?? flash_at49.h
字號:
//*----------------------------------------------------------------------------
//* 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 : flash_at49.h
//* Object : Flash AT49BV Prototyping File
//* AT49BV1604/AT49BV1604T
//* AT49BV1614/AT49BV1604T
//* AT49BV8011/AT49BV8011T
//* AT49BV8011/AT49BV8011T
//* AT49BV1614A/AT49BV1604AT
//*
//* 1.0 02/Nov/00 JPP : Creation
//* 1.1 04/Apr/03 NCy : Add AT49BV1604A/AT49BV1604AT
//*----------------------------------------------------------------------------
#ifndef lib_flash_at49_h
#define lib_flash_at49_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 ATMEL_MANUFACTURED 0x001F
#define FLASH_AT49BV_UNKNOW 0xFFFF
#define FLASH_AT49BV8011 0x00CB
#define FLASH_AT49BV8011T 0x004A
#define FLASH_AT49BV16x4 0x00C0
#define FLASH_AT49BV16x4T 0x00C2
#define FLASH_AT49BV16x4A 0x00C0
#define FLASH_AT49BV16x4AT 0x00C2
#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 (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 FlashAt49BVDef
{
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;
} FlashAt49BVDef;
#define NB_FLASH_SUPPORTED 6
/* Defines supported flash organizations */
OrgDef OrgAT49BV8011[] =
{
/* 1 x 16kbytes sectors */
{
1,
16*1024
},
/* 1 x 32 kbytes sectors */
{
1,
32*1024,
},
/* 4 x 8 kbytes sectors */
{
4,
8*1024,
},
/* 1 x 32 kbytes sectors */
{
1,
32*1024,
},
/* 1 x 16kbytes sectors */
{
1,
16*1024
},
/* 14 x 64 kbytes sectors */
{
14,
64*1024,
}
};
OrgDef OrgAT49BV8011T[] =
{
/* 14 x 64 kbytes sectors */
{
14,
64*1024,
},
/* 1 x 16kbytes sectors */
{
1,
16*1024
},
/* 1 x 32 kbytes sectors */
{
1,
32*1024,
},
/* 4 x 8 kbytes sectors */
{
4,
8*1024,
},
/* 1 x 32 kbytes sectors */
{
1,
32*1024,
},
/* 1 x 16kbytes sectors */
{
1,
16*1024
}
};
OrgDef OrgAT49BV16x4[] =
{
/* 8 x 8kbytes sectors */
{
8,
8*1024
},
/* 2 x 32 kbytes sectors */
{
2,
32*1024,
},
/* 30 x 64 kbytes sectors */
{
30,
64*1024,
}
};
OrgDef OrgAT49BV16x4T[] =
{
/* 30 x 64 kbytes sectors */
{
30,
64*1024,
},
/* 2 x 32 kbytes sectors */
{
2,
32*1024,
},
/* 8 x 8kbytes sectors */
{
8,
8*1024
}
};
OrgDef OrgAT49BV16x4A[] =
{
/* 8 x 8kbytes sectors */
{
8,
8*1024
},
/* 31 x 64 kbytes sectors */
{
31,
64*1024,
}
};
OrgDef OrgAT49BV16x4AT[] =
{
/* 31 x 64 kbytes sectors */
{
31,
64*1024,
},
/* 8 x 8kbytes sectors */
{
8,
8*1024
}
};
/* Define supported flash Table */
const FlashAt49BVDef FlashTable[NB_FLASH_SUPPORTED] =
{
{
1024*1024, /* 1 M Bytes */
"AT49BV8011",
ATMEL_MANUFACTURED,
FLASH_AT49BV8011,
FLASH_IDENT_DEFAULT,
0x000FFFFF,
OrgAT49BV8011,
sizeof(OrgAT49BV8011)/sizeof(OrgDef)
},
{
1024*1024, /* 1 M Bytes */
"AT49BV8011",
ATMEL_MANUFACTURED,
FLASH_AT49BV8011T,
FLASH_IDENT_DEFAULT,
0x000FFFFF,
OrgAT49BV8011T,
sizeof(OrgAT49BV8011T)/sizeof(OrgDef)
},
{
2*1024*1024, /* 2 M Bytes */
"AT49BV16x4",
ATMEL_MANUFACTURED,
FLASH_AT49BV16x4,
FLASH_IDENT_DEFAULT,
0x001FFFFF,
OrgAT49BV16x4,
sizeof(OrgAT49BV16x4)/sizeof(OrgDef)
},
{
2*1024*1024, /* 2 M Bytes */
"AT49BV16x4T",
ATMEL_MANUFACTURED,
FLASH_AT49BV16x4T,
FLASH_IDENT_DEFAULT,
0x001FFFFF,
OrgAT49BV16x4T,
sizeof(OrgAT49BV16x4T)/sizeof(OrgDef)
},
{
2*1024*1024,
"AT49BV16x4A",
ATMEL_MANUFACTURED,
FLASH_AT49BV16x4A,
FLASH_IDENT_AT49BV16x4A,
0x001FFFFF,
OrgAT49BV16x4A,
sizeof(OrgAT49BV16x4A)/sizeof(OrgDef)
},
{
2*1024*1024,
"AT49BV16x4AT",
ATMEL_MANUFACTURED,
FLASH_AT49BV16x4AT,
FLASH_IDENT_AT49BV16x4A,
0x001FFFFF,
OrgAT49BV16x4AT,
sizeof(OrgAT49BV16x4AT)/sizeof(OrgDef)
}
};
/*--------------------------- Function Prototyping -------------------------*/
#ifdef ESS
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 );
extern int flash_at49_check_flash_erased ( FlashAt49BVDef *flash, flash_word *addr_base );
extern int flash_at49_erase_flash ( FlashAt49BVDef *flash,flash_word *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_word *address_base,flash_word *address_load,FlashAt49BVDef *flash_type);
#endif
#endif /* lib_flash_at49_h */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -