30static const char*
s_tag =
"NSCCOM";
251 return ra8_i3c_read(channel, target_7b, out_buf, len,
false);
400 const uint64_t span = (uint64_t)bytes_per_unit * (uint64_t)len;
401 if (span > (uint64_t)UINT32_MAX) {
404 *out_span = (uint32_t)span;
445 if (bytes_per_unit == 0U) {
493 if (bytes_per_unit == 0U) {
519 if (bytes_per_unit == 0U) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_NSC_VENEER
Mark a TrustZone Secure-to-Non-Secure entry-point veneer.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
I3C Bus Interface driver – unified native-I3C + I2C-compat modes.
ra8_err_t ra8_i3c_read(uint8_t channel, uint8_t addr, uint8_t *buf, uint32_t len, bool restart)
Read len bytes from addr.
@ k_ra8_i3c_mode_i2c
Legacy I2C-compatibility controller.
ra8_err_t ra8_i3c_write(uint8_t channel, uint8_t addr, const uint8_t *data, uint32_t len, bool restart)
Write len bytes to addr.
ra8_err_t ra8_i3c_init(uint8_t channel, const ra8_i3c_cfg_t *cfg)
Initialise an I3C channel in the configured mode.
ra8_err_t ra8_nsc_sci_getc(uint8_t channel, uint8_t *out_byte)
NSC veneer: blocking single-byte SCI read.
ra8_err_t ra8_nsc_iic_init(uint8_t channel, const ra8_i3c_cfg_t *cfg)
NSC veneer: bring up an IIC (I2C-B) channel from NS code.
static bool internal_spi_byte_span(uint8_t bytes_per_unit, uint32_t len, uint32_t *out_span)
Byte span of len frames at bytes_per_unit each, in 64-bit.
ra8_err_t ra8_nsc_spi_write_read(uint32_t ch_bw, const void *tx, void *rx, uint32_t len)
NSC veneer: multi-frame full-duplex polling SPI exchange.
static uint8_t internal_spi_unit_bytes(ra8_spi_bit_width_t bit_width)
Bytes-per-frame helper for the NSC SPI multi-byte veneers.
ra8_err_t ra8_nsc_spi_xfer8(uint8_t channel, uint8_t tx, uint8_t *rx)
NSC veneer: full-duplex single-byte SPI exchange.
ra8_err_t ra8_nsc_sci_putc(uint8_t channel, uint8_t byte)
NSC veneer: blocking single-byte SCI write.
ra8_err_t ra8_nsc_iic_write(uint8_t channel, uint8_t target_7b, const uint8_t *data, uint32_t len)
NSC veneer: blocking I2C write to a 7-bit target.
ra8_err_t ra8_nsc_spi_init(uint8_t channel, const ra8_spi_cfg_t *cfg)
NSC veneer: bring up an SPI controller channel from NS code.
ra8_err_t ra8_nsc_spi_write(uint8_t channel, const void *tx, uint32_t len, ra8_spi_bit_width_t bit_width)
NSC veneer: multi-frame TX-only polling SPI write.
ra8_err_t ra8_nsc_spi_read(uint8_t channel, void *rx, uint32_t len, ra8_spi_bit_width_t bit_width)
NSC veneer: multi-frame RX-only polling SPI read.
ra8_err_t ra8_nsc_iic_read(uint8_t channel, uint8_t target_7b, uint8_t *out_buf, uint32_t len)
NSC veneer: blocking I2C read from a 7-bit target.
ra8_err_t ra8_nsc_sci_init(uint8_t channel, const ra8_sci_cfg_t *cfg)
NSC veneer: bring up an SCI channel from Non-Secure code.
ra8_err_t ra8_nsc_usb_init(ra8_usb_speed_t speed)
NSC veneer: bring up the USB device controller.
ra8_err_t ra8_nsc_usb_attach(ra8_usb_speed_t speed, bool attached)
NSC veneer: raise / drop the USB D+ pull-up.
NSC veneers for the communications drivers.
@ k_ra8_nsc_spi_bw_shift
Bit position of bit_width.
@ k_ra8_nsc_spi_byte_msk
Byte mask within the packed word.
Macros for declaring Non-Secure Callable veneer functions.
#define RA8_NSC_CHECK_NS_RANGE_R(ptr, len)
RA8 NSC CHECK NS RANGE r.
#define RA8_NSC_CHECK_NS_RANGE_RW(ptr, len)
RA8 NSC CHECK NS RANGE RW.
Full-featured Serial Communications Interface driver.
ra8_err_t ra8_sci_init(uint8_t channel, const ra8_sci_cfg_t *cfg)
Initialise an SCI channel using the descriptor.
ra8_err_t ra8_sci_getc_polling(uint8_t channel, uint8_t *out_byte)
Poll-receive one byte (blocking, bounded spin).
ra8_err_t ra8_sci_putc_polling(uint8_t channel, uint8_t byte)
Poll-send one byte (blocking, bounded by ra8_hw_err spin budget).
SPI_B controller driver (RA8D2 Type-B SPI peripheral).
ra8_spi_bit_width_t
Per-frame bit width for multi-byte transfers.
@ k_ra8_spi_width_16
16-bit frame -> SPCMDn.SPB = 0b01111.
@ k_ra8_spi_width_32
32-bit frame -> SPCMDn.SPB = 0b11111.
@ k_ra8_spi_width_8
8-bit frame -> SPCMDn.SPB = 0b00111.
ra8_err_t ra8_spi_write(uint8_t channel, const void *tx, uint32_t len, ra8_spi_bit_width_t bit_width)
Multi-frame TX-only polling transfer.
ra8_err_t ra8_spi_write_read(uint8_t channel, const void *tx, void *rx, uint32_t len, ra8_spi_bit_width_t bit_width)
Multi-frame full-duplex polling transfer.
ra8_err_t ra8_spi_xfer8(uint8_t channel, uint8_t tx, uint8_t *rx)
Full-duplex 8-bit exchange.
ra8_err_t ra8_spi_read(uint8_t channel, void *rx, uint32_t len, ra8_spi_bit_width_t bit_width)
Multi-frame RX-only polling transfer.
ra8_err_t ra8_spi_init(uint8_t channel, const ra8_spi_cfg_t *cfg)
Initialise an SPI channel with a full config descriptor.
Native USB controller driver public API (device + host modes).
ra8_err_t ra8_usb_device_init(ra8_usb_speed_t speed)
Bring up a USB controller in device mode.
ra8_err_t ra8_usb_device_attach(ra8_usb_speed_t speed, bool attached)
Raise / drop the D+ pull-up to advertise the device to the host.
ra8_usb_speed_t
Selects which controller instance the call targets.
Per-channel bring-up configuration for ra8_i3c_init.
ra8_i3c_mode_t mode
Operating mode for this channel.
Configuration descriptor for ra8_sci_init.
Configuration descriptor for ra8_spi_init.