ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_periph.h
Go to the documentation of this file.
1
32
33#pragma once
34
35#include <stdint.h>
36#include <unicorn/unicorn.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
51typedef enum : uint8_t {
57
75typedef enum : uint8_t {
79
103
122
145void board_periph_set_usbhs_loop(bool on);
146
161bool board_periph_usbhs_loop(void);
162
180void board_periph_init(bool trace);
181
204void board_periph_reset_set_cause(bool power_on, bool software, bool watchdog, bool iwdt);
205
223void board_periph_reset_request_reboot(bool watchdog, bool iwdt);
224
241bool board_periph_reset_take_request(bool* out_watchdog, bool* out_iwdt);
242
260void board_periph_sci_set_tx_sink(void (*sink)(uint8_t channel, uint8_t byte));
261
285void board_periph_sci_feed_rx(uint8_t channel, const uint8_t* data, uint32_t len);
286
311void board_periph_touch_inject(uint16_t x, uint16_t y);
312
330uint32_t board_periph_touch_reported(void);
331
354
377bool board_periph_touch_seq_push(uint16_t x, uint16_t y);
378
398
422void board_periph_gpio_set_input(uint8_t port, uint8_t pin, bool level);
423
443bool board_periph_gpio_get_input(uint8_t port, uint8_t pin);
444
465
480const char* board_periph_uart_last_line(void);
481
496uint32_t board_periph_uart_tx_total(void);
497
510uint32_t board_periph_irq_count(uint32_t irq);
511
523uint32_t board_periph_irq_total(void);
524
544bool board_periph_touch_last(uint16_t* x, uint16_t* y);
545
562void board_periph_battery_set(uint8_t soc_pct, bool charging);
563
575void board_periph_battery_get(uint8_t* out_soc, bool* out_charging);
576
593
613uint64_t board_periph_read(uc_engine* uc, uint64_t addr, unsigned size, bool* handled);
614
630void board_periph_write(uc_engine* uc, uint64_t addr, unsigned size, uint64_t value, bool* handled);
631
652void board_periph_tick(uc_engine* uc);
653
675void board_periph_nvic_set_enable(uint32_t irq, bool enable);
676
695bool board_periph_next_irq(uint32_t* out_irq);
696
708void board_periph_note_irq_taken(uint32_t irq);
709
725typedef struct {
726 uint32_t base;
727 uint32_t width;
728 uint32_t height;
729 uint32_t stride;
730 uint8_t format;
731 uint8_t layer;
732 bool enabled;
734
757
776void board_periph_report(uc_engine* uc);
777
778#ifdef __cplusplus
779}
780#endif
void board_periph_tick(uc_engine *uc)
Advance every modelled timer by one emulation chunk and raise events.
uint32_t board_periph_led_level(board_led_id_t led)
Read the last driven output level of a board LED.
void board_periph_init(bool trace)
One-time reset of all peripheral-model state.
board_device_t board_periph_device(void)
Report which RA8 device the peripheral model is emulating.
void board_periph_sci_feed_rx(uint8_t channel, const uint8_t *data, uint32_t len)
Queue host->firmware bytes for a channel's receive path.
void board_periph_battery_get(uint8_t *out_soc, bool *out_charging)
Read back the emulated battery state (for the status overlay).
void board_periph_nvic_set_enable(uint32_t irq, bool enable)
Set or clear a NVIC line's enable in the model's set-enable shadow.
bool board_periph_touch_last(uint16_t *x, uint16_t *y)
Report the coordinates of the most recently drained touch contact.
void board_periph_note_irq_taken(uint32_t irq)
Record that NVIC IRQ irq was actually taken (for the summary).
void board_periph_reset_set_cause(bool power_on, bool software, bool watchdog, bool iwdt)
Record the cause of a warm reboot in the sticky RSTSRn flags.
bool board_periph_touch_seq_push(uint16_t x, uint16_t y)
Queue one raw touch point onto the modelled GT911 injection FIFO.
const char * board_periph_uart_last_line(void)
The most recent complete line the firmware transmitted over any SCI.
bool board_periph_glcdc_get_framebuffer(board_glcdc_fb_t *out)
Report the active GLCDC graphics-layer framebuffer, if one is programmed.
void board_periph_set_usbhs_loop(bool on)
Enable the chip-internal USBHS-host self-loop model (–usbhs-loop).
uint8_t board_periph_sci_console_channel(void)
The SCI channel the EK-RA8D2 console (J-Link OB VCOM) uses.
void board_periph_sci_set_tx_sink(void(*sink)(uint8_t channel, uint8_t byte))
Wire a host sink that receives every byte the firmware transmits.
board_led_id_t
Board user-LED identity, mirrored from the EK-RA8D2 BSP.
@ k_board_led3
LED3, RED, PA07 (port 10, pin 7).
@ k_board_led2
LED2, GREEN, P303 (port 3, pin 3).
@ k_board_led_count
Board led count.
@ k_board_led1
LED1, BLUE, P600 (port 6, pin 0).
void board_periph_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value, bool *handled)
Dispatch an MMIO write to the owning block, if any.
uint32_t board_periph_uart_tx_total(void)
Total bytes the firmware has transmitted over all SCI channels.
bool board_periph_usbhs_loop(void)
Report whether the USBHS-host self-loop model is enabled.
void board_periph_touch_seq_reset(void)
Clear the modelled GT911 injected-touch sequence FIFO.
uint32_t board_periph_irq_total(void)
Total NVIC interrupts the ICU has delivered in this run.
uint64_t board_periph_read(uc_engine *uc, uint64_t addr, unsigned size, bool *handled)
Dispatch an MMIO read to the owning block, if any.
uint16_t board_periph_led_color_rgb565(board_led_id_t led)
The on-colour of a board LED as a packed RGB565 value.
void board_periph_battery_set(uint8_t soc_pct, bool charging)
Set the emulated battery state surfaced by the MAX17048 fuel gauge.
bool board_periph_gpio_get_input(uint8_t port, uint8_t pin)
Read the externally-injected input level of a GPIO pin.
void board_periph_report(uc_engine *uc)
Print the peripheral-model section of the end-of-run summary.
void board_periph_gpio_set_input(uint8_t port, uint8_t pin, bool level)
Drive a GPIO pin's input level from outside the firmware.
uint32_t board_periph_touch_reported(void)
Count of touch contacts the firmware has drained from the GT911 model.
bool board_periph_reset_take_request(bool *out_watchdog, bool *out_iwdt)
Consume a pending peripheral reboot request, if any (run-loop side).
void board_periph_set_device(board_device_t device)
Select which RA8 device the peripheral model emulates.
bool board_periph_next_irq(uint32_t *out_irq)
Pop the next pending, enabled NVIC IRQ number the ICU has queued.
void board_periph_touch_inject(uint16_t x, uint16_t y)
Arm a pending touch contact for the modelled GT911 device.
void board_periph_reset_request_reboot(bool watchdog, bool iwdt)
Request a warm reboot from a peripheral model (e.g.
uint32_t board_periph_irq_count(uint32_t irq)
Number of times a given NVIC line was taken in this run.
board_device_t
The RA8 device the emulator models for this run.
@ k_board_device_ra8p1
Renesas RA8P1: adds the Ethos-U55 NPU.
@ k_board_device_ra8d2
Renesas RA8D2 (default): no NPU.
ra8_board_eth_pin_t pin
Pin.
Active GLCDC graphics-layer framebuffer descriptor.
uint32_t width
Width in pixels (line stride / bytes-per-pixel).
uint32_t stride
Line stride in bytes (GRn FLM3.LNOFF[31:16]).
uint32_t base
Framebuffer base address (GRn FLM2.BASE).
uint8_t format
Pixel format code (GRn FLM6.FORMAT[30:28]).
uint32_t height
Height in pixels (GRn FLM5.LNNUM + 1).
bool enabled
True when the layer is fetching (FLMRD set + BG EN).
uint8_t layer
Source layer: 1 = GR1 (upper), 2 = GR2 (lower).