18#ifndef CMSIS_PLUS_DRIVER_USB_DEVICE_H_
19#define CMSIS_PLUS_DRIVER_USB_DEVICE_H_
35#pragma GCC diagnostic push
37#pragma clang diagnostic ignored "-Wc++98-compat"
52#pragma GCC diagnostic push
54#pragma clang diagnostic ignored "-Wpadded"
55#elif defined(__GNUC__)
56#pragma GCC diagnostic ignored "-Wpadded"
78#pragma GCC diagnostic pop
83#pragma GCC diagnostic push
85#pragma clang diagnostic ignored "-Wpadded"
86#elif defined(__GNUC__)
87#pragma GCC diagnostic ignored "-Wpadded"
121#pragma GCC diagnostic pop
185#pragma GCC diagnostic push
186#if defined(__clang__)
187#pragma clang diagnostic ignored "-Wpadded"
188#elif defined(__GNUC__)
189#pragma GCC diagnostic ignored "-Wpadded"
212 virtual ~Device () noexcept override;
225 const
void* cb_object =
nullptr) noexcept;
229 const
void* cb_object =
nullptr) noexcept;
237 const device::Capabilities&
382 virtual const device::Capabilities&
394 virtual device::Status&
429 std::
size_t num) noexcept
457#pragma GCC diagnostic pop
467 Status::is_vbus_on (
void)
const noexcept
473 Status::get_speed (
void)
const noexcept
479 Status::is_active (
void)
const noexcept
565#pragma GCC diagnostic pop
virtual return_t do_stall_endpoint(endpoint_t ep_addr, bool stall) noexcept=0
virtual return_t do_configure_address(device_address_t dev_addr) noexcept=0
virtual std::size_t do_get_transfer_count(endpoint_t ep_addr) noexcept=0
void signal_endpoint_event(endpoint_t ep_addr, event_t event) noexcept
Signal USB Endpoint Event.
return_t connect(void) noexcept
Connect USB Device.
virtual const device::Capabilities & do_get_capabilities(void) noexcept=0
return_t unconfigure_endpoint(endpoint_t ep_addr) noexcept
Unconfigure USB Endpoint.
virtual return_t do_wakeup_remote(void) noexcept=0
virtual return_t do_unconfigure_endpoint(endpoint_t ep_addr) noexcept=0
std::size_t get_transfer_count(endpoint_t ep_addr) noexcept
Get result of USB Endpoint transfer.
virtual ~Device() noexcept override
void signal_device_event(event_t event) noexcept
Signal device events.
virtual frame_number_t do_get_frame_number(void) noexcept=0
device::signal_device_event_t cb_device_func_
Pointer to static function that implements the device callback.
return_t wakeup_remote(void) noexcept
Trigger USB Remote Wakeup.
return_t read_setup_packet(uint8_t *buf) noexcept
Read setup packet received over Control Endpoint.
const device::Capabilities & get_capabilities(void) noexcept
Get driver capabilities.
virtual return_t do_transfer(endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept=0
virtual return_t do_connect(void) noexcept=0
Device & operator=(const Device &)=delete
virtual return_t do_abort_transfer(endpoint_t ep_addr) noexcept=0
return_t transfer(endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept
Read data from or Write data to USB Endpoint.
void register_device_callback(device::signal_device_event_t cb_func, const void *cb_object=nullptr) noexcept
Register device event callback.
device::signal_endpoint_event_t cb_endpoint_func_
Pointer to static function that implements the endpoint callback.
const void * cb_endpoint_object_
Pointer to object instance associated with the endpoint callback.
virtual return_t do_configure_endpoint(endpoint_t ep_addr, Endpoint_type ep_type, packet_size_t ep_max_packet_size) noexcept=0
virtual return_t do_read_setup_packet(uint8_t *buf) noexcept=0
virtual return_t do_disconnect(void) noexcept=0
return_t configure_address(device_address_t dev_addr) noexcept
Set USB Device Address.
return_t disconnect(void) noexcept
Disconnect USB Device.
frame_number_t get_frame_number(void) noexcept
Get current USB Frame Number.
void register_endpoint_callback(device::signal_endpoint_event_t cb_func, const void *cb_object=nullptr) noexcept
return_t abort_transfer(endpoint_t ep_addr) noexcept
Abort current USB Endpoint transfer.
const void * cb_device_object_
Pointer to object instance associated with the device callback.
return_t configure_endpoint(endpoint_t ep_addr, Endpoint_type ep_type, packet_size_t ep_max_packet_size) noexcept
Configure USB Endpoint.
device::Status & get_status(void) noexcept
Get current USB Device Status.
virtual device::Status & do_get_status(void) noexcept=0
Device(const Device &)=delete
return_t stall_endpoint(endpoint_t ep_addr, bool stall) noexcept
Set/Clear Stall for USB Endpoint.
USB device driver capabilities.
bool event_vbus_off
Signal VBUS Off event.
bool vbus_detection
VBUS detection.
bool event_vbus_on
Signal VBUS On event.
speed_t get_speed(void) const noexcept
speed_t speed
USB Device speed setting (ARM_USB_SPEED_xxx).
bool is_vbus_on(void) const noexcept
bool active
USB Device active flag.
bool is_active(void) const noexcept
bool vbus
USB Device VBUS flag.
void(* signal_endpoint_event_t)(const void *object, endpoint_t ep_addr, event_t event)
Endpoint_event
USB Device Endpoint Events.
Device_event
USB Device Events.
@ vbus_on
USB Device VBUS On.
@ high_speed
USB switch to High Speed occurred.
@ suspend
USB Suspend occurred.
@ reset
USB Reset occurred.
@ vbus_off
USB Device VBUS Off.
@ resume
USB Resume occurred.
void(* signal_device_event_t)(const void *object, event_t event)
Endpoint_type
Endpoint type.