📄 davincievm_flash.h
字号:
/*
* Copyright 2005 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*
* Not for distribution.
*/
/*
* ======== flash.h ========
* Interface for AMD Flash
*/
#ifndef FLASH_
#define FLASH_
#ifdef __cplusplus
extern "C" {
#endif
#include "davincievm.h"
/* ------------------------------------------------------------------------ *
* Flash Device *
* ------------------------------------------------------------------------ */
#define MFG_AMD 0x01
#define DEV_AM29LV256M_1 0x227E
#define DEV_AM29LV256M_2 0x2212
#define DEV_AM29LV256M_3 0x2201
#define DEV_AM29LV256M_SIZE 0x02000000
#define DEV_S29GL512N_1 0x227E
#define DEV_S29GL512N_2 0x2223
#define DEV_S29GL512N_3 0x2201
#define DEV_S29GL512N_SIZE 0x04000000
#define DEV_S29GL256N_1 0x227E
#define DEV_S29GL256N_2 0x2222
#define DEV_S29GL256N_3 0x2201
#define DEV_S29GL256N_SIZE 0x02000000
#define DEV_S29GL128N_1 0x227E
#define DEV_S29GL128N_2 0x2221
#define DEV_S29GL128N_3 0x2201
#define DEV_S29GL128N_SIZE 0x01000000
/* ------------------------------------------------------------------------ *
* Flash Memory Property Definitions *
* ------------------------------------------------------------------------ */
#define FLASH_BASE 0x02000000
#define FLASH_PAGESIZE 0x00010000
#define FLASH_PAGESIZE_POW2 16
#define FLASH_PAGES FLASH_getTotalPages( 1 )
#define FLASH_SIZE FLASH_PAGES * FLASH_PAGESIZE
#define FLASH_SUPPORT 1
/* ------------------------------------------------------------------------ *
* Flash Memory Data Pointer *
* ------------------------------------------------------------------------ */
#define FLASH_BASE_PTR32 *( volatile Uint32* )FLASH_BASE
#define FLASH_BASE_PTR16 *( volatile Uint16* )FLASH_BASE
#define FLASH_BASE_PTR8 *( volatile Uint8* ) FLASH_BASE
#define FLASH_CTL055 *( volatile Uint16* )( FLASH_BASE + 0xAA )
#define FLASH_CTL555 *( volatile Uint16* )( FLASH_BASE + 0xAAA )
#define FLASH_CTL2AA *( volatile Uint16* )( FLASH_BASE + 0x554 )
#define FLASH_CTLAAA *( volatile Uint8* )( FLASH_BASE + 0x554 )
/* ------------------------------------------------------------------------ *
* Flash Command Codes *
* ------------------------------------------------------------------------ */
#define FLASH_RESET 0xF0
#define FLASH_CMD_AA 0xAA
#define FLASH_CMD_55 0x55
#define FLASH_ID 0x90
#define FLASH_PROGRAM 0xA0
#define FLASH_WRITE_BUFFER 0x25
#define FLASH_PROGRAM_BUFFER 0x29
#define FLASH_ERASE 0x80
#define FLASH_ERASE_CHIP 0x10
#define FLASH_ERASE_SECTOR 0x30
#define FLASH_ERASE_SUSPEND 0xB0
#define FLASH_ERASE_RESUME 0x10
#define FLASH_CFI_QUERY 0x98
/* ------------------------------------------------------------------------ *
* Prototypes *
* ------------------------------------------------------------------------ */
/* Determine the total number of pages of Flash */
Uint32 DAVINCIEVM_FLASH_getTotalPages( Uint16 num_flash_device );
/* Calculate the checksum of a data range in Flash */
Uint32 DAVINCIEVM_FLASH_checksum( Uint32 start, Uint32 length );
/* Erase blocks Flash memory */
Int16 DAVINCIEVM_FLASH_erase( Uint32 start, Uint32 length );
/* Read data from Flash */
Int16 DAVINCIEVM_FLASH_read( Uint32 src, Uint32 dst, Uint32 length );
/* Write data to Flash */
Int16 DAVINCIEVM_FLASH_write( Uint32 src, Uint32 dst, Uint32 length );
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -