123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- #ifndef NRFX_GLUE_H__
- #define NRFX_GLUE_H__
- #include <sys/__assert.h>
- #include <sys/atomic.h>
- #include <irq.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifndef NRFX_ASSERT
- #define NRFX_ASSERT(expression) __ASSERT_NO_MSG(expression)
- #endif
- #define NRFX_STATIC_ASSERT(expression) \
- BUILD_ASSERT(expression, "assertion failed")
- #define NRFX_IRQ_PRIORITY_SET(irq_number, priority)
-
-
- #define NRFX_IRQ_ENABLE(irq_number) irq_enable(irq_number)
- #define NRFX_IRQ_IS_ENABLED(irq_number) irq_is_enabled(irq_number)
- #define NRFX_IRQ_DISABLE(irq_number) irq_disable(irq_number)
- #define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number)
- #define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number)
- #define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1)
- #define NRFX_CRITICAL_SECTION_ENTER() { unsigned int irq_lock_key = irq_lock();
- #define NRFX_CRITICAL_SECTION_EXIT() irq_unlock(irq_lock_key); }
- #define NRFX_DELAY_DWT_BASED 0
- #define NRFX_DELAY_US(us_time) nrfx_busy_wait(us_time)
- void nrfx_busy_wait(uint32_t usec_to_wait);
- #define nrfx_atomic_t atomic_t
- #define NRFX_ATOMIC_FETCH_STORE(p_data, value) atomic_set(p_data, value)
- #define NRFX_ATOMIC_FETCH_OR(p_data, value) atomic_or(p_data, value)
- #define NRFX_ATOMIC_FETCH_AND(p_data, value) atomic_and(p_data, value)
- #define NRFX_ATOMIC_FETCH_XOR(p_data, value) atomic_xor(p_data, value)
- #define NRFX_ATOMIC_FETCH_ADD(p_data, value) atomic_add(p_data, value)
- #define NRFX_ATOMIC_FETCH_SUB(p_data, value) atomic_sub(p_data, value)
- #define NRFX_CUSTOM_ERROR_CODES 0
- #define NRFX_EVENT_READBACK_ENABLED 1
- #define NRFX_DPPI_CHANNELS_USED (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | \
- NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \
- NRFX_PPI_CHANNELS_USED_BY_MPSL)
- #define NRFX_DPPI_GROUPS_USED (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | \
- NRFX_PPI_GROUPS_USED_BY_802154_DRV | \
- NRFX_PPI_GROUPS_USED_BY_MPSL)
- #define NRFX_PPI_CHANNELS_USED (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | \
- NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \
- NRFX_PPI_CHANNELS_USED_BY_MPSL | \
- NRFX_PPI_CHANNELS_USED_BY_PWM_SW)
- #define NRFX_PPI_GROUPS_USED (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | \
- NRFX_PPI_GROUPS_USED_BY_802154_DRV | \
- NRFX_PPI_GROUPS_USED_BY_MPSL)
- #define NRFX_GPIOTE_CHANNELS_USED NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW
- #if defined(CONFIG_BT_CTLR)
- extern const uint32_t z_bt_ctlr_used_nrf_ppi_channels;
- extern const uint32_t z_bt_ctlr_used_nrf_ppi_groups;
- #define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR z_bt_ctlr_used_nrf_ppi_channels
- #define NRFX_PPI_GROUPS_USED_BY_BT_CTLR z_bt_ctlr_used_nrf_ppi_groups
- #else
- #define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0
- #define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0
- #endif
- #if defined(CONFIG_NRF_802154_RADIO_DRIVER)
- extern const uint32_t g_nrf_802154_used_nrf_ppi_channels;
- extern const uint32_t g_nrf_802154_used_nrf_ppi_groups;
- #define NRFX_PPI_CHANNELS_USED_BY_802154_DRV g_nrf_802154_used_nrf_ppi_channels
- #define NRFX_PPI_GROUPS_USED_BY_802154_DRV g_nrf_802154_used_nrf_ppi_groups
- #else
- #define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0
- #define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0
- #endif
- #if defined(CONFIG_NRF_802154_RADIO_DRIVER) && \
- !defined(CONFIG_NRF_802154_SL_OPENSOURCE)
- extern const uint32_t z_mpsl_used_nrf_ppi_channels;
- extern const uint32_t z_mpsl_used_nrf_ppi_groups;
- #define NRFX_PPI_CHANNELS_USED_BY_MPSL z_mpsl_used_nrf_ppi_channels
- #define NRFX_PPI_GROUPS_USED_BY_MPSL z_mpsl_used_nrf_ppi_groups
- #else
- #define NRFX_PPI_CHANNELS_USED_BY_MPSL 0
- #define NRFX_PPI_GROUPS_USED_BY_MPSL 0
- #endif
- #if defined(CONFIG_PWM_NRF5_SW)
- #define PWM_NRF5_SW_NODE DT_INST(0, nordic_nrf_sw_pwm)
- #define PWM_NRF5_SW_GENERATOR_NODE DT_PHANDLE(PWM_NRF5_SW_NODE, generator)
- #if DT_NODE_HAS_COMPAT(PWM_NRF5_SW_GENERATOR_NODE, nordic_nrf_rtc)
- #define PWM_NRF5_SW_PPI_CHANNELS_PER_PIN 3
- #else
- #define PWM_NRF5_SW_PPI_CHANNELS_PER_PIN 2
- #endif
- #define NRFX_PPI_CHANNELS_USED_BY_PWM_SW \
- (BIT_MASK(DT_PROP(PWM_NRF5_SW_NODE, channel_count) * \
- PWM_NRF5_SW_PPI_CHANNELS_PER_PIN) \
- << DT_PROP(PWM_NRF5_SW_NODE, ppi_base))
- #define NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW \
- DT_PROP(PWM_NRF5_SW_NODE, channel_count)
- #else
- #define NRFX_PPI_CHANNELS_USED_BY_PWM_SW 0
- #define NRFX_GPIOTE_CHANNELS_USED_BY_PWM_SW 0
- #endif
- #define NRFX_EGUS_USED 0
- #define NRFX_TIMERS_USED 0
- void nrfx_isr(const void *irq_handler);
- #if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
- #include "nrfx_glue_bsim.h"
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|