Statistics
| Branch: | Tag: | Revision:

root / LUFA / Drivers / USB / Core / XMEGA / EndpointStream_XMEGA.h @ 978b99e5

History | View | Annotate | Download (33.4 KB)

1
/*
2
             LUFA Library
3
     Copyright (C) Dean Camera, 2011.
4
              
5
  dean [at] fourwalledcubicle [dot] com
6
           www.lufa-lib.org
7
*/
8

    
9
/*
10
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11

12
  Permission to use, copy, modify, distribute, and sell this 
13
  software and its documentation for any purpose is hereby granted
14
  without fee, provided that the above copyright notice appear in 
15
  all copies and that both that the copyright notice and this
16
  permission notice and warranty disclaimer appear in supporting 
17
  documentation, and that the name of the author not be used in 
18
  advertising or publicity pertaining to distribution of the 
19
  software without specific, written prior permission.
20

21
  The author disclaim all warranties with regard to this
22
  software, including all implied warranties of merchantability
23
  and fitness.  In no event shall the author be liable for any
24
  special, indirect or consequential damages or any damages
25
  whatsoever resulting from loss of use, data or profits, whether
26
  in an action of contract, negligence or other tortious action,
27
  arising out of or in connection with the use or performance of
28
  this software.
29
*/
30

    
31
/** \file
32
 *  \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers.
33
 *  \copydetails Group_EndpointStreamRW_XMEGA
34
 *
35
 *  \note This file should not be included directly. It is automatically included as needed by the USB driver
36
 *        dispatch header located in LUFA/Drivers/USB/USB.h.
37
 */
38

    
39
/** \ingroup Group_EndpointStreamRW
40
 *  \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA)
41
 *  \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture.
42
 *
43
 *  Functions, macros, variables, enums and types related to data reading and writing of data streams from
44
 *  and to endpoints.
45
 *
46
 *  @{
47
 */ 
48

    
49
#ifndef __ENDPOINT_STREAM_XMEGA_H__
50
#define __ENDPOINT_STREAM_XMEGA_H__
51

    
52
        /* Includes: */
53
                #include "../../../../Common/Common.h"
54
                #include "../USBMode.h"                
55
                #include "../USBTask.h"
56
                
57
        /* Enable C linkage for C++ Compilers: */
58
                #if defined(__cplusplus)
59
                        extern "C" {
60
                #endif
61

    
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.
65
                #endif
66

    
67
        /* Public Interface - May be used in end-application: */
68
                /* Function Prototypes: */
69
                        /** \name Stream functions for null data */
70
                        //@{
71

    
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.
76
                         *
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.
86
                         *
87
                         *  <b>Single Stream Transfer Example:</b>
88
                         *  \code
89
                         *  uint8_t ErrorCode;
90
                         *
91
                         *  if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
92
                         *  {
93
                         *       // Stream failed to complete - check ErrorCode here
94
                         *  }
95
                         *  \endcode
96
                         *
97
                         *  <b>Partial Stream Transfers Example:</b>
98
                         *  \code
99
                         *  uint8_t  ErrorCode;
100
                         *  uint16_t BytesProcessed;
101
                         *
102
                         *  BytesProcessed = 0;
103
                         *  while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
104
                         *  {
105
                         *      // Stream not yet complete - do other actions here, abort if required
106
                         *  }
107
                         *
108
                         *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
109
                         *  {
110
                         *      // Stream failed to complete - check ErrorCode here
111
                         *  }
112
                         *  \endcode
113
                         *
114
                         *  \note This routine should not be used on CONTROL type endpoints.
115
                         *
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.
119
                         *
120
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
121
                         */
122
                        uint8_t Endpoint_Discard_Stream(uint16_t Length,
123
                                                        uint16_t* const BytesProcessed);
124

    
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.
129
                         *
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.
139
                         *
140
                         *  <b>Single Stream Transfer Example:</b>
141
                         *  \code
142
                         *  uint8_t ErrorCode;
143
                         *
144
                         *  if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
145
                         *  {
146
                         *       // Stream failed to complete - check ErrorCode here
147
                         *  }
148
                         *  \endcode
149
                         *
150
                         *  <b>Partial Stream Transfers Example:</b>
151
                         *  \code
152
                         *  uint8_t  ErrorCode;
153
                         *  uint16_t BytesProcessed;
154
                         *
155
                         *  BytesProcessed = 0;
156
                         *  while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
157
                         *  {
158
                         *      // Stream not yet complete - do other actions here, abort if required
159
                         *  }
160
                         *
161
                         *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
162
                         *  {
163
                         *      // Stream failed to complete - check ErrorCode here
164
                         *  }
165
                         *  \endcode
166
                         *
167
                         *  \note This routine should not be used on CONTROL type endpoints.
168
                         *
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.
172
                         *
173
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
174
                         */
175
                        uint8_t Endpoint_Null_Stream(uint16_t Length,
176
                                                     uint16_t* const BytesProcessed);
177

    
178
                        //@}
179

    
180
                        /** \name Stream functions for RAM source/destination data */
181
                        //@{
182
                
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.
187
                         *
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.
197
                         *
198
                         *  <b>Single Stream Transfer Example:</b>
199
                         *  \code
200
                         *  uint8_t DataStream[512];
201
                         *  uint8_t ErrorCode;
202
                         *
203
                         *  if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
204
                         *                                            NULL)) != ENDPOINT_RWSTREAM_NoError)
205
                         *  {
206
                         *       // Stream failed to complete - check ErrorCode here
207
                         *  }
208
                         *  \endcode
209
                         *
210
                         *  <b>Partial Stream Transfers Example:</b>
211
                         *  \code
212
                         *  uint8_t  DataStream[512];
213
                         *  uint8_t  ErrorCode;
214
                         *  uint16_t BytesProcessed;
215
                         *
216
                         *  BytesProcessed = 0;
217
                         *  while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
218
                         *                                               &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
219
                         *  {
220
                         *      // Stream not yet complete - do other actions here, abort if required
221
                         *  }
222
                         *
223
                         *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
224
                         *  {
225
                         *      // Stream failed to complete - check ErrorCode here
226
                         *  }
227
                         *  \endcode
228
                         *
229
                         *  \note This routine should not be used on CONTROL type endpoints.
230
                         *
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.
235
                         *
236
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
237
                         */
238
                        uint8_t Endpoint_Write_Stream_LE(const void* const Buffer,
239
                                                         uint16_t Length,
240
                                                         uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
241

    
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.
246
                         *
247
                         *  \note This routine should not be used on CONTROL type endpoints.
248
                         *
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.
253
                         *
254
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
255
                         */
256
                        uint8_t Endpoint_Write_Stream_BE(const void* const Buffer,
257
                                                         uint16_t Length,
258
                                                         uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
259
                        
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.
264
                         *
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.
274
                         *
275
                         *  <b>Single Stream Transfer Example:</b>
276
                         *  \code
277
                         *  uint8_t DataStream[512];
278
                         *  uint8_t ErrorCode;
279
                         *
280
                         *  if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
281
                         *                                           NULL)) != ENDPOINT_RWSTREAM_NoError)
282
                         *  {
283
                         *       // Stream failed to complete - check ErrorCode here
284
                         *  }
285
                         *  \endcode
286
                         *
287
                         *  <b>Partial Stream Transfers Example:</b>
288
                         *  \code
289
                         *  uint8_t  DataStream[512];
290
                         *  uint8_t  ErrorCode;
291
                         *  uint16_t BytesProcessed;
292
                         *
293
                         *  BytesProcessed = 0;
294
                         *  while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
295
                         *                                              &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
296
                         *  {
297
                         *      // Stream not yet complete - do other actions here, abort if required
298
                         *  }
299
                         *
300
                         *  if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
301
                         *  {
302
                         *      // Stream failed to complete - check ErrorCode here
303
                         *  }
304
                         *  \endcode
305
                         *
306
                         *  \note This routine should not be used on CONTROL type endpoints.
307
                         *
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.
312
                         *
313
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
314
                         */
