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

NSC veneer: ethernet frame TX / RX. More...

#include <stdint.h>
#include "ra8_check.h"
#include "ra8_err.h"
#include "ra8_net_pal.h"
#include "ra8_nsc.h"
#include "ra8_nsc_veneer.h"
Include dependency graph for ra8_nsc_eth.c:

Go to the source code of this file.

Functions

ra8_err_t ra8_nsc_eth_send (const uint8_t *ns_frame, uint16_t len)
 NSC veneer: transmit an Ethernet frame from Non-Secure code.
ra8_err_t ra8_nsc_eth_recv (uint8_t *ns_buf, uint16_t *inout_len)
 NSC veneer: receive an Ethernet frame into a Non-Secure buffer.

Variables

static const char * s_tag = "NSCETH"

Detailed Description

NSC veneer: ethernet frame TX / RX.

Tag
[Ring 4 / NSC] {World: NSC}

scaffold. The veneers delegate to ra8_net_pal which, in turn, delegates to ra8_eth. adds __attribute__((cmse_nonsecure_entry)) and runtime address checks via cmse_check_address_range.

Definition in file ra8_nsc_eth.c.

Function Documentation

◆ ra8_nsc_eth_recv()

ra8_err_t ra8_nsc_eth_recv ( uint8_t * ns_buf,
uint16_t * inout_len )
nodiscard

NSC veneer: receive an Ethernet frame into a Non-Secure buffer.

NSC veneer: pull the next received frame to NS memory.

Validates capacity and pointer ranges, then forwards to ra8_net_pal_recv_frame.

Parameters
[out]ns_bufNon-Secure destination buffer.
[in,out]inout_lenIn: capacity; out: bytes written.
Returns
ra8_err_t outcome.
Return values
k_ra8_okFrame copied; *inout_len updated.
k_ra8_err_null_ptrA pointer argument was NULL.
k_ra8_err_invalid_argCapacity below the frame max.
Precondition
TrustZone substrate has been initialized.
Both pointers lie in the NS data region.
Postcondition
On success *inout_len reflects the byte count copied.
On failure *ns_buf may still have been touched.
Note
Thread-safe: serialises through the secure ra8_net_pal lock.
Since
0.1.0

Definition at line 82 of file ra8_nsc_eth.c.

References k_ra8_err_invalid_arg, k_ra8_nsc_eth_frame_max, RA8_CHECK_NULL_PTR, ra8_net_pal_recv_frame(), RA8_NSC_CHECK_NS_RANGE_RW, RA8_NSC_VENEER, and s_tag.

◆ ra8_nsc_eth_send()

ra8_err_t ra8_nsc_eth_send ( const uint8_t * ns_frame,
uint16_t len )
nodiscard

NSC veneer: transmit an Ethernet frame from Non-Secure code.

NSC veneer: hand a frame to the secure ESWM transmit path.

Validates the NS-side pointer/length, runs cmse_check_address_range (TZ builds), and forwards to ra8_net_pal_send_frame.

Parameters
[in]ns_frameNon-Secure source buffer holding the L2 frame.
[in]lenFrame length in bytes; 1..k_ra8_nsc_eth_frame_max.
Returns
ra8_err_t outcome.
Return values
k_ra8_okFrame queued for TX.
k_ra8_err_null_ptrns_frame was NULL.
k_ra8_err_invalid_arglen out of range.
Precondition
TrustZone substrate has been initialized.
ns_frame lies entirely within the NS data region.
Postcondition
On success the secure-side TX path owns a copy of the frame.
On failure no bytes were forwarded to ra8_net_pal.
Note
Thread-safe: serialises through the secure ra8_net_pal lock.
Since
0.1.0

Definition at line 50 of file ra8_nsc_eth.c.

References k_ra8_err_invalid_arg, k_ra8_nsc_eth_frame_max, RA8_CHECK_NULL_PTR, ra8_net_pal_send_frame(), RA8_NSC_CHECK_NS_RANGE_R, RA8_NSC_VENEER, and s_tag.

Variable Documentation

◆ s_tag

const char* s_tag = "NSCETH"
static

Definition at line 26 of file ra8_nsc_eth.c.