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

Module-private link seam shared between the MIPI DSI-2 hostdriver translation units. More...

#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_err.h"
#include "ra8_mipi_dsi.h"
#include "ra8_mipi_dsi_regs.h"
Include dependency graph for ra8_mipi_dsi_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  ra8_mipi_dsi_internal_t : uint32_t {
  k_ra8_mipi_dsi_clear_all = 0xFFFFFFFFUL ,
  k_ra8_mipi_dsi_isr_all ,
  k_ra8_mipi_dsi_byte_mask = 0xFFUL ,
  k_ra8_mipi_dsi_vc_mask = 0x3UL ,
  k_ra8_mipi_dsi_dt_mask = 0x3FUL ,
  k_ra8_mipi_dsi_bta_mask = 0x3UL
}
 Numeric constants used by the implementation that don't belong in the public header. More...
enum  ra8_mipi_dsi_shifts_t : uint8_t {
  k_shift_8 = 8U ,
  k_ulpssetr_wkup_shift = 0U ,
  k_dsisetr_mrpsz_shift = 0U ,
  k_dsisetr_vc_crc_shift = 20U ,
  k_rxrss_data1_shift = 8U ,
  k_rxrss_dt_shift = 16U ,
  k_rxrss_vc_shift = 22U ,
  k_akep_vc_shift = 16U
}
 Common shift positions used across the MIPI DSI-2 driver. More...

Functions

ra8_err_t priv_ra8_mipi_dsi_internal_wait_eq (volatile const uint32_t *reg, uint32_t mask, uint32_t expect)
 Bounded poll waiting for (reg & mask) == expect.

Variables

ra8_mipi_dsi_event_fn_t s_mipi_dsi_event_fn
 Single definition of the shared IRQ callback pointer.
void * s_mipi_dsi_event_ctx
 Single definition of the shared IRQ callback context.
uint8_t * s_mipi_dsi_pending_rx_buffer
 Single definition of the shared pending receive buffer.
uint16_t s_mipi_dsi_pending_rx_len
 Single definition of the shared pending receive capacity.

Detailed Description

Module-private link seam shared between the MIPI DSI-2 host

driver translation units.

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

The MIPI DSI-2 host driver is implemented across more than one translation unit so that no single file exceeds the scripts/checks/check_file_size.py cap. The configuration / link / sequence-channel path lives in ra8_mipi_dsi.c; the status, IRQ dispatch, video-mode, and convenience surfaces live in ra8_mipi_dsi_dispatch.c. A handful of file-scope mutable state words and one bounded-poll helper are read and written from both TUs.

This header is private to the MIPI DSI-2 driver only – no other module includes it. It exports:

  • the four mutable state words shared between the command-submission path (which arms the pending-RX buffer and registers the IRQ callback) and the dispatch path (which consumes them);
  • the bounded register-poll helper used by both the HS-clock path and the video-mode path.

Read-only constants (the log tag) are intentionally NOT shared: each TU keeps its own static copy with an identical initialiser.

Since
0.1.0

Definition in file ra8_mipi_dsi_internal.h.

Enumeration Type Documentation

◆ ra8_mipi_dsi_internal_t

enum ra8_mipi_dsi_internal_t : uint32_t

Numeric constants used by the implementation that don't belong in the public header.

Following the project's "no magic numbers" rule – every literal embedded in the driver code path lives here as a typed enum value. Shared between ra8_mipi_dsi.c and ra8_mipi_dsi_dispatch.c.

Enumerator
k_ra8_mipi_dsi_clear_all 

RW1C all-ones write mask.

k_ra8_mipi_dsi_isr_all 

RA8 mipi dsi ISR all.

k_ra8_mipi_dsi_byte_mask 

8-bit byte field.

k_ra8_mipi_dsi_vc_mask 

2-bit virtual-channel.

k_ra8_mipi_dsi_dt_mask 

6-bit DSI Data Type.

k_ra8_mipi_dsi_bta_mask 

2-bit BTA selector.

Definition at line 53 of file ra8_mipi_dsi_internal.h.

◆ ra8_mipi_dsi_shifts_t

enum ra8_mipi_dsi_shifts_t : uint8_t

Common shift positions used across the MIPI DSI-2 driver.

Shared between ra8_mipi_dsi.c and ra8_mipi_dsi_dispatch.c so both TUs agree on the bit-field positions of the link, ULPS, DSI, receive-result, and ack/error registers.

Enumerator
k_shift_8 

Shift 8.

k_ulpssetr_wkup_shift 

Ulpssetr wkup shift.

k_dsisetr_mrpsz_shift 

Dsisetr mrpsz shift.

k_dsisetr_vc_crc_shift 

Dsisetr vc CRC shift.

k_rxrss_data1_shift 

Rxrss data1 shift.

k_rxrss_dt_shift 

Rxrss dt shift.

k_rxrss_vc_shift 

Rxrss vc shift.

k_akep_vc_shift 

Akep vc shift.

Definition at line 73 of file ra8_mipi_dsi_internal.h.

Function Documentation

◆ priv_ra8_mipi_dsi_internal_wait_eq()

ra8_err_t priv_ra8_mipi_dsi_internal_wait_eq ( volatile const uint32_t * reg,
uint32_t mask,
uint32_t expect )

Bounded poll waiting for (reg & mask) == expect.

Defined in ra8_mipi_dsi.c and shared with the video-mode path in ra8_mipi_dsi_dispatch.c. Spins at most k_ra8_mipi_dsi_busy_loop_max iterations so the loop bound is statically provable (NASA Power of 10 Rule 2).

