efc.h
Go to the documentation of this file.
00001 
00044 #ifndef EFC_H_INCLUDED
00045 #define EFC_H_INCLUDED
00046 
00047 #include <Arduino.h>
00048 #include <inttypes.h>
00049 
00050 #define SAM3XA
00051 #define RAMFUNC __attribute__ ((section(".ramfunc")))
00052 
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058 
00059 
00060 
00062 
00063 typedef enum efc_rc {
00064         EFC_RC_OK = 0,      
00065         EFC_RC_YES = 0,     
00066         EFC_RC_NO = 1,      
00067         EFC_RC_ERROR = 1,   
00068         EFC_RC_INVALID,     
00069         EFC_RC_NOT_SUPPORT = 0xFFFFFFFF 
00070 } efc_rc_t;
00072 
00074 
00075 #define EFC_FCMD_GETD    0x00  //!< Get Flash Descriptor
00076 #define EFC_FCMD_WP      0x01  //!< Write page
00077 #define EFC_FCMD_WPL     0x02  //!< Write page and lock
00078 #define EFC_FCMD_EWP     0x03  //!< Erase page and write page
00079 #define EFC_FCMD_EWPL    0x04  //!< Erase page and write page then lock
00080 #define EFC_FCMD_EA      0x05  //!< Erase all
00081 #if (SAM3SD8)
00082 #define EFC_FCMD_EPL     0x06  //!< Erase plane
00083 #endif
00084 #if (SAM4S || SAM4E)
00085 #define EFC_FCMD_EPA     0x07  //!< Erase pages
00086 #endif
00087 #define EFC_FCMD_SLB     0x08  //!< Set Lock Bit
00088 #define EFC_FCMD_CLB     0x09  //!< Clear Lock Bit
00089 #define EFC_FCMD_GLB     0x0A  //!< Get Lock Bit
00090 #define EFC_FCMD_SGPB    0x0B  //!< Set GPNVM Bit
00091 #define EFC_FCMD_CGPB    0x0C  //!< Clear GPNVM Bit
00092 #define EFC_FCMD_GGPB    0x0D  //!< Get GPNVM Bit
00093 #define EFC_FCMD_STUI    0x0E  //!< Start unique ID
00094 #define EFC_FCMD_SPUI    0x0F  //!< Stop unique ID
00095 #if (!SAM3U && !SAM3SD8 && !SAM3S8)
00096 #define EFC_FCMD_GCALB   0x10  //!< Get CALIB Bit
00097 #endif
00098 #if (SAM4S || SAM4E)
00099 #define EFC_FCMD_ES      0x11  //!< Erase sector
00100 #define EFC_FCMD_WUS     0x12  //!< Write user signature
00101 #define EFC_FCMD_EUS     0x13  //!< Erase user signature
00102 #define EFC_FCMD_STUS    0x14  //!< Start read user signature
00103 #define EFC_FCMD_SPUS    0x15  //!< Stop read user signature
00104 #endif
00105 
00106 
00108 #define CHIP_FLASH_IAP_ADDRESS  (IROM_ADDR + 8)
00109 
00111 
00112 #define EFC_ACCESS_MODE_128    0
00113 #define EFC_ACCESS_MODE_64     EEFC_FMR_FAM
00114 
00115 
00116 uint32_t efc_init(Efc *p_efc, uint32_t ul_access_mode, uint32_t ul_fws);
00117 void efc_enable_frdy_interrupt(Efc *p_efc);
00118 void efc_disable_frdy_interrupt(Efc *p_efc);
00119 void efc_set_flash_access_mode(Efc *p_efc, uint32_t ul_mode);
00120 uint32_t efc_get_flash_access_mode(Efc *p_efc);
00121 void efc_set_wait_state(Efc *p_efc, uint32_t ul_fws);
00122 uint32_t efc_get_wait_state(Efc *p_efc);
00123 uint32_t efc_perform_command(Efc *p_efc, uint32_t ul_command,
00124                 uint32_t ul_argument);
00125 uint32_t efc_get_status(Efc *p_efc);
00126 uint32_t efc_get_result(Efc *p_efc);
00127 uint32_t efc_perform_read_sequence(Efc *p_efc,
00128                 uint32_t ul_cmd_st, uint32_t ul_cmd_sp,
00129                 uint32_t *p_ul_buf, uint32_t ul_size);
00130 
00132 
00133 #ifdef __cplusplus
00134 }
00135 #endif
00136 
00137 
00138 
00139 #endif /* EFC_H_INCLUDED */


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:22