Smart Remote 3 nRF52 v1.2
app_isched.h
1 /*$$$LICENCE_NORDIC_STANDARD<2016>$$$*/
2 
3 #ifndef APP_ISCHED_H__
4 #define APP_ISCHED_H__
5 
6 #include "nrf_queue.h"
7 
15 // Forward declaration of __app_isched_struct.
16 struct __app_isched_struct;
17 
23 
25 typedef void (*app_isched_event_handler_t)(void *p_context);
26 
28 typedef struct
29 {
31  void *p_context;
33 
35 typedef void (*app_isched_hook_t)(const app_isched_t *p_isched,
36  const app_isched_event_t *p_evt,
37  void *p_hook_context);
38 
40 typedef enum
41 {
47  // This must be the last value.
48  APP_ISCHED_HOOKS_COUNT,
50 
53 {
54  const nrf_queue_t *p_event_queue;
55  app_isched_hook_t hooks[APP_ISCHED_HOOKS_COUNT];
56  void *p_hook_contexts[APP_ISCHED_HOOKS_COUNT];
57 };
58 
68 #define APP_ISCHED_INIT_NAMED(_name, _isched, _queue_size) \
69  do { \
70  NRF_QUEUE_DEF(app_isched_event_t, _name##_queue, _queue_size, NRF_QUEUE_MODE_NO_OVERFLOW); \
71  (_isched)->p_event_queue = &_name##_queue; \
72  \
73  for (unsigned int i = 0; i < APP_ISCHED_HOOKS_COUNT; i++) \
74  { \
75  (_isched)->hooks[i] = NULL; \
76  } \
77  } while (0)
78 
87 #define APP_ISCHED_INIT(_isched, _queue_size) \
88  APP_ISCHED_INIT_NAMED(/* empty */, _isched, _queue_size)
89 
98 ret_code_t app_isched_event_put(app_isched_t *p_isched,
100  void *p_context);
101 
108 ret_code_t app_isched_events_execute(app_isched_t *p_isched);
109 
119 ret_code_t app_isched_install_hook(app_isched_t *p_isched,
120  app_isched_hook_type_t hook_type,
121  app_isched_hook_t hook,
122  void *p_hook_context);
123 
130 size_t app_isched_get_max_utilization(const app_isched_t *p_isched);
131 
132 #endif // APP_ISCHED_H__

Documentation feedback | Developer Zone | Subscribe | Updated