From 3ea356a72054b540e1c529fee5f55b10324254a4 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 9 Mar 2012 22:02:29 +0000 Subject: Added Dataflash operational checks and aborts to all projects using the Dataflash to ensure it is working correctly before use. --- Demos/Device/ClassDriver/MassStorage/MassStorage.c | 7 +++++++ Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c | 7 +++++++ .../VirtualSerialMassStorage/VirtualSerialMassStorage.c | 7 +++++++ Demos/Device/LowLevel/MassStorage/MassStorage.c | 7 +++++++ 4 files changed, 28 insertions(+) (limited to 'Demos') diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 55afed124..6a720f983 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -92,6 +92,13 @@ void SetupHardware(void) Dataflash_Init(); USB_Init(); + /* Check if the Dataflash is working, abort if not */ + if (!(DataflashManager_CheckDataflashOperation())) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); + } + /* Clear Dataflash sector protections, if enabled */ DataflashManager_ResetDataflashProtections(); } diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 9f1c5c90d..bfdf09ceb 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -117,6 +117,13 @@ void SetupHardware(void) Dataflash_Init(); USB_Init(); + /* Check if the Dataflash is working, abort if not */ + if (!(DataflashManager_CheckDataflashOperation())) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); + } + /* Clear Dataflash sector protections, if enabled */ DataflashManager_ResetDataflashProtections(); } diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index 13c34d942..d8ffea873 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c @@ -131,6 +131,13 @@ void SetupHardware(void) Dataflash_Init(); USB_Init(); + /* Check if the Dataflash is working, abort if not */ + if (!(DataflashManager_CheckDataflashOperation())) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); + } + /* Clear Dataflash sector protections, if enabled */ DataflashManager_ResetDataflashProtections(); } diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index e58ac745f..947636cf8 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -80,6 +80,13 @@ void SetupHardware(void) Dataflash_Init(); USB_Init(); + /* Check if the Dataflash is working, abort if not */ + if (!(DataflashManager_CheckDataflashOperation())) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); + } + /* Clear Dataflash sector protections, if enabled */ DataflashManager_ResetDataflashProtections(); } -- cgit v1.2.3