⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flash_29lv.h

📁 本资料说明如何采用Multi-ICE 和ADS通过JTAG口在线烧写FLASH 1
💻 H
字号:
#ifndef lib_flash_29lv_h
#define lib_flash_29lv_h

//* --------------------------- include file ----------------------------------

/* 16-bit Flash Data type */
typedef volatile unsigned short flash_word ;

/*---------------------------  Constants definition -------------------------*/

/* Include Standard c Libraries to allow stand alone compiling and operation */
#define TRUE    1
#define FALSE   0

/*Flash type*/
#define HYNIX_MANUFACTURED      0x00AD
#define AMD_MANUFACTURED		0x0001
#define FLASH_AT49BV_UNKNOW     0xFFFF
#define FLASH_HY29LV800B        0x225B
#define FLASH_HY29LV800T        0x22DA
#define FLASH_AM29LV800B        0x225B
#define FLASH_AM29LV160B        0x2249

#define FLASH_IDENT_DEFAULT	    0x0000
#define FLASH_IDENT_AT49BV16x4A	    0x00C8

/* Timeout loop count */
#define TIME_OUT                    10000000
/* Loop count for delay after sequence */
#define DELAY_ERASE                 10000000

/* Trials Number to erase a sector */
#define NB_TRIAL_ERASE              10

/* Define Flash Codes */
#define FLASH_SEQ_ADD1              (0x555)
#define FLASH_SEQ_ADD2              (0x2AA)

#define FLASH_RESET_CODE			(unsigned short)(0xF0F0)
#define FLASH_CODE1                 (unsigned short)(0xAAAA)
#define FLASH_CODE2                 (unsigned short)(0x5555)
#define ID_IN_CODE                  (unsigned short)(0x9090)
#define ID_OUT_CODE                 (unsigned short)(0xF0F0)
#define WRITE_CODE                  (unsigned short)(0xA0A0)
#define ERASE_SECTOR_CODE1          (unsigned short)(0x8080)
#define ERASE_SECTOR_CODE2          (unsigned short)(0x3030)
#define CHIP_ERASE_CODE             (unsigned short)(0x1010)

/*---------------------------  Structure definition -------------------------*/

/* Defines organization structure */
typedef struct OrgDef
{
    unsigned int    sector_number ;
    unsigned int    sector_size ;
} OrgDef ;

//* Defines Flash device definition structure
typedef struct FlashDef
{
    unsigned int    flash_size;
    char            *flash_name;
    unsigned int    flash_manuf_id;
    unsigned int    flash_id;
    unsigned int    flash_extra_id;
    unsigned int    flash_mask;
    OrgDef          *flash_org;
    unsigned int    flash_block_nb;

} FlashDef;

#define NB_FLASH_SUPPORTED 4

/* Defines supported flash organizations */
OrgDef OrgHY29LV800B[] =
{
    /* 1 x 16kbytes sectors */
    {
        1,
        16*1024
    },
    /* 1 x 8 kbytes sectors */
    {
        2,
        8*1024,
    },
    /* 1 x 32 kbytes sectors */
    {
        1,
        32*1024,
    },
    /* 15 x 64 kbytes sectors */
    {
        14,
        64*1024,
    }
};

 OrgDef OrgAM29LV800B[] =
{
    /* 1 x 16kbytes sectors */
    {
        1,
        16*1024
    },
    /* 1 x 8 kbytes sectors */
    {
        2,
        8*1024,
    },
    /* 1 x 32 kbytes sectors */
    {
        1,
        32*1024,
    },
    /* 15 x 64 kbytes sectors */
    {
        14,
        64*1024,
    }
};

 OrgDef OrgAM29LV160B[] =
{
	/* 1 x 16kbytes sectors */
    {
        1,
        16*1024
    },
    /* 1 x 8 kbytes sectors */
    {
        2,
        8*1024,
    },
    /* 1 x 32 kbytes sectors */
    {
        1,
        32*1024,
    },
    /* 15 x 64 kbytes sectors */
    {
        31,
        64*1024,
    }
};



/* Define supported flash Table */
const FlashDef FlashTable[NB_FLASH_SUPPORTED] =
{
    {
        1024*1024,                  /* 1 M Bytes */
        "HY29LV800B",
        HYNIX_MANUFACTURED,
        FLASH_HY29LV800B,
		FLASH_IDENT_DEFAULT,
        0x000FFFFF,
        OrgHY29LV800B,
        sizeof(OrgHY29LV800B)/sizeof(OrgDef)
    },
    {
        1024*1024,                  /* 1 M Bytes */
        "AMD29LV800B",
        AMD_MANUFACTURED,
        FLASH_AM29LV800B,
		FLASH_IDENT_DEFAULT,
        0x000FFFFF,
        OrgAM29LV800B,
        sizeof(OrgAM29LV800B)/sizeof(OrgDef)
    },
    {
        2*1024*1024,                /* 2 M Bytes */
        "AMD29LV160B",
        AMD_MANUFACTURED,
        FLASH_AM29LV160B,
		FLASH_IDENT_DEFAULT,
        0x001FFFFF,
        OrgAM29LV160B,
        sizeof(OrgAM29LV160B)/sizeof(OrgDef)
    },
};

#endif  /* lib_flash_29lv_h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -