Microchip® Advanced Software Framework

ctrl_access.c File Reference
#include "compiler.h"
#include "preprocessor.h"
#include "ctrl_access.h"

Macros

#define Lun_desc_entry(lun)
 Initializes an entry of the LUN descriptor table. More...
 
LUN Access Protection Macros
#define Ctrl_access_lock()   true
 Locks accesses to LUNs. More...
 
#define Ctrl_access_unlock()
 Unlocks accesses to LUNs. More...
 

Functions

Control Interface
U8 get_nb_lun (void)
 Returns the number of LUNs. More...
 
U8 get_cur_lun (void)
 Returns the current LUN. More...
 
Ctrl_status mem_test_unit_ready (U8 lun)
 Tests the memory state and initializes the memory if required. More...
 
Ctrl_status mem_read_capacity (U8 lun, U32 *u32_nb_sector)
 Returns the address of the last valid sector (512 bytes) in the memory. More...
 
U8 mem_sector_size (U8 lun)
 Returns the size of the physical sector. More...
 
bool mem_unload (U8 lun, bool unload)
 Unload/load the medium. More...
 
bool mem_wr_protect (U8 lun)
 Returns the write-protection state of the memory. More...
 
bool mem_removal (U8 lun)
 Tells whether the memory is removable. More...
 
const char * mem_name (U8 lun)
 Returns a pointer to the LUN name. More...
 
MEM <-> RAM Interface
Ctrl_status memory_2_ram (U8 lun, U32 addr, void *ram)
 Copies 1 data sector from the memory to RAM. More...
 
Ctrl_status ram_2_memory (U8 lun, U32 addr, const void *ram)
 Copies 1 data sector from RAM to the memory. More...
 
Streaming MEM <-> MEM Interface
Ctrl_status stream_state (U8 id)
 Returns the state of a streaming data transfer. More...
 
U16 stream_stop (U8 id)
 Stops a streaming data transfer. More...
 

Variables

struct {
   Ctrl_status(*   mem_2_ram )(U32, void *)
 
   const char *   name
 
   Ctrl_status(*   ram_2_mem )(U32, const void *)
 
   Ctrl_status(*   read_capacity )(U32 *)
 
   bool(*   removal )(void)
 
   Ctrl_status(*   test_unit_ready )(void)
 
   bool(*   unload )(bool)
 
   bool(*   wr_protect )(void)
 
lun_desc [MAX_LUN]
 LUN descriptor table. More...
 

#define Ctrl_access_lock ( )    true

Locks accesses to LUNs.

Returns
true if the access was successfully locked, else false.

Referenced by get_nb_lun(), mem_read_capacity(), mem_removal(), mem_sector_size(), mem_test_unit_ready(), mem_unload(), mem_wr_protect(), memory_2_ram(), and ram_2_memory().

#define Ctrl_access_unlock ( )
#define Lun_desc_entry (   lun)
Value:
{\
TPASTE3(Lun_, lun, _test_unit_ready),\
TPASTE3(Lun_, lun, _read_capacity),\
TPASTE3(Lun_, lun, _unload),\
TPASTE3(Lun_, lun, _wr_protect),\
TPASTE3(Lun_, lun, _removal),\
TPASTE3(Lun_, lun, _mem_2_ram),\
TPASTE3(Lun_, lun, _ram_2_mem),\
TPASTE3(LUN_, lun, _NAME)\
}
#define TPASTE3(a, b, c)
Definition: tpaste.h:60

Initializes an entry of the LUN descriptor table.

Parameters
lunLogical Unit Number.
Returns
LUN descriptor table entry initializer.

Ctrl_status(* mem_2_ram)(U32, void *)

Referenced by memory_2_ram().

const char* name

Referenced by mem_name().

Ctrl_status(* ram_2_mem)(U32, const void *)

Referenced by ram_2_memory().

Ctrl_status(* read_capacity)(U32 *)

Referenced by mem_read_capacity().

bool(* removal)(void)

Referenced by mem_removal().

Ctrl_status(* test_unit_ready)(void)

Referenced by mem_test_unit_ready().

bool(* unload)(bool)

Referenced by mem_unload(), and virtual_unload().

bool(* wr_protect)(void)

Referenced by mem_wr_protect().