// AMDFLASH.H

// Flash-Utilities for AMD Am29F010 on PHYTEC Board U8/U9

// 2 x 128 kBytes, CS0 (00:0000, 04:0000, 08:0000, ...

//     if not covered by CS1, CS2, CS3

// This module and the calling program must be located in

//     Segment 0

// External RAM (64kBytes) is used as shadow memory of

//     Segment 0


// Routines cannot run in the FLASH. Therefore switch to RAM

void SwitchToRAM(void);

void SwitchToFlash(void);


uword GetManufacturerID(void);  uword GetDeviceID(void);


// sector_number 0..7

uword SectorProtectVerify(uword sector_number);


// returns  0x0000 .. ok;  0x0080, 0x8000, 0x8080 .. Errors

uword ProgramWord(ulong addr, uword val);


// returns  0x0000 .. ok;  0x0080, 0x8000, 0x8080 .. Errors

uword SectorErase(ulong addr);


// returns  0x0000 .. ok;  0x0080, 0x8000, 0x8080 .. Errors

uword ChipErase(void);