|
| ra8_err_t | ra8_mipi_csi_init (const ra8_mipi_csi_config_t *cfg) |
| | Initialise the MIPI CSI receiver.
|
| ra8_err_t | ra8_mipi_csi_deinit (void) |
| | Tear down the MIPI CSI receiver.
|
| ra8_err_t | ra8_mipi_csi_reset (void) |
| | Issue a software reset (RTCT.VSRST) and wait for completion.
|
| ra8_err_t | ra8_mipi_csi_start_receive (void) |
| | Enable MIPI CSI reception (set MCT3.RXEN).
|
| ra8_err_t | ra8_mipi_csi_stop_receive (void) |
| | Disable MIPI CSI reception (clear MCT3.RXEN, pulse VSRST).
|
| ra8_err_t | ra8_mipi_csi_get_status (uint32_t *out_mask) |
| | Read the RXST receive-status register.
|
| ra8_err_t | ra8_mipi_csi_clear_status (uint32_t mask) |
| | Clear the sticky receive-status bits selected by mask.
|
| ra8_err_t | ra8_mipi_csi_set_rx_irq_enable (uint32_t mask) |
| | Programme RXIE (receive interrupt enable mask).
|
| ra8_err_t | ra8_mipi_csi_get_module_irq_status (uint32_t *out_mask) |
| | Read MIST (Module Interrupt Status, RO summary).
|
| ra8_err_t | ra8_mipi_csi_get_module_info (ra8_mipi_csi_module_info_t *out) |
| | Read MCG (Module Configuration, RO IP info) and decode.
|
| ra8_err_t | ra8_mipi_csi_set_data_type_filter (uint32_t low_mask, uint32_t high_mask) |
| | Programme the receive data-type filter (DTEL + DTEH).
|
| ra8_err_t | ra8_mipi_csi_set_ecc_mode (bool eccv13, bool lfsren) |
| | Update MCT0 ECC bits (ECCV13, LFSREN) atomically.
|
| ra8_err_t | ra8_mipi_csi_set_frame_error_mode (bool zlmd, bool edmd, bool rvmd) |
| | Update MCT0 frame-error notification bits atomically.
|
| ra8_err_t | ra8_mipi_csi_set_epd (bool enable, bool option_2, uint16_t long_spacer, uint16_t short_spacer) |
| | Programme EPCT (long-packet spacer + Option-2 EPD).
|
| ra8_err_t | ra8_mipi_csi_set_lrte (ra8_mipi_csi_vlsien_t vlsien, bool eotp_enable) |
| | Programme EMCT (LRTE / EOTP options).
|
| ra8_err_t | ra8_mipi_csi_dl_get_status (uint8_t lane, uint32_t *out_mask) |
| | Read DLST(N) (Data Lane N Status).
|
| ra8_err_t | ra8_mipi_csi_dl_clear_status (uint8_t lane, uint32_t mask) |
| | W1C-clear bits in DLST(N) via DLSC(N).
|
| ra8_err_t | ra8_mipi_csi_dl_set_irq_enable (uint8_t lane, uint32_t mask) |
| | Programme DLIE(N) (Data Lane N IRQ enable).
|
| ra8_err_t | ra8_mipi_csi_vc_get_status (uint8_t vc, uint32_t *out_mask) |
| | Read VCST(M) (Virtual Channel M Status).
|
| ra8_err_t | ra8_mipi_csi_vc_clear_status (uint8_t vc, uint32_t mask) |
| | W1C-clear bits in VCST(M) via VCSC(M).
|
| ra8_err_t | ra8_mipi_csi_vc_set_irq_enable (uint8_t vc, uint32_t mask) |
| | Programme VCIE(M) (Virtual Channel M IRQ enable).
|
| ra8_err_t | ra8_mipi_csi_pm_get_status (uint32_t *out_mask) |
| | Read PMST (Power Management Status) live value.
|
| ra8_err_t | ra8_mipi_csi_pm_clear_status (uint32_t mask) |
| | W1C-clear bits in PMST via PMSC.
|
| ra8_err_t | ra8_mipi_csi_pm_set_irq_enable (uint32_t mask) |
| | Programme PMIE (Power Management IRQ enable).
|
MIPI CSI-2 receiver HAL driver – control, status, and IRQ-enable API.
- Tag
- [Ring 3 / HAL] {World: NS}
Lifecycle, reception control, module-level status, data-type filter, ECC / scrambling / frame-error knobs, EPD / LRTE tuning, and the per-data-lane / per-VC / power-management status + IRQ-enable prototypes for the RA8D2 MIPI CSI-2 receiver HAL. Split out of ra8_mipi_csi.h to keep each header within the per-file line budget; consumers continue to include ra8_mipi_csi.h.
- Copyright
- Copyright (c) 2026 Brighton Sikarskie SPDX-License-Identifier: MIT
- Since
- 0.1.0
Definition in file ra8_mipi_csi_ctrl.h.
Tear down the MIPI CSI receiver.
Clears MCT3.RXEN, pulses VSRST to flush any in-flight state, clears every IRQ-enable register, drops cached callbacks, and gates the MSTP bit. Safe to call after a partial init.
- Returns
- ra8_err_t error code.
- Return values
-
- Precondition
- IRQs masked or single-threaded teardown context.
-
Caller has stopped any upstream camera transmission.
- Postcondition
- MCT3.RXEN is 0.
-
MSTP bit for MIPI CSI is set (peripheral gated).
- Note
- Thread safety: not thread-safe.
- Since
- 0.1.0
Definition at line 324 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_dlie0, k_ra8_mipi_csi_off_dlie1, k_ra8_mipi_csi_off_gsie, k_ra8_mipi_csi_off_mct3, k_ra8_mipi_csi_off_pmie, k_ra8_mipi_csi_off_rtct, k_ra8_mipi_csi_off_rxie, k_ra8_mipi_csi_off_vcie0, k_ra8_mipi_csi_rtct_vsrst_mask, k_ra8_mipi_csi_vc_count, k_ra8_mstp_mipi_csi, priv_ra8_mipi_csi_detach_all_handlers(), ra8_mipi_csi_reg32(), ra8_mipi_csi_vc_off(), and ra8_mstp_disable().
Initialise the MIPI CSI receiver.
Sequence:
- Validate cfg and the lane count.
- Ungate the peripheral via ra8_mstp_enable(k_ra8_mstp_mipi_csi).
- Clear MCT3.RXEN (no reception during configuration).
- Spin until RTST.VSRSTS reads 0 (no reset in progress).
- Programme MCT0 (lane count + GRMD + ECCV13 + LFSREN + ZLMD + EDMD + RVMD).
- Programme MCT2 (FRRCLK + FRRSKW).
- Programme EPCT (EPD enable, option, spacers).
- Programme EMCT (VLSIEN + EOTPEN).
- Programme DTEL / DTEH (data-type filter).
Programme GSCT (short-packet threshold + store flag).
- Programme RXIE / DLIE0 / DLIE1 / VCIE0..15 / PMIE / GSIE.
- Leave RXEN clear – caller arms via start_receive.
- Parameters
-
| [in] | cfg | Non-NULL configuration descriptor. |
- Returns
- ra8_err_t error code.
- Return values
-
- Precondition
- IRQs masked or single-threaded init context.
-
ra8_mstp_init has been called.
- Postcondition
- On success, the peripheral is clocked and configured.
-
MCT3.RXEN is 0 (no incoming data accepted).
- Note
- Thread safety: not thread-safe.
- See also
- ra8_mipi_csi_start_receive
-
ra8_mipi_csi_deinit
- Since
- 0.1.0
Definition at line 298 of file ra8_mipi_csi.c.
References internal_program_irq_masks(), internal_program_receiver(), internal_validate_cfg(), internal_wait_reset_idle(), k_ra8_mipi_csi_off_mct3, k_ra8_mstp_mipi_csi, k_ra8_ok, ra8_mipi_csi_config_t::lanes, RA8_CHECK_NULL_PTR, ra8_log_info_val, ra8_mipi_csi_reg32(), ra8_mstp_enable(), RA8_RETURN_ON_ERROR, and s_tag.
| ra8_err_t ra8_mipi_csi_set_data_type_filter |
( |
uint32_t | low_mask, |
|
|
uint32_t | high_mask ) |
|
nodiscard |
Programme the receive data-type filter (DTEL + DTEH).
A bit set in low_mask enables the corresponding data type in the 0x00-0x1F range; a bit set in high_mask enables one in 0x20-0x3F. Bits documented as reserved (DTEL[3:0] read 1, [7:5] read 0, [29:16] read 0; DTEH bits other than 4 and 10) are preserved by the hardware.
- Parameters
-
| [in] | low_mask | Mask written to DTEL. |
| [in] | high_mask | Mask written to DTEH. |
- Returns
- ra8_err_t error code.
- Return values
-
- Precondition
- ra8_mipi_csi_init has succeeded.
-
Caller is in single-threaded context.
- Postcondition
- DTEL = low_mask, DTEH = high_mask.
-
Receiver accepts only the selected data types.
- Note
- Thread safety: not thread-safe.
- Since
- 0.1.0
Definition at line 445 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_dteh, k_ra8_mipi_csi_off_dtel, k_ra8_ok, and ra8_mipi_csi_reg32().
| ra8_err_t ra8_mipi_csi_set_epd |
( |
bool | enable, |
|
|
bool | option_2, |
|
|
uint16_t | long_spacer, |
|
|
uint16_t | short_spacer ) |
|
nodiscard |
Programme EPCT (long-packet spacer + Option-2 EPD).
- Parameters
-
| [in] | enable | 1 = EPCT.EPDEN – enable EPD operation. |
| [in] | option_2 | 1 = EPCT.EPDOP – select Option-2 EPD. |
| [in] | long_spacer | EPCT.SLP[14:0] – long-packet spacer count. |
| [in] | short_spacer | EPCT.SSP[14:0] – short-packet spacer count. |
- Returns
- ra8_err_t error code.
- Return values
-
- Precondition
- ra8_mipi_csi_init has succeeded.
-
Reception is stopped (MCT3.RXEN = 0).
- Postcondition
- EPCT contains the requested fields.
-
Subsequent transmissions honour the new spacer values.
- Note
- Thread safety: not thread-safe.
- Since
- 0.1.0
Definition at line 505 of file ra8_mipi_csi.c.
References internal_reject_if_running(), k_ra8_err_invalid_arg, k_ra8_mipi_csi_epct_epden_mask, k_ra8_mipi_csi_epct_epdop_mask, k_ra8_mipi_csi_epct_slp_mask, k_ra8_mipi_csi_epct_ssp_mask, k_ra8_mipi_csi_epct_ssp_shift, k_ra8_mipi_csi_off_epct, k_ra8_ok, ra8_mipi_csi_reg32(), RA8_RETURN_ON_ERROR, and s_tag.