projects
/
pub
/
lufa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4b35dd1
)
Changed over manual loops waiting for endpoints to be ready to use the library Endpoi...
author
Dean Camera
<dean@fourwalledcubicle.com>
Wed, 5 Aug 2009 09:37:45 +0000
(09:37 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Wed, 5 Aug 2009 09:37:45 +0000
(09:37 +0000)
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
patch
|
blob
|
blame
|
history
Demos/Device/ClassDriver/MassStorage/MassStorage.h
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/CDC/CDC.c
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/DualCDC/DualCDC.c
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/MassStorage/MassStorage.h
patch
|
blob
|
blame
|
history
Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Class/Device/CDC.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/HighLevel/USBInterrupt.c
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
index
5f12d02
..
3858d38
100644
(file)
--- a/
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
+++ b/
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
@@
-69,11
+69,8
@@
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co
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
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
\r
while (TotalBlocks)
\r
{
\r
\r
while (TotalBlocks)
\r
{
\r
@@
-89,11
+86,8
@@
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
@@
-205,11
+199,8
@@
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, con
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
\r
while (TotalBlocks)
\r
{
\r
\r
while (TotalBlocks)
\r
{
\r
@@
-225,11
+216,8
@@
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, con
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
diff --git
a/Demos/Device/ClassDriver/MassStorage/MassStorage.h
b/Demos/Device/ClassDriver/MassStorage/MassStorage.h
index
e6b2bf9
..
930e8f4
100644
(file)
--- a/
Demos/Device/ClassDriver/MassStorage/MassStorage.h
+++ b/
Demos/Device/ClassDriver/MassStorage/MassStorage.h
@@
-70,7
+70,7
@@
#define LEDMASK_USB_BUSY (LEDS_LED2)
\r
\r
/** Total number of logical drives within the device - must be non-zero. */
\r
#define LEDMASK_USB_BUSY (LEDS_LED2)
\r
\r
/** Total number of logical drives within the device - must be non-zero. */
\r
- #define TOTAL_LUNS
2
\r
+ #define TOTAL_LUNS
1
\r
\r
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
\r
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
\r
\r
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
\r
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
\r
diff --git
a/Demos/Device/LowLevel/CDC/CDC.c
b/Demos/Device/LowLevel/CDC/CDC.c
index
9ee744e
..
12cd8c4
100644
(file)
--- a/
Demos/Device/LowLevel/CDC/CDC.c
+++ b/
Demos/Device/LowLevel/CDC/CDC.c
@@
-62,11
+62,8
@@
static int CDC_putchar(char c, FILE *stream)
if (!(LineEncoding.BaudRateBPS))
\r
return -1;
\r
\r
if (!(LineEncoding.BaudRateBPS))
\r
return -1;
\r
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState != DEVICE_STATE_Configured)
\r
- return -1;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return -1;
\r
\r
Endpoint_Write_Byte(c);
\r
Endpoint_ClearIN();
\r
\r
Endpoint_Write_Byte(c);
\r
Endpoint_ClearIN();
\r
@@
-85,11
+82,8
@@
static int CDC_getchar(FILE *stream)
\r
for (;;)
\r
{
\r
\r
for (;;)
\r
{
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState != DEVICE_STATE_Configured)
\r
- return -1;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return -1;
\r
\r
if (!(Endpoint_BytesInEndpoint()))
\r
{
\r
\r
if (!(Endpoint_BytesInEndpoint()))
\r
{
\r
@@
-327,11
+321,7
@@
void CDC_Task(void)
if (IsFull)
\r
{
\r
/* Wait until the endpoint is ready for another packet */
\r
if (IsFull)
\r
{
\r
/* Wait until the endpoint is ready for another packet */
\r
- while (!(Endpoint_IsINReady()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
\r
/* Send an empty packet to ensure that the host does not buffer data sent to it */
\r
Endpoint_ClearIN();
\r
\r
/* Send an empty packet to ensure that the host does not buffer data sent to it */
\r
Endpoint_ClearIN();
\r
diff --git
a/Demos/Device/LowLevel/DualCDC/DualCDC.c
b/Demos/Device/LowLevel/DualCDC/DualCDC.c
index
c49a1ad
..
7a84c8d
100644
(file)
--- a/
Demos/Device/LowLevel/DualCDC/DualCDC.c
+++ b/
Demos/Device/LowLevel/DualCDC/DualCDC.c
@@
-274,11
+274,7
@@
void CDC1_Task(void)
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for another packet */
\r
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for another packet */
\r
- while (!(Endpoint_IsINReady()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
\r
/* Send an empty packet to ensure that the host does not buffer data sent to it */
\r
Endpoint_ClearIN();
\r
\r
/* Send an empty packet to ensure that the host does not buffer data sent to it */
\r
Endpoint_ClearIN();
\r
@@
-329,11
+325,7
@@
void CDC2_Task(void)
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for the next packet */
\r
Endpoint_ClearIN();
\r
\r
/* Wait until the endpoint is ready for the next packet */
\r
- while (!(Endpoint_IsINReady()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
\r
/* Send an empty packet to prevent host buffering */
\r
Endpoint_ClearIN();
\r
\r
/* Send an empty packet to prevent host buffering */
\r
Endpoint_ClearIN();
\r
diff --git
a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
index
2bd03c9
..
9cd0279
100644
(file)
--- a/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
+++ b/
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
@@
-68,11
+68,8
@@
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
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
\r
while (TotalBlocks)
\r
{
\r
\r
while (TotalBlocks)
\r
{
\r
@@
-88,11
+85,8
@@
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
@@
-203,11
+197,8
@@
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
\r
while (TotalBlocks)
\r
{
\r
\r
while (TotalBlocks)
\r
{
\r
@@
-223,11
+214,8
@@
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
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ if (Endpoint_WaitUntilReady())
\r
+ return;
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
}
\r
\r
/* Check if end of dataflash page reached */
\r
diff --git
a/Demos/Device/LowLevel/MassStorage/MassStorage.h
b/Demos/Device/LowLevel/MassStorage/MassStorage.h
index
868daf0
..
65407c8
100644
(file)
--- a/
Demos/Device/LowLevel/MassStorage/MassStorage.h
+++ b/
Demos/Device/LowLevel/MassStorage/MassStorage.h
@@
-64,7
+64,7
@@
/** Total number of Logical Units (drives) in the device. The total device capacity is shared equally between
\r
* each drive - this can be set to any positive non-zero amount.
\r
*/
\r
/** Total number of Logical Units (drives) in the device. The total device capacity is shared equally between
\r
* each drive - this can be set to any positive non-zero amount.
\r
*/
\r
- #define TOTAL_LUNS
2
\r
+ #define TOTAL_LUNS
1
\r
\r
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
\r
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
\r
\r
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
\r
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
\r
diff --git
a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
index
bb1b4da
..
736c0af
100644
(file)
--- a/
Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
+++ b/
Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
@@
-263,11
+263,7
@@
void CDC_Task(void)
if ((Tx_Buffer.Elements) && LineEncoding.BaudRateBPS)
\r
{
\r
/* Wait until Serial Tx Endpoint Ready for Read/Write */
\r
if ((Tx_Buffer.Elements) && LineEncoding.BaudRateBPS)
\r
{
\r
/* Wait until Serial Tx Endpoint Ready for Read/Write */
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
\r
/* Write the bytes from the buffer to the endpoint while space is available */
\r
while (Tx_Buffer.Elements && Endpoint_IsReadWriteAllowed())
\r
\r
/* Write the bytes from the buffer to the endpoint while space is available */
\r
while (Tx_Buffer.Elements && Endpoint_IsReadWriteAllowed())
\r
@@
-287,11
+283,7
@@
void CDC_Task(void)
if (IsFull && !(Tx_Buffer.Elements))
\r
{
\r
/* Wait until Serial Tx Endpoint Ready for Read/Write */
\r
if (IsFull && !(Tx_Buffer.Elements))
\r
{
\r
/* Wait until Serial Tx Endpoint Ready for Read/Write */
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
\r
/* Send an empty packet to terminate the transfer */
\r
Endpoint_ClearIN();
\r
\r
/* Send an empty packet to terminate the transfer */
\r
Endpoint_ClearIN();
\r
diff --git
a/LUFA/Drivers/USB/Class/Device/CDC.c
b/LUFA/Drivers/USB/Class/Device/CDC.c
index
9da0ed1
..
0d6b378
100644
(file)
--- a/
LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/
LUFA/Drivers/USB/Class/Device/CDC.c
@@
-126,12
+126,7
@@
void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
-
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
}
\r
\r
Endpoint_ClearIN();
\r
}
\r
\r
Endpoint_ClearIN();
\r
@@
-156,12
+151,7
@@
void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, con
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
-
\r
- while (!(Endpoint_IsReadWriteAllowed()))
\r
- {
\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)
\r
- return;
\r
- }
\r
+ Endpoint_WaitUntilReady();
\r
}
\r
\r
Endpoint_Write_Byte(Data);
\r
}
\r
\r
Endpoint_Write_Byte(Data);
\r
diff --git
a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
index
a039dff
..
00fe7d1
100644
(file)
--- a/
LUFA/Drivers/USB/HighLevel/USBInterrupt.c
+++ b/
LUFA/Drivers/USB/HighLevel/USBInterrupt.c
@@
-223,7
+223,7
@@
ISR(USB_GEN_vect, ISR_BLOCK)
}
\r
\r
#if defined(INTERRUPT_CONTROL_ENDPOINT)
\r
}
\r
\r
#if defined(INTERRUPT_CONTROL_ENDPOINT)
\r
-ISR(USB_COM_vect, ISR_
NO
BLOCK)
\r
+ISR(USB_COM_vect, ISR_BLOCK)
\r
{
\r
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
\r
\r
{
\r
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
\r
\r
@@
-231,6
+231,6
@@
ISR(USB_COM_vect, ISR_NOBLOCK)
\r
USB_INT_Clear(USB_INT_ENDPOINT_SETUP);
\r
\r
\r
USB_INT_Clear(USB_INT_ENDPOINT_SETUP);
\r
\r
- Endpoint_SelectEndpoint(PrevSelectedEndpoint);
\r
+ Endpoint_SelectEndpoint(PrevSelectedEndpoint);
\r
}
\r
#endif
\r
}
\r
#endif
\r