123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- #ifndef NRF_SDH_SOC_H__
- #define NRF_SDH_SOC_H__
- #include "sdk_common.h"
- #include "nrf_section_iter.h"
- #include "nrf_soc.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #if !(defined(__LINT__))
- #define NRF_SDH_SOC_OBSERVER(_name, _prio, _handler, _context) \
- STATIC_ASSERT(NRF_SDH_SOC_ENABLED, "NRF_SDH_SOC_ENABLED not set!"); \
- STATIC_ASSERT(_prio < NRF_SDH_SOC_OBSERVER_PRIO_LEVELS, "Priority level unavailable."); \
- NRF_SECTION_SET_ITEM_REGISTER(sdh_soc_observers, _prio, static nrf_sdh_soc_evt_observer_t _name) = \
- { \
- .handler = _handler, \
- .p_context = _context \
- }
- #define NRF_SDH_SOC_EVENT_OBSERVERS(_name, _prio, _handler, _context, _cnt) \
- STATIC_ASSERT(NRF_SDH_SOC_ENABLED, "NRF_SDH_SOC_ENABLED not set!"); \
- STATIC_ASSERT(_prio < NRF_SDH_SOC_OBSERVER_PRIO_LEVELS, "Priority level unavailable."); \
- NRF_SECTION_SET_ITEM_REGISTER(sdh_soc_observers, _prio, static nrf_sdh_soc_evt_observer_t _name[_cnt]) = \
- { \
- MACRO_REPEAT_FOR(_cnt, HANDLER_SET, _handler, _context) \
- }
- #if !(defined(DOXYGEN))
- #define HANDLER_SET(_idx, _handler, _context) \
- { \
- .handler = _handler, \
- .p_context = _context[_idx], \
- },
- #endif
- #else
- #define NRF_SDH_SOC_OBSERVER(A, B, C, D) static int semicolon_swallow_##A
- #define NRF_SDH_SOC_OBSERVERS(A, B, C, D, E) static int semicolon_swallow_##A
- #endif
- typedef void (*nrf_sdh_soc_evt_handler_t) (uint32_t evt_id, void * p_context);
- typedef struct
- {
- nrf_sdh_soc_evt_handler_t handler;
- void * p_context;
- } const nrf_sdh_soc_evt_observer_t;
- #ifdef __cplusplus
- }
- #endif
- #endif
|