*\r
* Functions, macros and enums related to endpoint management when in USB Device mode. This\r
* module contains the endpoint management macros, as well as endpoint interrupt and data\r
- * send/recieve functions for various datatypes.\r
+ * send/recieve functions for various data types.\r
*/\r
\r
#ifndef __ENDPOINT_H__\r
#include "../HighLevel/USBTask.h"\r
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- #include "StreamCallbacks.h"\r
+ #include "../HighLevel/StreamCallbacks.h"\r
#endif\r
+ \r
/* Enable C linkage for C++ Compilers: */\r
#if defined(__cplusplus)\r
extern "C" {\r
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's\r
* numerical address in the device.\r
*/\r
- #define ENDPOINT_EPNUM_MASK 0b111\r
+ #define ENDPOINT_EPNUM_MASK 0x03\r
\r
/** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's\r
* bank size in the device.\r
\r
/** Returns true if the currently selected endpoint may be read from (if data is waiting in the endpoint\r
* bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an\r
- * IN direction). This function will return false if an error has occured in the endpoint, or if\r
+ * IN direction). This function will return false if an error has occurred in the endpoint, or if\r
* the endpoint is an OUT direction and no packet has been received, or if the endpoint is an IN\r
* direction and the endpoint bank is full.\r
*/\r
/** Sends an IN packet to the host on the currently selected CONTROL type endpoint. */\r
#define Endpoint_ClearSetupIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE\r
\r
- /** Acknowedges an OUT packet to the host on the currently selected CONTROL type endpoint, freeing\r
+ /** Acknowledges an OUT packet to the host on the currently selected CONTROL type endpoint, freeing\r
* up the endpoint for the next packet.\r
*/\r
#define Endpoint_ClearSetupOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE\r
\r
- /** Stalls the current endpoint, indicating to the host that a logical problem occured with the\r
+ /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the\r
* indicated endpoint and that the current transfer sequence should be aborted. This provides a\r
* way for devices to indicate invalid commands to the host so that the current transfer can be\r
- * aborted and the host can begin its own recovery seqeuence.\r
+ * aborted and the host can begin its own recovery sequence.\r
*\r
* The currently selected endpoint remains stalled until either the Endpoint_ClearStall() macro\r
* is called, or the host issues a CLEAR FEATURE request to the device for the currently selected\r
/** Clears the stall on the currently selected endpoint. */\r
#define Endpoint_ClearStall() MACROS{ UECONX |= (1 << STALLRQC); }MACROE\r
\r
- /** Returns true if the currently selected endpoint is stalled, false othewise. */\r
+ /** Returns true if the currently selected endpoint is stalled, false otherwise. */\r
#define Endpoint_IsStalled() ((UECONX & (1 << STALLRQ)) ? true : false)\r
\r
/** Resets the data toggle of the currently selected endpoint. */\r
*\r
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token\r
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter ommitted.\r
+ * and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* \param Length Number of bytes to send via the currently selected endpoint.\r
- * \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback\r
+ * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.\r
*/\r
*\r
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token\r
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter ommitted.\r
+ * and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* \param Buffer Pointer to the source data buffer to read from.\r
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.\r
- * \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback\r
+ * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.\r
*/\r
*\r
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token\r
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter ommitted.\r
+ * and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* \param Buffer Pointer to the source data buffer to read from.\r
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.\r
- * \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback\r
+ * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.\r
*/\r
*\r
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token\r
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter ommitted.\r
+ * and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* \param Buffer Pointer to the destination data buffer to write to.\r
* \param Length Number of bytes to send via the currently selected endpoint.\r
- * \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback\r
+ * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.\r
*/\r
*\r
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token\r
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter ommitted.\r
+ * and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* \param Buffer Pointer to the destination data buffer to write to.\r
* \param Length Number of bytes to send via the currently selected endpoint.\r
- * \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback\r
+ * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.\r
*/\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,\r
- * sending full packets to the host as needed. The host OUT acknowedgement is not automatically cleared\r
+ * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared\r
* in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
* finalize the transfer via the Endpoint_ClearSetupOUT() macro.\r
*\r
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,\r
- * sending full packets to the host as needed. The host OUT acknowedgement is not automatically cleared\r
+ * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared\r
* in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
* finalize the transfer via the Endpoint_ClearSetupOUT() macro.\r
*\r
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,\r
- * discarding fully read packets from the host as needed. The device IN acknowedgement is not\r
+ * discarding fully read packets from the host as needed. The device IN acknowledgement is not\r
* automatically sent after success or failure states; the user is responsible for manually sending the\r
* setup IN to finalize the transfer via the Endpoint_ClearSetupIN() macro.\r
*\r
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,\r
- * discarding fully read packets from the host as needed. The device IN acknowedgement is not\r
+ * discarding fully read packets from the host as needed. The device IN acknowledgement is not\r
* automatically sent after success or failure states; the user is responsible for manually sending the\r
* setup IN to finalize the transfer via the Endpoint_ClearSetupIN() macro.\r
*\r
#define Endpoint_Ignore_DWord() Endpoint_Discard_DWord()\r
\r
/** Alias for Endpoint_Read_Word_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Read_Word() Endpoint_Read_Word_LE() \r
\r
/** Alias for Endpoint_Write_Word_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Write_Word(Word) Endpoint_Write_Word_LE(Word)\r
\r
/** Alias for Endpoint_Read_DWord_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Read_DWord() Endpoint_Read_DWord_LE()\r
\r
/** Alias for Endpoint_Write_DWord_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Write_DWord(DWord) Endpoint_Write_DWord_LE(DWord)\r
\r
/** Alias for Endpoint_Read_Stream_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#if !defined(NO_STREAM_CALLBACKS)\r
#define Endpoint_Read_Stream(Buffer, Length, Callback) Endpoint_Read_Stream_LE(Buffer, Length, Callback)\r
#endif\r
\r
/** Alias for Endpoint_Write_Stream_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#if !defined(NO_STREAM_CALLBACKS)\r
#define Endpoint_Write_Stream(Buffer, Length, Callback) Endpoint_Write_Stream_LE(Buffer, Length, Callback)\r
#endif\r
\r
/** Alias for Endpoint_Read_Control_Stream_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Read_Control_Stream(Data, Length) Endpoint_Read_Control_Stream_LE(Data, Length)\r
\r
/** Alias for Endpoint_Write_Control_Stream_LE(). By default USB transfers use little endian format, thus\r
- * the command with no endianness specifier indicates little endian mode.\r
+ * the command with no endianness specified indicates little endian mode.\r
*/\r
#define Endpoint_Write_Control_Stream(Data, Length) Endpoint_Write_Control_Stream_LE(Data, Length) \r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Macros: */\r
- #define Endpoint_AllocateMemory() MACROS{ UECFG1X |= (1 << ALLOC); }MACROE\r
- #define Endpoint_DeallocateMemory() MACROS{ UECFG1X &= ~(1 << ALLOC); }MACROE\r
+ #define Endpoint_AllocateMemory() MACROS{ UECFG1X |= (1 << ALLOC); }MACROE\r
+ #define Endpoint_DeallocateMemory() MACROS{ UECFG1X &= ~(1 << ALLOC); }MACROE\r
\r
#define _ENDPOINT_GET_MAXSIZE(n) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## n)\r
#define _ENDPOINT_GET_MAXSIZE2(details) _ENDPOINT_GET_MAXSIZE3(details)\r