313 lines
9.9 KiB
C
313 lines
9.9 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 RF_MAC_ISR_H
|
|
#define RF_MAC_ISR_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
|
|
/* driver includes */
|
|
#include "iot_irq.h"
|
|
#include "mac_isr.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/***********************************************************
|
|
* NTOD: hw interrupt show CFG_RF_MAC_COMMON_INT_REG_0_ADDR.
|
|
* sw interrupt show CFG_RF_MAC_COMMON_INT_REG_20_ADDR.
|
|
* share interrupt show CFG_RF_MAC_COMMON_INT_REG_10_ADDR.
|
|
* hw interrupt are interrupts generated by RFMAC;
|
|
* sw interrupt are interrupts generated by SW;
|
|
* share interrupt indicates the status of txq and rxRing,
|
|
* share interrupt is just a status register;
|
|
************************************************************/
|
|
|
|
/* HW interruption id */
|
|
/* generate from bb cpu when bb rx done, bb cpu -> rf mac -> main cpu.
|
|
* NOTE: don't care about the interruption.
|
|
*/
|
|
#define RF_MAC_ISR_RX_DONE_ID 0
|
|
|
|
/* generate from bb cpu when bb tx done, bb cpu -> rf mac -> main cpu.
|
|
* NOTE: don't care about the interruption.
|
|
*/
|
|
#define RF_MAC_ISR_TX_DONE_ID 1
|
|
|
|
/* generate from rf mac near the end of cmdlist, rf mac -> main cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BC_ALERT_ID 2
|
|
|
|
/* generate from rf mac when backoff start, rf mac -> bb cpu.
|
|
* NOTE: don't care about the interruption.
|
|
*/
|
|
#define RF_MAC_ISR_BACKOFF_START_ID 3
|
|
|
|
/* generate from rf mac when backoff start, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BACKOFF_TIMEOUT_ID 4
|
|
|
|
/* generate from rf mac when tx start, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_TX_START_ID 5
|
|
|
|
/* generate from rf mac when rx start, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_RX_START_ID 6
|
|
|
|
/* generate from rf mac when tx abort, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_TX_ABORT_ID 7
|
|
|
|
/* generate from rf mac when rx abort, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_RX_ABORT_ID 8
|
|
|
|
/* generate from rf mac when txq ptr is null, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu or main cpu.
|
|
*/
|
|
#define RF_MAC_ISR_TXQ_PTR_ERR_ID 9
|
|
|
|
/* generate from bb when tx complete, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_TX_DONE_ID 10
|
|
|
|
/* generate from bb when bb force listen stop, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_STOP_LISTEN_ID 11
|
|
|
|
/* generate from bb when bb rx stf, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_RX_STF_ID 12
|
|
|
|
/* generate from bb when bb rx sig, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_RX_SIG_ID 13
|
|
|
|
/* generate from bb when bb rx phr, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_RX_PHR_ID 14
|
|
|
|
/* generate from bb when bb rx pld start, rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_BB_RX_PLD_START_ID 15
|
|
|
|
/* generate from main cpu when main cpu need stop schedule,
|
|
* main cpu -> rf mac -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_EARLY_STOP_START_ID 16
|
|
|
|
/* generate from bb cpu when early done, bb cpu -> rf mac -> main cpu.
|
|
* NOTE: use by main cpu or not care.
|
|
*/
|
|
#define RF_MAC_ISR_EARLY_STOP_DONE_ID 17
|
|
|
|
/* generate from rf mac when cmdlist done, rf mac -> main cpu/bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_CMDLIST_DONE_ID 18
|
|
|
|
/* generate from rf mac when cmd done, rf mac -> main cpu/bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_ISR_CMD_DONE_ID 19
|
|
|
|
/* NOTE:keep this the same as the last hw valid ISR ID */
|
|
#define RF_MAC_ISR_HW_MAX_ID RF_MAC_ISR_CMD_DONE_ID
|
|
|
|
/*****************************************************************
|
|
* NOTE: 1.the interrupt handled in dsr are interrupted by sw interrupt.
|
|
* sw interrupt id 0 ~ 31 bit use driver of sw interrupt.
|
|
* 2.interrupt functions that require immediate processing are
|
|
* interrupted with timers.
|
|
* sw interrupt id 32 ~ 63 bit use driver of timer interrupt.
|
|
****************************************************************/
|
|
|
|
/* NOTE: SW interruption id */
|
|
/* generate from main cpu when init bb set option, main cpu -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_BB_INIT 0
|
|
|
|
/* generate from main cpu when set channel, main cpu -> bb cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_SET_CHANNEL 1
|
|
|
|
/* generate from bb cpu when tx mpdu complete, bb cpu -> main cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_TX_MPDU_COMPLETE 2
|
|
|
|
/* generate from bb cpu when rx mpdu complete, bb cpu -> main cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_RX_MPDU_COMPLETE 3
|
|
|
|
/* generate from main cpu when trigger hwq, main cpu -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_CSMA_TX_CHECK 4
|
|
|
|
/* generate from main cpu when config spi, main cpu -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_SYNC_SPI_VALUE 5
|
|
|
|
/* generate from main cpu when tx tone, main cpu -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_TX_TONE 6
|
|
|
|
/* generate from main cpu when set power save idle, main cpu -> bb cpu.
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_SET_PS_IDLE 7
|
|
/* generate from main cpu when tx calibration register need update,
|
|
* NOTE: use by bb cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_TX_CAL_UPDATE 8
|
|
|
|
/* sw int id max */
|
|
#define RF_MAC_SW_INT_MAX 32
|
|
|
|
/* generate from bb cpu when cmdlist real done, bb cpu -> main cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_CMDLIST_BBCPU_DONE 32
|
|
|
|
/* generate from bb cpu when set hplc pcs, bb cpu -> main cpu.
|
|
* NOTE: use by main cpu.
|
|
*/
|
|
#define RF_MAC_SW_ISR_SET_HPLC_PCS 33
|
|
|
|
/* timer int id max */
|
|
#define RF_MAC_SW2_INT_MAX 64
|
|
|
|
typedef struct _rf_mac_isr_ctx {
|
|
/* irq handler for HAL_VECTOR_RFMAC_INT0/HAL_VECTOR_RFMAC_INT1 */
|
|
iot_irq_t isr_hw_h;
|
|
/* irq handler for HAL_VECTOR_RFMAC_SHARE_INT0/HAL_VECTOR_RFMAC_SHARE_INT1 */
|
|
iot_irq_t isr_sw_h;
|
|
/* irq handler for HAL_VECTOR_RFMAC_SHARE_INT0/HAL_VECTOR_RFMAC_SHARE_INT1 */
|
|
iot_irq_t isr_timer_h;
|
|
/* interrupt mask low32 int reg cache, use by hw */
|
|
uint32_t isr_hw_mask;
|
|
/* interrupt mask share int reg cache, use by sw */
|
|
uint32_t isr_sw_mask;
|
|
/* interrupt mask share int reg cache, use by sw */
|
|
uint32_t isr_timer_mask;
|
|
/* callback to receive dsr events */
|
|
dsr_notification_func_t rf_dsr_callback;
|
|
} rf_mac_isr_ctx_t;
|
|
|
|
/**
|
|
* @brief mac_rf_hw_isr_enable() - mac rf hw isr enable.
|
|
* @param id - irq id
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_hw_isr_enable(uint8_t id);
|
|
|
|
/**
|
|
* @brief mac_rf_sw_isr_enable() - mac rf sw isr enable.
|
|
* @param id - irq id
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_sw_isr_enable(uint8_t id);
|
|
|
|
/**
|
|
* @brief mac_rf_hw_isr_disable() - mac rf hw isr disenable.
|
|
* @param id - irq id
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_hw_isr_disable(uint8_t id);
|
|
|
|
/**
|
|
* @brief mac_rf_sw_isr_disable() - mac rf sw isr disenable.
|
|
* @param id - irq id
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_sw_isr_disable(uint8_t id);
|
|
|
|
/**
|
|
* @brief mac_rf_set_sw_irq_to_bbcpu() - mac rf set sw irq to bbcpu.
|
|
* @param id - irq id
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_set_sw_irq_to_bbcpu(uint8_t id);
|
|
|
|
/**
|
|
* @brief mac_rf_get_share_interrupt_sts() - mac rf get share intrrupt status.
|
|
* @param id - irq id
|
|
* @return irq_sts - irq status
|
|
*/
|
|
uint32_t mac_rf_get_share_interrupt_sts();
|
|
|
|
/**
|
|
* @brief mac_rf_clear_share_interrupt() - mac rf clear share intrrupt status.
|
|
* @param irq_sts - irq status
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_clear_share_interrupt(uint32_t irq_sts);
|
|
|
|
/**
|
|
* @brief mac_rf_isr_start() - mac rf isr start.
|
|
* @param void - void
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_isr_start();
|
|
|
|
/**
|
|
* @brief mac_rf_dsr_isr_start() - mac rf dsr handle isr start.
|
|
* @param void - void
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_dsr_isr_start();
|
|
|
|
/**
|
|
* @brief mac_rf_get_dsr_callback() - mac rf get dsr callback.
|
|
* @param void - void
|
|
* @return dsr_notification_func_t - callback.
|
|
*/
|
|
dsr_notification_func_t mac_rf_get_dsr_callback();
|
|
|
|
/**
|
|
* @brief mac_rf_isr_init() - mac rf isr init.
|
|
* @param callback - callback function.
|
|
* @return void - void
|
|
*/
|
|
void mac_rf_isr_init(dsr_notification_func_t callback);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MAC_ISR_H */
|