dxd - dynax driver framework  2675
cross platform open source driver development framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dxd::usb_stream Class Reference

generic USB device More...

#include <dxd_usb_stream.h>

+ Inheritance diagram for dxd::usb_stream:
+ Collaboration diagram for dxd::usb_stream:

Classes

class  stream
 USB stream. More...
 

Public Types

enum  speed {
  low =::kUSBHostConnectionSpeedLow, full =::kUSBHostConnectionSpeedFull, high =::kUSBHostConnectionSpeedHigh, usb1 =full,
  usb2 =high, low =::kUSBHostConnectionSpeedLow, full =::kUSBHostConnectionSpeedFull, high =::kUSBHostConnectionSpeedHigh,
  usb1 =full, usb2 =high
}
 
enum  speed {
  low =::kUSBHostConnectionSpeedLow, full =::kUSBHostConnectionSpeedFull, high =::kUSBHostConnectionSpeedHigh, usb1 =full,
  usb2 =high, low =::kUSBHostConnectionSpeedLow, full =::kUSBHostConnectionSpeedFull, high =::kUSBHostConnectionSpeedHigh,
  usb1 =full, usb2 =high
}
 

Public Member Functions

os_result clear ()
 
unsigned char configuration () const
 
os_result configuration (unsigned char configuration)
 
unsigned char configuration () const
 return available USB configurations More...
 
os_result configuration (unsigned char configuration)
 choose USB configuration More...
 
unsigned char configurations () const
 
unsigned char configurations () const
 return current USB configuration More...
 
struct dx::usb::descriptor::device descriptor () const
 IOKit: request the USB device descriptor. More...
 
template<class client_t = ::IOService, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t each_child (exec_arg_t exec_arg, exec_t exec)
 apply executor functor for each child More...
 
template<class client_t = ::IOUserClient, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t each_client (exec_arg_t exec_arg, exec_t exec)
 apply executor functor for each user client More...
 
uint64 frame () const
 
uint64_t frame () const
 
::IOUSBHostInterfaceinterface (unsigned char index, unsigned char setting=0)
 IOKit: USB interface. More...
 
const
::USBD_INTERFACE_INFORMATION * 
interface (unsigned char index, unsigned char setting=0)
 
template<typename tx_t , typename rx_t >
os_result ioctl (unsigned int ioctl, const tx_t &tx, rx_t &rx)
 convenience ioctl accessor for direct inter-kext IOCTL More...
 
os_result notify_clients ()
 
 operator const ::IOLock * () const
 
 operator::DEVICE_OBJECT * () const
 
 operator::IOLock * ()
 
 operator::IOUSBHostDevice * () const
 IOKit: IOUSBDevice* implicit cast. More...
 
template<typename type_t >
os_result property (const char *key, type_t &value) const
 provider property request More...
 
template<typename type_t >
os_result query (const char *key, type_t &value)
 device property request More...
 
template<>
os_result query (const char *key, unsigned int &value)
 (defined(doxygen)||defined(DXD_EXTERN)) More...
 
template<typename data_t >
os_result request (const dx::usb::control &control, data_t &data)
 IOKit: synchronously sends an USB request. More...
 
os_result request (const dx::usb::control &control, void *data, size_t &size)
 
template<typename data_t >
os_result request (const dx::usb::control &control, data_t &data)
 
os_result request (const dx::usb::control &control, void *data, size_t &size)
 
os_result set (const char *key, unsigned int value)
 
speed speed () const
 
speed speed () const
 
os_result state () const
 
os_result string (unsigned char idx, char *string, unsigned char &chars)
 IOKit: request the USB string descriptor for the index. More...
 
template<typename string_t >
os_result string (unsigned char idx, string_t &string)
 
os_result string (unsigned char idx, char *string, unsigned char &chars)
 
template<typename string_t >
os_result string (unsigned char idx, string_t &string)
 

Public Attributes

os_result status =not_initialized
 
scoped< streamstreams [0x20] {}
 

Protected Member Functions

void close_interfaces ()
 
void conclude () override
 IOKit: USB conclude. More...
 
void conclude () override
 WDK: USB device de-initialization callback. More...
 
os_result ioctl (unsigned int ioctl, const void *in, size_t size_in, void *out, size_t size_out, size_t &size) override
 usb IOCTL handler More...
 
os_result launch () override
 IOKit: USB launch. More...
 
os_result launch () override
 WDK: USB device initialization callback. More...
 
template<typename protocol_t >
os_result open (const dx::stream::open< protocol_t > &open, dxd::stream::opened< dx::circular > *opened, size_t &size)
 
os_result open_interfaces ()
 
os_result sleep () override
 device PNP sleep virtual method More...
 
bool start (::IOService *provider) override
 IOKit: USB start. More...
 
os_result wake () override
 device PNP wake virtual method More...
 

Detailed Description

generic USB device

Member Enumeration Documentation

