ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_board_ek_ra8d2_peripherals.h
Go to the documentation of this file.
1
35
36#pragma once
37
38#include <stddef.h>
39#include <stdint.h>
40
41#include "ra8_attributes.h"
43#include "ra8_err.h"
44#include "ra8_port_constants.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
51typedef struct {
52 uint32_t cpuclk0_hz;
53 uint32_t pclka_hz;
55
75
76/* =============================================================================
77 * 6c. Project SW4 layout (UM Section 4.3 Table 3 p 16 + Table 18 p 26)
78 * -- I/O-expander override functions (the ra8_board_pi4ioe_project_t
79 * enum that names the output bytes lives in the connectors header).
80 * =============================================================================
81 */
82
112
132[[nodiscard]] ra8_err_t ra8_board_io_expander_apply_sw4(uint8_t output_byte);
133
144[[nodiscard]] ra8_err_t ra8_board_io_expander_apply_sw4_mask(uint8_t output_byte,
145 uint8_t output_mask);
146
189
190/* =============================================================================
191 * 7. USB (UM Section 5.4.1 + 6.2, Tables 22 + 28, p 30 + 34)
192 * =============================================================================
193 */
194
207typedef enum : uint16_t {
208 /* The HS D+/D- differential pair (USBH_P/USBH_N) is internal to the chip,
209 * so only the two MCU-driven board signals below are port pins: the VBUS
210 * sense input and the J7 host-power-switch enable. */
212 (uint16_t)RA8_PIN(k_ra8_port_4, k_ra8_pin_8),
215 k_ra8_pin_7),
217
242
258
290
339
368
375[[nodiscard]] ra8_err_t ra8_board_usbhs_device_init(void);
376
383[[nodiscard]] ra8_err_t ra8_board_usbhs_host_init(void);
384
385/* =============================================================================
386 * 8. Camera connector J35 (UM Section 8.3, Tables 35 + 36, p 48 + 49)
387 * =============================================================================
388 */
389
452
457
473[[nodiscard]] ra8_err_t ra8_board_camera_xclk_start(uint32_t frequency_hz);
474
489
504
520[[nodiscard]] ra8_err_t ra8_board_camera_reset(void);
521
543[[nodiscard]] ra8_err_t
544ra8_board_camera_sccb_read_reg(void* ctx, uint8_t address, uint16_t reg, uint8_t* out_value);
545
563[[nodiscard]] ra8_err_t
564ra8_board_camera_sccb_write_reg(void* ctx, uint8_t address, uint16_t reg, uint8_t value);
565
578void ra8_board_camera_delay_ms(void* ctx, uint32_t milliseconds);
579
580/* =============================================================================
581 * 9. Octo-SPI flash + SDRAM (UM Section 6.3 + 6.4, Tables 29 + 30, p 35 + 36)
582 * =============================================================================
583 */
584
595typedef enum : uintptr_t {
598 0x68000000UL,
600
602typedef enum : uint32_t {
604 k_ra8_board_sdram_size = 0x04000000UL,
606
654
676[[nodiscard]] ra8_err_t ra8_board_xspi_pins_init(void);
677
678/* =============================================================================
679 * 10. MIPI-DSI graphics expansion port J32
680 * (UM Section 8.2, Table 34, page 45)
681 * =============================================================================
682 */
683
712
719[[nodiscard]] ra8_err_t ra8_board_mipi_dsi_init(void);
720
721/* =============================================================================
722 * 11. J-Link OB VCOM serial bridge (UM Section 5.2.4, Table 13, page 24)
723 * =============================================================================
724 */
725
742typedef enum : uint8_t {
746
760
780
814[[nodiscard]] ra8_err_t ra8_board_uart_console_init(uint32_t baud);
815
830[[nodiscard]] ra8_err_t ra8_board_uart_console_write(const uint8_t* data, size_t len);
831
852[[nodiscard]] ra8_err_t ra8_board_uart_console_read(uint8_t* out, size_t cap, size_t* out_len);
853
883[[nodiscard]] ra8_err_t ra8_board_uart_console_flush(void);
884
885/* =============================================================================
886 * 12. On-board RGMII Ethernet PHY (UM Section 6.1, Tables 26 + 27, p 33-34)
887 * =============================================================================
888 */
889
936
958
989
990#ifdef __cplusplus
991}
992#endif
Annotation-attribute framework macros for ra8-firmware.
#define RA8_NODISCARD
Warn at any call site that discards the function's return value.
Board-identity, LEDs, switches, display, audio, Arduino, Pmod, and MikroBUS portion of the EK-RA8D2 v...
ra8_err_t ra8_board_camera_reset(void)
Pulse the J35 camera reset input and leave the sensor released.
ra8_err_t ra8_board_uart_console_read(uint8_t *out, size_t cap, size_t *out_len)
Polled non-blocking read from the J-Link OB VCOM console.
ra8_err_t ra8_board_io_expander_set_usbhs_host_mode(void)
Drive the U15 I/O expander to select USB-HS HOST mode.
ra8_err_t ra8_board_usbhs_device_init(void)
Bring the chip USBHS module up in device mode (HS PHY).
ra8_board_eth_pin_t
Pin assignments for the on-board MaxLinear PEF7071 (GPY111) PHY.
@ k_ra8_board_eth_pin_rxd0
RXD0, P906 (E36).
@ k_ra8_board_eth_pin_mdio
MDIO, P414.
@ k_ra8_board_eth_pin_tx_clk
TX_CLK, P309 (E23).
@ k_ra8_board_eth_pin_rxd2
RXD2, P908 (E33).
@ k_ra8_board_eth_pin_txd1
TXD1, P306 (E20).
@ k_ra8_board_eth_pin_txd2
TXD2, P305 (E19).
@ k_ra8_board_eth_pin_txd0
TXD0, P307 (E21).
@ k_ra8_board_eth_pin_mdint
MDINT, P107.
@ k_ra8_board_eth_pin_rxd3
RXD3, P909 (E24).
@ k_ra8_board_eth_pin_rstn
RSTN, P708.
@ k_ra8_board_eth_pin_mdc
MDC, P415.
@ k_ra8_board_eth_pin_rx_clk
RX_CLK, P905 (E37).
@ k_ra8_board_eth_pin_rx_ctl
RX_CTL, P206 (E38).
@ k_ra8_board_eth_pin_txd3
TXD3, P304 (E18).
@ k_ra8_board_eth_pin_rxd1
RXD1, P907 (E34).
@ k_ra8_board_eth_pin_tx_ctl
TX_CTL, P310 (E22).
ra8_err_t ra8_board_io_expander_apply_project_sw4_defaults(void)
Program the U15 I/O expander to apply the project's SW4 layout.
ra8_board_uart_console_pin_t
Pin assignments for the J-Link OB VCOM bridge (UM Table 13 p 24).
@ k_ra8_board_uart_console_pin_cts
PD05 CTS (link E9).
@ k_ra8_board_uart_console_pin_txd
PD02 TXD.
@ k_ra8_board_uart_console_pin_rts
PD04 RTS (link E17).
@ k_ra8_board_uart_console_pin_rxd
PD03 RXD.
ra8_err_t ra8_board_usbhs_host_init(void)
Bring the chip USBHS module up in host mode.
ra8_err_t ra8_board_camera_sccb_write_reg(void *ctx, uint8_t address, uint16_t reg, uint8_t value)
Write one 16-bit-addressed SCCB register on the J35 camera bus.
ra8_err_t ra8_board_camera_sccb_read_reg(void *ctx, uint8_t address, uint16_t reg, uint8_t *out_value)
Read one 16-bit-addressed SCCB register on the J35 camera bus.
ra8_err_t ra8_board_clocks_init(ra8_board_clock_rates_t *out_rates)
Initialize the standard EK-RA8D2 clock tree and return its rates.
ra8_board_extmem_size_t
Sizes of the off-chip memories, in bytes.
@ k_ra8_board_sdram_size
64 MiB.
@ k_ra8_board_xspi_flash_size
64 MiB.
ra8_board_camera_bus_t
RIIC controller channel wired to the J35 camera SCCB bus.
@ k_ra8_board_camera_i2c_channel
RIIC1 serves J35 SCCB.
ra8_err_t ra8_board_ethernet_init(void)
Bring up the on-board RGMII Ethernet PHY and RMAC1/ETHA1.
ra8_board_eth_index_t
ETHA / RMAC port and PHY MDIO address for the on-board PHY.
@ k_ra8_board_eth_etha_port
ETHA1 (k_ra8_etha_port_1).
@ k_ra8_board_eth_rmac_port
RMAC1 (k_ra8_rmac_port_1).
@ k_ra8_board_eth_phy_addr
MDIO addr of the on-board PHY (HW strap on PEF7071, UM Table 27 p 34).
ra8_board_i3c0_pin_t
IIC_B / I3C channel-0 board pins (SCL0 / SDA0), UM Table 20 p 28.
@ k_ra8_board_i3c0_pin_scl
P400 SCL0.
@ k_ra8_board_i3c0_pin_sda
P401 SDA0.
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_mipi_dsi_init(void)
Bring the MIPI-DSI link up (PHY + DSI controller).
ra8_err_t ra8_board_camera_xclk_start(uint32_t frequency_hz)
Start the J35 camera sensor input clock (XCLK) on P501/GTIOC12A.
ra8_err_t ra8_board_io_expander_apply_sw4_mask(uint8_t output_byte, uint8_t output_mask)
Override selected SW4 positions while releasing every other position.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_board_uart_sci_channel_t
SCI channel that backs k_ra8_board_uart_console.
@ k_ra8_board_uart_console_sci_channel
PD02/PD03 -> SCI8 (verified on real EK-RA8D2 v1 silicon).
ra8_board_usbhs_pin_t
USBHS host/device routing per UM Table 28 p 34.
@ k_ra8_board_usbhs_pin_pwr
PD07 J7 host-power switch (HIGH = U18 drives 5 V VBUS).
@ k_ra8_board_usbhs_pin_vbus
P4_08 USBHS_VBUS sense.
ra8_board_usbfs_pin_t
USB-FS (J11) board-routed port pins, UM Table 22 p 30.
@ k_ra8_board_usbfs_pin_dm
P8_15 D-.
@ k_ra8_board_usbfs_pin_vbusen
P5_00 VBUSEN GPIO.
@ k_ra8_board_usbfs_pin_vbus
P4_07 VBUS sense.
@ k_ra8_board_usbfs_pin_dp
P8_14 D+.
ra8_err_t ra8_board_io_expander_set_usbhs_device_mode(void)
Drive the U15 PI4IOE5V6408 I/O expander to select USB-HS device mode.
ra8_board_uart_t
Identifiers for board-routed UART consoles.
@ k_ra8_board_uart_console
J-Link OB VCOM bridge: PD02 TXD / PD03 RXD on SCI8.
ra8_board_mipi_dsi_pin_t
MIPI-DSI display-connector control pins (J32).
@ k_ra8_board_mipi_dsi_backlight
DSI DISP_BLEN, P514.
@ k_ra8_board_mipi_dsi_reset_n
DSI DISP_RST, P606.
@ k_ra8_board_mipi_dsi_i2c_scl
DSI I2C SCL1, P512.
@ k_ra8_board_mipi_dsi_touch_int
DSI DISP_INT (IRQ-19), P111.
@ k_ra8_board_mipi_dsi_te
DSI tearing-effect, P411.
@ k_ra8_board_mipi_dsi_i2c_sda
DSI I2C SDA1, P511.
ra8_err_t ra8_board_io_expander_apply_sw4(uint8_t output_byte)
Program an exact U15 SW4 override byte in one bring-up sequence.
ra8_board_extmem_base_t
Memory-mapped base addresses for off-chip XSPI / SDRAM.
@ k_ra8_board_xspi_flash_base
64 MB IS25LX512M (chip HUM memory map).
@ k_ra8_board_sdram_base
64 MB IS42S32160F (per linker scripts + ra8_sdramc.c).
ra8_board_camera_pin_t
Pins routed to the parallel-camera connector J35 (DVP mode).
@ k_ra8_board_cam_d3
CAM D3, P406 (J41).
@ k_ra8_board_cam_pclk
CAM PCLK, PB04.
@ k_ra8_board_cam_vsync
CAM VSYNC, PB02.
@ k_ra8_board_cam_d7
CAM D7, P703.
@ k_ra8_board_cam_d0
CAM D0, P400.
@ k_ra8_board_cam_int
CAM INT (IRQ-14), P010.
@ k_ra8_board_cam_hsync
CAM HSYNC, PB03.
@ k_ra8_board_cam_xclk
CAM XCLK, P501.
@ k_ra8_board_cam_d2
CAM D2, P405 (J41).
@ k_ra8_board_cam_d1
CAM D1, P902.
@ k_ra8_board_cam_rst
CAM RST, P709.
@ k_ra8_board_cam_d5
CAM D5, P701.
@ k_ra8_board_cam_d6
CAM D6, P702.
@ k_ra8_board_cam_i2c_scl
CAM I2C SCL (SCL1), P512.
@ k_ra8_board_cam_i2c_sda
CAM I2C SDA (SDA1), P511.
@ k_ra8_board_cam_d4
CAM D4, P700.
ra8_err_t ra8_board_io_expander_set_octospi_active(void)
Program the U15 I/O expander to request the Octo-SPI SW4 layout.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.
ra8_err_t ra8_board_camera_route_parallel_pins(void)
Route J35 D[7:0], VSYNC, HSYNC and PCLK to the CEU peripheral.
ra8_board_xspi_pin_t
Pins routed to the on-board IS25LX512M Octo-SPI flash.
@ k_ra8_board_xspi_dq2
OSPI_FLASH_DQ2, P103.
@ k_ra8_board_xspi_dq7
OSPI_FLASH_DQ7, P804.
@ k_ra8_board_xspi_dq6
OSPI_FLASH_DQ6, P802.
@ k_ra8_board_xspi_dq1
OSPI_FLASH_DQ1, P803.
@ k_ra8_board_xspi_dq5
OSPI_FLASH_DQ5, P800.
@ k_ra8_board_xspi_dq3
OSPI_FLASH_DQ3, P101.
@ k_ra8_board_xspi_dq0
OSPI_FLASH_DQ0, P100.
@ k_ra8_board_xspi_clk
OSPI_FLASH_C, P808.
@ k_ra8_board_xspi_reset
OSPI_FLASH_RESET_L, P106.
@ k_ra8_board_xspi_dqs
OSPI_FLASH_DQS, P801.
@ k_ra8_board_xspi_dq4
OSPI_FLASH_DQ4, P102.
@ k_ra8_board_xspi_cs
OSPI_FLASH_S_L, P104.
ra8_err_t ra8_board_camera_select_parallel(void)
Drive only SW4-6 ON through U15, selecting J35 parallel DVP.
ra8_err_t ra8_board_xspi_pins_init(void)
Route the 12 OCTA bus pins to the xSPI peripheral and pulse RESET_L.
ra8_board_touch_wiring_t
Where the on-board GoodIX GT911 capacitive-touch controller sits.
@ k_ra8_board_touch_target_7b
GT911 default 7-bit target address.
@ k_ra8_board_touch_bus_hz
Fast-mode I2C rate for the touch bus.
@ k_ra8_board_touch_i3c_channel
IIC_B / I3C channel 0 carries the GT911.
void ra8_board_camera_delay_ms(void *ctx, uint32_t milliseconds)
Millisecond delay adapter for transport-independent camera drivers.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Typed Port / Pin Constants for the RA8D2 IOPORT Module.
@ k_ra8_port_13
RA8 port 13.
@ k_ra8_port_9
RA8 port 9.
@ k_ra8_port_7
RA8 port 7.
@ k_ra8_port_3
RA8 port 3.
@ k_ra8_port_11
RA8 port 11.
@ k_ra8_port_2
RA8 port 2.
@ k_ra8_port_6
RA8 port 6.
@ k_ra8_port_4
RA8 port 4.
@ k_ra8_port_5
RA8 port 5.
@ k_ra8_port_0
RA8 port 0.
@ k_ra8_port_8
RA8 port 8.
@ k_ra8_port_1
RA8 port 1.
#define RA8_PIN(port, pin)
Build a ra8_port_pin_t from explicit port / pin indices.
@ k_ra8_pin_4
RA8 pin 4.
@ k_ra8_pin_6
RA8 pin 6.
@ k_ra8_pin_11
RA8 pin 11.
@ k_ra8_pin_7
RA8 pin 7.
@ k_ra8_pin_10
RA8 pin 10.
@ k_ra8_pin_1
RA8 pin 1.
@ k_ra8_pin_2
RA8 pin 2.
@ k_ra8_pin_12
RA8 pin 12.
@ k_ra8_pin_5
RA8 pin 5.
@ k_ra8_pin_14
RA8 pin 14.
@ k_ra8_pin_9
RA8 pin 9.
@ k_ra8_pin_8
RA8 pin 8.
@ k_ra8_pin_0
RA8 pin 0.
@ k_ra8_pin_3
RA8 pin 3.
@ k_ra8_pin_15
RA8 pin 15.
Clock rates published by the standard EK-RA8D2 bring-up.
uint32_t pclka_hz
Peripheral clock A rate in hertz.
uint32_t cpuclk0_hz
Main Cortex-M85 clock rate in hertz.