91typedef enum : uint16_t {
103typedef enum : uint16_t {
113typedef enum : uint32_t {
310 __asm__
volatile(
"bkpt #0");
312 __asm__
volatile(
"wfi");
333 buf[n] = (uint8_t)
'0';
337 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_tc_dec_ten));
341 for (uint32_t i = 0U; i < n; i++) {
370 return (v >= 0) && (v < dim);
431 for (int32_t d = -half; d <= half; d++) {
455 uint32_t cpuclk0_hz = 0U;
564 if (cap->
disp !=
nullptr) {
594 return (rc ==
k_ra8_ok) && (got >= 1U);
621 if ((cap ==
nullptr) || (out_raw ==
nullptr) ||
630 out_raw->
x = (int32_t)pts[0].x;
631 out_raw->
y = (int32_t)pts[0].y;
662 const int32_t d = a - b;
663 return (d < 0) ? -d : d;
689 return (run_rc ==
k_ra8_ok) && (maxerr <= tol) && blob_ok;
728 return memcmp(blob0, blob1,
sizeof(blob0)) == 0;
755 if ((m ==
nullptr) || (cap ==
nullptr) || (out_max ==
nullptr)) {
759 for (uint8_t i = 0U; i < cap->
n_read; i++) {
768 worst = (ex > worst) ? ex : worst;
769 worst = (ey > worst) ? ey : worst;
772 if (cap->
disp !=
nullptr) {
933 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static uint16_t s_framebuffer[(size_t) k_panel_height_px *(size_t) k_panel_width_px]
1024x600 RGB565 framebuffer in external SDRAM (GLCDC scans this).
static const uint8_t s_tc_msg_boot[]
Startup banner emitted after the console becomes available.
static const uint8_t s_tc_msg_cal_ok[]
Prefix for the solved calibration verification result.
static const uint8_t s_tc_msg_skip[]
Prefix for the no-contact calibration skip result.
static bool internal_tc_pixel_in_bounds(int32_t v, int32_t dim)
Report whether a framebuffer coordinate is inside the panel.
static int32_t internal_tc_axis_err(int32_t a, int32_t b)
Compute the absolute difference of two signed coordinates.
static bool internal_tc_sample_usable(ra8_err_t rc, uint8_t got)
Decide whether a touch read yielded a usable contact.
static const uint8_t s_tc_msg_ready[]
Finger-independent HIL bring-up sentinel.
tc_geom_t
Framebuffer + calibration geometry (no magic numbers).
@ k_tc_verify_tol
Max allowed fit residual, pixels.
@ k_tc_cross_half
Cross-hair arm half-length, pixels.
@ k_tc_inset_px
Corner-target inset from each panel edge.
@ k_tc_fb_h
Framebuffer / screen height, pixels.
@ k_tc_fb_w
Framebuffer / screen width, pixels.
static const uint8_t s_tc_msg_comma[]
Separator between target X and Y coordinates.
static ra8_err_t internal_tc_draw_target(void *ctx, ra8_touch_cal_point_t target)
Draw shim: paint a target cross-hair and record it.
static const uint8_t s_tc_msg_fail_gl[]
Fatal banner for display-controller bring-up failure.
static const uint8_t s_tc_msg_ok[]
Success token used in the verification result banner.
static void internal_tc_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static const uint8_t s_tc_msg_eol[]
CRLF terminator shared by composed console reports.
static void internal_tc_put_px(int32_t x, int32_t y, uint16_t color)
Write one RGB565 pixel, clipped to the framebuffer rectangle.
static ra8_err_t internal_tc_apply_and_measure(const ra8_touch_cal_matrix_t *m, tc_capture_t *cap, int32_t *out_max)
Apply the solved matrix to every captured raw, paint the corrected cross-hairs, and return the larges...
static void internal_tc_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
tc_color_t
RGB565 palette for the calibration UI.
@ k_tc_color_target
White target cross-hair.
@ k_tc_color_corrected
Green corrected-coordinate mark.
@ k_tc_color_bg
Black field.
static void internal_tc_draw_cross(int32_t cx, int32_t cy, uint16_t color)
Draw a plus-shaped cross-hair centred at (cx, cy).
static const uint8_t s_tc_msg_maxerr[]
Label introducing the maximum calibration residual.
static ra8_err_t internal_tc_read_raw(void *ctx, ra8_touch_cal_point_t *out_raw)
Read shim: block (bounded) on one settled raw GT911 sample.
static bool internal_tc_blob_roundtrip(const ra8_touch_cal_matrix_t *m)
Round-trip the matrix through ra8_touch_cal_save / ra8_touch_cal_load and report stable reproduction.
static const display_cfg_t s_tc_display_cfg
Display PAL config selecting the GLCDC LCD backend.
static bool internal_tc_cal_pass(ra8_err_t run_rc, int32_t maxerr, int32_t tol, bool blob_ok)
Verdict: did the whole calibration pipeline pass?
static void internal_tc_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static void internal_tc_report_ok(int32_t maxerr, bool verify_ok)
Print the solved-and-verified result banner.
static const uint8_t s_tc_msg_tgt[]
Prefix for a target-coordinate progress report.
static const uint8_t s_tc_msg_fail_op[]
Fatal banner for touch-controller open failure.
static const uint8_t s_tc_msg_bad[]
Failure token used in the verification result banner.
static ra8_err_t internal_tc_run_calibration(display_handle_t *disp, ra8_touch_cal_matrix_t *out_matrix)
Reset the capture and run the five-point calibration collect+solve.
static const uint8_t s_tc_msg_fail_in[]
Fatal banner for clock, timebase, or console setup failure.
tc_consts_t
Console / GT911 / poll knobs (no magic numbers).
@ k_tc_max_points
Read up to the GT911 capacity.
@ k_tc_blob_cap
k_ra8_touch_cal_blob_size mirror.
@ k_tc_dec_ten
Decimal radix / small-buf cap.
@ k_tc_poll_max
Bounded per-target poll (NASA R2).
@ k_tc_uart_baud
Console baud.
static void internal_tc_fb_fill(uint16_t color)
Fill the whole framebuffer with color.
static bool internal_tc_glcdc_bringup(display_handle_t **out_disp)
Bring the GLCDC layer-1 path up and confirm it is programmed.
static void internal_tc_report_skip(uint8_t got)
Print the no-taps skip banner (bare automated bench).
static bool internal_tc_touch_bringup(void)
Bring up IIC_B (I2C-compat) and open the GT911 touch driver.
static void internal_tc_calibrate_and_report(display_handle_t *disp)
Solve, verify, and report; degrade to SKIP if no taps arrived.
static tc_capture_t s_capture
The single calibration capture the shims fill.
static void internal_tc_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
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_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
One-call bring-up of the EK-RA8D2 panel's GoodIX GT911 touch controller.
ra8_err_t ra8_board_touch_open(const ra8_board_touch_cfg_t *cfg)
Bring the on-board GT911 up and open the touch driver against it.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Display Platform Abstraction Layer for the RA8D2.
@ k_display_pixfmt_rgb565
16 bpp, 5/6/5 packed.
display_rect_t display_full_rect(const display_handle_t *d)
Convenience helper returning the rect covering the whole framebuffer.
ra8_err_t display_get_framebuffer(const display_handle_t *d, display_fb_t *out)
Return the framebuffer descriptor the backend is targeting.
ra8_err_t display_flush(const display_handle_t *d, display_rect_t rect, display_refresh_hint_t hint)
Commit pending framebuffer changes to the panel.
struct display_handle display_handle_t
ra8_err_t display_init(const display_cfg_t *cfg, display_handle_t **out_handle)
Initialise the display PAL and bring the selected backend up to a state where display_flush succeeds.
@ k_display_refresh_fast
Prioritise latency.
LCD backend (ra8_glcdc) for the display PAL.
const display_backend_iface_t k_display_backend_lcd_ra8_glcdc
LCD backend vtable – pass its address through display_cfg_t.iface to drive the EK-RA8D2 panel.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
Graphics LCD Controller driver (two-layer with alpha blending).
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).
@ k_ra8_board_fb_align_bytes
GLCDC AXI burst alignment, in bytes.
EK-RA8D2 panel timing as the HAL's ra8_glcdc_timing_t (ER-TFT070-6).
static const ra8_glcdc_timing_t s_ra8_panel_ek_ra8d2_timing
EK-RA8D2 ER-TFT070-6 RGB timing for ra8_glcdc_init / the LCD backend.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
Multi-touch input driver – GoodIX GT911 backend.
ra8_err_t ra8_touch_read(ra8_touch_point_t *out_points, uint8_t max_count, uint8_t *got_count)
Drain the current touch frame.
@ k_ra8_touch_irq_pin_unset
Sentinel for "no IRQ pin attached".
Resistive/capacitive touch-screen calibration utility.
ra8_err_t ra8_touch_cal_save(const ra8_touch_cal_matrix_t *matrix, uint8_t *dst, size_t dst_size)
Serialise a calibration matrix to a fixed-size byte blob.
@ k_ra8_touch_cal_n_targets
4 corners + centre.
ra8_err_t ra8_touch_cal_load(const uint8_t *src, size_t src_size, ra8_touch_cal_matrix_t *out_matrix)
Deserialise a calibration matrix from a byte blob.
ra8_err_t ra8_touch_cal_apply(ra8_touch_cal_point_t raw, const ra8_touch_cal_matrix_t *matrix, uint16_t screen_width, uint16_t screen_height, ra8_touch_cal_point_t *out_screen)
Apply a calibration matrix to a single raw touch sample.
ra8_err_t ra8_touch_cal_run(const ra8_touch_cal_run_cfg_t *cfg, ra8_touch_cal_matrix_t *out_matrix)
Drive the on-screen calibration sequence and produce a matrix.
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
void * pixels
Base of pixel data (RGB565 unless noted).
The two touch settings that are an APPLICATION choice, not a board fact.
2-D affine transform screen = [a b; d e] * raw + [c; f].
One (x, y) integer coordinate pair.
int32_t y
Vertical coordinate.
int32_t x
Horizontal coordinate.
Configuration for ra8_touch_cal_run.
One decoded touch contact.
Per-run capture the calibration shims fill for the verify pass.
uint8_t n_drawn
Targets drawn.
uint8_t n_read
Raws captured.
ra8_touch_cal_point_t raws[k_ra8_touch_cal_n_targets]
Captured raws.
display_handle_t * disp
Live panel handle.
ra8_touch_cal_point_t targets[k_ra8_touch_cal_n_targets]
Drawn targets.