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

NimBLE Native Porting Layer mapping onto Eclipse ThreadX. More...

#include "nimble_npl_threadx.h"
#include <stdint.h>
#include <string.h>
#include "nimble_transport_stubs.h"
#include "ra8_attributes.h"
#include "tx_api.h"
Include dependency graph for nimble_npl_threadx.c:

Go to the source code of this file.

Enumerations

enum  ble_npl_threadx_const_t : uint32_t {
  k_ble_npl_tx_wait_forever = 0xFFFFFFFFU ,
  k_ble_npl_tx_no_wait = 0U ,
  k_ble_npl_ms_per_sec = 1000U
}
 Local sizing/timeout constants. More...

Functions

static ULONG internal_tmo_to_tx (ble_npl_time_t tmo)
 Translate an NPL timeout into a ThreadX wait code.
ble_npl_error_t ble_npl_mutex_init (struct ble_npl_mutex *mu)
ble_npl_error_t ble_npl_mutex_pend (struct ble_npl_mutex *mu, ble_npl_time_t timeout)
ble_npl_error_t ble_npl_mutex_release (struct ble_npl_mutex *mu)
ble_npl_error_t ble_npl_sem_init (struct ble_npl_sem *sem, uint16_t tokens)
ble_npl_error_t ble_npl_sem_pend (struct ble_npl_sem *sem, ble_npl_time_t timeout)
ble_npl_error_t ble_npl_sem_release (struct ble_npl_sem *sem)
uint16_t ble_npl_sem_get_count (struct ble_npl_sem *sem)
void ble_npl_event_init (struct ble_npl_event *ev, ble_npl_event_fn *fn, void *arg)
void ble_npl_eventq_init (struct ble_npl_eventq *evq)
struct ble_npl_eventble_npl_eventq_get (struct ble_npl_eventq *evq, ble_npl_time_t tmo)
 Wait for an event from an NPL event queue.
void ble_npl_eventq_put (struct ble_npl_eventq *evq, struct ble_npl_event *ev)
void ble_npl_eventq_remove (struct ble_npl_eventq *evq, struct ble_npl_event *ev)
void ble_npl_event_run (struct ble_npl_event *ev)
bool ble_npl_event_is_queued (struct ble_npl_event *ev)
void * ble_npl_event_get_arg (struct ble_npl_event *ev)
 Read the user-arg pointer attached to an event.
void ble_npl_event_set_arg (struct ble_npl_event *ev, void *arg)
bool ble_npl_eventq_is_empty (struct ble_npl_eventq *evq)
static void internal_callout_trampoline (ULONG arg)
 Post a callout event from the ThreadX timer trampoline.
void ble_npl_callout_init (struct ble_npl_callout *co, struct ble_npl_eventq *evq, ble_npl_event_fn *ev_cb, void *ev_arg)
ble_npl_error_t ble_npl_callout_reset (struct ble_npl_callout *co, ble_npl_time_t ticks)
void ble_npl_callout_stop (struct ble_npl_callout *co)
bool ble_npl_callout_is_active (struct ble_npl_callout *co)
void ble_npl_callout_set_arg (struct ble_npl_callout *co, void *arg)
ble_npl_time_t ble_npl_time_get (void)
ble_npl_error_t ble_npl_time_ms_to_ticks (uint32_t ms, ble_npl_time_t *out_ticks)
ble_npl_error_t ble_npl_time_ticks_to_ms (ble_npl_time_t ticks, uint32_t *out_ms)
void ble_npl_time_delay (ble_npl_time_t ticks)
uint32_t ble_npl_hw_enter_critical (void)
void ble_npl_hw_exit_critical (uint32_t ctx)
bool ble_npl_hw_is_in_critical (void)
 Test whether the calling context is inside a critical section.
void nimble_port_init (void)
 Bring the NimBLE host port up.
struct ble_npl_eventqnimble_port_get_dflt_eventq (void)
 Return the address of the default eventq.
void nimble_port_run (void)
 Run the NimBLE host event loop forever.
void * ble_transport_alloc_evt (int discardable)
 Allocate an HCI event buffer (upstream ble_transport.h).
struct os_mbuf * ble_transport_alloc_acl_from_ll (void)
 Allocate an ACL mbuf for the LL-to-host direction.
void ble_transport_free (void *buf)
 Release a buffer obtained from ble_transport_alloc_evt().
int ble_transport_to_hs_evt (void *buf)
 Push an HCI event up to the host stack.
int ble_transport_to_hs_acl (struct os_mbuf *om)
 Push an ACL packet up to the host stack.
int os_mbuf_append (struct os_mbuf *om, const void *data, uint16_t len)
 Append bytes to an mbuf chain (upstream os_mbuf.h).
int os_mbuf_free_chain (struct os_mbuf *om)
 Free every mbuf in a chain.
uint16_t os_mbuf_len (const struct os_mbuf *om)
 Total payload length of an mbuf chain.
int os_mbuf_copydata (const struct os_mbuf *om, int off, int len, void *dst)
 Copy a byte range out of an mbuf chain.
int ble_transport_to_ll_cmd (void *buf)
 Host-to-controller HCI command entry point.
int ble_transport_to_ll_acl (struct os_mbuf *om)
 Host-to-controller ACL entry point.

Variables

static struct ble_npl_eventq s_dflt_eventq
 Default eventq used by the host stack.
static uint8_t s_dflt_eventq_ready = 0U
 Initialized flag for the default eventq.

Detailed Description

NimBLE Native Porting Layer mapping onto Eclipse ThreadX.

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

Implementation of the NimBLE NPL primitives on top of ThreadX. Each ble_npl_* symbol delegates to the matching tx_* service. This file also carries small stubs of the upstream ble_transport_alloc_* / os_mbuf_* symbols so the per-app build can link our adapter even before the curated upstream NimBLE host TUs are wired into the build (the heavyweight host stack is opt-in via RA8_USE_NIMBLE_HOST – without it we still provide a link-only scaffold so the demo links).

Tick rate: TX_TIMER_TICKS_PER_SECOND = 1000 (see port/threadx/inc/tx_user.h), so 1 NPL tick == 1 ms.

