Common APIs used by high level application to use this USB host class.
Modules | |
USB host Mass Storage interface for control access module | |
Layer added on UHI MSC interface to allow the usage of control access module. | |
Implementation of UHI Mass Storage Class | |
Class internal implementation. | |
Interface with USB Host Core (UHC) | |
Define and functions required by UHC. | |
Data Structures | |
struct | uhi_msc_lun_t |
Logical Unit Number (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, 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 |
Status of LUN.
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.
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, uhi_msc_dev_t::nb_lun, and NULL.
uhi_msc_lun_t* uhi_msc_get_lun_desc | ( | uint8_t | lun | ) |
Gives information about a LUN.
lun | LUN number |
[in] | lun | LUN number |
References uhi_msc_dev_t::lun, uhi_msc_dev_t::nb_lun, and NULL.
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.
Tests if the interface UHI Mass Storage is available The UHI Mass Storage can be busy during the enumeration of a USB Device MSC.
The UHI Mass Storage can be busy during the enumeration of a USB Device MSC.
References b_uhi_msc_free.
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 |
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.
[in] | lun | LUN number |
[in] | addr | Sector address to read |
[out] | ram | RAM address used to store the data |
[in] | nb_sector | Number of sector to read |
[in] | callback | Callback to call at the end of SCSI command |
References sbc_read_capacity10_data::block_len, callback, 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.
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 |
[in] | lun | LUN number |
[in] | callback | Callback to call at the end of SCSI command |
References callback, NULL, 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.
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 |
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.
[in] | lun | LUN number |
[in] | addr | Sector address to write |
[in] | ram | RAM address of data to write |
[in] | nb_sector | Number of sector to write |
[in] | callback | Callback to call at the end of SCSI command |
References sbc_read_capacity10_data::block_len, callback, 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.