Mynewt-Nimble Porting layer wrappers. More...
Mynewt-Nimble Porting layer wrappers.
Definition in file nimble_npl_os.h.
Include dependency graph for nimble_npl_os.h:Go to the source code of this file.
Data Structures | |
| struct | ble_npl_event |
| ble_npl event wrapper More... | |
| struct | ble_npl_eventq |
| ble_npl event queue wrapper More... | |
| struct | ble_npl_callout |
| ble_npl callout wrapper More... | |
| struct | ble_npl_mutex |
| ble_npl mutex wrapper More... | |
| struct | ble_npl_sem |
| ble_npl semaphore wrapper More... | |
Typedefs | |
| typedef uint32_t | ble_npl_time_t |
| time type | |
| typedef int32_t | ble_npl_stime_t |
| time type | |
Functions | |
| static bool | ble_npl_os_started (void) |
| Not used in RIOT. More... | |
| static void | ble_npl_event_init (struct ble_npl_event *ev, ble_npl_event_fn *fn, void *arg) |
| Init a event. More... | |
| static bool | ble_npl_event_is_queued (struct ble_npl_event *ev) |
| Check if event is in queue. More... | |
| static void * | ble_npl_event_get_arg (struct ble_npl_event *ev) |
| Runs an event. More... | |
| static void | ble_npl_event_set_arg (struct ble_npl_event *ev, void *arg) |
| Set the vent arg. More... | |
| static void | ble_npl_event_run (struct ble_npl_event *ev) |
| Runs an event. More... | |
| static void | ble_npl_eventq_init (struct ble_npl_eventq *evq) |
| Initialize the event queue. More... | |
| static int | ble_npl_eventq_inited (struct ble_npl_eventq *evq) |
| Check whether the event queue is initialized. More... | |
| static void | ble_npl_eventq_deinit (struct ble_npl_eventq *evq) |
| Deinitialize an event queue. More... | |
| static struct ble_npl_event * | ble_npl_eventq_get (struct ble_npl_eventq *evq, ble_npl_time_t tmo) |
| Get next event from event queue, blocking. More... | |
| static struct ble_npl_event * | ble_npl_eventq_get_no_wait (struct ble_npl_eventq *evq) |
| Get next event from event queue, non-blocking. More... | |
| static void | ble_npl_eventq_put (struct ble_npl_eventq *evq, struct ble_npl_event *ev) |
| Put an event on the event queue. More... | |
| static void | ble_npl_eventq_remove (struct ble_npl_eventq *evq, struct ble_npl_event *ev) |
| Remove an event from the queue. More... | |
| static void | ble_npl_eventq_run (struct ble_npl_eventq *evq) |
| Gets and runs an event from the queue callback. More... | |
| static bool | ble_npl_eventq_is_empty (struct ble_npl_eventq *evq) |
| Check if queue is empty. More... | |
| static ble_npl_error_t | ble_npl_mutex_init (struct ble_npl_mutex *mu) |
| Initializes a mutex object. More... | |
| static ble_npl_error_t | ble_npl_mutex_pend (struct ble_npl_mutex *mu, ble_npl_time_t timeout) |
| Pend (wait) for a mutex. More... | |
| static ble_npl_error_t | ble_npl_mutex_release (struct ble_npl_mutex *mu) |
| Release a mutex. More... | |
| static ble_npl_error_t | ble_npl_sem_init (struct ble_npl_sem *sem, uint16_t tokens) |
| Initialize a semaphore. More... | |
| static ble_npl_error_t | ble_npl_sem_pend (struct ble_npl_sem *sem, ble_npl_time_t timeout) |
| Pend (wait) for a semaphore. More... | |
| static ble_npl_error_t | ble_npl_sem_release (struct ble_npl_sem *sem) |
| Release a semaphore. More... | |
| static uint16_t | ble_npl_sem_get_count (struct ble_npl_sem *sem) |
| Get current semaphore's count. | |
| static void | ble_npl_callout_init (struct ble_npl_callout *c, struct ble_npl_eventq *q, ble_npl_event_fn *e_cb, void *e_arg) |
| Initialize a callout. More... | |
| static ble_npl_error_t | ble_npl_callout_reset (struct ble_npl_callout *c, ble_npl_time_t ticks) |
| Reset the callout to fire off in 'ticks' ticks. More... | |
| static void | ble_npl_callout_stop (struct ble_npl_callout *c) |
| Stops the callout from firing. More... | |
| static bool | ble_npl_callout_is_active (struct ble_npl_callout *c) |
| Check if callout is active. More... | |
| static ble_npl_time_t | ble_npl_callout_get_ticks (struct ble_npl_callout *co) |
| Get the callout set ticks. More... | |
| static ble_npl_time_t | ble_npl_callout_remaining_ticks (struct ble_npl_callout *co, ble_npl_time_t time) |
| Get the remaining ticks for callout expire. More... | |
| static void | ble_npl_callout_set_arg (struct ble_npl_callout *co, void *arg) |
| Set the callout event argument. More... | |
| static ble_npl_time_t | ble_npl_time_get (void) |
| Returns the low 32 bits of cputime. More... | |
| static ble_npl_error_t | ble_npl_time_ms_to_ticks (uint32_t ms, ble_npl_time_t *out_ticks) |
| Converts the given number of milliseconds into cputime ticks. More... | |
| static ble_npl_error_t | ble_npl_time_ticks_to_ms (ble_npl_time_t ticks, uint32_t *out_ms) |
| Convert the given number of ticks into milliseconds. More... | |
| static ble_npl_time_t | ble_npl_time_ms_to_ticks32 (uint32_t ms) |
| Converts the given number of milliseconds into cputime ticks. More... | |
| static ble_npl_time_t | ble_npl_time_ticks_to_ms32 (ble_npl_time_t ticks) |
| Convert the given number of ticks into milliseconds. More... | |
| static void | ble_npl_time_delay (ble_npl_time_t ticks) |
| Wait until the number of ticks has elapsed, BLOICKING. More... | |
| static uint32_t | ble_npl_hw_enter_critical (void) |
| Disable ISRs. More... | |
| static void | ble_npl_hw_exit_critical (uint32_t ctx) |
| Restores ISR context. More... | |
| static bool | ble_npl_hw_is_in_critical (void) |
| Check if is in critical section. More... | |
| static void * | ble_npl_get_current_task_id (void) |
| Return current thread PID. More... | |
| static void | ble_npl_hw_set_isr (int irqn, void(*addr)(void)) |
| Set nrf5x radio ISR callback. More... | |
BLE NPL layer macros | |
| #define | BLE_NPL_OS_ALIGNMENT (OS_ALIGNMENT) |
| #define | BLE_NPL_TIME_FOREVER (OS_WAIT_FOREVER) |
|
inlinestatic |
Get the callout set ticks.
| [in] | co | the callout to check |
Definition at line 418 of file nimble_npl_os.h.
|
inlinestatic |
Initialize a callout.
Callouts are used to schedule events in the future onto an event queue. Callout timers are scheduled using the ble_npl_callout_reset() function. When the timer expires, an event is posted to the event queue specified in ble_npl_callout_init(). The event argument given here is posted in the ev_arg field of that event.
| [out] | c | callout to initialize |
| [in] | q | event queue to queue event in |
| [in] | e_cb | callback function |
| [in] | e_arg | callback function argument |
Definition at line 367 of file nimble_npl_os.h.
|
inlinestatic |
Check if callout is active.
| [in] | c | the callout to check |
Definition at line 408 of file nimble_npl_os.h.
|
inlinestatic |
Get the remaining ticks for callout expire.
| [in] | co | the callout to check |
| [in] | time | ignored |
Definition at line 431 of file nimble_npl_os.h.
|
inlinestatic |
Reset the callout to fire off in 'ticks' ticks.
| [in] | c | callout to reset |
| [in] | ticks | number of ticks to wait before posting an event |
Definition at line 381 of file nimble_npl_os.h.
|
inlinestatic |
Set the callout event argument.
| [in] | co | the callout |
| [in] | arg | callback function argument |
Definition at line 445 of file nimble_npl_os.h.
|
inlinestatic |
Stops the callout from firing.
| [in] | c | the callout to stop |
Definition at line 396 of file nimble_npl_os.h.
|
inlinestatic |
|
inlinestatic |
Init a event.
| [in] | ev | pointer to event to set |
| [in] | fn | event callback function |
| [in] | arg | event argument |
Definition at line 105 of file nimble_npl_os.h.
|
inlinestatic |
Check if event is in queue.
| [in] | ev | event to check |
Definition at line 118 of file nimble_npl_os.h.
|
inlinestatic |
|
inlinestatic |
Set the vent arg.
| [in] | ev | event |
| [in] | arg | arg to set event |
Definition at line 139 of file nimble_npl_os.h.
|
inlinestatic |
Deinitialize an event queue.
| [in] | evq | the event queue to deinit |
Definition at line 181 of file nimble_npl_os.h.
|
inlinestatic |
Get next event from event queue, blocking.
| [in] | evq | the event queue to pull an event from |
| [in] | tmo | timeout, NPL_TIME_FOREVER to block, 0 to return immediately |
Definition at line 195 of file nimble_npl_os.h.
|
inlinestatic |
Get next event from event queue, non-blocking.
| [in] | evq | the event queue to pull an event from |
Definition at line 208 of file nimble_npl_os.h.
|
inlinestatic |
Initialize the event queue.
| [in] | evq | The event queue to initialize |
Definition at line 159 of file nimble_npl_os.h.
|
inlinestatic |
Check whether the event queue is initialized.
| [in] | evq | the event queue to check |
Definition at line 169 of file nimble_npl_os.h.
|
inlinestatic |
Check if queue is empty.
| [in] | evq | the event queue to check |
Definition at line 252 of file nimble_npl_os.h.
|
inlinestatic |
Put an event on the event queue.
| [in] | evq | event queue |
| [in] | ev | event to put in queue |
Definition at line 219 of file nimble_npl_os.h.
|
inlinestatic |
Remove an event from the queue.
| [in] | evq | event queue to remove the event from |
| [in] | ev | event to remove from the queue |
Definition at line 230 of file nimble_npl_os.h.
|
inlinestatic |
Gets and runs an event from the queue callback.
| [in] | evq | The event queue to pull the item off. |
Definition at line 240 of file nimble_npl_os.h.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Restores ISR context.
| [in] | ctx | ISR context to restore. |
Definition at line 534 of file nimble_npl_os.h.
|
inlinestatic |
Check if is in critical section.
Definition at line 544 of file nimble_npl_os.h.
|
inlinestatic |
Set nrf5x radio ISR callback.
| [in] | irqn | IRQ number |
| [in] | addr | the ISR callback |
Definition at line 565 of file nimble_npl_os.h.
|
inlinestatic |
Initializes a mutex object.
| [out] | mu | pre-allocated mutex structure, must not be NULL. |
Definition at line 262 of file nimble_npl_os.h.
|
inlinestatic |
Pend (wait) for a mutex.
| [in] | mu | Pointer to mutex. |
| [in] | timeout | Timeout, in os ticks. A timeout of 0 means do not wait if not available. A timeout of OS_TIMEOUT_NEVER means wait forever. |
Definition at line 279 of file nimble_npl_os.h.
|
inlinestatic |
Release a mutex.
Definition at line 292 of file nimble_npl_os.h.
|
inlinestatic |
|
inlinestatic |
Initialize a semaphore.
| [in] | sem | pointer to semaphore |
| [in] | tokens | # of tokens the semaphore should contain initially. |
Definition at line 307 of file nimble_npl_os.h.
|
inlinestatic |
Pend (wait) for a semaphore.
| [in] | sem | pointer to semaphore. |
| [in] | timeout | timeout, in os ticks. A timeout of 0 means do not wait if not available. A timeout of BLE_NPL_TIMEOUT_NEVER means wait forever. |
Definition at line 326 of file nimble_npl_os.h.
|
inlinestatic |
Release a semaphore.
| [in] | sem | pointer to the semaphore to be released |
Definition at line 340 of file nimble_npl_os.h.
|
inlinestatic |
Wait until the number of ticks has elapsed, BLOICKING.
| [in] | ticks | The number of ticks to wait. |
Definition at line 514 of file nimble_npl_os.h.
|
inlinestatic |
Returns the low 32 bits of cputime.
Definition at line 455 of file nimble_npl_os.h.
|
inlinestatic |
Converts the given number of milliseconds into cputime ticks.
| [in] | ms | The number of milliseconds to convert to ticks |
| [out] | out_ticks | The number of ticks corresponding to 'ms' |
Definition at line 468 of file nimble_npl_os.h.
|
inlinestatic |
Converts the given number of milliseconds into cputime ticks.
| [in] | ms | The number of milliseconds to convert to ticks |
Definition at line 493 of file nimble_npl_os.h.
|
inlinestatic |
Convert the given number of ticks into milliseconds.
| [in] | ticks | The number of ticks to convert to milliseconds. |
| [out] | out_ms | The converted milliseconds from 'ticks' |
Definition at line 481 of file nimble_npl_os.h.
|
inlinestatic |
Convert the given number of ticks into milliseconds.
| [in] | ticks | The number of ticks to convert to milliseconds. |
Definition at line 505 of file nimble_npl_os.h.