ArmSys Support
ArmsysApi  0.12.18

#include <BUsbSerial.h>

Inheritance diagram for BUsbSerial:
BComms BUsbSerialLock

Public Member Functions

 BUsbSerial (BUInt rxFifoSize=512, BUInt txFifoSize=512)
 
BError init (BUsbType type=BUsbTypeFullSpeed, BUsbConfig *usbConfig=0)
 Initialise with optional config params. More...
 
void setMaximumUsbChunk (BUInt usbChunkSize)
 Sets the maximum USB tranmitted chunk size. More...
 
void close ()
 Close down the USB interface. More...
 
void setBlocking (Bool on)
 Enable blocking mode. More...
 
void setSync (Bool on)
 Set synchronous mode for writes. More...
 
void start ()
 Start processing. More...
 
int printf (const char *fmt,...)
 
int printfv (const char *fmt, va_list args)
 
BUInt writeAvailable ()
 How much write space is available. More...
 
BError write (const void *data, BUInt32 nBytes, BUInt32 &nWritten)
 Write a set of data. More...
 
BUInt readAvailable ()
 How many bytes of read data is available. More...
 
BError read (void *data, BUInt32 nBytes, BUInt32 &nRead)
 Read the data. More...
 
BError wait (BUInt32 eventSet, BTimeout timeoutUs=BTimeoutForever, BUInt32 num=1)
 
BError usbdInitHardware ()
 
BError usbdInitUsbDev (USBD_HandleTypeDef *pdev)
 
