SAMV71 Xplained Ultra Software Package 1.5

Memory Control Access

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)

Detailed Description

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 Documentation

#define LUN_ID_USB   (MAX_LUN)

First dynamic LUN (USB host mass storage).

Definition at line 127 of file ctrl_access.h.


Enumeration Type Documentation

Status returned by CTRL_ACCESS interfaces.

Enumerator:
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.


Function Documentation

uint8_t get_cur_lun ( void   ) 

Returns the current LUN.

Returns:
Current LUN.

Definition at line 299 of file ctrl_access.c.

uint8_t get_nb_lun ( void   ) 

Returns the number of LUNs.

Returns:
Number of LUNs in the system.

Definition at line 278 of file ctrl_access.c.

const char* mem_name ( uint8_t  lun  ) 

Returns a pointer to the LUN name.

Parameters:
lun Logical Unit Number.
Returns:
Pointer to the LUN name string.

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.

Parameters:
lun Logical Unit Number.
u32_nb_sector Pointer to the address of the last valid sector.
Returns:
Status.

Definition at line 327 of file ctrl_access.c.

bool mem_removal ( uint8_t  lun  ) 

Tells whether the memory is removable.

Parameters:
lun Logical Unit Number.
Returns:
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.

Parameters:
lun Logical Unit Number.
Returns:
Sector size (unit: 512 bytes).

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.

Parameters:
lun Logical Unit Number.
Returns:
Status.

Definition at line 305 of file ctrl_access.c.

bool mem_unload ( uint8_t  lun,
bool  unload 
)

Unload/load the medium.

Parameters:
lun Logical Unit Number.
unload true to unload the medium, false to load the medium.
Returns:
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.

Parameters:
lun Logical Unit Number.
Returns:
true if the memory is write-protected, else false.
Note:
Only used by removable memories with hardware-specific write protection.

Definition at line 401 of file ctrl_access.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines