|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared C6 camera-stream application workflow. More...
#include <stdint.h>#include "c6_camera_server.h"#include "nx_ether_driver_c6.h"#include "ra8_attributes.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_c6link.h"#include "ra8_c6link_wifi.h"#include "ra8_err.h"#include "ra8_esp_hosted_c6link.h"#include "ra8_esp_hosted_port.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_net_provision.h"#include "ra8_sdramc.h"#include "ra8_secure.h"#include "ra8_time.h"#include "tx_api.h"Go to the source code of this file.
Functions | |
| static void | internal_c6_cam_halt (void) |
| Park the application after a terminal failure. | |
| static void | internal_c6_cam_setup_or_halt (void) |
| Initialize shared clocks, services, and the diagnostic console. | |
| static void | internal_c6_cam_on_event (void *ctx, const ra8_c6link_event_t *event) |
| Latch station connection events from the C6 link. | |
| static void | internal_c6_cam_report_fault (const char *stage, ra8_err_t err) |
| Emit one standardized application failure line. | |
| static ra8_err_t | internal_c6_cam_open_link (void) |
| Bind and open the raw ESP-hosted C6 link. | |
| static bool | internal_c6_cam_wait_connected (void) |
| Poll for a station association result. | |
| static bool | internal_c6_cam_prepare_link (void) |
| Open the C6 link and await firmware readiness. | |
| static bool | internal_c6_cam_associate (ra8_c6link_mac_t *mac, const ra8_net_credentials_t *credentials) |
| Start station mode and associate with the configured AP. | |
| static bool | internal_c6_cam_join (c6_cam_lease_t *lease, const ra8_net_credentials_t *credentials) |
| Join configured Wi-Fi and acquire a DHCP lease. | |
| static bool | internal_c6_cam_prepare_camera (void) |
| Initialize the camera backend and prove one startup JPEG capture. | |
| static bool | internal_c6_cam_prepare_media (void) |
| Initialize and self-test the audio and camera backends. | |
| static void | internal_c6_cam_worker_entry (ULONG input) |
| Run the network, audio, camera, and HTTP worker workflow. | |
| void | tx_application_define (void *first_unused_memory) |
| int32_t | c6_cam_app_run (void) |
| Run the shared runtime-provisioned C6, DHCP, and HTTP application flow. | |
Variables | |
| static uint32_t | s_cpuclk_hz |
| static uint32_t | s_pclka_hz |
| static ra8_err_t | s_port_err = k_ra8_err_not_initialized |
| static TX_THREAD | s_worker |
| static CHAR | s_worker_name [] = "c6_cam_stream" |
| static UCHAR | s_worker_stack [k_c6_cam_worker_stack] |
| static uint8_t | s_arena [k_c6_cam_arena_bytes] |
| static ra8_c6link_t | s_link |
| static volatile uint32_t | s_events |
| static volatile uint8_t | s_connected |
| static volatile uint8_t | s_disconnected |
| static volatile uint16_t | s_disconnect_reason |
| static const ra8_net_provision_uart_t | s_provision_uart |
| Board-console binding for the shared runtime provisioner. | |
Shared C6 camera-stream application workflow.
Initializes external SDRAM for camera storage, joins Wi-Fi through the bench-validated raw ra8_c6link sequence, obtains a NetX DHCP lease, then serves the selected camera backend on TCP port 80. Each camera example supplies its own local main.c and camera backend while reusing this flow.
Definition in file c6_cam_app.c.
|
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().
|
static |
Start station mode and associate with the configured AP.
Starts Wi-Fi, reads the station MAC, applies the supplied runtime credentials, joins, and waits for the association result.
| [out] | mac | Destination for the bound station MAC address. |
| [in] | credentials | Validated runtime credential record. |
| true | Wi-Fi control and association completed. |
| false | Credentials, control, or association failed. |
Definition at line 266 of file c6_cam_app.c.
References c6_cam_put_u32(), c6_cam_puts(), internal_c6_cam_report_fault(), internal_c6_cam_wait_connected(), k_ra8_ok, ra8_net_credentials::psk, ra8_c6link_sta_cfg_set(), ra8_c6link_wifi_join(), ra8_c6link_wifi_mac(), ra8_c6link_wifi_start(), RA8_INTERNAL, ra8_secure_memzero(), s_connected, s_disconnect_reason, s_disconnected, s_events, s_link, and ra8_net_credentials::ssid.
Referenced by internal_c6_cam_join().
|
static |
Park the application after a terminal failure.
Repeatedly waits for interrupt and never returns to the failed workflow.
Definition at line 66 of file c6_cam_app.c.
References RA8_INTERNAL.
Referenced by c6_cam_app_run(), internal_c6_cam_setup_or_halt(), and internal_c6_cam_worker_entry().
|
static |
Join configured Wi-Fi and acquire a DHCP lease.
Associates with the configured AP, then binds NetX to the link.
| [out] | lease | Destination for the bound network lease. |
| [in] | credentials | Validated runtime credential record. |
| true | Association and DHCP completed with a bound lease. |
| false | Credentials, control, association, or DHCP failed. |
Definition at line 324 of file c6_cam_app.c.
References c6_cam_lease_t::bound, c6_cam_net_up(), c6_cam_puts(), internal_c6_cam_associate(), k_ra8_ok, ra8_err_to_str(), RA8_INTERNAL, and s_link.
Referenced by internal_c6_cam_worker_entry().
|
static |
Latch station connection events from the C6 link.
Counts every delivered event and records connected or disconnected state.
| [in,out] | ctx | Unused callback context. |
| [in] | event | Borrowed event descriptor from the C6 link. |
Definition at line 118 of file c6_cam_app.c.
References k_ra8_c6link_event_sta_connected, k_ra8_c6link_event_sta_disconnected, ra8_c6link_event::kind, RA8_INTERNAL, s_connected, s_disconnect_reason, s_disconnected, and s_events.
Referenced by internal_c6_cam_open_link().
|
static |
Bind and open the raw ESP-hosted C6 link.
Supplies static arena storage plus event and NetX receive callbacks.
| k_ra8_ok | The link opened successfully. |
| k_ra8_err_not_initialized | The ESP-hosted transport was unavailable. |
Definition at line 169 of file c6_cam_app.c.
References ra8_c6link_cfg::arena, ra8_c6link_cfg::arena_bytes, ra8_c6link_cfg::cb_ctx, ra8_c6link_cfg::event_cb, internal_c6_cam_on_event(), k_ra8_ok, nx_ether_driver_c6_rx(), ra8_c6link_open(), ra8_esp_hosted_c6link_bind(), RA8_INTERNAL, ra8_c6link_cfg::rx_cb, s_arena, s_link, and ra8_c6link_cfg::transport.
Referenced by internal_c6_cam_prepare_link().
|
static |
Initialize the camera backend and prove one startup JPEG capture.
Runs after SDRAM and audio are already confirmed working, so a camera failure is never masked by an earlier media stage.
| true | Camera initialization and one JPEG capture passed. |
| false | A diagnostic was emitted for the failing stage. |
Definition at line 356 of file c6_cam_app.c.
References c6_cam_camera_capture_jpeg(), c6_cam_camera_description(), c6_cam_camera_init(), c6_cam_camera_report_last_error(), c6_cam_put_u32(), c6_cam_puts(), c6_cam_frame_timing_t::capture_ms, k_ra8_ok, ra8_err_to_str(), and RA8_INTERNAL.
Referenced by internal_c6_cam_prepare_media().
|
static |
Open the C6 link and await firmware readiness.
Reports link status and the coprocessor firmware version to SCI8.
| true | The link opened and the ready announcement arrived. |
| false | Transport open or ready negotiation failed. |
Definition at line 225 of file c6_cam_app.c.
References c6_cam_put_u32(), c6_cam_puts(), internal_c6_cam_open_link(), internal_c6_cam_report_fault(), k_ra8_c6link_announce_transfers, k_ra8_ok, ra8_c6link_fw_version::major, ra8_c6link_fw_version::minor, ra8_c6link_fw_version::patch, ra8_c6link_await_ready(), ra8_err_to_str(), RA8_INTERNAL, and s_link.
Referenced by internal_c6_cam_worker_entry().
|
static |
Initialize and self-test the audio and camera backends.
Proves local media hardware before any Wi-Fi or DHCP dependency can mask a camera failure, while giving the C6 additional boot time.
| true | SDRAM, audio, camera initialization, and one JPEG capture passed. |
| false | A diagnostic was emitted for the failing stage. |
Definition at line 403 of file c6_cam_app.c.
References c6_cam_audio_start(), c6_cam_puts(), internal_c6_cam_prepare_camera(), k_ra8_ok, ra8_err_to_str(), RA8_INTERNAL, and ra8_sdramc_init().
Referenced by internal_c6_cam_worker_entry().
|
static |
Emit one standardized application failure line.
Combines a stage label with the repository error string on SCI8.
| [in] | stage | NUL-terminated failing-stage name. |
| [in] | err | Repository error code to describe. |
Definition at line 147 of file c6_cam_app.c.
References c6_cam_puts(), ra8_err_to_str(), and RA8_INTERNAL.
Referenced by internal_c6_cam_associate(), internal_c6_cam_prepare_link(), and internal_c6_cam_worker_entry().
|
static |
Initialize shared clocks, services, and the diagnostic console.
Performs ordered CGC, MSTP, ISR, timebase, and UART initialization.
Definition at line 83 of file c6_cam_app.c.
References c6_cam_puts(), ra8_board_clock_rates_t::cpuclk0_hz, internal_c6_cam_halt(), k_c6_cam_uart_baud, k_ra8_ok, ra8_board_clock_rates_t::pclka_hz, ra8_board_clocks_init(), ra8_board_uart_console_init(), RA8_INTERNAL, ra8_isr_init(), ra8_mstp_init(), ra8_time_init(), s_cpuclk_hz, and s_pclka_hz.
Referenced by c6_cam_app_run().
|
static |
Poll for a station association result.
Services C6 transfers between bounded sleeps until connected, disconnected, or timed out.
| true | A station-connected event was observed. |
| false | Disconnection or the poll budget ended first. |
Definition at line 197 of file c6_cam_app.c.
References k_c6_cam_assoc_gap_ms, k_c6_cam_assoc_polls, k_ra8_c6link_announce_transfers, ra8_c6link_poll(), RA8_INTERNAL, s_connected, s_disconnected, s_link, and tx_thread_sleep.
Referenced by internal_c6_cam_associate().
|
static |
Run the network, audio, camera, and HTTP worker workflow.
Validates local media, joins Wi-Fi, then serves HTTP.
| [in] | input | ThreadX entry parameter, unused by this worker. |
Definition at line 432 of file c6_cam_app.c.
References c6_cam_http_serve(), c6_cam_put_ip(), c6_cam_puts(), internal_c6_cam_halt(), internal_c6_cam_join(), internal_c6_cam_prepare_link(), internal_c6_cam_prepare_media(), internal_c6_cam_report_fault(), c6_cam_lease_t::ip, k_c6_cam_boot_wait_ms, k_ra8_net_provision_timeout_ms, k_ra8_ok, ra8_delay_ms(), ra8_err_to_str(), RA8_INTERNAL, ra8_net_provision_clear(), ra8_net_provision_receive(), s_port_err, and s_provision_uart.
Referenced by tx_application_define().
| void tx_application_define | ( | void * | first_unused_memory | ) |
Definition at line 474 of file c6_cam_app.c.
References c6_cam_puts(), internal_c6_cam_worker_entry(), k_c6_cam_edge_poll_ms, k_c6_cam_sck_hz, k_c6_cam_worker_prio, k_ra8_board_pmod1_sci_channel, ra8_esp_hosted_port_init(), s_pclka_hz, s_port_err, s_worker, s_worker_name, s_worker_stack, TX_AUTO_START, TX_NO_TIME_SLICE, TX_SUCCESS, and tx_thread_create.
|
static |
Definition at line 43 of file c6_cam_app.c.
Referenced by c6_join_open_link(), internal_c6_cam_open_link(), ra8_img_arena_bind(), ra8_img_arena_free(), ra8_img_arena_malloc(), ra8_img_arena_unbind(), ra8_stbtt_malloc(), ra8_webp_arena_bind(), ra8_webp_arena_free(), ra8_webp_arena_malloc(), ra8_webp_arena_unbind(), sh_book_cover_fullscreen(), sh_comic_blit_page(), sh_epub_thumb(), and wifi_hal_make_cfg().
|
static |
Definition at line 46 of file c6_cam_app.c.
Referenced by c6_join_on_event(), c6_join_wait_connected(), internal_c6_cam_associate(), internal_c6_cam_on_event(), internal_c6_cam_wait_connected(), internal_on_event(), and internal_wait_connected().
|
static |
Definition at line 37 of file c6_cam_app.c.
Referenced by c6_join_setup_or_halt(), internal_c6_cam_setup_or_halt(), internal_setup_or_halt(), main(), and wifi_hal_setup_or_halt().
|
static |
Definition at line 48 of file c6_cam_app.c.
Referenced by internal_c6_cam_associate(), and internal_c6_cam_on_event().
|
static |
Definition at line 47 of file c6_cam_app.c.
Referenced by c6_join_on_event(), c6_join_wait_connected(), internal_c6_cam_associate(), internal_c6_cam_on_event(), internal_c6_cam_wait_connected(), internal_on_event(), and internal_wait_connected().
|
static |
Definition at line 45 of file c6_cam_app.c.
Referenced by c6_join_on_event(), c6_join_worker_entry(), internal_c6_cam_associate(), and internal_c6_cam_on_event().
|
static |
Definition at line 44 of file c6_cam_app.c.
Referenced by c6_join_open_link(), c6_join_phase_associate(), c6_join_phase_ip(), c6_join_phase_ready(), c6_join_report_fault(), c6_join_wait_connected(), internal_c6_cam_associate(), internal_c6_cam_join(), internal_c6_cam_open_link(), internal_c6_cam_prepare_link(), internal_c6_cam_wait_connected(), internal_open_and_join(), internal_run(), internal_transfer_and_consume(), internal_wait_connected(), and wifi_hal_make_cfg().
|
static |
Definition at line 38 of file c6_cam_app.c.
Referenced by c6_join_setup_or_halt(), er_try_load_font(), internal_c6_cam_setup_or_halt(), internal_mount_sd(), internal_setup_or_halt(), main(), microsd_sd_snapshot(), microsd_sd_spi_open(), microsd_setup_or_halt(), sfr_bringup_clocks(), sfr_load_font_or_halt(), sh_sd_bus_init(), sh_sd_mount(), tx_application_define(), and wifi_hal_setup_or_halt().
|
static |
Definition at line 39 of file c6_cam_app.c.
Referenced by internal_c6_cam_worker_entry(), internal_run(), and tx_application_define().
|
static |
Board-console binding for the shared runtime provisioner.
Definition at line 50 of file c6_cam_app.c.
Referenced by c6_join_worker_entry(), internal_c6_cam_worker_entry(), internal_worker(), and wifi_hal_worker_entry().
|
static |
Definition at line 40 of file c6_cam_app.c.
Referenced by tx_application_define().
|
static |
Definition at line 41 of file c6_cam_app.c.
Referenced by tx_application_define().
|
static |
Definition at line 42 of file c6_cam_app.c.
Referenced by tx_application_define().