315
                        uint8_t Endpoint_Read_Stream_LE(void* const Buffer,
316
                                                        uint16_t Length,
317
                                                        uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
318

    
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.
323
                         *
324
                         *  \note This routine should not be used on CONTROL type endpoints.
325
                         *
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.
330
                         *
331
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
332
                         */
333
                        uint8_t Endpoint_Read_Stream_BE(void* const Buffer,
334
                                                        uint16_t Length,
335
                                                        uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
336

    
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 setup OUT to
340
                         *  finalize the transfer via the \ref Endpoint_ClearOUT() macro.
341
                         *
342
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
343
                         *        to clear the status stage when using this routine in a control transaction.
344
                         *        \n\n
345
                         *
346
                         *  \note This routine should only be used on CONTROL type endpoints.
347
                         *
348
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
349
                         *           together; i.e. the entire stream data must be read or written at the one time.
350
                         *
351
                         *  \param[in] Buffer  Pointer to the source data buffer to read from.
352
                         *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer.
353
                         *
354
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
355
                         */
356
                        uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer,
357
                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
358

    
359
                        /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
360
                         *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
361
                         *  in both failure and success states; the user is responsible for manually clearing the setup OUT to
362
                         *  finalize the transfer via the \ref Endpoint_ClearOUT() macro.
363
                         *
364
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
365
                         *        to clear the status stage when using this routine in a control transaction.
366
                         *        \n\n
367
                         *
368
                         *  \note This routine should only be used on CONTROL type endpoints.
369
                         *
370
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
371
                         *           together; i.e. the entire stream data must be read or written at the one time.
372
                         *
373
                         *  \param[in] Buffer  Pointer to the source data buffer to read from.
374
                         *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer.
375
                         *
376
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
377
                         */
378
                        uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer,
379
                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
380

    
381
                        /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
382
                         *  discarding fully read packets from the host as needed. The device IN acknowledgement is not
383
                         *  automatically sent after success or failure states; the user is responsible for manually sending the
384
                         *  setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
385
                         *
386
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
387
                         *        to clear the status stage when using this routine in a control transaction.
388
                         *        \n\n
389
                         *
390
                         *  \note This routine should only be used on CONTROL type endpoints.
391
                         *
392
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
393
                         *           together; i.e. the entire stream data must be read or written at the one time.
394
                         *
395
                         *  \param[out] Buffer  Pointer to the destination data buffer to write to.
396
                         *  \param[in]  Length  Number of bytes to send via the currently selected endpoint.
397
                         *
398
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
399
                         */
400
                        uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer,
401
                                                                uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
402

    
403
                        /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
404
                         *  discarding fully read packets from the host as needed. The device IN acknowledgement is not
405
                         *  automatically sent after success or failure states; the user is responsible for manually sending the
406
                         *  setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
407
                         *
408
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
409
                         *        to clear the status stage when using this routine in a control transaction.
410
                         *        \n\n
411
                         *
412
                         *  \note This routine should only be used on CONTROL type endpoints.
413
                         *
414
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
415
                         *           together; i.e. the entire stream data must be read or written at the one time.
416
                         *
417
                         *  \param[out] Buffer  Pointer to the destination data buffer to write to.
418
                         *  \param[in]  Length  Number of bytes to send via the currently selected endpoint.
419
                         *
420
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
421
                         */
422
                        uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer,
423
                                                                uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
424
                        //@}
425

    
426
                        /** \name Stream functions for EEPROM source/destination data */
427
                        //@{
428

    
429
                        /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
430
                         *
431
                         *  \param[in] Buffer          Pointer to the source data buffer to read from.
432
                         *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer.
433
                         *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current
434
                         *                             transaction should be updated, \c NULL if the entire stream should be written at once.
435
                         *
436
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
437
                         */
438
                        uint8_t Endpoint_Write_EStream_LE(const void* const Buffer,
439
                                                          uint16_t Length,
440
                                                          uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
441

    
442
                        /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
443
                         *
444
                         *  \param[in] Buffer          Pointer to the source data buffer to read from.
445
                         *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer.
446
                         *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current
447
                         *                             transaction should be updated, \c NULL if the entire stream should be written at once.
448
                         *
449
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
450
                         */
451
                        uint8_t Endpoint_Write_EStream_BE(const void* const Buffer,
452
                                                          uint16_t Length,
453
                                                          uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
454

    
455
                        /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE().
456
                         *
457
                         *  \param[out] Buffer          Pointer to the destination data buffer to write to, located in EEPROM memory space.
458
                         *  \param[in]  Length          Number of bytes to send via the currently selected endpoint.
459
                         *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current
460
                         *                              transaction should be updated, \c NULL if the entire stream should be read at once.
461
                         *
462
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
463
                         */
464
                        uint8_t Endpoint_Read_EStream_LE(void* const Buffer,
465
                                                         uint16_t Length,
466
                                                         uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
467

    
468
                        /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE().
469
                         *
470
                         *  \param[out] Buffer          Pointer to the destination data buffer to write to, located in EEPROM memory space.
471
                         *  \param[in]  Length          Number of bytes to send via the currently selected endpoint.
472
                         *  \param[in]  BytesProcessed  Pointer to a location where the total number of bytes processed in the current
473
                         *                              transaction should be updated, \c NULL if the entire stream should be read at once.
474
                         *
475
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
476
                         */
477
                        uint8_t Endpoint_Read_EStream_BE(void* const Buffer,
478
                                                         uint16_t Length,
479
                                                         uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
480

    
481
                        /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
482
                         *
483
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
484
                         *        to clear the status stage when using this routine in a control transaction.
485
                         *        \n\n
486
                         *
487
                         *  \note This routine should only be used on CONTROL type endpoints.
488
                         *        \n\n
489
                         *
490
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
491
                         *           together; i.e. the entire stream data must be read or written at the one time.
492
                         *
493
                         *  \param[in] Buffer  Pointer to the source data buffer to read from.
494
                         *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer.
495
                         *
496
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
497
                         */
498
                        uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer,
499
                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
500

    
501
                        /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
502
                         *
503
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
504
                         *        to clear the status stage when using this routine in a control transaction.
505
                         *        \n\n
506
                         *
507
                         *  \note This routine should only be used on CONTROL type endpoints.
508
                         *        \n\n
509
                         *
510
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
511
                         *           together; i.e. the entire stream data must be read or written at the one time.
512
                         *
513
                         *  \param[in] Buffer  Pointer to the source data buffer to read from.
514
                         *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer.
515
                         *
516
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
517
                         */
518
                        uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer,
519
                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
520

    
521
                        /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
522
                         *
523
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
524
                         *        to clear the status stage when using this routine in a control transaction.
525
                         *        \n\n
526
                         *
527
                         *  \note This routine should only be used on CONTROL type endpoints.
528
                         *        \n\n
529
                         *
530
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
531
                         *           together; i.e. the entire stream data must be read or written at the one time.
532
                         *
533
                         *  \param[out] Buffer  Pointer to the destination data buffer to write to.
534
                         *  \param[in]  Length  Number of bytes to send via the currently selected endpoint.
535
                         *
536
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
537
                         */
538
                        uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer,
539
                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
540

    
541
                        /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
542
                         *
543
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
544
                         *        to clear the status stage when using this routine in a control transaction.
545
                         *        \n\n
546
                         *
547
                         *  \note This routine should only be used on CONTROL type endpoints.
548
                         *        \n\n
549
                         *
550
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
551
                         *           together; i.e. the entire stream data must be read or written at the one time.
552
                         *
553
                         *  \param[out] Buffer  Pointer to the destination data buffer to write to.
554
                         *  \param[in]  Length  Number of bytes to send via the currently selected endpoint.
555
                         *
556
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
557
                         */
558
                        uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer,
559
                                                                 uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
560
                        //@}
561

    
562
                        /** \name Stream functions for PROGMEM source/destination data */
563
                        //@{
564

    
565
                        /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
566
                         *
567
                         *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
568
                         *
569
                         *  \param[in] Buffer          Pointer to the source data buffer to read from.
570
                         *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer.
571
                         *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current
572
                         *                             transaction should be updated, \c NULL if the entire stream should be written at once.
573
                         *
574
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
575
                         */
576
                        uint8_t Endpoint_Write_PStream_LE(const void* const Buffer,
577
                                                          uint16_t Length,
578
                                                          uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
579

    
580
                        /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
581
                         *
582
                         *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
583
                         *
584
                         *  \param[in] Buffer          Pointer to the source data buffer to read from.
585
                         *  \param[in] Length          Number of bytes to read for the currently selected endpoint into the buffer.
586
                         *  \param[in] BytesProcessed  Pointer to a location where the total number of bytes processed in the current
587
                         *                             transaction should be updated, \c NULL if the entire stream should be written at once.
588
                         *
589
                         *  \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
590
                         */
591
                        uint8_t Endpoint_Write_PStream_BE(const void* const Buffer,
592
                                                          uint16_t Length,
593
                                                          uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
594

    
595
                        /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
596
                         *
597
                         *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
598
                         *
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.
601
                         *        \n\n
602
                         *
603
                         *  \note This routine should only be used on CONTROL type endpoints.
604
                         *        \n\n
605
                         *
606
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
607
                         *           together; i.e. the entire stream data must be read or written at the one time.
608
                         *
609
                         *  \param[in] Buffer  Pointer to the source data buffer to read from.
610
                         *  \param[in] Length  Number of bytes to read for the currently selected endpoint into the buffer.
611
                         *
612
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
613
                         */
614
                        uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer,
615
                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
616

    
617
                        /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
618
                         *
619
                         *  \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
620
                         *
621
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt
622
                         *        to clear the status stage when using this routine in a control transaction.
623
                         *        \n\n
624
                         *
625
                         *  \note This routine should only be used on CONTROL type endpoints.
626
                         *        \n\n
627
                         *
628
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
629
                         *           together; i.e. the entire stream data must be read or written at the one time.
630
                         *
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
                         *
634
                         *  \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
635
                         */
636
                        uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer,
637
                                                                  uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
638
                        //@}
639

    
640
        /* Disable C linkage for C++ Compilers: */
641
                #if defined(__cplusplus)
642
                        }
643
                #endif
644
                
645
#endif
646

    
647
/** @} */
648