320 lines
9.5 KiB
C
320 lines
9.5 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_TXQ_HW_H
|
|
#define MAC_TXQ_HW_H
|
|
#include "os_types.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define MAX_MAC_TXQ_NUM 24 /* 0 - 23 */
|
|
#define MAX_MAC_DCU_NUM 5 /* 0 - 4 */
|
|
|
|
#define HWQ_DEBUG_MODE 1
|
|
#define HWQ_SCHE_MODE 0
|
|
|
|
/* mac pcs busy timeout value */
|
|
#define MAC_PCS_BUSY_TIMEOUT 2000
|
|
|
|
/* mac pcs idle timeout value */
|
|
#define MAC_PCS_IDLE_TIMEOUT 2000
|
|
|
|
/**
|
|
* @brief mac_tx_cfg_bcn_miss_num() - set hw rx mode both sr and qr
|
|
*/
|
|
void mac_rx_sr_qr_mode_set();
|
|
|
|
/**
|
|
* @brief mac_tx_cfg_bcn_miss_num() - config tx beacon miss num
|
|
* @param: num -- miss beacon num
|
|
*/
|
|
void mac_tx_cfg_bcn_miss_num(uint32_t num);
|
|
|
|
/**
|
|
* @brief cfg_phy_tx_phase_select() - force tx phase
|
|
* @param: enable -- 1:enable 0:disable
|
|
* @param: phase -- 0:all phase, 1:A , 2:B , 3:C
|
|
*/
|
|
void cfg_phy_tx_phase_select(uint32_t enable, uint32_t phase);
|
|
|
|
/**
|
|
* @brief mac_cfg_phy_tx_underflow_force() - force phy tx underflow.
|
|
*
|
|
* @param none
|
|
*
|
|
* @return none
|
|
*/
|
|
void mac_cfg_phy_tx_underflow_force(void);
|
|
|
|
/* set the cfg of the specific qid */
|
|
void mac_txq_cfg(uint32_t qid, uint32_t cap, \
|
|
uint32_t is_csma);
|
|
|
|
void *mac_txq_get_curr_desc_ptr(uint8_t is_role_cco, uint8_t is_bcn);
|
|
|
|
/* enable the queue with the first tx desc */
|
|
void mac_txq_enable(uint32_t qid, void *tx_desc);
|
|
|
|
/* if enable, return none-zero
|
|
* else, return 0
|
|
*/
|
|
uint32_t mac_txq_is_enable(uint32_t qid);
|
|
|
|
/* get txq tx comp status bitmap */
|
|
uint32_t mac_txq_get_txcomp_status();
|
|
|
|
/* clr the hwq txcomp */
|
|
void mac_txq_clr_txcomp_status(uint32_t hwqid);
|
|
|
|
/* enable/disable txq dbg mode */
|
|
void mac_txq_set_dbg_mode(uint32_t is_dbg);
|
|
|
|
/* set the txq poll interval, us unit */
|
|
uint32_t mac_txq_set_poll_intval(uint32_t intvl_us);
|
|
|
|
/* set the packet in hwq immediately */
|
|
uint32_t mac_txq_trigger_send(uint32_t qid);
|
|
|
|
uint32_t mac_tx_hw_get_bcn_swcrc_cfg();
|
|
|
|
void mac_tx_hw_set_bcn_swcrc_cfg(uint32_t is_by_sw);
|
|
|
|
/* check if dbg mode */
|
|
uint32_t mac_txq_is_dbg_mode();
|
|
|
|
void mac_tx_cfg_start_desc_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_tx_cfg_end_desc_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_tx_cfg_phy_tx_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_tx_cfg_aes_key_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_tx_cfg_buf_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_tx_cfg_desc_timeout(uint32_t enable, uint32_t time_us);
|
|
|
|
void mac_txq_cfg_tdma_do_cca(uint32_t enable);
|
|
|
|
void mac_txq_clr_all_txcomp_status(uint32_t bitmap);
|
|
|
|
uint32_t mac_txq_is_csma(uint32_t qid);
|
|
|
|
void mac_set_slottime(uint32_t cap, uint32_t time_us);
|
|
|
|
void mac_set_tx_bts_dly(int32_t delay_ntb);
|
|
|
|
/**
|
|
* @brief mac_set_min_backoff_slotnum() -
|
|
* set 2^x of min backoff be value
|
|
* @param tmr: 2^(_2_be)
|
|
*/
|
|
void mac_set_min_backoff_slotnum(uint32_t _2_be);
|
|
|
|
/**
|
|
* @brief mac_tx_rx_common_rifs_tmr_set() - set common RIFS time.
|
|
* @param tmr: RIFS time(us)
|
|
*/
|
|
void mac_tx_rx_common_rifs_tmr_set(uint32_t tmr);
|
|
|
|
/**
|
|
* @brief mac_only_tx_rifs_tmr_set() - set tx RIFS time.
|
|
* @param tmr: RIFS time(us)
|
|
*/
|
|
void mac_only_tx_rifs_tmr_set(uint32_t tmr);
|
|
|
|
/**
|
|
* @brief mac_only_rx_rifs_tmr_set() - set rx RIFS time.
|
|
* @param tmr: RIFS time(us)
|
|
*/
|
|
void mac_only_rx_rifs_tmr_set(uint32_t tmr);
|
|
|
|
/**
|
|
* @brief mac_cfg_cifs_tmr_init init cifs config
|
|
* @param proto: current protocol, see PLC_PROTO_TYPE_XXX
|
|
* @return none
|
|
*/
|
|
void mac_cfg_cifs_tmr_init(uint32_t proto);
|
|
|
|
/**
|
|
* @brief mac_cfg_rifs_tmr_init init rifs config
|
|
* @param is_cert: 0 - normal mode case, others - cert mode case
|
|
* @param proto: current protocol, see PLC_PROTO_TYPE_XXX
|
|
* @return none
|
|
*/
|
|
void mac_cfg_rifs_tmr_init(uint8_t is_cert, uint32_t proto);
|
|
|
|
/**
|
|
* @brief mac_set_fc_fl_cfg_status() - set sw cfg fc frame len
|
|
* @param flag 0 : hw cfg, 1 : sw cfg
|
|
*/
|
|
void mac_set_fc_fl_cfg_status(uint8_t flag);
|
|
|
|
/**
|
|
* @brief mac_get_fc_fl_cfg_status() - get fc frame len cfg status
|
|
* @return 0 : hw cfg, 1 : sw cfg
|
|
*/
|
|
uint32_t mac_get_fc_fl_cfg_status();
|
|
|
|
/**
|
|
* @brief mac_get_tx_cifs() - get tx cifs value
|
|
* @return cifs value
|
|
*/
|
|
uint32_t mac_get_tx_cifs();
|
|
|
|
/**
|
|
* @brief mac_get_tx_rifs() - get tx rifs value
|
|
* @return rifs value
|
|
*/
|
|
uint32_t mac_get_tx_rifs();
|
|
|
|
/* @brief mac_get_tx_bifs() - get tx bifs value
|
|
* @param proto current porotocol, see PLC_PROTO_TYPE_XXX
|
|
* @return: bifs value - us
|
|
*/
|
|
uint32_t mac_get_tx_bifs(uint32_t proto);
|
|
|
|
/**
|
|
* @brief set cifs time
|
|
* @param tmr - [value of us unit time]
|
|
* @return - [none]
|
|
*/
|
|
void mac_tx_cifs_tmr_set(uint32_t tmr);
|
|
|
|
/**
|
|
* @brief set bifs time
|
|
* @param proto [current porotocol, see PLC_PROTO_TYPE_XXX]
|
|
* @param tmr [value of us unit time]
|
|
* @return - [none]
|
|
*/
|
|
void mac_tx_bifs_tmr_set(uint32_t proto, uint32_t tmr);
|
|
|
|
/**
|
|
*@brief mac_tx_hw_set_delay set count, and used to sw delay .
|
|
*@param tmr [delay time]
|
|
*@exception [none.]
|
|
*@return [none.]
|
|
*/
|
|
void mac_tx_hw_set_delay(uint32_t tmr);
|
|
|
|
/**
|
|
*@brief mac_tx_hw_get_delay get count, used to sw delay.
|
|
*@exception [none.]
|
|
*@return [get time]
|
|
*/
|
|
uint32_t mac_tx_hw_get_delay();
|
|
|
|
/**
|
|
* @brief mac_get_sche_rx_phase get schedule rx phase
|
|
* @param tmr - [value of us unit time]
|
|
* @return - [rx phase]
|
|
*/
|
|
uint32_t mac_get_sche_rx_phase();
|
|
|
|
/**
|
|
* @brief mac_set_cca_pcs_busy_timeout_ms -this api is to set
|
|
* the timeout ms value of cca's pcs busy, because the isr maybe trigger
|
|
* if the value is too small, so we need to set the value before the isr enabled
|
|
* @param uint32_t ena -enable / disable.
|
|
* @param uint32_t time_ms -timeout value.
|
|
* @return -0
|
|
*/
|
|
uint32_t mac_set_cca_pcs_busy_timeout_ms(uint32_t ena, uint32_t time_ms);
|
|
|
|
/**
|
|
* @brief mac_set_cca_pcs_idle_timeout_ms -this api is to set
|
|
* the timeout ms value of cca's pcs idle, because the isr maybe trigger
|
|
* if the value is too small, so we need to set the value before the isr enabled
|
|
* @param uint32_t ena -enable / disable.
|
|
* @param uint32_t time_ms -timeout value.
|
|
* @return -0
|
|
*/
|
|
uint32_t mac_set_cca_pcs_idle_timeout_ms(uint32_t ena, uint32_t time_ms);
|
|
|
|
/**
|
|
* @brief mac_cca_pcs_busy_isr_enable -pcs busy isr enable.
|
|
* @param uint32_t pri -intterupte priority addr.
|
|
* @return -none.
|
|
*/
|
|
void mac_cca_pcs_busy_isr_enable(uint32_t pri);
|
|
|
|
/**
|
|
* @brief mac_cca_pcs_busy_isr_disable -pcs busy isr disable.
|
|
* @param uint32_t pri -intterupte priority.
|
|
* @return -none.
|
|
*/
|
|
void mac_cca_pcs_busy_isr_disable(uint32_t pri);
|
|
|
|
/**
|
|
* @brief mac_cca_pcs_idle_isr_enable -pcs idle isr enable.
|
|
* @param uint32_t pri -intterupte priority.
|
|
* @return -none.
|
|
*/
|
|
void mac_cca_pcs_idle_isr_enable(uint32_t pri);
|
|
|
|
/**
|
|
* @brief mac_cca_pcs_idle_isr_disable -pcs busy isr disable.
|
|
* @param uint32_t pri -intterupte priority.
|
|
* @return -none.
|
|
*/
|
|
void mac_cca_pcs_idle_isr_disable(uint32_t pri);
|
|
|
|
/**
|
|
* @brief mac_cca_get_int_sts -get cca int.
|
|
* @param uint32_t pri -intterupte priority.
|
|
* @return uint32_t -int status.
|
|
*/
|
|
uint32_t mac_cca_get_int_sts(uint32_t pri);
|
|
|
|
/**
|
|
* @brief mac_cca_int_clear -cca int clear.
|
|
* @param uint32_t pri -intterupte priority addr.
|
|
* @param uint32_t int_sts -int status.
|
|
* @return -0.
|
|
*/
|
|
uint32_t mac_cca_int_clear(uint32_t pri, uint32_t int_sts);
|
|
|
|
/**
|
|
* @brief mac_tx_cfg_cmd_slot_guard_interval used for calculate if this
|
|
frame may cross scheduler command
|
|
* @param uint32_t hw_write_time time for hw write mpdu end. uint us.
|
|
*/
|
|
void mac_tx_cfg_cmd_slot_guard_interval(uint32_t hw_write_time);
|
|
|
|
/**
|
|
* @brief mac_tx_get_cmd_slot_guard_interval get cmd slot guard time.
|
|
* @return time for hw write mpdu end.
|
|
* uint: us.
|
|
*/
|
|
uint32_t mac_tx_get_cmd_slot_guard_interval(void);
|
|
|
|
/**
|
|
* @brief mac_tx_phy_sts_filter -tx filter enable config.
|
|
* @param uint32_t filter_en -filter enable.
|
|
* @param uint32_t err0_en -error update 0 enable.
|
|
* @param uint32_t err1_en -error update 1 enable.
|
|
* @return -0.
|
|
*/
|
|
uint32_t mac_tx_phy_sts_filter( \
|
|
bool_t filter_en, bool_t err0_en, bool_t err1_en);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // !MAC_TXQ_HW_H
|