Robobo
efc.h File Reference

Embedded Flash Controller (EFC) driver for SAM. More...

#include "../chip.h"

Go to the source code of this file.

Macros

#define CHIP_FLASH_IAP_ADDRESS   (IROM_ADDR + 8)
 
EFC command
#define EFC_FCMD_GETD   0x00
 Get Flash Descriptor.
 
#define EFC_FCMD_WP   0x01
 Write page.
 
#define EFC_FCMD_WPL   0x02
 Write page and lock.
 
#define EFC_FCMD_EWP   0x03
 Erase page and write page.
 
#define EFC_FCMD_EWPL   0x04
 Erase page and write page then lock.
 
#define EFC_FCMD_EA   0x05
 Erase all.
 
#define EFC_FCMD_SLB   0x08
 Set Lock Bit.
 
#define EFC_FCMD_CLB   0x09
 Clear Lock Bit.
 
#define EFC_FCMD_GLB   0x0A
 Get Lock Bit.
 
#define EFC_FCMD_SGPB   0x0B
 Set GPNVM Bit.
 
#define EFC_FCMD_CGPB   0x0C
 Clear GPNVM Bit.
 
#define EFC_FCMD_GGPB   0x0D
 Get GPNVM Bit.
 
#define EFC_FCMD_STUI   0x0E
 Start unique ID.
 
#define EFC_FCMD_SPUI   0x0F
 Stop unique ID.
 
EFC access mode
#define EFC_ACCESS_MODE_128   0
 
#define EFC_ACCESS_MODE_64   EEFC_FMR_FAM
 

Functions

uint32_t efc_init (Efc *p_efc, uint32_t ul_access_mode, uint32_t ul_fws)
 Initialize the EFC controller. More...
 
void efc_enable_frdy_interrupt (Efc *p_efc)
 Enable the flash ready interrupt. More...
 
void efc_disable_frdy_interrupt (Efc *p_efc)
 Disable the flash ready interrupt. More...
 
void efc_set_flash_access_mode (Efc *p_efc, uint32_t ul_mode)
 Set flash access mode. More...
 
uint32_t efc_get_flash_access_mode (Efc *p_efc)
 Get flash access mode. More...
 
void efc_set_wait_state (Efc *p_efc, uint32_t ul_fws)
 Set flash wait state. More...
 
uint32_t efc_get_wait_state (Efc *p_efc)
 Get flash wait state. More...
 
uint32_t efc_perform_command (Efc *p_efc, uint32_t ul_command, uint32_t ul_argument)
 Perform the given command and wait until its completion (or an error). More...
 
uint32_t efc_get_status (Efc *p_efc)
 Get the current status of the EEFC. More...
 
uint32_t efc_get_result (Efc *p_efc)
 Get the result of the last executed command. More...
 
uint32_t efc_perform_read_sequence (Efc *p_efc, uint32_t ul_cmd_st, uint32_t ul_cmd_sp, uint32_t *p_ul_buf, uint32_t ul_size)
 

EFC return codes

enum  efc_rc {
  EFC_RC_OK = 0, EFC_RC_YES = 0, EFC_RC_NO = 1, EFC_RC_ERROR = 1,
  EFC_RC_INVALID, EFC_RC_NOT_SUPPORT = 0xFFFFFFFF
}
 
typedef enum efc_rc efc_rc_t
 

Detailed Description

Embedded Flash Controller (EFC) driver for SAM.

Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.

Macro Definition Documentation

#define CHIP_FLASH_IAP_ADDRESS   (IROM_ADDR + 8)

The IAP function entry address

Enumeration Type Documentation

enum efc_rc
Enumerator
EFC_RC_OK 

Operation OK.

EFC_RC_YES 

Yes.

EFC_RC_NO 

No.

EFC_RC_ERROR 

General error.

EFC_RC_INVALID 

Invalid argument input.

EFC_RC_NOT_SUPPORT 

Operation is not supported.