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