ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_board_ra8p1.h
Go to the documentation of this file.
1
53
54#pragma once
55
56#include <stddef.h>
57#include <stdint.h>
58
59#include "ra8_err.h"
60#include "ra8_port_constants.h"
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66/* =============================================================================
67 * Board identity
68 * =============================================================================
69 */
70
79extern const char* const k_ra8_board_name;
80extern const char* const k_ra8_board_doc_rev;
81extern const char* const k_ra8_board_mcu;
82
101typedef struct {
102 const char* name;
103 const char* doc_rev;
104 const char* mcu;
106
127
128/* =============================================================================
129 * 1. User LEDs -- provisional, TODO(EK-RA8P1 UM / ra8p1_kicad)
130 * =============================================================================
131 */
132
159
180
196
212
228
249
250/* =============================================================================
251 * 2. User switches -- provisional, TODO(EK-RA8P1 UM / ra8p1_kicad)
252 * =============================================================================
253 */
254
274
287typedef enum : uint8_t {
291
303
324
350
355typedef void (*ra8_board_sw_irq_cb_t)(void* ctx);
356
383[[nodiscard]] ra8_err_t
385
406
407/* =============================================================================
408 * 3. Debug UART console -- provisional, TODO(EK-RA8P1 UM / ra8p1_kicad)
409 * =============================================================================
410 */
411
427typedef enum : uint8_t {
430
446
470
499[[nodiscard]] ra8_err_t ra8_board_uart_console_init(uint32_t baud);
500
521[[nodiscard]] ra8_err_t ra8_board_uart_console_write(const uint8_t* data, size_t len);
522
549[[nodiscard]] ra8_err_t ra8_board_uart_console_read(uint8_t* out, size_t cap, size_t* out_len);
550
575[[nodiscard]] ra8_err_t ra8_board_uart_console_flush(void);
576
577#ifdef __cplusplus
578}
579#endif
const char *const k_ra8_board_doc_rev
"R20UT5523EG0101 Rev 1.01".
const char *const k_ra8_board_name
Human-readable strings identifying this BSP target.
ra8_board_sw_id_t
Identifiers for the on-board user push-buttons.
@ k_ra8_board_sw_count
RA8 board sw count.
@ k_ra8_board_sw1
SW1, P009, IRQ13-DS (jumper E31).
@ k_ra8_board_sw2
SW2, P008, IRQ12-DS (jumper E32).
const char *const k_ra8_board_mcu
"R7KA8D2KFLCAC".
ra8_board_sw_irq_t
Per-switch IRQ channel numbers (UM Table 25 p 32).
@ k_ra8_board_sw2_irq
SW2 -> IRQ12-DS.
@ k_ra8_board_sw1_irq
SW1 -> IRQ13-DS.
void(* ra8_board_sw_irq_cb_t)(void *ctx)
Switch IRQ callback signature.
ra8_board_sw_state_t
Logical "pressed" / "released" state.
@ k_ra8_board_sw_released
RA8 board sw released.
@ k_ra8_board_sw_pressed
RA8 board sw pressed.
ra8_board_led_id_t
Identifiers for the three user LEDs on EK-RA8D2 v1.
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led_count
RA8 board led count.
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
@ k_ra8_board_led_green
RA8 board led green.
@ k_ra8_board_led_blue
Convenience aliases by colour.
@ k_ra8_board_led_red
RA8 board led red.
@ k_ra8_board_led3
LED3, RED, PA07 (jumper E28).
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_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_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_err_t ra8_board_sw_pin(ra8_board_sw_id_t sw, ra8_port_pin_t *out_pin)
Translate a board switch id into its underlying ra8_port_pin_t.
ra8_err_t ra8_board_uart_console_read(uint8_t *out, size_t cap, size_t *out_len)
Polled non-blocking read from the debug VCOM console.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_sw_attach_irq(ra8_board_sw_id_t sw, ra8_board_sw_irq_cb_t cb, void *ctx)
Wire sw to the ICU and register a falling-edge callback.
ra8_err_t ra8_board_sw_read(ra8_board_sw_id_t sw, ra8_board_sw_state_t *out_pressed)
Sample the current state of sw.
ra8_err_t ra8_board_sw_init(ra8_board_sw_id_t sw)
Configure a switch pin as an input with internal pull-up.
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the debug VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_err_t ra8_board_led_pin(ra8_board_led_id_t led, ra8_port_pin_t *out_pin)
Translate a board LED id into its underlying ra8_port_pin_t.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
ra8_err_t ra8_board_get_info(ra8_board_info_t *out)
Copy the three board-identity strings into out.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the console has clocked out.
ra8_err_t ra8_board_led_off(ra8_board_led_id_t led)
Drive led LOW (extinguish it).
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.
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
@ k_ra8_port_13
RA8 port 13.
#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_2
RA8 pin 2.
@ k_ra8_pin_5
RA8 pin 5.
@ k_ra8_pin_3
RA8 pin 3.
Snapshot of board identity strings.