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