SAMV71 Xplained Ultra Software Package 1.4

efc.c File Reference

#include "chip.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define EEFC_FCR_FCMD(value)   ((EEFC_FCR_FCMD_Msk & ((value) << EEFC_FCR_FCMD_Pos)))

Functions

void EFC_WriteFMR (Efc *efc, uint32_t dwFmr)
 __attribute__ ((section(".ramfunc")))
void EFC_EnableFrdyIt (Efc *efc)
 Enables the flash ready interrupt source on the EEFC peripheral.
void EFC_DisableFrdyIt (Efc *efc)
 Disables the flash ready interrupt source on the EEFC peripheral.
void EFC_SetWaitState (Efc *efc, uint8_t ucCycles)
 Set read/write wait state on the EEFC peripheral.
uint32_t EFC_GetStatus (Efc *efc)
 Returns the current status of the EEFC.
uint32_t EFC_GetResult (Efc *efc)
 Returns the result of the last executed command.
void EFC_TranslateAddress (Efc **ppEfc, uint32_t dwAddress, uint16_t *pwPage, uint16_t *pwOffset)
 Translates the given address page and offset values.
void EFC_ComputeAddress (Efc *efc, uint16_t wPage, uint16_t wOffset, uint32_t *pdwAddress)
 Computes the address of a flash access given the page and offset.
uint32_t EFC_PerformCommand (Efc *efc, uint32_t dwCommand, uint32_t dwArgument, uint32_t dwUseIAP)
 Performs the given command and wait until its completion (or an error).
void EFC_SetFlashAccessMode (Efc *efc, uint32_t dwMode)
 Set flash access mode.

Detailed Description

Implementation of Enhanced Embedded Flash Controller (EEFC).

Definition in file efc.c.


Function Documentation

void EFC_ComputeAddress ( Efc efc,
uint16_t  wPage,
uint16_t  wOffset,
uint32_t *  pdwAddress 
)

Computes the address of a flash access given the page and offset.

Parameters:
efc Pointer to a Efc instance
page Page number.
offset Byte offset inside page.
pAddress Computed address (optional).

Definition at line 210 of file efc.c.

void EFC_DisableFrdyIt ( Efc efc  ) 

Disables the flash ready interrupt source on the EEFC peripheral.

Parameters:
efc Pointer to a Efc instance

Definition at line 123 of file efc.c.

void EFC_EnableFrdyIt ( Efc efc  ) 

Enables the flash ready interrupt source on the EEFC peripheral.

Parameters:
efc Pointer to a Efc instance

Definition at line 110 of file efc.c.

uint32_t EFC_GetResult ( Efc efc  ) 

Returns the result of the last executed command.

Parameters:
efc Pointer to a Efc instance

Definition at line 166 of file efc.c.

uint32_t EFC_GetStatus ( Efc efc  ) 

Returns the current status of the EEFC.

Note:
Keep in mind that this function clears the value of some status bits (LOCKE, PROGE).
Parameters:
efc Pointer to a Efc instance

Definition at line 156 of file efc.c.

uint32_t EFC_PerformCommand ( Efc efc,
uint32_t  dwCommand,
uint32_t  dwArgument,
uint32_t  dwUseIAP 
)

Performs the given command and wait until its completion (or an error).

Parameters:
efc Pointer to a Efc instance
command Command to perform.
argument Optional command argument.
Returns:
0 if successful, otherwise returns an error code.

Definition at line 239 of file efc.c.

void EFC_SetFlashAccessMode ( Efc efc,
uint32_t  dwMode 
)

Set flash access mode.

Parameters:
dwMode - 0:128-bit, (1<<24):64-bit

Definition at line 272 of file efc.c.

void EFC_SetWaitState ( Efc efc,
uint8_t  ucCycles 
)

Set read/write wait state on the EEFC peripheral.

Parameters:
efc Pointer to a Efc instance
cycles the number of wait states in cycle.

Definition at line 138 of file efc.c.

void EFC_TranslateAddress ( Efc **  ppEfc,
uint32_t  dwAddress,
uint16_t *  pwPage,
uint16_t *  pwOffset 
)

Translates the given address page and offset values.

Note:
The resulting values are stored in the provided variables if they are not null.
Parameters:
efc Pointer to a Efc instance
address Address to translate.
pPage First page accessed.
pOffset Byte offset in first page.

Definition at line 181 of file efc.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines