ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
c6_camera_server.h File Reference

Shared contracts for ESP32-C6 browser camera servers. More...

#include <stdint.h>
#include "ra8_c6link.h"
#include "ra8_err.h"
Include dependency graph for c6_camera_server.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  c6_cam_lease_t
 DHCP lease returned by the raw, bench-validated C6/NetX path. More...
struct  c6_cam_frame_timing_t
 Per-frame pipeline latency exposed in HTTP Server-Timing headers. More...

Enumerations

enum  c6_cam_cfg_t : uint32_t {
  k_c6_cam_uart_baud = 115200U ,
  k_c6_cam_sck_hz = 10000000U ,
  k_c6_cam_edge_poll_ms = 2U ,
  k_c6_cam_boot_wait_ms = 200U ,
  k_c6_cam_assoc_polls = 200U ,
  k_c6_cam_assoc_gap_ms = 50U ,
  k_c6_cam_dhcp_wait_ms = 25000U ,
  k_c6_cam_worker_stack = 12288U ,
  k_c6_cam_worker_prio = 8U ,
  k_c6_cam_arena_bytes = 4096U ,
  k_c6_cam_http_port = 80U ,
  k_c6_cam_http_chunk = 1400U ,
  k_c6_cam_request_max = 512U ,
  k_c6_cam_tcp_window = 4096U ,
  k_c6_cam_listen_backlog = 1U ,
  k_c6_cam_stream_frames = 1024U ,
  k_c6_cam_net_pkt_payload = 1568U ,
  k_c6_cam_net_pool_bytes = 49152U ,
  k_c6_cam_net_ip_stack = 2048U ,
  k_c6_cam_net_arp_bytes = 1040U ,
  k_c6_cam_net_ip_prio = 3U
}
 Application sizing, pacing and fixed network values. More...

Functions

int32_t c6_cam_app_run (void)
 Run the shared runtime-provisioned C6, DHCP, and HTTP application flow.
ra8_err_t c6_cam_camera_init (void)
 Camera image and board-switch initialization, then one CEU capture.
ra8_err_t c6_cam_camera_capture_jpeg (const uint8_t **out_jpeg, uint32_t *out_bytes, c6_cam_frame_timing_t *out_timing)
const char * c6_cam_camera_description (void)
 Human-readable description of the selected camera backend.
void c6_cam_camera_report_last_error (void)
 Emit backend-specific diagnostics for the last capture failure.
ra8_err_t c6_cam_audio_start (void)
 Start continuous MIC1 capture into the SDRAM audio ring.
ra8_err_t c6_cam_audio_snapshot_wav (const uint8_t **out_wav, uint32_t *out_bytes, uint32_t *out_timestamp_ms)
 Snapshot the rolling microphone ring as mono PCM-S16LE WAV.
ra8_err_t c6_cam_net_up (ra8_c6link_t *link, const ra8_c6link_mac_t *mac, c6_cam_lease_t *out)
 Bind NetX to an associated raw C6 link and obtain a DHCP lease.
void c6_cam_http_serve (void)
 Serve the browser UI and fresh JPEG frames forever.
void c6_cam_puts (const char *text)
 Write a bounded NUL-terminated string to SCI8.
void c6_cam_put_u32 (uint32_t value)
 Write one unsigned decimal value to SCI8.
void c6_cam_put_ip (uint32_t ip)
 Write one IPv4 address to SCI8.

Detailed Description

Shared contracts for ESP32-C6 browser camera servers.

Defines the heap-free camera, audio, console, and HTTP seams shared by the validated livestream and hardware-JPEG applications.

Tag
[Ring 6 / APP] {World: S}
Since
0.1.0

Definition in file c6_camera_server.h.

Enumeration Type Documentation

◆ c6_cam_cfg_t

enum c6_cam_cfg_t : uint32_t

Application sizing, pacing and fixed network values.

Enumerator
k_c6_cam_uart_baud 

Diagnostic console baud rate.

k_c6_cam_sck_hz 

Camera-stream ESP-hosted SPI rate.

k_c6_cam_edge_poll_ms 

C6 interrupt-edge poll period.

k_c6_cam_boot_wait_ms 

C6 boot stabilization delay.

k_c6_cam_assoc_polls 

Maximum association status polls.

k_c6_cam_assoc_gap_ms 

Delay between association polls.

k_c6_cam_dhcp_wait_ms 

DHCP lease timeout.

k_c6_cam_worker_stack 

Worker thread stack bytes.

k_c6_cam_worker_prio 

ThreadX worker priority.

k_c6_cam_arena_bytes 

C6-link caller-owned arena size.

k_c6_cam_http_port 

Browser server TCP port.

k_c6_cam_http_chunk 

Maximum HTTP send chunk.

k_c6_cam_request_max 

Maximum parsed request bytes.

k_c6_cam_tcp_window 

HTTP socket receive window.

k_c6_cam_listen_backlog 

Single-client listen backlog.

k_c6_cam_stream_frames 

Frames served before client reconnect.

k_c6_cam_net_pkt_payload 

NetX packet payload bytes.

k_c6_cam_net_pool_bytes 

NetX packet pool bytes.

k_c6_cam_net_ip_stack 

NetX IP thread stack bytes.

k_c6_cam_net_arp_bytes 

NetX ARP cache bytes.

k_c6_cam_net_ip_prio 

NetX IP thread priority.

Definition at line 23 of file c6_camera_server.h.

Function Documentation

◆ c6_cam_app_run()

int32_t c6_cam_app_run ( void )
nodiscard

Run the shared runtime-provisioned C6, DHCP, and HTTP application flow.

Definition at line 498 of file c6_cam_app.c.

References c6_cam_puts(), internal_c6_cam_halt(), internal_c6_cam_setup_or_halt(), and ra8_isr_globals_enable().

Referenced by main().

◆ c6_cam_audio_snapshot_wav()

ra8_err_t c6_cam_audio_snapshot_wav ( const uint8_t ** out_wav,
uint32_t * out_bytes,
uint32_t * out_timestamp_ms )
nodiscard

◆ c6_cam_audio_start()

◆ c6_cam_camera_capture_jpeg()

◆ c6_cam_camera_description()

const char * c6_cam_camera_description ( void )
nodiscard

Human-readable description of the selected camera backend.

Definition at line 234 of file c6_cam_camera.c.

Referenced by internal_c6_cam_prepare_camera().

◆ c6_cam_camera_init()

◆ c6_cam_camera_report_last_error()

void c6_cam_camera_report_last_error ( void )

Emit backend-specific diagnostics for the last capture failure.

Writes retained sensor or CEU status through the shared bounded console helpers.

Precondition
The board console is initialized.
A camera capture was attempted or the backend has reset diagnostics.
Postcondition
A backend-specific diagnostic line is queued.
Camera and capture state remain unchanged.
Note
Intended for failure paths; output content depends on the selected backend.
Since
0.1.0

Definition at line 239 of file c6_cam_camera.c.

References c6_cam_put_u32(), c6_cam_puts(), internal_report_capture_events(), internal_report_jpeg_status_detail(), internal_report_sccb_state(), internal_report_sensor_registers(), k_ra8_ok, ra8_camera_source_ceu_get_last_events(), ra8_err_to_str(), s_camera_initialized, s_last_jpeg_status_err, and s_source_state.

Referenced by internal_c6_cam_http_frame(), internal_c6_cam_http_stream(), and internal_c6_cam_prepare_camera().

◆ c6_cam_http_serve()

void c6_cam_http_serve ( void )

Serve the browser UI and fresh JPEG frames forever.

Definition at line 550 of file c6_cam_net.c.

References c6_cam_puts(), internal_c6_cam_http_handle(), k_c6_cam_http_port, k_c6_cam_listen_backlog, k_c6_cam_tcp_window, s_http_socket, s_ip, s_socket_name, and tx_thread_sleep.

Referenced by internal_c6_cam_worker_entry().

◆ c6_cam_net_up()

◆ c6_cam_put_ip()

void c6_cam_put_ip ( uint32_t ip)

Write one IPv4 address to SCI8.

Formats the network-order address as four dotted decimal octets.

Parameters
[in]ipIPv4 address in the representation used by the C6/NetX path.
Precondition
The board console is initialized.
The address value came from a C6 or NetX network structure.
Postcondition
Four decimal octets and three separators are queued.
The address value remains unchanged.
Note
This helper emits no trailing whitespace or newline.
Since
0.1.0

Definition at line 60 of file c6_cam_console.c.

References c6_cam_put_u32(), c6_cam_puts(), k_c6_cam_ipv4_high_shift, and k_c6_cam_ipv4_octet_mask.

Referenced by internal_c6_cam_worker_entry().

◆ c6_cam_put_u32()

void c6_cam_put_u32 ( uint32_t value)

Write one unsigned decimal value to SCI8.

Formats the value into fixed stack storage without libc allocation.

Parameters
[in]valueValue to emit.
Precondition
The board console is initialized.
Fixed helper stack storage is available.
Postcondition
The decimal representation is queued for transmission.
No application state except console output is modified.
Note
The full uint32_t range is supported.
Since
0.1.0

Definition at line 44 of file c6_cam_console.c.

References k_c6_cam_decimal_digits, and ra8_board_uart_console_write().

Referenced by c6_cam_camera_report_last_error(), c6_cam_put_ip(), internal_c6_cam_associate(), internal_c6_cam_http_audio(), internal_c6_cam_http_frame(), internal_c6_cam_http_stream(), internal_c6_cam_prepare_camera(), internal_c6_cam_prepare_link(), internal_report_capture_events(), internal_report_jpeg_status_detail(), internal_report_sccb_state(), and sensor_report_register().

◆ c6_cam_puts()

void c6_cam_puts ( const char * text)

Write a bounded NUL-terminated string to SCI8.

Measures at most the helper's fixed string bound before one board-console write.

Parameters
[in]textNUL-terminated text to emit.
Precondition
text is nonnull and terminated within the fixed bound.
The board console is initialized.
Postcondition
The bounded text bytes are queued for transmission.
Caller-owned text remains unchanged.
Note
Console write failures are intentionally ignored by this diagnostic helper.
Since
0.1.0

Definition at line 32 of file c6_cam_console.c.

References k_c6_cam_console_text_max, and ra8_board_uart_console_write().

Referenced by c6_cam_app_run(), c6_cam_camera_report_last_error(), c6_cam_http_serve(), c6_cam_put_ip(), internal_c6_cam_associate(), internal_c6_cam_http_audio(), internal_c6_cam_http_frame(), internal_c6_cam_http_stream(), internal_c6_cam_join(), internal_c6_cam_prepare_camera(), internal_c6_cam_prepare_link(), internal_c6_cam_prepare_media(), internal_c6_cam_report_fault(), internal_c6_cam_setup_or_halt(), internal_c6_cam_worker_entry(), internal_report_capture_events(), internal_report_jpeg_status_detail(), internal_report_sccb_state(), sensor_report_register(), and tx_application_define().