35#include "ux_device_stack.h"
37#include "ux_utility.h"
72 bool auto_echo_pipe =
false;
75 auto_echo_pipe =
true;
106 const uint8_t ep_addr = (uint8_t)ep->ux_slave_endpoint_descriptor.bEndpointAddress;
118 switch ((uint8_t)ep->ux_slave_endpoint_descriptor.bmAttributes & 0x03U) {
137 (uint16_t)ep->ux_slave_endpoint_descriptor.wMaxPacketSize) !=
142 g_dcd.pipes[pipe].ep_addr = ep_addr;
143 g_dcd.pipes[pipe].dir_in =
145 g_dcd.pipes[pipe].max_pkt = (uint16_t)ep->ux_slave_endpoint_descriptor.wMaxPacketSize;
174 const uint8_t pipe =
priv_ep_to_pipe((uint8_t)ep->ux_slave_endpoint_descriptor.bEndpointAddress);
213 const uint8_t pipe =
priv_ep_to_pipe((uint8_t)ep->ux_slave_endpoint_descriptor.bEndpointAddress);
215 g_dcd.pipes[pipe].xfer =
nullptr;
240 if (state == (
unsigned long)UX_DEVICE_ATTACHED) {
241 g_diag.chg_state_attached++;
243 if (state == (
unsigned long)UX_DEVICE_CONFIGURED) {
244 g_diag.chg_state_configured++;
285 return UX_CONTROLLER_UNKNOWN;
289 case UX_DCD_TRANSFER_REQUEST:
292 case UX_DCD_TRANSFER_ABORT:
296 case UX_DCD_CREATE_ENDPOINT:
299 case UX_DCD_DESTROY_ENDPOINT:
302 case UX_DCD_RESET_ENDPOINT:
308 case UX_DCD_STALL_ENDPOINT:
311 case UX_DCD_SET_DEVICE_ADDRESS:
317 case UX_DCD_GET_FRAME_NUMBER:
318 if (parameter !=
nullptr) {
319 *(
unsigned long*)parameter = 0UL;
323 case UX_DCD_CHANGE_STATE:
329 case UX_DCD_ENDPOINT_STATUS:
332 case UX_DCD_ISR_PENDING:
336 return UX_FUNCTION_NOT_SUPPORTED;
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
Event Link Controller (ELC) register layout for the Renesas RA8D2.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
NVIC + ICU IELSR allocator.
Lightweight Logging Interface for ra8-firmware.
ra8_err_t ra8_usb_park_out_pipe(ra8_usb_speed_t speed, uint8_t pipe_num)
Park an OUT pipe at PID=NAK so an idle pipe stays quiescent.
ra8_usb_ep_type_t
Transfer type for a non-control endpoint.
@ k_ra8_usb_ep_type_bulk
Bulk transfer.
@ k_ra8_usb_ep_type_iso
Isochronous transfer.
@ k_ra8_usb_ep_type_intr
Interrupt transfer.
ra8_err_t ra8_usb_stall_endpoint(ra8_usb_speed_t speed, uint8_t pipe_num)
Stall a configured endpoint.
ra8_err_t ra8_usb_rearm_out_pipe(ra8_usb_speed_t speed, uint8_t pipe_num)
Re-arm an OUT pipe that the controller has parked at PID=NAK.
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.
ra8_usb_ep_dir_t
Endpoint direction.
@ k_ra8_usb_ep_dir_in
Device -> host.
@ k_ra8_usb_ep_dir_out
Host -> device.
USB Full-Speed + High-Speed controller layout for the Renesas RA8D2.
USBX device-controller-driver (DCD) bridge to ra8_usb.
@ k_ux_dcd_ra8_usb_max_pipes
DCP + 9 PIPE entries (HUM 36.1).
@ k_ux_dcd_ra8_usb_state_ready
Bridge installed; bus idle.
@ k_ux_dcd_ra8_usb_state_active
Class-layer transfers active.
@ k_ux_dcd_ra8_usb_state_uninit
Bridge not yet initialized.
static unsigned int internal_endpoint_create(struct UX_SLAVE_ENDPOINT_STRUCT *ep)
Translate a USBX endpoint create request into ra8_usb call.
static void internal_endpoint_arm_out_pid(uint8_t pipe, uint8_t ep_addr)
Set the power-on PID of a freshly created non-control pipe.
static unsigned int internal_endpoint_stall(struct UX_SLAVE_ENDPOINT_STRUCT *ep)
Endpoint stall.
static void internal_count_change_state(unsigned long state)
Count UX_DCD_CHANGE_STATE notifications by target state.
unsigned int _ux_dcd_ra8_usb_function(struct UX_SLAVE_DCD_STRUCT *dcd, unsigned int function, void *parameter)
USBX device-side DCD function dispatcher.
static unsigned int internal_endpoint_destroy(struct UX_SLAVE_ENDPOINT_STRUCT *ep)
Drop the bridge's per-pipe transfer stash for a destroyed endpoint.
USBX device-controller-driver bridge to ra8_usb – per-module cross-translation-unit contract.
uint8_t priv_ep_to_pipe(uint8_t ep_addr)
Map a USB EP number (1..9) into the PIPE table index.
volatile uint32_t g_dcd_auto_echo_enable
Non-zero once ISR-side auto-echo is armed.
uint8_t g_dcd_auto_echo_out_pipe
Pipe drained by the in-ISR auto-echo path.
uint16_t g_orphan_len
Held orphan byte count; 0 = empty.
ra8_usb_dcd_t g_dcd
The single bridge instance, defined in ux_dcd_ra8_usb.c.
ra8_usb_dcd_diag_t g_diag
Bridge diagnostic counter block, defined in ux_dcd_ra8_usb.c.
@ k_ra8_usb_ep_addr_dir_in_bit
Direction bit set => IN endpoint.
@ k_ra8_usb_ep_addr_num_mask
Endpoint-number field (bits 3:0).
unsigned int priv_transfer_request(struct UX_SLAVE_TRANSFER_STRUCT *tr)
USBX UX_DCD_TRANSFER_REQUEST dispatcher entry point.