30#include <Driver_USBD.h>
48 c_cb_device_func_ (c_cb_device_func),
49 c_cb_endpoint_func_ (c_cb_endpoint_func)
63#pragma GCC diagnostic push
64#pragma GCC diagnostic ignored "-Waggregate-return"
65#pragma GCC diagnostic ignored "-Wstrict-aliasing"
71 *(
reinterpret_cast<ARM_DRIVER_VERSION*
> (&version_)) =
72 driver_->GetVersion ();
80 *(
reinterpret_cast<ARM_USBD_CAPABILITIES*
> (&capa_)) =
81 driver_->GetCapabilities ();
89 *(
reinterpret_cast<ARM_USBD_STATE*
> (&status_)) =
90 driver_->DeviceGetState ();
94#pragma GCC diagnostic pop
99 assert (driver_ !=
nullptr);
105 status = driver_->Initialize (c_cb_device_func_, c_cb_endpoint_func_);
106 if (status != ARM_DRIVER_OK)
112 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
116 driver_->Uninitialize ();
125 return driver_->DeviceConnect ();
131 return driver_->DeviceDisconnect ();
137 return driver_->DeviceRemoteWakeup ();
143 return driver_->DeviceSetAddress (dev_addr);
149 return driver_->ReadSetupPacket (buf);
155 return driver_->GetFrameNumber ();
163 return driver_->EndpointConfigure (ep_addr,
164 static_cast<uint8_t
> (ep_type),
171 return driver_->EndpointUnconfigure (ep_addr);
177 return driver_->EndpointStall (ep_addr, stall);
182 std::size_t num)
noexcept
184 return driver_->EndpointTransfer (ep_addr, data,
185 static_cast<uint32_t
> (num));
191 return driver_->EndpointTransferGetResult (ep_addr);
197 return driver_->EndpointTransferAbort (ep_addr);
USB device driver capabilities.
virtual return_t do_unconfigure_endpoint(usb::endpoint_t ep_addr) noexcept override
virtual ~usbd_wrapper() noexcept
virtual usb::device::Status & do_get_status(void) noexcept override
virtual return_t do_connect(void) noexcept override
ARM_DRIVER_USBD * driver_
Pointer to CMSIS USBD Keil driver.
const usb::device::Capabilities & do_get_capabilities(void) noexcept override
virtual usb::frame_number_t do_get_frame_number(void) noexcept override
virtual return_t do_disconnect(void) noexcept override
virtual return_t do_configure_address(usb::device_address_t dev_addr) noexcept override
virtual const Version & do_get_version(void) noexcept override
virtual return_t do_configure_endpoint(usb::endpoint_t ep_addr, usb::Endpoint_type ep_type, usb::packet_size_t ep_max_packet_size) noexcept override
virtual return_t do_abort_transfer(usb::endpoint_t ep_addr) noexcept override
virtual std::size_t do_get_transfer_count(usb::endpoint_t ep_addr) noexcept override
virtual return_t do_transfer(usb::endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept override
virtual return_t do_power(Power state) noexcept override
virtual return_t do_stall_endpoint(usb::endpoint_t ep_addr, bool stall) noexcept override
virtual return_t do_wakeup_remote(void) noexcept override
virtual return_t do_read_setup_packet(uint8_t *buf) noexcept override
usbd_wrapper(ARM_DRIVER_USBD *driver, ARM_USBD_SignalDeviceEvent_t c_cb_device_func, ARM_USBD_SignalEndpointEvent_t c_cb_endpoint_func) noexcept
int printf(const char *format,...)
Write a formatted string to the trace device.
Endpoint_type
Endpoint type.
void(* ARM_USBD_SignalEndpointEvent_t)(uint8_t ep_addr, uint32_t event)
Pointer to endpoint event callback.
void(* ARM_USBD_SignalDeviceEvent_t)(uint32_t event)
Pointer to device event callback.
struct _ARM_DRIVER_USBD const ARM_DRIVER_USBD