Utility Functions#

Utility functions for applications on SoC.

Functions#

sl_status_t sl_bt_wait_event (sl_bt_msg_t *event)

sl_status_t sl_bt_pop_event (sl_bt_msg_t *event)

bool sl_bt_event_pending (void)

uint32_t sl_bt_event_pending_len ()

void sl_bt_handle_command (uint32_t hdr, void *data)

void * sli_bt_get_command_response ()

static sl_bt_msg_t * sl_bt_get_command_response ()

void sl_bt_priority_handle (void)

void sl_bt_external_signal (uint32_t signals)

void sl_bt_send_system_awake ()

void sl_bt_send_system_error (uint16_t reason, uint8_t data_len, const uint8_t *data)

uint8_t sl_bt_is_sensitive_message (uint32_t message_id)

void sl_bt_send_rsp_user_message_to_target (uint16_t result, uint8_t data_len, uint8_t *data)

void sl_bt_send_evt_user_message_to_host (uint8_t data_len, uint8_t *data)

Detailed Description#

Utility functions for applications on SoC.

Function Documentation#

sl_bt_wait_event()#

sl_status_t sl_bt_wait_event ( sl_bt_msg_t * event )

Get the next event that requires processing by user application. In a bare metal application, this blocks application until new event arrives. When RTOS is used, this works the same way as sl_bt_pop_event.

Parameters

      event the pointer for storing the new event

Returns

      SL_STATUS_OK if a new event is returned; other value indicates an error occurred


sl_bt_pop_event()#

sl_status_t sl_bt_pop_event (sl_bt_msg_t * event)

Get the next event that requires processing by user application. Application is not blocked if no event is waiting.

Parameters

      event the pointer for storing the new event

Returns

      SL_STATUS_OK if a new event is returned, or SL_STATUS_NOT_FOUND if no event is waiting; other value indicates an error occurred


sl_bt_event_pending()#

bool sl_bt_event_pending (void)

Check whether events are in queue pending for processing. Call sl_bt_wait_event or sl_bt_pop_event to process pending events.

Returns

      true if event is pending; false otherwise


sl_bt_event_pending_len()#

uint32_t sl_bt_event_pending_len ()

uint32_t sl_bt_event_pending_len

(

)

Check whether events are in queue pending for processing and return the next event length in bytes if events are pending. Call sl_bt_wait_event or sl_bt_pop_event to process pending events.

Returns

      the next event length if event is pending; 0 otherwise


sl_bt_handle_command()#

void sl_bt_handle_command

(

uint32_t

hdr,

void *

data

)

Handle an API command in binary format.

This is povided to NCP target applications for processing commands received from NCP transport.

Parameters

hdr

the command header

data

the command payload in a byte array


sli_bt_get_command_response()#

void* sli_bt_get_command_response

(

)

Stack internal function used by sl_bt_get_command_response() API.


sl_bt_get_command_response()#

static sl_bt_msg_t* sl_bt_get_command_response

(

)

inlinestatic

Get the response to the command currently been handled.

This is provided to NCP target applications for processing commands received from NCP transport.


sl_bt_priority_handle()#

void sl_bt_priority_handle

(

void

)

Priority message handler function if user application requires the use of PendSV interrupt.

If scheduler_callback function pointer in configuration struct is something else than NULL, then stack will not install its own PendSV IRQ handler but instead uses callback/handler functions.

When application receives call to the scheduler_callback function it must schedule the call to gecko_priority_handle function to later time to run on high priority thread. This callback may happen inside radio IRQ so processing must not block and has to happen as fast as possible.

Recommended implementation: High priority thread is loop that waits on binary semaphore and calls gecko_priority_handler. The scheduler_callback is simple function that only signals the semaphore.


sl_bt_external_signal()#

void sl_bt_external_signal

(

uint32_t

signals

)

Signals stack that external event has happened. Signals can be used to report status change from interrupt context or from other threads to application. Signals are bits that are automatically cleared after application has been notified.

Parameters

signals

is a bitmask defining active signals that are reported back to the application by system_external_signal-event.


sl_bt_send_system_awake()#

void sl_bt_send_system_awake

(

)

Signals stack to send system_awake event when application received wakeup signal.


sl_bt_send_system_error()#

void sl_bt_send_system_error

(

uint16_t

reason,

uint8_t

data_len,

const uint8_t *

data

)

Signals stack to send system_error event when in case of an error.


sl_bt_is_sensitive_message()#

uint8_t sl_bt_is_sensitive_message

(

uint32_t

message_id

)

Tells if a SL_BT_API message is sensitive.

Parameters

[in]

message_id

the SL_BT_API message identifier

Returns       1 if the message is sensitive; otherwise 0


sl_bt_send_rsp_user_message_to_target()#

void sl_bt_send_rsp_user_message_to_target

(

uint16_t

result,

uint8_t

data_len,

uint8_t *

data

)

Sends the NCP host a message whose SL_BT_MSG_ID is gecko_rsp_user_message_to_target_id.

This a utility helping a NCP host and target application to exchange user data. Do not use it in SoC mode.


sl_bt_send_evt_user_message_to_host()#

void sl_bt_send_evt_user_message_to_host

(

uint8_t

data_len,

uint8_t *

data

)

Sends the NCP host a message whose SL_BT_MSG_ID is gecko_evt_user_message_to_host_id.

This a utility helping a NCP host and target application to exchange user data. Do not use it in SoC mode.