|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Video Input Module (VIN) driver function prototypes. More...
Go to the source code of this file.
Functions | |
| ra8_err_t | ra8_vin_init (const ra8_vin_config_t *cfg) |
| Initialise VIN with the supplied descriptor. | |
| ra8_err_t | ra8_vin_deinit (void) |
| Tear down VIN: stop capture, mask interrupts, drop MSTP. | |
| ra8_err_t | ra8_vin_reset (void) |
| Issue a soft reset by re-running the MC.ST settle sequence. | |
| ra8_err_t | ra8_vin_capture_arm (ra8_vin_capture_mode_t mode) |
| Start a capture operation. | |
| ra8_err_t | ra8_vin_capture_disarm (void) |
| Stop the current capture and drain outstanding AXI traffic. | |
| ra8_err_t | ra8_vin_set_preclip (const ra8_vin_preclip_t *window) |
| Programme the pre-clip window (SLPRC / ELPRC / SPPRC / EPPRC). | |
| ra8_err_t | ra8_vin_set_uds_scale (const ra8_vin_uds_scale_t *scale) |
| Programme the UDS scaling factor (UDS_SCALE). | |
| ra8_err_t | ra8_vin_set_uds_passband (uint8_t v_bwidth, uint8_t h_bwidth) |
| Programme the UDS pass-band bandwidth (UDS_PASS_BWIDTH). | |
| ra8_err_t | ra8_vin_set_uds_clip (uint16_t v_size, uint16_t h_size) |
| Programme the UDS output clipping (UDS_CLIP_SIZE). | |
| ra8_err_t | ra8_vin_set_uds_ctrl (const ra8_vin_uds_ctrl_t *ctrl) |
| Programme UDS interpolation control (UDS_CTRL). | |
| ra8_err_t | ra8_vin_enable_scaling (bool enable) |
| Toggle the MC.SCLE main scaling-enable bit. | |
| ra8_err_t | ra8_vin_lut_program (const uint8_t *y_table, const uint8_t *cb_table, const uint8_t *cr_table, bool enable) |
| Programme all 256 entries of the Y / Cb / Cr conversion LUT. | |
| ra8_err_t | ra8_vin_set_yc_to_rgb (const ra8_vin_yc_to_rgb_t *coeffs) |
| Programme the YC -> RGB matrix coefficients (CSCE1..4). | |
| ra8_err_t | ra8_vin_set_rgb_to_yc (uint8_t channel, const ra8_vin_rgb_to_yc_chan_t *row) |
| Programme one row of the RGB -> YC matrix. | |
| ra8_err_t | ra8_vin_set_dithering (uint8_t mode, bool direction) |
| Configure the dithering mode (MC.DC + MC.DC2). | |
| ra8_err_t | ra8_vin_set_yuv444_mode (uint8_t mode) |
| Configure the YUV-444 conversion mode (MC.YUV444). | |
| ra8_err_t | ra8_vin_set_interlace_mode (uint8_t mode) |
| Set the interlace mode (MC.IM). | |
| ra8_err_t | ra8_vin_set_data_mode (const ra8_vin_data_mode_t *mode) |
| Programme the DMR (Data Mode Register). | |
| ra8_err_t | ra8_vin_set_csi_input (const ra8_vin_csi_input_t *input) |
| Programme CSI_IFMD (virtual channel + data type + extension). | |
| ra8_err_t | ra8_vin_set_field_detect (const ra8_vin_field_detect_t *detect) |
| Programme CSIFLD (field detection). | |
| ra8_err_t | ra8_vin_set_framebuffers (uint32_t mb1, uint32_t mb2, uint32_t mb3) |
| Re-programme MB1 / MB2 / MB3 (ping-pong framebuffers). | |
| ra8_err_t | ra8_vin_set_uv_offset (uint32_t uv_addr) |
| Programme UVAOF (UV plane address offset for YC-separated mode). | |
| ra8_err_t | ra8_vin_get_status (uint32_t *out_mask) |
| Snapshot the INTS register. | |
| ra8_err_t | ra8_vin_clear_status (uint32_t mask) |
| Clear write-1-to-clear bits in the INTS register. | |
| ra8_err_t | ra8_vin_get_module_status (ra8_vin_module_status_t *out_status) |
| Decode the MS register into a typed snapshot. | |
| ra8_err_t | ra8_vin_get_line_count (uint16_t *out_count) |
| Read the LC (line count) register. | |
| ra8_err_t | ra8_vin_get_active_buffer (uint8_t *out_id) |
| Return the active framebuffer index from MS.FBS. | |
| ra8_err_t | ra8_vin_set_interrupt_enable (uint32_t mask) |
| Update the IE (Interrupt Enable) mask at runtime. | |
| ra8_err_t | ra8_vin_set_scanline_compare (uint16_t line) |
| Programme the SI (Scanline Interrupt) compare register. | |
| ra8_err_t | ra8_vin_attach_handler (ra8_vin_event_fn_t fn, void *ctx) |
| Attach a VIN event callback (shared between status + error IRQs). | |
| void | ra8_vin_dispatch (void) |
| Snapshot INTS, fire callback, then W1C the latched bits. | |
| ra8_err_t | ra8_vin_enter_stop (void) |
| Quiesce VIN and disable its module-stop clock gate. | |
| ra8_err_t | ra8_vin_exit_stop (void) |
| Re-enable the VIN clock gate after ra8_vin_enter_stop. | |
| ra8_err_t | ra8_vin_capture_start (void *buf, uint16_t w, uint16_t h, ra8_vin_input_fmt_t format) |
| Start a single-frame capture into buf with the supplied geometry. | |
| ra8_err_t | ra8_vin_capture_stop (void) |
| Stop the in-flight capture started via ra8_vin_capture_start. | |
| ra8_err_t | ra8_vin_set_window (uint16_t x, uint16_t y, uint16_t w, uint16_t h) |
| Programme a region-of-interest pre-clip window. | |
| ra8_err_t | ra8_vin_attach_frame_handler (ra8_vin_frame_fn_t fn, void *ctx) |
| Register the frame-end IRQ callback. | |
Video Input Module (VIN) driver function prototypes.
Public function prototypes for the RA8D2 Video Input Module (VIN) HAL driver: lifecycle (init / deinit / reset), capture arm/disarm, geometry / pre-clip / scaling setters, the 10-to-8-bit LUT loader, colour-space conversion coefficient setters, dithering / YUV-444 / DMR options, CSI-2 input + framebuffer programming, status readers, the interrupt path (enable mask, scanline compare, handler attach, dispatch), power transitions, and the high-level dynamic capture window + frame-end IRQ helpers. The configuration descriptors and types these prototypes consume live in ra8_vin_types.h; both are aggregated by the thin umbrella ra8_vin.h, which also documents the full driver overview and state machine.
Definition in file ra8_vin_api.h.
|
nodiscard |
Register the frame-end IRQ callback.
The driver's generic ra8_vin_dispatch fans every INTS bit through a single mask-style callback. This frame-end variant is invoked only when INTS.FIE is set after a ra8_vin_capture_start call, and receives the cached buffer + length.
| [in] | fn | Callback (NULL detaches). |
| [in] | ctx | Forwarded to the callback. |
| k_ra8_ok | Always. |
Definition at line 983 of file ra8_vin.c.
References k_ra8_ok, s_vin_frame_ctx, and s_vin_frame_fn.
|
nodiscard |
Attach a VIN event callback (shared between status + error IRQs).
| [in] | fn | Callback invoked from ra8_vin_dispatch. May be NULL to detach. |
| [in] | ctx | Context value forwarded to the callback. |
| k_ra8_ok | Always. |
|
nodiscard |
Start a capture operation.
Implements the procedure from HUM Ch 67.3.1 "Initialization Procedure" p 3995:
The MIPI CSI peripheral must be configured and started by the caller separately – VIN consumes data that arrives on the shared CSI->VIN data path.
| [in] | mode | Single-shot, continuous, or continuous-with-field- skip (ra8_vin_capture_mode_t). |
| k_ra8_ok | Capture armed and running. |
| k_ra8_err_invalid_state | ME or CC was already 1. |
| k_ra8_err_invalid_arg | Unknown mode value. |
Definition at line 342 of file ra8_vin.c.
References internal_pulse_st(), k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_ok, k_ra8_vin_capture_continuous, k_ra8_vin_capture_continuous_field_skip, k_ra8_vin_capture_single, k_ra8_vin_fc_cc, k_ra8_vin_mc_me, k_ra8_vin_off_fc, k_ra8_vin_off_mc, ra8_log_info_val, ra8_vin_reg32(), and s_tag.
Referenced by ra8_vin_capture_start().
|
nodiscard |
Stop the current capture and drain outstanding AXI traffic.
Implements HUM Ch 67.3.6 "Stopping capture operation" p 4006:
| k_ra8_ok | Stop sequence drained successfully. |
| k_ra8_err_invalid_state | ME was already 0 (nothing to stop). |
| k_ra8_err_hw_timeout | OUTSTAND did not reach 0 in time. |
Definition at line 376 of file ra8_vin.c.
References k_ra8_err_invalid_state, k_ra8_vin_mc_me, k_ra8_vin_mtcstop_outstand, k_ra8_vin_mtcstop_req, k_ra8_vin_off_fc, k_ra8_vin_off_mc, k_ra8_vin_off_mtcstop, k_ra8_vin_stop_drain_max, ra8_hw_wait_flag_clear32(), ra8_log_info, ra8_vin_reg32(), and s_tag.
Referenced by ra8_vin_capture_stop().
|
nodiscard |
Start a single-frame capture into buf with the supplied geometry.
High-level wrapper around ra8_vin_capture_arm(k_ra8_vin_capture_single) that:
| [in] | buf | Capture target (must be 64-byte aligned). |
| [in] | w | Width in pixels (1..4096). |
| [in] | h | Height in lines (1..4096). |
| [in] | format | Input format (ra8_vin_input_fmt_t). |
| k_ra8_ok | Capture armed. |
| k_ra8_err_null_ptr | buf was NULL. |
| k_ra8_err_invalid_arg | w/h out of range or buf misaligned. |
| k_ra8_err_invalid_state | ME or CC was already 1. |
Definition at line 933 of file ra8_vin.c.
References internal_format_bpp(), internal_mc_rmw(), k_ra8_err_invalid_arg, k_ra8_vin_capture_single, k_ra8_vin_geom_max_dim, k_ra8_vin_mb_align_mask, k_ra8_vin_mc_inf, k_ra8_vin_mc_shift_inf, k_ra8_vin_off_is, k_ra8_vin_off_mb1, RA8_CHECK_NULL_PTR, ra8_vin_capture_arm(), ra8_vin_reg32(), s_tag, s_vin_frame_buf, and s_vin_frame_len.
|
nodiscard |
Stop the in-flight capture started via ra8_vin_capture_start.
Wraps ra8_vin_capture_disarm – exists so the high-level start / stop pair share matching names.
Definition at line 959 of file ra8_vin.c.
References ra8_vin_capture_disarm().
|
nodiscard |
Clear write-1-to-clear bits in the INTS register.
Only the bits in mask that intersect k_ra8_vin_int_w1c_mask are written back; all other bits are gated off so a careless caller cannot toggle status bits the hardware owns.
| [in] | mask | Bits to clear (subset of ra8_vin_int_mask_t). |
| k_ra8_ok | Always. |
Definition at line 783 of file ra8_vin.c.
References k_ra8_ok, k_ra8_vin_int_w1c_mask, k_ra8_vin_off_ints, and ra8_vin_reg32().
|
nodiscard |
Tear down VIN: stop capture, mask interrupts, drop MSTP.
| k_ra8_ok | Always. |
Definition at line 308 of file ra8_vin.c.
References k_ra8_mstp_mipi_csi, k_ra8_vin_int_w1c_mask, k_ra8_vin_off_fc, k_ra8_vin_off_ie, k_ra8_vin_off_ints, k_ra8_vin_off_mc, ra8_mstp_disable(), ra8_vin_reg32(), s_vin_ctx, s_vin_fn, s_vin_frame_buf, s_vin_frame_ctx, s_vin_frame_fn, and s_vin_frame_len.
| void ra8_vin_dispatch | ( | void | ) |
Snapshot INTS, fire callback, then W1C the latched bits.
Intended to be called from the VIN status / error ISR. Reads the current INTS value, hands it to the registered callback (if any), and writes back the W1C subset to acknowledge the event with the hardware.
Definition at line 849 of file ra8_vin.c.
References k_ra8_vin_int_fme, k_ra8_vin_int_w1c_mask, k_ra8_vin_off_ints, ra8_vin_reg32(), s_vin_ctx, s_vin_fn, s_vin_frame_buf, s_vin_frame_ctx, s_vin_frame_fn, and s_vin_frame_len.
|
nodiscard |
Toggle the MC.SCLE main scaling-enable bit.
| [in] | enable | True -> SCLE = 1, false -> SCLE = 0. |
| k_ra8_ok | Always. |
Definition at line 499 of file ra8_vin.c.
References internal_mc_rmw(), k_ra8_ok, and k_ra8_vin_mc_scle.
|
nodiscard |
Quiesce VIN and disable its module-stop clock gate.
Stops capture (MC.ME = 0) and disables the MIPI CSI MSTP bit. Note that this also gates the MIPI CSI receiver since the two peripherals share k_ra8_mstp_mipi_csi.
Definition at line 876 of file ra8_vin.c.
References k_ra8_mstp_mipi_csi, k_ra8_vin_mc_me, k_ra8_vin_off_fc, k_ra8_vin_off_mc, ra8_mstp_disable(), and ra8_vin_reg32().
|
nodiscard |
Re-enable the VIN clock gate after ra8_vin_enter_stop.
Definition at line 888 of file ra8_vin.c.
References k_ra8_mstp_mipi_csi, and ra8_mstp_enable().
|
nodiscard |
Return the active framebuffer index from MS.FBS.
| [out] | out_id | Non-NULL destination (ra8_vin_ms_fbs_t). |
| k_ra8_ok | Read OK. |
| k_ra8_err_null_ptr | out_id was NULL. |
Definition at line 815 of file ra8_vin.c.
References k_ra8_ok, k_ra8_vin_ms_fbs, k_ra8_vin_ms_shift_fbs, k_ra8_vin_off_ms, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Read the LC (line count) register.
| [out] | out_count | Non-NULL destination. |
| k_ra8_ok | Read OK. |
| k_ra8_err_null_ptr | out_count was NULL. |
Definition at line 807 of file ra8_vin.c.
References k_ra8_ok, k_ra8_vin_lc_mask, k_ra8_vin_off_lc, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Decode the MS register into a typed snapshot.
| [out] | out_status | Non-NULL destination. |
| k_ra8_ok | Snapshot taken. |
| k_ra8_err_null_ptr | out_status was NULL. |
Definition at line 793 of file ra8_vin.c.
References ra8_vin_module_status_t::active_video, ra8_vin_module_status_t::capture_active, ra8_vin_module_status_t::even_field, ra8_vin_module_status_t::frame_buffer_id, k_ra8_ok, k_ra8_vin_ms_av, k_ra8_vin_ms_ca, k_ra8_vin_ms_fbs, k_ra8_vin_ms_fms, k_ra8_vin_ms_fs, k_ra8_vin_ms_ma, k_ra8_vin_ms_shift_fbs, k_ra8_vin_ms_shift_fms, k_ra8_vin_off_ms, ra8_vin_module_status_t::latest_frame_buffer, ra8_vin_module_status_t::memory_active, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Snapshot the INTS register.
| [out] | out_mask | Receives the current INTS value. |
| k_ra8_ok | Snapshot taken. |
| k_ra8_err_null_ptr | out_mask was NULL. |
Definition at line 775 of file ra8_vin.c.
References k_ra8_ok, k_ra8_vin_off_ints, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Initialise VIN with the supplied descriptor.
Brings the MIPI CSI clock gate up via the MIPI-CSI MSTP bit (VIN does not have its own MSTPCR bit on the RA8D2; the peripheral's clocks are released as a side-effect of enabling MIPI CSI – see HUM Ch 11.2.8 "MSTPCRC" and section 67.1 "Block Diagram"). The function then writes a clean MC value (ME = 0), programmes IS / MB1..3 / IE / SI / MC.IM / MC.CLP, and clears all latched INTS bits.
Pre-clip, scaling, LUT, and colour-space coefficients are left at their reset defaults. Use the dedicated setters to programme them before ra8_vin_capture_start.
| [in] | cfg | Non-NULL configuration descriptor. |
| k_ra8_ok | Success. |
| k_ra8_err_null_ptr | cfg was NULL. |
| k_ra8_err_invalid_arg | cfg.image_stride_px was 0 or cfg.interlace_mode / pixel_clip_mode out of range. |
| k_ra8_err_hw_init_failed | MSTP enable failed. |
Definition at line 260 of file ra8_vin.c.
References ra8_vin_config_t::framebuffer_addr_1, ra8_vin_config_t::framebuffer_addr_2, ra8_vin_config_t::framebuffer_addr_3, ra8_vin_config_t::image_stride_px, ra8_vin_config_t::interlace_mode, internal_compose_mc(), ra8_vin_config_t::interrupt_enable, k_ra8_err_invalid_arg, k_ra8_mstp_mipi_csi, k_ra8_ok, k_ra8_vin_int_w1c_mask, k_ra8_vin_max_clp, k_ra8_vin_max_im, k_ra8_vin_off_fc, k_ra8_vin_off_ie, k_ra8_vin_off_ints, k_ra8_vin_off_is, k_ra8_vin_off_mb1, k_ra8_vin_off_mb2, k_ra8_vin_off_mb3, k_ra8_vin_off_mc, k_ra8_vin_off_si, ra8_vin_config_t::pixel_clip_mode, RA8_CHECK_NULL_PTR, ra8_log_info_val, ra8_mstp_enable(), RA8_RETURN_ON_ERROR, ra8_vin_reg32(), s_tag, and ra8_vin_config_t::scanline_compare.
|
nodiscard |
Programme all 256 entries of the Y / Cb / Cr conversion LUT.
HUM Ch 67.2.25 / 67.2.26 p 4000-4001. Each LUT byte is written by:
The driver loops 256 iterations, advancing all three pointers in lock-step. Pass NULL for cb or cr to reuse y for that channel; passing NULL for y returns k_ra8_err_null_ptr.
enable then drives MC.LUTE so the hardware actually consumes the table on the next frame.
| [in] | y_table | Pointer to 256 8-bit Y values (must be non-NULL). |
| [in] | cb_table | Pointer to 256 8-bit Cb values (NULL -> use Y). |
| [in] | cr_table | Pointer to 256 8-bit Cr values (NULL -> use Y). |
| [in] | enable | Drive MC.LUTE after programming. |
| k_ra8_ok | LUT programmed. |
| k_ra8_err_null_ptr | y_table was NULL. |
Definition at line 509 of file ra8_vin.c.
References internal_mc_rmw(), k_ra8_ok, k_ra8_vin_lut_entries, k_ra8_vin_lutd_ltcbdt, k_ra8_vin_lutd_ltcrdt, k_ra8_vin_lutd_ltydt, k_ra8_vin_lutd_shift_ltcbdt, k_ra8_vin_lutd_shift_ltcrdt, k_ra8_vin_lutd_shift_ltydt, k_ra8_vin_lutp_ltcbpr, k_ra8_vin_lutp_ltcrpr, k_ra8_vin_lutp_ltypr, k_ra8_vin_lutp_shift_ltcbpr, k_ra8_vin_lutp_shift_ltcrpr, k_ra8_vin_lutp_shift_ltypr, k_ra8_vin_mc_lute, k_ra8_vin_off_lutd, k_ra8_vin_off_lutp, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Issue a soft reset by re-running the MC.ST settle sequence.
HUM Ch 67.3.1 p 3995 – writes ME = 0, pulses MC.ST = 1, then absorbs the >= 10 ICLK settling time by reading MC back the configured number of times (k_ra8_vin_st_settle_reads).
| k_ra8_ok | Always. |
Definition at line 330 of file ra8_vin.c.
References internal_pulse_st(), k_ra8_ok, k_ra8_vin_mc_me, k_ra8_vin_off_mc, ra8_log_info, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Programme CSI_IFMD (virtual channel + data type + extension).
| [in] | input | Non-NULL CSI input descriptor. |
| k_ra8_ok | Programmed. |
| k_ra8_err_null_ptr | input was NULL. |
| k_ra8_err_invalid_arg | virtual_channel > 15 or data_type > 0x3F. |
Definition at line 703 of file ra8_vin.c.
References ra8_vin_csi_input_t::data_type, k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_csi_ifmd_des0, k_ra8_vin_csi_ifmd_dt, k_ra8_vin_csi_ifmd_shift_dt, k_ra8_vin_csi_ifmd_shift_vc_sel, k_ra8_vin_csi_ifmd_vc_sel, k_ra8_vin_max_dt, k_ra8_vin_max_vc_sel, k_ra8_vin_off_csi_ifmd, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), s_tag, ra8_vin_csi_input_t::virtual_channel, and ra8_vin_csi_input_t::zero_extend.
|
nodiscard |
Programme the DMR (Data Mode Register).
HUM Ch 67.2.19 p 3992. Composes DTMD / ABIT / BPSM / EXRGB / YC_THR / YMODE / A8BIT into a single 32-bit write.
| [in] | mode | Non-NULL DMR descriptor. |
| k_ra8_ok | Programmed. |
| k_ra8_err_null_ptr | mode was NULL. |
| k_ra8_err_invalid_arg | conv_mode > 2 or y_mode > 3. |
Definition at line 677 of file ra8_vin.c.
References ra8_vin_data_mode_t::alpha_bit, ra8_vin_data_mode_t::alpha_byte, ra8_vin_data_mode_t::byte_swap, ra8_vin_data_mode_t::conv_mode, ra8_vin_data_mode_t::extend_rgb, k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_dmr_a8bit, k_ra8_vin_dmr_abit, k_ra8_vin_dmr_bpsm, k_ra8_vin_dmr_dtmd, k_ra8_vin_dmr_exrgb, k_ra8_vin_dmr_shift_a8bit, k_ra8_vin_dmr_shift_dtmd, k_ra8_vin_dmr_shift_ymode, k_ra8_vin_dmr_yc_thr, k_ra8_vin_dmr_ymode, k_ra8_vin_max_dtmd, k_ra8_vin_max_ymode, k_ra8_vin_off_dmr, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), s_tag, ra8_vin_data_mode_t::y_mode, and ra8_vin_data_mode_t::yc_through.
|
nodiscard |
Configure the dithering mode (MC.DC + MC.DC2).
HUM Ch 67.2.1 p 3975. The DC field picks one of three patterns (ra8_vin_dc_value_t); the DC2 bit reverses the direction of the ordered patterns. Caller is responsible for keeping the input pixel depth large enough for dithering to be meaningful.
| [in] | mode | Dither pattern (ra8_vin_dc_value_t). |
| [in] | direction | True -> DC2 = 1, false -> DC2 = 0. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | mode > 2. |
Definition at line 641 of file ra8_vin.c.
References internal_mc_rmw(), k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_max_dc, k_ra8_vin_mc_dc, k_ra8_vin_mc_dc2, and k_ra8_vin_mc_shift_dc.
|
nodiscard |
Programme CSIFLD (field detection).
| [in] | detect | Non-NULL field-detect descriptor. |
| k_ra8_ok | Programmed. |
| k_ra8_err_null_ptr | detect was NULL. |
| k_ra8_err_invalid_arg | even_field_num > 1. |
Definition at line 720 of file ra8_vin.c.
References ra8_vin_field_detect_t::enable, ra8_vin_field_detect_t::even_field_num, ra8_vin_field_detect_t::even_field_sel, k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_csifld_fld_en, k_ra8_vin_csifld_fld_num, k_ra8_vin_csifld_fld_sel, k_ra8_vin_max_field_no, k_ra8_vin_off_csifld, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Re-programme MB1 / MB2 / MB3 (ping-pong framebuffers).
HUM Ch 67.2.10..67.2.12 p 3985-3987. Lower 7 address bits are forced to zero (64-byte alignment); the function rejects unaligned inputs with k_ra8_err_invalid_arg.
| [in] | mb1 | New MB1 base; ignored if zero. |
| [in] | mb2 | New MB2 base; ignored if zero. |
| [in] | mb3 | New MB3 base; ignored if zero. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | Any non-zero base unaligned. |
Definition at line 741 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_mb_align_mask, k_ra8_vin_off_mb1, k_ra8_vin_off_mb2, k_ra8_vin_off_mb3, and ra8_vin_reg32().
|
nodiscard |
Set the interlace mode (MC.IM).
| [in] | mode | ra8_vin_im_value_t. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | mode > 2. |
Definition at line 667 of file ra8_vin.c.
References internal_mc_rmw(), k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_max_im, k_ra8_vin_mc_im, and k_ra8_vin_mc_shift_im.
|
nodiscard |
Update the IE (Interrupt Enable) mask at runtime.
| [in] | mask | Bitwise OR of ra8_vin_int_mask_t values. |
| k_ra8_ok | Always. |
Definition at line 824 of file ra8_vin.c.
References k_ra8_ok, k_ra8_vin_off_ie, and ra8_vin_reg32().
|
nodiscard |
Programme the pre-clip window (SLPRC / ELPRC / SPPRC / EPPRC).
HUM Ch 67.2.4..67.2.7 p 3980-3981. Defines the rectangle of the input image that survives the pre-clip stage. End values must be >= start values; both sides are clamped to 12 bits (4095 max).
| [in] | window | Non-NULL pre-clip descriptor. |
| k_ra8_ok | Window programmed. |
| k_ra8_err_null_ptr | window was NULL. |
| k_ra8_err_invalid_arg | end < start or value > 4095. |
Definition at line 407 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_off_elprc, k_ra8_vin_off_epprc, k_ra8_vin_off_slprc, k_ra8_vin_off_spprc, k_ra8_vin_preclip_mask, ra8_vin_preclip_t::line_end, ra8_vin_preclip_t::line_start, ra8_vin_preclip_t::pixel_end, ra8_vin_preclip_t::pixel_start, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
Referenced by ra8_vin_set_window().
|
nodiscard |
Programme one row of the RGB -> YC matrix.
HUM Ch 67.2.27..67.2.35 p 4002-4011. The three rows correspond to Y (channel 0), Cb (channel 1), and Cr (channel 2). Each row writes three registers: setting 1 (R), setting 2 (G+B), setting 3 (LAP + LHEN + LSFT).
| [in] | channel | Row index 0 (Y), 1 (Cb), 2 (Cr). |
| [in] | row | Non-NULL coefficient descriptor. |
| k_ra8_ok | Row written. |
| k_ra8_err_null_ptr | row was NULL. |
| k_ra8_err_invalid_arg | channel > 2 or shift_down > 31. |
Definition at line 609 of file ra8_vin.c.
References ra8_vin_rgb_to_yc_chan_t::add_offset, ra8_vin_rgb_to_yc_chan_t::b_coeff, ra8_vin_rgb_to_yc_chan_t::enable_hen, ra8_vin_rgb_to_yc_chan_t::g_coeff, internal_yc_offsets(), k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_max_lsft, k_ra8_vin_off_yccr1, k_ra8_vin_off_yccr2, k_ra8_vin_off_yccr3, k_ra8_vin_yc1_rp, k_ra8_vin_yc2_bp, k_ra8_vin_yc2_gp, k_ra8_vin_yc3_ap, k_ra8_vin_yc3_hen, k_ra8_vin_yc3_sft, k_ra8_vin_yc_chan_max, k_ra8_vin_yccr_shift_bp, k_ra8_vin_yccr_shift_sft, ra8_vin_rgb_to_yc_chan_t::r_coeff, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), s_tag, and ra8_vin_rgb_to_yc_chan_t::shift_down.
|
nodiscard |
Programme the SI (Scanline Interrupt) compare register.
| [in] | line | 12-bit compare value, 0 disables. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | line > 4095. |
Definition at line 831 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_off_si, k_ra8_vin_si_mask, and ra8_vin_reg32().
|
nodiscard |
Programme the UDS output clipping (UDS_CLIP_SIZE).
HUM Ch 67.2.24 p 3999. 12-bit output clipping size for V and H after scaling.
| [in] | v_size | Vertical pixel count (0..4095). |
| [in] | h_size | Horizontal pixel count (0..4095). |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | Value > 4095. |
Definition at line 460 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_off_uds_clip_size, k_ra8_vin_uds_clip_h, k_ra8_vin_uds_clip_shift_h, k_ra8_vin_uds_clip_shift_v, k_ra8_vin_uds_clip_v, k_ra8_vin_uds_max_clip, and ra8_vin_reg32().
|
nodiscard |
Programme UDS interpolation control (UDS_CTRL).
HUM Ch 67.2.21 p 3996. Picks bilinear vs nearest-neighbour per channel, plus the multi-tap mode flag and two advanced-mode tweaks. ra8_vin_enable_scaling toggles the MC.SCLE main enable.
| [in] | ctrl | Non-NULL UDS control descriptor. |
| k_ra8_ok | Programmed. |
| k_ra8_err_null_ptr | ctrl was NULL. |
Definition at line 472 of file ra8_vin.c.
References ra8_vin_uds_ctrl_t::advanced_amd, ra8_vin_uds_ctrl_t::advanced_bl, ra8_vin_uds_ctrl_t::b_cb_nearest, ra8_vin_uds_ctrl_t::g_y_nearest, k_ra8_ok, k_ra8_vin_off_uds_ctrl, k_ra8_vin_uds_ctrl_amd, k_ra8_vin_uds_ctrl_bc, k_ra8_vin_uds_ctrl_bladv, k_ra8_vin_uds_ctrl_ne_bcb, k_ra8_vin_uds_ctrl_ne_gy, k_ra8_vin_uds_ctrl_ne_rcr, ra8_vin_uds_ctrl_t::multitap, ra8_vin_uds_ctrl_t::r_cr_nearest, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), and s_tag.
|
nodiscard |
Programme the UDS pass-band bandwidth (UDS_PASS_BWIDTH).
HUM Ch 67.2.23 p 3998. 7-bit V and H pass-band bandwidth values applied by the multi-tap filter.
| [in] | v_bwidth | Vertical bandwidth (0..127). |
| [in] | h_bwidth | Horizontal bandwidth (0..127). |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | Value > 127. |
Definition at line 448 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_off_uds_pass_bwidth, k_ra8_vin_uds_bwidth_h, k_ra8_vin_uds_bwidth_shift_h, k_ra8_vin_uds_bwidth_shift_v, k_ra8_vin_uds_bwidth_v, k_ra8_vin_uds_max_bw, and ra8_vin_reg32().
|
nodiscard |
Programme the UDS scaling factor (UDS_SCALE).
HUM Ch 67.2.22 p 3997. Set the integer mantissa and 12-bit fraction for both axes; the driver enables MC.SCLE only via ra8_vin_set_uds_ctrl(....multitap = ?,...) plus ra8_vin_enable_scaling(true). UDS_SCALE itself is loaded by ra8_vin_capture_start matching HUM Ch 67.3.5 p 4006.
| [in] | scale | Non-NULL scaling factor descriptor. |
| k_ra8_ok | Scale programmed. |
| k_ra8_err_null_ptr | scale was NULL. |
| k_ra8_err_invalid_arg | Mantissa > 15 or fraction > 4095. |
Definition at line 429 of file ra8_vin.c.
References ra8_vin_uds_scale_t::h_fraction, ra8_vin_uds_scale_t::h_mantissa, k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_off_uds_scale, k_ra8_vin_uds_max_frac, k_ra8_vin_uds_max_mant, k_ra8_vin_uds_scale_hfrac, k_ra8_vin_uds_scale_hmant, k_ra8_vin_uds_scale_shift_hfrac, k_ra8_vin_uds_scale_shift_hmant, k_ra8_vin_uds_scale_shift_vfrac, k_ra8_vin_uds_scale_shift_vmant, k_ra8_vin_uds_scale_vfrac, k_ra8_vin_uds_scale_vmant, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), s_tag, ra8_vin_uds_scale_t::v_fraction, and ra8_vin_uds_scale_t::v_mantissa.
|
nodiscard |
Programme UVAOF (UV plane address offset for YC-separated mode).
| [in] | uv_addr | 64-byte-aligned UV plane base; 0 disables. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | Address not 64-byte aligned. |
Definition at line 765 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_mb_align_mask, k_ra8_vin_off_uvaof, and ra8_vin_reg32().
|
nodiscard |
Programme a region-of-interest pre-clip window.
Wraps ra8_vin_set_preclip with a (x, y, w, h) signature for callers that prefer (x, y) over (start_line, start_pixel). HUM Ch 67.2.4.. 67.2.7 p 3980-3981.
| [in] | x | Top-left pixel index (0..4095). |
| [in] | y | Top-left line index (0..4095). |
| [in] | w | Window width in pixels (>=1). |
| [in] | h | Window height in lines (>=1). |
| k_ra8_ok | Window programmed. |
| k_ra8_err_invalid_arg | Arguments out of range. |
Definition at line 964 of file ra8_vin.c.
References k_ra8_err_invalid_arg, k_ra8_vin_preclip_mask, and ra8_vin_set_preclip().
|
nodiscard |
Programme the YC -> RGB matrix coefficients (CSCE1..4).
HUM Ch 67.2.36..67.2.39 p 4011-4015. Loads the 14-bit Y multiplier, the 12-bit Y / CbCr subtraction terms, and the 14-bit Cr/Cb multiplier pairs.
| [in] | coeffs | Non-NULL coefficient descriptor. |
| k_ra8_ok | Coefficients written. |
| k_ra8_err_null_ptr | coeffs was NULL. |
Definition at line 540 of file ra8_vin.c.
References ra8_vin_yc_to_rgb_t::cb_mul_hi, ra8_vin_yc_to_rgb_t::cb_mul_lo, ra8_vin_yc_to_rgb_t::cbcr_sub, ra8_vin_yc_to_rgb_t::cr_mul_hi, ra8_vin_yc_to_rgb_t::cr_mul_lo, ra8_vin_yc_to_rgb_t::enable_round, k_ra8_ok, k_ra8_vin_csce1_round, k_ra8_vin_csce1_ymul2, k_ra8_vin_csce2_csub2, k_ra8_vin_csce2_shift_ysub2, k_ra8_vin_csce2_ysub2, k_ra8_vin_csce_mul_hi, k_ra8_vin_csce_mul_lo, k_ra8_vin_csce_shift_mul_hi, k_ra8_vin_off_csce1, k_ra8_vin_off_csce2, k_ra8_vin_off_csce3, k_ra8_vin_off_csce4, RA8_CHECK_NULL_PTR, ra8_vin_reg32(), s_tag, ra8_vin_yc_to_rgb_t::y_multiplier, and ra8_vin_yc_to_rgb_t::y_sub.
|
nodiscard |
Configure the YUV-444 conversion mode (MC.YUV444).
HUM Ch 67.2.1 p 3975. Picks data-extend vs interpolate when promoting 4:2:2 input to 4:4:4 internally.
| [in] | mode | ra8_vin_yuv444_value_t. |
| k_ra8_ok | Programmed. |
| k_ra8_err_invalid_arg | mode > 1. |
Definition at line 657 of file ra8_vin.c.
References internal_mc_rmw(), k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_vin_max_yuv444, and k_ra8_vin_mc_yuv444.