µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::driver::usb::Device Class Referenceabstract

#include <usb-device.h>

+ Inheritance diagram for os::driver::usb::Device:

Public Member Functions

 Device () noexcept
 
 Device (const Device &)=delete
 
 Device (Device &&)=delete
 
virtual ~Device () noexcept override
 
return_t abort_transfer (endpoint_t ep_addr) noexcept
 Abort current USB Endpoint transfer.
 
return_t configure_address (device_address_t dev_addr) noexcept
 Set USB Device Address.
 
return_t configure_endpoint (endpoint_t ep_addr, Endpoint_type ep_type, packet_size_t ep_max_packet_size) noexcept
 Configure USB Endpoint.
 
return_t connect (void) noexcept
 Connect USB Device.
 
return_t disconnect (void) noexcept
 Disconnect USB Device.
 
const device::Capabilitiesget_capabilities (void) noexcept
 Get driver capabilities.
 
frame_number_t get_frame_number (void) noexcept
 Get current USB Frame Number.
 
device::Statusget_status (void) noexcept
 Get current USB Device Status.
 
std::size_t get_transfer_count (endpoint_t ep_addr) noexcept
 Get result of USB Endpoint transfer.
 
const Versionget_version (void) noexcept
 Get driver version.
 
Deviceoperator= (const Device &)=delete
 
Deviceoperator= (Device &&)=delete
 
return_t power (Power state) noexcept
 Power up/down device.
 
return_t read_setup_packet (uint8_t *buf) noexcept
 Read setup packet received over Control Endpoint.
 
void register_device_callback (device::signal_device_event_t cb_func, const void *cb_object=nullptr) noexcept
 Register device event callback.
 
void register_endpoint_callback (device::signal_endpoint_event_t cb_func, const void *cb_object=nullptr) noexcept
 
void signal_device_event (event_t event) noexcept
 Signal device events.
 
void signal_endpoint_event (endpoint_t ep_addr, event_t event) noexcept
 Signal USB Endpoint Event.
 
return_t stall_endpoint (endpoint_t ep_addr, bool stall) noexcept
 Set/Clear Stall for USB Endpoint.
 
return_t transfer (endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept
 Read data from or Write data to USB Endpoint.
 
return_t unconfigure_endpoint (endpoint_t ep_addr) noexcept
 Unconfigure USB Endpoint.
 
return_t wakeup_remote (void) noexcept
 Trigger USB Remote Wakeup.
 

Protected Member Functions

virtual return_t do_abort_transfer (endpoint_t ep_addr) noexcept=0
 
virtual return_t do_configure_address (device_address_t dev_addr) noexcept=0
 
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_connect (void) noexcept=0
 
virtual return_t do_disconnect (void) noexcept=0
 
virtual const device::Capabilitiesdo_get_capabilities (void) noexcept=0
 
virtual frame_number_t do_get_frame_number (void) noexcept=0
 
virtual device::Statusdo_get_status (void) noexcept=0
 
virtual std::size_t do_get_transfer_count (endpoint_t ep_addr) noexcept=0
 
virtual const Versiondo_get_version (void) noexcept=0
 
virtual return_t do_power (Power state) noexcept=0
 
virtual return_t do_read_setup_packet (uint8_t *buf) noexcept=0
 
virtual return_t do_stall_endpoint (endpoint_t ep_addr, bool stall) noexcept=0
 
virtual return_t do_transfer (endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept=0
 
virtual return_t do_unconfigure_endpoint (endpoint_t ep_addr) noexcept=0
 
virtual return_t do_wakeup_remote (void) noexcept=0
 

Protected Attributes

device::Status status_
 

Private Attributes

device::signal_device_event_t cb_device_func_
 Pointer to static function that implements the device callback.
 
const void * cb_device_object_
 Pointer to object instance associated with the device 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.
 

Detailed Description

Definition at line 203 of file usb-device.h.

Constructor & Destructor Documentation

◆ Device() [1/3]

os::driver::usb::Device::Device ( )
noexcept

Definition at line 54 of file usb-device.cpp.

◆ Device() [2/3]

os::driver::usb::Device::Device ( const Device )
delete

◆ Device() [3/3]

os::driver::usb::Device::Device ( Device &&  )
delete

◆ ~Device()

os::driver::usb::Device::~Device ( )
overridevirtualnoexcept

Definition at line 65 of file usb-device.cpp.

Member Function Documentation

◆ abort_transfer()

return_t os::driver::usb::Device::abort_transfer ( endpoint_t  ep_addr)
inlinenoexcept

Abort current USB Endpoint transfer.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
Returns
Execution status.

Definition at line 555 of file usb-device.h.

◆ configure_address()

return_t os::driver::usb::Device::configure_address ( device_address_t  dev_addr)
inlinenoexcept

Set USB Device Address.

Parameters
[in]dev_addrDevice Address
Returns
Execution status.

Definition at line 518 of file usb-device.h.

◆ configure_endpoint()

return_t os::driver::usb::Device::configure_endpoint ( endpoint_t  ep_addr,
Endpoint_type  ep_type,
packet_size_t  ep_max_packet_size 
)
inlinenoexcept

Configure USB Endpoint.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
[in]ep_typeEndpoint Type (ARM_USB_ENDPOINT_xxx)
[in]ep_max_packet_sizeEndpoint Maximum Packet Size
Returns
Execution status.

Definition at line 530 of file usb-device.h.

◆ connect()

return_t os::driver::usb::Device::connect ( void  )
inlinenoexcept

Connect USB Device.

Returns
Execution status.

Definition at line 500 of file usb-device.h.

◆ disconnect()

return_t os::driver::usb::Device::disconnect ( void  )
inlinenoexcept

Disconnect USB Device.

Returns
Execution status.

Definition at line 506 of file usb-device.h.

◆ do_abort_transfer()

virtual return_t os::driver::usb::Device::do_abort_transfer ( endpoint_t  ep_addr)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_configure_address()

virtual return_t os::driver::usb::Device::do_configure_address ( device_address_t  dev_addr)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_configure_endpoint()

virtual return_t os::driver::usb::Device::do_configure_endpoint ( endpoint_t  ep_addr,
Endpoint_type  ep_type,
packet_size_t  ep_max_packet_size 
)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_connect()

virtual return_t os::driver::usb::Device::do_connect ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_disconnect()

virtual return_t os::driver::usb::Device::do_disconnect ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_get_capabilities()

virtual const device::Capabilities & os::driver::usb::Device::do_get_capabilities ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_get_frame_number()

virtual frame_number_t os::driver::usb::Device::do_get_frame_number ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_get_status()

virtual device::Status & os::driver::usb::Device::do_get_status ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_get_transfer_count()

virtual std::size_t os::driver::usb::Device::do_get_transfer_count ( endpoint_t  ep_addr)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_get_version()

virtual const Version & os::driver::Base::do_get_version ( void  )
protectedpure virtualnoexceptinherited

◆ do_power()

virtual return_t os::driver::Base::do_power ( Power  state)
protectedpure virtualnoexceptinherited

◆ do_read_setup_packet()

virtual return_t os::driver::usb::Device::do_read_setup_packet ( uint8_t *  buf)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_stall_endpoint()

virtual return_t os::driver::usb::Device::do_stall_endpoint ( endpoint_t  ep_addr,
bool  stall 
)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_transfer()

virtual return_t os::driver::usb::Device::do_transfer ( endpoint_t  ep_addr,
uint8_t *  data,
std::size_t  num 
)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_unconfigure_endpoint()

virtual return_t os::driver::usb::Device::do_unconfigure_endpoint ( endpoint_t  ep_addr)
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ do_wakeup_remote()

virtual return_t os::driver::usb::Device::do_wakeup_remote ( void  )
protectedpure virtualnoexcept

Implemented in os::driver::usbd_wrapper.

◆ get_capabilities()

const device::Capabilities & os::driver::usb::Device::get_capabilities ( void  )
inlinenoexcept

Get driver capabilities.

Returns
Capabilities.

Definition at line 488 of file usb-device.h.

◆ get_frame_number()

frame_number_t os::driver::usb::Device::get_frame_number ( void  )
inlinenoexcept

Get current USB Frame Number.

Returns
Frame Number

Definition at line 524 of file usb-device.h.

◆ get_status()

device::Status & os::driver::usb::Device::get_status ( void  )
inlinenoexcept

Get current USB Device Status.

Returns
Device State.

Definition at line 494 of file usb-device.h.

◆ get_transfer_count()

std::size_t os::driver::usb::Device::get_transfer_count ( endpoint_t  ep_addr)
inlinenoexcept

Get result of USB Endpoint transfer.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
Returns
number of successfully transferred data bytes

Definition at line 549 of file usb-device.h.

◆ get_version()

const Version & os::driver::Base::get_version ( void  )
inlinenoexceptinherited

Get driver version.

Returns
Version.

Definition at line 213 of file common.h.

◆ operator=() [1/2]

Device & os::driver::usb::Device::operator= ( const Device )
delete

◆ operator=() [2/2]

Device & os::driver::usb::Device::operator= ( Device &&  )
delete

◆ power()

return_t os::driver::Base::power ( Power  state)
inlinenoexceptinherited

Power up/down device.

Parameters
[in]statePower state
Returns
Execution status

Definition at line 219 of file common.h.

◆ read_setup_packet()

return_t os::driver::usb::Device::read_setup_packet ( uint8_t *  buf)
noexcept

Read setup packet received over Control Endpoint.

Parameters
[out]bufPointer to buffer for setup packet
Returns
Execution status.

Definition at line 89 of file usb-device.cpp.

◆ register_device_callback()

void os::driver::usb::Device::register_device_callback ( device::signal_device_event_t  cb_func,
const void *  cb_object = nullptr 
)
noexcept

Register device event callback.

Parameters
[in]cb_funcPointer to function.
[in]cb_objectPointer to object passed to the function.
Returns
Nothing.

Definition at line 71 of file usb-device.cpp.

◆ register_endpoint_callback()

void os::driver::usb::Device::register_endpoint_callback ( device::signal_endpoint_event_t  cb_func,
const void *  cb_object = nullptr 
)
noexcept

Definition at line 79 of file usb-device.cpp.

◆ signal_device_event()

void os::driver::usb::Device::signal_device_event ( event_t  event)
noexcept

Signal device events.

Parameters
[in]eventEvent.
Returns
Nothing.

Definition at line 109 of file usb-device.cpp.

◆ signal_endpoint_event()

void os::driver::usb::Device::signal_endpoint_event ( endpoint_t  ep_addr,
event_t  event 
)
noexcept

Signal USB Endpoint Event.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
[in]eventEvent.
Returns
Nothing.

Definition at line 119 of file usb-device.cpp.

◆ stall_endpoint()

return_t os::driver::usb::Device::stall_endpoint ( endpoint_t  ep_addr,
bool  stall 
)
inlinenoexcept

Set/Clear Stall for USB Endpoint.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
[in]stallOperation
  • false Clear
  • true Set
Returns
Execution status.

Definition at line 543 of file usb-device.h.

◆ transfer()

return_t os::driver::usb::Device::transfer ( endpoint_t  ep_addr,
uint8_t *  data,
std::size_t  num 
)
noexcept

Read data from or Write data to USB Endpoint.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
[out]dataPointer to buffer for data to read or with data to write
[in]numNumber of data bytes to transfer
Returns
Execution status.

Definition at line 96 of file usb-device.cpp.

◆ unconfigure_endpoint()

return_t os::driver::usb::Device::unconfigure_endpoint ( endpoint_t  ep_addr)
inlinenoexcept

Unconfigure USB Endpoint.

Parameters
[in]ep_addrEndpoint Address
  • ep_addr.0..3: Address
  • ep_addr.7: Direction
Returns
Execution status.

Definition at line 537 of file usb-device.h.

◆ wakeup_remote()

return_t os::driver::usb::Device::wakeup_remote ( void  )
inlinenoexcept

Trigger USB Remote Wakeup.

Returns
Execution status.

Definition at line 512 of file usb-device.h.

Member Data Documentation

◆ cb_device_func_

device::signal_device_event_t os::driver::usb::Device::cb_device_func_
private

Pointer to static function that implements the device callback.

Definition at line 440 of file usb-device.h.

◆ cb_device_object_

const void* os::driver::usb::Device::cb_device_object_
private

Pointer to object instance associated with the device callback.

Definition at line 443 of file usb-device.h.

◆ cb_endpoint_func_

device::signal_endpoint_event_t os::driver::usb::Device::cb_endpoint_func_
private

Pointer to static function that implements the endpoint callback.

Definition at line 446 of file usb-device.h.

◆ cb_endpoint_object_

const void* os::driver::usb::Device::cb_endpoint_object_
private

Pointer to object instance associated with the endpoint callback.

Definition at line 449 of file usb-device.h.

◆ status_

device::Status os::driver::usb::Device::status_
protected

Definition at line 453 of file usb-device.h.


The documentation for this class was generated from the following files: