ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_usb_hcdc_ecm.c
Go to the documentation of this file.
1
38
39#include "ra8_usb_hcdc_ecm.h"
40
41#include <stddef.h>
42#include <stdint.h>
43
44#include "ra8_attributes.h"
45#include "ra8_check.h"
46#include "ra8_err.h"
47#include "ra8_log.h"
48#include "ra8_usb.h"
49
50static const char* s_tag = "USBHCDCECM";
51
52/* =============================================================================
53 * Internal constants
54 * =============================================================================
55 */
56
79
85typedef enum : uint8_t {
86 /* Chapter-9 standard requests (USB 2.0 spec section 9.4). */
94 /* CDC-ECM class-specific request envelopes. */
97 /* Descriptor types in wValue's high byte. */
103 /* CDC class-specific descriptor types (USB CDC 1.20 sec 5.2.3). */
107
123
134
139typedef enum : uint32_t {
142
143/* =============================================================================
144 * Internal state
145 * =============================================================================
146 */
147
162
164
165/* =============================================================================
166 * Internal helpers
167 * =============================================================================
168 */
169
190
210{
211 const uint16_t bulk_mp = internal_bulk_max_packet(s_state.speed);
212
215 s_state.device.bulk_in_ep,
218 bulk_mp);
219 RA8_RETURN_ON_ERROR(err, s_tag, "hcdc_ecm: bulk-in cfg");
220
223 s_state.device.bulk_out_ep,
226 bulk_mp);
227 RA8_RETURN_ON_ERROR(err, s_tag, "hcdc_ecm: bulk-out cfg");
228
231 s_state.device.intr_in_ep,
235 return err;
236}
237
257 uint8_t desc_index,
258 uint16_t lang_id,
259 uint16_t length)
260{
261 const ra8_usb_setup_t setup = {
262 .bm_request_type = k_ra8_hcdc_ecm_bm_std_dev_in,
264 .w_value =
265 (uint16_t)(((uint16_t)desc_type << k_ra8_hcdc_ecm_shift_byte1) | (uint16_t)desc_index),
266 .w_index = lang_id,
267 .w_length = length,
268 };
269 return ra8_usb_host_setup_request(s_state.speed, &setup);
270}
271
288{
289 const ra8_usb_setup_t setup = {
290 .bm_request_type = k_ra8_hcdc_ecm_bm_std_dev_out,
292 .w_value = (uint16_t)address,
293 .w_index = 0U,
294 .w_length = 0U,
295 };
296 return ra8_usb_host_setup_request(s_state.speed, &setup);
297}
298
314static ra8_err_t internal_setup_set_config(uint8_t config_value)
315{
316 const ra8_usb_setup_t setup = {
317 .bm_request_type = k_ra8_hcdc_ecm_bm_std_dev_out,
319 .w_value = (uint16_t)config_value,
320 .w_index = 0U,
321 .w_length = 0U,
322 };
323 return ra8_usb_host_setup_request(s_state.speed, &setup);
324}
325
344{
345 const ra8_usb_setup_t setup = {
346 .bm_request_type = k_ra8_hcdc_ecm_bm_std_iface_out,
348 .w_value = k_ra8_hcdc_ecm_data_alt,
349 .w_index = k_ra8_hcdc_ecm_data_alt,
350 .w_length = 0U,
351 };
352 return ra8_usb_host_setup_request(s_state.speed, &setup);
353}
354
371static ra8_err_t internal_setup_set_packet_filter(uint16_t filter_mask)
372{
373 const ra8_usb_setup_t setup = {
374 .bm_request_type = k_ra8_hcdc_ecm_bm_class_iface_out,
376 .w_value = filter_mask,
377 .w_index = k_ra8_hcdc_ecm_data_alt, /* Communications IF index. */
378 .w_length = 0U,
379 };
380 return ra8_usb_host_setup_request(s_state.speed, &setup);
381}
382
399static ra8_err_t internal_hex_nibble(char c, uint8_t* out_nibble)
400{
401 if ((c >= '0') && (c <= '9')) {
402 *out_nibble = (uint8_t)(c - '0');
403 return k_ra8_ok;
404 }
405 if ((c >= 'a') && (c <= 'f')) {
406 *out_nibble = (uint8_t)(k_ra8_hcdc_ecm_hex_alpha + (c - 'a'));
407 return k_ra8_ok;
408 }
409 if ((c >= 'A') && (c <= 'F')) {
410 *out_nibble = (uint8_t)(k_ra8_hcdc_ecm_hex_alpha + (c - 'A'));
411 return k_ra8_ok;
412 }
414}
415
441{
442 s_state.device.device_address = k_ra8_hcdc_ecm_assigned_address;
443 s_state.device.bulk_in_ep = 1U;
444 s_state.device.bulk_out_ep = 2U;
445 s_state.device.intr_in_ep = 3U;
446 s_state.device.bulk_in_max_packet = internal_bulk_max_packet(s_state.speed);
447 s_state.device.bulk_out_max_packet = internal_bulk_max_packet(s_state.speed);
448 /* iMACAddress index 4 is what the FSP-tested ASIX AX88179 / RNDIS-ECM
449 * dongle reports; the production walker overwrites this from the
450 * Ethernet Networking Functional descriptor. */
451 s_state.device.i_mac_address = 4U;
452}
453
469{
471 return ra8_usb_host_bus_reset(s_state.speed, true);
472}
473
489{
490 const ra8_err_t rel = ra8_usb_host_bus_reset(s_state.speed, false);
491 RA8_RETURN_ON_ERROR(rel, /* GCOVR_EXCL_BR_LINE -- stored speed valid; reset rejects only speed */
492 s_tag,
493 "hcdc_ecm: release bus reset");
496}
497
514{
516 RA8_RETURN_ON_ERROR(addr_err, /* GCOVR_EXCL_BR_LINE -- valid speed + static in-range address */
517 s_tag,
518 "hcdc_ecm: set USBADDR");
521 0U,
522 0U,
524}
525
548
568
589
612
640
660
676{
677 const ra8_err_t pipes_err = internal_configure_pipes();
678 RA8_RETURN_ON_ERROR(pipes_err, s_tag, "hcdc_ecm: configure pipes");
679 s_state.attached = true;
681 if (s_state.attach_cb != nullptr) {
682 s_state.attach_cb(s_state.attach_ctx, &s_state.device);
683 }
684 return k_ra8_ok;
685}
686
729
730/* =============================================================================
731 * Lifecycle
732 * =============================================================================
733 */
734
736{
737 if ((speed != k_ra8_usb_speed_fs) && (speed != k_ra8_usb_speed_hs)) {
739 }
740 const ra8_err_t usb_err = ra8_usb_host_init(speed);
741 if (usb_err != k_ra8_ok) {
742 ra8_log_error_val(s_tag, "ra8_usb_host_init failed", (uint32_t)usb_err);
744 }
745
746 s_state.speed = speed;
748 s_state.attached = false;
749 s_state.attach_cb = nullptr;
750 s_state.attach_ctx = nullptr;
753 s_state.initialized = true;
754
755 ra8_log_info_val(s_tag, "host-CDC-ECM ready", (uint32_t)speed);
756 return k_ra8_ok;
757}
758
760{
761 if (!s_state.initialized) {
763 }
764 /* Bus power down: drop UACT before tearing the controller. */
765 (void)ra8_usb_host_set_uact(s_state.speed, false);
766 const ra8_err_t err = ra8_usb_host_deinit(s_state.speed);
767 s_state.initialized = false;
768 s_state.attached = false;
769 s_state.attach_cb = nullptr;
770 s_state.attach_ctx = nullptr;
772 return err;
773}
774
775/* =============================================================================
776 * Attach callback
777 * =============================================================================
778 */
779
781{
782 if (!s_state.initialized) {
784 }
785 s_state.attach_cb = on_attach;
786 s_state.attach_ctx = ctx;
787 return k_ra8_ok;
788}
789
790/* =============================================================================
791 * Bulk frame pipe
792 * =============================================================================
793 */
794
795ra8_err_t ra8_usb_hcdc_ecm_send_frame(const uint8_t* buf, uint16_t len)
796{
797 if (!s_state.initialized) {
799 }
800 if (!s_state.attached) {
802 }
803 if ((buf == nullptr) && (len != 0U)) {
805 }
808 }
810}
811
812ra8_err_t ra8_usb_hcdc_ecm_recv_frame(uint8_t* buf, uint16_t max_len, uint16_t* got_len)
813{
814 RA8_CHECK_NULL_PTR(buf, s_tag, "ecm_recv: buf");
815 RA8_CHECK_NULL_PTR(got_len, s_tag, "ecm_recv: got_len");
816 if (!s_state.initialized) {
818 }
819 if (!s_state.attached) {
821 }
822 if (max_len == 0U) {
824 }
825 uint16_t inout_len = max_len;
826 const ra8_err_t err =
827 ra8_usb_queue_out(s_state.speed, k_ra8_hcdc_ecm_pipe_bulk_in, buf, &inout_len, true);
828 if (err == k_ra8_ok) {
829 *got_len = inout_len;
830 } else {
831 *got_len = 0U;
832 }
833 return err;
834}
835
836/* =============================================================================
837 * Class control transfers
838 * =============================================================================
839 */
840
842{
843 if (!s_state.initialized) {
845 }
846 if (!s_state.attached) {
848 }
849 if ((filter_mask & (uint16_t)~k_ra8_hcdc_ecm_filter_all) != 0U) {
851 }
852 return internal_setup_set_packet_filter(filter_mask);
853}
854
856{
857 RA8_CHECK_NULL_PTR(out_link, s_tag, "ecm_link: out_link");
858 if (!s_state.initialized) {
860 }
861 if (!s_state.attached) {
863 }
864
865 /* See USB CDC ECM 1.20 sec 6.2.5 "GetEthernetStatistic": class IN
866 * request with bRequest = 0x44. The cached link state comes from
867 * the NetworkConnection notification on PIPE6; the production CTRT
868 * path updates `s_state.link` when it lands. */
869 const ra8_usb_setup_t setup = {
870 .bm_request_type = k_ra8_hcdc_ecm_bm_class_iface_in,
872 .w_value = 0U,
873 .w_index = k_ra8_hcdc_ecm_data_alt,
874 .w_length = 1U,
875 };
876 const ra8_err_t err = ra8_usb_host_setup_request(s_state.speed, &setup);
877 if (err == k_ra8_ok) {
878 *out_link = s_state.link;
879 }
880 return err;
881}
882
883/* =============================================================================
884 * MAC parse helper
885 * =============================================================================
886 */
887
888ra8_err_t ra8_usb_hcdc_ecm_parse_mac(const char* chars, uint8_t* out_mac)
889{
890 RA8_CHECK_NULL_PTR(chars, s_tag, "parse_mac: chars");
891 RA8_CHECK_NULL_PTR(out_mac, s_tag, "parse_mac: out_mac");
892
893 /* See USB CDC ECM 1.20 sec 5.4 "iMACAddress": 12 ASCII hex digits
894 * encoded UTF-16LE in the string descriptor. The caller is expected
895 * to have peeled the UTF-16 wrapper down to the 12 ASCII bytes. */
896 for (size_t i = 0U; i < (size_t)k_ra8_hcdc_ecm_mac_bytes; ++i) {
897 uint8_t hi = 0U;
898 uint8_t lo = 0U;
899 const ra8_err_t hi_err = internal_hex_nibble(chars[i * 2U], &hi);
900 if (hi_err != k_ra8_ok) {
901 return hi_err;
902 }
903 const ra8_err_t lo_err = internal_hex_nibble(chars[(i * 2U) + 1U], &lo);
904 if (lo_err != k_ra8_ok) {
905 return lo_err;
906 }
907 out_mac[i] = (uint8_t)((hi << k_ra8_hcdc_ecm_shift_nibble) | lo);
908 }
909 return k_ra8_ok;
910}
911
912/* =============================================================================
913 * Test / introspection helpers
914 * =============================================================================
915 */
916
918{
919 if (!s_state.initialized) {
921 }
922 return internal_step_advance();
923}
static const char * s_tag
Logging / check tag.
Definition ra8_app.c:17
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Definition ra8_check.h:184
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ k_ra8_err_hw_init_failed
Hardware peripheral failed to initialise.
Definition ra8_err.h:290
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
Definition ra8_err.h:161
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
Definition ra8_log.h:366
#define ra8_log_error_val(tag, message, value)
RA8 log error val.
Definition ra8_log.h:337
static uint32_t s_state
Native USB controller driver public API (device + host modes).
ra8_err_t ra8_usb_queue_out(ra8_usb_speed_t speed, uint8_t pipe_num, uint8_t *out_buf, uint16_t *inout_len, bool rearm)
Drain an OUT transfer (host -> device) from pipe_num.
@ k_ra8_usb_ep_type_bulk
Bulk transfer.
@ k_ra8_usb_ep_type_intr
Interrupt transfer.
ra8_err_t ra8_usb_set_address(ra8_usb_speed_t speed, uint8_t address)
Program the device USB address into USBADDR.
ra8_err_t ra8_usb_configure_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num, uint8_t ep_addr, ra8_usb_ep_dir_t dir, ra8_usb_ep_type_t type, uint16_t max_packet)
Configure a non-control PIPE for IN or OUT bulk / interrupt / iso transfers.
@ k_ra8_usb_ep_dir_in
Device -> host.
@ k_ra8_usb_ep_dir_out
Host -> device.
ra8_usb_speed_t
Selects which controller instance the call targets.
@ k_ra8_usb_speed_hs
High-Speed controller (USBHS @ 0x40351000).
@ k_ra8_usb_speed_fs
Full-Speed controller (USBFS @ 0x40250000).
ra8_err_t ra8_usb_queue_in(ra8_usb_speed_t speed, uint8_t pipe_num, const uint8_t *data, uint16_t len)
Queue an IN transfer (device -> host) on pipe_num.
ra8_usb_hcdc_ecm_setup_field_t
Standard chapter-9 + CDC-ECM class request bmRequestType / bRequest encodings.
@ k_ra8_hcdc_ecm_desc_interface
INTERFACE descriptor.
@ k_ra8_hcdc_ecm_breq_set_config
SET_CONFIGURATION.
@ k_ra8_hcdc_ecm_breq_get_descriptor
GET_DESCRIPTOR.
@ k_ra8_hcdc_ecm_desc_endpoint
ENDPOINT descriptor.
@ k_ra8_hcdc_ecm_breq_set_interface
SET_INTERFACE.
@ k_ra8_hcdc_ecm_bm_std_dev_out
Std | Device | Out.
@ k_ra8_hcdc_ecm_func_subtype_ecm
Ethernet Networking subtype.
@ k_ra8_hcdc_ecm_bm_class_iface_in
Class | Interface | In.
@ k_ra8_hcdc_ecm_bm_class_iface_out
Class | Interface | Out.
@ k_ra8_hcdc_ecm_bm_std_iface_out
Std | Interface | Out.
@ k_ra8_hcdc_ecm_desc_cs_interface
CS_INTERFACE functional.
@ k_ra8_hcdc_ecm_desc_configuration
CONFIGURATION descriptor.
@ k_ra8_hcdc_ecm_bm_std_dev_in
Std | Device | In.
@ k_ra8_hcdc_ecm_breq_set_address
SET_ADDRESS.
@ k_ra8_hcdc_ecm_desc_string
STRING descriptor.
@ k_ra8_hcdc_ecm_desc_device
DEVICE descriptor.
static ra8_err_t internal_do_set_address(void)
Step handler – store assigned address + SETUP for GET_DEVICE_DESCRIPTOR.
ra8_err_t ra8_usb_hcdc_ecm_get_link_status(ra8_usb_hcdc_ecm_link_t *out_link)
Issue GET_ETHERNET_STATISTIC (bRequest=0x44) to read the adapter's link state and store the result in...
static ra8_err_t internal_setup_set_config(uint8_t config_value)
Stage a SET_CONFIGURATION SETUP request.
ra8_err_t ra8_usb_hcdc_ecm_set_packet_filter(uint16_t filter_mask)
Issue SET_ETHERNET_PACKET_FILTER (bRequest=0x43) to the attached CDC-ECM adapter.
ra8_usb_hcdc_ecm_byte_mask_t
Single-byte mask used during serialisation.
@ k_ra8_hcdc_ecm_byte_mask
RA8 hcdc ecm byte mask.
static ra8_err_t internal_do_idle(void)
Step handler – bus-reset assert.
static ra8_err_t internal_step_advance(void)
Drive the enumeration step machine forward by one step.
static ra8_err_t internal_do_set_config(void)
Step handler – pure software descriptor walk.
ra8_err_t ra8_usb_hcdc_ecm_parse_mac(const char *chars, uint8_t *out_mac)
Parse 12 ASCII hex characters from an iMACAddress string descriptor payload into a 6-byte MAC.
static ra8_err_t internal_hex_nibble(char c, uint8_t *out_nibble)
Convert one ASCII hex digit to a 0..15 nibble.
static ra8_err_t internal_do_bus_reset(void)
Step handler – bus-reset release + SETUP for SET_ADDRESS.
static ra8_err_t internal_do_get_dev_desc(void)
Step handler – SETUP for GET_CONFIGURATION_DESCRIPTOR.
ra8_err_t ra8_usb_hcdc_ecm_init(ra8_usb_speed_t speed)
Bring up the host-CDC-ECM driver on a chosen USB controller.
static void internal_walk_config_descriptor(void)
Populate s_state.device with stub descriptor data.
ra8_err_t ra8_usb_hcdc_ecm_close(void)
Tear down the host-CDC-ECM driver and release the controller.
static ra8_err_t internal_do_set_interface(void)
Step handler – finalise pipes + fire attach callback.
ra8_usb_hcdc_ecm_size_t
Standard descriptor sizes and request payload sizes.
@ k_ra8_hcdc_ecm_cfg_desc_len
CONFIGURATION descriptor hdr.
@ k_ra8_hcdc_ecm_lang_id_us
wIndex for English (US).
@ k_ra8_hcdc_ecm_assigned_address
First assigned device addr.
@ k_ra8_hcdc_ecm_iface_desc_len
INTERFACE descriptor.
@ k_ra8_hcdc_ecm_ep_desc_len
ENDPOINT descriptor.
@ k_ra8_hcdc_ecm_string_desc_len
wLength for string fetch.
@ k_ra8_hcdc_ecm_data_alt
Data IF alt setting = 1.
@ k_ra8_hcdc_ecm_dev_desc_len
USB DEVICE descriptor.
@ k_ra8_hcdc_ecm_default_config
bConfigurationValue = 1.
ra8_err_t ra8_usb_hcdc_ecm_send_frame(const uint8_t *buf, uint16_t len)
Send an Ethernet frame OUT to the attached CDC-ECM adapter.
static ra8_err_t internal_setup_set_interface_data(void)
Stage a SET_INTERFACE (alt 1, iface 1) SETUP request.
static ra8_err_t internal_do_walk_desc(void)
Step handler – SETUP for GET_STRING_DESCRIPTOR(iMACAddress).
ra8_usb_hcdc_ecm_byte_shift_t
Per-byte shift constants for descriptor / wValue serialisation.
@ k_ra8_hcdc_ecm_hex_alpha
Offset for 'A'/'a' in hex digit.
@ k_ra8_hcdc_ecm_shift_byte0
RA8 hcdc ecm shift byte0.
@ k_ra8_hcdc_ecm_shift_byte1
RA8 hcdc ecm shift byte1.
@ k_ra8_hcdc_ecm_shift_nibble
RA8 hcdc ecm shift nibble.
static ra8_err_t internal_do_set_filter(void)
Step handler – SETUP for SET_INTERFACE (data IF, alt 1).
static ra8_err_t internal_setup_get_descriptor(uint8_t desc_type, uint8_t desc_index, uint16_t lang_id, uint16_t length)
Stage a chapter-9 GET_DESCRIPTOR SETUP request.
ra8_err_t ra8_usb_hcdc_ecm_recv_frame(uint8_t *buf, uint16_t max_len, uint16_t *got_len)
Drain an Ethernet frame IN from the attached CDC-ECM adapter.
ra8_usb_hcdc_ecm_step_t
Enumeration step machine states.
@ k_ra8_hcdc_ecm_step_set_filter
SET_ETHERNET_PACKET_FILTER.
@ k_ra8_hcdc_ecm_step_set_interface
SET_INTERFACE (alt 1).
@ k_ra8_hcdc_ecm_step_walk_desc
Find ECM IFs; populate pipes.
@ k_ra8_hcdc_ecm_step_get_cfg_desc
GET_CONFIGURATION_DESCRIPTOR.
@ k_ra8_hcdc_ecm_step_set_config
SET_CONFIGURATION (1).
@ k_ra8_hcdc_ecm_step_bus_reset
Drive USBRST then release.
@ k_ra8_hcdc_ecm_step_get_dev_desc
GET_DEVICE_DESCRIPTOR (18 B).
@ k_ra8_hcdc_ecm_step_done
Attach callback fires.
@ k_ra8_hcdc_ecm_step_get_string_mac
GET_STRING_DESCRIPTOR(iMAC).
@ k_ra8_hcdc_ecm_step_set_address
SET_ADDRESS to assigned 1.
@ k_ra8_hcdc_ecm_step_idle
Pre-attach.
static uint16_t internal_bulk_max_packet(ra8_usb_speed_t speed)
Pick the bulk-max-packet ceiling matching the negotiated speed.
ra8_err_t ra8_usb_hcdc_ecm_attach_callback(ra8_usb_hcdc_ecm_attach_fn_t on_attach, void *ctx)
Register (or detach) the attach callback.
static ra8_err_t internal_setup_set_address(uint8_t address)
Stage a SET_ADDRESS SETUP request.
static ra8_err_t internal_do_get_string_mac(void)
Step handler – SETUP for SET_ETHERNET_PACKET_FILTER.
static ra8_err_t internal_do_get_cfg_desc(void)
Step handler – SETUP for SET_CONFIGURATION.
static ra8_err_t internal_setup_set_packet_filter(uint16_t filter_mask)
Stage SET_ETHERNET_PACKET_FILTER (bRequest=0x43).
ra8_err_t ra8_usb_hcdc_ecm_step(void)
Drive the enumeration step machine forward by one step.
static ra8_err_t internal_configure_pipes(void)
Configure the three host-CDC-ECM pipes against the attached adapter's endpoints.
Native USB host-side CDC ECM (Communications Device Class -Ethernet Networking Control Model) class l...
@ k_ra8_hcdc_ecm_mac_bytes
Ethernet MAC byte count.
@ k_ra8_hcdc_ecm_req_get_statistic
GET_ETHERNET_STATISTIC.
@ k_ra8_hcdc_ecm_req_set_packet_filter
SET_ETHERNET_PACKET_FILTER.
ra8_usb_hcdc_ecm_link_t
Adapter link status reported by _get_link_status.
@ k_ra8_hcdc_ecm_link_down
NetworkConnection notification 0.
@ k_ra8_hcdc_ecm_pipe_bulk_in
PIPE1 -> attached EP bulk IN.
@ k_ra8_hcdc_ecm_pipe_intr_in
PIPE6 -> attached EP intr IN.
@ k_ra8_hcdc_ecm_pipe_bulk_out
PIPE2 -> attached EP bulk OUT.
@ k_ra8_hcdc_ecm_filter_all
All bits set.
void(* ra8_usb_hcdc_ecm_attach_fn_t)(void *ctx, const ra8_usb_hcdc_ecm_device_t *device)
Attach-callback signature.
@ k_ra8_hcdc_ecm_bulk_max_packet_fs
Bulk size at full speed.
@ k_ra8_hcdc_ecm_max_ethernet_frame
Ethernet frame ceiling.
@ k_ra8_hcdc_ecm_intr_max_packet
Notification pipe size.
@ k_ra8_hcdc_ecm_bulk_max_packet_hs
Bulk size at high speed.
ra8_err_t ra8_usb_host_bus_reset(ra8_usb_speed_t speed, bool assert_reset)
Drive (or release) the bus reset line.
ra8_err_t ra8_usb_host_init(ra8_usb_speed_t speed)
Bring up a USB controller in HOST mode.
ra8_err_t ra8_usb_host_deinit(ra8_usb_speed_t speed)
Tear down a host-mode controller and drop its MSTP reference.
ra8_err_t ra8_usb_host_setup_request(ra8_usb_speed_t speed, const ra8_usb_setup_t *setup)
Issue a SETUP packet through the DCP (host -> peripheral).
ra8_err_t ra8_usb_host_set_uact(ra8_usb_speed_t speed, bool enable)
Enable / disable SOF (Start-of-Frame) generation on the bus.
Snapshot of the attached CDC-ECM adapter, passed to the attach callback.
Singleton shadow state for the host-CDC-ECM driver.
ra8_usb_hcdc_ecm_link_t link
Cached link state.
ra8_usb_hcdc_ecm_step_t step
Current enum step.
ra8_usb_hcdc_ecm_attach_fn_t attach_cb
Attach callback, or NULL.
void * attach_ctx
Attach callback ctx.
ra8_usb_hcdc_ecm_device_t device
Snapshot of attached dev.
bool initialized
True after _init.
bool attached
True after enumeration.
ra8_usb_speed_t speed
Underlying controller.
Decoded 8-byte USB SETUP packet.