1. 程式人生 > >使用飛思卡爾的FEE官方驅動

使用飛思卡爾的FEE官方驅動

通過參考官方的驅動手冊。修改ee_blocks.h匹配專案。

具體機理可以參考官方文件。本文件在wind river的編譯器dcc下測試並使用。

 

 1 #ifndef _EE_BLOCKS_H_
 2 #define _EE_BLOCKS_H_
 3 #include "ee_emulation.h"
 4 /* test ok for 5644A*/
 5 #define C90LC_LML                       0x0004         /* ? Low/Mid Address Sapce Block Locking Register */
 6 #define
C90LC_SLL 0x000C /* ? Secondary Low/Mid Address Space Block Locking Register */ 7 8 #define MAIN_ARRAY_BASE 0x00000000 9 10 /* 0 */ 11 #define BLOCK0_OFFSET 0x00010000 /* Offset of L4 */ 12 #define BLOCK0_SIZE 0x4000 /* 16KB size */ 13
#define BLOCK0_MASK 0b10000 /*L */ 14 #define BLOCK0_PARTITION (0x1<<1) 15 #define BLOCK0_ADD_SPACE LOW_ADDRESS_SPACE 16 17 /* 1 */ 18 #define BLOCK1_OFFSET 0x00014000 /* Offset of L5 */ 19 #define BLOCK1_SIZE 0x4000 /* 16 KB size */ 20
#define BLOCK1_MASK 0b100000 /*L */ 21 #define BLOCK1_PARTITION (0x1<<1) 22 #define BLOCK1_ADD_SPACE LOW_ADDRESS_SPACE 23 24 /* 2 */ 25 #define BLOCK2_OFFSET 0x00018000 /* Offset of L6 */ 26 #define BLOCK2_SIZE 0x4000 /* 16 KB size */ 27 #define BLOCK2_MASK 0b1000000 /*0b010000 L6*/ 28 #define BLOCK2_PARTITION (0x1<<1) /*partition 2 (start from partition1)*/ 29 #define BLOCK2_ADD_SPACE LOW_ADDRESS_SPACE 30 31 /* 3 */ 32 #define BLOCK3_OFFSET 0x0001C000 /* Offset of L7 */ 33 #define BLOCK3_SIZE 0x4000 /* 16 KB size */ 34 #define BLOCK3_MASK 0b10000000 /* 0b100000 L7*/ 35 #define BLOCK3_PARTITION (0x1<<1) /*partition 2 (start from partition1)*/ 36 #define BLOCK3_ADD_SPACE LOW_ADDRESS_SPACE 37 38 39 /* 0xFFFFFF0F means unlocking 0b11110000 in the whole space*/ 40 #define UNLOCK_EBLOCKS WRITE32(FLASH_REG_BASE + C90LC_LML, 0xA1A11111);\ 41 WRITE32(FLASH_REG_BASE + C90LC_SLL, 0xC3C33333);\ 42 WRITE32(FLASH_REG_BASE + C90LC_LML, 0xFFFFFF0F);\ 43 WRITE32(FLASH_REG_BASE + C90LC_SLL, 0xFFFFFF0F); 44 45 #endif /* _EE_BLOCKS_H_ */

 

 1 #ifndef _USER_CFG_H_
 2 #define _USER_CFG_H_
 3 #include "ee_blocks.h"
 4 #include "ee_emulation.h"
 5 
 6 //#define SCHEME_SELECT  ECC8_FIXLENGTH  /* works for 5644A */
 7 #define SCHEME_SELECT  ECC8_VARLENGTH    /* works for 5644A */
 8 //#define SCHEME_SELECT  ECC4_FIXLENGTH    /* not ok! FSL_InitEeprom returns EE_ERROR_PE_OPT(0x10)*/
 9 //#define SCHEME_SELECT ECC16_FIXLENGTH /* not for 5644A*/
10 
11 #define MAX_REERASE                 1
12 
13 #define MAX_REPGM_BLK_IND           1
14     
15 #define SWAP_CACHE_SIZE             0x30
16 
17 #define EER_OPTION                  IVOR_EXCEPTION
18 
19 #define FLASH_MODULE                C90FL
20 
21 #define FLASH_REG_BASE              0xC3F88000
22 /*1 FLASH_A_REGS_BASE = 0xC3F8_8000
23 FLASH_B_REGS_BASE = 0xC3F8_C000*/
24 
25 /* Size of eeprom cache byte*/
26 #define EE_CACHE_SIZE       0x80
27 /* Number of eeprom blocks*/
28 #define NUMBER_OF_BLOCK     3
29 /* Maximum number of active blocks */
30 #define NUMBER_OF_ACTIVE_BLOCKS     2
31 /* Size of buffer */
32 #define BUFFER_SIZE         0x50
33 /* Size of data if a fixed length record schem is seleted */
34 #define DATA_SIZE                   0x40   
35 
36 #endif /* _USER_CFG_H_ */