47static const char*
s_tag =
"MIPI_CSI";
58typedef enum : uint16_t {
282 uint32_t generic_errors = 0UL;
284 if ((vc_flags & ((uint32_t)1U << vc)) == 0UL) {
301 fn(ctx, vc, vc_specific);
307 if (err_fn !=
nullptr) {
308 const uint32_t err_bits =
311 if (err_bits != 0UL) {
427 bool is_high =
false;
453 const bool keep = ((vc_mask & ((uint16_t)1U << vc)) != 0U);
478 bool is_high =
false;
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_ISR_SAFE
The function is callable from interrupt context.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Cross-translation-unit private helpers shared inside ra8_hal.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
MIPI CSI-2 receiver HAL driver – public API.
static void * s_mipi_csi_pm_ctx
Caller context forwarded to the PM callback.
static ra8_mipi_csi_error_fn_t s_mipi_csi_err_fn
Callback invoked from dispatch_vc when an ECC/CRC error is decoded out of a VCST snapshot.
static ra8_mipi_csi_event_fn_t s_mipi_csi_fn
Currently-attached receive event callback.
static void * s_mipi_csi_dl_ctx
Caller context forwarded to the data-lane callback.
ra8_err_t ra8_mipi_csi_set_data_format(uint8_t vc, ra8_mipi_csi_data_format_t format)
Select the CSI-2 payload format the receiver should accept on a specific virtual channel.
static void * s_mipi_csi_ctx
Caller context forwarded to the receive event callback.
static ra8_mipi_csi_pm_event_fn_t s_mipi_csi_pm_fn
Currently-attached power-management callback.
ra8_err_t ra8_mipi_csi_attach_short_packet_handler(ra8_mipi_csi_short_event_fn_t fn, void *ctx)
Attach the short-packet FIFO callback (MIPI CSI GST vector).
ra8_err_t ra8_mipi_csi_attach_error_handler(ra8_mipi_csi_error_fn_t fn, void *ctx)
Register a callback invoked on ECC / CRC error reports.
static ra8_mipi_csi_dl_event_fn_t s_mipi_csi_dl_fn
Currently-attached data-lane callback.
static ra8_err_t internal_format_to_bit(ra8_mipi_csi_data_format_t format, bool *is_high, uint32_t *bit)
void ra8_mipi_csi_dispatch(void)
ISR-side dispatcher for the receive vector.
static void * s_mipi_csi_gst_ctx
Caller context forwarded to the short-packet callback.
ra8_err_t ra8_mipi_csi_attach_pm_handler(ra8_mipi_csi_pm_event_fn_t fn, void *ctx)
Attach the power-management callback (MIPI CSI PM vector).
ra8_err_t ra8_mipi_csi_set_virtual_channels(uint16_t vc_mask)
Filter which CSI-2 virtual channels the receiver will surface.
static void * s_mipi_csi_vc_ctx
Caller context forwarded to the per-VC callback.
static uint8_t s_mipi_csi_vc_format[k_ra8_mipi_csi_vc_count]
Software shadow of the per-VC payload format selection published by ra8_mipi_csi_set_data_format.
ra8_mipi_csi_irq_intern_t
Internal limits used by this translation unit only.
@ k_ra8_mipi_csi_vc_invalid_idx
Sentinel for "generic" event.
static void internal_recompute_dt_filter(void)
void ra8_mipi_csi_dispatch_pm(void)
ISR-side dispatcher for the power-management vector.
static void * s_mipi_csi_err_ctx
Caller context forwarded to the error callback.
ra8_err_t ra8_mipi_csi_attach_handler(ra8_mipi_csi_event_fn_t fn, void *ctx)
Attach the module-level CSI event callback.
ra8_err_t ra8_mipi_csi_attach_vc_handler(ra8_mipi_csi_vc_event_fn_t fn, void *ctx)
Attach the per-VC callback (MIPI CSI VC vector).
void ra8_mipi_csi_dispatch_short_packet(void)
ISR-side dispatcher for the generic-short-packet vector.
void priv_ra8_mipi_csi_detach_all_handlers(void)
Detach every MIPI CSI-2 receiver callback (module / data-lane / virtual-channel / power-management / ...
void ra8_mipi_csi_dispatch_vc(void)
ISR-side dispatcher for the per-VC vector.
static uint32_t s_mipi_csi_vcie_saved[k_ra8_mipi_csi_vc_count]
Snapshot of VCIE(M) at the time the last ra8_mipi_csi_set_virtual_channels call masked it off.
void ra8_mipi_csi_dispatch_dl(void)
ISR-side dispatcher for the data-lane vector.
ra8_err_t ra8_mipi_csi_attach_dl_handler(ra8_mipi_csi_dl_event_fn_t fn, void *ctx)
Attach the per-data-lane callback (MIPI CSI DL vector).
static ra8_mipi_csi_short_event_fn_t s_mipi_csi_gst_fn
Currently-attached short-packet FIFO callback.
static ra8_mipi_csi_vc_event_fn_t s_mipi_csi_vc_fn
Currently-attached per-VC callback.
MIPI CSI-2 Receiver register layout for the RA8D2 (HUM Ch 66).
@ k_ra8_mipi_csi_vc_count
Number of virtual channels.
@ k_ra8_mipi_csi_dteh_rgb888_mask
[4] RGB888.
@ k_ra8_mipi_csi_dteh_raw8_mask
[10] RAW8.
@ k_ra8_mipi_csi_mist_vc_mask
[31:16] per-VC src.
@ k_ra8_mipi_csi_mist_dl0s_mask
[0] DL0 has IRQ src.
@ k_ra8_mipi_csi_mist_dl1s_mask
[1] DL1 has IRQ src.
@ k_ra8_mipi_csi_mist_vc_shift
VC mask shift.
ra8_mipi_csi_off_t
Absolute byte offsets into the MIPI CSI register window.
@ k_ra8_mipi_csi_off_vcst0
Virtual Channel 0 Status.
@ k_ra8_mipi_csi_off_dtel
Receive Data-Type Enable Low.
@ k_ra8_mipi_csi_off_dlsc1
Data Lane 1 Status Clear.
@ k_ra8_mipi_csi_off_vcie0
Virtual Channel 0 IRQ Enable.
@ k_ra8_mipi_csi_off_gsst
Generic Short Packet Status.
@ k_ra8_mipi_csi_off_vcsc0
Virtual Channel 0 Status Clear.
@ k_ra8_mipi_csi_off_dlst0
Data Lane 0 Status.
@ k_ra8_mipi_csi_off_rxst
Receive Status.
@ k_ra8_mipi_csi_off_gssc
Generic Short Packet Stat Clear.
@ k_ra8_mipi_csi_off_mist
Module Interrupt Status.
@ k_ra8_mipi_csi_off_dlsc0
Data Lane 0 Status Clear.
@ k_ra8_mipi_csi_off_dteh
Receive Data-Type Enable High.
@ k_ra8_mipi_csi_off_pmst
Power-Management Status.
@ k_ra8_mipi_csi_off_dlst1
Data Lane 1 Status.
@ k_ra8_mipi_csi_off_pmsc
Power-Management Status Clear.
@ k_ra8_mipi_csi_off_rxsc
Receive Status Clear.
@ k_ra8_mipi_csi_pmst_w1c_mask
Lower 8 bits W1C-clr.
@ k_ra8_mipi_csi_rxsc_ractdetc_mask
[17] clear RXDET.
@ k_ra8_mipi_csi_gssc_govc_mask
[4] clear GOV.
@ k_ra8_mipi_csi_dlsc_all_mask
All clearable.
@ k_ra8_mipi_csi_vcst_generic_err_mask
Errors that affect every VC because the VC of the offending packet cannot be determined (MLF + ECD).
@ k_ra8_mipi_csi_vcst_ecd_mask
[1] ECC 2-bit error.
@ k_ra8_mipi_csi_vcst_ecc_mask
[5] ECC 1-bit corr.
@ k_ra8_mipi_csi_vcst_crc_mask
[2] CRC error.
@ k_ra8_mipi_csi_vcsc_per_vc_mask
All per-VC W1C bits.
@ k_ra8_mipi_csi_dtel_yuv422_8_mask
[30] YUV 8b.
@ k_ra8_mipi_csi_dtel_yuv422_10_mask
[31] YUV 10b.
static ra8_mipi_csi_off_t ra8_mipi_csi_vc_off(ra8_mipi_csi_off_t base, uint8_t vc)
Compute the byte offset of a per-virtual-channel register.
static volatile uint32_t * ra8_mipi_csi_reg32(ra8_mipi_csi_off_t off)
Get a 32-bit volatile pointer to a register inside the MIPI CSI window.
void(* ra8_mipi_csi_dl_event_fn_t)(void *ctx, uint8_t lane, uint32_t dlst)
Data-lane IRQ callback.
void(* ra8_mipi_csi_event_fn_t)(void *ctx, uint32_t rxst_mask)
MIPI CSI receive-status event callback.
void(* ra8_mipi_csi_pm_event_fn_t)(void *ctx, uint32_t pmst)
Power-management IRQ callback.
void(* ra8_mipi_csi_short_event_fn_t)(void *ctx, uint32_t gsst)
Generic-short-packet FIFO IRQ callback.
ra8_mipi_csi_data_format_t
Per-virtual-channel payload format used by ra8_mipi_csi_set_data_format.
@ k_ra8_mipi_csi_format_off
Disable – accept nothing for VC.
@ k_ra8_mipi_csi_format_yuv422_10
CSI-2 DT 0x1F – YUV 4:2:2 10-bit.
@ k_ra8_mipi_csi_format_rgb888
CSI-2 DT 0x24 – RGB888.
@ k_ra8_mipi_csi_format_yuv420
CSI-2 DT 0x18 – YUV 4:2:0 8-bit.
@ k_ra8_mipi_csi_format_raw8
CSI-2 DT 0x2A – RAW8.
@ k_ra8_mipi_csi_format_yuv422_8
CSI-2 DT 0x1E – YUV 4:2:2 8-bit.
@ k_ra8_mipi_csi_format_raw10
CSI-2 DT 0x2B – RAW10 (FSP-only).
void(* ra8_mipi_csi_error_fn_t)(void *ctx, const ra8_mipi_csi_error_report_t *report)
Callback invoked when the receiver reports an ECC or CRC error.
void(* ra8_mipi_csi_vc_event_fn_t)(void *ctx, uint8_t vc, uint32_t vcst)
Per-virtual-channel IRQ callback.
Ref-counted Module Stop Control wrapper for the RA8D2.
One ECC / CRC error notification from the receiver.