CC26xx - Enable RX_NOK on DEBUG builds

Enabled the RX_NOK interrupt, if DEBUG or CC26XX_DEBUG_CRC are set
true, for the purpose of monitoring packets with bad CRC
This commit is contained in:
Billy Kozak 2015-07-20 10:47:06 -06:00
parent 512f9984b6
commit 35919f6836

View file

@ -92,6 +92,12 @@
#define PRINTF(...) #define PRINTF(...)
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef CC26XX_CONF_DEBUG_CRC
#define CC26XX_DEBUG_CRC CC26XX_CONF_DEBUG_CRC
#else /* CC26XX_CONF_DEBUG_CRC */
#define CC26XX_DEBUG_CRC DEBUG
#endif /* CC26XX_CONF_DEBUG_CRC */
/*---------------------------------------------------------------------------*/
/* Data entry status field constants */ /* Data entry status field constants */
#define DATA_ENTRY_STATUS_PENDING 0x00 /* Not in use by the Radio CPU */ #define DATA_ENTRY_STATUS_PENDING 0x00 /* Not in use by the Radio CPU */
#define DATA_ENTRY_STATUS_ACTIVE 0x01 /* Open for r/w by the radio CPU */ #define DATA_ENTRY_STATUS_ACTIVE 0x01 /* Open for r/w by the radio CPU */
@ -266,11 +272,16 @@ const output_config_t *tx_power_current = &output_power[0];
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* RF interrupts */ /* RF interrupts */
#define RX_IRQ IRQ_IEEE_RX_ENTRY_DONE #define RX_IRQ IRQ_IEEE_RX_ENTRY_DONE
#define RX_NOK_IRQ IRQ_IEEE_RX_NOK
#define TX_ACK_IRQ IRQ_IEEE_TX_ACK #define TX_ACK_IRQ IRQ_IEEE_TX_ACK
#define ERROR_IRQ IRQ_INTERNAL_ERROR #define ERROR_IRQ IRQ_INTERNAL_ERROR
/* Those IRQs are enabled all the time */ /* Those IRQs are enabled all the time */
#define ENABLED_IRQS (RX_IRQ + ERROR_IRQ) #if CC26XX_DEBUG_CRC
#define ENABLED_IRQS (RX_IRQ | ERROR_IRQ | RX_NOK_IRQ)
#else
#define ENABLED_IRQS (RX_IRQ | ERROR_IRQ)
#endif
/* /*
* We only enable this right before starting frame TX, so we can sleep while * We only enable this right before starting frame TX, so we can sleep while
@ -1055,6 +1066,13 @@ rx_isr(void)
process_poll(&cc26xx_rf_process); process_poll(&cc26xx_rf_process);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void
rx_nok_isr(void)
{
RIMESTATS_ADD(badcrc);
PRINTF("RF: Bad CRC\n");
}
/*---------------------------------------------------------------------------*/
void void
cc26xx_rf_cpe1_isr(void) cc26xx_rf_cpe1_isr(void)
{ {
@ -1093,7 +1111,11 @@ cc26xx_rf_cpe0_isr(void)
if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_IRQ) { if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_IRQ) {
rx_isr(); rx_isr();
} }
if(CC26XX_DEBUG_CRC) {
if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_NOK_IRQ) {
rx_nok_isr();
}
}
/* Clear interrupt flags */ /* Clear interrupt flags */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0; HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
ti_lib_int_master_enable(); ti_lib_int_master_enable();