USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BulkOnly Class Reference

#include <masstorage.h>

Inheritance diagram for BulkOnly:
Inheritance graph
[legend]
Collaboration diagram for BulkOnly:
Collaboration graph
[legend]

Public Member Functions

 BulkOnly (USB *p)
 
uint8_t GetLastUsbError ()
 
uint8_t GetbMaxLUN ()
 
uint8_t GetbTheLUN ()
 
boolean WriteProtected (uint8_t lun)
 
uint8_t MediaCTL (uint8_t lun, uint8_t ctl)
 
uint8_t Read (uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)
 
uint8_t Read (uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)
 
uint8_t Write (uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t *buf)
 
uint8_t LockMedia (uint8_t lun, uint8_t lock)
 
bool LUNIsGood (uint8_t lun)
 
uint32_t GetCapacity (uint8_t lun)
 
uint16_t GetSectorSize (uint8_t lun)
 
virtual uint8_t Init (uint8_t parent, uint8_t port, bool lowspeed)
 
virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed)
 
virtual uint8_t Release ()
 
virtual uint8_t Poll ()
 
virtual uint8_t GetAddress ()
 
virtual void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
 
virtual boolean DEVCLASSOK (uint8_t klass)
 
- Public Member Functions inherited from USBDeviceConfig
virtual void ResetHubPort (uint8_t port)
 
virtual boolean VIDPIDOK (uint16_t vid, uint16_t pid)
 

Protected Member Functions

void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
 
virtual uint8_t OnInit ()
 

Protected Attributes

USBpUsb
 
uint8_t bAddress
 
uint8_t bConfNum
 
uint8_t bIface
 
uint8_t bNumEP
 
uint32_t qNextPollTime
 
bool bPollEnable
 
EpInfo epInfo [MASS_MAX_ENDPOINTS]
 
uint32_t dCBWTag
 
uint32_t dCBWDataTransferLength
 
uint8_t bLastUsbError
 
uint8_t bMaxLUN
 
uint8_t bTheLUN
 
uint32_t CurrentCapacity [MASS_MAX_SUPPORTED_LUN]
 
uint16_t CurrentSectorSize [MASS_MAX_SUPPORTED_LUN]
 
bool LUNOk [MASS_MAX_SUPPORTED_LUN]
 
bool WriteOk [MASS_MAX_SUPPORTED_LUN]
 

Static Protected Attributes

static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 

Detailed Description

Definition at line 206 of file masstorage.h.

Constructor & Destructor Documentation

BulkOnly::BulkOnly ( USB p)

Definition at line 241 of file masstorage.cpp.

Member Function Documentation

void BulkOnly::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTOR ep_ptr)
protected
Parameters
ep_ptr

Definition at line 1298 of file masstorage.cpp.

virtual uint8_t BulkOnly::OnInit ( )
inlineprotectedvirtual

Definition at line 236 of file masstorage.h.

uint8_t BulkOnly::GetLastUsbError ( )
inline

Definition at line 242 of file masstorage.h.

uint8_t BulkOnly::GetbMaxLUN ( )
inline

Definition at line 246 of file masstorage.h.

uint8_t BulkOnly::GetbTheLUN ( )
inline

Definition at line 250 of file masstorage.h.

boolean BulkOnly::WriteProtected ( uint8_t  lun)

Test if LUN is write protected

Parameters
lunLogical Unit Number
Returns
cached status of write protect switch

Definition at line 53 of file masstorage.cpp.

uint8_t BulkOnly::MediaCTL ( uint8_t  lun,
uint8_t  ctl 
)

Media control, for spindle motor and media tray or door. This includes CDROM, TAPE and anything with a media loader.

Parameters
lunLogical Unit Number
ctl0x00 Stop Motor, 0x01 Start Motor, 0x02 Eject Media, 0x03 Load Media
Returns
0 on success

Definition at line 97 of file masstorage.cpp.

uint8_t BulkOnly::Read ( uint8_t  lun,
uint32_t  addr,
uint16_t  bsize,
uint8_t  blocks,
uint8_t *  buf 
)

Read data from media

Parameters
lunLogical Unit Number
addrLBA address on media to read
bsizesize of a block (we should probably use the cached size)
blockshow many blocks to read
bufmemory that is able to hold the requested data
Returns
0 on success

Definition at line 134 of file masstorage.cpp.

uint8_t BulkOnly::Read ( uint8_t  lun,
uint32_t  addr,
uint16_t  bsize,
uint8_t  blocks,
USBReadParser prs 
)

Definition at line 1326 of file masstorage.cpp.

uint8_t BulkOnly::Write ( uint8_t  lun,
uint32_t  addr,
uint16_t  bsize,
uint8_t  blocks,
const uint8_t *  buf 
)

Write data to media

Parameters
lunLogical Unit Number
addrLBA address on media to write
bsizesize of a block (we should probably use the cached size)
blockshow many blocks to write
bufmemory that contains the data to write
Returns
0 on success

Definition at line 186 of file masstorage.cpp.

uint8_t BulkOnly::LockMedia ( uint8_t  lun,
uint8_t  lock 
)

Lock or Unlock the tray or door on device. Caution: Some devices with buggy firmware will lock up.

Parameters
lunLogical Unit Number
lock1 to lock, 0 to unlock
Returns

Definition at line 66 of file masstorage.cpp.

bool BulkOnly::LUNIsGood ( uint8_t  lun)

Test if LUN is ready for use

Parameters
lunLogical Unit Number
Returns
true if LUN is ready for use

Definition at line 43 of file masstorage.cpp.

uint32_t BulkOnly::GetCapacity ( uint8_t  lun)

Get the capacity of the media

Parameters
lunLogical Unit Number
Returns
media capacity

Definition at line 19 of file masstorage.cpp.

uint16_t BulkOnly::GetSectorSize ( uint8_t  lun)

Get the sector (block) size used on the media

Parameters
lunLogical Unit Number
Returns
media sector size

Definition at line 31 of file masstorage.cpp.

uint8_t BulkOnly::Init ( uint8_t  parent,
uint8_t  port,
bool  lowspeed 
)
virtual
Parameters
parent(not used)
port(not used)
lowspeedtrue if device is low speed
Returns
0 for success

Reimplemented from USBDeviceConfig.

Definition at line 346 of file masstorage.cpp.

uint8_t BulkOnly::ConfigureDevice ( uint8_t  parent,
uint8_t  port,
bool  lowspeed 
)
virtual

USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET == success We need to standardize either the rcode, or change the API to return values so a signal that additional actions are required can be produced. Some of these codes do exist already.

TECHNICAL: We could do most of this code elsewhere, with the exception of checking the class instance. Doing so would save some program memory when using multiple drivers.

Parameters
parentUSB address of parent
portaddress of port on parent
lowspeedtrue if device is low speed
Returns

Reimplemented from USBDeviceConfig.

Definition at line 270 of file masstorage.cpp.

uint8_t BulkOnly::Release ( )
virtual

For driver use only.

Returns

Reimplemented from USBDeviceConfig.

Definition at line 571 of file masstorage.cpp.

uint8_t BulkOnly::Poll ( )
virtual

For driver use only.

Returns

Reimplemented from USBDeviceConfig.

Definition at line 649 of file masstorage.cpp.

virtual uint8_t BulkOnly::GetAddress ( )
inlinevirtual

Reimplemented from USBDeviceConfig.

Definition at line 272 of file masstorage.h.

void BulkOnly::EndpointXtract ( uint8_t  conf,
uint8_t  iface,
uint8_t  alt,
uint8_t  proto,
const USB_ENDPOINT_DESCRIPTOR pep 
)
virtual

For driver use only.

Parameters
conf
iface
alt
proto
pep

Implements UsbConfigXtracter.

Definition at line 539 of file masstorage.cpp.

virtual boolean BulkOnly::DEVCLASSOK ( uint8_t  klass)
inlinevirtual

Reimplemented from USBDeviceConfig.

Definition at line 278 of file masstorage.h.

Member Data Documentation

const uint8_t BulkOnly::epDataInIndex = 1
staticprotected

Definition at line 208 of file masstorage.h.

const uint8_t BulkOnly::epDataOutIndex = 2
staticprotected

Definition at line 209 of file masstorage.h.

const uint8_t BulkOnly::epInterruptInIndex = 3
staticprotected

Definition at line 210 of file masstorage.h.

USB* BulkOnly::pUsb
protected

Definition at line 212 of file masstorage.h.

uint8_t BulkOnly::bAddress
protected

Definition at line 213 of file masstorage.h.

uint8_t BulkOnly::bConfNum
protected

Definition at line 214 of file masstorage.h.

uint8_t BulkOnly::bIface
protected

Definition at line 215 of file masstorage.h.

uint8_t BulkOnly::bNumEP
protected

Definition at line 216 of file masstorage.h.

uint32_t BulkOnly::qNextPollTime
protected

Definition at line 217 of file masstorage.h.

bool BulkOnly::bPollEnable
protected

Definition at line 218 of file masstorage.h.

EpInfo BulkOnly::epInfo[MASS_MAX_ENDPOINTS]
protected

Definition at line 220 of file masstorage.h.

uint32_t BulkOnly::dCBWTag
protected

Definition at line 222 of file masstorage.h.

uint32_t BulkOnly::dCBWDataTransferLength
protected

Definition at line 223 of file masstorage.h.

uint8_t BulkOnly::bLastUsbError
protected

Definition at line 224 of file masstorage.h.

uint8_t BulkOnly::bMaxLUN
protected

Definition at line 225 of file masstorage.h.

uint8_t BulkOnly::bTheLUN
protected

Definition at line 226 of file masstorage.h.

uint32_t BulkOnly::CurrentCapacity[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 227 of file masstorage.h.

uint16_t BulkOnly::CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 228 of file masstorage.h.

bool BulkOnly::LUNOk[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 229 of file masstorage.h.

bool BulkOnly::WriteOk[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 230 of file masstorage.h.


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