Smart Remote 3 nRF52 v1.2
Data Structures | Macros | Typedefs | Enumerations | Enumerator | Functions | Variables
Instantiable scheduler

Instantiable scheduler functions. More...

Data Structures

struct  __app_isched_struct
 app_isched_t data structure More...
 
struct  app_isched_event_t
 Structure representing an event. More...
 

Macros

#define APP_ISCHED_INIT(_isched, _queue_size)   APP_ISCHED_INIT_NAMED(/* empty */, _isched, _queue_size)
 Initialize a scheduler instance. More...
 
#define APP_ISCHED_INIT_NAMED(_name, _isched, _queue_size)
 Initialize a named scheduler instance. More...
 

Typedefs

typedef void(* app_isched_event_handler_t )(void *p_context)
 Instantiable scheduler event handler.
 
typedef void(* app_isched_hook_t )(const app_isched_t *p_isched, const app_isched_event_t *p_evt, void *p_hook_context)
 Instantiable scheduler hook.
 
typedef struct __app_isched_struct app_isched_t
 Instantiable scheduler instance. You can run several instances of this scheduler at the same time. Note that the instantiable scheduler stores only pointers, not actual objects.
 

Enumerations

enum  app_isched_hook_type_t { APP_ISCHED_HOOK_PRE_PUT, APP_ISCHED_HOOK_POST_PUT, APP_ISCHED_HOOK_PRE_EXEC, APP_ISCHED_HOOK_POST_EXEC }
 Instantiable scheduler hook types. More...
 

Functions

ret_code_t app_isched_event_put (app_isched_t *p_isched, app_isched_event_handler_t handler, void *p_context)
 Put an event in the scheduler instance. More...
 
ret_code_t app_isched_events_execute (app_isched_t *p_isched)
 Execute events queued in the given scheduler. More...
 
size_t app_isched_get_max_utilization (const app_isched_t *p_isched)
 Get maximum scheduler utilization. More...
 
ret_code_t app_isched_install_hook (app_isched_t *p_isched, app_isched_hook_type_t hook_type, app_isched_hook_t hook, void *p_hook_context)
 Install app_isched hook. More...
 

Variables

app_isched_event_handler_t app_isched_event_t::handler
 
app_isched_hook_t __app_isched_struct::hooks [APP_ISCHED_HOOKS_COUNT]
 
void * app_isched_event_t::p_context
 
const nrf_queue_t * __app_isched_struct::p_event_queue
 
void * __app_isched_struct::p_hook_contexts [APP_ISCHED_HOOKS_COUNT]
 

Detailed Description

Instantiable scheduler functions.

Macro Definition Documentation

#define APP_ISCHED_INIT (   _isched,
  _queue_size 
)    APP_ISCHED_INIT_NAMED(/* empty */, _isched, _queue_size)

Initialize a scheduler instance.

Note
This macro reserves memory for the given pool instance. Use it only once per each app_balloc_pool instance.
Parameters
[in]_ischedPointer to the app_isched instance that is to be initialized.
[in]_queue_sizeMaximum number of events in the execution queue.
#define APP_ISCHED_INIT_NAMED (   _name,
  _isched,
  _queue_size 
)
Value:
do { \
NRF_QUEUE_DEF(app_isched_event_t, _name##_queue, _queue_size, NRF_QUEUE_MODE_NO_OVERFLOW); \
(_isched)->p_event_queue = &_name##_queue; \
\
for (unsigned int i = 0; i < APP_ISCHED_HOOKS_COUNT; i++) \
{ \
(_isched)->hooks[i] = NULL; \
} \
} while (0)

Initialize a named scheduler instance.

Note
This macro reserves memory for the given pool instance. Use it only once per each app_balloc_pool instance.
Parameters
[in]_nameName of the scheduler storage.
[in]_ischedPointer to the app_isched instance that is to be initialized.
[in]_queue_sizeMaximum number of events in the execution queue.

Enumeration Type Documentation

Instantiable scheduler hook types.

Enumerator
APP_ISCHED_HOOK_PRE_PUT 

This hook will be called before putting an event into queue.

APP_ISCHED_HOOK_POST_PUT 

This hook will be called after putting an event into queue.

APP_ISCHED_HOOK_PRE_EXEC 

This hook will be called before event execution.

APP_ISCHED_HOOK_POST_EXEC 

This hook will be called after event execution.

Function Documentation

ret_code_t app_isched_event_put ( app_isched_t p_isched,
app_isched_event_handler_t  handler,
void *  p_context 
)

Put an event in the scheduler instance.

Parameters
[in]p_ischedPointer to the scheduler instance.
[in]handlerEvent handler that will receive the event.
[in]p_contextPointer to the event context which will be passed to the event handler.
Returns
NRF_SUCCESS on success, otherwise error code.
ret_code_t app_isched_events_execute ( app_isched_t p_isched)

Execute events queued in the given scheduler.

Parameters
[in]p_ischedPointer to the scheduler instance.
Returns
NRF_SUCCESS on success, otherwise error code.
size_t app_isched_get_max_utilization ( const app_isched_t p_isched)

Get maximum scheduler utilization.

Parameters
[in]p_ischedPointer to the scheduler instance.
Returns
Maximum number of events stored in the scheduler.
ret_code_t app_isched_install_hook ( app_isched_t p_isched,
app_isched_hook_type_t  hook_type,
app_isched_hook_t  hook,
void *  p_hook_context 
)

Install app_isched hook.

Parameters
[in]p_ischedPointer to the scheduler instance.
[in]hook_typeHook type.
[in]hookHook or NULL if previously set hook should be removed.
[in]p_hook_contextContext, which will be passed to hook.
Returns
NRF_SUCCESS on success, otherwise error code.

Variable Documentation

app_isched_event_handler_t app_isched_event_t::handler

Event handler.

app_isched_hook_t __app_isched_struct::hooks[APP_ISCHED_HOOKS_COUNT]

Hooks.

void* app_isched_event_t::p_context

Pointer to the event context.

const nrf_queue_t* __app_isched_struct::p_event_queue

Event queue.

void* __app_isched_struct::p_hook_contexts[APP_ISCHED_HOOKS_COUNT]

Hook contexts.


Documentation feedback | Developer Zone | Subscribe | Updated