SAMV71 Xplained Ultra Software Package 1.5

efc.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /**
00031  * \file
00032  *
00033  * \section Purpose
00034  *
00035  * Interface for configuration the Enhanced Embedded Flash Controller (EEFC)
00036  * peripheral.
00037  *
00038  * \section Usage
00039  *
00040  * -# Enable/disable %flash ready interrupt sources using EFC_EnableFrdyIt()
00041  *    and EFC_DisableFrdyIt().
00042  * -# Translates the given address into which EEFC, page and offset values
00043  *    for difference density %flash memory using EFC_TranslateAddress().
00044  * -# Computes the address of a %flash access given the EFC, page and offset
00045  *    for difference density %flash memory using EFC_ComputeAddress().
00046  * -# Start the executing command with EFC_PerformCommand()
00047  * -# Retrieve the current status of the EFC using EFC_GetStatus().
00048  * -# Retrieve the result of the last executed command with EFC_GetResult().
00049  */
00050 
00051 #ifndef _EEFC_
00052 #define _EEFC_
00053 
00054 /*----------------------------------------------------------------------------
00055  *        Headers
00056  *----------------------------------------------------------------------------*/
00057 #include "chip.h"
00058 
00059 #include <stdint.h>
00060 
00061 /*----------------------------------------------------------------------------
00062  *        Definitions
00063  *----------------------------------------------------------------------------*/
00064 /* TODO: Temporary definition for missing symbol in header file */
00065 #define IFLASH_SECTOR_SIZE      65536u
00066 
00067 
00068 /* EFC command */
00069 #define EFC_FCMD_GETD    0x00 /* Get Flash Descriptor */
00070 #define EFC_FCMD_WP      0x01 /* Write page */
00071 #define EFC_FCMD_WPL     0x02 /* Write page and lock */
00072 #define EFC_FCMD_EWP     0x03 /* Erase page and write page */
00073 #define EFC_FCMD_EWPL    0x04 /* Erase page and write page then lock */
00074 #define EFC_FCMD_EA      0x05 /* Erase all */
00075 #define EFC_FCMD_EPA     0x07 /* Erase pages */
00076 #define EFC_FCMD_SLB     0x08 /* Set Lock Bit */
00077 #define EFC_FCMD_CLB     0x09 /* Clear Lock Bit */
00078 #define EFC_FCMD_GLB     0x0A /* Get Lock Bit */
00079 #define EFC_FCMD_SFB     0x0B /* Set GPNVM Bit */
00080 #define EFC_FCMD_CFB     0x0C /* Clear GPNVM Bit */
00081 #define EFC_FCMD_GFB     0x0D /* Get GPNVM Bit */
00082 #define EFC_FCMD_STUI    0x0E /* Start unique ID */
00083 #define EFC_FCMD_SPUI    0x0F /* Stop unique ID */
00084 #define EFC_FCMD_GCALB   0x10 /* Get CALIB Bit */
00085 #define EFC_FCMD_ES      0x11 /* Erase Sector */
00086 #define EFC_FCMD_WUS     0x12 /* Write User Signature */
00087 #define EFC_FCMD_EUS     0x13 /* Erase User Signature */
00088 #define EFC_FCMD_STUS    0x14 /* Start Read User Signature */
00089 #define EFC_FCMD_SPUS    0x15 /* Stop Read User Signature */
00090 
00091 /* The IAP function entry address */
00092 #define CHIP_FLASH_IAP_ADDRESS  (0x00800008)
00093 
00094 #ifdef __cplusplus
00095 extern "C" {
00096 #endif
00097 
00098 /*----------------------------------------------------------------------------
00099  *        Exported functions
00100  *----------------------------------------------------------------------------*/
00101 
00102 extern void EFC_EnableFrdyIt(Efc *efc);
00103 
00104 extern void EFC_DisableFrdyIt(Efc *efc);
00105 
00106 extern void EFC_SetWaitState(Efc *efc, uint8_t cycles);
00107 
00108 extern void EFC_TranslateAddress(Efc **pEfc, uint32_t dwAddress,
00109                                   uint16_t *pwPage, uint16_t *pwOffset);
00110 
00111 extern void EFC_ComputeAddress(Efc *efc, uint16_t wPage, uint16_t wOffset,
00112                                 uint32_t *pdwAddress);
00113 
00114 extern uint32_t EFC_PerformCommand(Efc *efc, uint32_t dwCommand,
00115                                     uint32_t dwArgument, uint32_t dwUseIAP);
00116 
00117 extern uint32_t EFC_GetStatus(Efc *efc);
00118 
00119 extern uint32_t EFC_GetResult(Efc *efc);
00120 
00121 extern void EFC_SetFlashAccessMode(Efc *efc, uint32_t dwMode);
00122 
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126 
00127 #endif /* #ifndef _EEFC_ */
00128 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines