28 #if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__) 37 #define USB_MAX_ENDPOINTS 4 42 #define USB_EP0_STATUS_STAGE USB_EP0_STATUS_STAGE_SW 47 #define USB_SET_ADDRESS_MODE USB_LATE_SET_ADDRESS 52 #define USB_SET_ADDRESS_ACK_HANDLING USB_SET_ADDRESS_ACK_SW 67 #if !defined(PLATFORM_USB_USE_USB1) || defined(__DOXYGEN__) 68 #define PLATFORM_USB_USE_USB1 FALSE 96 #if (USB_USE_WAIT == TRUE) || defined(__DOXYGEN__) 121 #if (USB_USE_WAIT == TRUE) || defined(__DOXYGEN__) 288 #if defined(USB_DRIVER_EXT_FIELDS) 289 USB_DRIVER_EXT_FIELDS
306 #define usb_lld_get_frame_number(usbp) 0 322 #define usb_lld_get_transaction_size(usbp, ep) \ 323 ((usbp)->epc[ep]->out_state->rxcnt) 330 #define usb_lld_connect_bus(usbp) 337 #define usb_lld_disconnect_bus(usbp) 344 #define usb_lld_wakeup_host(usbp) 350 #if (PLATFORM_USB_USE_USB1 == TRUE) && !defined(__DOXYGEN__) USBOutEndpointState * out_state
USBEndpointState associated to the OUT endpoint.
void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep)
Prepares for a receive operation.
uint16_t in_maxsize
IN endpoint maximum packet size.
USBDriver USBD1
USB1 driver identifier.
Type of an OUT endpoint state structure.
void usb_lld_init(void)
Low level USB driver initialization.
usbstate_t state
Driver state.
size_t rxcnt
Received bytes so far.
const USBEndpointConfig * epc[USB_MAX_ENDPOINTS+1]
Active endpoints configurations.
uint8_t setup[8]
Setup packet buffer.
void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep)
Enables an endpoint.
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep)
Brings an OUT endpoint in the active state.
usbeventcb_t event_cb
USB events callback.
size_t txsize
Requested transmit transfer size.
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep)
Brings an IN endpoint in the active state.
void usb_lld_start(USBDriver *usbp)
Configures and activates the USB peripheral.
void usb_lld_disable_endpoints(USBDriver *usbp)
Disables all the active endpoints except the endpoint zero.
void usb_lld_start_out(USBDriver *usbp, usbep_t ep)
Starts a receive operation on an OUT endpoint.
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep)
Brings an IN endpoint in the stalled state.
usbstate_t
Type of a driver state machine possible states.
uint8_t configuration
Current USB device configuration.
void usb_lld_start_in(USBDriver *usbp, usbep_t ep)
Starts a transmit operation on an IN endpoint.
usbepcallback_t in_cb
IN endpoint notification callback.
const USBConfig * config
Current configuration data.
Structure representing an USB driver.
void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf)
Reads a setup packet from the dedicated packet buffer.
uint8_t address
Assigned USB address.
void * out_params[USB_MAX_ENDPOINTS]
Fields available to user, it can be used to associate an application-defined handler to an OUT endpoi...
size_t ep0n
Number of bytes yet to be transferred through endpoint 0.
void(* usbcallback_t)(USBDriver *usbp)
Type of an USB generic notification callback.
void usb_lld_stall_out(USBDriver *usbp, usbep_t ep)
Brings an OUT endpoint in the stalled state.
uint16_t receiving
Bit map of the receiving OUT endpoints.
void(* usbeventcb_t)(USBDriver *usbp, usbevent_t event)
Type of an USB event notification callback.
uint32_t ep_mode
Type and mode of the endpoint.
usbcallback_t sof_cb
Start Of Frame callback.
thread_reference_t thread
Waiting thread.
const uint8_t * txbuf
Pointer to the transmission linear buffer.
usbreqhandler_t requests_hook_cb
Requests hook callback.
uint8_t * rxbuf
Pointer to the receive linear buffer.
usbep0state_t
Type of an endpoint zero state machine states.
size_t txcnt
Transmitted bytes so far.
bool(* usbreqhandler_t)(USBDriver *usbp)
Type of a requests handler callback.
void usb_lld_reset(USBDriver *usbp)
USB low level reset routine.
size_t rxsize
Requested receive transfer size.
const USBDescriptor *(* usbgetdescriptor_t)(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang)
Type of an USB descriptor-retrieving callback.
uint16_t transmitting
Bit map of the transmitting IN endpoints.
void * thread_reference_t
Type of a thread reference.
usbepstatus_t usb_lld_get_status_out(USBDriver *usbp, usbep_t ep)
Returns the status of an OUT endpoint.
void * in_params[USB_MAX_ENDPOINTS]
Fields available to user, it can be used to associate an application-defined handler to an IN endpoin...
uint16_t status
Current USB device status.
usbepcallback_t setup_cb
Setup packet notification callback.
Type of an IN endpoint state structure.
uint8_t * ep0next
Next position in the buffer to be transferred through endpoint 0.
void(* usbepcallback_t)(USBDriver *usbp, usbep_t ep)
Type of an USB endpoint callback.
usbgetdescriptor_t get_descriptor_cb
Device GET_DESCRIPTOR request callback.
usbcallback_t ep0endcb
Endpoint 0 end transaction callback.
usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep)
Returns the status of an IN endpoint.
uint8_t usbep_t
Type of an endpoint identifier.
Type of an USB driver configuration structure.
uint16_t out_maxsize
OUT endpoint maximum packet size.
void usb_lld_stop(USBDriver *usbp)
Deactivates the USB peripheral.
usbepcallback_t out_cb
OUT endpoint notification callback.
Type of an USB endpoint configuration structure.
usbstate_t saved_state
State of the driver when a suspend happened.
USBInEndpointState * in_state
USBEndpointState associated to the IN endpoint.
void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep)
Prepares for a transmit operation.
thread_reference_t thread
Waiting thread.
void usb_lld_set_address(USBDriver *usbp)
Sets the USB address.
usbep0state_t ep0state
Endpoint 0 state.
#define USB_MAX_ENDPOINTS
Maximum endpoint address.
usbepstatus_t
Type of an endpoint status.