Annex IRQ Callback Setter¶
In addition to the swc_hal_t
structure, the ported BSP must also provide callback setters to run Wireless Core code under specific IRQ event conditions. The functions below are part of the wireless_core interface in the BSP. The code block below illustrates the EVK1.4 hardware implementation which needs to be ported to the new hardware.
swc_radio_irq_handler¶
This is a Wireless Core function that must be called every time the transceiver IRQ pin triggers an interruption. To do so, the BSP must provide a callback setter function.
In the SDK, this is implemented by this EVK BSP function:
-
void evk_set_radio_irq_callback(irq_callback callback)¶
This function sets the function callback for the radio pin interrupt.
- Parameters
callback – [in] External interrupt callback function pointer.
swc_radio_spi_receive_complete_handler¶
This is a Wireless Core function that must be called every time SPI DMA RX transfer complete triggers an interruption. To do so, the BSP must provide a callback setter function.
In the SDK, this is implemented by this EVK BSP function:
-
void evk_set_radio_dma_rx_callback(irq_callback callback)¶
This function sets the function callback for the DMA_RX ISR.
- Parameters
callback – [in] External interrupt callback function pointer.
swc_connection_callbacks_processing_handler¶
This is a Wireless Core function that must be called every time there is a context switch in the MCU. To do so, the BSP must provide a callback setter function. The EVK1.4 platform uses an ARM Cortex MCU which has a built-in interrupt-driven request for system-level service called PendSV.
In the SDK, this is implemented by this EVK BSP function:
-
void evk_set_pendsv_callback(irq_callback callback)¶
This function sets the function callback for the pendsv.
- Parameters
callback – [in] External interrupt callback function pointer.
41void iface_swc_handlers_init(void)
42{
43 evk_set_radio_irq_callback(swc_radio_irq_handler);
44 evk_set_radio_dma_rx_callback(swc_radio_spi_receive_complete_handler);
45 evk_set_pendsv_callback(swc_connection_callbacks_processing_handler);
46}
Note
The pulsar name is a placeholder name since the EVK1.4 does not support dual-transceiver operations.
void iface_swc_handlers_init(void)
{
#if (WPS_RADIO_COUNT == 1)
pulsar_it_set_radio_1_irq_callback(swc_radio_irq_handler);
pulsar_it_set_radio_1_dma_rx_callback(swc_radio_spi_receive_complete_handler);
#elif (WPS_RADIO_COUNT == 2)
pulsar_it_set_radio_1_irq_callback(swc_radio1_irq_handler);
pulsar_it_set_radio_1_dma_rx_callback(swc_radio1_spi_receive_complete_handler);
pulsar_it_set_radio_2_irq_callback(swc_radio2_irq_handler);
pulsar_it_set_radio_2_dma_rx_callback(swc_radio2_spi_receive_complete_handler);
pulsar_it_set_multi_radio_callback(swc_radio_synchronization_timer_callback);
#else
#error "Number of radios must be either 1 or 2"
#endif
pulsar_it_set_pendsv_callback(swc_connection_callbacks_processing_handler);
}
#if (WPS_RADIO_COUNT == 2)
void iface_swc_dual_radio_timer_init(void)
{
pulsar_timer_multi_radio_timer_init();
}
swc_radio_synchronization_timer_callback
Once the timer reaches the compare value, the triggered interruption will be served with this function. To do so, the BSP must provide a callback setter for this IRQ.
In the SDK, this is implemented by this Pulsar BSP function:
-
void pulsar_it_set_multi_radio_callback(irq_callback callback)¶
Set Multi-Radio callback.
- Parameters
callback – [in] Radio MCU timer callback.