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

Test-access surface for the BLE loopback transport. More...

#include <stdint.h>
#include "ra8_attributes.h"
Include dependency graph for ra8_ble_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ra8_ble_test_reset_capture (void)
 Reset the BLE loopback capture and injection cursors.
void ra8_ble_test_inject_rx (const uint8_t *bytes, uint16_t len)
 Replace the synthetic BLE receive input with bounded caller bytes.
const uint8_t * ra8_ble_test_tx_capture (uint16_t *out_len)
 Borrow the BLE transmit capture and optionally report its length.

Detailed Description

Test-access surface for the BLE loopback transport.

Declares the bounded capture and injection hooks used to verify HCI framing and receive dispatch without exposing them as public HAL operations. Production code must use the API in ra8_ble.h.

Since
Version 0.1.0

Definition in file ra8_ble_internal.h.

Function Documentation

◆ ra8_ble_test_inject_rx()

void ra8_ble_test_inject_rx ( const uint8_t * bytes,
uint16_t len )

Replace the synthetic BLE receive input with bounded caller bytes.

Rejects a null source or zero length without changing state. A longer source is truncated to k_ra8_ble_rx_inject_bytes, copied into module-owned storage, and made readable from position zero.

Parameters
[in]bytesSource bytes, or nullptr for the rejected-input vector.
[in]lenReadable source extent in bytes; values above the injection capacity are truncated.
Precondition
When non-null, bytes addresses at least len readable bytes.
No concurrent BLE operation is reading or modifying loopback state.
Postcondition
Rejected input leaves the existing receive injection state unchanged.
Accepted input replaces the receive bytes, publishes the bounded length, and resets the read position to zero.
Note
Test-only hook; it copies input and retains no caller-owned pointer.
MC/DC:
The (bytes == nullptr) || (len == 0) guard uses three vectors: non-null and nonzero continues, null and nonzero returns, and non-null and zero returns. These demonstrate each condition's independent influence.
Since
Version 0.1.0

Definition at line 479 of file ra8_ble.c.

References internal_byte_copy(), k_ra8_ble_rx_inject_bytes, RA8_TEST_HELPER, and s_state.

◆ ra8_ble_test_reset_capture()

void ra8_ble_test_reset_capture ( void )

Reset the BLE loopback capture and injection cursors.

Clears the recorded transmit length and discards every unread byte in the synthetic receive buffer without changing open state or registered callbacks.

Precondition
The linked BLE implementation provides its loopback test hooks.
No concurrent BLE operation is reading or modifying loopback state.
Postcondition
The transmit capture length is zero.
The receive injection length and read position are zero.
Note
Test-only hook; not thread-safe with any other BLE operation.
MC/DC:
This decision-free reset supplies the known-empty control state used by the HCI framing and injection vectors.
Since
Version 0.1.0

Definition at line 472 of file ra8_ble.c.

References RA8_TEST_HELPER, and s_state.

◆ ra8_ble_test_tx_capture()

const uint8_t * ra8_ble_test_tx_capture ( uint16_t * out_len)

Borrow the BLE transmit capture and optionally report its length.

Returns the stable module-owned capture base and writes the number of valid leading bytes only when out_len is non-null.

Parameters
[out]out_lenOptional destination for the captured byte count.
Returns
Read-only pointer to the module-owned transmit capture.
Return values
non-nullThe fixed capture buffer base; ownership remains internal.
Precondition
When non-null, out_len addresses writable uint16_t storage.
No concurrent BLE operation is appending to the capture.
Postcondition
A non-null out_len contains the current capture length.
The capture bytes and all BLE module state remain unchanged.
Note
Test-only borrowed view; valid for the module lifetime and mutable by later BLE transmit or reset operations.
MC/DC:
Tests call with a writable length pointer and with nullptr to cover both outcomes of the optional-output decision.
Since
Version 0.1.0

Definition at line 492 of file ra8_ble.c.

References RA8_TEST_HELPER, and s_state.