30#include <Driver_USBH.h>
48 c_cb_port_func_ (c_cb_port_func),
49 c_cb_pipe_func_ (c_cb_pipe_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_USBH_CAPABILITIES*
> (&capa_)) =
81 driver_->GetCapabilities ();
89 *(
reinterpret_cast<ARM_USBH_PORT_STATE*
> (&status_)) =
90 driver_->PortGetState (port);
94#pragma GCC diagnostic pop
99 assert (driver_ !=
nullptr);
105 status = driver_->Initialize (c_cb_port_func_, c_cb_pipe_func_);
106 if (status != ARM_DRIVER_OK)
112 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
116 driver_->Uninitialize ();
125 return driver_->PortVbusOnOff (port, vbus);
131 return driver_->PortReset (port);
137 return driver_->PortSuspend (port);
143 return driver_->PortResume (port);
156 return driver_->PipeCreate (dev_addr, dev_speed, hub_addr, hub_port,
157 ep_addr, ep_type, ep_max_packet_size,
169 return driver_->PipeModify (pipe, dev_addr, dev_speed, hub_addr, hub_port,
176 return driver_->PipeDelete (pipe);
182 return driver_->PipeReset (pipe);
187 std::size_t num)
noexcept
189 return driver_->PipeTransfer (pipe, packet, data,
190 static_cast<uint32_t
> (num));
196 return driver_->PipeTransferGetResult (pipe);
202 return driver_->PipeTransferAbort (pipe);
208 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