enum dxd::usb_device::speed
inherited
Todo:
enum class
Enumerator
low 
full 
high 
usb1 
usb2 
low 
full 
high 
usb1 
usb2 
enum dxd::usb_device::speed
inherited
Enumerator
low 
full 
high 
usb1 
usb2 
low 
full 
high 
usb1 
usb2 

Member Function Documentation

os_result dxd::usb_device::clear ( )
inlineinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dxd::usb_device::close_interfaces ( )
inlineprotectedinherited

+ Here is the caller graph for this function:

void dxd::usb_device::conclude ( )
inlineoverrideprotectedvirtualinherited

IOKit: USB conclude.

This method:

  • iterates over and closes all USB interfaces
  • deselects USB configuration
  • closes the USB device from exclusive access
  • De-selects previosly selected USB configuration,
Todo:
investigate if reset() is still needed here
  • closes the USB device, so another driver has the chance to match against (important: this driver will not unload otherwise)

Reimplemented from dxd::device.

void dxd::usb_device::conclude ( )
inlineoverrideprotectedvirtualinherited

WDK: USB device de-initialization callback.

Reimplemented from dxd::device.

+ Here is the call graph for this function:

unsigned char dxd::usb_device::configuration ( ) const
inlineinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

os_result dxd::usb_device::configuration ( unsigned char  configuration)
inlineinherited

+ Here is the call graph for this function:

unsigned char dxd::usb_device::configuration ( ) const
inlineinherited

return available USB configurations

os_result dxd::usb_device::configuration ( unsigned char  configuration)
inlineinherited

choose USB configuration

removes interface cache

obtains the configuration descriptor,

obtains all descriptors,

enumerates interfaces in the configuration,

allocates and builds an URB for the select-configuration request,

creates interface cache

enumerates the pipes in the interface information array, which is now filled with pipe information.

+ Here is the call graph for this function:

unsigned char dxd::usb_device::configurations ( ) const
inlineinherited

+ Here is the call graph for this function:

unsigned char dxd::usb_device::configurations ( ) const
inlineinherited

return current USB configuration

struct dx::usb::descriptor::device dxd::usb_device::descriptor ( ) const
inlineinherited

IOKit: request the USB device descriptor.

Deprecated:

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class client_t = ::IOService, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t dxd::device::each_child ( exec_arg_t  exec_arg,
exec_t  exec 
)
inlineinherited

apply executor functor for each child

template<class client_t = ::IOUserClient, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t dxd::device::each_client ( exec_arg_t  exec_arg,
exec_t  exec 
)
inlineinherited

apply executor functor for each user client

uint64 dxd::usb_device::frame ( ) const
inlineinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t dxd::usb_device::frame ( ) const
inlineinherited

+ Here is the call graph for this function:

::IOUSBHostInterface* dxd::usb_device::interface ( unsigned char  index,
unsigned char  setting = 0 
)
inlineinherited

IOKit: USB interface.

Selects the USB interface

checks interface, if it fails: was it configured?

and selects the (alternate) setting

Parameters
indexindex of the USB interface in the USB configuration
settingsetting # of the USB interface

+ Here is the caller graph for this function:

const::USBD_INTERFACE_INFORMATION* dxd::usb_device::interface ( unsigned char  index,
unsigned char  setting = 0 
)
inlineinherited

disposes interface cache,

requests settings change,

creates and fills interface cache,

os_result dxd::usb_stream::ioctl ( unsigned int  ioctl,
const void *  in,
size_t  size_in,
void *  out,
size_t  size_out,
size_t &  size 
)
inlineoverrideprotectedvirtual

usb IOCTL handler

virtual ioctl() gets called by the dynax driver framework for usb device IOCTL handling.

implemented handler

checks endpoint address,

obtains stream index from endpoint address

checks if stream is opened;

detaches mapping from stream

checks endpoint address,

checks stream user mode mapping,

checks endpoint address,

checks stream user mode mapping,

  • dx::ioctl::stream::puid
    • out: USB serial number - if present
  • dx::usb::request - send generic USB request to device
  • dx::usb::descriptor - obtain generic USB device descriptor
    • in: none,
    • out: dx::usb::device_descriptor
  • dx::usb::string - obtain generic USB device string
    • in: (char) string index,
    • out: unsigned short[] unicode string from device
  • dx::usb::configuration - select/obtain USB configuration
    • in: optional (unsigned char) configuration,
    • out: optional (unsigned char) configuration,
Parameters
ioctlIOCTL
inbuffer pointer containing data from user mode
size_insize of the buffer containing data from user mode
outbuffer pointer accepting data to be returned to user mode
size_outsize of the buffer accepting data to be returned to user mode
sizeactual size of data to be returned to user mode

Reimplemented from dxd::device.

+ Here is the call graph for this function:

template<typename tx_t , typename rx_t >
os_result dxd::device::ioctl ( unsigned int  ioctl,
const tx_t &  tx,
rx_t &  rx 
)
inlineinherited

convenience ioctl accessor for direct inter-kext IOCTL

+ Here is the call graph for this function:

os_result dxd::usb_device::launch ( )
inlineoverrideprotectedvirtualinherited

