ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_esp_hosted_osi_absent.c
Go to the documentation of this file.
1
36
37#include <stddef.h>
38#include <stdint.h>
39
40#include "esp_hosted_os_abstraction.h"
41#include "esp_log.h"
45#include "ra8_attributes.h"
47
49
76static int internal_absent(const char* slot)
77{
78 ESP_LOGE(s_esp_hosted_tag, "%s: transport not present on this board", slot);
79 return RET_FAIL;
80}
81
106static int internal_sdio_card_init(void* ctx, bool show_config)
107{
108 (void)show_config;
109 if (ctx == nullptr) {
110 return RET_INVALID;
111 }
112 return internal_absent("_h_sdio_card_init");
113}
114
135static int internal_sdio_card_deinit(void* ctx)
136{
137 if (ctx == nullptr) {
138 return RET_INVALID;
139 }
140 return internal_absent("_h_sdio_card_deinit");
141}
142
167static int
168/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
169internal_sdio_read_reg(void* ctx, uint32_t reg, uint8_t* data, uint16_t size, bool lock_required)
170{
171 (void)reg;
172 (void)lock_required;
173 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
174 return RET_INVALID;
175 }
176 return internal_absent("_h_sdio_read_reg");
177}
178
203static int
204/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
205internal_sdio_write_reg(void* ctx, uint32_t reg, uint8_t* data, uint16_t size, bool lock_required)
206{
207 (void)reg;
208 (void)lock_required;
209 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
210 return RET_INVALID;
211 }
212 return internal_absent("_h_sdio_write_reg");
213}
214
239static int
240/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
241internal_sdio_read_block(void* ctx, uint32_t reg, uint8_t* data, uint16_t size, bool lock_required)
242{
243 (void)reg;
244 (void)lock_required;
245 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
246 return RET_INVALID;
247 }
248 return internal_absent("_h_sdio_read_block");
249}
250
275static int
276/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
277internal_sdio_write_block(void* ctx, uint32_t reg, uint8_t* data, uint16_t size, bool lock_required)
278{
279 (void)reg;
280 (void)lock_required;
281 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
282 return RET_INVALID;
283 }
284 return internal_absent("_h_sdio_write_block");
285}
286
308static int internal_sdio_wait_intr(void* ctx, uint32_t ticks_to_wait)
309{
310 (void)ticks_to_wait;
311 if (ctx == nullptr) {
312 return RET_INVALID;
313 }
314 return internal_absent("_h_sdio_wait_slave_intr"); /* LEGACY-OK: upstream row name */
315}
316
343/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
344static int internal_spi_hd_read_reg(uint32_t reg, uint32_t* data, int poll, bool lock_required)
345{
346 (void)reg;
347 (void)poll;
348 (void)lock_required;
349 if (data == nullptr) {
350 return RET_INVALID;
351 }
352 return internal_absent("_h_spi_hd_read_reg");
353}
354
378/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
379static int internal_spi_hd_write_reg(uint32_t reg, uint32_t* data, bool lock_required)
380{
381 (void)reg;
382 (void)lock_required;
383 if (data == nullptr) {
384 return RET_INVALID;
385 }
386 return internal_absent("_h_spi_hd_write_reg");
387}
388
412/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
413static int internal_spi_hd_read_dma(uint8_t* data, uint16_t size, bool lock_required)
414{
415 (void)lock_required;
416 if ((data == nullptr) || (size == 0U)) {
417 return RET_INVALID;
418 }
419 return internal_absent("_h_spi_hd_read_dma");
420}
421
445/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
446static int internal_spi_hd_write_dma(uint8_t* data, uint16_t size, bool lock_required)
447{
448 (void)lock_required;
449 if ((data == nullptr) || (size == 0U)) {
450 return RET_INVALID;
451 }
452 return internal_absent("_h_spi_hd_write_dma");
453}
454
481static int internal_spi_hd_set_data_lines(uint32_t data_lines)
482{
483 if ((data_lines != (uint32_t)H_SPI_HD_CONFIG_1_DATA_LINE) &&
484 (data_lines != (uint32_t)H_SPI_HD_CONFIG_2_DATA_LINES) &&
485 (data_lines != (uint32_t)H_SPI_HD_CONFIG_4_DATA_LINES)) {
486 return RET_INVALID;
487 }
488 return internal_absent("_h_spi_hd_set_data_lines");
489}
490
513{
514 return internal_absent("_h_spi_hd_send_cmd9");
515}
516
539/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
540static int internal_uart_read(void* ctx, uint8_t* data, uint16_t size)
541{
542 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
543 return RET_INVALID;
544 }
545 return internal_absent("_h_uart_read");
546}
547
570/* NOLINTNEXTLINE(readability-non-const-parameter) -- hosted_osi_funcs_t row is non-const. */
571static int internal_uart_write(void* ctx, uint8_t* data, uint16_t size)
572{
573 if ((ctx == nullptr) || (data == nullptr) || (size == 0U)) {
574 return RET_INVALID;
575 }
576 return internal_absent("_h_uart_write");
577}
578
599static int internal_uart_flush_input(void* ctx)
600{
601 if (ctx == nullptr) {
602 return RET_INVALID;
603 }
604 return internal_absent("_h_uart_flush_input");
605}
606
610void priv_ra8_esp_hosted_osi_bind_absent(hosted_osi_funcs_t* out)
611{
612 if (out == nullptr) {
613 return;
614 }
615
616 out->_h_sdio_card_init = internal_sdio_card_init;
617 out->_h_sdio_card_deinit = internal_sdio_card_deinit;
618 out->_h_sdio_read_reg = internal_sdio_read_reg;
619 out->_h_sdio_write_reg = internal_sdio_write_reg;
620 out->_h_sdio_read_block = internal_sdio_read_block;
621 out->_h_sdio_write_block = internal_sdio_write_block;
622 out->_h_sdio_wait_slave_intr = internal_sdio_wait_intr; /* LEGACY-OK: upstream field */
623
624 out->_h_spi_hd_read_reg = internal_spi_hd_read_reg;
625 out->_h_spi_hd_write_reg = internal_spi_hd_write_reg;
626 out->_h_spi_hd_read_dma = internal_spi_hd_read_dma;
627 out->_h_spi_hd_write_dma = internal_spi_hd_write_dma;
628 out->_h_spi_hd_set_data_lines = internal_spi_hd_set_data_lines;
629 out->_h_spi_hd_send_cmd9 = internal_spi_hd_send_cmd9;
630
631 out->_h_uart_read = internal_uart_read;
632 out->_h_uart_write = internal_uart_write;
633 out->_h_uart_flush_input = internal_uart_flush_input;
634}
ESP-IDF-compatible logging surface, implemented by this port.
#define ESP_LOGE(tag,...)
Log a fault the caller cannot recover from itself.
Definition esp_log.h:313
esp-hosted port header: transport selection, side-band pin map, link polarity.
#define H_SPI_HD_CONFIG_2_DATA_LINES
Selector passed to the port when two data lines are negotiated.
#define H_SPI_HD_CONFIG_4_DATA_LINES
Selector passed to the port when four data lines are negotiated.
#define H_SPI_HD_CONFIG_1_DATA_LINE
Selector passed to the port when one data line is negotiated.
esp-hosted port header: the per-file log tag the core expects.
#define DEFINE_LOG_TAG(tag)
Declare the file-scope s_esp_hosted_tag string the ESP_LOGx macros use.
esp-hosted port header: RTOS handle types, return codes and budgets.
#define RET_FAIL
Operation failed for an unspecified reason.
#define RET_INVALID
A parameter was out of contract (null handle, bad size).
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
static const char * s_esp_hosted_tag
static int internal_sdio_read_reg(void *ctx, uint32_t reg, uint8_t *data, uint16_t size, bool lock_required)
Vtable row: read an SDIO peripheral register.
static int internal_sdio_card_deinit(void *ctx)
Vtable row: shut an SDIO card down.
static int internal_sdio_read_block(void *ctx, uint32_t reg, uint8_t *data, uint16_t size, bool lock_required)
Vtable row: read an SDIO data block.
static int internal_sdio_write_block(void *ctx, uint32_t reg, uint8_t *data, uint16_t size, bool lock_required)
Vtable row: write an SDIO data block.
static int internal_spi_hd_set_data_lines(uint32_t data_lines)
Vtable row: choose how many half-duplex SPI data lines to use.
static int internal_spi_hd_read_dma(uint8_t *data, uint16_t size, bool lock_required)
Vtable row: read a half-duplex SPI data burst.
static int internal_sdio_card_init(void *ctx, bool show_config)
Vtable row: bring an SDIO card up.
static int internal_spi_hd_write_reg(uint32_t reg, uint32_t *data, bool lock_required)
Vtable row: write a half-duplex SPI register.
static int internal_uart_write(void *ctx, uint8_t *data, uint16_t size)
Vtable row: write to the UART transport.
static int internal_sdio_write_reg(void *ctx, uint32_t reg, uint8_t *data, uint16_t size, bool lock_required)
Vtable row: write an SDIO peripheral register.
static int internal_spi_hd_read_reg(uint32_t reg, uint32_t *data, int poll, bool lock_required)
Vtable row: read a half-duplex SPI register.
void priv_ra8_esp_hosted_osi_bind_absent(hosted_osi_funcs_t *out)
Implementation of priv_ra8_esp_hosted_osi_bind_absent() – fills all sixteen rows so none is ever left...
static int internal_absent(const char *slot)
Report a call into a transport this board does not carry.
static int internal_sdio_wait_intr(void *ctx, uint32_t ticks_to_wait)
Vtable row: wait for an SDIO peripheral interrupt.
static int internal_uart_read(void *ctx, uint8_t *data, uint16_t size)
Vtable row: read from the UART transport.
static int internal_spi_hd_write_dma(uint8_t *data, uint16_t size, bool lock_required)
Vtable row: write a half-duplex SPI data burst.
static int internal_spi_hd_send_cmd9(void)
Vtable row: issue the half-duplex SPI command-nine sequence.
static int internal_uart_flush_input(void *ctx)
Vtable row: discard whatever the UART transport has buffered.
Library-private surface of the esp-hosted OS-abstraction vtable.
static ra8_err_t internal_uart_write(void *ctx, const uint8_t *buf, uint32_t len, uint32_t *out_written)
UART sink: write all bytes out of the SCI channel by polling.