Common APIs used by high level application to use this USB host class.
Modules | |
Implementation of UHI Mass Storage Class | |
Class internal implementation. | |
USB host Mass Storage interface for control access module | |
Layer added on UHI MSC interface to allow the usage of control access module. | |
Interface with USB Host Core (UHC) | |
Define and functions required by UHC. | |
Data Structures | |
struct | uhi_msc_lun_t |
LUN structure information. More... | |
Functions | |
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. More... | |
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. More... | |
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. More... | |
Functions to access at LUNs | |
uhi_msc_lun_t * | uhi_msc_get_lun_desc (uint8_t lun) |
Gives information about a LUN. More... | |
bool | uhi_msc_scsi_test_unit_ready (uint8_t lun, uhi_msc_scsi_callback_t callback) |
Checks and update the status of the LUN. More... | |
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. More... | |
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. More... | |
typedef void(* uhi_msc_scsi_callback_t)(bool) |
Callback type used by uhi_msc_scsi() functions.
enum lun_status_t |
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.
References uhi_msc_dev_t::dev, and uhi_msc_dev_t::nb_lun.
Referenced by uhi_msc_mem_get_lun().
uhi_msc_lun_t* uhi_msc_get_lun_desc | ( | uint8_t | lun | ) |
Gives information about a LUN.
lun | LUN number |
References uhi_msc_dev_t::lun, and uhi_msc_dev_t::nb_lun.
Referenced by uhi_msc_mem_read_10_ram(), uhi_msc_mem_read_capacity(), uhi_msc_mem_read_sector_size(), uhi_msc_mem_test_unit_ready(), uhi_msc_mem_wr_protect(), and uhi_msc_mem_write_10_ram().
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.
References b_uhi_msc_free.
Referenced by uhi_msc_mem_get_lun(), uhi_msc_mem_read_10_ram(), uhi_msc_mem_read_capacity(), uhi_msc_mem_read_sector_size(), uhi_msc_mem_test_unit_ready(), uhi_msc_mem_wr_protect(), and uhi_msc_mem_write_10_ram().
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.
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 |
References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, MSB0W, MSB1W, MSB2W, MSB3W, SBC_READ10, uhi_msc_scsi(), uhi_msc_scsi_callback, uhi_msc_scsi_read_10_done(), uhi_msc_select_lun(), and USB_CBW_DIRECTION_IN.
Referenced by uhi_msc_mem_read_10_ram().
bool uhi_msc_scsi_test_unit_ready | ( | uint8_t | lun, |
uhi_msc_scsi_callback_t | callback | ||
) |
Checks and update the status of the LUN.
lun | LUN number |
callback | Callback to call at the end of scsi command |
References SPC_TEST_UNIT_READY, uhi_msc_scsi(), uhi_msc_scsi_callback, uhi_msc_scsi_test_unit_ready_done(), uhi_msc_select_lun(), and USB_CBW_DIRECTION_OUT.
Referenced by uhi_msc_mem_test_unit_ready().
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.
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 |
References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, MSB0W, MSB1W, MSB2W, MSB3W, SBC_WRITE10, uhi_msc_scsi(), uhi_msc_scsi_callback, uhi_msc_scsi_write_10_done(), uhi_msc_select_lun(), and USB_CBW_DIRECTION_OUT.
Referenced by uhi_msc_mem_write_10_ram().