|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Display PAL dispatcher – forwards every public call into the bound backend's vtable. More...
#include "ra8_display_pal.h"#include <stddef.h>#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_display_pal_internal.h"#include "ra8_err.h"#include "ra8_log.h"Go to the source code of this file.
Functions | |
| static ra8_err_t | internal_validate_handle (const display_handle_t *d) |
| Reject d if it is NULL or refers to an un-initialised handle. | |
| 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. | |
| ra8_err_t | display_get_caps (const display_handle_t *d, display_caps_t *out) |
| Query the bound backend's runtime capabilities. | |
| 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. | |
| ra8_err_t | display_clear (const display_handle_t *d, uint32_t color) |
| Clear the entire framebuffer to color. | |
| ra8_err_t | display_deinit (const display_handle_t *d) |
| Release the backend and invalidate the PAL handle. | |
| display_rect_t | display_full_rect (const display_handle_t *d) |
| Convenience helper returning the rect covering the whole framebuffer. | |
Variables | |
| static const char *const | s_tag = "ra8_display_pal" |
| Module log tag. | |
| static struct display_handle | s_handle |
| Single PAL handle – one display per board. | |
| static bool | s_initialized = false |
| True once display_init has succeeded. | |
Display PAL dispatcher – forwards every public call into the bound backend's vtable.
Owns one module-static display_handle and one s_initialized flag. The dispatcher does no hardware work itself; its only job is to validate arguments, dispatch through the iface, and refuse re-init while a handle is live.
Definition in file ra8_display_pal.c.
|
nodiscard |
Clear the entire framebuffer to color.
Writes color into every pixel of the framebuffer using the backend's native paint loop. Does NOT call display_flush – callers that want the cleared frame visible on e-ink must follow up with a display_flush(d, display_full_rect(d), k_display_refresh_quality).
| [in] | d | PAL handle. |
| [in] | color | Pixel value to write (interpretation depends on caps.pixfmt). |
| k_ra8_ok | Buffer cleared. |
| k_ra8_err_null_ptr | d was NULL. |
Definition at line 148 of file ra8_display_pal.c.
References internal_validate_handle(), k_ra8_ok, and s_handle.
Referenced by main().
|
nodiscard |
Release the backend and invalidate the PAL handle.
Mirrors display_init: tears down the controller, releases the static handle, and leaves the PAL ready to be re-initialised with a different backend.
| [in] | d | PAL handle to release. |
| k_ra8_ok | Backend released; d is now stale. |
| k_ra8_err_null_ptr | d was NULL. |
Definition at line 157 of file ra8_display_pal.c.
References internal_validate_handle(), k_ra8_ok, s_handle, and s_initialized.
Referenced by main().
|
nodiscard |
Commit pending framebuffer changes to the panel.
On scan-out backends (LCD) this is a memory barrier plus an optional cache clean. On e-ink backends this is the real work step: copy rect from the framebuffer into the controller's internal buffer, then trigger a display update with the waveform mapped from hint.
| [in] | d | PAL handle. |
| [in] | rect | Region of the framebuffer to push. Use display_full_rect(d) for a whole-screen update. |
| [in] | hint | Intent driving the waveform/mode selection. |
| k_ra8_ok | Flush completed (or queued for the next scan on continuous-refresh panels). |
| k_ra8_err_null_ptr | d was NULL. |
| k_ra8_err_invalid_arg | rect extends outside the framebuffer. |
| k_ra8_err_not_supported | Backend does not implement flush yet (e-ink stub returns this). |
Definition at line 139 of file ra8_display_pal.c.
References internal_validate_handle(), k_ra8_ok, and s_handle.
Referenced by cm_present(), ep_run_refresh_cycle(), er_flush_event(), ez_flush(), internal_tc_apply_and_measure(), internal_tc_draw_target(), ls_present(), main(), mg_present(), sh_loading_overlay(), sh_present(), sh_present_loupe(), wc_flush_rect(), wd_flush_full(), wd_flush_rect(), and wk_flush_rect().
| display_rect_t display_full_rect | ( | const display_handle_t * | d | ) |
Convenience helper returning the rect covering the whole framebuffer.
Short-hand for the common case where the caller wants to flush the entire framebuffer. Equivalent to {0, 0, caps.width_px, caps.height_px} if the handle is valid, or an all-zero rectangle if it is not.
| [in] | d | PAL handle. |
| Full-screen | rect when d is a live handle. |
| All-zero | rect when d is NULL or stale. |
Definition at line 173 of file ra8_display_pal.c.
References display_caps_t::height_px, internal_validate_handle(), k_ra8_ok, s_handle, and display_caps_t::width_px.
Referenced by cm_present(), ep_run_refresh_cycle(), er_flush_event(), internal_tc_apply_and_measure(), internal_tc_draw_target(), ls_present(), main(), mg_present(), and wd_flush_full().
|
nodiscard |
Query the bound backend's runtime capabilities.
| [in] | d | PAL handle returned by display_init. |
| [out] | out | Capabilities snapshot. |
| k_ra8_ok | Capabilities written to *out. |
| k_ra8_err_null_ptr | Either argument was NULL. |
Definition at line 119 of file ra8_display_pal.c.
References internal_validate_handle(), k_ra8_ok, RA8_CHECK_NULL_PTR, s_handle, and s_tag.
Referenced by app_bringup_display(), and main().
|
nodiscard |
Return the framebuffer descriptor the backend is targeting.
The pointer in out->pixels is the same buffer the caller passed via cfg->framebuffer. The width / height / stride may differ from the values the caller passed if the backend rounded them up to satisfy an alignment requirement.
| [in] | d | PAL handle. |
| [out] | out | Filled with the framebuffer descriptor. |
| k_ra8_ok | Descriptor written. |
| k_ra8_err_null_ptr | Either argument was NULL. |
| k_ra8_err_not_supported | Backend does not expose a CPU-writable framebuffer (e.g. the e-ink stub before it is wired up). |
Definition at line 129 of file ra8_display_pal.c.
References internal_validate_handle(), k_ra8_ok, RA8_CHECK_NULL_PTR, s_handle, and s_tag.
Referenced by app_bringup_display(), app_bringup_panel(), cm_bringup_panel(), ez_bringup_panel(), gh_glcdc_programmed(), internal_tc_glcdc_bringup(), main(), mg_bringup_panel(), sfr_bringup_panel(), sh_panel_or_halt(), wc_panel_up(), wd_panel_up(), and wk_panel_up().
|
nodiscard |
Initialise the display PAL and bring the selected backend up to a state where display_flush succeeds.
Validates cfg, dispatches into the backend's init function (which on the LCD path runs the full GLCDC bring-up sequence: panel power-on, GLCDC pin/clock setup, settle delay, controller init, BG colour clear, start(true), layer1_show), then stores the resulting context inside the module-static handle and returns its address through out_handle.
| [in] | cfg | Backend + geometry descriptor (see struct). |
| [out] | out_handle | Filled with the PAL handle on success. |
| k_ra8_ok | Backend ready; out_handle populated. |
| k_ra8_err_null_ptr | cfg / cfg->iface / cfg->framebuffer / out_handle NULL. |
| k_ra8_err_invalid_arg | Width / height / pixfmt rejected by backend. |
| k_ra8_err_busy | PAL already initialised; deinit first. |
| k_ra8_err_not_supported | Pixel format unsupported by chosen backend. |
Definition at line 93 of file ra8_display_pal.c.
References display_cfg_t::iface, display_backend_iface::init, k_ra8_err_busy, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_log_error, ra8_log_info, s_handle, s_initialized, and s_tag.
Referenced by app_bringup_display(), app_bringup_panel(), cm_bringup_panel(), ez_bringup_panel(), gh_glcdc_programmed(), internal_tc_glcdc_bringup(), lcd_bringup_panel(), main(), mg_bringup_panel(), sfr_bringup_panel(), sh_panel_or_halt(), wc_panel_up(), wd_panel_up(), and wk_panel_up().
|
static |
Reject d if it is NULL or refers to an un-initialised handle.
Every dispatch path runs this. Kept as a tiny inline so each caller stays well under the NASA P10 Rule 4 60-line cap.
| [in] | d | Candidate handle. |
| k_ra8_ok | d points at the live handle. |
| k_ra8_err_null_ptr | d was NULL. |
| k_ra8_err_invalid_arg | d did not match the live handle or no handle is initialised. |
Definition at line 74 of file ra8_display_pal.c.
References k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_ok, s_handle, and s_initialized.
Referenced by display_clear(), display_deinit(), display_flush(), display_full_rect(), display_get_caps(), and display_get_framebuffer().
|
static |
Single PAL handle – one display per board.
Definition at line 39 of file ra8_display_pal.c.
Referenced by display_clear(), display_deinit(), display_flush(), display_full_rect(), display_get_caps(), display_get_framebuffer(), display_init(), and internal_validate_handle().
|
static |
True once display_init has succeeded.
Definition at line 42 of file ra8_display_pal.c.
Referenced by display_deinit(), display_init(), internal_aead_decrypt_check(), internal_aead_encrypt_check(), internal_session_validate_args(), internal_validate_handle(), ra8_dma_deinit(), ra8_dma_init(), ra8_dma_request(), ra8_mipi_dsi_deinit(), ra8_mipi_dsi_enter_stop(), ra8_mipi_dsi_exit_stop(), ra8_mipi_dsi_init(), ra8_nsc_periph_init(), ra8_power_profile_get_stats(), ra8_power_profile_init(), ra8_power_profile_mark_enter(), ra8_power_profile_mark_exit(), ra8_power_profile_reset_stats(), ra8_psa_crypto_deinit(), ra8_psa_crypto_init(), ra8_psa_crypto_random(), ra8_psa_hash_compute(), ra8_psa_key_destroy(), ra8_psa_key_import(), ra8_psa_sign_hash(), ra8_psa_verify_hash(), ra8_sram_deinit(), ra8_sram_init(), ra8_tls_get_cipher_suite(), ra8_tls_get_verify_result(), ra8_tls_global_deinit(), ra8_tls_global_init(), ra8_tls_handshake(), ra8_tls_recv(), ra8_tls_send(), and ra8_tls_session_close().
|
static |
Module log tag.
Definition at line 36 of file ra8_display_pal.c.