|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
GPIO activity diagnostic for the J35 parallel DVP camera signals. More...
#include "cam_ceu.h"#include <stdint.h>#include "ra8_check.h"#include "ra8_err.h"#include "ra8_port_regs.h"#include "ra8_port_utils.h"#include "ra8_systick.h"Go to the source code of this file.
Data Structures | |
| struct | cam_ceu_pin_t |
| One CEU DVP pin: MCU port/pin routed to the CEU peripheral. More... | |
| struct | cam_probe_ports_t |
| GPIO register banks used while sampling the parallel camera bus. More... | |
| struct | cam_sync_state_t |
| Accumulator for the bounded sync/data sampling pass. More... | |
Enumerations | |
| enum | cam_ceu_poll_t : uint32_t { k_cam_sync_samples = 2000000U , k_cam_data_d2_pin_bit = 5U , k_cam_data_d5_out_bit = 5U , k_cam_data_d7_out_bit = 7U , k_cam_long_line_pclk = 1024U } |
| Bounded GPIO signal-activity sampling constants. More... | |
Functions | |
| static void | cam_release_probe_pins (uint32_t count) |
| Release a bounded prefix of the temporary camera GPIO claims. | |
| static ra8_err_t | cam_claim_probe_pins (void) |
| Claim every parallel-camera pin as a temporary GPIO input. | |
| static ra8_err_t | cam_get_probe_ports (cam_probe_ports_t *ports) |
| Resolve the four register banks that carry the camera signals. | |
| static uint8_t | cam_read_probe_data (const cam_probe_ports_t *ports) |
| Reconstruct VIO_D[7:0] from the three GPIO input banks. | |
| static uint32_t | cam_read_probe_sync (const cam_probe_ports_t *ports, uint32_t sync_mask) |
| Read and mask the three camera sync signals from PORT11. | |
| static void | cam_sync_state_init (cam_sync_state_t *state, uint32_t prior) |
| Initialize sync-sampling state from the first masked sample. | |
| static void | cam_record_probe_data (cam_sync_state_t *state, cam_ceu_sync_probe_t *probe, uint8_t data) |
| Fold one active-line camera byte into the probe statistics. | |
| static void | cam_record_sync_sample (const cam_probe_ports_t *ports, uint32_t current, cam_sync_state_t *state, cam_ceu_sync_probe_t *probe) |
| Fold one masked sync sample into edge, timing, and data statistics. | |
| static void | cam_measure_sync (const cam_probe_ports_t *ports, uint32_t sync_mask, cam_ceu_sync_probe_t *probe) |
| Run the bounded sync/data sampling pass and finalize its statistics. | |
| static void | cam_measure_lines (const cam_probe_ports_t *ports, uint32_t sync_mask, cam_ceu_sync_probe_t *probe) |
| Measure active-line PCLK counts with three bounded sampling loops. | |
| ra8_err_t | cam_probe_sync_activity (cam_ceu_sync_probe_t *out_probe) |
| Measure DVP sync, clock, and data activity before CEU routing. | |
Variables | |
| static const cam_ceu_pin_t | s_ceu_pins [] |
| The 11 EK-RA8D2 J35 parallel-camera pins that feed the CEU: VIO_D[7:0], VIO_VD, VIO_HD, VIO_CLK (EK-RA8D2 UM Table 35 p 48). | |
GPIO activity diagnostic for the J35 parallel DVP camera signals.
Owns only the 11-entry GPIO pin map and bounded signal-activity sampler used by the HIL diagnostics. The reusable ra8_camera_source_ceu backend owns CEU dispatch while the application supplies its state and DMA buffer.
Definition in file cam_ceu.c.
| enum cam_ceu_poll_t : uint32_t |
Bounded GPIO signal-activity sampling constants.
|
static |
Claim every parallel-camera pin as a temporary GPIO input.
| k_ra8_ok | Every camera pin is configured as an input. |
| k_ra8_err_gpio_conflict | A pin could not be claimed. |
Definition at line 128 of file cam_ceu.c.
References cam_release_probe_pins(), k_ra8_err_gpio_conflict, k_ra8_ok, k_ra8_pull_none, pin, ra8_gpio_input_init(), RA8_PIN, and s_ceu_pins.
Referenced by cam_probe_sync_activity().
|
static |
Resolve the four register banks that carry the camera signals.
| [out] | ports | Receives non-NULL register-bank pointers. |
| k_ra8_ok | Every required bank is addressable. |
| k_ra8_err_hw_error | A required bank is unavailable. |
| k_ra8_err_null_ptr | ports was NULL. |
Definition at line 157 of file cam_ceu.c.
References k_ra8_err_hw_error, k_ra8_ok, k_ra8_port_11, k_ra8_port_4, k_ra8_port_7, k_ra8_port_9, cam_probe_ports_t::port11, cam_probe_ports_t::port4, cam_probe_ports_t::port7, cam_probe_ports_t::port9, RA8_CHECK_NULL_PTR, and ra8_port().
Referenced by cam_probe_sync_activity().
|
static |
Measure active-line PCLK counts with three bounded sampling loops.
| [in] | ports | Resolved camera GPIO banks. |
| [in] | sync_mask | Mask covering VSYNC, HSYNC, and PCLK. |
| [in,out] | probe | Probe result to populate. |
Definition at line 381 of file cam_ceu.c.
References cam_read_probe_sync(), k_cam_long_line_pclk, k_cam_sync_samples, k_ra8_pin_3, k_ra8_pin_4, cam_ceu_sync_probe_t::line_pclk_long, cam_ceu_sync_probe_t::line_pclk_max, cam_ceu_sync_probe_t::line_pclk_mean, cam_ceu_sync_probe_t::line_pclk_min, and cam_ceu_sync_probe_t::measured_lines.
Referenced by cam_probe_sync_activity().
|
static |
Run the bounded sync/data sampling pass and finalize its statistics.
| [in] | ports | Resolved camera GPIO banks. |
| [in] | sync_mask | Mask covering VSYNC, HSYNC, and PCLK. |
| [in,out] | probe | Probe result to populate. |
Definition at line 345 of file cam_ceu.c.
References cam_read_probe_sync(), cam_record_sync_sample(), cam_sync_state_init(), cam_ceu_sync_probe_t::data_and, cam_sync_state_t::data_and, cam_ceu_sync_probe_t::data_max, cam_sync_state_t::data_max, cam_ceu_sync_probe_t::data_min, cam_sync_state_t::data_min, cam_ceu_sync_probe_t::data_or, cam_sync_state_t::data_or, cam_ceu_sync_probe_t::data_samples, cam_sync_state_t::high_cycles_max, cam_sync_state_t::high_cycles_min, cam_sync_state_t::high_max, cam_sync_state_t::high_min, cam_ceu_sync_probe_t::hsync_high_cycles_max, cam_ceu_sync_probe_t::hsync_high_cycles_min, cam_ceu_sync_probe_t::hsync_high_max, cam_ceu_sync_probe_t::hsync_high_min, cam_ceu_sync_probe_t::hsync_low_max, cam_ceu_sync_probe_t::hsync_low_min, k_cam_sync_samples, cam_sync_state_t::low_max, cam_sync_state_t::low_min, and cam_ceu_sync_probe_t::pclk_half_cycles_min.
Referenced by cam_probe_sync_activity().
| ra8_err_t cam_probe_sync_activity | ( | cam_ceu_sync_probe_t * | out_probe | ) |
Measure DVP sync, clock, and data activity before CEU routing.
Temporarily samples the camera connector as GPIO to characterize live sensor timing before the CEU peripheral claims the pins.
| [out] | out_probe | Receives observed sync transition counts. |
| k_ra8_ok | Sampling completed and populated out_probe. |
| k_ra8_err_null_ptr | out_probe was null. |
Definition at line 420 of file cam_ceu.c.
References cam_claim_probe_pins(), cam_get_probe_ports(), cam_measure_lines(), cam_measure_sync(), cam_release_probe_pins(), k_ra8_ok, k_ra8_pin_2, k_ra8_pin_3, k_ra8_pin_4, RA8_CHECK_NULL_PTR, and s_ceu_pins.
Referenced by cam_prepare_capture().
|
inlinestatic |
Reconstruct VIO_D[7:0] from the three GPIO input banks.
| [in] | ports | Resolved camera GPIO banks. |
Definition at line 186 of file cam_ceu.c.
References k_cam_data_d2_pin_bit, k_cam_data_d5_out_bit, k_cam_data_d7_out_bit, r_port_regs_t::PCNTR2, cam_probe_ports_t::port4, cam_probe_ports_t::port7, and cam_probe_ports_t::port9.
Referenced by cam_record_sync_sample().
|
inlinestatic |
Read and mask the three camera sync signals from PORT11.
| [in] | ports | Resolved camera GPIO banks. |
| [in] | sync_mask | Mask covering VSYNC, HSYNC, and PCLK. |
Definition at line 212 of file cam_ceu.c.
References r_port_regs_t::PCNTR2, and cam_probe_ports_t::port11.
Referenced by cam_measure_lines(), and cam_measure_sync().
|
inlinestatic |
Fold one active-line camera byte into the probe statistics.
| [in,out] | state | Sync/data accumulator. |
| [in,out] | probe | Public probe result being accumulated. |
| [in] | data | Newly sampled camera byte. |
Definition at line 262 of file cam_ceu.c.
References cam_sync_state_t::data_and, cam_ceu_sync_probe_t::data_changes, cam_sync_state_t::data_max, cam_sync_state_t::data_min, cam_sync_state_t::data_or, cam_ceu_sync_probe_t::data_samples, and cam_sync_state_t::prior_data.
Referenced by cam_record_sync_sample().
|
inlinestatic |
Fold one masked sync sample into edge, timing, and data statistics.
| [in] | ports | Resolved camera GPIO banks. |
| [in] | current | Current masked VSYNC/HSYNC/PCLK sample. |
| [in,out] | state | Private sampling state. |
| [in,out] | probe | Public probe result being accumulated. |
Definition at line 289 of file cam_ceu.c.
References cam_read_probe_data(), cam_record_probe_data(), cam_sync_state_t::high_cycles_max, cam_sync_state_t::high_cycles_min, cam_sync_state_t::high_max, cam_sync_state_t::high_min, cam_ceu_sync_probe_t::hsync_edges, k_ra8_pin_2, k_ra8_pin_3, k_ra8_pin_4, cam_sync_state_t::low_max, cam_sync_state_t::low_min, cam_ceu_sync_probe_t::pclk_edges, cam_ceu_sync_probe_t::pclk_half_cycles_min, cam_sync_state_t::prior, cam_sync_state_t::prior_pclk_cycles, ra8_dwt_cyccnt_read(), cam_sync_state_t::run_samples, cam_sync_state_t::run_start_cycles, and cam_ceu_sync_probe_t::vsync_edges.
Referenced by cam_measure_sync().
|
static |
Release a bounded prefix of the temporary camera GPIO claims.
| [in] | count | Number of entries in s_ceu_pins to release. |
Definition at line 106 of file cam_ceu.c.
References pin, ra8_gpio_release(), RA8_PIN, and s_ceu_pins.
Referenced by cam_claim_probe_pins(), and cam_probe_sync_activity().
|
static |
Initialize sync-sampling state from the first masked sample.
| [out] | state | State accumulator to initialize. |
| [in] | prior | First masked sync sample. |
Definition at line 231 of file cam_ceu.c.
References ra8_dwt_cyccnt_read().
Referenced by cam_measure_sync().
|
static |
The 11 EK-RA8D2 J35 parallel-camera pins that feed the CEU: VIO_D[7:0], VIO_VD, VIO_HD, VIO_CLK (EK-RA8D2 UM Table 35 p 48).
Definition at line 81 of file cam_ceu.c.
Referenced by cam_claim_probe_pins(), cam_probe_sync_activity(), and cam_release_probe_pins().