27typedef enum : uint32_t {
35typedef enum : uint16_t {
41typedef enum : uint16_t {
55typedef enum : uint8_t {
62typedef enum : uint8_t {
173 .bytes_per_pixel = 1U,
183 .byte_swap = {.swap_8_bit =
true, .swap_16_bit =
true, .swap_32_bit =
true},
260 uint16_t chip_id = 0U;
333 for (uint32_t i = 1U; i < bytes; i += 1U) {
346 if ((out_jpeg ==
nullptr) || (out_bytes ==
nullptr) || (out_timing ==
nullptr)) {
356 .capacity = (uint32_t)
sizeof(
s_jpeg),
374 if (jpeg_bytes == 0U) {
377 frame.
bytes = jpeg_bytes;
384 *out_jpeg = jpeg.
data;
385 *out_bytes = jpeg.
bytes;
391 return "frame=640x480 sensor-JPEG CEU data-enable backend";
489 uint32_t events = 0U;
static ra8_camera_codec_t s_codec
ra8_err_t c6_cam_camera_init(void)
Camera image and board-switch initialization, then one CEU capture.
static uint8_t s_jpeg[k_sw_cam_jpeg_bytes]
ra8_err_t c6_cam_camera_capture_jpeg(const uint8_t **out_jpeg, uint32_t *out_bytes, c6_cam_frame_timing_t *out_timing)
static ra8_camera_source_ceu_state_t s_source_state
void c6_cam_camera_report_last_error(void)
Emit backend-specific diagnostics for the last capture failure.
const char * c6_cam_camera_description(void)
Human-readable description of the selected camera backend.
static sccb_operation_t s_last_sccb_op
static uint32_t jpeg_trim_to_eoi(const uint8_t *jpeg, uint32_t bytes)
Locate the first complete JPEG payload in a captured span.
static ra8_ov5640_jpeg_status_t s_last_jpeg_status
static void internal_report_sensor_registers(void)
Report the OV5640 clock and stream registers when the sensor bound.
static ra8_err_t sensor_sccb_read(void *ctx, uint8_t address, uint16_t reg, uint8_t *out_value)
Forward one SCCB read while retaining bounded failure diagnostics.
@ k_jpeg_marker_soi
JPEG start-of-image marker byte.
@ k_jpeg_marker_prefix
JPEG marker prefix byte.
@ k_jpeg_marker_eoi
JPEG end-of-image marker byte.
static ra8_err_t s_last_sccb_err
static ra8_camera_source_ceu_cfg_t sensor_ceu_config(void)
Build the CEU configuration for bounded hardware JPEG capture.
@ k_sensor_jpeg_poll_tries
CEU completion poll limit.
@ k_sensor_jpeg_buffer_bytes
Maximum gated frame span.
@ k_sensor_jpeg_poll_ms
CEU completion poll period.
@ k_sensor_jpeg_xclk_hz
OV5640 input clock.
@ k_sensor_jpeg_settle_ms
Sensor routing settle delay.
sccb_operation_t
Last SCCB operation retained for initialization diagnostics.
@ k_sccb_op_write
Last transfer was a write.
@ k_sccb_op_read
Last transfer was a read.
@ k_sccb_op_none
No SCCB transfer has run.
@ k_sensor_jpeg_height
Encoded sensor JPEG height.
@ k_sensor_jpeg_width
Encoded sensor JPEG width.
static void sensor_report_register(const char *label, uint16_t reg)
Emit one named OV5640 register value when it remains readable.
static ra8_err_t internal_bring_up_capture_pipeline(void)
Route the parallel capture pins and bind the CEU source and codec.
static void internal_report_capture_events(void)
Report the CEU event mask observed by the most recent capture.
static void internal_report_sccb_state(void)
Report the most recent SCCB transfer direction, register, and result.
static ra8_err_t s_last_jpeg_status_err
static void internal_reset_camera_diagnostics(void)
Reset every camera diagnostic and lifecycle flag to its cold state.
static bool s_sensor_streaming
static ra8_err_t sensor_sccb_write(void *ctx, uint8_t address, uint16_t reg, uint8_t value)
Forward one SCCB write while retaining bounded failure diagnostics.
static uint16_t s_last_sccb_reg
static ra8_err_t internal_bring_up_sensor(void)
Bring the OV5640 sensor up to streaming hardware-JPEG mode.
static void internal_report_jpeg_status_detail(void)
Report the OV5640 hardware-JPEG status block from the last capture.
sensor_diagnostic_register_t
OV5640 clock and stream registers emitted on initialization failure.
@ k_sensor_reg_pll_ctrl3
PLL pre-divider.
@ k_sensor_reg_system_reset02
JPEG reset control.
@ k_sensor_reg_pll_ctrl2
PLL multiplier.
@ k_sensor_reg_system_ctrl0
Software stream state.
@ k_sensor_reg_pll_ctrl1
PLL system divider.
@ k_sensor_reg_system_reset00
Internal MCU reset control.
@ k_sensor_reg_clock_root
PCLK/SCLK root dividers.
@ k_sensor_reg_pll_ctrl0
PLL bit-mode control.
@ k_sensor_reg_clock_enable02
JPEG clock enables.
@ k_sensor_reg_pclk_divider
DVP pixel-clock divider.
@ k_sensor_reg_system_root
System-clock source.
static bool s_camera_initialized
static ra8_err_t sensor_bind(void)
Bind the hardware-JPEG sensor instance to board SCCB callbacks.
static bool s_sensor_bound
static ra8_ov5640_t s_sensor
Shared contracts for ESP32-C6 browser camera servers.
void c6_cam_put_u32(uint32_t value)
Write one unsigned decimal value to SCI8.
void c6_cam_puts(const char *text)
Write a bounded NUL-terminated string to SCI8.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_camera_reset(void)
Pulse the J35 camera reset input and leave the sensor released.
ra8_err_t ra8_board_camera_sccb_write_reg(void *ctx, uint8_t address, uint16_t reg, uint8_t value)
Write one 16-bit-addressed SCCB register on the J35 camera bus.
ra8_err_t ra8_board_camera_sccb_read_reg(void *ctx, uint8_t address, uint16_t reg, uint8_t *out_value)
Read one 16-bit-addressed SCCB register on the J35 camera bus.
ra8_err_t ra8_board_camera_xclk_start(uint32_t frequency_hz)
Start the J35 camera sensor input clock (XCLK) on P501/GTIOC12A.
ra8_err_t ra8_board_camera_route_parallel_pins(void)
Route J35 D[7:0], VSYNC, HSYNC and PCLK to the CEU peripheral.
ra8_err_t ra8_board_camera_select_parallel(void)
Drive only SW4-6 ON through U15, selecting J35 parallel DVP.
void ra8_board_camera_delay_ms(void *ctx, uint32_t milliseconds)
Millisecond delay adapter for transport-independent camera drivers.
Transport-neutral camera source and image-codec facade.
@ k_ra8_camera_format_jpeg
Complete encoded JPEG byte stream.
ra8_err_t ra8_camera_source_capture(ra8_camera_source_t *source, const ra8_camera_buffer_t *buffer, ra8_camera_frame_t *out_frame)
Capture one frame into a caller-owned buffer.
ra8_err_t ra8_camera_codec_encode(ra8_camera_codec_t *codec, const ra8_camera_frame_t *input, const ra8_camera_buffer_t *output_buffer, ra8_camera_frame_t *out_frame)
Encode or transform one frame through a bound codec.
Zero-copy JPEG passthrough codec backend.
ra8_err_t ra8_camera_codec_passthrough_init(ra8_camera_codec_t *codec)
Bind the zero-copy JPEG passthrough codec.
RA8 CEU capture backend for the transport-neutral camera facade.
ra8_err_t ra8_camera_source_ceu_get_last_events(const ra8_camera_source_ceu_state_t *state, uint32_t *out_events)
Read the most recent CEU event snapshot retained by the backend.
ra8_err_t ra8_camera_source_ceu_init(ra8_camera_source_t *source, ra8_camera_source_ceu_state_t *state, const ra8_camera_source_ceu_cfg_t *cfg)
Initialize the CEU and bind it as a generic camera source.
Capture Engine Unit (CEU) camera-capture driver.
@ k_ra8_ceu_input_cb0_y0_cr0_y1
Cb0 Y0 Cr0 Y1.
@ k_ra8_ceu_burst_256
256-byte bus bursts.
@ k_ra8_ceu_capture_single
CE auto-clears after CPE.
@ k_ra8_ceu_fmt_data_enable
JPEG / data-enable fetch.
@ k_ra8_ceu_field_immediate
Capture starts at next VD.
@ k_ra8_ceu_pol_high_active
Sync signal is active high.
@ k_ra8_ceu_bus_8_bit
VIO_D[7:0] used.
@ k_ra8_ceu_edge_rising
Sample on rising VIO_CLK edge.
@ k_ra8_ceu_output_ycbcr_422
Pass-through (no conversion).
@ k_ra8_err_hw_init_failed
Hardware peripheral failed to initialise.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
const char * ra8_err_to_str(ra8_err_t err)
Human-readable string for an error code.
Transport-independent OmniVision OV5640 sensor driver.
ra8_err_t ra8_ov5640_read_reg(ra8_ov5640_t *dev, uint16_t reg, uint8_t *out_value)
Read one sensor register through the bound transport.
@ k_ra8_ov5640_chip_id
Expected combined chip identifier.
ra8_err_t ra8_ov5640_stream_set(ra8_ov5640_t *dev, bool enabled)
Enter software standby or resume sensor streaming.
ra8_err_t ra8_ov5640_configure(ra8_ov5640_t *dev, ra8_ov5640_mode_t mode)
Software-reset and program one validated output mode.
ra8_err_t ra8_ov5640_jpeg_status_get(ra8_ov5640_t *dev, ra8_ov5640_jpeg_status_t *out_status)
Snapshot sensor JPEG length, overflow, and routing controls.
ra8_err_t ra8_ov5640_probe(ra8_ov5640_t *dev, uint16_t *out_id)
Probe both legal SCCB addresses and verify chip ID 0x5640.
@ k_ra8_ov5640_mode_vga_jpeg
Sensor-encoded VGA JPEG stream.
ra8_err_t ra8_ov5640_init(ra8_ov5640_t *dev, const ra8_ov5640_bus_t *bus)
Bind a caller-supplied SCCB transport without touching the sensor.
SysTick-based tick counter, delay and timestamp helpers.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
uint32_t ra8_time_ms(void)
Get the current 1 kHz tick count.
Per-frame pipeline latency exposed in HTTP Server-Timing headers.
uint32_t timestamp_ms
Capture-start monotonic timestamp.
uint32_t capture_ms
Camera capture latency.
Caller-owned writable byte-buffer description.
Caller-owned handle binding one image codec and its context.
Immutable view of one captured or encoded image.
const uint8_t * data
Borrowed immutable image bytes.
uint32_t bytes
Valid bytes beginning at data.
Backend configuration, including native CEU register descriptor.
Caller-owned CEU source state.
Caller-owned handle binding one source backend and its context.
Full configuration descriptor for ra8_ceu_init.
Injected SCCB and time services.
Snapshot of the OV5640 JPEG pipeline and its most recent frame.
Caller-owned sensor instance; supports multiple independent parts.