|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
MIPI CSI-2 receiver HAL driver implementation. More...
#include "ra8_mipi_csi.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_hal_internal.h"#include "ra8_log.h"#include "ra8_mipi_csi_regs.h"#include "ra8_mstp.h"Go to the source code of this file.
Enumerations | |
| enum | ra8_mipi_csi_intern_t : uint16_t { k_ra8_mipi_csi_reset_spin_max = 1024U , k_ra8_mipi_csi_gfclr_spin_max = 1024U } |
| Internal limits used by this translation unit only. More... | |
Functions | |
| static ra8_err_t | internal_wait_reset_idle (void) |
| static uint32_t | internal_encode_mct0 (const ra8_mipi_csi_config_t *cfg) |
| static ra8_err_t | internal_reject_if_running (void) |
| static ra8_err_t | internal_validate_cfg (const ra8_mipi_csi_config_t *cfg) |
| Validate cfg field ranges before any register writes. | |
| static void | internal_program_receiver (const ra8_mipi_csi_config_t *cfg) |
| Program the MCT/EPCT/EMCT/DTEL/DTEH/GSCT receiver block. | |
| static void | internal_program_irq_masks (const ra8_mipi_csi_config_t *cfg) |
| Program the receiver interrupt-enable mask block. | |
| 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). | |
| ra8_err_t | ra8_mipi_csi_short_packet_configure (uint8_t threshold, bool store_enable) |
| Programme GSCT (short-packet FIFO threshold + store flag). | |
| ra8_err_t | ra8_mipi_csi_short_packet_set_irq_enable (uint32_t mask) |
| Programme GSIE (short-packet IRQ enable). | |
| ra8_err_t | ra8_mipi_csi_short_packet_get_status (uint32_t *out_mask) |
| Read GSST (short-packet status). | |
| ra8_err_t | ra8_mipi_csi_short_packet_clear_status (uint32_t mask) |
| W1C-clear GSST.GOV (FIFO overflow) via GSSC. | |
| ra8_err_t | ra8_mipi_csi_read_short_packet (ra8_mipi_csi_short_packet_t *out) |
| Drain one stored short-packet header from the FIFO. | |
| ra8_err_t | ra8_mipi_csi_short_packet_clear_fifo (void) |
| Request a clear of the entire short-packet FIFO (GSIU.GFCLR). | |
| ra8_err_t | ra8_mipi_csi_short_packet_re_enable_store (void) |
| Re-enable storing into the FIFO after a GOV overflow (GSIU.GFEN). | |
| ra8_err_t | ra8_mipi_csi_enter_stop (void) |
| Gate the peripheral via MSTP (low-power entry helper). | |
| ra8_err_t | ra8_mipi_csi_exit_stop (void) |
| Ungate the peripheral via MSTP (low-power exit helper). | |
Variables | |
| static const char * | s_tag = "MIPI_CSI" |
| Log tag prefix used by every ra8_log_* call below. | |
MIPI CSI-2 receiver HAL driver implementation.
Full HUM Ch 66 ("MIPI CSI Interface" p 3935-3972) HAL driver for the RA8D2 MIPI CSI-2 receiver block. Hand-authored against the HUM (with FSP r_mipi_csi.c used purely as a register-sequence sanity check) – every single register documented in Ch 66 is exposed, and every IRQ source has a dispatcher + callback slot.
Pairs with the parallel ra8_mipi_phy driver (HUM Ch 64): the caller brings the PHY up first, then opens the CSI receiver.
Every register access carries a HUM Ch 66 citation immediately above the access, per project policy.
Definition in file ra8_mipi_csi.c.
| enum ra8_mipi_csi_intern_t : uint16_t |
Internal limits used by this translation unit only.
k_ra8_mipi_csi_reset_spin_max bounds the busy-loop that waits for RTST.VSRSTS to clear. k_ra8_mipi_csi_gfclr_spin_max bounds the wait for GSST.GCD after a GSIU.GFCLR request. With vclk at 125 MHz both complete in well under a microsecond; the ceilings here are defensive against a stuck peripheral.
| Enumerator | |
|---|---|
| k_ra8_mipi_csi_reset_spin_max | Max VSRSTS poll iterations. |
| k_ra8_mipi_csi_gfclr_spin_max | Max GCD poll iterations. |
Definition at line 79 of file ra8_mipi_csi.c.
|
static |
Definition at line 105 of file ra8_mipi_csi.c.
References ra8_mipi_csi_config_t::eccv13, ra8_mipi_csi_config_t::edmd, ra8_mipi_csi_config_t::generic_rule, k_ra8_mipi_csi_mct0_eccv13_mask, k_ra8_mipi_csi_mct0_edmd_mask, k_ra8_mipi_csi_mct0_grmd_mask, k_ra8_mipi_csi_mct0_lfsren_mask, k_ra8_mipi_csi_mct0_rvmd_mask, k_ra8_mipi_csi_mct0_vdln_mask, k_ra8_mipi_csi_mct0_zlmd_mask, ra8_mipi_csi_config_t::lanes, ra8_mipi_csi_config_t::lfsren, ra8_mipi_csi_config_t::rvmd, and ra8_mipi_csi_config_t::zlmd.
Referenced by internal_program_receiver().
|
static |
Program the receiver interrupt-enable mask block.
HUM Ch 66.3.14-66.3.27 pp 3946-3958. Writes RXIE, DLIE0/1, VCIE(M), PMIE, and GSIE in one pass.
| [in] | cfg | Caller-provided config snapshot. |
Definition at line 276 of file ra8_mipi_csi.c.
References ra8_mipi_csi_config_t::dl_irq_mask, k_ra8_mipi_csi_off_dlie0, k_ra8_mipi_csi_off_dlie1, k_ra8_mipi_csi_off_gsie, k_ra8_mipi_csi_off_pmie, k_ra8_mipi_csi_off_rxie, k_ra8_mipi_csi_off_vcie0, k_ra8_mipi_csi_vc_count, ra8_mipi_csi_config_t::pm_irq_mask, ra8_mipi_csi_reg32(), ra8_mipi_csi_vc_off(), ra8_mipi_csi_config_t::rx_irq_mask, ra8_mipi_csi_config_t::short_irq_mask, and ra8_mipi_csi_config_t::vc_irq_mask.
Referenced by ra8_mipi_csi_init().
|
static |
Program the MCT/EPCT/EMCT/DTEL/DTEH/GSCT receiver block.
HUM Ch 66.3.2-66.3.24 pp 3936-3957. Writes module-control registers, EPD options, data-type enables, and the generic short-packet control.
| [in] | cfg | Caller-provided config snapshot. |
Definition at line 208 of file ra8_mipi_csi.c.
References ra8_mipi_csi_config_t::dt_high_mask, ra8_mipi_csi_config_t::dt_low_mask, ra8_mipi_csi_config_t::eotp_enable, ra8_mipi_csi_config_t::epd_enable, ra8_mipi_csi_config_t::epd_long_spacer, ra8_mipi_csi_config_t::epd_option_2, ra8_mipi_csi_config_t::epd_short_spacer, ra8_mipi_csi_config_t::frrclk, ra8_mipi_csi_config_t::frrskw, internal_encode_mct0(), k_ra8_mipi_csi_emct_eotpen_mask, k_ra8_mipi_csi_emct_vlsien_mask, k_ra8_mipi_csi_emct_vlsien_shift, 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_gsct_gfif_mask, k_ra8_mipi_csi_gsct_shth_mask, k_ra8_mipi_csi_mct2_frrclk_mask, k_ra8_mipi_csi_mct2_frrskw_mask, k_ra8_mipi_csi_mct2_frrskw_shift, k_ra8_mipi_csi_off_dteh, k_ra8_mipi_csi_off_dtel, k_ra8_mipi_csi_off_emct, k_ra8_mipi_csi_off_epct, k_ra8_mipi_csi_off_gsct, k_ra8_mipi_csi_off_mct0, k_ra8_mipi_csi_off_mct2, ra8_mipi_csi_reg32(), ra8_mipi_csi_config_t::short_store_enable, ra8_mipi_csi_config_t::short_threshold, and ra8_mipi_csi_config_t::vlsien.
Referenced by ra8_mipi_csi_init().
|
static |
Definition at line 131 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_state, k_ra8_mipi_csi_mct3_rxen_mask, k_ra8_mipi_csi_off_mct3, k_ra8_ok, and ra8_mipi_csi_reg32().
Referenced by ra8_mipi_csi_set_ecc_mode(), ra8_mipi_csi_set_epd(), ra8_mipi_csi_set_frame_error_mode(), ra8_mipi_csi_set_lrte(), and ra8_mipi_csi_start_receive().
|
static |
Validate cfg field ranges before any register writes.
Catches lane count, VLSIEN, EPD spacer, and short-packet threshold out-of-range values described in HUM Ch 66 "MIPI Camera Serial Interface" pp 3935-3958.
| [in] | cfg | Caller-provided config snapshot. |
| k_ra8_ok | All fields in range. |
| k_ra8_err_invalid_arg | At least one field is out of the documented range. |
Definition at line 169 of file ra8_mipi_csi.c.
References ra8_mipi_csi_config_t::epd_long_spacer, ra8_mipi_csi_config_t::epd_short_spacer, k_ra8_err_invalid_arg, 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_gsct_shth_max, k_ra8_mipi_csi_lanes_1, k_ra8_mipi_csi_lanes_2, k_ra8_mipi_csi_vlsien_x4, k_ra8_ok, ra8_mipi_csi_config_t::lanes, ra8_mipi_csi_config_t::short_threshold, and ra8_mipi_csi_config_t::vlsien.
Referenced by ra8_mipi_csi_init().
|
static |
Definition at line 91 of file ra8_mipi_csi.c.
References k_ra8_err_hw_timeout, k_ra8_mipi_csi_off_rtst, k_ra8_mipi_csi_reset_spin_max, k_ra8_mipi_csi_rtst_vsrsts_mask, k_ra8_ok, and ra8_mipi_csi_reg32().
Referenced by ra8_mipi_csi_init(), and ra8_mipi_csi_reset().
|
nodiscard |
Clear the sticky receive-status bits selected by mask.
Only RACTDET (bit 17) is currently writable in RXSC; other bits in mask are silently dropped by hardware.
| [in] | mask | Bit mask to write to RXSC. |
| k_ra8_ok | Always. |
Definition at line 404 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_rxsc, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
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.
| k_ra8_ok | Receiver gated cleanly. |
| k_ra8_err_invalid_state | ra8_mstp ref-count was already 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().
|
nodiscard |
W1C-clear bits in DLST(N) via DLSC(N).
| [in] | lane | Data lane index (0..1). |
| [in] | mask | Bits to clear. |
| k_ra8_ok | Cleared. |
| k_ra8_err_invalid_arg | lane > 1. |
Definition at line 569 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_dl_max, k_ra8_mipi_csi_dlsc_all_mask, k_ra8_mipi_csi_off_dlsc0, k_ra8_ok, ra8_mipi_csi_dl_off(), and ra8_mipi_csi_reg32().
|
nodiscard |
Read DLST(N) (Data Lane N Status).
| [in] | lane | Data lane index (0..1). |
| [out] | out_mask | Live DLST(N) value. |
| k_ra8_ok | Status returned. |
| k_ra8_err_invalid_arg | lane > 1. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 557 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_dl_max, k_ra8_mipi_csi_off_dlst0, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_dl_off(), ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
Programme DLIE(N) (Data Lane N IRQ enable).
| [in] | lane | Data lane index (0..1). |
| [in] | mask | Bits to set in DLIE(N). |
| k_ra8_ok | Updated. |
| k_ra8_err_invalid_arg | lane > 1. |
Definition at line 580 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_dl_max, k_ra8_mipi_csi_off_dlie0, k_ra8_ok, ra8_mipi_csi_dl_off(), and ra8_mipi_csi_reg32().
|
nodiscard |
Gate the peripheral via MSTP (low-power entry helper).
| k_ra8_ok | Peripheral gated. |
| k_ra8_err_invalid_state | ra8_mstp ref-count was already 0. |
Definition at line 759 of file ra8_mipi_csi.c.
References k_ra8_mstp_mipi_csi, and ra8_mstp_disable().
|
nodiscard |
Ungate the peripheral via MSTP (low-power exit helper).
| k_ra8_ok | Peripheral clocked. |
| k_ra8_err_hw_init_failed | MSTP enable failed. |
Definition at line 765 of file ra8_mipi_csi.c.
References k_ra8_mstp_mipi_csi, and ra8_mstp_enable().
|
nodiscard |
Read MCG (Module Configuration, RO IP info) and decode.
| [out] | out | On success, the decoded MCG snapshot. |
| k_ra8_ok | Info returned in *out. |
| k_ra8_err_null_ptr | out was nullptr. |
Definition at line 427 of file ra8_mipi_csi.c.
References ra8_mipi_csi_module_info_t::fifo_stages, k_ra8_mipi_csi_mcg_gsnm_mask, k_ra8_mipi_csi_mcg_gsnm_shift, k_ra8_mipi_csi_mcg_sdln_mask, k_ra8_mipi_csi_mcg_sdln_shift, k_ra8_mipi_csi_mcg_ver_mask, k_ra8_mipi_csi_off_mcg, k_ra8_ok, ra8_mipi_csi_module_info_t::lanes_max, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), ra8_mipi_csi_module_info_t::raw, s_tag, and ra8_mipi_csi_module_info_t::version.
|
nodiscard |
Read MIST (Module Interrupt Status, RO summary).
| [out] | out_mask | On success, the live MIST value. |
| k_ra8_ok | Status returned. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 419 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_mist, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
Read the RXST receive-status register.
| [out] | out_mask | On success, the live RXST value (RACT, RACTDET, FRMn[15:0]). |
| k_ra8_ok | Status returned in *out_mask. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 396 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_rxst, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
Initialise the MIPI CSI receiver.
Sequence:
Programme GSCT (short-packet threshold + store flag).
| [in] | cfg | Non-NULL configuration descriptor. |
| k_ra8_ok | Receiver configured, RXEN still 0. |
| k_ra8_err_null_ptr | cfg was nullptr. |
| k_ra8_err_invalid_arg | Lane count not in {1, 2} or VLSIEN out of range. |
| k_ra8_err_hw_init_failed | MSTP enable failed. |
| k_ra8_err_hw_timeout | VSRSTS did not clear within budget. |
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.
|
nodiscard |
W1C-clear bits in PMST via PMSC.
| [in] | mask | Bits to clear (only [7:0] are clearable). |
| k_ra8_ok | Always. |
Definition at line 643 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_pmsc, k_ra8_mipi_csi_pmsc_all_mask, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Read PMST (Power Management Status) live value.
| [out] | out_mask | Live PMST value. |
| k_ra8_ok | Status returned. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 635 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_pmst, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
Programme PMIE (Power Management IRQ enable).
| [in] | mask | Bits to set in PMIE. |
| k_ra8_ok | Always. |
Definition at line 651 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_pmie, k_ra8_mipi_csi_pmie_all_mask, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Drain one stored short-packet header from the FIFO.
Reads GSST.PNUM first; if non-zero, sets GSIU.FINC (advance read pointer) then reads GSHT to retrieve the next header. The returned raw field is the unprocessed GSHT snapshot and the other fields are decoded for caller convenience.
| [out] | out | On success, the decoded short-packet header. |
| k_ra8_ok | Header drained into *out. |
| k_ra8_err_null_ptr | out was nullptr. |
| k_ra8_err_empty | FIFO had no stored packets. |
Definition at line 700 of file ra8_mipi_csi.c.
References ra8_mipi_csi_short_packet_t::data_type, k_ra8_err_empty, k_ra8_mipi_csi_gsht_dtyp_mask, k_ra8_mipi_csi_gsht_dtyp_shift, k_ra8_mipi_csi_gsht_spdt_mask, k_ra8_mipi_csi_gsht_spdt_shift, k_ra8_mipi_csi_gsht_spvc_mask, k_ra8_mipi_csi_gsht_spvc_shift, k_ra8_mipi_csi_gsiu_finc_mask, k_ra8_mipi_csi_gsst_pnum_mask, k_ra8_mipi_csi_gsst_pnum_shift, k_ra8_mipi_csi_off_gsht, k_ra8_mipi_csi_off_gsiu, k_ra8_mipi_csi_off_gsst, k_ra8_ok, ra8_mipi_csi_short_packet_t::payload, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), ra8_mipi_csi_short_packet_t::raw, s_tag, and ra8_mipi_csi_short_packet_t::vc.
|
nodiscard |
Issue a software reset (RTCT.VSRST) and wait for completion.
Pulses RTCT.VSRST then spins on RTST.VSRSTS until it clears. Used after stop_receive to drain the video-pixel pipeline before the next start.
| k_ra8_ok | Reset completed. |
| k_ra8_err_hw_timeout | VSRSTS did not clear in time. |
Definition at line 358 of file ra8_mipi_csi.c.
References internal_wait_reset_idle(), k_ra8_mipi_csi_off_rtct, k_ra8_mipi_csi_rtct_vsrst_mask, and ra8_mipi_csi_reg32().
|
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.
| [in] | low_mask | Mask written to DTEL. |
| [in] | high_mask | Mask written to DTEH. |
| k_ra8_ok | Always. |
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().
|
nodiscard |
Update MCT0 ECC bits (ECCV13, LFSREN) atomically.
| [in] | eccv13 | 1 = ECC v1.3 (24-bit) mode, 0 = legacy ECC. |
| [in] | lfsren | 1 = enable LFSR descrambling. |
| k_ra8_ok | Bits updated. |
| k_ra8_err_invalid_state | RXEN was set (can only update while gated). |
Definition at line 459 of file ra8_mipi_csi.c.
References internal_reject_if_running(), k_ra8_mipi_csi_mct0_eccv13_mask, k_ra8_mipi_csi_mct0_lfsren_mask, k_ra8_mipi_csi_off_mct0, k_ra8_ok, ra8_mipi_csi_reg32(), RA8_RETURN_ON_ERROR, and s_tag.
|
nodiscard |
Programme EPCT (long-packet spacer + Option-2 EPD).
| [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. |
| k_ra8_ok | Updated. |
| k_ra8_err_invalid_arg | spacer values exceed 15 bits. |
| k_ra8_err_invalid_state | RXEN was set. |
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.
|
nodiscard |
Update MCT0 frame-error notification bits atomically.
| [in] | zlmd | 1 = treat zero-length LP as ErrFrameSync. |
| [in] | edmd | 1 = forward ErrFrameData errors to ISR. |
| [in] | rvmd | 1 = receive Reserved-DT packets normally. |
| k_ra8_ok | Bits updated. |
| k_ra8_err_invalid_state | RXEN was set. |
Definition at line 477 of file ra8_mipi_csi.c.
References internal_reject_if_running(), k_ra8_mipi_csi_mct0_edmd_mask, k_ra8_mipi_csi_mct0_rvmd_mask, k_ra8_mipi_csi_mct0_zlmd_mask, k_ra8_mipi_csi_off_mct0, k_ra8_ok, ra8_mipi_csi_reg32(), RA8_RETURN_ON_ERROR, and s_tag.
|
nodiscard |
Programme EMCT (LRTE / EOTP options).
| [in] | vlsien | Variable-length spacer mode (EMCT.VLSIEN[5:4]). |
| [in] | eotp_enable | 1 = EMCT.EOTPEN – expect EoT packet. |
| k_ra8_ok | Updated. |
| k_ra8_err_invalid_arg | vlsien out of enum range. |
| k_ra8_err_invalid_state | RXEN was set. |
Definition at line 533 of file ra8_mipi_csi.c.
References internal_reject_if_running(), k_ra8_err_invalid_arg, k_ra8_mipi_csi_emct_eotpen_mask, k_ra8_mipi_csi_emct_vlsien_mask, k_ra8_mipi_csi_emct_vlsien_shift, k_ra8_mipi_csi_off_emct, k_ra8_mipi_csi_vlsien_x4, k_ra8_ok, ra8_mipi_csi_reg32(), RA8_RETURN_ON_ERROR, and s_tag.
|
nodiscard |
Programme RXIE (receive interrupt enable mask).
| [in] | mask | Bit mask to programme into RXIE. |
| k_ra8_ok | Always. |
Definition at line 412 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_rxie, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Request a clear of the entire short-packet FIFO (GSIU.GFCLR).
Writes 1 to GSIU.GFCLR, then waits for GSST.GCD to read 1 (clear complete) and writes 0 to GSIU.GFCLR to release the request line.
| k_ra8_ok | Cleared. |
| k_ra8_err_hw_timeout | GCD did not assert within budget. |
Definition at line 725 of file ra8_mipi_csi.c.
References k_ra8_err_hw_timeout, k_ra8_mipi_csi_gfclr_spin_max, k_ra8_mipi_csi_gsiu_gfclr_mask, k_ra8_mipi_csi_gsst_gcd_mask, k_ra8_mipi_csi_off_gsiu, k_ra8_mipi_csi_off_gsst, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
W1C-clear GSST.GOV (FIFO overflow) via GSSC.
| [in] | mask | Bits to clear (only GOV bit is W1C). |
| k_ra8_ok | Always. |
Definition at line 692 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_gssc_govc_mask, k_ra8_mipi_csi_off_gssc, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Programme GSCT (short-packet FIFO threshold + store flag).
| [in] | threshold | FIFO depth-1 reported in GSST.PNUM that asserts the GTH IRQ. Range 0..15. |
| [in] | store_enable | 1 = store incoming short packets in FIFO. |
| k_ra8_ok | Updated. |
| k_ra8_err_invalid_arg | threshold > 15. |
Definition at line 663 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_gsct_gfif_mask, k_ra8_mipi_csi_gsct_shth_mask, k_ra8_mipi_csi_gsct_shth_max, k_ra8_mipi_csi_off_gsct, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Read GSST (short-packet status).
| [out] | out_mask | Live GSST value. |
| k_ra8_ok | Status returned. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 684 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_gsst, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
Re-enable storing into the FIFO after a GOV overflow (GSIU.GFEN).
| k_ra8_ok | Always. |
Definition at line 747 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_gsiu_gfen_mask, k_ra8_mipi_csi_off_gsiu, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Programme GSIE (short-packet IRQ enable).
| [in] | mask | Bits to set in GSIE. |
| k_ra8_ok | Always. |
Definition at line 677 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_gsie_all_mask, k_ra8_mipi_csi_off_gsie, k_ra8_ok, and ra8_mipi_csi_reg32().
|
nodiscard |
Enable MIPI CSI reception (set MCT3.RXEN).
| k_ra8_ok | MCT3.RXEN set. |
| k_ra8_err_invalid_state | RXEN was already set. |
Definition at line 371 of file ra8_mipi_csi.c.
References internal_reject_if_running(), k_ra8_mipi_csi_mct3_rxen_mask, k_ra8_mipi_csi_off_mct3, k_ra8_ok, ra8_log_info, ra8_mipi_csi_reg32(), RA8_RETURN_ON_ERROR, and s_tag.
|
nodiscard |
Disable MIPI CSI reception (clear MCT3.RXEN, pulse VSRST).
The HUM (and FSP) require the application to wait for a full frame after stopping the upstream camera before calling this – we do not poll for that condition because the driver has no way to know the frame interval. Caller is responsible.
| k_ra8_ok | Always. |
Definition at line 381 of file ra8_mipi_csi.c.
References k_ra8_mipi_csi_off_mct3, k_ra8_mipi_csi_off_rtct, k_ra8_mipi_csi_rtct_vsrst_mask, k_ra8_ok, ra8_log_info, ra8_mipi_csi_reg32(), and s_tag.
|
nodiscard |
W1C-clear bits in VCST(M) via VCSC(M).
| [in] | vc | Virtual channel index (0..15). |
| [in] | mask | Bits to clear. |
| k_ra8_ok | Cleared. |
| k_ra8_err_invalid_arg | vc > 15. |
Definition at line 608 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_off_vcsc0, k_ra8_mipi_csi_vc_max, k_ra8_ok, ra8_mipi_csi_reg32(), and ra8_mipi_csi_vc_off().
|
nodiscard |
Read VCST(M) (Virtual Channel M Status).
| [in] | vc | Virtual channel index (0..15). |
| [out] | out_mask | Live VCST(M) value. |
| k_ra8_ok | Status returned. |
| k_ra8_err_invalid_arg | vc > 15. |
| k_ra8_err_null_ptr | out_mask was nullptr. |
Definition at line 596 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_off_vcst0, k_ra8_mipi_csi_vc_max, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_mipi_csi_reg32(), ra8_mipi_csi_vc_off(), and s_tag.
|
nodiscard |
Programme VCIE(M) (Virtual Channel M IRQ enable).
| [in] | vc | Virtual channel index (0..15). |
| [in] | mask | Bits to set in VCIE(M). |
| k_ra8_ok | Updated. |
| k_ra8_err_invalid_arg | vc > 15. |
Definition at line 619 of file ra8_mipi_csi.c.
References k_ra8_err_invalid_arg, k_ra8_mipi_csi_off_vcie0, k_ra8_mipi_csi_vc_max, k_ra8_ok, ra8_mipi_csi_reg32(), and ra8_mipi_csi_vc_off().
|
static |
Log tag prefix used by every ra8_log_* call below.
Definition at line 66 of file ra8_mipi_csi.c.