Warning
UNVALIDATED SCAFFOLD (issue #286): this NimBLE port and its ThreadX Native Porting Layer link and pass the static gates, but have NEVER been hardware-validated and are NOT emulator-gated – ra8_emulator models no RA8D2 BLE controller / HCI mailbox, and the underlying ra8_ble transport is itself unproven on this board (see #86, #91). Treat every symbol here as a link-only stub, not a working BLE stack. Consumers stay under examples/_unsupported/ until a NimBLE app is driven to real hardware validation and promoted out of that tier.
Since
0.1.0

Definition in file nimble_npl_threadx.c.

Enumeration Type Documentation

◆ ble_npl_threadx_const_t

enum ble_npl_threadx_const_t : uint32_t

Local sizing/timeout constants.

Enumerator
k_ble_npl_tx_wait_forever 

TX_WAIT_FOREVER literal.

k_ble_npl_tx_no_wait 

TX_NO_WAIT literal.

k_ble_npl_ms_per_sec 

Helper: ms / second.

Definition at line 58 of file nimble_npl_threadx.c.

Function Documentation

◆ ble_npl_callout_init()

void ble_npl_callout_init ( struct ble_npl_callout * co,
struct ble_npl_eventq * evq,
ble_npl_event_fn * ev_cb,
void * ev_arg )

Mutable timer name retained by the ThreadX control block.

Definition at line 343 of file nimble_npl_threadx.c.

References ble_npl_event::arg, ble_npl_callout::ev, ble_npl_callout::evq, ble_npl_event::fn, ble_npl_callout::handle, internal_callout_trampoline(), and memset().

◆ ble_npl_callout_is_active()

bool ble_npl_callout_is_active ( struct ble_npl_callout * co)

Definition at line 391 of file nimble_npl_threadx.c.

References ble_npl_callout::handle, and TX_SUCCESS.

◆ ble_npl_callout_reset()

ble_npl_error_t ble_npl_callout_reset ( struct ble_npl_callout * co,
ble_npl_time_t ticks )

Definition at line 367 of file nimble_npl_threadx.c.

References ble_npl_callout::handle, and TX_SUCCESS.

◆ ble_npl_callout_set_arg()

void ble_npl_callout_set_arg ( struct ble_npl_callout * co,
void * arg )

Definition at line 404 of file nimble_npl_threadx.c.

References ble_npl_event::arg, and ble_npl_callout::ev.

◆ ble_npl_callout_stop()

void ble_npl_callout_stop ( struct ble_npl_callout * co)

Definition at line 382 of file nimble_npl_threadx.c.

References ble_npl_callout::handle.

◆ ble_npl_event_get_arg()

void * ble_npl_event_get_arg ( struct ble_npl_event * ev)

Read the user-arg pointer attached to an event.

Parameters
[in]evNPL event pointer.
Returns
The user argument or NULL when ev is NULL.
Precondition
ev may be NULL.
Since
0.1.0

Definition at line 286 of file nimble_npl_threadx.c.

References ble_npl_event::arg, and nullptr.

◆ ble_npl_event_init()

void ble_npl_event_init ( struct ble_npl_event * ev,
ble_npl_event_fn * fn,
void * arg )

Definition at line 185 of file nimble_npl_threadx.c.

References ble_npl_event::arg, ble_npl_event::fn, and memset().

◆ ble_npl_event_is_queued()

bool ble_npl_event_is_queued ( struct ble_npl_event * ev)

Definition at line 270 of file nimble_npl_threadx.c.

References ble_npl_event::queued.

◆ ble_npl_event_run()

void ble_npl_event_run ( struct ble_npl_event * ev)

Definition at line 261 of file nimble_npl_threadx.c.

References ble_npl_event::fn.

Referenced by nimble_port_run().

◆ ble_npl_event_set_arg()

void ble_npl_event_set_arg ( struct ble_npl_event * ev,
void * arg )

Definition at line 292 of file nimble_npl_threadx.c.

References ble_npl_event::arg.

◆ ble_npl_eventq_get()

struct ble_npl_event * ble_npl_eventq_get ( struct ble_npl_eventq * evq,
ble_npl_time_t tmo )

Wait for an event from an NPL event queue.

Parameters
[in,out]evqNPL event queue pointer.
[in]tmoNPL ticks to wait; 0xFFFFU is forever.
Returns
Pointer to the popped event or NULL on timeout.
Precondition
evq != NULL.
Postcondition
On non-NULL return the event has been removed from the queue.
Since
0.1.0

< U.

< Slot.

< Ev.

Definition at line 220 of file nimble_npl_threadx.c.

References internal_tmo_to_tx(), ble_npl_eventq::q, ble_npl_event::queued, and TX_SUCCESS.

Referenced by nimble_port_run().

◆ ble_npl_eventq_init()

void ble_npl_eventq_init ( struct ble_npl_eventq * evq)

Mutable queue name retained by the ThreadX control block.

Definition at line 196 of file nimble_npl_threadx.c.

References memset(), ble_npl_eventq::q, and ble_npl_eventq::storage.

Referenced by nimble_port_init().

◆ ble_npl_eventq_is_empty()

bool ble_npl_eventq_is_empty ( struct ble_npl_eventq * evq)

Definition at line 300 of file nimble_npl_threadx.c.

References ble_npl_eventq::q, and TX_SUCCESS.

◆ ble_npl_eventq_put()

void ble_npl_eventq_put ( struct ble_npl_eventq * evq,
struct ble_npl_event * ev )

Definition at line 237 of file nimble_npl_threadx.c.

References ble_npl_eventq::q, and ble_npl_event::queued.

Referenced by internal_callout_trampoline().

◆ ble_npl_eventq_remove()

void ble_npl_eventq_remove ( struct ble_npl_eventq * evq,
struct ble_npl_event * ev )

Definition at line 251 of file nimble_npl_threadx.c.

References ble_npl_event::queued.

◆ ble_npl_hw_enter_critical()

uint32_t ble_npl_hw_enter_critical ( void )

Definition at line 455 of file nimble_npl_threadx.c.

◆ ble_npl_hw_exit_critical()

void ble_npl_hw_exit_critical ( uint32_t ctx)

Definition at line 461 of file nimble_npl_threadx.c.

◆ ble_npl_hw_is_in_critical()

bool ble_npl_hw_is_in_critical ( void )

Test whether the calling context is inside a critical section.

Returns
1 when inside, 0 otherwise.

Best-effort: ThreadX does not expose a "primask read" helper, so we always report 0 (NimBLE uses this for assertions only).

Since
0.1.0
Return values
0Success or default value.
Precondition
Module has been initialized.
Caller has validated arguments.
Postcondition
Side effects bounded to documented state.
State reflects operation result.
Note
Not thread-safe unless documented otherwise.

Definition at line 484 of file nimble_npl_threadx.c.

◆ ble_npl_mutex_init()

ble_npl_error_t ble_npl_mutex_init ( struct ble_npl_mutex * mu)

Mutable mutex name retained by the ThreadX control block.

Definition at line 94 of file nimble_npl_threadx.c.

References ble_npl_mutex::handle, tx_mutex_create, TX_NO_INHERIT, and TX_SUCCESS.

◆ ble_npl_mutex_pend()

ble_npl_error_t ble_npl_mutex_pend ( struct ble_npl_mutex * mu,
ble_npl_time_t timeout )

◆ ble_npl_mutex_release()

ble_npl_error_t ble_npl_mutex_release ( struct ble_npl_mutex * mu)

Definition at line 119 of file nimble_npl_threadx.c.

References ble_npl_mutex::handle, tx_mutex_put, and TX_SUCCESS.

◆ ble_npl_sem_get_count()

uint16_t ble_npl_sem_get_count ( struct ble_npl_sem * sem)

Definition at line 169 of file nimble_npl_threadx.c.

References ble_npl_sem::handle.

◆ ble_npl_sem_init()

ble_npl_error_t ble_npl_sem_init ( struct ble_npl_sem * sem,
uint16_t tokens )

Mutable semaphore name retained by the ThreadX control block.

Definition at line 134 of file nimble_npl_threadx.c.

References ble_npl_sem::handle, and TX_SUCCESS.

◆ ble_npl_sem_pend()

ble_npl_error_t ble_npl_sem_pend ( struct ble_npl_sem * sem,
ble_npl_time_t timeout )

Definition at line 146 of file nimble_npl_threadx.c.

References ble_npl_sem::handle, internal_tmo_to_tx(), and TX_SUCCESS.

◆ ble_npl_sem_release()

ble_npl_error_t ble_npl_sem_release ( struct ble_npl_sem * sem)

Definition at line 159 of file nimble_npl_threadx.c.

References ble_npl_sem::handle, and TX_SUCCESS.

◆ ble_npl_time_delay()

void ble_npl_time_delay ( ble_npl_time_t ticks)

Definition at line 444 of file nimble_npl_threadx.c.

References tx_thread_sleep.

◆ ble_npl_time_get()

ble_npl_time_t ble_npl_time_get ( void )

Definition at line 417 of file nimble_npl_threadx.c.

References tx_time_get.

◆ ble_npl_time_ms_to_ticks()

ble_npl_error_t ble_npl_time_ms_to_ticks ( uint32_t ms,
ble_npl_time_t * out_ticks )

Definition at line 423 of file nimble_npl_threadx.c.

◆ ble_npl_time_ticks_to_ms()

ble_npl_error_t ble_npl_time_ticks_to_ms ( ble_npl_time_t ticks,
uint32_t * out_ms )

Definition at line 434 of file nimble_npl_threadx.c.

◆ ble_transport_alloc_acl_from_ll()

struct os_mbuf * ble_transport_alloc_acl_from_ll ( void )

Allocate an ACL mbuf for the LL-to-host direction.

Stub: no mbuf pool exists in the curated build.

Returns
Pointer to a freshly allocated ACL mbuf chain.
Return values
NULLAlways, in the stub build.
Precondition
The NimBLE port has been initialised.
Caller is prepared for a NULL return.
Postcondition
No allocation is performed.
No global state changes.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_to_hs_acl()
Since
0.1.0

Definition at line 581 of file nimble_npl_threadx.c.

Referenced by internal_acl_cb().

◆ ble_transport_alloc_evt()

void * ble_transport_alloc_evt ( int discardable)

Allocate an HCI event buffer (upstream ble_transport.h).

Stub: the curated build has no transport buffer pool, so the allocation always fails and the caller drops the event.

Parameters
[in]discardableNon-zero when the caller can tolerate a NULL return (low-priority event). Unused by the stub, kept for ABI parity with upstream.
Returns
Pointer to an event buffer.
Return values
NULLAlways, in the stub build.
Precondition
The NimBLE port has been initialised.
Caller is prepared for a NULL return.
Postcondition
No allocation is performed.
No global state changes.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_free()
Since
0.1.0

Definition at line 575 of file nimble_npl_threadx.c.

Referenced by internal_event_cb().

◆ ble_transport_free()

void ble_transport_free ( void * buf)

Release a buffer obtained from ble_transport_alloc_evt().

Stub: nothing was ever allocated, so nothing is freed.

Parameters
[in]bufBuffer to release. May be NULL.
Precondition
buf came from ble_transport_alloc_evt() or is NULL.
The NimBLE port has been initialised.
Postcondition
The buffer is no longer owned by the caller.
No global state changes in the stub build.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_alloc_evt()
Since
0.1.0

Definition at line 586 of file nimble_npl_threadx.c.

Referenced by ble_transport_to_ll_cmd_impl().

◆ ble_transport_to_hs_acl()

int ble_transport_to_hs_acl ( struct os_mbuf * om)

Push an ACL packet up to the host stack.

Stub: the mbuf is dropped and success is reported.

Parameters
[in]omACL mbuf chain to deliver.
Returns
Upstream transport status code.
Return values
0Always, in the stub build.
Precondition
om is a valid mbuf chain.
The NimBLE port has been initialised.
Postcondition
Ownership of om passes to the transport.
No data reaches a host in the stub build.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_to_hs_evt()
Since
0.1.0

Definition at line 597 of file nimble_npl_threadx.c.

Referenced by internal_acl_cb().

◆ ble_transport_to_hs_evt()

int ble_transport_to_hs_evt ( void * buf)

Push an HCI event up to the host stack.

Stub: the event is dropped and success is reported so the controller side does not treat the missing host as an error.

Parameters
[in]bufEvent buffer from ble_transport_alloc_evt().
Returns
Upstream transport status code.
Return values
0Always, in the stub build.
Precondition
buf is a valid event buffer.
The NimBLE port has been initialised.
Postcondition
Ownership of buf passes to the transport.
No data reaches a host in the stub build.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_to_hs_acl()
Since
0.1.0

Definition at line 591 of file nimble_npl_threadx.c.

Referenced by internal_event_cb().

◆ ble_transport_to_ll_acl()

int ble_transport_to_ll_acl ( struct os_mbuf * om)

Host-to-controller ACL entry point.

Stub wrapper: forwards straight to ble_transport_to_ll_acl_impl().

Parameters
[in]omACL mbuf chain to send.
Returns
Upstream transport status code.
Return values
0Packet accepted by the controller side.
Precondition
om is a valid ACL mbuf chain.
ble_hci_ra8_ble_init() has succeeded.
Postcondition
Ownership of om passes to the controller side.
No state changes when the controller rejects the packet.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_to_ll_acl_impl()
Since
0.1.0

Definition at line 637 of file nimble_npl_threadx.c.

References ble_transport_to_ll_acl_impl().

◆ ble_transport_to_ll_cmd()

int ble_transport_to_ll_cmd ( void * buf)

Host-to-controller HCI command entry point.

Stub wrapper: forwards straight to ble_transport_to_ll_cmd_impl() so an app that bypasses the upstream transport core still reaches this port's controller side.

Parameters
[in]bufHCI command buffer.
Returns
Upstream transport status code.
Return values
0Command accepted by the controller side.
Precondition
buf holds a well-formed HCI command.
ble_hci_ra8_ble_init() has succeeded.
Postcondition
Ownership of buf passes to the controller side.
No state changes when the controller rejects the command.
Note
Not thread-safe unless the real transport core replaces it.
See also
ble_transport_to_ll_cmd_impl()
Since
0.1.0

Definition at line 632 of file nimble_npl_threadx.c.

References ble_transport_to_ll_cmd_impl().

◆ internal_callout_trampoline()

void internal_callout_trampoline ( ULONG arg)
static

Post a callout event from the ThreadX timer trampoline.

Recovers the caller-owned NPL callout from the timer argument and queues its embedded event when the recovered pointer is valid.

Parameters
[in]argInteger representation of the callout pointer supplied at timer creation.
Precondition
A nonzero arg identifies a live caller-owned callout object.
The callout's event queue remains bound for the timer lifetime.
Postcondition
A valid callout has its embedded event offered to its event queue.
A null argument returns without mutating queue state.
Note
The queue operation retains the NPL event object's normal ownership.
Since
Version 0.1.0

Definition at line 333 of file nimble_npl_threadx.c.

References ble_npl_eventq_put(), ble_npl_callout::ev, ble_npl_callout::evq, and RA8_INTERNAL.

Referenced by ble_npl_callout_init().

◆ internal_tmo_to_tx()

ULONG internal_tmo_to_tx ( ble_npl_time_t tmo)
static

Translate an NPL timeout into a ThreadX wait code.

Preserves finite tick counts and maps the NPL forever sentinel to ThreadX's exact wait-forever value.

Parameters
[in]tmoNPL timeout value to translate.
Returns
ThreadX wait-code representation of tmo.
Return values
TX_WAIT_FOREVERThe input requested an unbounded wait.
Precondition
tmo is a value accepted by the calling NPL primitive.
The configured NPL and ThreadX tick domains use the documented rate.
Postcondition
Finite timeout values are returned without mutation.
The helper changes no NPL or ThreadX object state.
Note
This conversion does not round or rescale finite tick values.
Since
Version 0.1.0

Definition at line 80 of file nimble_npl_threadx.c.

References k_ble_npl_threadx_wait_forever, k_ble_npl_tx_wait_forever, and RA8_INTERNAL.

Referenced by ble_npl_eventq_get(), ble_npl_mutex_pend(), and ble_npl_sem_pend().

◆ nimble_port_get_dflt_eventq()

struct ble_npl_eventq * nimble_port_get_dflt_eventq ( void )

Return the address of the default eventq.

Return the host's default eventq pointer.

Returns
Pointer to the default ble_npl_eventq (never NULL).
Precondition
nimble_port_init has been called.
Postcondition
Caller can pass the returned pointer to ble_npl_eventq_put.
Since
0.1.0

< S dflt eventq.

Definition at line 530 of file nimble_npl_threadx.c.

References s_dflt_eventq.

◆ nimble_port_init()

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.

Precondition
ThreadX kernel is running (tx_kernel_enter returned).
Postcondition
nimble_port_get_dflt_eventq returns a usable queue.
Since
0.1.0
Precondition
Module has been initialized.
Postcondition
Side effects bounded to documented state.
Note
Not thread-safe unless documented otherwise.

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().

◆ nimble_port_run()

void nimble_port_run ( void )

Run the NimBLE host event loop forever.

Pump the NimBLE host event loop forever.

Pumps events out of the default eventq; never returns under normal operation.

Precondition
nimble_port_init has been called.
Postcondition
Calling thread runs the host loop until shutdown.
Since
0.1.0
Precondition
Module has been initialized.
Postcondition
Side effects bounded to documented state.
Note
Not thread-safe unless documented otherwise.

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.

◆ os_mbuf_append()

int os_mbuf_append ( struct os_mbuf * om,
const void * data,
uint16_t len )

Append bytes to an mbuf chain (upstream os_mbuf.h).

Stub: no mbuf pool exists, so the append is a no-op.

Parameters
[in,out]omChain to append to.
[in]dataBytes to copy in.
[in]lenNumber of bytes at data.
Returns
Mynewt status code.
Return values
0Always, in the stub build.
Precondition
om and data are valid for len bytes.
The NimBLE port has been initialised.
Postcondition
om is unchanged in the stub build.
No allocation is performed.
Note
Not thread-safe unless the real mbuf pool replaces it.
See also
os_mbuf_len()
Since
0.1.0

Definition at line 603 of file nimble_npl_threadx.c.

Referenced by internal_acl_cb().

◆ os_mbuf_copydata()

int os_mbuf_copydata ( const struct os_mbuf * om,
int off,
int len,
void * dst )

Copy a byte range out of an mbuf chain.

Stub: copies nothing and reports success.

Parameters
[in]omChain to read from.
[in]offByte offset into the chain payload.
[in]lenNumber of bytes to copy.
[out]dstDestination buffer, at least len bytes.
Returns
Mynewt status code.
Return values
0Always, in the stub build.
Precondition
dst is writable for len bytes.
off and len lie inside the chain payload.
Postcondition
dst is untouched in the stub build.
om is not modified.
Note
Not thread-safe unless the real mbuf pool replaces it.
See also
os_mbuf_len()
Since
0.1.0

Definition at line 623 of file nimble_npl_threadx.c.

Referenced by ble_transport_to_ll_acl_impl().

◆ os_mbuf_free_chain()

int os_mbuf_free_chain ( struct os_mbuf * om)

Free every mbuf in a chain.

Stub: nothing was allocated, so nothing is freed.

Parameters
[in]omHead of the chain to release. May be NULL.
Returns
Mynewt status code.
Return values
0Always, in the stub build.
Precondition
om is a chain head or NULL.
The NimBLE port has been initialised.
Postcondition
The caller no longer owns om.
No pool state changes in the stub build.
Note
Not thread-safe unless the real mbuf pool replaces it.
See also
os_mbuf_append()
Since
0.1.0

Definition at line 611 of file nimble_npl_threadx.c.

Referenced by ble_transport_to_ll_acl_impl(), ble_transport_to_ll_iso_impl(), and internal_acl_cb().

◆ os_mbuf_len()

uint16_t os_mbuf_len ( const struct os_mbuf * om)

Total payload length of an mbuf chain.

Stub: reports an empty chain.

Parameters
[in]omChain to measure. May be NULL.
Returns
Payload length in bytes.
Return values
0Always, in the stub build.
Precondition
om is a chain head or NULL.
The NimBLE port has been initialised.
Postcondition
om is not modified.
No pool state changes.
Note
Not thread-safe unless the real mbuf pool replaces it.
See also
os_mbuf_copydata()
Since
0.1.0

Definition at line 617 of file nimble_npl_threadx.c.

Referenced by ble_transport_to_ll_acl_impl().

Variable Documentation

◆ s_dflt_eventq

struct ble_npl_eventq s_dflt_eventq
static

Default eventq used by the host stack.

Lives in BSS; ble_npl_eventq_init is called once at boot. Surfaced via nimble_port_get_dflt_eventq.

Definition at line 506 of file nimble_npl_threadx.c.

Referenced by nimble_port_get_dflt_eventq(), nimble_port_init(), and nimble_port_run().

◆ s_dflt_eventq_ready

uint8_t s_dflt_eventq_ready = 0U
static

Initialized flag for the default eventq.

Definition at line 509 of file nimble_npl_threadx.c.

Referenced by nimble_port_init().