ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
nimble_npl_os.h File Reference

ThreadX-backed OS types for the NimBLE Native Porting Layer. More...

#include <stdint.h>
#include "tx_api.h"
Include dependency graph for nimble_npl_os.h:

Go to the source code of this file.

Data Structures

struct  ble_npl_event
 NimBLE event opaque – pairs a callback with an argument. More...
struct  ble_npl_eventq
 Event queue mapped onto TX_QUEUE. More...
struct  ble_npl_callout
 One-shot timer that posts an event into a queue when it fires. More...
struct  ble_npl_mutex
 Mutex mapped onto TX_MUTEX. More...
struct  ble_npl_sem
 Counting semaphore mapped onto TX_SEMAPHORE. More...

Macros

#define BLE_NPL_OS_ALIGNMENT   (4)
 Pool alignment upstream os_mempool.h sizes os_membuf_t from.
#define BLE_NPL_TIME_FOREVER   UINT32_MAX
 Tick value meaning "block indefinitely".

Typedefs

typedef uint32_t ble_npl_time_t
 Tick-count type used by the NPL.
typedef int32_t ble_npl_stime_t
 Signed tick delta, for timeouts expressed relative to now.

Detailed Description

ThreadX-backed OS types for the NimBLE Native Porting Layer.

Tag
[Ring 4 / PORT] {World: S}

Upstream nimble/nimble_npl.h declares the whole NPL function surface and then does #include "nimble/nimble_npl_os.h" to pick up the OS-specific struct definitions the port supplies. This is that file for the ThreadX port: it is found on the include path because port/nimble/inc is on it, exactly as upstream's own ports (porting/npl/freertos/include/nimble/nimble_npl_os.h and friends) are found on theirs.

Splitting these types out of nimble_npl_threadx.h is what lets the port include the upstream header instead of hand-copying its declarations. The copies drifted out of the compiler's sight: nothing declared ble_npl_mutex_init and the other 30-odd NPL entry points in a header the implementation TU could see, so their definitions were never checked against the contract they implement.

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_os.h.

Macro Definition Documentation

◆ BLE_NPL_OS_ALIGNMENT

#define BLE_NPL_OS_ALIGNMENT   (4)

Pool alignment upstream os_mempool.h sizes os_membuf_t from.

Four bytes: the M85 ABI aligns uint32_t and pointers to 4.

Note
Read by vendored NimBLE headers, never by first-party code.
Since
0.1.0

Definition at line 65 of file nimble_npl_os.h.

◆ BLE_NPL_TIME_FOREVER

#define BLE_NPL_TIME_FOREVER   UINT32_MAX

Tick value meaning "block indefinitely".

Maps onto TX_WAIT_FOREVER inside the NPL implementation.

Note
Read by vendored NimBLE headers, never by first-party code.
Since
0.1.0

Definition at line 74 of file nimble_npl_os.h.

Typedef Documentation

◆ ble_npl_stime_t

typedef int32_t ble_npl_stime_t

Signed tick delta, for timeouts expressed relative to now.

Definition at line 80 of file nimble_npl_os.h.

◆ ble_npl_time_t

typedef uint32_t ble_npl_time_t

Tick-count type used by the NPL.

ThreadX ULONG matches.

Definition at line 77 of file nimble_npl_os.h.