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

📄 flash.h

📁 数字信号处理
💻 H
字号:
#ifndef lib_flash_at49_h
#define lib_flash_at49_h

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

/* 8-bit Flash Data type */
typedef volatile unsigned char flash_byte ;

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

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

/*Flash type*/
#define SST_MANUFACTURED 			0xBF
#define AMD_MANUFACTURED			0x01
#define FLASH_AT49BV_UNKNOW         0xFFFF
#define FLASH_SST39VF1601           0x4B
#define FLASH_AM29F040				0xA4

#define FLASH_IDENT_DEFAULT	    	0x0000

/* 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              (0x5555)
#define FLASH_SEQ_ADD2              (0x2AAA)

#define FLASH_CODE1                 (unsigned short)(0xAA)
#define FLASH_CODE2                 (unsigned short)(0x55)
#define ID_IN_CODE                  (unsigned short)(0x90)
#define ID_OUT_CODE                 (unsigned short)(0xF0)
#define WRITE_CODE                  (unsigned short)(0xA0)
#define ERASE_SECTOR_CODE1          (unsigned short)(0x80)
#define ERASE_SECTOR_CODE2          (unsigned short)(0x30)
#define CHIP_ERASE_CODE             (unsigned short)(0x10)

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

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

//* Defines Flash device definition structure*/
typedef struct TMS320C3xDef
{
    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;

} TMS320C3xDef;

#define NB_FLASH_SUPPORTED 2

/* Defines supported flash organizations */


 OrgDef OrgSST39VF1601[] =
{
    /* 8 x 8kbytes sectors */
    {
        512,
        2*1024
    },
    /* 2 x 32 kbytes sectors */
    {
        2,
        32*1024,
    },
    /* 30 x 64 kbytes sectors */
    {
        30,
        64*1024,
    }
};

 OrgDef OrgAM29F040[] =
{
    /* 30 x 64 kbytes sectors */
    {
        8,
        64*1024,
    },
    /* 2 x 32 kbytes sectors */
    {
        8,
        64*1024,
    },
    /* 8 x 8kbytes sectors */
    {
        8,
        64*1024
    }
};

/* Define supported flash Table */
const TMS320C3xDef FlashTable[NB_FLASH_SUPPORTED] =
{
    {
        2*1024*1024,                /* 2 M Bytes */
        "SST39VF1601",
        SST_MANUFACTURED,
        FLASH_SST39VF1601,
	FLASH_IDENT_DEFAULT,
        0x001FFFFF,
        OrgSST39VF1601,
        /*sizeof(OrgSST39VF1601)/sizeof(OrgDef)*/
        1
    },
    {
        512*1024,                /* 512K Bytes */
        "AM29F040",
        AMD_MANUFACTURED,
        FLASH_AM29F040,
	FLASH_IDENT_DEFAULT,
        0x007FFFF,
        OrgAM29F040,
        1
    },
};

/*---------------------------  Function Prototyping -------------------------*/
#ifdef ESS
extern flash_byte flash_at49_identify ( flash_byte *base_addr );
extern int flash_at49_check_sector_erased ( flash_byte *sector_addr,int size);
extern int flash_at49_erase_sector ( flash_byte *base_addr,flash_byte *sector_addr);
extern int flash_at49_write_flash ( flash_byte *base_addr,flash_byte *load_addr,flash_byte data );
extern int flash_at49_check_flash_erased ( TMS320C3xDef *flash, flash_byte *addr_base );
extern int flash_at49_erase_flash ( TMS320C3xDef *flash,flash_byte *base_addr );


/* write tools  defined in flash_atxx_write.c */

extern int flash_at49_erase_write_block ( u_char *buffer,int size);
extern void flash_at49_init_write ( flash_byte *address_base,flash_byte *address_load,TMS320C3xDef *flash_type);
#endif
#endif  /* lib_flash_at49_h */

⌨️ 快捷键说明

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