zoukankan      html  css  js  c++  java
  • 使用飞思卡尔的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     4
    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_ */

     注意,在使用过程中,flash会发现swap,此时不能再对其进行读写。需要等待高压操作完成后才对flash进行操作。

    #if 1 /* necessary busy waiting to ensure safty */
    while(eraseStatus_Flag == ERASE_INPROGRESS)
    {
      ret = FSL_MainFunction(&eepromConf,&CallBack);
    }
    #endif

     

  • 相关阅读:
    Java中的==和equals区别
    2014年06月30日
    20140625&nbsp;20:39
    20140627&nbsp;20:47
    2014年06月30日
    20140628&nbsp;16:07
    hdu 1418 抱歉 (数学)
    hdu 1302 The Snail (模拟)
    hdu 1391Number Steps
    hdu 1395 2^x mod n = 1
  • 原文地址:https://www.cnblogs.com/praiseslow/p/9951720.html
Copyright © 2011-2022 走看看