|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
USB host MSC + ra8_fs file-operations exerciser for EK-RA8D2 (USB-HS). More...
#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_fs.h"#include "ra8_gpio_constants.h"#include "ra8_isr.h"#include "ra8_port_constants.h"#include "ra8_port_utils.h"#include "ra8_time.h"#include "ra8_usb.h"#include "ra8_usb_hmsc.h"#include "usb_host_file_ops_steps.h"Go to the source code of this file.
Functions | |
| static void | fileops_panic_halt (void) |
| Halt forever in WFI – panic stop. | |
| static void | fileops_route_usb_or_halt (void) |
| Route both USB ports' board pins for the host role. | |
| static void | fileops_setup_or_halt (void) |
| Bring CGC + both USB clocks + SysTick + SCI8 + LEDs + pins up. | |
| static const char * | fileops_port_name (ra8_usb_speed_t speed) |
| Map a USB speed to the printable port name. | |
| static ra8_err_t | fileops_print_attach (const ra8_usb_hmsc_device_t *device, ra8_usb_speed_t speed) |
| Print "device attached vid=0x.. pid=0x.. port=USB-xS". | |
| static ra8_err_t | fileops_run_ladder (ra8_usb_speed_t speed) |
| One full pass on one port: host up, enumerate, mount, run the 9-step file-op suite. | |
| void | main (void) |
| Application entry. | |
Variables | |
| static const ra8_port_pin_t | k_fileops_pin_hs_vbus = (ra8_port_pin_t)k_ra8_board_usbhs_pin_vbus |
| USBHS_VBUS sense pin (P4_08, PSEL = 0x14). | |
| static const ra8_port_pin_t | k_fileops_pin_hs_pwr = (ra8_port_pin_t)k_ra8_board_usbhs_pin_pwr |
| J7 host-power switch (PD07): HIGH = U18 supplies VBUS (UM 6.2). | |
| static const ra8_port_pin_t | k_fileops_pin_fs_vbus = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbus |
| USBFS VBUS sense pin (P4_07, PSEL = 0x13). | |
| static const ra8_port_pin_t | k_fileops_pin_fs_vbusen = (ra8_port_pin_t)k_ra8_board_usbfs_pin_vbusen |
| USBFS VBUSEN (P5_00): the USB function drives host VBUS. | |
| static const ra8_port_pin_t | k_fileops_pin_fs_dp = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dp |
| USBFS D+ (P8_14) – PFS-muxed, unlike the dedicated HS balls. | |
| static const ra8_port_pin_t | k_fileops_pin_fs_dm = (ra8_port_pin_t)k_ra8_board_usbfs_pin_dm |
| USBFS D- (P8_15). | |
USB host MSC + ra8_fs file-operations exerciser for EK-RA8D2 (USB-HS).
Manual HIL test that proves real file operations work end to end on a USB thumb drive plugged into the J7 USB-HS jack: the board enumerates the stick via ra8_usb_hmsc_enumerate, mounts its FAT/exFAT volume through ra8_fs (block I/O bridged onto ra8_usb_hmsc_read10 / ra8_usb_hmsc_write10), then runs a 9-step suite over the J-Link OB CDC console:
Every step prints a pass/fail verdict; the run ends with ALL FILE OPS PASSED and a solid LED1. The ladder retries every 5 s so a freshly inserted drive is picked up automatically.
Board specifics (EK-RA8D2 v1 UM):
Definition in file main.c.
|
static |
Halt forever in WFI – panic stop.
Definition at line 97 of file main.c.
Referenced by fileops_route_usb_or_halt(), fileops_setup_or_halt(), and main().
|
static |
Map a USB speed to the printable port name.
| [in] | speed | Controller selector. |
| USB-HS | For k_ra8_usb_speed_hs. |
speed is one of the two host-capable controllers. Definition at line 214 of file main.c.
References k_ra8_usb_speed_hs.
Referenced by fileops_print_attach(), and fileops_run_ladder().
|
staticnodiscard |
Print "device attached vid=0x.. pid=0x.. port=USB-xS".
| [in] | device | Enumerated device snapshot. |
| [in] | speed | Controller the device answered on. |
| k_ra8_ok | All chunks queued. |
device is non-NULL. Definition at line 236 of file main.c.
References fileops_port_name(), fileops_print(), fileops_print_hex(), k_fileops_hex_chars_u16, k_ra8_ok, ra8_usb_hmsc_device_t::product_id, and ra8_usb_hmsc_device_t::vendor_id.
Referenced by fileops_run_ladder().
|
static |
Route both USB ports' board pins for the host role.
Panic-halts.
HS (J7): SW4-8 to Host via the U15 expander, PD07 HIGH (U18 supplies the jack), P4_08 to USBHS_VBUS. FS: P4_07 (VBUS sense), P5_00 (VBUSEN – the controller drives host VBUS through it), and the PFS-muxed data lines P8_14/P8_15.
Definition at line 124 of file main.c.
References fileops_panic_halt(), k_fileops_pin_fs_dm, k_fileops_pin_fs_dp, k_fileops_pin_fs_vbus, k_fileops_pin_fs_vbusen, k_fileops_pin_hs_pwr, k_fileops_pin_hs_vbus, k_ra8_level_high, k_ra8_ok, k_ra8_psel_usb_fs, k_ra8_psel_usb_hs, ra8_board_io_expander_set_usbhs_host_mode(), ra8_gpio_output_init(), and ra8_pfs_route_peripheral().
Referenced by fileops_setup_or_halt().
|
staticnodiscard |
One full pass on one port: host up, enumerate, mount, run the 9-step file-op suite.
Brings the selected controller up (ra8_usb_hmsc_init), so the caller can alternate between the HS and FS ports per retry cycle. On any failure the controller is closed again before returning; the mount handle is always released so the static mount-slot pool cannot leak.
| [in] | speed | Controller to drive this cycle (HS or FS port). |
| k_ra8_ok | The suite printed ALL FILE OPS PASSED. |
Definition at line 285 of file main.c.
References fileops_mount_volume(), fileops_port_name(), fileops_print(), fileops_print_attach(), fileops_print_fail(), fileops_probe_layout(), fileops_suite_create(), fileops_suite_mutate(), k_ra8_board_led1, k_ra8_ok, ra8_board_led_on(), ra8_fs_unmount(), ra8_usb_hmsc_close(), ra8_usb_hmsc_enumerate(), and ra8_usb_hmsc_init().
Referenced by main().
|
static |
Bring CGC + both USB clocks + SysTick + SCI8 + LEDs + pins up.
Panic-halts on any failure.
Enables the USBHS 60 MHz PLL and the USBFS 48 MHz PLL2 clock (the latter must run before MSTPB11 is released or UACT never sticks), then routes both ports' pins. The controller itself is brought up per retry cycle by the ladder (ra8_usb_hmsc_init), since the app alternates between the HS and FS ports.
Definition at line 171 of file main.c.
References fileops_panic_halt(), fileops_route_usb_or_halt(), k_fileops_baud, k_ra8_board_led1, k_ra8_board_led2, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_cgc_usbfs_clock_enable(), ra8_cgc_usbhs_pll_enable(), and ra8_time_init().
Referenced by main().
| void main | ( | void | ) |
Application entry.
The application entry point Reset_Handler hands control to.
Alternates between the HS and FS host ports and runs the file-op suite until it fully passes.
Definition at line 359 of file main.c.
References fileops_panic_halt(), fileops_print(), fileops_print_fail(), fileops_run_ladder(), fileops_setup_or_halt(), k_fileops_idle_ms, k_fileops_retry_ms, k_ra8_ok, k_ra8_usb_speed_fs, k_ra8_usb_speed_hs, ra8_delay_ms(), and ra8_isr_globals_enable().
|
static |
|
static |
USBFS D+ (P8_14) – PFS-muxed, unlike the dedicated HS balls.
Definition at line 77 of file main.c.
Referenced by fileops_route_usb_or_halt().
|
static |
USBFS VBUS sense pin (P4_07, PSEL = 0x13).
Definition at line 71 of file main.c.
Referenced by fileops_route_usb_or_halt().
|
static |
USBFS VBUSEN (P5_00): the USB function drives host VBUS.
Definition at line 74 of file main.c.
Referenced by fileops_route_usb_or_halt().
|
static |
J7 host-power switch (PD07): HIGH = U18 supplies VBUS (UM 6.2).
Definition at line 68 of file main.c.
Referenced by fileops_route_usb_or_halt().
|
static |
USBHS_VBUS sense pin (P4_08, PSEL = 0x14).
Definition at line 65 of file main.c.
Referenced by fileops_route_usb_or_halt().