56static const char*
s_tag =
"MIPI_DSI";
67typedef enum : uint32_t {
98 const bool is_long = low_nibble > 0x08U;
171 uint32_t words[4] = {0U, 0U, 0U, 0U};
173 const uint16_t eff = (len < cap) ? len : cap;
174 for (uint16_t i = 0U; i < eff; ++i) {
175 const uint16_t word_idx = (uint16_t)(i / 4U);
176 const uint16_t byte_idx = (uint16_t)(i % 4U);
177 words[word_idx] |= ((uint32_t)data[i]) << (byte_idx * (uint32_t)
k_shift_8);
209 const uint32_t ch0_word =
211 const uint32_t ch1_word =
282 const uint32_t link = reg->
LINKSR;
325 dsc->
D = (uint32_t)buf_addr;
353 uint8_t channel = 1U;
358 const bool is_long = low_nibble > 0x08U;
360 if (is_long && (cmd->
tx_len > 0U)) {
394 uint8_t buf[2] = {param0, param1};
397 .virtual_channel = vc,
400 .ack_request =
false,
401 .aux_operation =
false,
405 .p_rx_buffer =
nullptr,
416 if ((tx_len > 0U) && (data ==
nullptr)) {
421 .virtual_channel = vc,
423 .low_power = low_power,
424 .ack_request =
false,
425 .aux_operation =
false,
429 .p_rx_buffer =
nullptr,
438 uint8_t* p_rx_buffer,
445 uint8_t tx_buf[2] = {param0, param1};
448 .virtual_channel = vc,
452 .aux_operation =
false,
455 .p_tx_buffer = tx_buf,
456 .p_rx_buffer = p_rx_buffer,
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_busy
Resource busy – blocking operation cannot proceed.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
uint16_t s_mipi_dsi_pending_rx_len
Single definition of the shared pending receive capacity.
uint8_t * s_mipi_dsi_pending_rx_buffer
Single definition of the shared pending receive buffer.
MIPI DSI-2 host driver – public API (full HUM Ch 65 surface).
static uint32_t internal_ra8_mipi_dsi_make_dsc_a(const ra8_mipi_dsi_command_t *cmd)
Build descriptor word A from a fully-formed command struct.
static ra8_err_t internal_check_link_state(const ra8_mipi_dsi_command_t *cmd)
Run the LINKSR-based pre-condition checks for send_command.
static void internal_ra8_mipi_dsi_stage_payload(const uint8_t *data, uint16_t len)
Stage long-packet payload bytes into TXPPD0..3R.
ra8_err_t ra8_mipi_dsi_send_command(const ra8_mipi_dsi_command_t *cmd)
Send any sequence-channel command (full-feature path).
static void internal_ra8_mipi_dsi_pulse_start(uint8_t channel)
Write the START-bit pulse for the given sequence channel.
static void internal_send_stage_and_pulse(const ra8_mipi_dsi_command_t *cmd)
Stage payload + descriptor for ra8_mipi_dsi_send_command.
ra8_err_t ra8_mipi_dsi_send_short_packet(ra8_mipi_dsi_dt_t cmd_id, ra8_mipi_dsi_vc_t vc, uint8_t param0, uint8_t param1)
Send a DSI short packet on sequence channel 0 (LP escape).
dsi_cmd_mask_t
Low-nibble mask for the DCS command id.
@ k_dsi_cmd_id_mask
Low nibble of the DCS command id.
static void internal_program_descriptor(volatile r_mipi_dsi_descriptor_t *dsc, const ra8_mipi_dsi_command_t *cmd)
Fill the four descriptor words for a sequence-channel command.
ra8_err_t ra8_mipi_dsi_send_long_packet(ra8_mipi_dsi_dt_t cmd_id, ra8_mipi_dsi_vc_t vc, const uint8_t *data, uint16_t tx_len, bool low_power)
Send a DSI long-packet write (Generic Long / DCS Long).
static uint32_t internal_ra8_mipi_dsi_make_dsc_c(const ra8_mipi_dsi_command_t *cmd)
Build descriptor word C (FINACT / AUXOP / ACTCODE).
static ra8_err_t internal_ra8_mipi_dsi_validate_cmd(const ra8_mipi_dsi_command_t *cmd)
Common LP/HS bound-checking for command submission.
ra8_err_t ra8_mipi_dsi_read_packet(ra8_mipi_dsi_dt_t cmd_id, ra8_mipi_dsi_vc_t vc, uint8_t param0, uint8_t param1, uint8_t *p_rx_buffer, uint16_t rx_len)
Issue a BTA-then-read on sequence channel 0 and return the captured response payload.
Module-private link seam shared between the MIPI DSI-2 hostdriver translation units.
@ k_ra8_mipi_dsi_byte_mask
8-bit byte field.
@ k_ra8_mipi_dsi_bta_mask
2-bit BTA selector.
@ k_ra8_mipi_dsi_vc_mask
2-bit virtual-channel.
@ k_ra8_mipi_dsi_dt_mask
6-bit DSI Data Type.
MIPI DSI Host (DSI-2) register layout for the RA8D2.
@ k_ra8_mipi_dsi_bta_none
No bus-turnaround.
@ k_ra8_mipi_dsi_bta_read
BTA followed by read.
@ k_ra8_mipi_dsi_max_lp_bytes
LP (ch 0) max long-pkt size.
@ k_ra8_mipi_dsi_max_hs_bytes
HS (ch 1) max long-pkt size.
@ k_ra8_mipi_dsi_payload_max
TXPPD bytes (4 x 32-bit regs).
static volatile r_mipi_dsi_regs_t * ra8_mipi_dsi(void)
Pointer to the RA8D2 MIPI DSI host register block.
@ k_ra8_mipi_dsi_dsc0b_dtsel_seqrm
Use sequence RAM.
@ k_ra8_mipi_dsi_sqch_start
START: kick sequence.
@ k_ra8_mipi_dsi_sqch_chsel
Channel-select bit (FSP).
@ k_ra8_mipi_dsi_link_vrun
Video-mode operation running.
@ k_ra8_mipi_dsi_link_sq1run
Sequence ch 1 running.
@ k_ra8_mipi_dsi_link_sq0run
Sequence ch 0 running.
@ k_ra8_mipi_dsi_dsc0a_shift_bta
Bus Turn Around bits.
@ k_ra8_mipi_dsi_dsc0a_shift_spd
0 = HS, 1 = LP escape.
@ k_ra8_mipi_dsi_dsc0a_shift_data0
Byte 1 of short packet.
@ k_ra8_mipi_dsi_dsc0a_shift_fmt
0 = short packet, 1 = long.
@ k_ra8_mipi_dsi_dsc0a_shift_data1
Byte 2 of short packet.
@ k_ra8_mipi_dsi_dsc0a_shift_dt
DSI data type (cmd id).
@ k_ra8_mipi_dsi_dsc0a_shift_vc
Virtual channel.
@ k_ra8_mipi_dsi_dsc0c_actcode_shift
Action code shift.
@ k_ra8_mipi_dsi_dsc0c_auxop
Auxiliary op flag.
@ k_ra8_mipi_dsi_dsc0c_finact
Finish action flag.
@ k_ra8_mipi_dsi_dsc0c_actcode_mask
ACTCODE[31:24].
ra8_mipi_dsi_dt_t
Frequently used DSI Data Types (cmd id) for short and long packets.
ra8_mipi_dsi_vc_t
DSI virtual channel identifier (DT[7:6] in the packet header).
@ k_ra8_mipi_dsi_vc3
Virtual channel 3.
One sequence-channel descriptor slot (4 x 32-bit registers).
volatile uint32_t D
Descriptor word D: payload buffer address.
volatile uint32_t A
Descriptor word A: packet header.
volatile uint32_t C
Descriptor word C: action / finish.
volatile uint32_t B
Descriptor word B: payload select.
MIPI DSI host register block (full layout).
volatile uint32_t LINKSR
+0x010 Link status (RO).
volatile uint32_t SQCH1SET0R
+0x600 Sequence ch 1 START bit.
volatile uint32_t TXPPD0R
+0x160 Tx packet payload data 0.
volatile uint32_t SQCH0SET0R
+0x5C0 Sequence ch 0 START bit.
r_mipi_dsi_descriptor_t SQCH0DSC[8]
+0x780..0x7FC ch0 desc 0..7.
volatile uint32_t TXPPD3R
+0x16C Tx packet payload data 3.
volatile uint32_t TXPPD1R
+0x164 Tx packet payload data 1.
r_mipi_dsi_descriptor_t SQCH1DSC[8]
+0x800..0x87C ch1 desc 0..7.
volatile uint32_t TXPPD2R
+0x168 Tx packet payload data 2.
Generic DSI packet descriptor for ra8_mipi_dsi_send_command.
uint8_t action_code
ACTCODE (only when aux_op).
bool low_power
true = LP escape (ch 0).
const uint8_t * p_tx_buffer
Source bytes for long packet.
uint8_t * p_rx_buffer
Sink bytes for read responses.
ra8_mipi_dsi_bta_t bta
BTA selector (none/after/...).
ra8_mipi_dsi_dt_t cmd_id
Data Type / command opcode.
ra8_mipi_dsi_vc_t virtual_channel
VC[1:0] in the packet header.
uint16_t tx_len
Bytes in p_tx_buffer.
bool aux_operation
AUXOP descriptor word C.