3      Copyright (C) Dean Camera, 2015. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2015  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 disclaims 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 for the AVR8 microcontrollers. 
  33  *  \copydetails Group_EndpointStreamRW_AVR8 
  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_EndpointStreamRW 
  40  *  \defgroup Group_EndpointStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) 
  41  *  \brief Endpoint data stream transmission and reception management for the Atmel AVR8 architecture. 
  43  *  Functions, macros, variables, enums and types related to data reading and writing of data streams from 
  49 #ifndef __ENDPOINT_STREAM_AVR8_H__ 
  50 #define __ENDPOINT_STREAM_AVR8_H__ 
  53                 #include "../../../../Common/Common.h" 
  54                 #include "../USBMode.h" 
  55                 #include "../USBTask.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: */ 
  68                 /* Function Prototypes: */ 
  69                         /** \name Stream functions for null data */ 
  72                         /** Reads and discards the given number of bytes from the currently selected endpoint's bank, 
  73                          *  discarding fully read packets from the host as needed. The last packet is not automatically 
  74                          *  discarded once the remaining bytes has been read; the user is responsible for manually 
  75                          *  discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. 
  77                          *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, 
  78                          *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid 
  79                          *  storage location, the transfer will instead be performed as a series of chunks. Each time 
  80                          *  the endpoint bank becomes empty while there is still data to process (and after the current 
  81                          *  packet has been acknowledged) the BytesProcessed location will be updated with the total number 
  82                          *  of bytes processed in the stream, and the function will exit with an error code of 
  83                          *  \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed 
  84                          *  in the user code - to continue the transfer, call the function again with identical parameters 
  85                          *  and it will resume until the BytesProcessed value reaches the total transfer length. 
  87                          *  <b>Single Stream Transfer Example:</b> 
  91                          *  if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) 
  93                          *       // Stream failed to complete - check ErrorCode here 
  97                          *  <b>Partial Stream Transfers Example:</b> 
 100                          *  uint16_t BytesProcessed; 
 102                          *  BytesProcessed = 0; 
 103                          *  while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) 
 105                          *      // Stream not yet complete - do other actions here, abort if required 
 108                          *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError) 
 110                          *      // Stream failed to complete - check ErrorCode here 
 114                          *  \note This routine should not be used on CONTROL type endpoints. 
 116                          *  \param[in] Length          Number of bytes to discard via the currently selected endpoint. 
 117                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 118                          *                             transaction should be updated, \c NULL if the entire stream should be read at once. 
 120                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 122                         uint8_t Endpoint_Discard_Stream(uint16_t Length
, 
 123                                                         uint16_t* const BytesProcessed
); 
 125                         /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending 
 126                          *  full packets to the host as needed. The last packet is not automatically sent once the 
 127                          *  remaining bytes have been written; the user is responsible for manually sending the last 
 128                          *  packet to the host via the \ref Endpoint_ClearIN() macro. 
 130                          *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, 
 131                          *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid 
 132                          *  storage location, the transfer will instead be performed as a series of chunks. Each time 
 133                          *  the endpoint bank becomes full while there is still data to process (and after the current 
 134                          *  packet transmission has been initiated) the BytesProcessed location will be updated with the 
 135                          *  total number of bytes processed in the stream, and the function will exit with an error code of 
 136                          *  \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed 
 137                          *  in the user code - to continue the transfer, call the function again with identical parameters 
 138                          *  and it will resume until the BytesProcessed value reaches the total transfer length. 
 140                          *  <b>Single Stream Transfer Example:</b> 
 144                          *  if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) 
 146                          *       // Stream failed to complete - check ErrorCode here 
 150                          *  <b>Partial Stream Transfers Example:</b> 
 153                          *  uint16_t BytesProcessed; 
 155                          *  BytesProcessed = 0; 
 156                          *  while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) 
 158                          *      // Stream not yet complete - do other actions here, abort if required 
 161                          *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError) 
 163                          *      // Stream failed to complete - check ErrorCode here 
 167                          *  \note This routine should not be used on CONTROL type endpoints. 
 169                          *  \param[in] Length          Number of zero bytes to send via the currently selected endpoint. 
 170                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 171                          *                             transaction should be updated, \c NULL if the entire stream should be read at once. 
 173                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 175                         uint8_t Endpoint_Null_Stream(uint16_t Length
, 
 176                                                      uint16_t* const BytesProcessed
); 
 180                         /** \name Stream functions for RAM source/destination data */ 
 183                         /** Writes the given number of bytes to the endpoint from the given buffer in little endian, 
 184                          *  sending full packets to the host as needed. The last packet filled is not automatically sent; 
 185                          *  the user is responsible for manually sending the last written packet to the host via the 
 186                          *  \ref Endpoint_ClearIN() macro. 
 188                          *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, 
 189                          *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid 
 190                          *  storage location, the transfer will instead be performed as a series of chunks. Each time 
 191                          *  the endpoint bank becomes full while there is still data to process (and after the current 
 192                          *  packet transmission has been initiated) the BytesProcessed location will be updated with the 
 193                          *  total number of bytes processed in the stream, and the function will exit with an error code of 
 194                          *  \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed 
 195                          *  in the user code - to continue the transfer, call the function again with identical parameters 
 196                          *  and it will resume until the BytesProcessed value reaches the total transfer length. 
 198                          *  <b>Single Stream Transfer Example:</b> 
 200                          *  uint8_t DataStream[512]; 
 203                          *  if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), 
 204                          *                                            NULL)) != ENDPOINT_RWSTREAM_NoError) 
 206                          *       // Stream failed to complete - check ErrorCode here 
 210                          *  <b>Partial Stream Transfers Example:</b> 
 212                          *  uint8_t  DataStream[512]; 
 214                          *  uint16_t BytesProcessed; 
 216                          *  BytesProcessed = 0; 
 217                          *  while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), 
 218                          *                                               &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) 
 220                          *      // Stream not yet complete - do other actions here, abort if required 
 223                          *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError) 
 225                          *      // Stream failed to complete - check ErrorCode here 
 229                          *  \note This routine should not be used on CONTROL type endpoints. 
 231                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 232                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 233                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 234                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 236                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 238                         uint8_t Endpoint_Write_Stream_LE(const void* const Buffer
, 
 240                                                          uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 242                         /** Writes the given number of bytes to the endpoint from the given buffer in big endian, 
 243                          *  sending full packets to the host as needed. The last packet filled is not automatically sent; 
 244                          *  the user is responsible for manually sending the last written packet to the host via the 
 245                          *  \ref Endpoint_ClearIN() macro. 
 247                          *  \note This routine should not be used on CONTROL type endpoints. 
 249                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 250                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 251                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 252                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 254                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 256                         uint8_t Endpoint_Write_Stream_BE(const void* const Buffer
, 
 258                                                          uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 260                         /** Reads the given number of bytes from the endpoint from the given buffer in little endian, 
 261                          *  discarding fully read packets from the host as needed. The last packet is not automatically 
 262                          *  discarded once the remaining bytes has been read; the user is responsible for manually 
 263                          *  discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. 
 265                          *  If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, 
 266                          *  failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid 
 267                          *  storage location, the transfer will instead be performed as a series of chunks. Each time 
 268                          *  the endpoint bank becomes empty while there is still data to process (and after the current 
 269                          *  packet has been acknowledged) the BytesProcessed location will be updated with the total number 
 270                          *  of bytes processed in the stream, and the function will exit with an error code of 
 271                          *  \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed 
 272                          *  in the user code - to continue the transfer, call the function again with identical parameters 
 273                          *  and it will resume until the BytesProcessed value reaches the total transfer length. 
 275                          *  <b>Single Stream Transfer Example:</b> 
 277                          *  uint8_t DataStream[512]; 
 280                          *  if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), 
 281                          *                                           NULL)) != ENDPOINT_RWSTREAM_NoError) 
 283                          *       // Stream failed to complete - check ErrorCode here 
 287                          *  <b>Partial Stream Transfers Example:</b> 
 289                          *  uint8_t  DataStream[512]; 
 291                          *  uint16_t BytesProcessed; 
 293                          *  BytesProcessed = 0; 
 294                          *  while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), 
 295                          *                                              &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) 
 297                          *      // Stream not yet complete - do other actions here, abort if required 
 300                          *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError) 
 302                          *      // Stream failed to complete - check ErrorCode here 
 306                          *  \note This routine should not be used on CONTROL type endpoints. 
 308                          *  \param[out] Buffer          Pointer to the destination data buffer to write to. 
 309                          *  \param[in]  Length          Number of bytes to send via the currently selected endpoint. 
 310                          *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 311                          *                              transaction should be updated, \c NULL if the entire stream should be read at once. 
 313                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 315                         uint8_t Endpoint_Read_Stream_LE(void* const Buffer
, 
 317                                                         uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 319                         /** Reads the given number of bytes from the endpoint from the given buffer in big endian, 
 320                          *  discarding fully read packets from the host as needed. The last packet is not automatically 
 321                          *  discarded once the remaining bytes has been read; the user is responsible for manually 
 322                          *  discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. 
 324                          *  \note This routine should not be used on CONTROL type endpoints. 
 326                          *  \param[out] Buffer          Pointer to the destination data buffer to write to. 
 327                          *  \param[in]  Length          Number of bytes to send via the currently selected endpoint. 
 328                          *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 329                          *                              transaction should be updated, \c NULL if the entire stream should be read at once. 
 331                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 333                         uint8_t Endpoint_Read_Stream_BE(void* const Buffer
, 
 335                                                         uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 337                         /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, 
 338                          *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared 
 339                          *  in both failure and success states; the user is responsible for manually clearing the status OUT packet 
 340                          *  to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. 
 342                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 343                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 344                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 347                          *  \note This routine should only be used on CONTROL type endpoints. 
 349                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 350                          *           together; i.e. the entire stream data must be read or written at the one time. 
 352                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 353                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 355                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 357                         uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer
, 
 358                                                                  uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 360                         /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, 
 361                          *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared 
 362                          *  in both failure and success states; the user is responsible for manually clearing the status OUT packet 
 363                          *  to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. 
 365                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 366                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 367                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 370                          *  \note This routine should only be used on CONTROL type endpoints. 
 372                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 373                          *           together; i.e. the entire stream data must be read or written at the one time. 
 375                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 376                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 378                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 380                         uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer
, 
 381                                                                  uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 383                         /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, 
 384                          *  discarding fully read packets from the host as needed. The device IN acknowledgement is not 
 385                          *  automatically sent after success or failure states; the user is responsible for manually sending the 
 386                          *  status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. 
 388                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 389                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 390                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 393                          *  \note This routine should only be used on CONTROL type endpoints. 
 395                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 396                          *           together; i.e. the entire stream data must be read or written at the one time. 
 398                          *  \param[out] Buffer  Pointer to the destination data buffer to write to. 
 399                          *  \param[in]  Length  Number of bytes to send via the currently selected endpoint. 
 401                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 403                         uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer
, 
 404                                                                 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 406                         /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, 
 407                          *  discarding fully read packets from the host as needed. The device IN acknowledgement is not 
 408                          *  automatically sent after success or failure states; the user is responsible for manually sending the 
 409                          *  status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. 
 411                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 412                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 413                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 416                          *  \note This routine should only be used on CONTROL type endpoints. 
 418                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 419                          *           together; i.e. the entire stream data must be read or written at the one time. 
 421                          *  \param[out] Buffer  Pointer to the destination data buffer to write to. 
 422                          *  \param[in]  Length  Number of bytes to send via the currently selected endpoint. 
 424                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 426                         uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer
, 
 427                                                                 uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 430                         /** \name Stream functions for EEPROM source/destination data */ 
 433                         /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). 
 435                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 436                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 437                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 438                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 440                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 442                         uint8_t Endpoint_Write_EStream_LE(const void* const Buffer
, 
 444                                                           uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 446                         /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). 
 448                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 449                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 450                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 451                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 453                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 455                         uint8_t Endpoint_Write_EStream_BE(const void* const Buffer
, 
 457                                                           uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 459                         /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). 
 461                          *  \param[out] Buffer          Pointer to the destination data buffer to write to, located in EEPROM memory space. 
 462                          *  \param[in]  Length          Number of bytes to send via the currently selected endpoint. 
 463                          *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 464                          *                              transaction should be updated, \c NULL if the entire stream should be read at once. 
 466                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 468                         uint8_t Endpoint_Read_EStream_LE(void* const Buffer
, 
 470                                                          uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 472                         /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). 
 474                          *  \param[out] Buffer          Pointer to the destination data buffer to write to, located in EEPROM memory space. 
 475                          *  \param[in]  Length          Number of bytes to send via the currently selected endpoint. 
 476                          *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 477                          *                              transaction should be updated, \c NULL if the entire stream should be read at once. 
 479                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 481                         uint8_t Endpoint_Read_EStream_BE(void* const Buffer
, 
 483                                                          uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 485                         /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. 
 487                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 488                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 489                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 492                          *  \note This routine should only be used on CONTROL type endpoints. 
 495                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 496                          *           together; i.e. the entire stream data must be read or written at the one time. 
 498                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 499                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 501                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 503                         uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer
, 
 504                                                                   uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 506                         /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). 
 508                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 509                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 510                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 513                          *  \note This routine should only be used on CONTROL type endpoints. 
 516                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 517                          *           together; i.e. the entire stream data must be read or written at the one time. 
 519                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 520                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 522                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 524                         uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer
, 
 525                                                                   uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 527                         /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). 
 529                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 530                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 531                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 534                          *  \note This routine should only be used on CONTROL type endpoints. 
 537                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 538                          *           together; i.e. the entire stream data must be read or written at the one time. 
 540                          *  \param[out] Buffer  Pointer to the destination data buffer to write to. 
 541                          *  \param[in]  Length  Number of bytes to send via the currently selected endpoint. 
 543                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 545                         uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer
, 
 546                                                                  uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 548                         /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). 
 550                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 551                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 552                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 555                          *  \note This routine should only be used on CONTROL type endpoints. 
 558                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 559                          *           together; i.e. the entire stream data must be read or written at the one time. 
 561                          *  \param[out] Buffer  Pointer to the destination data buffer to write to. 
 562                          *  \param[in]  Length  Number of bytes to send via the currently selected endpoint. 
 564                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 566                         uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer
, 
 567                                                                  uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 570                         /** \name Stream functions for PROGMEM source/destination data */ 
 573                         /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). 
 575                          *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. 
 577                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 578                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 579                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 580                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 582                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 584                         uint8_t Endpoint_Write_PStream_LE(const void* const Buffer
, 
 586                                                           uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 588                         /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). 
 590                          *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. 
 592                          *  \param[in] Buffer          Pointer to the source data buffer to read from. 
 593                          *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer. 
 594                          *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current 
 595                          *                             transaction should be updated, \c NULL if the entire stream should be written at once. 
 597                          *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. 
 599                         uint8_t Endpoint_Write_PStream_BE(const void* const Buffer
, 
 601                                                           uint16_t* const BytesProcessed
) ATTR_NON_NULL_PTR_ARG(1); 
 603                         /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). 
 605                          *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. 
 607                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 608                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 609                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 612                          *  \note This routine should only be used on CONTROL type endpoints. 
 615                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 616                          *           together; i.e. the entire stream data must be read or written at the one time. 
 618                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 619                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 621                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 623                         uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer
, 
 624                                                                   uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 626                         /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). 
 628                          *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. 
 630                          *  \note This function automatically sends the last packet in the data stage of the transaction; when the 
 631                          *        function returns, the user is responsible for clearing the <b>status</b> stage of the transaction. 
 632                          *        Note that the status stage packet is sent or received in the opposite direction of the data flow. 
 635                          *  \note This routine should only be used on CONTROL type endpoints. 
 638                          *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained 
 639                          *           together; i.e. the entire stream data must be read or written at the one time. 
 641                          *  \param[in] Buffer  Pointer to the source data buffer to read from. 
 642                          *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer. 
 644                          *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. 
 646                         uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer
, 
 647                                                                   uint16_t Length
) ATTR_NON_NULL_PTR_ARG(1); 
 650         /* Disable C linkage for C++ Compilers: */ 
 651                 #if defined(__cplusplus)