RTEMS 6.3
Loading...
Searching...
No Matches
efc.h File Reference
#include "chip.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#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().

Function Documentation

◆ EFC_ComputeAddress()

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

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

Parameters
efcPointer to a Efc instance
pagePage number.
offsetByte offset inside page.
pAddressComputed address (optional).

◆ EFC_DisableFrdyIt()

void EFC_DisableFrdyIt ( Efc * efc)
extern

Disables the flash ready interrupt source on the EEFC peripheral.

Parameters
efcPointer to a Efc instance

◆ EFC_EnableFrdyIt()

void EFC_EnableFrdyIt ( Efc * efc)
extern

Enables the flash ready interrupt source on the EEFC peripheral.

Parameters
efcPointer to a Efc instance

◆ EFC_GetResult()

uint32_t EFC_GetResult ( Efc * efc)
extern

Returns the result of the last executed command.

Parameters
efcPointer to a Efc instance

◆ EFC_GetStatus()

uint32_t EFC_GetStatus ( Efc * efc)
extern

Returns the current status of the EEFC.

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

◆ EFC_PerformCommand()

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

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

Parameters
efcPointer to a Efc instance
commandCommand to perform.
argumentOptional command argument.
Returns
0 if successful, otherwise returns an error code.

◆ EFC_SetFlashAccessMode()

void EFC_SetFlashAccessMode ( Efc * efc,
uint32_t dwMode )
extern

Set flash access mode.

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

◆ EFC_SetWaitState()

void EFC_SetWaitState ( Efc * efc,
uint8_t ucCycles )
extern

Set read/write wait state on the EEFC peripheral.

Parameters
efcPointer to a Efc instance
cyclesthe number of wait states in cycle.

◆ EFC_TranslateAddress()

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

Translates the given address page and offset values.

Note
The resulting values are stored in the provided variables if they are not null.
Parameters
efcPointer to a Efc instance
addressAddress to translate.
pPageFirst page accessed.
pOffsetByte offset in first page.