125 lines
4.1 KiB
C
125 lines
4.1 KiB
C
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
#ifndef MAC_RF_HWQ_MGR_H
|
|
#define MAC_RF_HWQ_MGR_H
|
|
#include "os_types.h"
|
|
#include "plc_utils.h"
|
|
#include "iot_config.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define INV_MAC_RF_HWQ_ID (uint8_t)(~0)
|
|
|
|
typedef enum _mac_rf_queue {
|
|
MAC_RF_QUE_BCN,
|
|
MAC_RF_QUE_CSMA_0,
|
|
MAC_RF_QUE_CSMA_1,
|
|
MAC_RF_QUE_CSMA_2,
|
|
MAC_RF_QUE_CSMA_3,
|
|
/* for some package of special needs */
|
|
MAC_RF_QUE_CSMA_DBG,
|
|
MAC_RF_QUE_BCSMA,
|
|
MAC_RF_QUE_TDMA,
|
|
MAX_MAC_RF_QUE_NUM
|
|
} mac_rf_queue_t;
|
|
|
|
/* define the max csma hwq cnt */
|
|
#define MAX_ENABLE_CSMA_HWQ (MAC_RF_QUE_CSMA_DBG + 1)
|
|
|
|
#define MAX_MAC_RF_TXQ_NUM MAX_MAC_RF_QUE_NUM /* 0 - 7 */
|
|
|
|
typedef struct _mac_rf_queue_ctxt {
|
|
/* the last available hwq id*/
|
|
uint8_t last_hwq_id;
|
|
/* store the hwq id for each swq type id */
|
|
uint8_t hwq_map[MAX_MAC_RF_QUE_NUM];
|
|
/* store the last desc for each hwq */
|
|
void *last_desc[MAX_MAC_RF_TXQ_NUM];
|
|
/* store the current sw handle ptr for each hwq */
|
|
void *cur_hdl_desc[MAX_MAC_RF_TXQ_NUM];
|
|
/* cur msdu ctxt for each hwq */
|
|
void *cur_msdu_ptr[MAX_MAC_RF_TXQ_NUM];
|
|
/*hwq depth*/
|
|
uint16_t q_depth[MAX_MAC_RF_TXQ_NUM];
|
|
/* hwq block */
|
|
uint8_t is_block_all_tx;
|
|
} mac_rf_queue_ctxt_t;
|
|
|
|
#if HPLC_RF_DEV_SUPPORT
|
|
|
|
/* init the hwq ctxt */
|
|
void mac_rf_q_init(mac_rf_queue_ctxt_t *queue);
|
|
|
|
/* get the real rf hwq mapping id
|
|
* @queue - hwq handler
|
|
* @mac_que - sw queue that designated
|
|
* return - the real rf hwq id that mapping to MAC HW if allocated
|
|
* INV_MAC_RF_HWQ_ID if not allocated
|
|
*/
|
|
uint8_t mac_rf_q_get_hwqid(mac_rf_queue_ctxt_t *queue,
|
|
mac_rf_queue_t qtype);
|
|
|
|
uint8_t mac_rf_q_alloc_hwq(mac_rf_queue_ctxt_t *queue,
|
|
mac_rf_queue_t qtype);
|
|
|
|
/* get the swq id from region type, lid
|
|
* return MAX_MAC_RF_QUE_NUM if error
|
|
*/
|
|
mac_rf_queue_t mac_rf_q_get_swq_type(uint32_t bcn_region_type,
|
|
lid_t lid, uint8_t is_dbg_tx);
|
|
|
|
/* get the rf swqid from lid info */
|
|
uint32_t mac_rf_q_get_swqid_from_lid(mac_rf_queue_ctxt_t *queue,
|
|
lid_t lid, uint8_t is_dbg_tx);
|
|
|
|
/* get the rf hwqid from swq id info */
|
|
uint32_t mac_rf_q_create_hwqid_from_swqid(mac_rf_queue_ctxt_t *queue,
|
|
mac_rf_queue_t swq_id);
|
|
|
|
/*
|
|
* @breif mac_rf_block_all_tx_ena() set hw block
|
|
* @param tx_ctxt the pointer of the hwq_ctxt
|
|
* @param uint32_t ena enable/disable]
|
|
* @return uint32_t ERR_OK
|
|
*/
|
|
uint32_t mac_rf_block_all_tx_ena(mac_rf_queue_ctxt_t *tx_ctxt, uint32_t ena);
|
|
|
|
/*
|
|
* @breif mac_rf_is_block_all_tx() - get is block tx status
|
|
* @param tx_ctxt the pointer of the hwq_ctxt
|
|
* @return uint32_t 0: false; other: true;
|
|
*/
|
|
uint32_t mac_rf_is_block_all_tx(mac_rf_queue_ctxt_t *tx_ctxt);
|
|
|
|
#else /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#define mac_rf_q_get_swq_type(bcn_region_type, lid, is_dbg_tx) \
|
|
MAX_MAC_RF_QUE_NUM; \
|
|
do { \
|
|
(void)(bcn_region_type); \
|
|
(void)(lid); \
|
|
(void)(is_dbg_tx); \
|
|
} while(0);
|
|
|
|
#endif /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif //MAC_HWQ_MGR_H
|