📄 dataflash.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 : at45db321.h
//* Object : Data Flash Atmel AT45DB321 Description File
//* Translator : ARM Software Development Toolkit V2.5
//*
//* 1.0 03/06/00 PF : Creation
//*---------------------------------------------------------------------------
#ifndef at45db321_h
#define at45db321_h
/*--------------------*/
/* Command Definition */
/*--------------------*/
#define DB_PAGE_READ 0x52 /* Main memory page read */
#define DB_BUF1_READ 0x54 /* Buffer 1 read */
#define DB_BUF2_READ 0x56 /* Buffer 2 read */
#define DB_PAGE_2_BUF1_TRF 0x53 /* Main memory page to buffer 1 transfert */
#define DB_PAGE_2_BUF2_TRF 0x55 /* Main memory page to buffer 2 transfert */
#define DB_PAGE_2_BUF1_CMP 0x60 /* Main memory page to buffer 1 compare */
#define DB_PAGE_2_BUF2_CMP 0x61 /* Main memory page to buffer 2 compare */
#define DB_BUF1_WRITE 0x84 /* Buffer 1 write */
#define DB_BUF2_WRITE 0x87 /* Buffer 2 write */
#define DB_BUF1_PAGE_ERASE_PGM 0x83 /* Buffer 1 to main memory page program with built-In erase */
#define DB_BUF2_PAGE_ERASE_PGM 0x86 /* Buffer 2 to main memory page program with built-In erase */
#define DB_BUF1_PAGE_PGM 0x88 /* Buffer 1 to main memory page program without built-In erase */
#define DB_BUF2_PAGE_PGM 0x89 /* Buffer 2 to main memory page program without built-In erase */
#define DB_PAGE_ERASE 0x81 /* Page Erase */
#define DB_BLOCK_ERASE 0x50 /* Block Erase */
#define DB_PAGE_PGM_BUF1 0x82 /* Main memory page through buffer 1 */
#define DB_PAGE_PGM_BUF2 0x85 /* Main memory page through buffer 2 */
#define DB_AUTO_PAGE_PGM_BUF1 0x58 /* Auto page rewrite throught buffer 1 */
#define DB_AUTO_PAGE_PGM_BUF2 0x59 /* Auto page rewrite throught buffer 2 */
#define DB_STATUS 0x57 /* Status Register */
/*-----------------*/
/* Size Definition */
/*-----------------*/
#define DB321_PAGE_SIZE 528
#define DB321_PAGE_PER_BLOCK 8
#define DB321_BLOCK_SIZE (DB321_PAGE_SIZE*DB321_PAGE_PER_BLOCK) /* 528*8 = 4224 bytes */
#define DB321_BLOCK_PER_SECTOR 64
#define DB321_PAGE_PER_SECTOR (DB321_PAGE_PER_BLOCK*DB321_BLOCK_PER_SECTOR) /* 8*64 = 512 pages */
#define DB321_SECTOR_SIZE (DB321_BLOCK_PER_SECTOR*DB321_BLOCK_SIZE) /* (8*528)*64 = 270336 bytes */
#define DB321_SECTOR_NUMBER 17
#define DB321_SECTOR_0_SIZE (DB321_PAGE_PER_BLOCK*DB321_PAGE_SIZE) /* 8*528 = 4224 bytes */
#define DB321_SECTOR_1_SIZE (DB321_BLOCK_PER_SECTOR*DB321_BLOCK_SIZE) /* 64*4224 = 261888 bytes */
#define DB321_SIZE (DB321_SECTOR_NUMBER*DB321_SECTOR_SIZE)
#define DB_STATUS_MASK_READY 0x80 /* Dataflash ready/busy mask */
/*DataFlash return value */
#define DATAFLASH_WRITE_OK TRUE
#define DATAFLASH_READ_OK TRUE
#define DATAFLASH_OPEN_OK TRUE
#define DATAFLASH_READY TRUE
#define DATAFLASH_BUSY FALSE
#define DATAFLASH_INVALIDE -1
#define DATAFLASH_MEMORY_OVERFLOW -2
#define DATAFLASH_WRITE_ERROR -3
#define DATAFLASH_READ_ERROR -4
#define DATAFLASH_OPEN_ERROR -5
/*DataFlash device definition structure */
typedef struct
{
unsigned char Dataflash_mask;
int pages_number;
int pages_size;
}S_DataflashDef;
extern S_DataflashDef *S_Dataflash_detect;
extern u_int dataflash_open ( void );
extern void dataflash_close ( void );
extern int dataflash_wait_ready(int time_out );
extern int dataflash_read (int src, u_char *dest, int size );
extern int dataflash_write (u_char *src, int dest, int size);
extern void dataflash_write_buffer ( u_char *src, u_char *dest, int size ) ;
extern void dataflash_read_buffer ( u_char *src, u_char *dest, int size ) ;
#endif /* at45db321_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -