projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
State information for class drivers is now zeroed out during enumeration (both in...
[pub/USBasp.git]
/
Demos
/
Device
/
LowLevel
/
MassStorage
/
Lib
/
DataflashManager.c
diff --git
a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
index
fdc91dd
..
2bd03c9
100644
(file)
--- a/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
+++ b/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
@@
-68,8
+68,12
@@
void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
Dataflash_SendAddressBytes(0, CurrDFPageByte);
\r
\r
/* Wait until endpoint is ready before continuing */
\r
Dataflash_SendAddressBytes(0, CurrDFPageByte);
\r
\r
/* Wait until endpoint is ready before continuing */
\r
- while (!(Endpoint_IsReadWriteAllowed()));
\r
-
\r
+ while (!(Endpoint_IsReadWriteAllowed()))
\r
+ {
\r
+ if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
+ return;
\r
+ }
\r
+
\r
while (TotalBlocks)
\r
{
\r
uint8_t BytesInBlockDiv16 = 0;
\r
while (TotalBlocks)
\r
{
\r
uint8_t BytesInBlockDiv16 = 0;
\r
@@
-84,7
+88,11
@@
void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
Endpoint_ClearOUT();
\r
\r
/* Wait until the host has sent another packet */
\r
Endpoint_ClearOUT();
\r
\r
/* Wait until the host has sent another packet */
\r
- while (!(Endpoint_IsReadWriteAllowed()));
\r
+ while (!(Endpoint_IsReadWriteAllowed()))
\r
+ {
\r
+ if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
+ return;
\r
+ }
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
@@
-195,7
+203,11
@@
void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
Dataflash_SendByte(0x00);
\r
\r
/* Wait until endpoint is ready before continuing */
\r
Dataflash_SendByte(0x00);
\r
\r
/* Wait until endpoint is ready before continuing */
\r
- while (!(Endpoint_IsReadWriteAllowed()));
\r
+ while (!(Endpoint_IsReadWriteAllowed()))
\r
+ {
\r
+ if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
+ return;
\r
+ }
\r
\r
while (TotalBlocks)
\r
{
\r
\r
while (TotalBlocks)
\r
{
\r
@@
-211,7
+223,11
@@
void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for more data */
\r
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for more data */
\r
- while (!(Endpoint_IsReadWriteAllowed()));
\r
+ while (!(Endpoint_IsReadWriteAllowed()))
\r
+ {
\r
+ if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
+ return;
\r
+ }
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r