uint8_t Endpoint_Discard_Stream(uint16_t Length,\r
uint16_t* const BytesProcessed)\r
{\r
- return 0; // TODO\r
+ uint8_t ErrorCode;\r
+ uint16_t BytesInTransfer = 0;\r
+ \r
+ if ((ErrorCode = Endpoint_WaitUntilReady()))\r
+ return ErrorCode;\r
+ \r
+ if (BytesProcessed != NULL)\r
+ Length -= *BytesProcessed;\r
+\r
+ while (Length)\r
+ {\r
+ if (!(Endpoint_IsReadWriteAllowed()))\r
+ {\r
+ Endpoint_ClearOUT();\r
+\r
+ if (BytesProcessed != NULL)\r
+ {\r
+ *BytesProcessed += BytesInTransfer;\r
+ return ENDPOINT_RWSTREAM_IncompleteTransfer;\r
+ }\r
+\r
+ if ((ErrorCode = Endpoint_WaitUntilReady()))\r
+ return ErrorCode;\r
+ }\r
+ else\r
+ {\r
+ Endpoint_Discard_8();\r
+\r
+ Length--;\r
+ BytesInTransfer++;\r
+ }\r
+ }\r
+ \r
+ return ENDPOINT_RWSTREAM_NoError;\r
}\r
\r
uint8_t Endpoint_Null_Stream(uint16_t Length,\r
uint16_t* const BytesProcessed)\r
{\r
- return 0; // TODO\r
+ uint8_t ErrorCode;\r
+ uint16_t BytesInTransfer = 0;\r
+ \r
+ if ((ErrorCode = Endpoint_WaitUntilReady()))\r
+ return ErrorCode;\r
+ \r
+ if (BytesProcessed != NULL)\r
+ Length -= *BytesProcessed;\r
+\r
+ while (Length)\r
+ {\r
+ if (!(Endpoint_IsReadWriteAllowed()))\r
+ {\r
+ Endpoint_ClearIN();\r
+\r
+ if (BytesProcessed != NULL)\r
+ {\r
+ *BytesProcessed += BytesInTransfer;\r
+ return ENDPOINT_RWSTREAM_IncompleteTransfer;\r
+ }\r
+\r
+ if ((ErrorCode = Endpoint_WaitUntilReady()))\r
+ return ErrorCode;\r
+ }\r
+ else\r
+ {\r
+ Endpoint_Write_8(0);\r
+\r
+ Length--;\r
+ BytesInTransfer++;\r
+ }\r
+ }\r
+ \r
+ return ENDPOINT_RWSTREAM_NoError;\r
}\r
\r
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE\r
\r
#define ENDPOINT_DETAILS_MAXEP 16\r
\r
- /* Inline Functions: */\r
- static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST\r
- ATTR_ALWAYS_INLINE;\r
- static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes)\r
- {\r
- return 0; // TODO\r
- }\r
-\r
/* Function Prototypes: */\r
void Endpoint_ClearEndpoints(void);\r
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,\r