SAMV71 Xplained Ultra Software Package 1.5

efc.h File Reference

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

Go to the source code of this file.

Defines

#define IFLASH_SECTOR_SIZE   65536u
#define EFC_FCMD_GETD   0x00
#define EFC_FCMD_WP   0x01
#define EFC_FCMD_WPL   0x02
#define EFC_FCMD_EWP   0x03
#define EFC_FCMD_EWPL   0x04
#define EFC_FCMD_EA   0x05
#define EFC_FCMD_EPA   0x07
#define EFC_FCMD_SLB   0x08
#define EFC_FCMD_CLB   0x09
#define EFC_FCMD_GLB   0x0A
#define EFC_FCMD_SFB   0x0B
#define EFC_FCMD_CFB   0x0C
#define EFC_FCMD_GFB   0x0D
#define EFC_FCMD_STUI   0x0E
#define EFC_FCMD_SPUI   0x0F
#define EFC_FCMD_GCALB   0x10
#define EFC_FCMD_ES   0x11
#define EFC_FCMD_WUS   0x12
#define EFC_FCMD_EUS   0x13
#define EFC_FCMD_STUS   0x14
#define EFC_FCMD_SPUS   0x15
#define CHIP_FLASH_IAP_ADDRESS   (0x00800008)

Functions

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 cycles)
 Set read/write wait state on the EEFC peripheral.
void EFC_TranslateAddress (Efc **pEfc, 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).
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_SetFlashAccessMode (Efc *efc, uint32_t dwMode)
 Set flash access mode.

Detailed Description

Purpose

Interface for configuration the Enhanced Embedded Flash Controller (EEFC) peripheral.

Usage

  1. Enable/disable flash ready interrupt sources using EFC_EnableFrdyIt() and EFC_DisableFrdyIt().
  2. Translates the given address into which EEFC, page and offset values for difference density flash memory using EFC_TranslateAddress().
  3. Computes the address of a flash access given the EFC, page and offset for difference density flash memory using EFC_ComputeAddress().
  4. Start the executing command with EFC_PerformCommand()
  5. Retrieve the current status of the EFC using EFC_GetStatus().
  6. Retrieve the result of the last executed command with EFC_GetResult().

Definition in file efc.h.


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 124 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 111 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 167 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 157 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 238 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 273 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 139 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 182 of file efc.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines