Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB host Mass Storage interface for control access module

Layer added on UHI MSC interface to allow the usage of control access module.

The control access module provides a common access at all memories and it is used by the File Systems available in ASF.

See Quick start guide for USB host mass-storage module (UHI MSC).

Modules

 
 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the USB host Mass Storage interface for control access module.
 
 Implementation of USB host Mass Storage
 interface for control access module
 

Functions

uint8_t uhi_msc_mem_get_lun (void)
 Gives the number of available LUN. More...
 
Ctrl_status uhi_msc_mem_read_10_ram (uint32_t addr, void *ram)
 Reads 512 bytes from the current LUN. More...
 
Ctrl_status uhi_msc_mem_read_capacity (uint8_t lun, uint32_t *u32_nb_sector)
 Returns the capacity of the LUN. More...
 
uint8_t uhi_msc_mem_read_sector_size (uint8_t lun)
 Returns the sector size of the LUN. More...
 
bool uhi_msc_mem_removal (void)
 Checks if the device is removed. More...
 
Ctrl_status uhi_msc_mem_test_unit_ready (uint8_t lun)
 Checks and update the status of the LUN. More...
 
bool uhi_msc_mem_wr_protect (uint8_t lun)
 Checks if the LUN is write protected. More...
 
Ctrl_status uhi_msc_mem_write_10_ram (uint32_t addr, const void *ram)
 Writes 512 bytes to the current LUN. More...
 

uint8_t uhi_msc_mem_get_lun ( void  )

Gives the number of available LUN.

Note
A LUN can be available, but with a status not present. It is the case for a card reader without card.
Returns
Number of available LUN
Note
A LUN can be available, but with a status not present.

It is the case for a card reader without card.

Returns
Number of available LUN.

References uhi_msc_get_lun(), and uhi_msc_is_available().

Ctrl_status uhi_msc_mem_read_10_ram ( uint32_t  addr,
void *  ram 
)

Reads 512 bytes from the current LUN.

The LUN is selected by uhi_msc_mem_test_unit_ready() or uhi_msc_mem_read_capacity() function.

Parameters
addrDisk address (unit 512B)
ramPointer to store the data
Returns
Status of the LUN

The LUN is selected by uhi_msc_mem_test_unit_ready() or uhi_msc_mem_read_capacity() function.

Parameters
[in]addrDisk address (unit 512B)
[out]ramPointer to store the data
Returns
Status of the LUN.

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, CTRL_FAIL, CTRL_GOOD, NULL, uhi_msc_lun_t::status, uhi_msc_get_lun_desc(), uhi_msc_is_available(), uhi_msc_mem_command_ongoing, uhi_msc_mem_command_status, uhi_msc_mem_lun, uhi_msc_mem_stop_pooling(), uhi_msc_mem_translate_status(), and uhi_msc_scsi_read_10().

Ctrl_status uhi_msc_mem_read_capacity ( uint8_t  lun,
uint32_t *  u32_nb_sector 
)

Returns the capacity of the LUN.

Parameters
lunLUN number
u32_nb_sectorPointer to store the last sector address possible on this LUN
Returns
Status of the LUN
Parameters
[in]lunLUN number
[in]u32_nb_sectorPointer to store the last sector address possible on this LUN
Returns
Status of the LUN.

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, CTRL_FAIL, sbc_read_capacity10_data::max_lba, NULL, uhi_msc_lun_t::status, uhi_msc_get_lun_desc(), uhi_msc_is_available(), uhi_msc_mem_lun, and uhi_msc_mem_translate_status().

uint8_t uhi_msc_mem_read_sector_size ( uint8_t  lun)

Returns the sector size of the LUN.

Parameters
lunLUN number
Returns
Sector size (unit 512B)
Parameters
[in]lunLUN number
Returns
Sector size (unit 512B).

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, NULL, uhi_msc_get_lun_desc(), uhi_msc_is_available(), and uhi_msc_mem_lun.

bool uhi_msc_mem_removal ( void  )

Checks if the device is removed.

Returns
Always true for USB Device
Always true for USB Device.
Ctrl_status uhi_msc_mem_test_unit_ready ( uint8_t  lun)

Checks and update the status of the LUN.

Parameters
lunLUN number
Returns
Status of the LUN
Parameters
[in]lunLUN number
Returns
Status of the LUN.

References CTRL_FAIL, uhi_msc_lun_t::status, uhi_msc_get_lun_desc(), uhi_msc_is_available(), uhi_msc_mem_command_ongoing, uhi_msc_mem_command_status, uhi_msc_mem_lun, uhi_msc_mem_stop_pooling(), uhi_msc_mem_translate_status(), and uhi_msc_scsi_test_unit_ready().

bool uhi_msc_mem_wr_protect ( uint8_t  lun)

Checks if the LUN is write protected.

Parameters
lunLUN number
Returns
true, if write protected
Parameters
[in]lunLUN number
Returns
True, if write protected.

References uhi_msc_lun_t::b_write_protected, sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, NULL, uhi_msc_get_lun_desc(), uhi_msc_is_available(), and uhi_msc_mem_lun.

Ctrl_status uhi_msc_mem_write_10_ram ( uint32_t  addr,
const void *  ram 
)

Writes 512 bytes to the current LUN.

The LUN is selected by uhi_msc_mem_test_unit_ready() or uhi_msc_mem_read_capacity() function.

Parameters
addrDisk address (unit 512B)
ramPointer on the data
Returns
Status of the LUN

The LUN is selected by uhi_msc_mem_test_unit_ready() or uhi_msc_mem_read_capacity() function.

Parameters
[in]addrDisk address (unit 512B)
[in]ramPointer on the data
Returns
Status of the LUN.

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, CTRL_FAIL, CTRL_GOOD, NULL, uhi_msc_lun_t::status, uhi_msc_get_lun_desc(), uhi_msc_is_available(), uhi_msc_mem_command_ongoing, uhi_msc_mem_command_status, uhi_msc_mem_lun, uhi_msc_mem_stop_pooling(), uhi_msc_mem_translate_status(), and uhi_msc_scsi_write_10().