SAMV71 Xplained Ultra Software Package 1.3

UHI for Mass Storage Class
[USB Host Interface (UHI)]

Collaboration diagram for UHI for Mass Storage Class:

Data Structures

struct  uhi_msc_lun_t
 LUN structure information. More...

Modules

 Implementation of UHI Mass Storage Class
 Interface with USB Host Core (UHC)
 USB host Mass Storage interface for control access module

Functions

bool uhi_msc_is_available (void)
 Tests if the interface UHI Mass Storage is available The UHI Mass Storage can be busy during the enumeration of a USB Device MSC.
uint8_t uhi_msc_get_lun (void)
 Gives the number of LUN available Note: A LUN can be available, but with a status LUN_NOT_PRESENT. It is the case for a card reader without card.

Struct to access at Logical Unit Numbers (LUNs)



enum  lun_status_t { LUN_GOOD = 0, LUN_FAIL = 1, LUN_NOT_PRESENT = 2, LUN_BUSY = 3 }
 

Status of LUN.

More...
typedef void(* uhi_msc_scsi_callback_t )(bool)
 Callback type used by uhi_msc_scsi() functions.

Functions to access at LUNs



uhi_msc_lun_tuhi_msc_get_lun_desc (uint8_t lun)
 Gives information about a LUN.
bool uhi_msc_scsi_test_unit_ready (uint8_t lun, uhi_msc_scsi_callback_t callback)
 Checks and update the status of the LUN.
bool uhi_msc_scsi_read_10 (uint8_t lun, uint32_t addr, uint8_t *ram, uint8_t nb_sector, uhi_msc_scsi_callback_t callback)
 Reads a LUN data section to RAM buffer Note: The sector size used to define the data section is the sector size returned by LUN in field.
bool uhi_msc_scsi_write_10 (uint8_t lun, uint32_t addr, const uint8_t *ram, uint8_t nb_sector, uhi_msc_scsi_callback_t callback)
 Writes a RAM buffer in a LUN data section Note: The sector size used to define the data section is the sector size returned by LUN in field.

Detailed Description

Common APIs used by high level application to use this USB host class.


Enumeration Type Documentation

Status of LUN.

Enumerator:
LUN_GOOD 

Success, memory ready.

LUN_FAIL 

An error occurred.

LUN_NOT_PRESENT 

Memory unplugged.

LUN_BUSY 

Memory not initialized or changed.

Definition at line 105 of file uhi_msc.h.


Function Documentation

uint8_t uhi_msc_get_lun ( void   ) 

Gives the number of LUN available Note: A LUN can be available, but with a status LUN_NOT_PRESENT. It is the case for a card reader without card.

Returns:
Number of LUN available

Definition at line 466 of file uhi_msc.c.

uhi_msc_lun_t* uhi_msc_get_lun_desc ( uint8_t  lun  ) 

Gives information about a LUN.

Parameters:
lun LUN number
Returns:
Pointer on the LUN information structure.

Definition at line 474 of file uhi_msc.c.

bool uhi_msc_is_available ( void   ) 

Tests if the interface UHI Mass Storage is available The UHI Mass Storage can be busy during the enumeration of a USB Device MSC.

Returns:
true, if UHI Mass Storage is available

Definition at line 461 of file uhi_msc.c.

bool uhi_msc_scsi_read_10 ( uint8_t  lun,
uint32_t  addr,
uint8_t *  ram,
uint8_t  nb_sector,
uhi_msc_scsi_callback_t  callback 
)

Reads a LUN data section to RAM buffer Note: The sector size used to define the data section is the sector size returned by LUN in field.

Parameters:
lun LUN number
addr Sector address to read
ram RAM address used to store the data
nb_sector Number of sector to read
callback Callback to call at the end of scsi command
Returns:
true, if the scsi command has been accepted

pCommand++ = SBC_WRITE10; memcpy(pCommand, &addr, sizeof(addr));

Definition at line 500 of file uhi_msc.c.

bool uhi_msc_scsi_test_unit_ready ( uint8_t  lun,
uhi_msc_scsi_callback_t  callback 
)

Checks and update the status of the LUN.

Parameters:
lun LUN number
callback Callback to call at the end of scsi command
Returns:
true, if the scsi command has been accepted

Definition at line 482 of file uhi_msc.c.

bool uhi_msc_scsi_write_10 ( uint8_t  lun,
uint32_t  addr,
const uint8_t *  ram,
uint8_t  nb_sector,
uhi_msc_scsi_callback_t  callback 
)

Writes a RAM buffer in a LUN data section Note: The sector size used to define the data section is the sector size returned by LUN in field.

Parameters:
lun LUN number
addr Sector address to write
ram RAM address of data to write
nb_sector Number of sector to write
callback Callback to call at the end of scsi command
Returns:
true, if the scsi command has been accepted

Definition at line 538 of file uhi_msc.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines