15#include <Driver_USBD.h>
33 c_cb_device_func_ (c_cb_device_func),
34 c_cb_endpoint_func_ (c_cb_endpoint_func)
48#pragma GCC diagnostic push
50#elif defined(__GNUC__)
51#pragma GCC diagnostic ignored "-Waggregate-return"
53#pragma GCC diagnostic ignored "-Wstrict-aliasing"
59 *(
reinterpret_cast<ARM_DRIVER_VERSION*
> (&version_)) =
60 driver_->GetVersion ();
68 *(
reinterpret_cast<ARM_USBD_CAPABILITIES*
> (&capa_)) =
69 driver_->GetCapabilities ();
77 *(
reinterpret_cast<ARM_USBD_STATE*
> (&status_)) =
78 driver_->DeviceGetState ();
82#pragma GCC diagnostic pop
87 assert (driver_ !=
nullptr);
93 status = driver_->Initialize (c_cb_device_func_, c_cb_endpoint_func_);
94 if (status != ARM_DRIVER_OK)
100 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
104 driver_->Uninitialize ();
113 return driver_->DeviceConnect ();
119 return driver_->DeviceDisconnect ();
125 return driver_->DeviceRemoteWakeup ();
131 return driver_->DeviceSetAddress (dev_addr);
137 return driver_->ReadSetupPacket (buf);
143 return driver_->GetFrameNumber ();
151 return driver_->EndpointConfigure (ep_addr,
152 static_cast<uint8_t
> (ep_type),
159 return driver_->EndpointUnconfigure (ep_addr);
165 return driver_->EndpointStall (ep_addr, stall);
170 std::size_t num)
noexcept
172 return driver_->EndpointTransfer (ep_addr, data,
173 static_cast<uint32_t
> (num));
179 return driver_->EndpointTransferGetResult (ep_addr);
185 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