aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-14 07:28:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-14 07:28:32 +0000
commitb971dbbce82a1138dbf0c57e34df7b9a1e9a49d7 (patch)
treefc5f8e3e0e6592fe0d40e53a6d99ceebf4666799 /LUFA/Drivers/USB/Core/XMEGA
parent8629e1918c9be8cab4421077cf2e62445599fc47 (diff)
downloadlufa-b971dbbce82a1138dbf0c57e34df7b9a1e9a49d7.tar.gz
lufa-b971dbbce82a1138dbf0c57e34df7b9a1e9a49d7.tar.bz2
lufa-b971dbbce82a1138dbf0c57e34df7b9a1e9a49d7.zip
More XMEGA USB AVR device port work - re-add missing Endpoint stream functions, remove unnecessary internal functions.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c2
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c70
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h8
3 files changed, 69 insertions, 11 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
index 1294814f3..55598ffaf 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
@@ -37,7 +37,7 @@
void USB_Device_SendRemoteWakeup(void)
{
- // TODO
+ USB.CTRLB |= USB_RWAKEUP_bm;
}
#endif
diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
index 9a0a19561..b1b05bfaa 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
@@ -39,13 +39,79 @@
uint8_t Endpoint_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
- return 0; // TODO
+ uint8_t ErrorCode;
+ uint16_t BytesInTransfer = 0;
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+
+ if (BytesProcessed != NULL)
+ Length -= *BytesProcessed;
+
+ while (Length)
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearOUT();
+
+ if (BytesProcessed != NULL)
+ {
+ *BytesProcessed += BytesInTransfer;
+ return ENDPOINT_RWSTREAM_IncompleteTransfer;
+ }
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ Endpoint_Discard_8();
+
+ Length--;
+ BytesInTransfer++;
+ }
+ }
+
+ return ENDPOINT_RWSTREAM_NoError;
}
uint8_t Endpoint_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
- return 0; // TODO
+ uint8_t ErrorCode;
+ uint16_t BytesInTransfer = 0;
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+
+ if (BytesProcessed != NULL)
+ Length -= *BytesProcessed;
+
+ while (Length)
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearIN();
+
+ if (BytesProcessed != NULL)
+ {
+ *BytesProcessed += BytesInTransfer;
+ return ENDPOINT_RWSTREAM_IncompleteTransfer;
+ }
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ Endpoint_Write_8(0);
+
+ Length--;
+ BytesInTransfer++;
+ }
+ }
+
+ return ENDPOINT_RWSTREAM_NoError;
}
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index c444433a6..3ed603de0 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
@@ -95,14 +95,6 @@
#define ENDPOINT_DETAILS_MAXEP 16
- /* Inline Functions: */
- static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST
- ATTR_ALWAYS_INLINE;
- static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes)
- {
- return 0; // TODO
- }
-
/* Function Prototypes: */
void Endpoint_ClearEndpoints(void);
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,