SAMV71 Xplained Ultra Software Package 1.4

MSDLun.h File Reference

#include <stdint.h>
#include "SBC.h"
#include "MSDIOFifo.h"
#include "USBD.h"

Go to the source code of this file.

Data Structures

struct  MSDLun
 LUN structure. More...

Defines

#define MED_STATUS_SUCCESS   0x00
#define MED_STATE_READY   0x00
#define MED_STATE_BUSY   0x01
#define LUN_STATUS_SUCCESS   0x00
#define LUN_STATUS_ERROR   0x02
#define LUN_NOT_PRESENT   0x00
#define LUN_EJECTED   0x01
#define LUN_CHANGED   0x10
#define LUN_TRANS_READY   LUN_CHANGED
#define LUN_READY   0x11

Typedefs

typedef void(* fMEDCallback )(void *pArg, uint8_t bStatus, uint32_t dwTransferred, uint32_t dwRemaining)
typedef void(* MSDLunDataMonitorFunction )(uint8_t flowDirection, uint32_t dataLength, uint32_t fifoNullCount, uint32_t fifoFullCount)

Functions

uint8_t MED_IsMappedRDSupported (void *pMed)
uint8_t MED_IsMappedWRSupported (void *pMed)
uint32_t MED_GetMappedAddress (void *pMed, uint32_t dwBlk)
uint8_t MED_IsBusy (void *pMed)
uint8_t MED_IsProtected (void *pMed)
uint8_t MED_GetState (void *pMed)
uint32_t MED_GetBlockSize (void *pMed)
uint32_t MED_GetSize (void *pMed)
uint8_t MED_Write (void *pMed, uint32_t dwAddr, void *pData, uint32_t dwLen, fMEDCallback fCallback, void *pArg)
uint8_t MED_Read (void *pMed, uint32_t dwAddr, void *pData, uint32_t dwLen, fMEDCallback fCallback, void *pArg)
uint8_t MED_Flush (void *pMed)
void LUN_Init (MSDLun *lun, void *media, uint8_t *ioBuffer, uint32_t ioBufferSize, uint32_t baseAddress, uint32_t size, uint16_t blockSize, uint8_t protected, void(*dataMonitor)(uint8_t flowDirection, uint32_tdataLength, uint32_tfifoNullCount, uint32_tfifoFullCount))
 Initializes a LUN instance. Must be invoked at least once even no Media is linked.
uint32_t LUN_Eject (MSDLun *lun)
 Eject the media from a LUN.
uint32_t LUN_Write (MSDLun *lun, uint32_t blockAddress, void *data, uint32_t length, TransferCallback callback, void *argument)
 Writes data on the a LUN starting at the specified block address.
uint32_t LUN_Read (MSDLun *lun, uint32_t blockAddress, void *data, uint32_t length, TransferCallback callback, void *argument)
 Reads data from a LUN, starting at the specified block address.

Detailed Description

Purpose

Logical Unit Number (LUN) used by the Mass Storage driver and the SCSI protocol. Represents a logical hard-drive.

Usage

  1. Initialize Memory related pins (see pio & board.h).
  2. Initialize a Media instance for the LUN (see memories).
  3. Initialize the LUN with LUN_Init, and link to the initialized Media.
  4. To read data from the LUN linked media, uses LUN_Read.
  5. To write data to the LUN linked media, uses LUN_Write.
  6. To unlink the media, uses LUN_Eject.

Definition in file MSDLun.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines