|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
NimBLE Native Porting Layer mapping onto Eclipse ThreadX. More...
#include <stdint.h>#include "nimble/nimble_npl.h"Go to the source code of this file.
Enumerations | |
| enum | ble_npl_threadx_limits_t : uint16_t { k_ble_npl_threadx_wait_forever = 0xFFFFU , k_ble_npl_threadx_eventq_depth = 16U , k_ble_npl_threadx_eventq_slot_bytes = 4U , k_ble_npl_threadx_sem_max = 0xFFFFU } |
| Sizing constants for the ThreadX-backed NPL. More... | |
Functions | |
| void | nimble_port_init (void) |
| Bring the NimBLE host port up. | |
| void | nimble_port_run (void) |
| Pump the NimBLE host event loop forever. | |
| struct ble_npl_eventq * | nimble_port_get_dflt_eventq (void) |
| Return the host's default eventq pointer. | |
NimBLE Native Porting Layer mapping onto Eclipse ThreadX.
Apache NimBLE expects a small set of OS primitives – mutex, semaphore, event-queue, callout (one-shot timer that posts an event), tick counter, critical section – collectively the "Native Porting Layer" (NPL). Upstream ships canned ports for FreeRTOS, Mynewt, Linux, NuttX, RIOT and "dummy". We provide a ThreadX-backed implementation here so NimBLE's host stack runs on the same kernel that powers threadx_blink and threadx_fs_demo.
Mapping:
| NimBLE primitive | ThreadX primitive |
|---|---|
| ble_npl_mutex | TX_MUTEX |
| ble_npl_sem | TX_SEMAPHORE |
| ble_npl_eventq | TX_QUEUE |
| ble_npl_callout | TX_TIMER |
| ble_npl_time_t | ULONG (ticks) |
| critical section | TX interrupt mask |
Tick rate matches the project tx_user.h (TX_TIMER_TICKS_PER_SECOND = 1000), so 1 NPL tick == 1 ms.
Definition in file nimble_npl_threadx.h.
| enum ble_npl_threadx_limits_t : uint16_t |
Sizing constants for the ThreadX-backed NPL.
| Enumerator | |
|---|---|
| k_ble_npl_threadx_wait_forever | Wait forever – maps onto TX_WAIT_FOREVER. |
| k_ble_npl_threadx_eventq_depth | Default eventq depth (number of pointer slots). |
| k_ble_npl_threadx_eventq_slot_bytes | Bytes of storage per eventq slot (one pointer on M85). |
| k_ble_npl_threadx_sem_max | Default sem max value – effectively unbounded for our use case. |
Definition at line 127 of file nimble_npl_threadx.h.
| struct ble_npl_eventq * nimble_port_get_dflt_eventq | ( | void | ) |
Return the host's default eventq pointer.
Return the host's default eventq pointer.
< S dflt eventq.
Definition at line 530 of file nimble_npl_threadx.c.
References s_dflt_eventq.
| void nimble_port_init | ( | void | ) |
Bring the NimBLE host port up.
Initialises the default eventq used by the host stack. The adapter implementation lives in nimble_npl_threadx.c and is marked weak so the upstream NimBLE host TUs can supersede it once they are wired into the build.
Definition at line 512 of file nimble_npl_threadx.c.
References ble_npl_eventq_init(), s_dflt_eventq, and s_dflt_eventq_ready.
Referenced by internal_demo_ble_or_halt().
| void nimble_port_run | ( | void | ) |
Pump the NimBLE host event loop forever.
Pulls events out of the default eventq and calls ble_npl_event_run on each. Never returns.
Pump the NimBLE host event loop forever.
Pumps events out of the default eventq; never returns under normal operation.
Definition at line 550 of file nimble_npl_threadx.c.
References ble_npl_event_run(), ble_npl_eventq_get(), k_ble_npl_threadx_wait_forever, and s_dflt_eventq.