Defines | |
#define | SECTOR_SIZE 512 |
Enumerations | |
enum | Ctrl_status { CTRL_GOOD = PASS, CTRL_FAIL = FAIL, CTRL_NO_PRESENT = FAIL + 1, CTRL_BUSY = FAIL + 2 } |
Status returned by CTRL_ACCESS interfaces. More... | |
Control Interface | |
| |
uint8_t | get_nb_lun (void) |
Returns the number of LUNs. | |
uint8_t | get_cur_lun (void) |
Returns the current LUN. | |
Ctrl_status | mem_test_unit_ready (uint8_t lun) |
Tests the memory state and initializes the memory if required. | |
Ctrl_status | mem_read_capacity (uint8_t lun, uint32_t *u32_nb_sector) |
Returns the address of the last valid sector (512 bytes) in the memory. | |
uint8_t | mem_sector_size (uint8_t lun) |
Returns the size of the physical sector. | |
bool | mem_unload (uint8_t lun, bool unload) |
Unload/load the medium. | |
bool | mem_wr_protect (uint8_t lun) |
Returns the write-protection state of the memory. | |
bool | mem_removal (uint8_t lun) |
Tells whether the memory is removable. | |
const char * | mem_name (uint8_t lun) |
Returns a pointer to the LUN name. | |
LUN IDs | |
| |
#define | LUN_ID_0 (0) |
First static LUN. | |
#define | LUN_ID_1 (LUN_ID_0 + LUN_0) |
#define | LUN_ID_2 (LUN_ID_1 + LUN_1) |
#define | LUN_ID_3 (LUN_ID_2 + LUN_2) |
#define | LUN_ID_4 (LUN_ID_3 + LUN_3) |
#define | LUN_ID_5 (LUN_ID_4 + LUN_4) |
#define | LUN_ID_6 (LUN_ID_5 + LUN_5) |
#define | LUN_ID_7 (LUN_ID_6 + LUN_6) |
#define | MAX_LUN (LUN_ID_7 + LUN_7) |
Number of static LUNs. | |
#define | LUN_ID_USB (MAX_LUN) |
Common abstraction layer for memory interfaces. It provides interfaces between: Memory and USB, Memory and RAM, Memory and Memory. Common API for XMEGA and UC3.
#define LUN_ID_USB (MAX_LUN) |
First dynamic LUN (USB host mass storage).
Definition at line 127 of file ctrl_access.h.
enum Ctrl_status |
Status returned by CTRL_ACCESS interfaces.
CTRL_GOOD |
Success, memory ready. |
CTRL_FAIL |
An error occurred. |
CTRL_NO_PRESENT |
Memory unplugged. |
CTRL_BUSY |
Memory not initialized or changed. |
Definition at line 76 of file ctrl_access.h.
uint8_t get_cur_lun | ( | void | ) |
uint8_t get_nb_lun | ( | void | ) |
Returns the number of LUNs.
Definition at line 278 of file ctrl_access.c.
const char* mem_name | ( | uint8_t | lun | ) |
Returns a pointer to the LUN name.
lun | Logical Unit Number. |
Definition at line 448 of file ctrl_access.c.
Ctrl_status mem_read_capacity | ( | uint8_t | lun, | |
uint32_t * | u32_nb_sector | |||
) |
Returns the address of the last valid sector (512 bytes) in the memory.
lun | Logical Unit Number. | |
u32_nb_sector | Pointer to the address of the last valid sector. |
Definition at line 327 of file ctrl_access.c.
bool mem_removal | ( | uint8_t | lun | ) |
Tells whether the memory is removable.
lun | Logical Unit Number. |
true
if the memory is removable, else false
. Definition at line 423 of file ctrl_access.c.
uint8_t mem_sector_size | ( | uint8_t | lun | ) |
Returns the size of the physical sector.
lun | Logical Unit Number. |
Definition at line 349 of file ctrl_access.c.
Ctrl_status mem_test_unit_ready | ( | uint8_t | lun | ) |
Tests the memory state and initializes the memory if required.
The TEST UNIT READY SCSI primary command allows an application client to poll a LUN until it is ready without having to allocate memory for returned data.
This command may be used to check the media status of LUNs with removable media.
lun | Logical Unit Number. |
Definition at line 305 of file ctrl_access.c.
bool mem_unload | ( | uint8_t | lun, | |
bool | unload | |||
) |
Unload/load the medium.
lun | Logical Unit Number. | |
unload | true to unload the medium, false to load the medium. |
true
if unload/load success, else false
. Definition at line 371 of file ctrl_access.c.
bool mem_wr_protect | ( | uint8_t | lun | ) |
Returns the write-protection state of the memory.
lun | Logical Unit Number. |
true
if the memory is write-protected, else false
.Definition at line 401 of file ctrl_access.c.