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

 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

References uhi_msc_get_lun(), and uhi_msc_is_available().

Referenced by main().

Ctrl_status uhi_msc_mem_read_10_ram ( uint32_t  addr,
void *  ram 
)
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

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, CTRL_FAIL, sbc_read_capacity10_data::max_lba, 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)

References sbc_read_capacity10_data::block_len, uhi_msc_lun_t::capacity, 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
Ctrl_status uhi_msc_mem_test_unit_ready ( uint8_t  lun)
bool uhi_msc_mem_wr_protect ( uint8_t  lun)

Checks if the LUN is write protected.

Parameters
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, 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 
)