IOKit: USB launch.

This method:

  • opens the USB device for exclusive access,
  • selects default USB configuration
  • iterates over and opens all USB interfaces

Reimplemented from dxd::device.

os_result dxd::usb_device::launch ( )
inlineoverrideprotectedvirtualinherited

WDK: USB device initialization callback.

obtain vage speed info

obtains the device descriptor,

and select USB configuration #1.

Reimplemented from dxd::device.

+ Here is the call graph for this function:

os_result dxd::device::notify_clients ( )
inlineinherited
template<typename protocol_t >
os_result dxd::usb_stream::open ( const dx::stream::open< protocol_t > &  open,
dxd::stream::opened< dx::circular > *  opened,
size_t &  size 
)
inlineprotected

checks endpoint address,

obtains stream index from endpoint address

opens device receiver endpoint and checks its status,

registers this client, and returns

  • kernel space address of shared buffer,
  • kernel data available event pointer
  • kernel backingstore space available pointer

+ Here is the call graph for this function:

os_result dxd::usb_device::open_interfaces ( )
inlineprotectedinherited

+ Here is the caller graph for this function:

dxd::mutex::operator const ::IOLock * ( ) const
inlineinherited
dxd::usb_device::operator::DEVICE_OBJECT * ( ) const
inlineinherited
dxd::mutex::operator::IOLock * ( )
inlineinherited
dxd::usb_device::operator::IOUSBHostDevice * ( ) const
inlineinherited

IOKit: IOUSBDevice* implicit cast.

template<typename type_t >
os_result dxd::device::property ( const char *  key,
type_t &  value 
) const
inlineinherited

provider property request

try if property is an OSString

or, try to get it as OSData

+ Here is the caller graph for this function:

template<typename type_t >
os_result dxd::device::query ( const char *  key,
type_t &  value 
)
inherited

device property request

device string property request

Todo:
move into property class

try if property is an OSString

get it as OSData

+ Here is the call graph for this function:

template<>
os_result dxd::device::query ( const char *  key,
unsigned int &  value 
)
inherited

(defined(doxygen)||defined(DXD_EXTERN))

device integer property request

template<typename data_t >
os_result dxd::usb_device::request ( const dx::usb::control control,
data_t &  data 
)
inlineinherited

IOKit: synchronously sends an USB request.

Todo:
USB device control request timeout
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive

+ Here is the caller graph for this function:

os_result dxd::usb_device::request ( const dx::usb::control control,
void *  data,
size_t &  size 
)
inlineinherited
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive
sizesize of the actual transaction

+ Here is the call graph for this function:

template<typename data_t >
os_result dxd::usb_device::request ( const dx::usb::control control,
data_t &  data 
)
inlineinherited
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive

+ Here is the call graph for this function:

os_result dxd::usb_device::request ( const dx::usb::control control,
void *  data,
size_t &  size 
)
inlineinherited
os_result dxd::device::set ( const char *  key,
unsigned int  value 
)
inlineinherited
os_result dxd::usb_stream::sleep ( )
inlineoverrideprotectedvirtual

device PNP sleep virtual method

virtual sleep() gets called by the dynax driver framework for device PNP sleep handling.

stops all endpoints

Reimplemented from dxd::device.

speed dxd::usb_device::speed ( ) const
inlineinherited
speed dxd::usb_device::speed ( ) const
inlineinherited
Todo:
implement WDK low/super speed check for dxd::usb_device.speed()
bool dxd::usb_device::start ( ::IOService *  provider)
inlineoverrideprotectedinherited

IOKit: USB start.

+ Here is the caller graph for this function:

os_result dxd::usb_device::state ( ) const
inlineinherited
Todo:
find out if isInactive() is equivalent to getState()

+ Here is the caller graph for this function:

os_result dxd::usb_device::string ( unsigned char  idx,
char *  string,
unsigned char &  chars 
)
inlineinherited

IOKit: request the USB string descriptor for the index.

Parameters
idxindex of the string to request
stringstring to request
charsnumber of characters returned

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename string_t >
os_result dxd::usb_device::string ( unsigned char  idx,
string_t &  string 
)
inlineinherited

+ Here is the call graph for this function:

os_result dxd::usb_device::string ( unsigned char  idx,
char *  string,
unsigned char &  chars 
)
inlineinherited
template<typename string_t >
os_result dxd::usb_device::string ( unsigned char  idx,
string_t &  string 
)
inlineinherited

+ Here is the call graph for this function:

os_result dxd::usb_stream::wake ( )
inlineoverrideprotectedvirtual

device PNP wake virtual method

virtual wake() gets called by the dynax driver framework for device PNP wake handling.

starts all endpoints

Reimplemented from dxd::device.

+ Here is the call graph for this function:

Member Data Documentation

os_result dxd::mutex::status =not_initialized
inherited
scoped<stream> dxd::usb_stream::streams[0x20] {}

list of open streams


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

(c) copyright 2009 dynamic acoustics e.U. generated on Tue Dec 4 2018

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.