lib_flash_at49.h

来自「使用JTAG口对AT91R40008芯片进行FLASH编程的程序」· C头文件 代码 · 共 98 行

H
98
字号
//*----------------------------------------------------------------------------//*      ATMEL Microcontroller Software Support  -  ROUSSET  -//*----------------------------------------------------------------------------//* The software is delivered "AS IS" without warranty or condition of any//* kind, either express, implied or statutory. This includes without//* limitation any warranty or condition with respect to merchantability or//* fitness for any particular purpose, or against the infringements of//* intellectual property rights of others.//*----------------------------------------------------------------------------//* File Name           : lib_flash_at49.h//* Object              : Flash AT49BV Prototyping File//*                             AT49BV1604/AT49BV1604T//*                             AT49BV1614/AT49BV1604T//*                             AT49BV8011/AT49BV8011T//*                             AT49BV8011/AT49BV8011T//*//* 1.0 02/11/00 JPP    : Creation//*----------------------------------------------------------------------------#ifndef lib_flash_at49_h#define lib_flash_at49_h//* --------------------------- include file ----------------------------------/* Standards	*/typedef unsigned int        u_int;typedef unsigned short		u_char;/* 16-bit Flash Data type */typedef volatile unsigned short flash_word ;/* Include Standard c Libraries to allow stand alone compiling and operation */#define TRUE    1#define FALSE   0/*Flash type*/#define ATMEL_MANUFACTURED          0x001F#define FLASH_AT49BV_UNKNOW         0xFFFF#define FLASH_AT49BV8011            0x00CB#define FLASH_AT49BV8011T           0x004A#define FLASH_AT49BV16x4            0x00C0#define FLASH_AT49BV16x4T           0x00C2/* Timeout loop count */#define TIME_OUT                    100000000/* Loop count for delay after sequence */#define DELAY_ERASE                 10000000/* Trials Number to erase a sector */#define NB_TRIAL_ERASE              20/* Define Flash Codes */#define FLASH_SEQ_ADD1              (0x5555)#define FLASH_SEQ_ADD2              (0x2AAA)#define FLASH_CODE1                 ((flash_word)(0xAA))#define FLASH_CODE2                 ((flash_word)(0x55))#define ID_IN_CODE                  ((flash_word)(0x90))#define ID_OUT_CODE                 ((flash_word)(0xF0))#define WRITE_CODE                  ((flash_word)(0xA0))#define ERASE_SECTOR_CODE1          ((flash_word)(0x80))#define ERASE_SECTOR_CODE2          ((flash_word)(0x30))#define CHIP_ERASE_CODE             ((flash_word)(0x10))/*---------------------------  Structure definition -------------------------*//* Defines organization structure */typedef struct OrgDef{    unsigned int    sector_number ;    unsigned int    sector_size ;} OrgDef ;//* Defines Flash device definition structuretypedef struct FlashAt49BVDef{    unsigned int    flash_size;    unsigned int    flash_id;    OrgDef          *flash_org;    unsigned int    flash_block_nb;} FlashAt49BVDef;#define NB_FLASH_SUPPORTED 4#define R_BIT	1#define W_BIT	2/*---------------------------  Function Prototyping -------------------------*///* extern flash_word flash_at49_identify ( flash_word *base_addr );extern int flash_at49_check_sector_erased ( flash_word *sector_addr,int size);extern int flash_at49_erase_sector ( flash_word *base_addr,flash_word *sector_addr);extern int flash_at49_write_flash ( flash_word *base_addr,flash_word *load_addr,flash_word data );#endif  /* lib_flash_at49_h */

⌨️ 快捷键说明

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