420 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			420 lines
		
	
	
		
			14 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 _BB_CPU_MAC_INIT_H_
 | |
| #define _BB_CPU_MAC_INIT_H_
 | |
| 
 | |
| /* os shim includes */
 | |
| #include "os_types.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /*
 | |
|  structure for
 | |
|  aquiring different part of FC according to delimiter and proto
 | |
| */
 | |
| typedef struct _bb_cpu_rf_fc {
 | |
|     uint32_t dst_tei          : 12,
 | |
|              src_tei          : 12,
 | |
|              delimiter        : 4,
 | |
|              result_in_sack   : 4;
 | |
|     uint32_t nid              : 24,
 | |
|              rf_mcs           : 4,
 | |
|              rf_pb_sz_idx     : 4;
 | |
| } bb_cpu_rf_fc_t;
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_txq_ptr()  - get mac txq ptr.
 | |
|  * @param void                      - void
 | |
|  * @return uint32_t                 - txq ptr
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_txq_ptr();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_crc32_check()  - get need check crc32 or not.
 | |
|  * @param void                             - void
 | |
|  * @return uint32_t                        - need check crc32 or not
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_crc32_check();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_cur_hwqid()       - get hwqid.
 | |
|  * @param void                             - void
 | |
|  * @return uint32_t                        - hwq id.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_cur_hwqid();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_judge_cur_cmd_need_tx_tdma()  - judge current cmd need tx tdma.
 | |
|  * @param void                                     - void.
 | |
|  * @return uint32_t                                - need tx tdma or not.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_judge_cur_cmd_need_tx_tdma();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_judge_cur_cmd_need_tx_csma()  - judge current cmd need tx csma.
 | |
|  * @param void                                     - void.
 | |
|  * @return uint32_t                                - need tx csma or not.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_judge_cur_cmd_need_tx_csma();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_judge_next_cmd_is_vld()       - judge next cmd is vaild.
 | |
|  * @param void                                     - void.
 | |
|  * @return uint32_t                                - is vaild or not.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_judge_next_cmd_is_vld();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_judge_next_cmd_need_tx_tdma() - judge next cmd need tx tdma.
 | |
|  * @param void                                     - void.
 | |
|  * @return uint32_t                                - need tx tdma or not.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_judge_next_cmd_need_tx_tdma();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rest_slot_time()  - get the rest of slot time.
 | |
|  * @param void                             - void
 | |
|  * @return uint32_t                        - the rest of slot time, unit us.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rest_slot_time();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_inter_pkt_interval() - start cifs timer.
 | |
|  * @param interval                        - interval time. uint us.
 | |
|  * @return                                - void.
 | |
|  */
 | |
| void bb_cpu_mac_inter_pkt_interval(uint32_t interval);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_vcs_sts_from_isr() - set vcs status from isr.
 | |
|  * @param is_busy                           - is busy.
 | |
|  * @return void                             - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_vcs_sts_from_isr(uint32_t is_busy);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_vcs_sts()          - get vcs status.
 | |
|  * @param void                              - void.
 | |
|  * @return uint32_t                         - is busy or not.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_vcs_sts();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_tx_done() - bb cpu set tx done to rf mac
 | |
|  * @param void                     - void.
 | |
|  * @return void                    - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_tx_done();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_rx_done() - bb cpu set rx done to rf mac
 | |
|  * @param void                     - void.
 | |
|  * @return void                    - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_rx_done();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_tx_abort_done() - bb cpu set tx abort done to rf mac
 | |
|  * @param void                           - void.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_tx_abort_done();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_rx_abort_done() - bb cpu set rx abort done to rf mac
 | |
|  * @param void                           - void.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_rx_abort_done();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_sched_stop_done() - bb cpu set sched stop done to rf mac
 | |
|  * @param uint32_t                         - times.
 | |
|  * @return uint32_t                        - fsm.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_set_sched_stop_done(uint32_t times);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_csma_is_ready() - bb cpu set csma is ready to rf mac
 | |
|  * @param void                           - void.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_csma_is_ready();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_set_cmdlist_done()  - bb cpu set cmdlist is done to rf mac
 | |
|  * @param void                           - void.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_set_cmdlist_done();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_tx_timer_en()       - bb cpu tx timer enable
 | |
|  * @param enable                         - enable or not.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_tx_timer_en(uint32_t enable);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_trigger_tx()        - bb cpu trigger bb to tx
 | |
|  * @param phr                            - the point to phy header.
 | |
|  * @return uint32_t                      - tx ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_trigger_tx(uint32_t *phr);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_rx_timer_en()       - bb cpu rx timer enable
 | |
|  * @param enable                         - enable or not.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_rx_timer_en(uint32_t enable);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_trigger_rx()        - bb cpu trigger bb to rx
 | |
|  * @param void                           - void.
 | |
|  * @return void                          - void.
 | |
|  */
 | |
| void bb_cpu_mac_trigger_rx();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_stop_listen_timer_en() - bb cpu stop listen timer enable
 | |
|  * @param enable                            - enable or not.
 | |
|  * @return void                             - void.
 | |
|  */
 | |
| void bb_cpu_mac_stop_listen_timer_en(uint32_t enable);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_trigger_stop_listen()  - bb cpu trigger bb to stop listen
 | |
|  * @param void                              - void.
 | |
|  * @return void                             - void.
 | |
|  */
 | |
| void bb_cpu_mac_trigger_stop_listen();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_tx_complete_ntb()  - bb cpu mac get tx complete ntb.
 | |
|  * @param void                              - void.
 | |
|  * @return uint32_t                         - tx complete ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_tx_complete_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_tx_complete_local_ntb()
 | |
|  *                                      - bb cpu mac get tx complete local ntb.
 | |
|  * @param void                          - void.
 | |
|  * @return uint32_t                     - tx complete local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_tx_complete_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_stop_listen_ntb()
 | |
|  *                                      - bb cpu mac get stop listen ntb.
 | |
|  * @param void                          - void.
 | |
|  * @return uint32_t                     - stop listen ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_stop_listen_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_stop_listen_local_ntb()
 | |
|  *                                      - bb cpu mac get stop listen local ntb.
 | |
|  * @param void                          - void.
 | |
|  * @return uint32_t                     - stop listen local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_stop_listen_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_stf_ntb()   - bb cpu mac get rx stf ntb.
 | |
|  * @param void                          - void.
 | |
|  * @return uint32_t                     - rx stf ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_stf_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_stf_local_ntb()   - bb cpu mac get rx stf local ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx stf local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_stf_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_sig_ntb()         - bb cpu mac get rx sig ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx sig ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_sig_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_sig_local_ntb()   - bb cpu mac get rx sig local ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx sig local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_sig_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_phr_ntb()         - bb cpu mac get rx phr ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx phr ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_phr_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_phr_local_ntb()   - bb cpu mac get rx phr local ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx phr local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_phr_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_pld_start_ntb()   - bb cpu mac get rx pld ntb.
 | |
|  * @param void                                - void.
 | |
|  * @return uint32_t                           - rx pld ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_pld_start_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rx_pld_start_local_ntb()
 | |
|  *                                           - bb cpu mac get rx pld local ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - rx pld local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rx_pld_start_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rf_tx_ntb()         - bb cpu mac get rf tx ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - rf tx ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rf_tx_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_bb_tx_ntb()         - bb cpu mac get bb tx ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - bb tx ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_bb_tx_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rf_rx_ntb()         - bb cpu mac get rf rx ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - rf rx ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rf_rx_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_bb_rx_ntb()         - bb cpu mac get bb rx ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - bb rx ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_bb_rx_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_stop_rx_evt_ntb()   - bb cpu mac get stop rx evt ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - stop rx evt ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_stop_rx_evt_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rf_tx_local_ntb()   - bb cpu mac get rf tx local ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - rf tx local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rf_tx_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_bb_tx_local_ntb()   - bb cpu mac get bb tx local ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - bb tx local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_bb_tx_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_rf_rx_local_ntb()   - bb cpu mac get rf rx local ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - rf rx local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_rf_rx_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_bb_rx_local_ntb()   - bb cpu mac get bb rx local ntb.
 | |
|  * @param void                               - void.
 | |
|  * @return uint32_t                          - bb rx local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_bb_rx_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_hwq_cur_ptr()       - bb cpu mac get hwq current ptr.
 | |
|  * @param hwqid                              - hwq id 0 - 7.
 | |
|  * @return cur mpdu                          - current mpdu.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_hwq_cur_ptr(uint32_t hwqid);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_hwqfsm()            - bb cpu mac get hwq fsm.
 | |
|  * @param void                               - void.
 | |
|  * @return hwqfsm                            - hwq fsm.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_hwqfsm();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_stop_rx_evt_local_ntb()
 | |
|  *                                       - bb cpu mac get stop rx evt local ntb.
 | |
|  * @param void                           - void.
 | |
|  * @return uint32_t                      - stop rx evt local ntb.
 | |
|  */
 | |
| uint32_t bb_cpu_mac_get_stop_rx_evt_local_ntb();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_dma_start()        - dma start.
 | |
|  * @param bb_addr                   - dma to bb addr
 | |
|  * @param pb_addr                   - dma form pb addr
 | |
|  * @param byte_size                 - byte size of data
 | |
|  * @return void                     - void
 | |
|  */
 | |
| void bb_cpu_dma_start(uint32_t bb_addr, uint32_t pb_addr, uint32_t byte_size);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_dma_stop()         - dma stop.
 | |
|  * @return void                     - void
 | |
|  */
 | |
| void bb_cpu_dma_stop();
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_init() - initialize bb cpu mac.
 | |
|  *
 | |
|  * @param        none
 | |
|  *
 | |
|  * @return       none
 | |
|  */
 | |
| void bb_cpu_mac_init(void);
 | |
| 
 | |
| /**
 | |
|  * @brief bb_cpu_mac_get_msg_from_fc()      - get msg from phr.
 | |
|  * @param proto                             - protocol.
 | |
|  * @param phr                               - point to phr.
 | |
|  * @param msg                               - point to msg.
 | |
|  * @return void                             - void
 | |
|  */
 | |
| void bb_cpu_mac_get_msg_from_phr(uint32_t proto, void *phr,
 | |
|     bb_cpu_rf_fc_t *msg);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif // _BB_CPU_MAC_INIT_H_
 |