Description
Source
Call Graph
Start Line: 106
unsigned int amd_ReadIdentification(struct NorFlashInfo *pNorFlashInfo, unsigned char index)
{
unsigned int id;
unsigned char busWidth;
unsigned int address;
busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
// The amd_Read identification command sequence is initiated by first
// writing two unlock cycles.
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
AMD_CMD_UNLOCK_1);
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2),
AMD_CMD_UNLOCK_2);
// Followed by a third write cycle that contains the autoselect command.
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
AMD_CMD_IDIN);
// The device then enters the autoselect mode. It may read at any address any
// number of times without initiating another autoselect command sequence.
address = NorFlash_GetByteAddressInChip(pNorFlashInfo, index);
ReadRawData(busWidth, address, (unsigned char*)&id);
// The system must write the exit command to return to the read mode
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
AMD_CMD_UNLOCK_1);
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2),
AMD_CMD_UNLOCK_2);
WriteCommand(busWidth,
NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
AMD_CMD_IDOUT);
return id;
}