15#include <Driver_USBH.h>
33 c_cb_port_func_ (c_cb_port_func),
34 c_cb_pipe_func_ (c_cb_pipe_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_USBH_CAPABILITIES*
> (&capa_)) =
69 driver_->GetCapabilities ();
77 *(
reinterpret_cast<ARM_USBH_PORT_STATE*
> (&status_)) =
78 driver_->PortGetState (port);
82#pragma GCC diagnostic pop
87 assert (driver_ !=
nullptr);
93 status = driver_->Initialize (c_cb_port_func_, c_cb_pipe_func_);
94 if (status != ARM_DRIVER_OK)
100 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
104 driver_->Uninitialize ();
113 return driver_->PortVbusOnOff (port, vbus);
119 return driver_->PortReset (port);
125 return driver_->PortSuspend (port);
131 return driver_->PortResume (port);
144 return driver_->PipeCreate (dev_addr, dev_speed, hub_addr, hub_port,
145 ep_addr, ep_type, ep_max_packet_size,
157 return driver_->PipeModify (pipe, dev_addr, dev_speed, hub_addr, hub_port,
164 return driver_->PipeDelete (pipe);
170 return driver_->PipeReset (pipe);
175 std::size_t num)
noexcept
177 return driver_->PipeTransfer (pipe, packet, data,
178 static_cast<uint32_t
> (num));
184 return driver_->PipeTransferGetResult (pipe);
190 return driver_->PipeTransferAbort (pipe);
196 return driver_->GetFrameNumber ();
USB host driver capabilities.
virtual return_t do_transfer(usb::pipe_t pipe, uint32_t packet, uint8_t *data, std::size_t num) noexcept override
virtual return_t do_reset_pipe(usb::pipe_t pipe) noexcept override
virtual return_t do_modify_pipe(usb::pipe_t pipe, usb::device_address_t dev_addr, usb::speed_t dev_speed, usb::hub_addr_t hub_addr, usb::hub_port_t hub_port, usb::packet_size_t ep_max_packet_size) noexcept override
virtual ~usbh_wrapper() noexcept
virtual const usb::host::Capabilities & do_get_capabilities(void) noexcept override
virtual uint16_t do_get_frame_number(void) noexcept override
virtual const Version & do_get_version(void) noexcept override
virtual usb::pipe_t do_create_pipe(usb::device_address_t dev_addr, usb::speed_t dev_speed, usb::hub_addr_t hub_addr, usb::hub_port_t hub_port, usb::endpoint_t ep_addr, usb::endpoint_type_t ep_type, usb::packet_size_t ep_max_packet_size, usb::polling_interval_t ep_interval) noexcept override
virtual return_t do_power_port_vbus(usb::port_t port, bool vbus) noexcept override
virtual std::size_t do_get_transfer_count(usb::pipe_t pipe) noexcept override
virtual return_t do_power(Power state) noexcept override
virtual return_t do_suspend_port(usb::port_t port) noexcept override
virtual return_t do_delete_pipe(usb::pipe_t pipe) noexcept override
ARM_DRIVER_USBH * driver_
Pointer to CMSIS USBD Keil driver.
virtual return_t do_reset_port(usb::port_t port) noexcept override
virtual return_t do_resume_port(usb::port_t port) noexcept override
virtual return_t do_abort_transfer(usb::pipe_t pipe) noexcept override
usbh_wrapper(ARM_DRIVER_USBH *driver, ARM_USBH_SignalPortEvent_t c_cb_port_func, ARM_USBH_SignalPipeEvent_t c_cb_pipe_func) noexcept
virtual usb::host::Status & do_get_port_status(usb::port_t port) noexcept override
int printf(const char *format,...)
Write a formatted string to the trace device.
uint8_t polling_interval_t
void(* ARM_USBH_SignalPipeEvent_t)(ARM_USBH_PIPE_HANDLE pipe_hndl, uint32_t event)
Pointer to pipe event callback.
void(* ARM_USBH_SignalPortEvent_t)(uint8_t port, uint32_t event)
Pointer to port event callback.
struct _ARM_DRIVER_USBH const ARM_DRIVER_USBH