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)
 
uint8_t SCSITransaction6 (CDB6_t *cdb, uint16_t buf_size, void *buf, uint8_t dir)
 
uint8_t SCSITransaction10 (CDB10_t *cdb, uint16_t buf_size, void *buf, uint8_t dir)
 
- 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
 
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 441 of file masstorage.h.

Constructor & Destructor Documentation

BulkOnly::BulkOnly ( USB p)

Definition at line 205 of file masstorage.cpp.

Member Function Documentation

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

Definition at line 1182 of file masstorage.cpp.

virtual uint8_t BulkOnly::OnInit ( )
inlineprotectedvirtual

Definition at line 471 of file masstorage.h.

uint8_t BulkOnly::GetLastUsbError ( )
inline

Definition at line 477 of file masstorage.h.

uint8_t BulkOnly::GetbMaxLUN ( )
inline

Definition at line 481 of file masstorage.h.

uint8_t BulkOnly::GetbTheLUN ( )
inline

Definition at line 485 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 113 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 137 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 1209 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 171 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 97 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 309 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 234 of file masstorage.cpp.

uint8_t BulkOnly::Release ( )
virtual

For driver use only.

Returns

Reimplemented from USBDeviceConfig.

Definition at line 558 of file masstorage.cpp.

uint8_t BulkOnly::Poll ( )
virtual

For driver use only.

Returns

Reimplemented from USBDeviceConfig.

Definition at line 636 of file masstorage.cpp.

virtual uint8_t BulkOnly::GetAddress ( )
inlinevirtual

Reimplemented from USBDeviceConfig.

Definition at line 507 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 526 of file masstorage.cpp.

virtual boolean BulkOnly::DEVCLASSOK ( uint8_t  klass)
inlinevirtual

Reimplemented from USBDeviceConfig.

Definition at line 514 of file masstorage.h.

uint8_t BulkOnly::SCSITransaction6 ( CDB6_t cdb,
uint16_t  buf_size,
void *  buf,
uint8_t  dir 
)

Wrap and execute a SCSI CDB with length of 6

Parameters
cdbCDB to execute
buf_sizeSize of expected transaction
bufBuffer
dirMASS_CMD_DIR_IN | MASS_CMD_DIR_OUT
Returns

Definition at line 66 of file masstorage.cpp.

uint8_t BulkOnly::SCSITransaction10 ( CDB10_t cdb,
uint16_t  buf_size,
void *  buf,
uint8_t  dir 
)

Wrap and execute a SCSI CDB with length of 10

Parameters
cdbCDB to execute
buf_sizeSize of expected transaction
bufBuffer
dirMASS_CMD_DIR_IN | MASS_CMD_DIR_OUT
Returns

Definition at line 82 of file masstorage.cpp.

Member Data Documentation

const uint8_t BulkOnly::epDataInIndex = 1
staticprotected

Definition at line 443 of file masstorage.h.

const uint8_t BulkOnly::epDataOutIndex = 2
staticprotected

Definition at line 444 of file masstorage.h.

const uint8_t BulkOnly::epInterruptInIndex = 3
staticprotected

Definition at line 445 of file masstorage.h.

USB* BulkOnly::pUsb
protected

Definition at line 447 of file masstorage.h.

uint8_t BulkOnly::bAddress
protected

Definition at line 448 of file masstorage.h.

uint8_t BulkOnly::bConfNum
protected

Definition at line 449 of file masstorage.h.

uint8_t BulkOnly::bIface
protected

Definition at line 450 of file masstorage.h.

uint8_t BulkOnly::bNumEP
protected

Definition at line 451 of file masstorage.h.

uint32_t BulkOnly::qNextPollTime
protected

Definition at line 452 of file masstorage.h.

bool BulkOnly::bPollEnable
protected

Definition at line 453 of file masstorage.h.

EpInfo BulkOnly::epInfo[MASS_MAX_ENDPOINTS]
protected

Definition at line 455 of file masstorage.h.

uint32_t BulkOnly::dCBWTag
protected

Definition at line 457 of file masstorage.h.

uint8_t BulkOnly::bLastUsbError
protected

Definition at line 459 of file masstorage.h.

uint8_t BulkOnly::bMaxLUN
protected

Definition at line 460 of file masstorage.h.

uint8_t BulkOnly::bTheLUN
protected

Definition at line 461 of file masstorage.h.

uint32_t BulkOnly::CurrentCapacity[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 462 of file masstorage.h.

uint16_t BulkOnly::CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 463 of file masstorage.h.

bool BulkOnly::LUNOk[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 464 of file masstorage.h.

bool BulkOnly::WriteOk[MASS_MAX_SUPPORTED_LUN]
protected

Definition at line 465 of file masstorage.h.


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