📄 flash.h
字号:
/* * $Id: flash.h,v 1.1 2002/12/05 22:20:38 telka Exp $ * * Flash routines for Intel(R) StrataFlash(TM) Memory * 28F128J3A, 28F640J3A, 28F320J3A * (tested only with 28F640J3A and 28F128J3A) * Copyright (C) 2001, 2002 ETC s.r.o. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Written by Marcel Telka <marcel@telka.sk>, 2001, 2002. * */#ifndef FLASH_H#define FLASH_H#include <stdint.h>#include "download.h"/* this function can generate E_FL_* exceptions if fail */void FlashImage( struct imginfo *img, uint32_t FlashOffset );/* 4.1 Read Array Command *//* switch flash to read array mode */void FlashReadArray( void );/* 4.2 Read Query Mode Command *//* This struct contains data readed from flash memory (see 4.2 Read Query Mode Command in datasheet) */struct FlashInfo { /* 4.2.1 - 4.2.5 */ /* 4.2.6 Device Geometry Definition */ uint32_t size; /* flash memory size (in bytes) */ uint32_t wbufsize; /* write buffer size (in bytes) */ uint16_t eblocks; /* number of erase blocks */ uint32_t eblocksize; /* erase block size */ /* 4.2.7 Primary-Vendor Specific Extended Query Table */ /* TODO */};/* fills FlashInfo structure, if error, returns zero *//* Reads and checks infos related to chapter 4.2 Read Query Mode Command in datasheet */int FlashReadInfo( struct FlashInfo *fi );/* 4.3 Read Identifier Codes Command *//* * FlashReadID checks Manufacturer Code and returns Device Code (0x16, 0x17 or 0x18) * if error occured returns 0 * * Reads and checks infos related to chapter 4.3 Read Identifier Codes Command in datasheet, * except Block Lock Configuration (address X0002). */int FlashReadID( void );/* 4.4 Read Status Register Command *//* write Read Status Register Command and return status register */uint32_t FlashReadStatusRegister( void );/* 4.5 Clear Status Register Command */void FlashClearStatusRegister( void );/* 4.6 Block Erase Command *//* erase block, return masked status register (if no error, then 0) */uint32_t FlashBlockErase( int block );/* 4.7 TODO *//* 4.8 Write to Buffer Command *//* write size uint32_t's from src to dst, size cannot exceed write buffer size!!! *//* returns masked status register (zero if no error) */uint32_t FlashWriteToBuffer( uint32_t dst, const uint32_t *src, uint32_t size );/* 4.9 - 4.13 TODO *//* 4.14 Clear Block Lock-Bits Command */uint32_t FlashClearBlockLockBit( int block );/* 4.15 TODO */#endif /* FLASH_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -