nRF5 SDK v17.0.2
Macros
Asynchronous Supervisor function interface

Macros to create Asynchronous Supervisor interface functions. More...

Macros

#define NRF_SVCI_ACYNC_FUNC_TYPEDEF(name, param_type, state_type)   typedef uint32_t (* name ## _async_fn_t)(param_type * p_param, state_type * p_state)
 Macro for creating type definition for SVCI interface init function. More...
 
#define NRF_SVCI_ASYNC_EVENT_FUNC_TYPEDEF(name, state_type)   typedef uint32_t (* name ## _event_fn_t)(uint32_t sys_evt, state_type * p_state)
 Macro for creating type definition for SVCI interface event function. More...
 
#define NRF_SVCI_ASYNC_FUNC_DECLARE(svci_num,name,param_type,state_type)
 Macro for creating a declaration of a named async function for the SVCI interface. More...
 
#define NRF_SVCI_ASYNC_FUNC_DEFINE(svci_num, name, param_type)
 Macro for defining a named SVCI async interface. More...
 

Detailed Description

Macros to create Asynchronous Supervisor interface functions.

Macro Definition Documentation

#define NRF_SVCI_ACYNC_FUNC_TYPEDEF (   name,
  param_type,
  state_type 
)    typedef uint32_t (* name ## _async_fn_t)(param_type * p_param, state_type * p_state)

Macro for creating type definition for SVCI interface init function.

Warning
Do not call this macro directly! Use NRF_SVCI_ASYNC_FUNC_DECLARE instead.
Parameters
[in]nameName of async request function. Will be appended with _async_fn_t.
[in]param_typeParameter type.
[in]state_typeState type.
Return values
Typedefinition a named SVCI async init function.
#define NRF_SVCI_ASYNC_EVENT_FUNC_TYPEDEF (   name,
  state_type 
)    typedef uint32_t (* name ## _event_fn_t)(uint32_t sys_evt, state_type * p_state)

Macro for creating type definition for SVCI interface event function.

Warning
Do not call this macro directly! Use NRF_SVCI_ASYNC_FUNC_DECLARE instead.

Calling this function with sys-events will report NRF_ERROR_BUSY until the asynchronous calls is finished, at which time it will report either NRF_SUCCESS or any another error-message.

Parameters
[in]nameName of the event function. Will be appended with _event_fn_t
[in]state_typeType parameter for the state.
Return values
Typedefinition for a named SVCI async event function.
#define NRF_SVCI_ASYNC_FUNC_DECLARE (   svci_num,
  name,
  param_type,
  state_type 
)
Value:
/*lint --e{19} */ \
NRF_SVCI_ACYNC_FUNC_TYPEDEF(name, param_type, state_type); \
NRF_SVCI_ASYNC_EVENT_FUNC_TYPEDEF(name, state_type); \
\
typedef struct \
{ \
name ## _async_fn_t async_func; \
name ## _event_fn_t sys_evt_handler; \
state_type state; \
} name ## _svci_async_t;

Macro for creating a declaration of a named async function for the SVCI interface.

The async interface provides a method to call into a external application through the SVCI interface without relying on allocated or reserved memory inside the external application.

This macro declares variables and function types in use by the async SVCI interface.

Note
This is intended to be invoked in a header file shared by both the caller and the recipient (handler).
Parameters
[in]svci_numSVC indirect number.
[in]nameName of the async function.
[in]param_typeType of the param used for the async interface.
[in]state_typeType of the state used for the async interface.
Return values
Atype definition of NAME_svc_async_t to be used for async access through the SVCI interface.
#define NRF_SVCI_ASYNC_FUNC_DEFINE (   svci_num,
  name,
  param_type 
)
Value:
\
SVCI(svci_num, uint32_t, name ## _svci_async_init, name ## _svci_async_t *, p_async); \
static name ## _svci_async_t name ## _svci_async_def = {0}; \
\
static __INLINE uint32_t name ## _init (void) \
{ \
return name ## _svci_async_init(&name ## _svci_async_def); \
} \
\
static __INLINE uint32_t name(param_type * p_param) \
{ \
return name ## _svci_async_def.async_func(p_param, &name ## _svci_async_def.state); \
} \
\
static __INLINE uint32_t name ## _on_sys_evt(uint32_t sys_evt) \
{ \
return name ## _svci_async_def.sys_evt_handler(sys_evt, &name ## _svci_async_def.state); \
} \
\
static __INLINE uint32_t name ## _is_initialized(void) \
{ \
return (name ## _svci_async_def.async_func != NULL && \
name ## _svci_async_def.sys_evt_handler != NULL ); \
}

Macro for defining a named SVCI async interface.

The async interface provides a method to call into an external application through the SVCI interface without relying on allocated or reserved memory inside the external application.

Running this macro creates a defintion of the structure that holds the information about the async function, the event handler, and the state.

Running this macro also defines convenience functions to the SVCI interface.

The available functions are: -NAME_init - Function to call to set up the async SVCI interface. -NAME - Function to call the async SVCI interface. -NAME_on_sys_event - Function to report sys events to the async SVCI interface. -NAME_is_initialized - Function to check if the async SVCI interface is initialized and ready to use.

Note
Invoking this macro is only possible in a source file as the macro creates a static variable for the async interface as well as static functions to call into the async interface.
Parameters
[in]svci_numSVC indirect number.
[in]nameName of the async function.
[in]param_typeType of the param used for the async interface.
Return values
Instanceof the async SVCI interface and convenience functions for using it.

Documentation feedback | Developer Zone | Subscribe | Updated