| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /* Copyright (c) 2010 - 2018 Arm Ltd.
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- - Neither the name of Arm nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- ---------------------------------------------------------------------------*/
-
- /***********************************************************************/
- /* */
- /* FlashOS.h: Data structures and entries */
- /* for Flash Programming Functions */
- /* */
- /***********************************************************************/
- #define VERS 1 // Interface Version 1.01
- #define UNKNOWN 0 // Unknown
- #define ONCHIP 1 // On-chip Flash Memory
- #define EXT8BIT 2 // External Flash Device on 8-bit Bus
- #define EXT16BIT 3 // External Flash Device on 16-bit Bus
- #define EXT32BIT 4 // External Flash Device on 32-bit Bus
- #define EXTSPI 5 // External Flash Device on SPI
- #define SECTOR_NUM 512 // Max Number of Sector Items
- #define PAGE_MAX 65536 // Max Page Size for Programming
- struct FlashSectors {
- unsigned long szSector; // Sector Size in Bytes
- unsigned long AddrSector; // Address of Sector
- };
- #define SECTOR_END 0xFFFFFFFF, 0xFFFFFFFF
- struct FlashDevice {
- unsigned short Vers; // Version Number and Architecture
- char DevName[128]; // Device Name and Description
- unsigned short DevType; // Device Type: ONCHIP, EXT8BIT, EXT16BIT, ...
- unsigned long DevAdr; // Default Device Start Address
- unsigned long szDev; // Total Size of Device
- unsigned long szPage; // Programming Page Size
- unsigned long Res; // Reserved for future Extension
- unsigned char valEmpty; // Content of Erased Memory
- unsigned long toProg; // Time Out of Program Page Function
- unsigned long toErase; // Time Out of Erase Sector Function
- struct FlashSectors sectors[SECTOR_NUM];
- };
- #define FLASH_DRV_VERS (0x0100+VERS) // Driver Version, do not modify!
- // Flash Programming Functions (Called by FlashOS)
- extern int Init (unsigned long adr, // Initialize Flash
- unsigned long clk,
- unsigned long fnc);
- extern int UnInit (unsigned long fnc); // De-initialize Flash
- extern int BlankCheck (unsigned long adr, // Blank Check
- unsigned long sz,
- unsigned char pat);
- extern int EraseChip (void); // Erase complete Device
- extern int EraseSector (unsigned long adr); // Erase Sector Function
- extern int ProgramPage (unsigned long adr, // Program Page Function
- unsigned long sz,
- unsigned char *buf);
- extern unsigned long Verify (unsigned long adr, // Verify Function
- unsigned long sz,
- unsigned char *buf);
|