flash_efc.h
Go to the documentation of this file.
00001 
00044 #ifndef FLASH_H_INCLUDED
00045 #define FLASH_H_INCLUDED
00046 
00047 #include <Arduino.h>
00048 #include "efc.h"
00049 
00050 /* Internal Flash 0 base address. */
00051 #define IFLASH_ADDR     IFLASH0_ADDR
00052         /* Internal flash page size. */
00053 #define IFLASH_PAGE_SIZE     IFLASH0_PAGE_SIZE
00054 
00055 /* Last page start address. */
00056 #define IFLASH_LAST_PAGE_ADDRESS (IFLASH1_ADDR + IFLASH1_SIZE - IFLASH1_PAGE_SIZE)
00057 
00059 
00060 #ifdef __cplusplus
00061  extern "C" {
00062 #endif
00063 
00064 
00065 
00067 
00068 typedef enum flash_rc {
00069         FLASH_RC_OK = 0,        
00070         FLASH_RC_YES = 0,       
00071         FLASH_RC_NO = 1,        
00072         FLASH_RC_ERROR = 0x10,  
00073         FLASH_RC_INVALID,       
00074         FLASH_RC_NOT_SUPPORT = 0xFFFFFFFF    
00075 } flash_rc_t;
00077 
00081 
00082 typedef enum flash_farg_page_num {
00083         /* 4 of pages to be erased with EPA command*/
00084         IFLASH_ERASE_PAGES_4=0,
00085         /* 8 of pages to be erased with EPA command*/
00086         IFLASH_ERASE_PAGES_8,
00087         /* 16 of pages to be erased with EPA command*/
00088         IFLASH_ERASE_PAGES_16,
00089         /* 32 of pages to be erased with EPA command*/
00090         IFLASH_ERASE_PAGES_32,
00091         /* Parameter is not support */
00092         IFLASH_ERASE_PAGES_INVALID,
00093 }flash_farg_page_num_t;
00095 
00097 
00098 #define FLASH_ACCESS_MODE_128    EFC_ACCESS_MODE_128
00099 #define FLASH_ACCESS_MODE_64     EFC_ACCESS_MODE_64
00100 
00101 
00102 uint32_t flash_init(uint32_t ul_mode, uint32_t ul_fws);
00103 uint32_t flash_set_wait_state(uint32_t ul_address, uint32_t ul_fws);
00104 uint32_t flash_set_wait_state_adaptively(uint32_t ul_address);
00105 uint32_t flash_get_wait_state(uint32_t ul_address);
00106 uint32_t flash_get_descriptor(uint32_t ul_address,
00107                 uint32_t *pul_flash_descriptor, uint32_t ul_size);
00108 uint32_t flash_get_page_count(const uint32_t *pul_flash_descriptor);
00109 uint32_t flash_get_page_count_per_region(const uint32_t *pul_flash_descriptor);
00110 uint32_t flash_get_region_count(const uint32_t *pul_flash_descriptor);
00111 uint32_t flash_erase_all(uint32_t ul_address);
00112 
00113 #if SAM3SD8
00114 uint32_t flash_erase_plane(uint32_t ul_address);
00115 #endif
00116 
00117 #if (SAM4S || SAM4E)
00118 uint32_t flash_erase_page(uint32_t ul_address, uint8_t uc_page_num);
00119 uint32_t flash_erase_sector(uint32_t ul_address);
00120 #endif
00121 
00122 uint32_t flash_write(uint32_t ul_address, const void *p_buffer,
00123                 uint32_t ul_size, uint32_t ul_erase_flag);
00124 uint32_t flash_lock(uint32_t ul_start, uint32_t ul_end,
00125                 uint32_t *pul_actual_start, uint32_t *pul_actual_end);
00126 uint32_t flash_unlock(uint32_t ul_start, uint32_t ul_end,
00127                 uint32_t *pul_actual_start, uint32_t *pul_actual_end);
00128 uint32_t flash_is_locked(uint32_t ul_start, uint32_t ul_end);
00129 uint32_t flash_set_gpnvm(uint32_t ul_gpnvm);
00130 uint32_t flash_clear_gpnvm(uint32_t ul_gpnvm);
00131 uint32_t flash_is_gpnvm_set(uint32_t ul_gpnvm);
00132 uint32_t flash_enable_security_bit(void);
00133 uint32_t flash_is_security_bit_enabled(void);
00134 uint32_t flash_read_unique_id(uint32_t *pul_data, uint32_t ul_size);
00135 
00136 #if (SAM4S || SAM4E)
00137 uint32_t flash_read_user_signature(uint32_t *p_data, uint32_t ul_size);
00138 uint32_t flash_write_user_signature(uint32_t ul_address, const void *p_buffer,
00139                 uint32_t ul_size);
00140 uint32_t flash_erase_user_signature(void);
00141 #endif
00142 
00144 
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148 
00149 
00150 
00151 #endif /* FLASH_H_INCLUDED */


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