SAMV71 Xplained Ultra Software Package 1.3

Media.c File Reference

#include "Media.h"

Go to the source code of this file.

Functions

uint8_t MED_Write (sMedia *pMedia, uint32_t address, void *data, uint32_t length, MediaCallback callback, void *argument)
 Writes data on a media.
uint8_t MED_Read (sMedia *pMedia, uint32_t address, void *data, uint32_t length, MediaCallback callback, void *argument)
 Reads a specified amount of data from a media.
uint8_t MED_Lock (sMedia *pMedia, uint32_t start, uint32_t end, uint32_t *pActualStart, uint32_t *pActualEnd)
 Locks all the regions in the given address range.
uint8_t MED_Unlock (sMedia *pMedia, uint32_t start, uint32_t end, uint32_t *pActualStart, uint32_t *pActualEnd)
 Unlocks all the regions in the given address range.
uint8_t MED_Flush (sMedia *pMedia)
void MED_Handler (sMedia *pMedia)
 Invokes the interrupt handler of the specified media.
void MED_DeInit (sMedia *pMedia)
 Reset the media interface to un-configured state.
uint8_t MED_IsInitialized (sMedia *pMedia)
 Check if the Media instance is ready to use.
uint8_t MED_IsBusy (sMedia *pMedia)
 Check if the Media instance is busy in transfer.
uint8_t MED_IsMappedRDSupported (sMedia *pMedia)
 Check if the Media supports mapped reading.
uint8_t MED_IsMappedWRSupported (sMedia *pMedia)
 Check if the Media supports mapped writing.
uint8_t MED_IsProtected (sMedia *pMedia)
 Check if the Media is write protected.
uint8_t MED_GetState (sMedia *pMedia)
 Return current state of the Media.
uint32_t MED_GetBlockSize (sMedia *pMedia)
 Return block size in bytes.
uint32_t MED_GetSize (sMedia *pMedia)
 Return Media size in number of blocks.
uint32_t MED_GetMappedAddress (sMedia *pMedia, uint32_t dwBlk)
 Return mapped memory address for a block on media.
void MED_HandleAll (sMedia *pMedia, uint8_t bNumMedia)
 Handle interrupts on specified media.

Variables

uint32_t gNbMedias = 0

Detailed Description

Definition in file Media.c.


Function Documentation

void MED_DeInit ( sMedia *  pMedia  ) 

Reset the media interface to un-configured state.

Parameters:
media Pointer to the Media instance to use

Definition at line 158 of file Media.c.

uint8_t MED_Flush ( sMedia *  pMedia  ) 
Parameters:
media Pointer to the Media instance to use

Definition at line 134 of file Media.c.

uint32_t MED_GetBlockSize ( sMedia *  pMedia  ) 

Return block size in bytes.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 221 of file Media.c.

uint32_t MED_GetMappedAddress ( sMedia *  pMedia,
uint32_t  dwBlk 
)

Return mapped memory address for a block on media.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 239 of file Media.c.

uint32_t MED_GetSize ( sMedia *  pMedia  ) 

Return Media size in number of blocks.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 230 of file Media.c.

uint8_t MED_GetState ( sMedia *  pMedia  ) 

Return current state of the Media.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 212 of file Media.c.

void MED_HandleAll ( sMedia *  pMedia,
uint8_t  bNumMedia 
)

Handle interrupts on specified media.

Parameters:
pMedia List of media
bNumMedia Number of media in list
See also:
S_media

Definition at line 251 of file Media.c.

Here is the call graph for this function:

void MED_Handler ( sMedia *  pMedia  ) 

Invokes the interrupt handler of the specified media.

Parameters:
media Pointer to the Media instance to use

Definition at line 147 of file Media.c.

uint8_t MED_IsBusy ( sMedia *  pMedia  ) 

Check if the Media instance is busy in transfer.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 176 of file Media.c.

uint8_t MED_IsInitialized ( sMedia *  pMedia  ) 

Check if the Media instance is ready to use.

Parameters:
media Pointer to the Media instance to use

Definition at line 167 of file Media.c.

uint8_t MED_IsMappedRDSupported ( sMedia *  pMedia  ) 

Check if the Media supports mapped reading.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 185 of file Media.c.

uint8_t MED_IsMappedWRSupported ( sMedia *  pMedia  ) 

Check if the Media supports mapped writing.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 194 of file Media.c.

uint8_t MED_IsProtected ( sMedia *  pMedia  ) 

Check if the Media is write protected.

Parameters:
pMedia Pointer to the Media instance to use

Definition at line 203 of file Media.c.

uint8_t MED_Lock ( sMedia *  pMedia,
uint32_t  start,
uint32_t  end,
uint32_t *  pActualStart,
uint32_t *  pActualEnd 
)

Locks all the regions in the given address range.

Parameters:
media Pointer to a Media instance
start Start address of lock range.
end End address of lock range.
pActualStart Start address of the actual lock range (optional).
pActualEnd End address of the actual lock range (optional).
Returns:
0 if successful; otherwise returns an error code.

Definition at line 99 of file Media.c.

uint8_t MED_Read ( sMedia *  pMedia,
uint32_t  address,
void *  data,
uint32_t  length,
MediaCallback  callback,
void *  argument 
)

Reads a specified amount of data from a media.

Parameters:
media Pointer to a Media instance
address Address of the data to read
data Pointer to the buffer in which to store the retrieved data
length Length of the buffer
callback Optional pointer to a callback function to invoke when the operation is finished
argument Optional pointer to an argument for the callback
Returns:
Operation result code
See also:
TransferCallback

Definition at line 83 of file Media.c.

uint8_t MED_Unlock ( sMedia *  pMedia,
uint32_t  start,
uint32_t  end,
uint32_t *  pActualStart,
uint32_t *  pActualEnd 
)

Unlocks all the regions in the given address range.

Parameters:
media Pointer to a Media instance
start Start address of unlock range.
end End address of unlock range.
pActualStart Start address of the actual unlock range (optional).
pActualEnd End address of the actual unlock range (optional).
Returns:
0 if successful; otherwise returns an error code.

Definition at line 119 of file Media.c.

uint8_t MED_Write ( sMedia *  pMedia,
uint32_t  address,
void *  data,
uint32_t  length,
MediaCallback  callback,
void *  argument 
)

Writes data on a media.

Parameters:
media Pointer to a Media instance
address Address at which to write
data Pointer to the data to write
length Size of the data buffer
callback Optional pointer to a callback function to invoke when the write operation terminates
argument Optional argument for the callback function
Returns:
Operation result code
See also:
TransferCallback

Definition at line 61 of file Media.c.


Variable Documentation

uint32_t gNbMedias = 0

Number of medias which are effectively used.

Definition at line 43 of file Media.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines