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

MIPI DSI-2 host driver – video mode, status, IRQ dispatch, and convenience surfaces. More...

#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "ra8_attributes.h"
#include "ra8_check.h"
#include "ra8_err.h"
#include "ra8_log.h"
#include "ra8_mipi_dsi.h"
#include "ra8_mipi_dsi_internal.h"
#include "ra8_mipi_dsi_regs.h"
#include "ra8_mstp.h"
Include dependency graph for ra8_mipi_dsi_dispatch.c:

Go to the source code of this file.

Enumerations

enum  ra8_mipi_dsi_timing_limits_t : uint16_t {
  k_ra8_mipi_dsi_timing_max_sync = 0x0FFFU ,
  k_ra8_mipi_dsi_timing_max_porch = 0x1FFFU ,
  k_ra8_mipi_dsi_timing_max_active = 0x7FFFU
}
 Per-field bit-width caps for ra8_mipi_dsi_video_timing_t. More...

Functions

static void internal_ra8_mipi_dsi_decode_rx (uint32_t raw, ra8_mipi_dsi_rx_result_t *out_result)
 Decode an RXRSS slot register into a struct.
ra8_err_t ra8_mipi_dsi_video_configure (const ra8_mipi_dsi_video_cfg_t *vcfg)
 Programme every video-mode timing register from a single config.
ra8_err_t ra8_mipi_dsi_video_start (const ra8_mipi_dsi_video_cfg_t *vcfg)
 Start video-mode operation.
ra8_err_t ra8_mipi_dsi_video_stop (void)
 Request a video-mode stop and wait for it.
ra8_err_t ra8_mipi_dsi_get_status (uint32_t *out_mask)
 Read the top-level Interrupt Status Register.
ra8_err_t ra8_mipi_dsi_link_status_get (ra8_mipi_dsi_link_status_t *out_status)
 Decode LINKSR into a struct.
ra8_err_t ra8_mipi_dsi_clear_status (uint32_t mask)
 Clear bits in any of the sub-status registers.
ra8_err_t ra8_mipi_dsi_ack_error_get (ra8_mipi_dsi_ack_error_t *out_err)
 Read the latest accumulated ack/error report and clear it.
ra8_err_t ra8_mipi_dsi_rx_result_get (uint8_t slot, ra8_mipi_dsi_rx_result_t *out_result)
 Decode and consume an RXRSS slot.
ra8_err_t ra8_mipi_dsi_rx_payload_read (uint8_t *dest, uint16_t max_len, uint16_t *out_len)
 Copy out the most-recent long-packet RX payload (RXPPD0..3R).
ra8_err_t ra8_mipi_dsi_te_event_pending (bool *out_pending)
 Check if a tearing-effect (TE) trigger was received.
ra8_err_t ra8_mipi_dsi_te_event_clear (void)
 Clear the latched tearing-effect bits in RXSR.
ra8_err_t ra8_mipi_dsi_irq_enable (ra8_mipi_dsi_event_t event, uint32_t mask, bool enable)
 Toggle a sub-class IER bit.
ra8_err_t ra8_mipi_dsi_attach_handler (ra8_mipi_dsi_event_fn_t fn, void *ctx)
 Attach a callback for MIPI DSI interrupt events.
static void internal_ra8_mipi_dsi_call_user (ra8_mipi_dsi_event_t event, uint32_t mask)
 Common helper that fires the registered callback.
void ra8_mipi_dsi_dispatch_seq0 (void)
 Sequence-channel-0 IRQ handler (LP path).
void ra8_mipi_dsi_dispatch_seq1 (void)
 Sequence-channel-1 IRQ handler (HS path).
void ra8_mipi_dsi_dispatch_video (void)
 Video-mode IRQ handler.
void ra8_mipi_dsi_dispatch_receive (void)
 Receive IRQ handler.
void ra8_mipi_dsi_dispatch_fatal (void)
 Fatal-error IRQ handler.
void ra8_mipi_dsi_dispatch_phy (void)
 PHY-protocol-interface IRQ handler.
void ra8_mipi_dsi_dispatch (void)
 Snapshot ISR, clear sub-status, fan out per-class callbacks.
ra8_err_t ra8_mipi_dsi_set_video_timing (const ra8_mipi_dsi_video_timing_t *timing)
 Load only the HSA/HBP/HACT/HFP/VSA/VBP/VACT/VFP video-timing registers from a compact descriptor.
ra8_err_t ra8_mipi_dsi_send_command_short (ra8_mipi_dsi_dt_t dt, const uint8_t params[2])
 Send a DSI command-mode short packet on VC0 (LP escape).
ra8_err_t ra8_mipi_dsi_send_command_long (ra8_mipi_dsi_dt_t dt, const uint8_t *payload, uint16_t len)
 Send a DSI command-mode long packet on VC0 (HS path).
ra8_err_t ra8_mipi_dsi_send_command_payload (ra8_mipi_dsi_dt_t packet_type, const uint8_t *payload, uint16_t len)
 Send a DSI command-mode packet (short or long) on VC0 in LP escape.
ra8_err_t ra8_mipi_dsi_enter_ulps (void)
 Drive the entire link (clock + data lanes) into ULPS.
ra8_err_t ra8_mipi_dsi_exit_ulps (void)
 Wake the entire link out of ULPS.
ra8_err_t ra8_mipi_dsi_get_link_status (ra8_mipi_dsi_link_status_t *out)
 Snapshot the link state (running flags + busy flags + accumulated ack/error report) into a single struct.

Variables

static const char * s_tag = "MIPI_DSI"
 Component tag used by the ra8_log_* family.

Detailed Description

MIPI DSI-2 host driver – video mode, status, IRQ dispatch, and convenience surfaces.

Tag
[Ring 3 / HAL] {World: S}

Second translation unit of the hand-written HAL for the RA8D2 MIPI DSI Host module (HUM Ch 65, p 3839-3934). The configuration, link, HS-clock, sequence-channel command, and ULPS paths live in the sibling ra8_mipi_dsi.c; this file carries:

  • video-mode configure / start / stop;
  • status getters (ISR, LINKSR, ack/error, receive-result, payload);
  • tearing-effect query / clear;
  • per-class interrupt enable + callback attach;
  • the per-class IRQ dispatch routines and the top-level dispatcher;
  • the "sweep 6" convenience surfaces (video timing, command send, ULPS shortcuts, link-status alias).

The mutable state shared with the command-submission path (the registered callback + the pending receive buffer) and the bounded register-poll helper used by video mode are declared in ra8_mipi_dsi_internal.h.

Every register access carries a HUM Ch 65 citation in the form required by scripts/checks/cite_check.py:

