3 Copyright (C) Dean Camera, 2011.
5 dean [at] fourwalledcubicle [dot] com
10 Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
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.
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
32 * \brief Endpoint data stream transmission and reception management.
33 * \copydetails Group_EndpointStreamRW
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.
39 /** \ingroup Group_EndpointRW
40 * \defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams
41 * \brief Endpoint data stream transmission and reception management.
43 * Functions, macros, variables, enums and types related to data reading and writing of data streams from
49 #ifndef __ENDPOINT_STREAM_H__
50 #define __ENDPOINT_STREAM_H__
53 #include "../../../Common/Common.h"
57 /* Enable C linkage for C++ Compilers: */
58 #if defined(__cplusplus)
62 /* Preprocessor Checks: */
63 #if !defined(__INCLUDE_FROM_USB_DRIVER)
64 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
67 /* Public Interface - May be used in end-application: */
69 /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */
70 enum Endpoint_Stream_RW_ErrorCodes_t
72 ENDPOINT_RWSTREAM_NoError
= 0, /**< Command completed successfully, no error. */
73 ENDPOINT_RWSTREAM_EndpointStalled
= 1, /**< The endpoint was stalled during the stream
74 * transfer by the host or device.
76 ENDPOINT_RWSTREAM_DeviceDisconnected
= 2, /**< Device was disconnected from the host during
79 ENDPOINT_RWSTREAM_BusSuspended
= 3, /**< The USB bus has been suspended by the host and
80 * no USB endpoint traffic can occur until the bus
83 ENDPOINT_RWSTREAM_Timeout
= 4, /**< The host failed to accept or send the next packet
84 * within the software timeout period set by the
85 * \ref USB_STREAM_TIMEOUT_MS macro.
87 ENDPOINT_RWSTREAM_IncompleteTransfer
= 5, /**< Indicates that the endpoint bank became full or empty before
88 * the complete contents of the current stream could be
89 * transferred. The endpoint stream function should be called
90 * again to process the next chunk of data in the transfer.
94 /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */
95 enum Endpoint_ControlStream_RW_ErrorCodes_t
97 ENDPOINT_RWCSTREAM_NoError
= 0, /**< Command completed successfully, no error. */
98 ENDPOINT_RWCSTREAM_HostAborted
= 1, /**< The aborted the transfer prematurely. */
99 ENDPOINT_RWCSTREAM_DeviceDisconnected
= 2, /**< Device was disconnected from the host during
102 ENDPOINT_RWCSTREAM_BusSuspended
= 3, /**< The USB bus has been suspended by the host and
103 * no USB endpoint traffic can occur until the bus
108 /* Function Prototypes: */
110 /** \name Stream functions for null data */
113 /** Reads and discards the given number of bytes from the currently selected endpoint's bank,
114 * discarding fully read packets from the host as needed. The last packet is not automatically
115 * discarded once the remaining bytes has been read; the user is responsible for manually
116 * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
118 * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
119 * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
120 * storage location, the transfer will instead be performed as a series of chunks. Each time
121 * the endpoint bank becomes empty while there is still data to process (and after the current
122 * packet has been acknowledged) the BytesProcessed location will be updated with the total number
123 * of bytes processed in the stream, and the function will exit with an error code of
124 * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
125 * in the user code - to continue the transfer, call the function again with identical parameters
126 * and it will resume until the BytesProcessed value reaches the total transfer length.
128 * <b>Single Stream Transfer Example:</b>
132 * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
134 * // Stream failed to complete - check ErrorCode here
138 * <b>Partial Stream Transfers Example:</b>
141 * uint16_t BytesProcessed;
143 * BytesProcessed = 0;
144 * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
146 * // Stream not yet complete - do other actions here, abort if required
149 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
151 * // Stream failed to complete - check ErrorCode here
155 * \note This routine should not be used on CONTROL type endpoints.
157 * \param[in] Length Number of bytes to discard via the currently selected endpoint.
158 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
159 * transaction should be updated, \c NULL if the entire stream should be read at once.
161 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
163 uint8_t Endpoint_Discard_Stream(uint16_t Length
,
164 uint16_t* const BytesProcessed
);
166 /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending
167 * full packets to the host as needed. The last packet is not automatically sent once the
168 * remaining bytes have been written; the user is responsible for manually sending the last
169 * packet to the host via the \ref Endpoint_ClearIN() macro.
171 * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
172 * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
173 * storage location, the transfer will instead be performed as a series of chunks. Each time
174 * the endpoint bank becomes full while there is still data to process (and after the current
175 * packet transmission has been initiated) the BytesProcessed location will be updated with the
176 * total number of bytes processed in the stream, and the function will exit with an error code of
177 * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
178 * in the user code - to continue the transfer, call the function again with identical parameters
179 * and it will resume until the BytesProcessed value reaches the total transfer length.
181 * <b>Single Stream Transfer Example:</b>
185 * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
187 * // Stream failed to complete - check ErrorCode here
191 * <b>Partial Stream Transfers Example:</b>
194 * uint16_t BytesProcessed;
196 * BytesProcessed = 0;
197 * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
199 * // Stream not yet complete - do other actions here, abort if required
202 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
204 * // Stream failed to complete - check ErrorCode here
208 * \note This routine should not be used on CONTROL type endpoints.
210 * \param[in] Length Number of zero bytes to send via the currently selected endpoint.
211 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
212 * transaction should be updated, \c NULL if the entire stream should be read at once.
214 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
216 uint8_t Endpoint_Null_Stream(uint16_t Length
,
217 uint16_t* const BytesProcessed
);
221 /** \name Stream functions for RAM source/destination data */
224 /** Writes the given number of bytes to the endpoint from the given buffer in little endian,
225 * sending full packets to the host as needed. The last packet filled is not automatically sent;
226 * the user is responsible for manually sending the last written packet to the host via the
227 * \ref Endpoint_ClearIN() macro.
229 * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
230 * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
231 * storage location, the transfer will instead be performed as a series of chunks. Each time
232 * the endpoint bank becomes full while there is still data to process (and after the current
233 * packet transmission has been initiated) the BytesProcessed location will be updated with the
234 * total number of bytes processed in the stream, and the function will exit with an error code of
235 * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
236 * in the user code - to continue the transfer, call the function again with identical parameters
237 * and it will resume until the BytesProcessed value reaches the total transfer length.
239 * <b>Single Stream Transfer Example:</b>
241 * uint8_t DataStream[512];
244 * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
245 * NULL)) != ENDPOINT_RWSTREAM_NoError)
247 * // Stream failed to complete - check ErrorCode here
251 * <b>Partial Stream Transfers Example:</b>
253 * uint8_t DataStream[512];
255 * uint16_t BytesProcessed;
257 * BytesProcessed = 0;
258 * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
259 * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
261 * // Stream not yet complete - do other actions here, abort if required
264 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
266 * // Stream failed to complete - check ErrorCode here
270 * \note This routine should not be used on CONTROL type endpoints.
272 * \param[in] Buffer Pointer to the source data buffer to read from.
273 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
274 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
275 * transaction should be updated, \c NULL if the entire stream should be written at once.
277 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
279 uint8_t Endpoint_Write_Stream_LE(const void* const Buffer
,
281 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
283 /** Writes the given number of bytes to the endpoint from the given buffer in big endian,
284 * sending full packets to the host as needed. The last packet filled is not automatically sent;
285 * the user is responsible for manually sending the last written packet to the host via the
286 * \ref Endpoint_ClearIN() macro.
288 * \note This routine should not be used on CONTROL type endpoints.
290 * \param[in] Buffer Pointer to the source data buffer to read from.
291 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
292 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
293 * transaction should be updated, \c NULL if the entire stream should be written at once.
295 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
297 uint8_t Endpoint_Write_Stream_BE(const void* const Buffer
,
299 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
301 /** Reads the given number of bytes from the endpoint from the given buffer in little endian,
302 * discarding fully read packets from the host as needed. The last packet is not automatically
303 * discarded once the remaining bytes has been read; the user is responsible for manually
304 * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
306 * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
307 * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
308 * storage location, the transfer will instead be performed as a series of chunks. Each time
309 * the endpoint bank becomes empty while there is still data to process (and after the current
310 * packet has been acknowledged) the BytesProcessed location will be updated with the total number
311 * of bytes processed in the stream, and the function will exit with an error code of
312 * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
313 * in the user code - to continue the transfer, call the function again with identical parameters
314 * and it will resume until the BytesProcessed value reaches the total transfer length.
316 * <b>Single Stream Transfer Example:</b>
318 * uint8_t DataStream[512];
321 * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
322 * NULL)) != ENDPOINT_RWSTREAM_NoError)
324 * // Stream failed to complete - check ErrorCode here
328 * <b>Partial Stream Transfers Example:</b>
330 * uint8_t DataStream[512];
332 * uint16_t BytesProcessed;
334 * BytesProcessed = 0;
335 * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
336 * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
338 * // Stream not yet complete - do other actions here, abort if required
341 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
343 * // Stream failed to complete - check ErrorCode here
347 * \note This routine should not be used on CONTROL type endpoints.
349 * \param[out] Buffer Pointer to the destination data buffer to write to.
350 * \param[in] Length Number of bytes to send via the currently selected endpoint.
351 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
352 * transaction should be updated, \c NULL if the entire stream should be read at once.
354 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
356 uint8_t Endpoint_Read_Stream_LE(void* const Buffer
,
358 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
360 /** Reads the given number of bytes from the endpoint from the given buffer in big endian,
361 * discarding fully read packets from the host as needed. The last packet is not automatically
362 * discarded once the remaining bytes has been read; the user is responsible for manually
363 * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
365 * \note This routine should not be used on CONTROL type endpoints.
367 * \param[out] Buffer Pointer to the destination data buffer to write to.
368 * \param[in] Length Number of bytes to send via the currently selected endpoint.
369 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
370 * transaction should be updated, \c NULL if the entire stream should be read at once.
372 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
374 uint8_t Endpoint_Read_Stream_BE(void* const Buffer
,
376 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
378 /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,
379 * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
380 * in both failure and success states; the user is responsible for manually clearing the setup OUT to
381 * finalize the transfer via the \ref Endpoint_ClearOUT() macro.
383 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
384 * to clear the status stage when using this routine in a control transaction.
387 * \note This routine should only be used on CONTROL type endpoints.
389 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
390 * together; i.e. the entire stream data must be read or written at the one time.
392 * \param[in] Buffer Pointer to the source data buffer to read from.
393 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
395 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
397 uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer
,
398 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
400 /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
401 * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
402 * in both failure and success states; the user is responsible for manually clearing the setup OUT to
403 * finalize the transfer via the \ref Endpoint_ClearOUT() macro.
405 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
406 * to clear the status stage when using this routine in a control transaction.
409 * \note This routine should only be used on CONTROL type endpoints.
411 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
412 * together; i.e. the entire stream data must be read or written at the one time.
414 * \param[in] Buffer Pointer to the source data buffer to read from.
415 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
417 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
419 uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer
,
420 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
422 /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
423 * discarding fully read packets from the host as needed. The device IN acknowledgement is not
424 * automatically sent after success or failure states; the user is responsible for manually sending the
425 * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
427 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
428 * to clear the status stage when using this routine in a control transaction.
431 * \note This routine should only be used on CONTROL type endpoints.
433 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
434 * together; i.e. the entire stream data must be read or written at the one time.
436 * \param[out] Buffer Pointer to the destination data buffer to write to.
437 * \param[in] Length Number of bytes to send via the currently selected endpoint.
439 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
441 uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer
,
442 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
444 /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
445 * discarding fully read packets from the host as needed. The device IN acknowledgement is not
446 * automatically sent after success or failure states; the user is responsible for manually sending the
447 * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
449 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
450 * to clear the status stage when using this routine in a control transaction.
453 * \note This routine should only be used on CONTROL type endpoints.
455 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
456 * together; i.e. the entire stream data must be read or written at the one time.
458 * \param[out] Buffer Pointer to the destination data buffer to write to.
459 * \param[in] Length Number of bytes to send via the currently selected endpoint.
461 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
463 uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer
,
464 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
467 /** \name Stream functions for EEPROM source/destination data */
470 #if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) || defined(__DOXYGEN__)
471 /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
473 * \note This function is not available on all architectures.
475 * \param[in] Buffer Pointer to the source data buffer to read from.
476 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
477 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
478 * transaction should be updated, \c NULL if the entire stream should be written at once.
480 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
482 uint8_t Endpoint_Write_EStream_LE(const void* const Buffer
,
484 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
486 /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
488 * \note This function is not available on all architectures.
490 * \param[in] Buffer Pointer to the source data buffer to read from.
491 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
492 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
493 * transaction should be updated, \c NULL if the entire stream should be written at once.
495 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
497 uint8_t Endpoint_Write_EStream_BE(const void* const Buffer
,
499 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
501 /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
503 * \note This function is not available on all architectures.
505 * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
506 * \param[in] Length Number of bytes to send via the currently selected endpoint.
507 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
508 * transaction should be updated, \c NULL if the entire stream should be read at once.
510 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
512 uint8_t Endpoint_Read_EStream_LE(void* const Buffer
,
514 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
516 /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
518 * \note This function is not available on all architectures.
520 * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
521 * \param[in] Length Number of bytes to send via the currently selected endpoint.
522 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
523 * transaction should be updated, \c NULL if the entire stream should be read at once.
525 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
527 uint8_t Endpoint_Read_EStream_BE(void* const Buffer
,
529 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
531 /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
533 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
534 * to clear the status stage when using this routine in a control transaction.
537 * \note This routine should only be used on CONTROL type endpoints.
540 * \note This function is not available on all architectures.
542 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
543 * together; i.e. the entire stream data must be read or written at the one time.
545 * \param[in] Buffer Pointer to the source data buffer to read from.
546 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
548 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
550 uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer
,
551 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
553 /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
555 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
556 * to clear the status stage when using this routine in a control transaction.
559 * \note This routine should only be used on CONTROL type endpoints.
562 * \note This function is not available on all architectures.
564 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
565 * together; i.e. the entire stream data must be read or written at the one time.
567 * \param[in] Buffer Pointer to the source data buffer to read from.
568 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
570 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
572 uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer
,
573 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
575 /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
577 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
578 * to clear the status stage when using this routine in a control transaction.
581 * \note This routine should only be used on CONTROL type endpoints.
584 * \note This function is not available on all architectures.
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.
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.
592 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
594 uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer
,
595 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
597 /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
599 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
600 * to clear the status stage when using this routine in a control transaction.
603 * \note This routine should only be used on CONTROL type endpoints.
606 * \note This function is not available on all architectures.
608 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
609 * together; i.e. the entire stream data must be read or written at the one time.
611 * \param[out] Buffer Pointer to the destination data buffer to write to.
612 * \param[in] Length Number of bytes to send via the currently selected endpoint.
614 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
616 uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer
,
617 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
621 /** \name Stream functions for PROGMEM source/destination data */
624 #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) || defined(__DOXYGEN__)
625 /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
627 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
629 * \note This function is not available on all architectures.
631 * \param[in] Buffer Pointer to the source data buffer to read from.
632 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
633 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
634 * transaction should be updated, \c NULL if the entire stream should be written at once.
636 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
638 uint8_t Endpoint_Write_PStream_LE(const void* const Buffer
,
640 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
642 /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
644 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
646 * \note This function is not available on all architectures.
648 * \param[in] Buffer Pointer to the source data buffer to read from.
649 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
650 * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
651 * transaction should be updated, \c NULL if the entire stream should be written at once.
653 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
655 uint8_t Endpoint_Write_PStream_BE(const void* const Buffer
,
657 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
659 /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
661 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
663 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
664 * to clear the status stage when using this routine in a control transaction.
667 * \note This routine should only be used on CONTROL type endpoints.
670 * \note This function is not available on all architectures.
672 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
673 * together; i.e. the entire stream data must be read or written at the one time.
675 * \param[in] Buffer Pointer to the source data buffer to read from.
676 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
678 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
680 uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer
,
681 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
683 /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
685 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
687 * \note This function automatically clears the control transfer's status stage. Do not manually attempt
688 * to clear the status stage when using this routine in a control transaction.
691 * \note This routine should only be used on CONTROL type endpoints.
694 * \note This function is not available on all architectures.
696 * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
697 * together; i.e. the entire stream data must be read or written at the one time.
699 * \param[in] Buffer Pointer to the source data buffer to read from.
700 * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
702 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
704 uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer
,
705 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
709 /* Disable C linkage for C++ Compilers: */
710 #if defined(__cplusplus)