BUInt8 usbdInit (USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
 
void usbdStarted ()
 The USB device is connected and running. More...
 
BUInt8 usbdDeInit (USBD_HandleTypeDef *pdev, BUInt8 cfgidx)
 
BUInt8 usbdSetup (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
 
void usbdTx ()
 Data to USB stack. More...
 
BUInt8 usbdTxComplete ()
 Data has been sent. More...
 
int usbdRx (USBD_HandleTypeDef *pdev, BUInt len)
 Data from USB stack. More...
 
void usbdInterrupt ()
 
- Public Member Functions inherited from BComms
 BComms ()
 
virtual ~BComms ()
 
virtual BError init ()
 
virtual const char * name ()
 The name of this interface. More...
 
virtual BUInt32 byteRate ()
 The byte rate of this interface. More...
 
virtual BError setPacketMode (Bool packetMode)
 Set packet mode. More...
 
virtual Bool packetMode ()
 Device is in packet mode. More...
 
virtual BError setTimeout (BTimeout timeoutUs)
 Set communication timeout. More...
 
virtual BError connect (const char *resource)
 Create a connection. More...
 
virtual Bool isConnected ()
 
virtual BError disconnect ()
 Disconnect. More...
 
virtual void flush (Flush flush)
 
virtual BError writeChunks (const BDataChunk *chunks, BUInt nChunks, BUInt32 &nTrans)
 
virtual void eventQueue (BEventQueue *eventQueue, BUInt32 event, BUInt32 eventSet, BUInt num=1)
 
virtual void eventEnable (Bool on)
 Enable events to be sent. More...
 

Private Attributes

BFifo< char > otxFifo
 The transmit fifo. More...
 
BFifo< char > orxFifo
 The receive fifo. More...
 
Bool ohighSpeed
 High speed USB. More...
 
BUInt opacketSize
 The maximum packet size. More...
 
Bool oinitialised
 The USB device has initialised. More...
 
Bool oconnected
 The USB is connected. More...
 
BSemaphore owait
 Read wait semaphore. More...
 
BUInt owaitReadNum
 The number of bytes to wait for. More...
 
Bool oblocking
 Device set to block on writes. More...
 
Bool osync
 Device set to wait for writes. More...
 
USBD_HandleTypeDef ousbDev
 The USB device. More...
 
PCD_HandleTypeDef ohpcd
 The USB PCD layer. More...
 
Bool otxSending
 USB is transmitting. More...
 
int otxSendLen
 The length of data sent. More...
 
char orxBuffer [512]
 Receive packet buffer. More...
 
Bool orxStalled
 Receive has stalled as no room in buffer. More...
 
BUInt ousbChunkSize
 The maximum USB chunk size. More...
 

Additional Inherited Members

- Public Types inherited from BComms
enum  Flush { FlushRead, FlushWrite, FlushReadWrite }
 
- Protected Attributes inherited from BComms
Bool oconnected
 
Bool opacketMode
 
BTimeout otimeout
 
BEventQueueoeventQueue
 
Bool oeventEnabled
 
BUInt32 oevent
 
BUInt32 oeventSet
 
BUInt oeventNum
 

Constructor & Destructor Documentation

◆ BUsbSerial()

BUsbSerial::BUsbSerial ( BUInt  rxFifoSize = 512,
BUInt  txFifoSize = 512 
)

Member Function Documentation

◆ close()

void BUsbSerial::close ( )
virtual

Close down the USB interface.

Reimplemented from BComms.

◆ init()

BError BUsbSerial::init ( BUsbType  type = BUsbTypeFullSpeed,
BUsbConfig usbConfig = 0 
)

Initialise with optional config params.

◆ printf()

int BUsbSerial::printf ( const char *  fmt,
  ... 
)

◆ printfv()

int BUsbSerial::printfv ( const char *  fmt,
va_list  args 
)

◆ read()

BError BUsbSerial::read ( void *  data,
BUInt32  nBytes,
BUInt32 nRead 
)
virtual

Read the data.

Implements BComms.

Reimplemented in BUsbSerialLock.

◆ readAvailable()

BUInt BUsbSerial::readAvailable ( )
virtual

How many bytes of read data is available.

Reimplemented from BComms.

Reimplemented in BUsbSerialLock.

◆ setBlocking()

void BUsbSerial::setBlocking ( Bool  on)

Enable blocking mode.

◆ setMaximumUsbChunk()

void BUsbSerial::setMaximumUsbChunk ( BUInt  usbChunkSize)

Sets the maximum USB tranmitted chunk size.

◆ setSync()

void BUsbSerial::setSync ( Bool  on)

Set synchronous mode for writes.

◆ start()

void BUsbSerial::start ( )

Start processing.

◆ usbdDeInit()

BUInt8 BUsbSerial::usbdDeInit ( USBD_HandleTypeDef *  pdev,
BUInt8  cfgidx 
)

◆ usbdInit()

BUInt8 BUsbSerial::usbdInit ( USBD_HandleTypeDef *  pdev,
BUInt8  cfgidx 
)

◆ usbdInitHardware()

BError BUsbSerial::usbdInitHardware ( )

◆ usbdInitUsbDev()

BError BUsbSerial::usbdInitUsbDev ( USBD_HandleTypeDef *  pdev)

◆ usbdInterrupt()

void BUsbSerial::usbdInterrupt ( void  )

◆ usbdRx()

int BUsbSerial::usbdRx ( USBD_HandleTypeDef *  pdev,
BUInt  len 
)

Data from USB stack.

◆ usbdSetup()

BUInt8 BUsbSerial::usbdSetup ( USBD_HandleTypeDef *  pdev,
USBD_SetupReqTypedef *  req 
)

◆ usbdStarted()

void BUsbSerial::usbdStarted ( )

The USB device is connected and running.

◆ usbdTx()

void BUsbSerial::usbdTx ( )

Data to USB stack.

◆ usbdTxComplete()

BUInt8 BUsbSerial::usbdTxComplete ( )

Data has been sent.

◆ wait()

BError BUsbSerial::wait ( BUInt32  eventSet,
BTimeout  timeoutUs = BTimeoutForever,
BUInt32  num = 1 
)
virtual

Reimplemented from BComms.

◆ write()

BError BUsbSerial::write ( const void *  data,
BUInt32  nBytes,
BUInt32 nWritten 
)
virtual

Write a set of data.

Implements BComms.

Reimplemented in BUsbSerialLock.

◆ writeAvailable()

BUInt BUsbSerial::writeAvailable ( )
virtual

How much write space is available.

Reimplemented from BComms.

Reimplemented in BUsbSerialLock.

Member Data Documentation

◆ oblocking

Bool BUsbSerial::oblocking
private

Device set to block on writes.

◆ oconnected

Bool BUsbSerial::oconnected
private

The USB is connected.

◆ ohighSpeed

Bool BUsbSerial::ohighSpeed
private

High speed USB.

◆ ohpcd

PCD_HandleTypeDef BUsbSerial::ohpcd
private

The USB PCD layer.

◆ oinitialised

Bool BUsbSerial::oinitialised
private

The USB device has initialised.

◆ opacketSize

BUInt BUsbSerial::opacketSize
private

The maximum packet size.

◆ orxBuffer

char BUsbSerial::orxBuffer[512]
private

Receive packet buffer.

◆ orxFifo

BFifo<char> BUsbSerial::orxFifo
private

The receive fifo.

◆ orxStalled

Bool BUsbSerial::orxStalled
private

Receive has stalled as no room in buffer.

◆ osync

Bool BUsbSerial::osync
private

Device set to wait for writes.

◆ otxFifo

BFifo<char> BUsbSerial::otxFifo
private

The transmit fifo.

◆ otxSending

Bool BUsbSerial::otxSending
private

USB is transmitting.

◆ otxSendLen

int BUsbSerial::otxSendLen
private

The length of data sent.

◆ ousbChunkSize

BUInt BUsbSerial::ousbChunkSize
private

The maximum USB chunk size.

◆ ousbDev

USBD_HandleTypeDef BUsbSerial::ousbDev
private

The USB device.

◆ owait

BSemaphore BUsbSerial::owait
private

Read wait semaphore.

◆ owaitReadNum

BUInt BUsbSerial::owaitReadNum
private

The number of bytes to wait for.


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