/* HUM Ch 65.X "name", p NNNN *\/

Since
0.1.0

Definition in file ra8_mipi_dsi_dispatch.c.

Enumeration Type Documentation

◆ ra8_mipi_dsi_timing_limits_t

Per-field bit-width caps for ra8_mipi_dsi_video_timing_t.

HUM Ch 65.2 register fields impose these maxima: VSA/HSA = 12 bits, V/HBP + V/HFP = 13 bits, V/HACT = 15 bits. Used by ra8_mipi_dsi_set_video_timing to range-check inputs.

Enumerator
k_ra8_mipi_dsi_timing_max_sync 

12-bit field.

k_ra8_mipi_dsi_timing_max_porch 

13-bit field.

k_ra8_mipi_dsi_timing_max_active 

15-bit field.

Definition at line 554 of file ra8_mipi_dsi_dispatch.c.

Function Documentation

◆ internal_ra8_mipi_dsi_call_user()

void internal_ra8_mipi_dsi_call_user ( ra8_mipi_dsi_event_t event,
uint32_t mask )
static

Common helper that fires the registered callback.

Parameters
[in]eventClass enum.
[in]maskStatus bits captured before clearing.

See implementation.

Precondition
Module state is consistent.
Module state is consistent.
Postcondition
Caller-visible state matches the documented contract.
Caller-visible state matches the documented contract.
Note
Not thread-safe unless documented otherwise.
Since
0.1.0

Definition at line 414 of file ra8_mipi_dsi_dispatch.c.

References s_mipi_dsi_event_ctx, and s_mipi_dsi_event_fn.

Referenced by ra8_mipi_dsi_dispatch(), ra8_mipi_dsi_dispatch_fatal(), ra8_mipi_dsi_dispatch_phy(), ra8_mipi_dsi_dispatch_receive(), ra8_mipi_dsi_dispatch_seq0(), ra8_mipi_dsi_dispatch_seq1(), and ra8_mipi_dsi_dispatch_video().

◆ internal_ra8_mipi_dsi_decode_rx()

void internal_ra8_mipi_dsi_decode_rx ( uint32_t raw,
ra8_mipi_dsi_rx_result_t * out_result )
static

◆ ra8_mipi_dsi_ack_error_get()

ra8_err_t ra8_mipi_dsi_ack_error_get ( ra8_mipi_dsi_ack_error_t * out_err)
nodiscard

Read the latest accumulated ack/error report and clear it.

Parameters
[out]out_errDecoded report.
Returns
k_ra8_ok / k_ra8_err_null_ptr.
Precondition
out_err non-NULL.
Driver initialized.
Postcondition
AKEPACMSR written to AKEPSCR (cleared in HW).
*out_err reflects the snapshot before clearing.
Since
0.1.0

Definition at line 256 of file ra8_mipi_dsi_dispatch.c.

References r_mipi_dsi_regs_t::AKEPACMSR, r_mipi_dsi_regs_t::AKEPSCR, ra8_mipi_dsi_ack_error_t::error_report, k_akep_vc_shift, k_ra8_mipi_dsi_akep_erep_mask, k_ra8_mipi_dsi_akep_vc_mask, k_ra8_mipi_dsi_vc_mask, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), s_tag, and ra8_mipi_dsi_ack_error_t::virtual_channel.

◆ ra8_mipi_dsi_attach_handler()

ra8_err_t ra8_mipi_dsi_attach_handler ( ra8_mipi_dsi_event_fn_t fn,
void * ctx )
nodiscard

Attach a callback for MIPI DSI interrupt events.

Parameters
[in]fnFunction to call (or nullptr to detach).
[in]ctxOpaque context passed back to fn.
Returns
k_ra8_ok.
Precondition
Caller's fn is ISR-safe.
Caller owns ctx lifetime for as long as fn is attached.
Postcondition
Subsequent ra8_mipi_dsi_dispatch* calls invoke fn.
Detached state silently swallowed.
Since
0.1.0

Definition at line 387 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_ok, s_mipi_dsi_event_ctx, and s_mipi_dsi_event_fn.

◆ ra8_mipi_dsi_clear_status()

ra8_err_t ra8_mipi_dsi_clear_status ( uint32_t mask)
nodiscard

Clear bits in any of the sub-status registers.

Fans mask out across SQCH0SCR, SQCH1SCR, VMSCR, RXSCR, FERRSCR, PLSCR so callers do not need to track which bit lives where.

Parameters
[in]maskOR of ra8_mipi_dsi_isr_mask_t bits to clear.
Returns
k_ra8_ok always.
Precondition
Driver init has run (or this is the bring-up path).
mask only contains bits defined in ra8_mipi_dsi_isr_mask_t.
Postcondition
Cleared sub-status registers read 0 for the requested bits.
Other status bits are preserved.
Since
0.1.0

Definition at line 226 of file ra8_mipi_dsi_dispatch.c.

References r_mipi_dsi_regs_t::FERRSCR, k_ra8_mipi_dsi_ferrsr_clear_all, k_ra8_mipi_dsi_isr_ferr, k_ra8_mipi_dsi_isr_ppi, k_ra8_mipi_dsi_isr_rcv, k_ra8_mipi_dsi_isr_sq0, k_ra8_mipi_dsi_isr_sq1, k_ra8_mipi_dsi_isr_vm, k_ra8_mipi_dsi_plsr_clear_all, k_ra8_mipi_dsi_rxsr_clear_all, k_ra8_mipi_dsi_sqch_clear_all, k_ra8_mipi_dsi_vmsr_clear_all, k_ra8_ok, r_mipi_dsi_regs_t::PLSCR, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RXSCR, r_mipi_dsi_regs_t::SQCH0SCR, r_mipi_dsi_regs_t::SQCH1SCR, and r_mipi_dsi_regs_t::VMSCR.

◆ ra8_mipi_dsi_dispatch()

void ra8_mipi_dsi_dispatch ( void )

Snapshot ISR, clear sub-status, fan out per-class callbacks.

Convenience trampoline that calls every per-class ra8_mipi_dsi_dispatch_* whose ISR bit is set. The platform's NVIC stub may also call individual _dispatch_* directly when wired up per-IRQ.

Precondition
Called either in IRQ context or with IRQs masked.
Driver init has run.
Postcondition
ISR reads 0 for the bits that were set when the call began.
Per-class dispatch trampolines have each fired at most once.
Note
Not thread-safe; pair with NVIC masking. See HUM Ch 65 "MIPI DSI Host" pp 3839-3934.
Since
0.1.0

Definition at line 511 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), r_mipi_dsi_regs_t::ISR, k_ra8_mipi_dsi_event_phy, k_ra8_mipi_dsi_isr_all, k_ra8_mipi_dsi_isr_ferr, k_ra8_mipi_dsi_isr_ppi, k_ra8_mipi_dsi_isr_rcv, k_ra8_mipi_dsi_isr_sq0, k_ra8_mipi_dsi_isr_sq1, k_ra8_mipi_dsi_isr_vm, ra8_mipi_dsi(), ra8_mipi_dsi_dispatch_fatal(), ra8_mipi_dsi_dispatch_phy(), ra8_mipi_dsi_dispatch_receive(), ra8_mipi_dsi_dispatch_seq0(), ra8_mipi_dsi_dispatch_seq1(), and ra8_mipi_dsi_dispatch_video().

◆ ra8_mipi_dsi_dispatch_fatal()

void ra8_mipi_dsi_dispatch_fatal ( void )

Fatal-error IRQ handler.

Snapshots FERRSR, clears the latched bits and invokes the registered fatal callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
FERRSR cleared.
Callback invoked with fatal event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 489 of file ra8_mipi_dsi_dispatch.c.

References r_mipi_dsi_regs_t::FERRSCR, r_mipi_dsi_regs_t::FERRSR, internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_fatal, k_ra8_mipi_dsi_ferrsr_clear_all, and ra8_mipi_dsi().

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_dispatch_phy()

void ra8_mipi_dsi_dispatch_phy ( void )

PHY-protocol-interface IRQ handler.

Snapshots PLSR, clears the latched bits and invokes the registered phy callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
PLSR cleared.
Callback invoked with phy event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 500 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_phy, k_ra8_mipi_dsi_plsr_clear_all, r_mipi_dsi_regs_t::PLSCR, r_mipi_dsi_regs_t::PLSR, and ra8_mipi_dsi().

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_dispatch_receive()

void ra8_mipi_dsi_dispatch_receive ( void )

Receive IRQ handler.

Snapshots RXSR, clears the latched bits and invokes the registered receive callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
RXSR cleared.
Callback invoked with receive event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 464 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_receive, k_ra8_mipi_dsi_rxrinfoow_sl0, k_ra8_mipi_dsi_rxsr_clear_all, k_ra8_mipi_dsi_rxsr_rxresp, ra8_mipi_dsi(), ra8_mipi_dsi_rx_payload_read(), r_mipi_dsi_regs_t::RXRINFOOWSCR, r_mipi_dsi_regs_t::RXSCR, r_mipi_dsi_regs_t::RXSR, s_mipi_dsi_pending_rx_buffer, and s_mipi_dsi_pending_rx_len.

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_dispatch_seq0()

void ra8_mipi_dsi_dispatch_seq0 ( void )

Sequence-channel-0 IRQ handler (LP path).

Snapshots SQCH0SR, clears the latched bits and invokes the registered seq0 callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
SQCH0SR cleared.
Callback invoked with seq0 event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 424 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_seq0, k_ra8_mipi_dsi_sqch_clear_all, ra8_mipi_dsi(), r_mipi_dsi_regs_t::SQCH0SCR, and r_mipi_dsi_regs_t::SQCH0SR.

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_dispatch_seq1()

void ra8_mipi_dsi_dispatch_seq1 ( void )

Sequence-channel-1 IRQ handler (HS path).

Snapshots SQCH1SR, clears the latched bits and invokes the registered seq1 callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
SQCH1SR cleared.
Callback invoked with seq1 event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 435 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_seq1, k_ra8_mipi_dsi_sqch_clear_all, ra8_mipi_dsi(), r_mipi_dsi_regs_t::SQCH1SCR, and r_mipi_dsi_regs_t::SQCH1SR.

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_dispatch_video()

void ra8_mipi_dsi_dispatch_video ( void )

Video-mode IRQ handler.

Snapshots VMSR, clears the latched bits and invokes the registered video callback. Safe to call from a spurious IRQ.

Precondition
Driver init done.
IRQ context.
Postcondition
VMSR cleared.
Callback invoked with video event.
Note
ISR-context only; not thread-safe.
Since
0.1.0

Definition at line 446 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_call_user(), k_ra8_mipi_dsi_event_video, k_ra8_mipi_dsi_rstcr_swrst, k_ra8_mipi_dsi_vmsr_clear_all, k_ra8_mipi_dsi_vmsr_vbufovf, k_ra8_mipi_dsi_vmsr_vbufudf, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RSTCR, r_mipi_dsi_regs_t::VMSCR, and r_mipi_dsi_regs_t::VMSR.

Referenced by ra8_mipi_dsi_dispatch().

◆ ra8_mipi_dsi_enter_ulps()

ra8_err_t ra8_mipi_dsi_enter_ulps ( void )
nodiscard

Drive the entire link (clock + data lanes) into ULPS.

Convenience equivalent to ra8_mipi_dsi_ulps_enter(k_ra8_mipi_dsi_lane_all). Honours the same continuous-clock-mode guard as the underlying call.

Returns
ra8_err_t outcome.
Return values
k_ra8_okBoth lanes pulsed into ULPS.
k_ra8_err_invalid_argContinuous-clock mode active and clock lane requested – HW prohibits it.
Precondition
Driver initialized, HS clock currently running.
Continuous-clock mode is OFF.
Postcondition
ULPSCR.CLENT and DLENT have been pulsed.
Subsequent ra8_mipi_dsi_send_* is rejected until ra8_mipi_dsi_exit_ulps.
Since
0.1.0

Definition at line 644 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_lane_all, and ra8_mipi_dsi_ulps_enter().

◆ ra8_mipi_dsi_exit_ulps()

ra8_err_t ra8_mipi_dsi_exit_ulps ( void )
nodiscard

Wake the entire link out of ULPS.

Convenience equivalent to ra8_mipi_dsi_ulps_exit(k_ra8_mipi_dsi_lane_all).

Returns
ra8_err_t outcome.
Return values
k_ra8_okBoth lanes woken.
Precondition
At least one of the lanes was previously placed in ULPS.
Driver initialized.
Postcondition
ULPSCR.CLEXIT and DLEXIT pulsed.
Link is ready for HS / LP traffic again once the wake-up sequence completes.
Since
0.1.0

Definition at line 649 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_lane_all, and ra8_mipi_dsi_ulps_exit().

◆ ra8_mipi_dsi_get_link_status()

ra8_err_t ra8_mipi_dsi_get_link_status ( ra8_mipi_dsi_link_status_t * out)
nodiscard

Snapshot the link state (running flags + busy flags + accumulated ack/error report) into a single struct.

Convenience around ra8_mipi_dsi_link_status_get – some callers want the more direct "get_link_status" name from the FSP surface.

Parameters
[out]outDecoded link status.
Returns
ra8_err_t outcome.
Return values
k_ra8_okStatus returned.
k_ra8_err_null_ptrout == nullptr.
Precondition
out non-NULL.
Driver initialized.
Postcondition
*out reflects the current LINKSR snapshot.
No registers mutated.
Since
0.1.0

Definition at line 654 of file ra8_mipi_dsi_dispatch.c.

References ra8_mipi_dsi_link_status_get().

◆ ra8_mipi_dsi_get_status()

ra8_err_t ra8_mipi_dsi_get_status ( uint32_t * out_mask)
nodiscard

Read the top-level Interrupt Status Register.

Parameters
[out]out_maskReceives the raw ISR value.
Returns
k_ra8_ok / k_ra8_err_null_ptr.
Precondition
out_mask non-NULL.
Driver init has run.
Postcondition
*out_mask reflects the current ISR snapshot.
No registers mutated.
Since
0.1.0

Definition at line 205 of file ra8_mipi_dsi_dispatch.c.

References r_mipi_dsi_regs_t::ISR, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), and s_tag.

◆ ra8_mipi_dsi_irq_enable()

ra8_err_t ra8_mipi_dsi_irq_enable ( ra8_mipi_dsi_event_t event,
uint32_t mask,
bool enable )
nodiscard

Toggle a sub-class IER bit.

Parameters
[in]eventWhich class (k_ra8_mipi_dsi_event_*).
[in]maskBits inside the class IER register to update.
[in]enabletrue -> set selected bits, false -> clear.
Returns
k_ra8_ok / k_ra8_err_invalid_arg for unknown class.
Precondition
Driver initialized.
event is a defined enumerator.
Postcondition
Selected IER bits updated.
Other IER bits preserved.
Since
0.1.0

Definition at line 347 of file ra8_mipi_dsi_dispatch.c.

References r_mipi_dsi_regs_t::FERRIER, k_ra8_err_invalid_arg, k_ra8_mipi_dsi_event_fatal, k_ra8_mipi_dsi_event_phy, k_ra8_mipi_dsi_event_receive, k_ra8_mipi_dsi_event_seq0, k_ra8_mipi_dsi_event_seq1, k_ra8_mipi_dsi_event_video, k_ra8_ok, r_mipi_dsi_regs_t::PLIER, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RXIER, r_mipi_dsi_regs_t::SQCH0IER, r_mipi_dsi_regs_t::SQCH1IER, and r_mipi_dsi_regs_t::VMIER.

◆ ra8_mipi_dsi_link_status_get()

ra8_err_t ra8_mipi_dsi_link_status_get ( ra8_mipi_dsi_link_status_t * out_status)
nodiscard

Decode LINKSR into a struct.

Parameters
[out]out_statusDecoded status.
Returns
k_ra8_ok / k_ra8_err_null_ptr.
Precondition
out_status non-NULL.
Driver initialized.
Postcondition
*out_status populated with the current LINKSR snapshot.
No registers mutated.
Since
0.1.0

Definition at line 213 of file ra8_mipi_dsi_dispatch.c.

References ra8_mipi_dsi_link_status_t::hs_busy, k_ra8_mipi_dsi_link_hsbusy, k_ra8_mipi_dsi_link_lpbusy, k_ra8_mipi_dsi_link_sq0run, k_ra8_mipi_dsi_link_sq1run, k_ra8_mipi_dsi_link_vrun, k_ra8_ok, r_mipi_dsi_regs_t::LINKSR, ra8_mipi_dsi_link_status_t::lp_busy, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), s_tag, ra8_mipi_dsi_link_status_t::sequence_ch0_running, ra8_mipi_dsi_link_status_t::sequence_ch1_running, and ra8_mipi_dsi_link_status_t::video_running.

Referenced by ra8_mipi_dsi_get_link_status().

◆ ra8_mipi_dsi_rx_payload_read()

ra8_err_t ra8_mipi_dsi_rx_payload_read ( uint8_t * dest,
uint16_t max_len,
uint16_t * out_len )
nodiscard

Copy out the most-recent long-packet RX payload (RXPPD0..3R).

Parameters
[out]destCaller buffer.
[in]max_lenBytes available in dest (capped at 16).
[out]out_lenBytes actually read.
Returns
k_ra8_ok / k_ra8_err_null_ptr.
Precondition
dest and out_len non-NULL.
max_len <= k_ra8_mipi_dsi_payload_max.
Postcondition
dest[0..*out_len) populated.
*out_len <= 16.
Since
0.1.0

Definition at line 310 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_byte_mask, k_ra8_mipi_dsi_payload_max, k_ra8_ok, k_shift_8, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RXPPD0R, r_mipi_dsi_regs_t::RXPPD1R, r_mipi_dsi_regs_t::RXPPD2R, r_mipi_dsi_regs_t::RXPPD3R, and s_tag.

Referenced by ra8_mipi_dsi_dispatch_receive().

◆ ra8_mipi_dsi_rx_result_get()

ra8_err_t ra8_mipi_dsi_rx_result_get ( uint8_t slot,
ra8_mipi_dsi_rx_result_t * out_result )
nodiscard

Decode and consume an RXRSS slot.

Parameters
[in]slot0..3 – which RXRSS register.
[out]out_resultDecoded packet header.
Returns
k_ra8_ok if the slot was valid, k_ra8_err_no_data if the slot's RXRSSR.SLT*VLD bit was clear.
Precondition
out_result non-NULL.
slot in 0..3.
Postcondition
On success, slot's RXRSSR + RXRINFOOWSR valid bits cleared.
*out_result carries the decoded header.
Since
0.1.0

Definition at line 271 of file ra8_mipi_dsi_dispatch.c.

References internal_ra8_mipi_dsi_decode_rx(), k_ra8_err_invalid_arg, k_ra8_err_no_data, k_ra8_mipi_dsi_rx_slots, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RXRINFOOWSCR, r_mipi_dsi_regs_t::RXRSS0R, r_mipi_dsi_regs_t::RXRSS1R, r_mipi_dsi_regs_t::RXRSS2R, r_mipi_dsi_regs_t::RXRSS3R, r_mipi_dsi_regs_t::RXRSSCR, r_mipi_dsi_regs_t::RXRSSR, and s_tag.

◆ ra8_mipi_dsi_send_command_long()

ra8_err_t ra8_mipi_dsi_send_command_long ( ra8_mipi_dsi_dt_t dt,
const uint8_t * payload,
uint16_t len )
nodiscard

Send a DSI command-mode long packet on VC0 (HS path).

Convenience surface around ra8_mipi_dsi_send_long_packet – always uses VC0 and the high-speed sequence channel 1, which is what every command-mode panel programming sequence wants. Use the lower-level helper if you need LP routing or a non-zero VC. HUM Ch 65 "Long packet write" p 3839+.

Parameters
[in]dtk_ra8_mipi_dsi_dt_gen_long_write or k_ra8_mipi_dsi_dt_dcs_long_write.
[in]payloadPayload bytes (len bytes long).
[in]lenPayload length in bytes (max 1024 in HS mode).
Returns
ra8_err_t outcome.
Return values
k_ra8_okPacket queued, START asserted.
k_ra8_err_null_ptrpayload == nullptr and len > 0.
k_ra8_err_invalid_arglen > 1024.
k_ra8_err_busySequence engine running.
Precondition
Driver initialized.
Either len == 0 or payload valid.
Postcondition
Descriptor 0 of channel 1 carries the long-packet header.
Since
0.1.0

Definition at line 613 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_err_null_ptr, k_ra8_mipi_dsi_vc0, and ra8_mipi_dsi_send_long_packet().

◆ ra8_mipi_dsi_send_command_payload()

ra8_err_t ra8_mipi_dsi_send_command_payload ( ra8_mipi_dsi_dt_t packet_type,
const uint8_t * payload,
uint16_t len )
nodiscard

Send a DSI command-mode packet (short or long) on VC0 in LP escape.

Routes a command-mode payload through the LP-escape sequence channel. Short writes (len <= 2) use the short-packet path; longer writes go through the long-packet path with the payload staged into TXPPD0..3R. Mirrors HUM Ch 65 "Command-mode packet TX" pp 3839-3934.

Parameters
[in]packet_typeDSI Data Type (see k_ra8_mipi_dsi_dt_*).
[in]payloadPayload bytes (len bytes).
[in]lenPayload length in bytes (LP cap = 128).
Returns
ra8_err_t outcome.
Return values
k_ra8_okPacket queued.
k_ra8_err_null_ptrpayload == nullptr and len > 0.
k_ra8_err_invalid_arglen > 128 (LP cap).
k_ra8_err_busySequence engine still running.
Precondition
Driver initialized via ra8_mipi_dsi_init.
Either len == 0 or payload is non-NULL.
Postcondition
Sequence channel 0 descriptor 0 carries the assembled header.
SQCH0SET0R pulsed with START.
Note
Not thread-safe.
Since
0.1.0

< RA8 mipi dsi short payload maximum.

Definition at line 622 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_err_null_ptr, k_ra8_mipi_dsi_vc0, ra8_mipi_dsi_send_long_packet(), and ra8_mipi_dsi_send_short_packet().

◆ ra8_mipi_dsi_send_command_short()

ra8_err_t ra8_mipi_dsi_send_command_short ( ra8_mipi_dsi_dt_t dt,
const uint8_t params[2] )
nodiscard

Send a DSI command-mode short packet on VC0 (LP escape).

Convenience surface around ra8_mipi_dsi_send_short_packet that matches the FSP "command short" signature: a Data Type plus a 2-byte parameter array. Always sent on virtual channel 0 in low power escape mode. HUM Ch 65 "Command-mode short packet" p 3839+.

Parameters
[in]dtOne of the k_ra8_mipi_dsi_dt_*_short_* constants.
[in]params2-element array carrying parameter 0 / 1.
Returns
ra8_err_t outcome.
Return values
k_ra8_okPacket queued.
k_ra8_err_null_ptrparams == nullptr.
k_ra8_err_busySequence engine still running.
k_ra8_err_invalid_stateVideo mode running (LP rejected).
Precondition
Driver initialized.
params is non-NULL.
Postcondition
Sequence channel 0 descriptor 0 carries the assembled header.
SQCH0SET0R pulsed with START.
Since
0.1.0

Definition at line 605 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_vc0, RA8_CHECK_NULL_PTR, ra8_mipi_dsi_send_short_packet(), and s_tag.

◆ ra8_mipi_dsi_set_video_timing()

ra8_err_t ra8_mipi_dsi_set_video_timing ( const ra8_mipi_dsi_video_timing_t * timing)
nodiscard

Load only the HSA/HBP/HACT/HFP/VSA/VBP/VACT/VFP video-timing registers from a compact descriptor.

Wraps ra8_mipi_dsi_video_configure with sensible defaults (RGB888 pixel format on VC0, sync-pulse mode off, HSA/HBP/HFP-no-LP all set so the link stays HS through blanking). The remaining VMSET1R / VMPPSETR fields keep their power-on defaults.

Parameters
[in]timingCompact timing descriptor.
Returns
ra8_err_t outcome.
Return values
k_ra8_okTiming registers loaded.
k_ra8_err_null_ptrtiming == nullptr.
k_ra8_err_invalid_argA field is wider than the target register.
Precondition
Driver initialized.
timing is non-NULL.
Postcondition
Video-mode timing registers reflect the new values.
Other VM* registers preserve their power-on defaults.
Note
Not thread-safe. Call from single-threaded init or with IRQs masked.
See also
ra8_mipi_dsi_video_configure – full-feature surface.
ra8_mipi_dsi_video_start
Since
0.1.0

Definition at line 560 of file ra8_mipi_dsi_dispatch.c.

References ra8_mipi_dsi_video_timing_t::horizontal_active, ra8_mipi_dsi_video_timing_t::horizontal_back_porch, ra8_mipi_dsi_video_timing_t::horizontal_front_porch, ra8_mipi_dsi_video_timing_t::horizontal_sync, k_ra8_err_invalid_arg, k_ra8_mipi_dsi_dt_pixel_rgb888, k_ra8_mipi_dsi_timing_max_active, k_ra8_mipi_dsi_timing_max_porch, k_ra8_mipi_dsi_timing_max_sync, k_ra8_mipi_dsi_vc0, RA8_CHECK_NULL_PTR, ra8_mipi_dsi_video_configure(), s_tag, ra8_mipi_dsi_video_timing_t::vertical_active, ra8_mipi_dsi_video_timing_t::vertical_back_porch, ra8_mipi_dsi_video_timing_t::vertical_front_porch, and ra8_mipi_dsi_video_timing_t::vertical_sync.

◆ ra8_mipi_dsi_te_event_clear()

ra8_err_t ra8_mipi_dsi_te_event_clear ( void )
nodiscard

Clear the latched tearing-effect bits in RXSR.

Returns
k_ra8_ok.
Precondition
Driver initialized.
Caller is in IRQ context or has IRQs masked.
Postcondition
RXSR.RXTE / EXTEDET clear.
Other RXSR bits preserved.
Since
0.1.0

Definition at line 339 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_rxsr_extedet, k_ra8_mipi_dsi_rxsr_rxte, k_ra8_ok, ra8_mipi_dsi(), and r_mipi_dsi_regs_t::RXSCR.

◆ ra8_mipi_dsi_te_event_pending()

ra8_err_t ra8_mipi_dsi_te_event_pending ( bool * out_pending)
nodiscard

Check if a tearing-effect (TE) trigger was received.

Parameters
[out]out_pendingReceives true if RXSR.RXTE (rx TE trigger) or RXSR.EXTEDET (external TE pin) is set.
Returns
k_ra8_ok / k_ra8_err_null_ptr.
Precondition
out_pending non-NULL.
Driver initialized.
Postcondition
*out_pending reflects current RXSR snapshot.
No registers mutated.
Since
0.1.0

Definition at line 329 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_rxsr_extedet, k_ra8_mipi_dsi_rxsr_rxte, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), r_mipi_dsi_regs_t::RXSR, and s_tag.

◆ ra8_mipi_dsi_video_configure()

ra8_err_t ra8_mipi_dsi_video_configure ( const ra8_mipi_dsi_video_cfg_t * vcfg)
nodiscard

Programme every video-mode timing register from a single config.

Touches VMSET1R, VMPPSETR, VMVSSETR, VMVPSETR, VMHSSETR, VMHPSETR. Does not assert VMSET0R.VSTART – call ra8_mipi_dsi_video_start() for that.

Parameters
[in]vcfgPointer to video-mode timing struct.
Returns
k_ra8_ok on success; k_ra8_err_null_ptr if vcfg == nullptr, k_ra8_err_invalid_arg if a field is out of range.
Precondition
vcfg is non-NULL.
All sync / porch / active-line counts fit into their HUM-defined bit widths.
Postcondition
Video timing registers loaded.
Subsequent _video_start will use these values.
Since
0.1.0

Definition at line 106 of file ra8_mipi_dsi_dispatch.c.

References ra8_mipi_dsi_video_cfg_t::horizontal_active_pixels, ra8_mipi_dsi_video_cfg_t::horizontal_back_porch, ra8_mipi_dsi_video_cfg_t::horizontal_front_porch, ra8_mipi_dsi_video_cfg_t::horizontal_sync_lines, ra8_mipi_dsi_video_cfg_t::hsync_active_high, k_ra8_err_invalid_arg, k_ra8_mipi_dsi_vc3, k_ra8_mipi_dsi_vmhp_hbp_mask, k_ra8_mipi_dsi_vmhp_hfp_mask, k_ra8_mipi_dsi_vmhp_hfp_shift, k_ra8_mipi_dsi_vmhs_hact_mask, k_ra8_mipi_dsi_vmhs_hact_shift, k_ra8_mipi_dsi_vmhs_hsa_mask, k_ra8_mipi_dsi_vmhs_hspol, k_ra8_mipi_dsi_vmpp_dt_mask, k_ra8_mipi_dsi_vmpp_dt_shift, k_ra8_mipi_dsi_vmpp_txesync, k_ra8_mipi_dsi_vmpp_vc_mask, k_ra8_mipi_dsi_vmpp_vc_shift, k_ra8_mipi_dsi_vmset1_dly_mask, k_ra8_mipi_dsi_vmset1_dly_shift, k_ra8_mipi_dsi_vmvp_vbp_mask, k_ra8_mipi_dsi_vmvp_vfp_mask, k_ra8_mipi_dsi_vmvp_vfp_shift, k_ra8_mipi_dsi_vmvs_vact_mask, k_ra8_mipi_dsi_vmvs_vact_shift, k_ra8_mipi_dsi_vmvs_vsa_mask, k_ra8_mipi_dsi_vmvs_vspol, k_ra8_ok, ra8_mipi_dsi_video_cfg_t::pixel_format, RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), s_tag, ra8_mipi_dsi_video_cfg_t::sync_pulse, ra8_mipi_dsi_video_cfg_t::vertical_active_lines, ra8_mipi_dsi_video_cfg_t::vertical_back_porch, ra8_mipi_dsi_video_cfg_t::vertical_front_porch, ra8_mipi_dsi_video_cfg_t::vertical_sync_lines, ra8_mipi_dsi_video_cfg_t::video_mode_delay, ra8_mipi_dsi_video_cfg_t::virtual_channel, r_mipi_dsi_regs_t::VMHPSETR, r_mipi_dsi_regs_t::VMHSSETR, r_mipi_dsi_regs_t::VMPPSETR, r_mipi_dsi_regs_t::VMSET1R, r_mipi_dsi_regs_t::VMVPSETR, r_mipi_dsi_regs_t::VMVSSETR, and ra8_mipi_dsi_video_cfg_t::vsync_active_high.

Referenced by ra8_mipi_dsi_set_video_timing().

◆ ra8_mipi_dsi_video_start()

ra8_err_t ra8_mipi_dsi_video_start ( const ra8_mipi_dsi_video_cfg_t * vcfg)
nodiscard

Start video-mode operation.

Writes VMSET0R with the HSA/HBP/HFP no-LP bits and the VSTART bit. Polls VMSR.VIRDY until set (bounded).

Returns
k_ra8_ok on success, k_ra8_err_hw_timeout on poll timeout.
Precondition
_video_configure has run since the last reset.
HS clock running.
Postcondition
LINKSR.VRUN set.
Video pixel stream is being transmitted.
Since
0.1.0

Definition at line 162 of file ra8_mipi_dsi_dispatch.c.

References ra8_mipi_dsi_video_cfg_t::hbp_no_lp, ra8_mipi_dsi_video_cfg_t::hfp_no_lp, ra8_mipi_dsi_video_cfg_t::hsa_no_lp, k_ra8_mipi_dsi_vmset0_hbpnolp, k_ra8_mipi_dsi_vmset0_hfpnolp, k_ra8_mipi_dsi_vmset0_hsanolp, k_ra8_mipi_dsi_vmset0_vstart, k_ra8_mipi_dsi_vmsr_virdy, priv_ra8_mipi_dsi_internal_wait_eq(), RA8_CHECK_NULL_PTR, ra8_mipi_dsi(), s_tag, r_mipi_dsi_regs_t::VMSET0R, and r_mipi_dsi_regs_t::VMSR.

◆ ra8_mipi_dsi_video_stop()

ra8_err_t ra8_mipi_dsi_video_stop ( void )
nodiscard

Request a video-mode stop and wait for it.

Sets VMSET0R.VSTOP, polls VMSR.STOP until 1, then scrubs the VMSCR latches. Equivalent to FSP dsi_stop.

Returns
k_ra8_ok on success, k_ra8_err_hw_timeout if VMSR.STOP never asserts within the bounded loop.
Precondition
Video mode is currently running (otherwise call is a no-op).
Driver initialized.
Postcondition
LINKSR.VRUN clear.
VMSR cleared of stale flags.
Since
0.1.0

Definition at line 184 of file ra8_mipi_dsi_dispatch.c.

References k_ra8_mipi_dsi_vmset0_vstop, k_ra8_mipi_dsi_vmsr_clear_all, k_ra8_mipi_dsi_vmsr_stop, k_ra8_ok, priv_ra8_mipi_dsi_internal_wait_eq(), ra8_mipi_dsi(), r_mipi_dsi_regs_t::VMSCR, r_mipi_dsi_regs_t::VMSET0R, and r_mipi_dsi_regs_t::VMSR.

Variable Documentation

◆ s_tag

const char* s_tag = "MIPI_DSI"
static

Component tag used by the ra8_log_* family.

Static so the linker keeps it confined to this TU. Same convention as every other ra8_hal driver (see ra8_glcdc.c, ra8_doc.c). The sibling ra8_mipi_dsi.c keeps its own identical copy – read-only constants are not shared across TUs.

Note
Read-only after assignment. Not modified at runtime.
Warning
Never modify directly – declared const to enforce.
Since
0.1.0

Definition at line 65 of file ra8_mipi_dsi_dispatch.c.