Move Dataflash operational checking code out from SCSI.c into the DataflashManager.c in the Device mode Mass Storage demos.
This commit is contained in:
parent
242303c160
commit
576f40f5ae
7 changed files with 75 additions and 58 deletions
|
@ -488,3 +488,36 @@ void DataflashManager_ResetDataflashProtections(void)
|
|||
/* Deselect current dataflash chip */
|
||||
Dataflash_DeselectChip();
|
||||
}
|
||||
|
||||
/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.
|
||||
*
|
||||
* \return Boolean true if all media chips are working, false otherwise
|
||||
*/
|
||||
bool DataflashManager_CheckDataflashOperation(void)
|
||||
{
|
||||
uint8_t ReturnByte;
|
||||
|
||||
/* Test first Dataflash IC is present and responding to commands */
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
|
||||
ReturnByte = Dataflash_ReceiveByte();
|
||||
Dataflash_DeselectChip();
|
||||
|
||||
/* If returned data is invalid, fail the command */
|
||||
if (ReturnByte != DF_MANUFACTURER_ATMEL)
|
||||
return false;
|
||||
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
/* Test second Dataflash IC is present and responding to commands */
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
||||
Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);
|
||||
ReturnByte = Dataflash_ReceiveByte();
|
||||
Dataflash_DeselectChip();
|
||||
|
||||
/* If returned data is invalid, fail the command */
|
||||
if (ReturnByte != DF_MANUFACTURER_ATMEL)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue