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"
56 /* Enable C linkage for C++ Compilers: */
57 #if defined(__cplusplus)
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.
66 /* Public Interface - May be used in end-application: */
68 /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */
69 enum Endpoint_Stream_RW_ErrorCodes_t
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.
75 ENDPOINT_RWSTREAM_DeviceDisconnected
= 2, /**< Device was disconnected from the host during
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
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.
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.
93 /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */
94 enum Endpoint_ControlStream_RW_ErrorCodes_t
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
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
107 /* Function Prototypes: */
109 /** \name Stream functions for null data */
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.
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.
127 * <b>Single Stream Transfer Example:</b>
131 * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
133 * // Stream failed to complete - check ErrorCode here
137 * <b>Partial Stream Transfers Example:</b>
140 * uint16_t BytesProcessed;
142 * BytesProcessed = 0;
143 * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
145 * // Stream not yet complete - do other actions here, abort if required
148 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
150 * // Stream failed to complete - check ErrorCode here
154 * \note This routine should not be used on CONTROL type endpoints.
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.
160 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
162 uint8_t Endpoint_Discard_Stream(uint16_t Length
,
163 uint16_t* const BytesProcessed
);
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.
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.
180 * <b>Single Stream Transfer Example:</b>
184 * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
186 * // Stream failed to complete - check ErrorCode here
190 * <b>Partial Stream Transfers Example:</b>
193 * uint16_t BytesProcessed;
195 * BytesProcessed = 0;
196 * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
198 * // Stream not yet complete - do other actions here, abort if required
201 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
203 * // Stream failed to complete - check ErrorCode here
207 * \note This routine should not be used on CONTROL type endpoints.
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.
213 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
215 uint8_t Endpoint_Null_Stream(uint16_t Length
,
216 uint16_t* const BytesProcessed
);
220 /** \name Stream functions for RAM source/destination data */
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.
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.
238 * <b>Single Stream Transfer Example:</b>
240 * uint8_t DataStream[512];
243 * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
244 * NULL)) != ENDPOINT_RWSTREAM_NoError)
246 * // Stream failed to complete - check ErrorCode here
250 * <b>Partial Stream Transfers Example:</b>
252 * uint8_t DataStream[512];
254 * uint16_t BytesProcessed;
256 * BytesProcessed = 0;
257 * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
258 * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
260 * // Stream not yet complete - do other actions here, abort if required
263 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
265 * // Stream failed to complete - check ErrorCode here
269 * \note This routine should not be used on CONTROL type endpoints.
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.
276 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
278 uint8_t Endpoint_Write_Stream_LE(const void* const Buffer
,
280 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
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.
287 * \note This routine should not be used on CONTROL type endpoints.
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.
294 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
296 uint8_t Endpoint_Write_Stream_BE(const void* const Buffer
,
298 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
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.
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.
315 * <b>Single Stream Transfer Example:</b>
317 * uint8_t DataStream[512];
320 * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
321 * NULL)) != ENDPOINT_RWSTREAM_NoError)
323 * // Stream failed to complete - check ErrorCode here
327 * <b>Partial Stream Transfers Example:</b>
329 * uint8_t DataStream[512];
331 * uint16_t BytesProcessed;
333 * BytesProcessed = 0;
334 * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
335 * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
337 * // Stream not yet complete - do other actions here, abort if required
340 * if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
342 * // Stream failed to complete - check ErrorCode here
346 * \note This routine should not be used on CONTROL type endpoints.
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.
353 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
355 uint8_t Endpoint_Read_Stream_LE(void* const Buffer
,
357 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
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.
364 * \note This routine should not be used on CONTROL type endpoints.
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.
371 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
373 uint8_t Endpoint_Read_Stream_BE(void* const Buffer
,
375 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
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.
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.
386 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
394 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
396 uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer
,
397 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
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.
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.
408 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
416 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
418 uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer
,
419 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
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.
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.
430 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
438 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
440 uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer
,
441 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
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.
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.
452 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
460 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
462 uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer
,
463 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
466 /** \name Stream functions for EEPROM source/destination data */
469 /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
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.
476 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
478 uint8_t Endpoint_Write_EStream_LE(const void* const Buffer
,
480 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
482 /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
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.
489 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
491 uint8_t Endpoint_Write_EStream_BE(const void* const Buffer
,
493 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
495 /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
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.
502 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
504 uint8_t Endpoint_Read_EStream_LE(void* const Buffer
,
506 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
508 /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
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.
515 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
517 uint8_t Endpoint_Read_EStream_BE(void* const Buffer
,
519 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
521 /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
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.
527 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
535 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
537 uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer
,
538 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
540 /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
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.
546 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
554 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
556 uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer
,
557 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
559 /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
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.
565 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
573 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
575 uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer
,
576 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
578 /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
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.
584 * \note This routine should only be used on CONTROL type endpoints.
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_BE(void* const Buffer
,
595 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
598 /** \name Stream functions for PROGMEM source/destination data */
601 /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
603 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
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.
610 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
612 uint8_t Endpoint_Write_PStream_LE(const void* const Buffer
,
614 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
616 /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
618 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
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.
625 * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
627 uint8_t Endpoint_Write_PStream_BE(const void* const Buffer
,
629 uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1);
631 /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
633 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
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.
639 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
647 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
649 uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer
,
650 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
652 /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
654 * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
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.
660 * \note This routine should only be used on CONTROL type endpoints.
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.
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.
668 * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
670 uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer
,
671 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1);
674 /* Disable C linkage for C++ Compilers: */
675 #if defined(__cplusplus)