Parameters
[in]regAddress of the register to poll.
[in]maskBits to test.
[in]expectRequired value of reg & mask.
Returns
k_ra8_ok if the condition was met within the iteration cap, otherwise k_ra8_err_hw_timeout.
Return values
k_ra8_okCondition satisfied before the iteration cap.
k_ra8_err_hw_timeoutCap reached without the condition holding.
Precondition
reg is a valid MMIO register address.
Module clock is ungated.
Postcondition
No register is modified by this helper.
reg is read at least once.
Note
Not thread-safe unless documented otherwise.
Since
0.1.0

Bounded poll waiting for (reg & mask) == expect.

Definition at line 349 of file ra8_mipi_dsi.c.

References k_ra8_err_hw_timeout, k_ra8_mipi_dsi_busy_loop_max, and k_ra8_ok.

Referenced by ra8_mipi_dsi_hs_clock_start(), ra8_mipi_dsi_hs_clock_stop(), ra8_mipi_dsi_video_start(), and ra8_mipi_dsi_video_stop().

Variable Documentation

◆ s_mipi_dsi_event_ctx

void* s_mipi_dsi_event_ctx
extern

Single definition of the shared IRQ callback context.

Opaque context handed back to the IRQ callback.

Declared extern (with the full contract) in ra8_mipi_dsi_internal.h. Lifetime is owned by the caller of ra8_mipi_dsi_attach_handler.

Note
May be NULL if the user never attached.
Warning
Direct access from outside the MIPI DSI-2 driver is forbidden.
Since
0.1.0

Single definition lives in ra8_mipi_dsi.c. Lifetime is owned by the caller of ra8_mipi_dsi_attach_handler.

Note
May be NULL if the user never attached.
Warning
Direct access from outside the MIPI DSI-2 driver is forbidden.
Since
0.1.0

Definition at line 121 of file ra8_mipi_dsi.c.

Referenced by internal_ra8_mipi_dsi_call_user(), ra8_mipi_dsi_attach_handler(), ra8_mipi_dsi_deinit(), and ra8_mipi_dsi_init().

◆ s_mipi_dsi_event_fn

ra8_mipi_dsi_event_fn_t s_mipi_dsi_event_fn
extern

Single definition of the shared IRQ callback pointer.

Currently registered IRQ callback, or nullptr.

Declared extern (with the full contract) in ra8_mipi_dsi_internal.h and read from IRQ context in ra8_mipi_dsi_dispatch.c. Mutated only from the single-threaded init / deinit / attach-handler call sites.

Note
Direct access from outside the MIPI DSI-2 driver is forbidden.
Warning
Not thread-safe; treat as IRQ-shared state.
Since
0.1.0

Single definition lives in ra8_mipi_dsi.c. Mutated from the single-threaded init / deinit / attach-handler call sites; read from IRQ context inside ra8_mipi_dsi_dispatch.c.

Note
Direct access from outside the MIPI DSI-2 driver is forbidden.
Warning
Not thread-safe; treat as IRQ-shared state.
Since
0.1.0

Definition at line 106 of file ra8_mipi_dsi.c.

Referenced by internal_ra8_mipi_dsi_call_user(), ra8_mipi_dsi_attach_handler(), ra8_mipi_dsi_deinit(), and ra8_mipi_dsi_init().

◆ s_mipi_dsi_pending_rx_buffer

uint8_t* s_mipi_dsi_pending_rx_buffer
extern

Single definition of the shared pending receive buffer.

Buffer the caller passed to ra8_mipi_dsi_read_packet().

Declared extern (with the full contract) in ra8_mipi_dsi_internal.h. The receive ISR in ra8_mipi_dsi_dispatch.c copies long-packet payload bytes from RXPPD0..3R into this buffer once the response arrives, then clears it to avoid stale-pointer use.

Note
Modified from read_packet / send_command and the RX dispatch.
Warning
The pointer must remain valid until the IRQ fires.
Since
0.1.0

Single definition lives in ra8_mipi_dsi.c. The receive ISR in ra8_mipi_dsi_dispatch.c copies long-packet payload bytes into this buffer once the response arrives and then clears it to avoid stale-pointer use.

Note
Modified from read_packet / send_command and the RX dispatch.
Warning
The pointer must remain valid until the IRQ fires.
Since
0.1.0

Definition at line 180 of file ra8_mipi_dsi.c.

Referenced by ra8_mipi_dsi_deinit(), ra8_mipi_dsi_dispatch_receive(), ra8_mipi_dsi_init(), ra8_mipi_dsi_read_packet(), and ra8_mipi_dsi_send_command().

◆ s_mipi_dsi_pending_rx_len

uint16_t s_mipi_dsi_pending_rx_len
extern

Single definition of the shared pending receive capacity.

Capacity of s_mipi_dsi_pending_rx_buffer in bytes.

Declared extern (with the full contract) in ra8_mipi_dsi_internal.h. Cleared to zero once the response is consumed by the RX dispatch.

Note
Treat as undefined when s_mipi_dsi_pending_rx_buffer is NULL.
Warning
Direct access from outside the MIPI DSI-2 driver is forbidden.
Since
0.1.0

Single definition lives in ra8_mipi_dsi.c. Cleared to zero once the response is consumed by the RX dispatch.

Note
Treat as undefined when s_mipi_dsi_pending_rx_buffer is NULL.
Warning
Direct access from outside the MIPI DSI-2 driver is forbidden.
Since
0.1.0

Definition at line 195 of file ra8_mipi_dsi.c.

Referenced by ra8_mipi_dsi_deinit(), ra8_mipi_dsi_dispatch_receive(), ra8_mipi_dsi_init(), ra8_mipi_dsi_read_packet(), and ra8_mipi_dsi_send_command().