ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_panel.h File Reference

Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6). More...

#include <stddef.h>
#include <stdint.h>
Include dependency graph for ra8_panel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RA8_INTERNAL_PANEL_SECTION   gnu::section(".sdram_data"),
 Internal section specifier on target ELF binaries.
#define RA8_BOARD_PANEL_FRAMEBUFFER(name)
 Declare a correctly aligned, sized and placed RGB565 framebuffer for the on-board panel.

Enumerations

enum  ra8_panel_geometry_t : uint16_t {
  k_panel_width_px = 1024U ,
  k_panel_height_px = 600U ,
  k_panel_width_mm = 154U ,
  k_panel_height_mm = 86U ,
  k_panel_ppi = 169U
}
 ER-TFT070-6 geometry as compile-time constants. More...
enum  ra8_panel_timing_t : uint16_t {
  k_panel_h_front = 160U ,
  k_panel_h_back = 160U ,
  k_panel_h_sync = 4U ,
  k_panel_v_front = 12U ,
  k_panel_v_back = 23U ,
  k_panel_v_sync = 3U
}
 ER-TFT070-6 RGB timing (porches + sync); active size = the geometry. More...
enum  ra8_panel_framebuffer_t : uint16_t { k_ra8_board_fb_align_bytes = 64U }
 How a framebuffer for this panel must be laid out in memory. More...

Detailed Description

Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).

BSP description of the display wired to the EK-RA8D2 Parallel Graphics Expansion Board 1: the ER-TFT070-6, a 7.0" 1024x600 IPS panel driven RGB565 through the GLCDC. Panel-agnostic code (the shared UI, the host preview) reads its geometry from here rather than hardcoding pixels.

Each board package exposes its own ra8_panel.h; the build selects the active panel through the include path (no preprocessor selection), so a different board – e.g. a future e-reader – swaps in its own descriptor without touching the UI.

Holds the full panel description: UI-facing geometry plus the GLCDC RGB timing (porches / sync). The geometry + timing values here are plain constants (host-includable); the GLCDC-typed timing instance the HAL consumes lives in the companion ra8_panel_timing.h (target-only, since it pulls in the HAL type).

Self-contained (no MCU / FSP includes) so host-side previews include it unchanged.

Since
0.1.0

Definition in file ra8_panel.h.

Macro Definition Documentation

◆ RA8_BOARD_PANEL_FRAMEBUFFER

#define RA8_BOARD_PANEL_FRAMEBUFFER ( name)
Value:
[[RA8_INTERNAL_PANEL_SECTION gnu::aligned(k_ra8_board_fb_align_bytes)]] static uint16_t \
name[(size_t)k_panel_height_px * (size_t)k_panel_width_px]
@ k_ra8_board_fb_align_bytes
GLCDC AXI burst alignment, in bytes.
Definition ra8_panel.h:108
#define RA8_INTERNAL_PANEL_SECTION
Internal section specifier on target ELF binaries.
Definition ra8_panel.h:116
@ k_panel_height_px
Native height (pixels).
Definition ra8_panel.h:52
@ k_panel_width_px
Native width (pixels).
Definition ra8_panel.h:51

Declare a correctly aligned, sized and placed RGB565 framebuffer for the on-board panel.

Expands to a file-scope static array of k_panel_height_px x k_panel_width_px 16-bit pixels, aligned to k_ra8_board_fb_align_bytes so the GLCDC's AXI bursts fetch cleanly, and placed in .sdram_data – the external-SDRAM output section every EK-RA8D2 linker script defines. All three are board facts, and none of them is checkable by the API that consumes the pointer: the wrong alignment is torn scanout, and 1.2 MiB of surface does not fit in on-chip SRAM at all.

This is the one case the project style rules name as macro-legal – reducing duplicated code – because the alternative, a library-owned array behind an accessor, would fix the size at library build time and cost every application the memory whether it drives the panel or not.

An application drawing into a smaller scratch surface declares its own array instead, but should still take the alignment from k_ra8_board_fb_align_bytes rather than writing 64 again.

Parameters
[in]nameIdentifier for the declared array (a token, not a value).
Precondition
ra8_panel.h is included and the app targets the on-board panel.
Used at file scope; the expansion declares a static object.
The app's linker script defines a .sdram_data output section (the shared board script does).
Postcondition
name is a framebuffer the GLCDC can scan out without tearing.
Roughly 1.2 MiB of external SDRAM is reserved, outside the image.
Note
Not thread-safe in any sense – it is a declaration.
Warning
Omitting the alignment is not a compile error and not a runtime error; it is torn scanout. Prefer this macro over hand-writing the attributes.
Example:
// ... later, at init:
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).
Definition main.c:67
ra8_err_t ra8_gfx_init(void *fb, uint16_t width, uint16_t height, ra8_gfx_format_t format)
Bind ra8_gfx to a caller-owned framebuffer.
#define RA8_BOARD_PANEL_FRAMEBUFFER(name)
Declare a correctly aligned, sized and placed RGB565 framebuffer for the on-board panel.
Definition ra8_panel.h:165
See also
k_ra8_board_fb_align_bytes The alignment this applies.

Definition at line 165 of file ra8_panel.h.

◆ RA8_INTERNAL_PANEL_SECTION

#define RA8_INTERNAL_PANEL_SECTION   gnu::section(".sdram_data"),

Internal section specifier on target ELF binaries.

Definition at line 116 of file ra8_panel.h.

Enumeration Type Documentation

◆ ra8_panel_framebuffer_t

enum ra8_panel_framebuffer_t : uint16_t

How a framebuffer for this panel must be laid out in memory.

The GLCDC fetches scanlines over AXI in bursts, and a framebuffer whose base is not 64-byte aligned splits every burst – which shows up as torn scanout, not as an error. Nothing in the API can catch it, so the number has to be stated where a consumer will find it. Before this existed, thirteen example files each declared their own = 64U under a different name (k_app_fb_align_bytes, k_cm_fb_align, k_wd_fb_align, ...), every one carrying the same copied comment – the tell that the fact had been copied rather than derived.

Use RA8_BOARD_PANEL_FRAMEBUFFER for a full-panel surface. An application drawing into a smaller scratch surface declares its own array but should still take the alignment from here.

Invariant
k_ra8_board_fb_align_bytes is a power of two and at least the AXI burst length the GLCDC issues.
[[gnu::aligned(k_ra8_board_fb_align_bytes)]] static uint16_t s_scratch[64 * 64];
static uint8_t s_scratch[(size_t) k_ra8_compress_scratch_bytes]
Compressor scratch (one miniz tdefl_compressor) in SRAM.
Definition main.c:96
See also
RA8_BOARD_PANEL_FRAMEBUFFER Declares a correctly shaped full-panel one.
ra8_panel_geometry_t The panel's pixel budget.
Since
0.1.0
Enumerator
k_ra8_board_fb_align_bytes 

GLCDC AXI burst alignment, in bytes.

Definition at line 107 of file ra8_panel.h.

◆ ra8_panel_geometry_t

enum ra8_panel_geometry_t : uint16_t

ER-TFT070-6 geometry as compile-time constants.

The resolution is the hard pixel budget for any UI. The physical fields drive design rules: size touch targets and fonts in millimetres, not just pixels, because the panel PPI is far below a laptop display and the glass does no supersampling. PPI = k_panel_width_px / (k_panel_width_mm / 25.4), which for this panel is about 169. Physical values are approximate – confirm against the ER-TFT070-6 datasheet.

Since
0.1.0
Enumerator
k_panel_width_px 

Native width (pixels).

k_panel_height_px 

Native height (pixels).

k_panel_width_mm 

Active-area width (mm, approx).

k_panel_height_mm 

Active-area height (mm, approx).

k_panel_ppi 

Pixels per inch (approx).

Definition at line 50 of file ra8_panel.h.

◆ ra8_panel_timing_t

enum ra8_panel_timing_t : uint16_t

ER-TFT070-6 RGB timing (porches + sync); active size = the geometry.

Per the LVGL EK-RA8D2 reference for this panel (these differ from the generic 1024x600 values: h_back 140->160, h_sync 20->4, v_back 20->23). Assembled into the HAL's ra8_glcdc_timing_t in ra8_panel_timing.h.

Since
0.1.0
Enumerator
k_panel_h_front 

Horizontal front porch (px).

k_panel_h_back 

Horizontal back porch (px).

k_panel_h_sync 

HSYNC pulse width (px clocks).

k_panel_v_front 

Vertical front porch (lines).

k_panel_v_back 

Vertical back porch (lines).

k_panel_v_sync 

VSYNC pulse width (lines).

Definition at line 68 of file ra8_panel.h.