|
#defin U16 unsigned short
//**********************************************************
__ramfunc void flash_reset(void)
{
U16 *dummy_pointer;
dummy_pointer=(U16*)MEMORY_FLASH_START_ADDRESS;
*dummy_pointer=(U16)0x00F0;
} // end of flash_reset
//**********************************************************
// return
// 0 - This is our flash; All OK
// 1 - unknown flash
__ramfunc U16 flash_id(void)
{
U16 *flash_pointer;
U16 manufacture_id;
U16 device_id;
U8 temp1;
static U8 mesg1[]="AMD valid flash found";
static U8 mesg2[]="Error! Unknown flash ";
// get manufacture ID
flash_pointer=(U16*)(MEMORY_FLASH_START_ADDRESS+0xAAA);
*flash_pointer=(U16)0x00AA;
flash_pointer=(U16*)(MEMORY_FLASH_START_ADDRESS+0x554);
*flash_pointer=(U16)0x0055;
flash_pointer=(U16*)(MEMORY_FLASH_START_ADDRESS+0xAAA);
*flash_pointer=(U16)0x0090;
flash_pointer=(U16*)MEMORY_FLASH_START_ADDRESS;
manufacture_id=*flash_pointer;
flash_pointer++;
device_id=*flash_pointer;
if ((manufacture_id==((U16)AMD_ID))&&(device_id==((U16)AM29LV641_ID)))
{
transmit_string(mesg1);
flash_reset();
return(0);
}
transmit_string(mesg2);
temp1=manufacture_id>>8;
transmit_char(&temp1);
temp1=manufacture_id;
transmit_char(&temp1);
temp1=device_id>>8;
transmit_char(&temp1);
temp1=device_id;
transmit_char(&temp1);
flash_reset();
return(1);
}// end og flash_id
E-mail: info@telesys.ru