]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/LPCUSBLib/Drivers/USB/Core/EndpointStream.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / LPCUSBLib / Drivers / USB / Core / EndpointStream.h
1 /*\r
2  * @brief Endpoint data stream transmission and reception management\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6  * Copyright(C) Dean Camera, 2011, 2012\r
7  * All rights reserved.\r
8  *\r
9  * @par\r
10  * Software that is described herein is for illustrative purposes only\r
11  * which provides customers with programming information regarding the\r
12  * LPC products.  This software is supplied "AS IS" without any warranties of\r
13  * any kind, and NXP Semiconductors and its licensor disclaim any and\r
14  * all warranties, express or implied, including all implied warranties of\r
15  * merchantability, fitness for a particular purpose and non-infringement of\r
16  * intellectual property rights.  NXP Semiconductors assumes no responsibility\r
17  * or liability for the use of the software, conveys no license or rights under any\r
18  * patent, copyright, mask work right, or any other intellectual property rights in\r
19  * or to any products. NXP Semiconductors reserves the right to make changes\r
20  * in the software without notification. NXP Semiconductors also makes no\r
21  * representation or warranty that such application will be suitable for the\r
22  * specified use without further testing or modification.\r
23  *\r
24  * @par\r
25  * Permission to use, copy, modify, and distribute this software and its\r
26  * documentation is hereby granted, under NXP Semiconductors' and its\r
27  * licensor's relevant copyrights in the software, without fee, provided that it\r
28  * is used in conjunction with NXP Semiconductors microcontrollers.  This\r
29  * copyright, permission, and disclaimer notice must appear in all copies of\r
30  * this code.\r
31  */\r
32 \r
33 /** @ingroup Group_EndpointRW  \r
34  *  @defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams\r
35  *  @brief Endpoint data stream transmission and reception management.\r
36  *\r
37  *  Functions, macros, variables, enums and types related to data reading and writing of data streams from\r
38  *  and to endpoints.\r
39  *\r
40  *  @{\r
41  */ \r
42 \r
43 #ifndef __ENDPOINT_STREAM_H__\r
44 #define __ENDPOINT_STREAM_H__\r
45 \r
46         /* Includes: */\r
47                 #include "../../../Common/Common.h"\r
48                 #include "USBMode.h"\r
49 \r
50         /* Enable C linkage for C++ Compilers: */\r
51                 #if defined(__cplusplus)\r
52                         extern "C" {\r
53                 #endif\r
54 \r
55         /* Preprocessor Checks: */\r
56                 #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
57                         #error Do not include this file directly. Include lpcroot/libraries/LPCUSBlib/Drivers/USB/USB.h instead.\r
58                 #endif\r
59 \r
60         /* Public Interface - May be used in end-application: */\r
61                 /* Enums: */\r
62                         /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */\r
63                         enum Endpoint_Stream_RW_ErrorCodes_t\r
64                         {\r
65                                 ENDPOINT_RWSTREAM_NoError            = 0, /**< Command completed successfully, no error. */\r
66                                 ENDPOINT_RWSTREAM_EndpointStalled    = 1, /**< The endpoint was stalled during the stream\r
67                                                                            *   transfer by the host or device.\r
68                                                                            */\r
69                                 ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
70                                                                            *   the transfer.\r
71                                                                            */\r
72                                 ENDPOINT_RWSTREAM_BusSuspended       = 3, /**< The USB bus has been suspended by the host and\r
73                                                                            *   no USB endpoint traffic can occur until the bus\r
74                                                                            *   has resumed.\r
75                                                                            */\r
76                                 ENDPOINT_RWSTREAM_Timeout            = 4, /**< The host failed to accept or send the next packet\r
77                                                                            *   within the software timeout period set by the\r
78                                                                            *   @ref USB_STREAM_TIMEOUT_MS macro.\r
79                                                                            */\r
80                                 ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before\r
81                                                                            *   the complete contents of the current stream could be\r
82                                                                            *   transferred. The endpoint stream function should be called\r
83                                                                            *   again to process the next chunk of data in the transfer.\r
84                                                                            */\r
85                         };\r
86                         \r
87                         /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */\r
88                         enum Endpoint_ControlStream_RW_ErrorCodes_t\r
89                         {\r
90                                 ENDPOINT_RWCSTREAM_NoError            = 0, /**< Command completed successfully, no error. */\r
91                                 ENDPOINT_RWCSTREAM_HostAborted        = 1, /**< The aborted the transfer prematurely. */\r
92                                 ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
93                                                                             *   the transfer.\r
94                                                                             */\r
95                                 ENDPOINT_RWCSTREAM_BusSuspended       = 3, /**< The USB bus has been suspended by the host and\r
96                                                                             *   no USB endpoint traffic can occur until the bus\r
97                                                                             *   has resumed.\r
98                                                                             */\r
99                         };\r
100 \r
101                 #include "../../../Common/Common.h"\r
102                 #include "USBTask.h"\r
103                 \r
104                 /* Function Prototypes: */\r
105                         /** \name Stream functions for null data */\r
106                         //@{\r
107                 /**\r
108                  * @brief  Reads and discards the given number of bytes from the currently selected endpoint's bank,\r
109                  *  discarding fully read packets from the host as needed. The last packet is not automatically\r
110                  *  discarded once the remaining bytes has been read; the user is responsible for manually\r
111                  *  discarding the last packet from the host via the @ref Endpoint_ClearOUT() macro.\r
112                  *\r
113                  *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,\r
114                  *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid\r
115                  *  storage location, the transfer will instead be performed as a series of chunks. Each time\r
116                  *  the endpoint bank becomes empty while there is still data to process (and after the current\r
117                  *  packet has been acknowledged) the BytesProcessed location will be updated with the total number\r
118                  *  of bytes processed in the stream, and the function will exit with an error code of\r
119                  *  @ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed\r
120                  *  in the user code - to continue the transfer, call the function again with identical parameters\r
121                  *  and it will resume until the BytesProcessed value reaches the total transfer length.\r
122                  *\r
123                  *  <b>Single Stream Transfer Example:</b>\r
124                  *  \code\r
125                  *  uint8_t ErrorCode;\r
126                  *\r
127                  *  if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)\r
128                  *  {\r
129                  *       // Stream failed to complete - check ErrorCode here\r
130                  *  }\r
131                  *  \endcode\r
132                  *\r
133                  *  <b>Partial Stream Transfers Example:</b>\r
134                  *  \code\r
135                  *  uint8_t  ErrorCode;\r
136                  *  uint16_t BytesProcessed;\r
137                  *\r
138                  *  BytesProcessed = 0;\r
139                  *  while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)\r
140                  *  {\r
141                  *      // Stream not yet complete - do other actions here, abort if required\r
142                  *  }\r
143                  *\r
144                  *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)\r
145                  *  {\r
146                  *      // Stream failed to complete - check ErrorCode here\r
147                  *  }\r
148                  *  \endcode\r
149                  *\r
150                  *  @note This routine should not be used on CONTROL type endpoints.\r
151                  *\r
152                  *  @param     corenum         ID Number of USB Core to be processed.\r
153                  *  @param     Length          Number of bytes to discard via the currently selected endpoint.\r
154                  *  @param     BytesProcessed  Pointer to a location where the total number of bytes processed in the current\r
155                  *                             transaction should be updated, \c NULL if the entire stream should be read at once.\r
156                  *\r
157                  * @param  Length :         Number of bytes to discard via the currently selected endpoint\r
158                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
159                  *                          transaction should be updated, NULL if the entire stream should be read at once.\r
160                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
161                  */\r
162                 uint8_t Endpoint_Discard_Stream(uint8_t corenum,\r
163                                                                                 uint16_t Length,\r
164                                                                                 uint16_t *const BytesProcessed);\r
165 \r
166                 /**\r
167                  * @brief  Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending\r
168                  *  full packets to the host as needed. The last packet is not automatically sent once the \r
169                  *  remaining bytes have been written; the user is responsible for manually sending the last\r
170                  *  packet to the host via the @ref Endpoint_ClearIN() macro.\r
171                  *\r
172                  *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,\r
173                  *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid\r
174                  *  storage location, the transfer will instead be performed as a series of chunks. Each time\r
175                  *  the endpoint bank becomes full while there is still data to process (and after the current\r
176                  *  packet transmission has been initiated) the BytesProcessed location will be updated with the\r
177                  *  total number of bytes processed in the stream, and the function will exit with an error code of\r
178                  *  @ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed\r
179                  *  in the user code - to continue the transfer, call the function again with identical parameters\r
180                  *  and it will resume until the BytesProcessed value reaches the total transfer length.\r
181                  *\r
182                  *  <b>Single Stream Transfer Example:</b>\r
183                  *  \code\r
184                  *  uint8_t ErrorCode;\r
185                  *\r
186                  *  if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)\r
187                  *  {\r
188                  *       // Stream failed to complete - check ErrorCode here\r
189                  *  }\r
190                  *  \endcode\r
191                  *\r
192                  *  <b>Partial Stream Transfers Example:</b>\r
193                  *  \code\r
194                  *  uint8_t  ErrorCode;\r
195                  *  uint16_t BytesProcessed;\r
196                  *\r
197                  *  BytesProcessed = 0;\r
198                  *  while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)\r
199                  *  {\r
200                  *      // Stream not yet complete - do other actions here, abort if required\r
201                  *  }\r
202                  *\r
203                  *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)\r
204                  *  {\r
205                  *      // Stream failed to complete - check ErrorCode here\r
206                  *  }\r
207                  *  \endcode\r
208                  *\r
209                  *  @note This routine should not be used on CONTROL type endpoints.\r
210                  *\r
211                  *  @param     corenum         ID Number of USB Core to be processed.\r
212                  *  @param     Length          Number of zero bytes to send via the currently selected endpoint.\r
213                  *  @param     BytesProcessed  Pointer to a location where the total number of bytes processed in the current\r
214                  *                             transaction should be updated, \c NULL if the entire stream should be read at once.\r
215                  *\r
216                  * @param  Length :         Number of zero bytes to send via the currently selected endpoint\r
217                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
218                  *                          transaction should be updated, NULL if the entire stream should be read at once\r
219                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
220                  */\r
221                 uint8_t Endpoint_Null_Stream(uint8_t corenum,\r
222                                                                          uint16_t Length,\r
223                                                                          uint16_t *const BytesProcessed);\r
224 \r
225                 //@}\r
226 \r
227                 /** \name Stream functions for RAM source/destination data */\r
228                 //@{\r
229                                 \r
230                 /** @brief Writes the given number of bytes to the endpoint from the given buffer in little endian,\r
231                  *  sending full packets to the host as needed. The last packet filled is not automatically sent;\r
232                  *  the user is responsible for manually sending the last written packet to the host via the\r
233                  *  @ref Endpoint_ClearIN() macro.\r
234                  *\r
235                  *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,\r
236                  *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid\r
237                  *  storage location, the transfer will instead be performed as a series of chunks. Each time\r
238                  *  the endpoint bank becomes full while there is still data to process (and after the current\r
239                  *  packet transmission has been initiated) the BytesProcessed location will be updated with the\r
240                  *  total number of bytes processed in the stream, and the function will exit with an error code of\r
241                  *  @ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed\r
242                  *  in the user code - to continue the transfer, call the function again with identical parameters\r
243                  *  and it will resume until the BytesProcessed value reaches the total transfer length.\r
244                  *\r
245                  *  <b>Single Stream Transfer Example:</b>\r
246                  *  \code\r
247                  *  uint8_t DataStream[512];\r
248                  *  uint8_t ErrorCode;\r
249                  *\r
250                  *  if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),\r
251                  *                                            NULL)) != ENDPOINT_RWSTREAM_NoError)\r
252                  *  {\r
253                  *       // Stream failed to complete - check ErrorCode here\r
254                  *  }\r
255                  *  \endcode\r
256                  *\r
257                  *  <b>Partial Stream Transfers Example:</b>\r
258                  *  \code\r
259                  *  uint8_t  DataStream[512];\r
260                  *  uint8_t  ErrorCode;\r
261                  *  uint16_t BytesProcessed;\r
262                  *\r
263                  *  BytesProcessed = 0;\r
264                  *  while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),\r
265                  *                                               &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)\r
266                  *  {\r
267                  *      // Stream not yet complete - do other actions here, abort if required\r
268                  *  }\r
269                  *\r
270                  *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)\r
271                  *  {\r
272                  *      // Stream failed to complete - check ErrorCode here\r
273                  *  }\r
274                  *  \endcode\r
275                  *\r
276                  *  @note This routine should not be used on CONTROL type endpoints.\r
277                  *\r
278                  *  @param     corenum         ID Number of USB Core to be processed.\r
279                  *  @param     Buffer          Pointer to the source data buffer to read from.\r
280                  *  @param     Length          Number of bytes to read for the currently selected endpoint into the buffer.\r
281                  *  @param     BytesProcessed  Pointer to a location where the total number of bytes processed in the current\r
282                  *                             transaction should be updated, \c NULL if the entire stream should be written at once.\r
283                  *\r
284                  * @param  Buffer :         Pointer to the source data buffer to read from\r
285                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
286                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
287                  *                          transaction should be updated, NULL if the entire stream should be written at once\r
288                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
289                  */\r
290                 uint8_t Endpoint_Write_Stream_LE(uint8_t corenum,\r
291                                                                                  const void *const Buffer,\r
292                                                                                  uint16_t Length,\r
293                                                                                  uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(2);\r
294 \r
295                 /**\r
296                  * @brief  Writes the given number of bytes to the endpoint from the given buffer in big endian,\r
297                  *  sending full packets to the host as needed. The last packet filled is not automatically sent;\r
298                  *  the user is responsible for manually sending the last written packet to the host via the\r
299                  *  @ref Endpoint_ClearIN() macro.\r
300                  *\r
301                  *  @note This routine should not be used on CONTROL type endpoints.\r
302                  *\r
303                  * @param     corenum       ID Number of USB Core to be processed.\r
304                  * @param  Buffer :         Pointer to the source data buffer to read from\r
305                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
306                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
307                  *                          transaction should be updated, \c NULL if the entire stream should be written at once\r
308                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
309                  */\r
310                 uint8_t Endpoint_Write_Stream_BE(uint8_t corenum,\r
311                                                                                  const void *const Buffer,\r
312                                                                                  uint16_t Length,\r
313                                                                                  uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(2);\r
314 \r
315                 /**\r
316                  * @brief  Reads the given number of bytes from the endpoint from the given buffer in little endian,\r
317                  *  discarding fully read packets from the host as needed. The last packet is not automatically\r
318                  *  discarded once the remaining bytes has been read; the user is responsible for manually\r
319                  *  discarding the last packet from the host via the @ref Endpoint_ClearOUT() macro.\r
320                  *\r
321                  *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,\r
322                  *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid\r
323                  *  storage location, the transfer will instead be performed as a series of chunks. Each time\r
324                  *  the endpoint bank becomes empty while there is still data to process (and after the current\r
325                  *  packet has been acknowledged) the BytesProcessed location will be updated with the total number\r
326                  *  of bytes processed in the stream, and the function will exit with an error code of\r
327                  *  @ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed\r
328                  *  in the user code - to continue the transfer, call the function again with identical parameters\r
329                  *  and it will resume until the BytesProcessed value reaches the total transfer length.\r
330                  *\r
331                  *  <b>Single Stream Transfer Example:</b>\r
332                  *  \code\r
333                  *  uint8_t DataStream[512];\r
334                  *  uint8_t ErrorCode;\r
335                  *\r
336                  *  if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),\r
337                  *                                           NULL)) != ENDPOINT_RWSTREAM_NoError)\r
338                  *  {\r
339                  *       // Stream failed to complete - check ErrorCode here\r
340                  *  }\r
341                  *  \endcode\r
342                  *\r
343                  *  <b>Partial Stream Transfers Example:</b>\r
344                  *  \code\r
345                  *  uint8_t  DataStream[512];\r
346                  *  uint8_t  ErrorCode;\r
347                  *  uint16_t BytesProcessed;\r
348                  *\r
349                  *  BytesProcessed = 0;\r
350                  *  while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),\r
351                  *                                              &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)\r
352                  *  {\r
353                  *      // Stream not yet complete - do other actions here, abort if required\r
354                  *  }\r
355                  *\r
356                  *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)\r
357                  *  {\r
358                  *      // Stream failed to complete - check ErrorCode here\r
359                  *  }\r
360                  *  \endcode\r
361                  *\r
362                  *  @note This routine should not be used on CONTROL type endpoints.\r
363                  *\r
364                  *  @param     corenum         ID Number of USB Core to be processed.\r
365                  *  \param[out] Buffer          Pointer to the destination data buffer to write to.\r
366                  *  @param      Length          Number of bytes to send via the currently selected endpoint.\r
367                  *  @param      BytesProcessed  Pointer to a location where the total number of bytes processed in the current\r
368                  *                              transaction should be updated, \c NULL if the entire stream should be read at once.\r
369                  *\r
370                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
371                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
372                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
373                  *                          transaction should be updated, NULL if the entire stream should be written at once\r
374                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
375                  */\r
376                 uint8_t Endpoint_Read_Stream_LE(uint8_t corenum,\r
377                                                                                 void *const Buffer,\r
378                                                                                 uint16_t Length,\r
379                                                                                 uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(2);\r
380 \r
381                 /**\r
382                  * @brief  Reads the given number of bytes from the endpoint from the given buffer in big endian,\r
383                  *  discarding fully read packets from the host as needed. The last packet is not automatically\r
384                  *  discarded once the remaining bytes has been read; the user is responsible for manually\r
385                  *  discarding the last packet from the host via the @ref Endpoint_ClearOUT() macro.\r
386                  *\r
387                  *  @note This routine should not be used on CONTROL type endpoints.\r
388                  *\r
389                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
390                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
391                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
392                  *                          transaction should be updated, \c NULL if the entire stream should be read at once\r
393                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
394                  */\r
395                 uint8_t Endpoint_Read_Stream_BE(void *const Buffer,\r
396                                                                                 uint16_t Length,\r
397                                                                                 uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
398 \r
399                 /**\r
400                  * @brief  Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,\r
401                  *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared\r
402                  *  in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
403                  *  finalize the transfer via the @ref Endpoint_ClearOUT() macro.\r
404                  *\r
405                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
406                  *        to clear the status stage when using this routine in a control transaction.\r
407                  *        \n\n\r
408                  *\r
409                  *  @note This routine should only be used on CONTROL type endpoints.\r
410                  *\r
411                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
412                  *           together; i.e. the entire stream data must be read or written at the one time.\r
413                  *\r
414                  * @param  corenum          ID Number of USB Core to be processed.\r
415                  * @param  Buffer :         Pointer to the source data buffer to read from\r
416                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
417                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
418                  */\r
419                 uint8_t Endpoint_Write_Control_Stream_LE(uint8_t corenum, const void *const Buffer,\r
420                                                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(2);\r
421 \r
422                 /**\r
423                  * @brief  Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,\r
424                  *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared\r
425                  *  in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
426                  *  finalize the transfer via the @ref Endpoint_ClearOUT() macro.\r
427                  *\r
428                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
429                  *        to clear the status stage when using this routine in a control transaction.\r
430                  *        \n\n\r
431                  *\r
432                  *  @note This routine should only be used on CONTROL type endpoints.\r
433                  *\r
434                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
435                  *           together; i.e. the entire stream data must be read or written at the one time.\r
436                  *\r
437                  * @param  Buffer :         Pointer to the source data buffer to read from\r
438                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
439                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
440                  */\r
441                 uint8_t Endpoint_Write_Control_Stream_BE(const void *const Buffer,\r
442                                                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
443 \r
444                 /**\r
445                  * @brief  Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,\r
446                  *  discarding fully read packets from the host as needed. The device IN acknowledgement is not\r
447                  *  automatically sent after success or failure states; the user is responsible for manually sending the\r
448                  *  setup IN to finalize the transfer via the @ref Endpoint_ClearIN() macro.\r
449                  *\r
450                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
451                  *        to clear the status stage when using this routine in a control transaction.\r
452                  *        \n\n\r
453                  *\r
454                  *  @note This routine should only be used on CONTROL type endpoints.\r
455                  *\r
456                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
457                  *           together; i.e. the entire stream data must be read or written at the one time.\r
458                  *\r
459                  * @param  corenum          ID Number of USB Core to be processed.\r
460                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
461                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
462                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
463                  */\r
464                 uint8_t Endpoint_Read_Control_Stream_LE(uint8_t corenum, void *const Buffer,\r
465                                                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(2);\r
466 \r
467                 /**\r
468                  * @brief  Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,\r
469                  *  discarding fully read packets from the host as needed. The device IN acknowledgement is not\r
470                  *  automatically sent after success or failure states; the user is responsible for manually sending the\r
471                  *  setup IN to finalize the transfer via the @ref Endpoint_ClearIN() macro.\r
472                  *\r
473                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
474                  *        to clear the status stage when using this routine in a control transaction.\r
475                  *        \n\n\r
476                  *\r
477                  *  @note This routine should only be used on CONTROL type endpoints.\r
478                  *\r
479                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
480                  *           together; i.e. the entire stream data must be read or written at the one time.\r
481                  *\r
482                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
483                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
484                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
485                  */\r
486                 uint8_t Endpoint_Read_Control_Stream_BE(void *const Buffer,\r
487                                                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
488                 //@}\r
489 \r
490                 /** \name Stream functions for EEPROM source/destination data */\r
491                 //@{\r
492                 /**\r
493                  * @brief  Endpoint Write EEPROM Stream Little Endian\r
494                  * @param  Buffer :         Pointer to the source data buffer to read from\r
495                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
496                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
497                  *                          transaction should be updated, \c NULL if the entire stream should be written at once\r
498                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
499                  */\r
500                 uint8_t Endpoint_Write_EStream_LE(const void *const Buffer,\r
501                                                                                   uint16_t Length,\r
502                                                                                   uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
503 \r
504                 /**\r
505                  * @brief  Endpoint Write EEPROM Stream Big Endian\r
506                  * @param  Buffer :         Pointer to the source data buffer to read from\r
507                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
508                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
509                  *                          transaction should be updated, \c NULL if the entire stream should be written at once\r
510                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
511                  */\r
512                 uint8_t Endpoint_Write_EStream_BE(const void *const Buffer,\r
513                                                                                   uint16_t Length,\r
514                                                                                   uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
515 \r
516                 /**\r
517                  * @brief  Endpoint Read EEPROM Stream Little Endian\r
518                  * @param  Buffer :         Pointer to the destination data buffer to write to, located in EEPROM memory space\r
519                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
520                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
521                  *                          transaction should be updated, \c NULL if the entire stream should be read at once\r
522                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
523                  */\r
524                 uint8_t Endpoint_Read_EStream_LE(void *const Buffer,\r
525                                                                                  uint16_t Length,\r
526                                                                                  uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
527 \r
528                 /**\r
529                  * @brief  Endpoint Read EEPROM Stream Big Endian\r
530                  * @param  Buffer :         Pointer to the destination data buffer to write to, located in EEPROM memory space\r
531                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
532                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
533                  *                          transaction should be updated, \c NULL if the entire stream should be read at once\r
534                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
535                  */\r
536                 uint8_t Endpoint_Read_EStream_BE(void *const Buffer,\r
537                                                                                  uint16_t Length,\r
538                                                                                  uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
539 \r
540                 /**\r
541                  * @brief  Endpoint Write Control EEPROM Stream Little Endian\r
542                  *\r
543                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
544                  *        to clear the status stage when using this routine in a control transaction.\r
545                  *        \n\n\r
546                  *\r
547                  *  @note This routine should only be used on CONTROL type endpoints.\r
548                  *        \n\n\r
549                  *\r
550                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
551                  *           together; i.e. the entire stream data must be read or written at the one time.\r
552                  *\r
553                  * @param  Buffer :         Pointer to the source data buffer to read from\r
554                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
555                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
556                  */\r
557                 uint8_t Endpoint_Write_Control_EStream_LE(const void *const Buffer,\r
558                                                                                                   uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
559 \r
560                 /**\r
561                  * @brief  Endpoint Write Control EEPROM Stream Big Endian\r
562                  *\r
563                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
564                  *        to clear the status stage when using this routine in a control transaction.\r
565                  *        \n\n\r
566                  *\r
567                  *  @note This routine should only be used on CONTROL type endpoints.\r
568                  *        \n\n\r
569                  *\r
570                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
571                  *           together; i.e. the entire stream data must be read or written at the one time.\r
572                  *\r
573                  * @param  Buffer :         Pointer to the source data buffer to read from\r
574                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
575                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
576                  */\r
577                 uint8_t Endpoint_Write_Control_EStream_BE(const void *const Buffer,\r
578                                                                                                   uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
579 \r
580                 /**\r
581                  * @brief  Endpoint Read Control EEPROM Stream Little Endian\r
582                  *\r
583                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
584                  *        to clear the status stage when using this routine in a control transaction.\r
585                  *        \n\n\r
586                  *\r
587                  *  @note This routine should only be used on CONTROL type endpoints.\r
588                  *        \n\n\r
589                  *\r
590                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
591                  *           together; i.e. the entire stream data must be read or written at the one time.\r
592                  *\r
593                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
594                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
595                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
596                  */\r
597                 uint8_t Endpoint_Read_Control_EStream_LE(void *const Buffer,\r
598                                                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
599 \r
600                 /**\r
601                  * @brief  Endpoint Read Control EEPROM Stream Big Endian\r
602                  *\r
603                  *  @note This function automatically clears the control transfer's status stage. Do not manually attempt\r
604                  *        to clear the status stage when using this routine in a control transaction.\r
605                  *        \n\n\r
606                  *\r
607                  *  @note This routine should only be used on CONTROL type endpoints.\r
608                  *        \n\n\r
609                  *\r
610                  *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
611                  *           together; i.e. the entire stream data must be read or written at the one time.\r
612                  *\r
613                  * @param  Buffer :         Pointer to the destination data buffer to write to\r
614                  * @param  Length :         Number of bytes to send via the currently selected endpoint\r
615                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
616                  */\r
617                 uint8_t Endpoint_Read_Control_EStream_BE(void *const Buffer,\r
618                                                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
619                                         //@}\r
620                 /**\r
621                  * @brief  Endpoint Write PROGMEM Stream Little Endian\r
622                 //@{\r
623                  * @param  Buffer :         Pointer to the source data buffer to read from\r
624                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
625                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
626                  *                          transaction should be updated, NULL if the entire stream should be written at once.\r
627                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
628                  */\r
629                 uint8_t Endpoint_Write_PStream_LE(const void *const Buffer,\r
630                                                                                   uint16_t Length,\r
631                                                                                   uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
632 \r
633                 /**\r
634                  * @brief  Endpoint Write PROGMEM Stream Big Endian\r
635                  * @param  Buffer :         Pointer to the source data buffer to read from\r
636                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
637                  * @param  BytesProcessed : Pointer to a location where the total number of bytes processed in the current\r
638                  *                          transaction should be updated, \c NULL if the entire stream should be written at once.\r
639                  * @return A value from the @ref Endpoint_Stream_RW_ErrorCodes_t enum\r
640                  */\r
641                 uint8_t Endpoint_Write_PStream_BE(const void *const Buffer,\r
642                                                                                   uint16_t Length,\r
643                                                                                   uint16_t *const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);\r
644 \r
645                 /**\r
646                  * @brief  Endpoint Write Control PROGMEM Stream Little Endian\r
647                  * @param  Buffer :         Pointer to the source data buffer to read from\r
648                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
649                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
650                  */\r
651                 uint8_t Endpoint_Write_Control_PStream_LE(const void *const Buffer,\r
652                                                                                                   uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
653 \r
654                 /**\r
655                  * @brief  Endpoint Write Control PROGMEM Stream Big Endian\r
656                  * @param  Buffer :         Pointer to the source data buffer to read from\r
657                  * @param  Length :         Number of bytes to read for the currently selected endpoint into the buffer\r
658                  * @return A value from the @ref Endpoint_ControlStream_RW_ErrorCodes_t enum\r
659                  */\r
660                 uint8_t Endpoint_Write_Control_PStream_BE(const void *const Buffer,\r
661                                                                                                   uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
662                 //@}\r
663 \r
664         /* Disable C linkage for C++ Compilers: */\r
665                 #if defined(__cplusplus)\r
666                         }\r
667                 #endif\r
668 \r
669 #endif\r
670 \r
671 /** @} */\r
672 \r