123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #include "sdk_common.h"
- #if NRF_MODULE_ENABLED(NRF_SDH_SOC)
- #include "nrf_sdh_soc.h"
- #include "nrf_sdh.h"
- #include "nrf_soc.h"
- #include "app_error.h"
- #define NRF_LOG_MODULE_NAME nrf_sdh_soc
- #if NRF_SDH_SOC_LOG_ENABLED
- #define NRF_LOG_LEVEL NRF_SDH_SOC_LOG_LEVEL
- #define NRF_LOG_INFO_COLOR NRF_SDH_SOC_INFO_COLOR
- #define NRF_LOG_DEBUG_COLOR NRF_SDH_SOC_DEBUG_COLOR
- #else
- #define NRF_LOG_LEVEL 0
- #endif
- #include "nrf_log.h"
- NRF_LOG_MODULE_REGISTER();
- NRF_SECTION_SET_DEF(sdh_soc_observers, nrf_sdh_soc_evt_observer_t, NRF_SDH_SOC_OBSERVER_PRIO_LEVELS);
- static void nrf_sdh_soc_evts_poll(void * p_context)
- {
- ret_code_t ret_code;
- UNUSED_VARIABLE(p_context);
- while (true)
- {
- uint32_t evt_id;
- ret_code = sd_evt_get(&evt_id);
- if (ret_code != NRF_SUCCESS)
- {
- break;
- }
- NRF_LOG_DEBUG("SoC event: 0x%x.", evt_id);
-
- nrf_section_iter_t iter;
- for (nrf_section_iter_init(&iter, &sdh_soc_observers);
- nrf_section_iter_get(&iter) != NULL;
- nrf_section_iter_next(&iter))
- {
- nrf_sdh_soc_evt_observer_t * p_observer;
- nrf_sdh_soc_evt_handler_t handler;
- p_observer = (nrf_sdh_soc_evt_observer_t *) nrf_section_iter_get(&iter);
- handler = p_observer->handler;
- handler(evt_id, p_observer->p_context);
- }
- }
- if (ret_code != NRF_ERROR_NOT_FOUND)
- {
- APP_ERROR_HANDLER(ret_code);
- }
- }
- NRF_SDH_STACK_OBSERVER(m_nrf_sdh_soc_evts_poll, NRF_SDH_SOC_STACK_OBSERVER_PRIO) =
- {
- .handler = nrf_sdh_soc_evts_poll,
- .p_context = NULL,
- };
- #endif
|