Keyboard firmwares for Atmel AVR and Cortex-M
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

EndpointStream_XMEGA.h 34KB

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