X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b462f2d457ec2f0cfa22a1c3db198cb22f6809a1..a459f10b0c1a3e02f160ff3a1a2a0b45ae5b69a7:/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c?ds=sidebyside diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c index f335b6798..3858d3873 100644 --- a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c +++ b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c @@ -43,6 +43,7 @@ * the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes * them to the dataflash in Dataflash page sized blocks. * + * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. * \param[in] BlockAddress Data block starting address for the write sequence * \param[in] TotalBlocks Number of blocks of data to write */ @@ -68,7 +69,8 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co Dataflash_SendAddressBytes(0, CurrDFPageByte); /* Wait until endpoint is ready before continuing */ - while (!(Endpoint_IsReadWriteAllowed())); + if (Endpoint_WaitUntilReady()) + return; while (TotalBlocks) { @@ -84,7 +86,8 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co Endpoint_ClearOUT(); /* Wait until the host has sent another packet */ - while (!(Endpoint_IsReadWriteAllowed())); + if (Endpoint_WaitUntilReady()) + return; } /* Check if end of dataflash page reached */ @@ -174,6 +177,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co * the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash * and writes them in OS sized blocks to the endpoint. * + * \param[in] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. * \param[in] BlockAddress Data block starting address for the read sequence * \param[in] TotalBlocks Number of blocks of data to read */ @@ -195,7 +199,8 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, con Dataflash_SendByte(0x00); /* Wait until endpoint is ready before continuing */ - while (!(Endpoint_IsReadWriteAllowed())); + if (Endpoint_WaitUntilReady()) + return; while (TotalBlocks) { @@ -211,7 +216,8 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, con Endpoint_ClearIN(); /* Wait until the endpoint is ready for more data */ - while (!(Endpoint_IsReadWriteAllowed())); + if (Endpoint_WaitUntilReady()) + return; } /* Check if end of dataflash page reached */