Renamed SERIAL_STREAM_ASSERT() macro to STDOUT_ASSERT().

Minor tweaks to the library documentation.
pull/1469/head
Dean Camera 15 years ago
parent 69dc32c5f0
commit deed746d37

@ -124,15 +124,15 @@
/** Places the function in one of the initialization sections, which execute before the main function /** Places the function in one of the initialization sections, which execute before the main function
* of the application. Refer to the avr-libc manual for more information on the initialization sections. * of the application. Refer to the avr-libc manual for more information on the initialization sections.
* *
* \param[in] x Initialization section number where the function should be placed * \param[in] SectionIndex Initialization section number where the function should be placed.
*/ */
#define ATTR_INIT_SECTION(x) __attribute__ ((naked, section (".init" #x ))) #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((naked, section (".init" #SectionIndex )))
/** Marks a function as an alias for another function. /** Marks a function as an alias for another function.
* *
* \param[in] x Name of the function which the given function name should alias * \param[in] Func Name of the function which the given function name should alias.
*/ */
#define ATTR_ALIAS(x) __attribute__ ((alias( #x ))) #define ATTR_ALIAS(Func) __attribute__ ((alias( #Func )))
#endif #endif
/** @} */ /** @} */

@ -99,17 +99,17 @@
*/ */
#define JTAG_DEBUG_ASSERT(x) MACROS{ if (!(x)) { JTAG_DEBUG_BREAK(); } }MACROE #define JTAG_DEBUG_ASSERT(x) MACROS{ if (!(x)) { JTAG_DEBUG_BREAK(); } }MACROE
/** Macro for testing condition "x" and writing debug data to the serial stream if false. As a /** Macro for testing condition "x" and writing debug data to the stdout stream if false. The stdout stream
* prerequisite for this macro, the serial stream should be configured via the Peripheral/SerialStream driver. * must be pre-initialized before this macro is run and linked to an output device, such as the AVR's USART
* peripheral.
* *
* The serial output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {x} failed."
* {x} failed."
* *
* \ingroup Group_Debugging * \ingroup Group_Debugging
*/ */
#define SERIAL_STREAM_ASSERT(x) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \ #define STDOUT_ASSERT(x) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \ "Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #x); } \ __FILE__, __func__, __LINE__, #x); } \
}MACROE }MACROE
/* Inline Functions: */ /* Inline Functions: */
@ -118,7 +118,7 @@
* *
* \ingroup Group_BitManip * \ingroup Group_BitManip
* *
* \param[in] Byte Byte of data whose bits are to be reversed * \param[in] Byte Byte of data whose bits are to be reversed.
*/ */
static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint8_t BitReverse(uint8_t Byte) static inline uint8_t BitReverse(uint8_t Byte)
@ -134,7 +134,7 @@
* *
* \ingroup Group_BitManip * \ingroup Group_BitManip
* *
* \param[in] Word Word of data whose bytes are to be swapped * \param[in] Word Word of data whose bytes are to be swapped.
*/ */
static inline uint16_t SwapEndian_16(uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint16_t SwapEndian_16(uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint16_t SwapEndian_16(uint16_t Word) static inline uint16_t SwapEndian_16(uint16_t Word)
@ -146,7 +146,7 @@
* *
* \ingroup Group_BitManip * \ingroup Group_BitManip
* *
* \param[in] DWord Double word of data whose bytes are to be swapped * \param[in] DWord Double word of data whose bytes are to be swapped.
*/ */
static inline uint32_t SwapEndian_32(uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint32_t SwapEndian_32(uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint32_t SwapEndian_32(uint32_t DWord) static inline uint32_t SwapEndian_32(uint32_t DWord)
@ -161,8 +161,8 @@
* *
* \ingroup Group_BitManip * \ingroup Group_BitManip
* *
* \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed.
* \param[in] Bytes Length of the data in bytes * \param[in] Bytes Length of the data in bytes.
*/ */
static inline void SwapEndian_n(void* Data, uint8_t Bytes); static inline void SwapEndian_n(void* Data, uint8_t Bytes);
static inline void SwapEndian_n(void* Data, uint8_t Bytes) static inline void SwapEndian_n(void* Data, uint8_t Bytes)

@ -636,7 +636,7 @@ EXCLUDE_PATTERNS =
# wildcard * is used, a substring. Examples: ANamespace, AClass, # wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test # AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS = __* EXCLUDE_SYMBOLS = _* __*
# The EXAMPLE_PATH tag can be used to specify one or more files or # The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see

@ -108,7 +108,7 @@
/** Returns a mask indicating which board buttons are currently pressed. /** Returns a mask indicating which board buttons are currently pressed.
* *
* \return Mask indicating which board buttons are currently pressed * \return Mask indicating which board buttons are currently pressed.
*/ */
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
#endif #endif

@ -218,8 +218,8 @@
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
* dataflash commands which require a complete 24-byte address. * dataflash commands which require a complete 24-byte address.
* *
* \param[in] PageAddress Page address within the selected dataflash IC * \param[in] PageAddress Page address within the selected dataflash IC.
* \param[in] BufferByte Address within the dataflash's buffer * \param[in] BufferByte Address within the dataflash's buffer.
*/ */
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte); static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte);

@ -99,7 +99,7 @@
* currently facing in (multiple bits can be set). * currently facing in (multiple bits can be set).
* *
* \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file * \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file
* for direction masks * for direction masks.
*/ */
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
#endif #endif

@ -140,41 +140,41 @@
/** Turns on the LEDs specified in the given LED mask. /** Turns on the LEDs specified in the given LED mask.
* *
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file) * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/ */
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask); static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask);
/** Turns off the LEDs specified in the given LED mask. /** Turns off the LEDs specified in the given LED mask.
* *
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file) * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/ */
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask); static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask);
/** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED /** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED
* mask. * mask.
* *
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file) * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/ */
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask); static inline void LEDs_SetAllLEDs(const uint8_t LEDMask);
/** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs /** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs
* specified in both the LED and active masks. * specified in both the LED and active masks.
* *
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file) * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
* \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off * \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off.
*/ */
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask); static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);
/** Toggles all LEDs in the LED mask, leaving all others in their current states. /** Toggles all LEDs in the LED mask, leaving all others in their current states.
* *
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file) * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
*/ */
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask); static inline void LEDs_ToggleLEDs(const uint8_t LEDMask);
/** Returns the status of all the board LEDs; set LED masks in the return value indicate that the /** Returns the status of all the board LEDs; set LED masks in the return value indicate that the
* corresponding LED is on. * corresponding LED is on.
* *
* \return Mask of the board LEDs which are currently turned on * \return Mask of the board LEDs which are currently turned on.
*/ */
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
#endif #endif

@ -103,7 +103,7 @@
/** Performs a complete ADC on the temperature sensor channel, and converts the result into a /** Performs a complete ADC on the temperature sensor channel, and converts the result into a
* valid temperature between \ref TEMP_MIN_TEMP and \ref TEMP_MAX_TEMP in degrees Celsius. * valid temperature between \ref TEMP_MIN_TEMP and \ref TEMP_MAX_TEMP in degrees Celsius.
* *
* \return Signed temperature in degrees Celsius * \return Signed temperature value in degrees Celsius.
*/ */
int8_t Temperature_GetTemperature(void) ATTR_WARN_UNUSED_RESULT; int8_t Temperature_GetTemperature(void) ATTR_WARN_UNUSED_RESULT;

@ -63,7 +63,10 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
#if !defined(DISABLE_TERMINAL_CODES) #if !defined(DISABLE_TERMINAL_CODES)
/** Creates an ANSII escape sequence with the payload specified by "c". */ /** Creates an ANSI escape sequence with the payload specified by "c".
*
* \param[in] c Payload to encode as an ANSI escape sequence, a ESC_* mask.
*/
#define ANSI_ESCAPE_SEQUENCE(c) "\33[" c #define ANSI_ESCAPE_SEQUENCE(c) "\33[" c
#else #else
#define ANSI_ESCAPE_SEQUENCE(c) #define ANSI_ESCAPE_SEQUENCE(c)

@ -203,7 +203,7 @@
* The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and * The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and
* prescaler masks. * prescaler masks.
* *
* \param[in] Mode Mask of ADC settings, including adjustment, prescale, mode and reference * \param[in] Mode Mask of ADC settings, including adjustment, prescale, mode and reference.
*/ */
static inline void ADC_Init(uint8_t Mode); static inline void ADC_Init(uint8_t Mode);
@ -221,14 +221,14 @@
/** Indicates if the current ADC conversion is completed, or still in progress. /** Indicates if the current ADC conversion is completed, or still in progress.
* *
* \return Boolean false if the reading is still taking place, or true if the conversion is * \return Boolean false if the reading is still taking place, or true if the conversion is
* complete and ready to be read out with \ref ADC_GetResult() * complete and ready to be read out with \ref ADC_GetResult().
*/ */
static inline bool ADC_IsReadingComplete(void); static inline bool ADC_IsReadingComplete(void);
/** Retrieves the conversion value of the last completed ADC conversion and clears the reading /** Retrieves the conversion value of the last completed ADC conversion and clears the reading
* completion flag. * completion flag.
* *
* \return The result of the last ADC conversion * \return The result of the last ADC conversion as an unsigned value.
*/ */
static inline uint16_t ADC_GetResult(void); static inline uint16_t ADC_GetResult(void);
#else #else
@ -254,7 +254,7 @@
* *
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask. * \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.
* *
* \param[in] Channel ADC channel number to set up for conversions * \param[in] Channel ADC channel number to set up for conversions.
*/ */
static inline void ADC_SetupChannel(const uint8_t Channel) static inline void ADC_SetupChannel(const uint8_t Channel)
{ {
@ -297,7 +297,7 @@
* *
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask. * \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.
* *
* \param[in] Channel ADC channel number to set up for conversions * \param[in] Channel ADC channel number to set up for conversions.
*/ */
static inline void ADC_DisableChannel(const uint8_t Channel) static inline void ADC_DisableChannel(const uint8_t Channel)
{ {
@ -338,7 +338,7 @@
* conversions. If the ADC is in single conversion mode (or the channel to convert from is to be changed), * conversions. If the ADC is in single conversion mode (or the channel to convert from is to be changed),
* this function must be called each time a conversion is to take place. * this function must be called each time a conversion is to take place.
* *
* \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask * \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask.
*/ */
static inline void ADC_StartReading(const uint16_t MUXMask) static inline void ADC_StartReading(const uint16_t MUXMask)
{ {
@ -361,7 +361,7 @@
* to \ref ADC_StartReading() to select the channel and begin the automated conversions, and * to \ref ADC_StartReading() to select the channel and begin the automated conversions, and
* the results read directly from the \ref ADC_GetResult() instead to reduce overhead. * the results read directly from the \ref ADC_GetResult() instead to reduce overhead.
* *
* \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask * \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask.
*/ */
static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT; static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT;
static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask)

@ -111,7 +111,7 @@
* SPI routines. * SPI routines.
* *
* \param[in] SPIOptions SPI Options, a mask consisting of one of each of the SPI_SPEED_*, * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the SPI_SPEED_*,
* SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks * SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks.
*/ */
static inline void SPI_Init(const uint8_t SPIOptions) static inline void SPI_Init(const uint8_t SPIOptions)
{ {
@ -138,9 +138,9 @@
/** Sends and receives a byte through the SPI interface, blocking until the transfer is complete. /** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.
* *
* \param[in] Byte Byte to send through the SPI interface * \param[in] Byte Byte to send through the SPI interface.
* *
* \return Response byte from the attached SPI device * \return Response byte from the attached SPI device.
*/ */
static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline uint8_t SPI_TransferByte(const uint8_t Byte) static inline uint8_t SPI_TransferByte(const uint8_t Byte)
@ -153,7 +153,7 @@
/** Sends a byte through the SPI interface, blocking until the transfer is complete. The response /** Sends a byte through the SPI interface, blocking until the transfer is complete. The response
* byte sent to from the attached SPI device is ignored. * byte sent to from the attached SPI device is ignored.
* *
* \param[in] Byte Byte to send through the SPI interface * \param[in] Byte Byte to send through the SPI interface.
*/ */
static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void SPI_SendByte(const uint8_t Byte) static inline void SPI_SendByte(const uint8_t Byte)
@ -165,7 +165,7 @@
/** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response /** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response
* byte from the attached SPI device is returned. * byte from the attached SPI device is returned.
* *
* \return The response byte from the attached SPI device * \return The response byte from the attached SPI device.
*/ */
static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t SPI_ReceiveByte(void) static inline uint8_t SPI_ReceiveByte(void)

@ -80,7 +80,7 @@
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Indicates whether a character has been received through the USART. /** Indicates whether a character has been received through the USART.
* *
* \return Boolean true if a character has been received, false otherwise * \return Boolean true if a character has been received, false otherwise.
*/ */
static inline bool Serial_IsCharReceived(void); static inline bool Serial_IsCharReceived(void);
#else #else
@ -90,13 +90,13 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Transmits a given string located in program space (FLASH) through the USART. /** Transmits a given string located in program space (FLASH) through the USART.
* *
* \param[in] FlashStringPtr Pointer to a string located in program space * \param[in] FlashStringPtr Pointer to a string located in program space.
*/ */
void Serial_TxString_P(const char *FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1); void Serial_TxString_P(const char *FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1);
/** Transmits a given string located in SRAM memory through the USART. /** Transmits a given string located in SRAM memory through the USART.
* *
* \param[in] StringPtr Pointer to a string located in SRAM space * \param[in] StringPtr Pointer to a string located in SRAM space.
*/ */
void Serial_TxString(const char *StringPtr) ATTR_NON_NULL_PTR_ARG(1); void Serial_TxString(const char *StringPtr) ATTR_NON_NULL_PTR_ARG(1);
@ -104,8 +104,8 @@
/** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to
* standard 8-bit, no parity, 1 stop bit settings suitable for most applications. * standard 8-bit, no parity, 1 stop bit settings suitable for most applications.
* *
* \param[in] BaudRate Serial baud rate, in bits per second * \param[in] BaudRate Serial baud rate, in bits per second.
* \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate.
*/ */
static inline void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed) static inline void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{ {
@ -134,7 +134,7 @@
/** Transmits a given byte through the USART. /** Transmits a given byte through the USART.
* *
* \param[in] DataByte Byte to transmit through the USART * \param[in] DataByte Byte to transmit through the USART.
*/ */
static inline void Serial_TxByte(const char DataByte) static inline void Serial_TxByte(const char DataByte)
{ {
@ -144,7 +144,7 @@
/** Receives a byte from the USART. /** Receives a byte from the USART.
* *
* \return Byte received from the USART * \return Byte received from the USART.
*/ */
static inline char Serial_RxByte(void) static inline char Serial_RxByte(void)
{ {

@ -84,8 +84,8 @@
/** Initializes the serial stream (and regular USART driver) so that both the stream and regular /** Initializes the serial stream (and regular USART driver) so that both the stream and regular
* USART driver functions can be used. Must be called before any stream or regular USART functions. * USART driver functions can be used. Must be called before any stream or regular USART functions.
* *
* \param[in] BaudRate Baud rate to configure the USART to * \param[in] BaudRate Baud rate to configure the USART to.
* \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate.
*/ */
static inline void SerialStream_Init(const uint32_t BaudRate, const bool DoubleSpeed) static inline void SerialStream_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{ {

@ -79,22 +79,22 @@
/** Descriptor header constant to indicate a Audio class endpoint descriptor. */ /** Descriptor header constant to indicate a Audio class endpoint descriptor. */
#define DTYPE_AudioEndpoint 0x25 #define DTYPE_AudioEndpoint 0x25
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */ /** Audio class descriptor subtype value for a Audio class-specific header descriptor. */
#define DSUBTYPE_Header 0x01 #define DSUBTYPE_Header 0x01
/** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */ /** Audio class descriptor subtype value for an Output Terminal Audio class-specific descriptor. */
#define DSUBTYPE_InputTerminal 0x02 #define DSUBTYPE_InputTerminal 0x02
/** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */ /** Audio class descriptor subtype value for an Input Terminal Audio class-specific descriptor. */
#define DSUBTYPE_OutputTerminal 0x03 #define DSUBTYPE_OutputTerminal 0x03
/** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */ /** Audio class descriptor subtype value for a Feature Unit Audio class-specific descriptor. */
#define DSUBTYPE_FeatureUnit 0x06 #define DSUBTYPE_FeatureUnit 0x06
/** Audio class descriptor subtype value for a general Audio class specific descriptor. */ /** Audio class descriptor subtype value for a general Audio class-specific descriptor. */
#define DSUBTYPE_General 0x01 #define DSUBTYPE_General 0x01
/** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */ /** Audio class descriptor subtype value for an Audio class-specific descriptor indicating the format of an audio stream. */
#define DSUBTYPE_Format 0x02 #define DSUBTYPE_Format 0x02
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
@ -225,175 +225,175 @@
*/ */
#define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)} #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples. * accepts only filled endpoint packets of audio samples.
*/ */
#define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7) #define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
* will accept partially filled endpoint packets of audio samples. * will accept partially filled endpoint packets of audio samples.
*/ */
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7) #define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
/* Type Defines: */ /* Type Defines: */
/** \brief Audio Class Specific Interface Descriptor. /** \brief Audio class-specific Interface Descriptor.
* *
* Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
* details. * details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */ uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */ uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
uint8_t InCollection; /**< Total number of audio class interfaces within this device */ uint8_t InCollection; /**< Total number of audio class interfaces within this device. */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */ uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface. */
} USB_Audio_Interface_AC_t; } USB_Audio_Interface_AC_t;
/** \brief Audio Class Specific Feature Unit Descriptor. /** \brief Audio class-specific Feature Unit Descriptor.
* *
* Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
* specification for more details. * specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */ uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device. */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */ uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit. */
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */ uint8_t ControlSize; /**< Size of each element in the ChanelControlls array. */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */ uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_FeatureUnit_t; } USB_Audio_FeatureUnit_t;
/** \brief Audio Class Specific Input Terminal Descriptor. /** \brief Audio class-specific Input Terminal Descriptor.
* *
* Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example, * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details. * a USB endpoint). See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */ uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */ uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset * such as the speaker and microphone of a phone handset.
*/ */
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */ uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */ uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device. */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_InputTerminal_t; } USB_Audio_InputTerminal_t;
/** \brief Audio Class Specific Output Terminal Descriptor. /** \brief Audio class-specific Output Terminal Descriptor.
* *
* Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example, * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details. * a USB endpoint). See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */ uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */ uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset * such as the speaker and microphone of a phone handset.
*/ */
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */ uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from. */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_OutputTerminal_t; } USB_Audio_OutputTerminal_t;
/** \brief Audio Class Specific Streaming Audio Interface Descriptor. /** \brief Audio class-specific Streaming Audio Interface Descriptor.
* *
* Type define for an Audio class specific streaming interface descriptor. This indicates to the host * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host
* how audio streams within the device are formatted. See the USB Audio specification for more details. * how audio streams within the device are formatted. See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */ uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing. */
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */ uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */ uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification. */
} USB_Audio_Interface_AS_t; } USB_Audio_Interface_AS_t;
/** \brief 24-Bit Audio Frequency Structure. /** \brief 24-Bit Audio Frequency Structure.
* *
* Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype, * Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro. * this this structure is used to build up the value instead. Fill this structure with the \ref AUDIO_SAMPLE_FREQ() macro.
*/ */
typedef struct typedef struct
{ {
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */ uint16_t LowWord; /**< Low 16 bits of the 24-bit value. */
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */ uint8_t HighByte; /**< Upper 8 bits of the 24-bit value. */
} USB_Audio_SampleFreq_t; } USB_Audio_SampleFreq_t;
/** \brief Audio Class Specific Format Descriptor. /** \brief Audio class-specific Format Descriptor.
* *
* Type define for an Audio class specific audio format descriptor. This is used to give the host full details * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
* in the device's audio streams. See the USB Audio specification for more details. * in the device's audio streams. See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */ uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
uint8_t Channels; /**< Total number of discrete channels in the stream */ uint8_t Channels; /**< Total number of discrete channels in the stream. */
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */ uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */ uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream. */
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */ uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device */ USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device. */
} USB_Audio_Format_t; } USB_Audio_Format_t;
/** \brief Audio Class Specific Streaming Endpoint Descriptor. /** \brief Audio class-specific Streaming Endpoint Descriptor.
* *
* Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details. * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */ USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint. */
uint8_t Refresh; /**< Always set to zero */ uint8_t Refresh; /**< Always set to zero for Audio class devices. */
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */ uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */
} USB_Audio_StreamEndpoint_Std_t; } USB_Audio_StreamEndpoint_Std_t;
/** \brief Audio Class Specific Extended Endpoint Descriptor. /** \brief Audio class-specific Extended Endpoint Descriptor.
* *
* Type define for an Audio class specific extended endpoint descriptor. This contains extra information * Type define for an Audio class-specific extended endpoint descriptor. This contains extra information
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio * on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
* class specific extended endpoint descriptor. See the USB Audio specification for more details. * class-specific extended endpoint descriptor. See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */ uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */ uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */ uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */
} USB_Audio_StreamEndpoint_Spc_t; } USB_Audio_StreamEndpoint_Spc_t;
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

@ -66,22 +66,22 @@
#endif #endif
/* Macros: */ /* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */ /** CDC class-specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21 #define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */ /** CDC class-specific request to set the current virtual serial port configuration settings. */
#define REQ_SetLineEncoding 0x20 #define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */ /** CDC class-specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22 #define REQ_SetControlLineState 0x22
/** CDC Class specific request to send a break to the receiver via the carrier channel. */ /** CDC class-specific request to send a break to the receiver via the carrier channel. */
#define REQ_SendBreak 0x23 #define REQ_SendBreak 0x23
/** CDC Class specific request to send an encapsulated command to the device. */ /** CDC class-specific request to send an encapsulated command to the device. */
#define REQ_SendEncapsulatedCommand 0x00 #define REQ_SendEncapsulatedCommand 0x00
/** CDC Class specific request to retrieve an encapsulated command response from the device. */ /** CDC class-specific request to retrieve an encapsulated command response from the device. */
#define REQ_GetEncapsulatedResponse 0x01 #define REQ_GetEncapsulatedResponse 0x01
/** Notification type constant for a change in the virtual serial port handshake line states, for /** Notification type constant for a change in the virtual serial port handshake line states, for
@ -90,47 +90,47 @@
*/ */
#define NOTIF_SerialState 0x20 #define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class-specific request
* from the host, to indicate that the DTR line state should be high. * from the host, to indicate that the DTR line state should be high.
*/ */
#define CDC_CONTROL_LINE_OUT_DTR (1 << 0) #define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request /** Mask for the RTS handshake line for use with the REQ_SetControlLineState class-specific request
* from the host, to indicate that theRTS line state should be high. * from the host, to indicate that theRTS line state should be high.
*/ */
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1) #define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification /** Mask for the DCD handshake line for use with the a NOTIF_SerialState class-specific notification
* from the device to the host, to indicate that the DCD line state is currently high. * from the device to the host, to indicate that the DCD line state is currently high.
*/ */
#define CDC_CONTROL_LINE_IN_DCD (1 << 0) #define CDC_CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification /** Mask for the DSR handshake line for use with the a NOTIF_SerialState class-specific notification
* from the device to the host, to indicate that the DSR line state is currently high. * from the device to the host, to indicate that the DSR line state is currently high.
*/ */
#define CDC_CONTROL_LINE_IN_DSR (1 << 1) #define CDC_CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification /** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class-specific notification
* from the device to the host, to indicate that the BREAK line state is currently high. * from the device to the host, to indicate that the BREAK line state is currently high.
*/ */
#define CDC_CONTROL_LINE_IN_BREAK (1 << 2) #define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification /** Mask for the RING handshake line for use with the a NOTIF_SerialState class-specific notification
* from the device to the host, to indicate that the RING line state is currently high. * from the device to the host, to indicate that the RING line state is currently high.
*/ */
#define CDC_CONTROL_LINE_IN_RING (1 << 3) #define CDC_CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class-specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port. * to indicate that a framing error has occurred on the virtual serial port.
*/ */
#define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4) #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class-specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port. * to indicate that a parity error has occurred on the virtual serial port.
*/ */
#define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5) #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class-specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port. * to indicate that a data overrun error has occurred on the virtual serial port.
*/ */
#define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6) #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
@ -140,7 +140,7 @@
* a single typedef struct. A macro is used instead so that functional descriptors can be created * a single typedef struct. A macro is used instead so that functional descriptors can be created
* easily by specifying the size of the payload. This allows sizeof() to work correctly. * easily by specifying the size of the payload. This allows sizeof() to work correctly.
* *
* \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload * \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload.
*/ */
#define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \ #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
struct \ struct \
@ -152,21 +152,21 @@
/* Enums: */ /* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */ /** Enum for the possible line encoding formats of a virtual serial port. */
enum CDC_LineCodingFormats_t enum CDC_LineEncodingFormats_t
{ {
CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */ CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit. */
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */ CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits. */
CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */ CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits. */
}; };
/** Enum for the possible line encoding parity settings of a virtual serial port. */ /** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDC_LineCodingParity_t enum CDC_LineEncodingParity_t
{ {
CDC_PARITY_None = 0, /**< No parity bit mode on each frame */ CDC_PARITY_None = 0, /**< No parity bit mode on each frame. */
CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */ CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame. */
CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */ CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame. */
CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */ CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame. */
CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */ CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame. */
}; };
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

@ -61,22 +61,22 @@
#endif #endif
/* Macros: */ /* Macros: */
/** HID Class Specific Request to get the current HID report from the device. */ /** HID class-specific Request to get the current HID report from the device. */
#define REQ_GetReport 0x01 #define REQ_GetReport 0x01
/** HID Class Specific Request to get the current device idle count. */ /** HID class-specific Request to get the current device idle count. */
#define REQ_GetIdle 0x02 #define REQ_GetIdle 0x02
/** HID Class Specific Request to set the current HID report to the device. */ /** HID class-specific Request to set the current HID report to the device. */
#define REQ_SetReport 0x09 #define REQ_SetReport 0x09
/** HID Class Specific Request to set the device's idle count. */ /** HID class-specific Request to set the device's idle count. */
#define REQ_SetIdle 0x0A #define REQ_SetIdle 0x0A
/** HID Class Specific Request to get the current HID report protocol mode. */ /** HID class-specific Request to get the current HID report protocol mode. */
#define REQ_GetProtocol 0x03 #define REQ_GetProtocol 0x03
/** HID Class Specific Request to set the current HID report protocol mode. */ /** HID class-specific Request to set the current HID report protocol mode. */
#define REQ_SetProtocol 0x0B #define REQ_SetProtocol 0x0B
/** Descriptor header type value, to indicate a HID class HID descriptor. */ /** Descriptor header type value, to indicate a HID class HID descriptor. */
@ -145,22 +145,22 @@
REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */
}; };
/** \brief HID Class Specific HID Descriptor. /** \brief HID class-specific HID Descriptor.
* *
* Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID * Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID
* specification for details on the structure elements. * specification for details on the structure elements.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint16_t HIDSpec; uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */
uint8_t CountryCode; uint8_t CountryCode; /**< Country code of the localized device, or zero if universal. */
uint8_t TotalReportDescriptors; uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */
uint8_t HIDReportType; uint8_t HIDReportType; /**< Type of HID report, set to \ref DTYPE_Report. */
uint16_t HIDReportLength; uint16_t HIDReportLength; /**< Length of the associated HID report descriptor, in bytes. */
} USB_HID_Descriptor_t; } USB_HID_Descriptor_t;
/** \brief Standard HID Boot Protocol Mouse Report. /** \brief Standard HID Boot Protocol Mouse Report.
@ -169,9 +169,9 @@
*/ */
typedef struct typedef struct
{ {
uint8_t Button; /**< Button mask for currently pressed buttons in the mouse */ uint8_t Button; /**< Button mask for currently pressed buttons in the mouse. */
int8_t X; /**< Current delta X movement of the mouse */ int8_t X; /**< Current delta X movement of the mouse. */
int8_t Y; /**< Current delta Y movement on the mouse */ int8_t Y; /**< Current delta Y movement on the mouse. */
} USB_MouseReport_Data_t; } USB_MouseReport_Data_t;
/** \brief Standard HID Boot Protocol Keyboard Report. /** \brief Standard HID Boot Protocol Keyboard Report.
@ -181,10 +181,10 @@
typedef struct typedef struct
{ {
uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of
* HID_KEYBOARD_MODIFER_* masks) * HID_KEYBOARD_MODIFER_* masks).
*/ */
uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */ uint8_t Reserved; /**< Reserved for OEM use, always set to 0. */
uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys */ uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys. */
} USB_KeyboardReport_Data_t; } USB_KeyboardReport_Data_t;
/** Type define for the data type used to store HID report descriptor elements. */ /** Type define for the data type used to store HID report descriptor elements. */

@ -70,10 +70,10 @@
#endif #endif
/* Macros: */ /* Macros: */
/** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */ /** Audio class descriptor subtype value for a Audio class-specific MIDI input jack descriptor. */
#define DSUBTYPE_InputJack 0x02 #define DSUBTYPE_InputJack 0x02
/** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */ /** Audio class descriptor subtype value for a Audio class-specific MIDI output jack descriptor. */
#define DSUBTYPE_OutputJack 0x03 #define DSUBTYPE_OutputJack 0x03
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
@ -94,75 +94,77 @@
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel /** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address. * addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
* *
* \param[in] channel MIDI channel number to address * \param[in] channel MIDI channel number to address.
*/ */
#define MIDI_CHANNEL(channel) ((channel) - 1) #define MIDI_CHANNEL(channel) ((channel) - 1)
/* Type Defines: */ /* Type Defines: */
/** \brief MIDI Class Specific Streaming Interface Descriptor. /** \brief MIDI class-specific Streaming Interface Descriptor.
* *
* Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host * Type define for an Audio class-specific MIDI streaming interface descriptor. This indicates to the host
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors. * how MIDI the specification compliance of the device and the total length of the Audio class-specific descriptors.
* See the USB Audio specification for more details. * See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */ uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */ * specification version.
*/
uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
} USB_MIDI_AudioInterface_AS_t; } USB_MIDI_AudioInterface_AS_t;
/** \brief MIDI Class Specific Input Jack Descriptor. /** \brief MIDI class-specific Input Jack Descriptor.
* *
* Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint). * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */ uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */ uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_In_Jack_t; } USB_MIDI_In_Jack_t;
/** \brief MIDI Class Specific Output Jack Descriptor. /** \brief MIDI class-specific Output Jack Descriptor.
* *
* Type define for an Audio class specific MIDI OUT jack. This gives information to the host on a MIDI output, either * Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either
* a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint). * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint).
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */ uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */ uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */ uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical. */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */ uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack. */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */ uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data. */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_Out_Jack_t; } USB_MIDI_Out_Jack_t;
/** \brief Audio Class Specific Jack Endpoint Descriptor. /** \brief Audio class-specific Jack Endpoint Descriptor.
* *
* Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information * Type define for an Audio class-specific extended MIDI jack endpoint descriptor. This contains extra information
* on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio * on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
* class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details. * class-specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
*/ */
typedef struct typedef struct
{ {
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */ USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint */ uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint. */
uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint */ uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint. */
} USB_MIDI_Jack_Endpoint_t; } USB_MIDI_Jack_Endpoint_t;
/** \brief MIDI Class Driver Event Packet. /** \brief MIDI Class Driver Event Packet.
@ -171,12 +173,12 @@
*/ */
typedef struct typedef struct
{ {
unsigned char Command : 4; /**< Upper nibble of the MIDI command being sent or received in the event packet */ unsigned char Command : 4; /**< Upper nibble of the MIDI command being sent or received in the event packet. */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */ unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface. */
uint8_t Data1; /**< First byte of data in the MIDI event */ uint8_t Data1; /**< First byte of data in the MIDI event. */
uint8_t Data2; /**< Second byte of data in the MIDI event */ uint8_t Data2; /**< Second byte of data in the MIDI event. */
uint8_t Data3; /**< Third byte of data in the MIDI event */ uint8_t Data3; /**< Third byte of data in the MIDI event. */
} MIDI_EventPacket_t; } MIDI_EventPacket_t;
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

@ -66,10 +66,10 @@
#endif #endif
/* Macros: */ /* Macros: */
/** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */ /** Mass Storage class-specific request to reset the Mass Storage interface, ready for the next command. */
#define REQ_MassStorageReset 0xFF #define REQ_MassStorageReset 0xFF
/** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */ /** Mass Storage class-specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
#define REQ_GetMaxLUN 0xFE #define REQ_GetMaxLUN 0xFE
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */ /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
@ -211,13 +211,13 @@
* Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */ * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct typedef struct
{ {
uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */ uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block. */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */ uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */
uint32_t DataTransferLength; /**< Length of the optional data portion of the issued command, in bytes */ uint32_t DataTransferLength; /**< Length of the optional data portion of the issued command, in bytes. */
uint8_t Flags; /**< Command block flags, indicating command data direction */ uint8_t Flags; /**< Command block flags, indicating command data direction. */
uint8_t LUN; /**< Logical Unit number this command is issued to */ uint8_t LUN; /**< Logical Unit number this command is issued to. */
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */ uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array. */
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */ uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block. */
} MS_CommandBlockWrapper_t; } MS_CommandBlockWrapper_t;
/** \brief Mass Storage Class Command Status Wrapper. /** \brief Mass Storage Class Command Status Wrapper.
@ -226,10 +226,10 @@
*/ */
typedef struct typedef struct
{ {
uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status */ uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status. */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */ uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */ uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command. */
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */ uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum. */
} MS_CommandStatusWrapper_t; } MS_CommandStatusWrapper_t;
/** \brief Mass Storage Class SCSI Sense Structure /** \brief Mass Storage Class SCSI Sense Structure
@ -306,8 +306,10 @@
enum MassStorage_CommandStatusCodes_t enum MassStorage_CommandStatusCodes_t
{ {
SCSI_Command_Pass = 0, /**< Command completed with no error */ SCSI_Command_Pass = 0, /**< Command completed with no error */
SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */ SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a
SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */ * SCSI REQUEST SENSE command.
*/
SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase. */
}; };
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

@ -96,25 +96,25 @@
/** Enum for the possible NDIS adapter states. */ /** Enum for the possible NDIS adapter states. */
enum RNDIS_States_t enum RNDIS_States_t
{ {
RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */ RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized. */
RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */ RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers. */
RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */ RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers. */
}; };
/** Enum for the NDIS hardware states. */ /** Enum for the NDIS hardware states. */
enum NDIS_Hardware_Status_t enum NDIS_Hardware_Status_t
{ {
NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host */ NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host. */
NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing */ NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing. */
NDIS_HardwareStatus_Reset, /**< Hardware reset */ NDIS_HardwareStatus_Reset, /**< Hardware reset. */
NDIS_HardwareStatus_Closing, /**< Hardware currently closing */ NDIS_HardwareStatus_Closing, /**< Hardware currently closing. */
NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host */ NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host. */
}; };
/* Type Defines: */ /* Type Defines: */
/** \brief MAC Address Structure. /** \brief MAC Address Structure.
* *
* Type define for a physical MAC address of a device on a network * Type define for a physical MAC address of a device on a network.
*/ */
typedef struct typedef struct
{ {
@ -127,9 +127,9 @@
*/ */
typedef struct typedef struct
{ {
uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents */ uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents. */
uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer */ uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer. */
bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */ bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer. */
} Ethernet_Frame_Info_t; } Ethernet_Frame_Info_t;
/** \brief RNDIS Common Message Header Structure. /** \brief RNDIS Common Message Header Structure.

@ -66,58 +66,58 @@
#endif #endif
/* Macros: */ /* Macros: */
/** Length in bytes of a given Unicode string's character length /** Length in bytes of a given Unicode string's character length.
* *
* \param[in] chars Total number of Unicode characters in the string * \param[in] Chars Total number of Unicode characters in the string.
* *
* \return Number of bytes of the given unicode string * \return Number of bytes of the given unicode string.
*/ */
#define UNICODE_STRING_LENGTH(chars) ((chars) << 1) #define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1)
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container. * a command container.
* *
* \param[in] params Number of parameters which are to be sent in the Param field of the container * \param[in] Params Number of parameters which are to be sent in the Param field of the container.
*/ */
#define PIMA_COMMAND_SIZE(params) ((sizeof(SI_PIMA_Container_t) - 12) + \ #define PIMA_COMMAND_SIZE(Params) ((sizeof(SI_PIMA_Container_t) - 12) + \
((params) * sizeof(uint32_t))) ((Params) * sizeof(uint32_t)))
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a data container. * a data container.
* *
* \param[in] datalen Length in bytes of the data in the container * \param[in] DataLen Length in bytes of the data in the container.
*/ */
#define PIMA_DATA_SIZE(datalen) ((sizeof(SI_PIMA_Container_t) - 12) + \ #define PIMA_DATA_SIZE(DataLen) ((sizeof(SI_PIMA_Container_t) - 12) + \
(datalen)) (DataLen))
/* Enums: */ /* Enums: */
/** Enum for the possible PIMA contains types. */ /** Enum for the possible PIMA contains types. */
enum SI_PIMA_Container_Types_t enum SI_PIMA_Container_Types_t
{ {
CType_Undefined = 0, /**< Undefined container type */ CType_Undefined = 0, /**< Undefined container type. */
CType_CommandBlock = 1, /**< Command Block container type */ CType_CommandBlock = 1, /**< Command Block container type. */
CType_DataBlock = 2, /**< Data Block container type */ CType_DataBlock = 2, /**< Data Block container type. */
CType_ResponseBlock = 3, /**< Response container type */ CType_ResponseBlock = 3, /**< Response container type. */
CType_EventBlock = 4, /**< Event Block container type */ CType_EventBlock = 4, /**< Event Block container type. */
}; };
/* Enums: */ /* Enums: */
/** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */ /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */
enum SI_PIMA_ResponseCodes_t enum SI_PIMA_ResponseCodes_t
{ {
PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command */ PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */
PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the
* issued command * issued command.
*/ */
PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open
* session before being issued * session before being issued.
*/ */
PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred */ PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */
PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported
* by the attached device * by the attached device.
*/ */
PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's
* parameters are not supported by the device * parameters are not supported by the device.
*/ */
}; };
@ -129,11 +129,11 @@
*/ */
typedef struct typedef struct
{ {
uint32_t DataLength; /**< Length of the container and data, in bytes */ uint32_t DataLength; /**< Length of the container and data, in bytes. */
uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */ uint16_t Type; /**< Container type, a value from the \ref SI_PIMA_Container_Types_t enum. */
uint16_t Code; /**< Command, event or response code of the container */ uint16_t Code; /**< Command, event or response code of the container. */
uint32_t TransactionID; /**< Unique container ID to link blocks together */ uint32_t TransactionID; /**< Unique container ID to link blocks together. */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */ uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */
} SI_PIMA_Container_t; } SI_PIMA_Container_t;
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

@ -82,21 +82,21 @@
const struct const struct
{ {
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this
* structure controls * structure controls.
*/ */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming Audio Streaming data, if available uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming Audio Streaming data, if available
* (zero if unused) * (zero if unused).
*/ */
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming Audio Streaming data endpoint, if available uint16_t DataINEndpointSize; /**< Size in bytes of the incoming Audio Streaming data endpoint, if available
* (zero if unused) * (zero if unused).
*/ */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
* (zero if unused) * (zero if unused).
*/ */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
* (zero if unused) * (zero if unused).
*/ */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
@ -116,16 +116,16 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
* given Audio interface is selected. * given Audio interface is selected.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Processes incoming control requests from the host, that are directed to the given Audio class interface. This should be /** Processes incoming control requests from the host, that are directed to the given Audio class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
*/ */
void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -133,7 +133,7 @@
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should /** General management task for a given Audio class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
*/ */
static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -148,9 +148,9 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Boolean true if the given Audio interface has a sample to be read, false otherwise * \return Boolean true if the given Audio interface has a sample to be read, false otherwise.
*/ */
static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -169,9 +169,9 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Boolean true if the given Audio interface is ready to accept the next sample, false otherwise * \return Boolean true if the given Audio interface is ready to accept the next sample, false otherwise.
*/ */
static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -189,9 +189,9 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure
* ensure the correct endpoint is selected and ready for data. * ensure the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Signed 8-bit audio sample from the audio interface * \return Signed 8-bit audio sample from the audio interface.
*/ */
static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -214,9 +214,9 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure
* that the correct endpoint is selected and ready for data. * that the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Signed 16-bit audio sample from the audio interface * \return Signed 16-bit audio sample from the audio interface.
*/ */
static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -239,9 +239,9 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure
* that the correct endpoint is selected and ready for data. * that the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* *
* \return Signed 24-bit audio sample from the audio interface * \return Signed 24-bit audio sample from the audio interface.
*/ */
static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -264,8 +264,8 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to
* ensure that the correct endpoint is selected and ready for data. * ensure that the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* \param[in] Sample Signed 8-bit audio sample * \param[in] Sample Signed 8-bit audio sample.
*/ */
static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
const int8_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; const int8_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -283,8 +283,8 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to
* ensure that the correct endpoint is selected and ready for data. * ensure that the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* \param[in] Sample Signed 16-bit audio sample * \param[in] Sample Signed 16-bit audio sample.
*/ */
static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
const int16_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; const int16_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
@ -302,8 +302,8 @@
* \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to
* ensure that the correct endpoint is selected and ready for data. * ensure that the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
* \param[in] Sample Signed 24-bit audio sample * \param[in] Sample Signed 24-bit audio sample.
*/ */
static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
const int32_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; const int32_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;

@ -99,19 +99,19 @@
{ {
const struct const struct
{ {
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */ uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */ uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */ uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the CDC interface's IN data endpoint should use double banking */ bool DataINEndpointDoubleBank; /**< Indicates if the CDC interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */ uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the CDC interface's OUT data endpoint should use double banking */ bool DataOUTEndpointDoubleBank; /**< Indicates if the CDC interface's OUT data endpoint should use double banking. */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */ uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */ uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
bool NotificationEndpointDoubleBank; /**< Indicates if the CDC interface's notification endpoint should use double banking */ bool NotificationEndpointDoubleBank; /**< Indicates if the CDC interface's notification endpoint should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -130,14 +130,14 @@
struct struct
{ {
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */ uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum * \ref CDC_LineEncodingFormats_t enum.
*/ */
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum * \ref CDC_LineEncodingParity_t enum.
*/ */
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */ uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. This is generally } LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. This is generally
* only used if the virtual serial port data is to be reconstructed on a physical UART. * only used if the virtual serial port data is to be reconstructed on a physical UART.
*/ */
@ -151,23 +151,23 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing
* the given CDC interface is selected. * the given CDC interface is selected.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Processes incoming control requests from the host, that are directed to the given CDC class interface. This should be /** Processes incoming control requests from the host, that are directed to the given CDC class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given CDC class interface, required for the correct operation of the interface. This should /** General management task for a given CDC class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -176,7 +176,7 @@
* user program by declaring a handler function with the same name and parameters listed here. The new line encoding * user program by declaring a handler function with the same name and parameters listed here. The new line encoding
* settings are available in the LineEncoding structure inside the CDC interface structure passed as a parameter. * settings are available in the LineEncoding structure inside the CDC interface structure passed as a parameter.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -186,15 +186,15 @@
* are available in the ControlLineStates.HostToDevice value inside the CDC interface structure passed as a parameter, set as * are available in the ControlLineStates.HostToDevice value inside the CDC interface structure passed as a parameter, set as
* a mask of CDC_CONTROL_LINE_OUT_* masks. * a mask of CDC_CONTROL_LINE_OUT_* masks.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** CDC class driver event for a send break request sent to the device from the host. This is generally used to separate /** CDC class driver event for a send break request sent to the device from the host. This is generally used to separate
* data or to indicate a special condition to the receiving device. * data or to indicate a special condition to the receiving device.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in] Duration Duration of the break that has been sent by the host, in milliseconds * \param[in] Duration Duration of the break that has been sent by the host, in milliseconds.
*/ */
void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1); void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1);
@ -206,11 +206,11 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in] Data Pointer to the string to send to the host * \param[in] Data Pointer to the string to send to the host.
* \param[in] Length Size in bytes of the string to send to the host * \param[in] Length Size in bytes of the string to send to the host.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length) uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -223,10 +223,10 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in] Data Byte of data to send to the host * \param[in] Data Byte of data to send to the host.
* *
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
@ -235,9 +235,9 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* *
* \return Total number of buffered bytes received from the host * \return Total number of buffered bytes received from the host.
*/ */
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -248,9 +248,9 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* *
* \return Next received byte from the host, or 0 if no data received * \return Next received byte from the host, or 0 if no data received.
*/ */
uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -259,9 +259,9 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* *
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -273,7 +273,7 @@
* \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or * \pre This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
* the call will fail. * the call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -289,8 +289,8 @@
* \note The created stream can be given as stdout if desired to direct the standard output from all <stdio.h> functions * \note The created stream can be given as stdout if desired to direct the standard output from all <stdio.h> functions
* to the given CDC interface. * to the given CDC interface.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, FILE* Stream) void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, FILE* Stream)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -298,8 +298,8 @@
/** Identical to CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates /** Identical to CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates
* the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, FILE* Stream) void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, FILE* Stream)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);

@ -85,11 +85,11 @@
{ {
const struct const struct
{ {
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */ uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */ uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint. */
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */ uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking */ bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking. */
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be
* stored by the driver, for comparison purposes to detect report changes that * stored by the driver, for comparison purposes to detect report changes that
@ -114,10 +114,10 @@
*/ */
struct struct
{ {
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */ bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode. */
uint16_t IdleCount; /**< Report idle period, in milliseconds, set by the host */ uint16_t IdleCount; /**< Report idle period, in milliseconds, set by the host. */
uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this
* should be decremented by the user application if non-zero each millisecond */ * should be decremented by the user application if non-zero each millisecond. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated. * are reset to their defaults when the interface is enumerated.
*/ */
@ -128,23 +128,23 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given HID interface is selected. * containing the given HID interface is selected.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Processes incoming control requests from the host, that are directed to the given HID class interface. This should be /** Processes incoming control requests from the host, that are directed to the given HID class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
*/ */
void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given HID class interface, required for the correct operation of the interface. This should /** General management task for a given HID class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
*/ */
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -152,16 +152,16 @@
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the * HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
* user is responsible for the creation of the next HID input report to be sent to the host. * user is responsible for the creation of the next HID input report to be sent to the host.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
* \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero,
* this should be set to the report ID of the generated HID input report (if any). If multiple * this should be set to the report ID of the generated HID input report (if any). If multiple
* reports are not sent via the given HID interface, this parameter should be ignored. * reports are not sent via the given HID interface, this parameter should be ignored.
* \param[in] ReportType Type of HID report to generate, either \ref REPORT_ITEM_TYPE_In or \ref REPORT_ITEM_TYPE_Feature * \param[in] ReportType Type of HID report to generate, either \ref REPORT_ITEM_TYPE_In or \ref REPORT_ITEM_TYPE_Feature.
* \param[out] ReportData Pointer to a buffer where the generated HID report should be stored * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored.
* \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent * \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent.
* *
* \return Boolean true to force the sending of the report even if it is identical to the previous report and still within * \return Boolean true to force the sending of the report even if it is identical to the previous report and still within
* the idle period (useful for devices which report relative movement), false otherwise * the idle period (useful for devices which report relative movement), false otherwise.
*/ */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1) const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1)
@ -171,10 +171,10 @@
* either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback * either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
* the user is responsible for the processing of the received HID output report from the host. * the user is responsible for the processing of the received HID output report from the host.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
* \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID * \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID
* interface, this parameter should be ignored. * interface, this parameter should be ignored.
* \param[in] ReportType Type of received HID report, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature * \param[in] ReportType Type of received HID report, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature.
* \param[in] ReportData Pointer to a buffer where the received HID report is stored. * \param[in] ReportData Pointer to a buffer where the received HID report is stored.
* \param[in] ReportSize Size in bytes of the received report from the host. * \param[in] ReportSize Size in bytes of the received report from the host.
*/ */
@ -186,9 +186,9 @@
/** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be /** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be
* decremented. This should be called once per millisecond so that hardware key-repeats function correctly. It is recommended * decremented. This should be called once per millisecond so that hardware key-repeats function correctly. It is recommended
* that this be called by the \ref EVENT_USB_Device_StartOfFrame() event, once SOF events have been enabled via * that this be called by the \ref EVENT_USB_Device_StartOfFrame() event, once SOF events have been enabled via
* \ref USB_Device_EnableSOFEvents();. * \ref USB_Device_EnableSOFEvents().
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
*/ */
static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1); static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1);
static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)

@ -81,15 +81,15 @@
{ {
const struct const struct
{ {
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */ uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming MIDI data, if available (zero if unused) */ uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming MIDI data, if available (zero if unused). */
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming MIDI data endpoint, if available (zero if unused) */ uint16_t DataINEndpointSize; /**< Size in bytes of the incoming MIDI data endpoint, if available (zero if unused). */
bool DataINEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking */ bool DataINEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */ uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused). */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused). */
bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking */ bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -106,9 +106,9 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given MIDI interface is selected. * containing the given MIDI interface is selected.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -119,10 +119,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send * \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo,
MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -131,9 +131,9 @@
/** Flushes the MIDI send buffer, sending any queued MIDI events to the host. This should be called to override the /** Flushes the MIDI send buffer, sending any queued MIDI events to the host. This should be called to override the
* \ref MIDI_Device_SendEventPacket() function's packing behavior, to flush queued events. * \ref MIDI_Device_SendEventPacket() function's packing behavior, to flush queued events.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* *
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -143,10 +143,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed * \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed.
* *
* \return Boolean true if a MIDI event packet was received, false otherwise * \return Boolean true if a MIDI event packet was received, false otherwise.
*/ */
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo,
MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -155,7 +155,7 @@
/** General management task for a given MIDI class interface, required for the correct operation of the interface. This should /** General management task for a given MIDI class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
*/ */
static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
@ -166,7 +166,7 @@
/** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
*/ */
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)

@ -81,30 +81,30 @@
{ {
const struct const struct
{ {
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */ uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */ uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */ uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the Mass Storage interface's IN data endpoint should use double banking */ bool DataINEndpointDoubleBank; /**< Indicates if the Mass Storage interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */ uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the Mass Storage interface's OUT data endpoint should use double banking */ bool DataOUTEndpointDoubleBank; /**< Indicates if the Mass Storage interface's OUT data endpoint should use double banking. */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */ uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
struct struct
{ {
MS_CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI MS_CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI
* command from the host which is to be processed * command from the host which is to be processed.
*/ */
MS_CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate MS_CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate
* the issued command's success or failure to the host * the issued command's success or failure to the host.
*/ */
volatile bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset volatile bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset
* and that all current Mass Storage operations should immediately abort * and that all current Mass Storage operations should immediately abort.
*/ */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated. * are reset to their defaults when the interface is enumerated.
@ -116,23 +116,23 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given Mass Storage interface is selected. * containing the given Mass Storage interface is selected.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Processes incoming control requests from the host, that are directed to the given Mass Storage class interface. This should be /** Processes incoming control requests from the host, that are directed to the given Mass Storage class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
*/ */
void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state.
*/ */
void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -141,9 +141,9 @@
* for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure * for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure
* inside the Mass Storage class state structure passed as a parameter to the callback function. * inside the Mass Storage class state structure passed as a parameter to the callback function.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
* *
* \return Boolean true if the SCSI command was successfully processed, false otherwise * \return Boolean true if the SCSI command was successfully processed, false otherwise.
*/ */
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);

@ -81,38 +81,38 @@
{ {
const struct const struct
{ {
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */ uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */ uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint. */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */ uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint. */
bool DataINEndpointDoubleBank; /**< Indicates if the RNDIS interface's IN data endpoint should use double banking */ bool DataINEndpointDoubleBank; /**< Indicates if the RNDIS interface's IN data endpoint should use double banking. */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */ uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint. */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */ uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint. */
bool DataOUTEndpointDoubleBank; /**< Indicates if the RNDIS interface's OUT data endpoint should use double banking */ bool DataOUTEndpointDoubleBank; /**< Indicates if the RNDIS interface's OUT data endpoint should use double banking. */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */ uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */ uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking */ bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking. */
char* AdapterVendorDescription; /**< String description of the adapter vendor */ char* AdapterVendorDescription; /**< String description of the adapter vendor. */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */ MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section.
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
struct struct
{ {
uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host, uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host,
* managed by the class driver * managed by the class driver.
*/ */
bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host */ bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host. */
uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum */ uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum. */
uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver */ uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver. */
Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user
* processing * processing.
*/ */
Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the
* user application * user application.
*/ */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated. * are reset to their defaults when the interface is enumerated.
@ -124,23 +124,23 @@
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given HID interface is selected. * containing the given HID interface is selected.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
* *
* \return Boolean true if the endpoints were successfully configured, false otherwise * \return Boolean true if the endpoints were successfully configured, false otherwise.
*/ */
bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Processes incoming control requests from the host, that are directed to the given RNDIS class interface. This should be /** Processes incoming control requests from the host, that are directed to the given RNDIS class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
*/ */
void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given HID class interface, required for the correct operation of the interface. This should /** General management task for a given HID class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
*/ */
void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);

@ -82,14 +82,14 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the CDC interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the CDC interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */ uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking */ bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -97,13 +97,13 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref CDC_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref CDC_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device */ uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe. */
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used */ uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used. */
struct struct
{ {
@ -118,14 +118,14 @@
struct struct
{ {
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */ uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum * \ref CDC_LineEncodingFormats_t enum.
*/ */
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum * \ref CDC_LineEncodingParity_t enum.
*/ */
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */ uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information. This is generally } LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information. This is generally
* only used if the virtual serial port data is to be reconstructed on a physical UART. When set * only used if the virtual serial port data is to be reconstructed on a physical UART. When set
* by the host application, the \ref CDC_Host_SetLineEncoding() function must be called to push * by the host application, the \ref CDC_Host_SetLineEncoding() function must be called to push
@ -141,17 +141,17 @@
/** Enum for the possible error codes returned by the \ref CDC_Host_ConfigurePipes() function. */ /** Enum for the possible error codes returned by the \ref CDC_Host_ConfigurePipes() function. */
enum CDCHost_EnumerationFailure_ErrorCodes_t enum CDCHost_EnumerationFailure_ErrorCodes_t
{ {
CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
CDC_ENUMERROR_NoCDCInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor */ CDC_ENUMERROR_NoCDCInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor. */
CDC_ENUMERROR_EndpointsNotFound = 3, /**< Compatible CDC endpoints were not found in the device's CDC interface */ CDC_ENUMERROR_EndpointsNotFound = 3, /**< Compatible CDC endpoints were not found in the device's CDC interface. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */
/** General management task for a given CDC host class interface, required for the correct operation of the interface. This should /** General management task for a given CDC host class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state.
*/ */
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -161,11 +161,11 @@
* This should be called once after the stack has enumerated the attached device, while the host state machine is in * This should be called once after the stack has enumerated the attached device, while the host state machine is in
* the Addressed state. * the Addressed state.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref CDCHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref CDCHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -173,9 +173,9 @@
/** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding /** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding
* values of the interface have been changed to push the new settings to the USB device. * values of the interface have been changed to push the new settings to the USB device.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -184,19 +184,19 @@
* notification. This should be called each time the CDC class driver's ControlLineStates.HostToDevice value is updated * notification. This should be called each time the CDC class driver's ControlLineStates.HostToDevice value is updated
* to push the new states to the USB device. * to push the new states to the USB device.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a Send Break request to the device. This is generally used to separate data data or to indicate a special condition /** Sends a Send Break request to the device. This is generally used to separate data data or to indicate a special condition
* to the receiving device. * to the receiving device.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* \param[in] Duration Duration of the break, in milliseconds * \param[in] Duration Duration of the break, in milliseconds.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1);
@ -208,11 +208,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* \param[in] Data Pointer to the string to send to the device * \param[in] Data Pointer to the string to send to the device.
* \param[in] Length Size in bytes of the string to send to the device * \param[in] Length Size in bytes of the string to send to the device.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, char* Data, const uint16_t Length) uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, char* Data, const uint16_t Length)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -225,10 +225,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* \param[in] Data Byte of data to send to the device * \param[in] Data Byte of data to send to the device.
* *
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
@ -237,9 +237,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* *
* \return Total number of buffered bytes received from the device * \return Total number of buffered bytes received from the device.
*/ */
uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -250,9 +250,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* *
* \return Next received byte from the device, or 0 if no data received * \return Next received byte from the device, or 0 if no data received.
*/ */
uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -261,9 +261,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
* *
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -274,16 +274,16 @@
* \note The created stream can be given as stdout if desired to direct the standard output from all <stdio.h> functions * \note The created stream can be given as stdout if desired to direct the standard output from all <stdio.h> functions
* to the given CDC interface. * to the given CDC interface.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream); void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream);
/** Identical to CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates /** Identical to CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates
* the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed.
*/ */
void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream); void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream);
@ -293,7 +293,7 @@
* are available in the ControlLineStates.DeviceToHost value inside the CDC host interface structure passed as a parameter, set as * are available in the ControlLineStates.DeviceToHost value inside the CDC host interface structure passed as a parameter, set as
* a mask of CDC_CONTROL_LINE_IN_* masks. * a mask of CDC_CONTROL_LINE_IN_* masks.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
*/ */
void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);

@ -85,20 +85,20 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the HID interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the HID interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking. */
uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific
* boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL, * boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL,
* \ref HID_BOOT_KEYBOARD_PROTOCOL or \ref HID_NON_BOOT_PROTOCOL if any * \ref HID_BOOT_KEYBOARD_PROTOCOL or \ref HID_NON_BOOT_PROTOCOL if any
* HID device should be enumerated by the interface * HID device should be enumerated by the interface.
*/ */
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
HID_ReportInfo_t* HIDParserData; /**< HID parser data to store the parsed HID report data, when boot protocol HID_ReportInfo_t* HIDParserData; /**< HID parser data to store the parsed HID report data, when boot protocol
* is not used * is not used.
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined,
* this method is unavailable. * this method is unavailable.
@ -111,23 +111,23 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device */ uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe. */
bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot
* Protocol when enabled via \ref HID_Host_SetBootProtocol() * Protocol when enabled via \ref HID_Host_SetBootProtocol().
*/ */
bool DeviceUsesOUTPipe; /**< Indicates if the current interface instance uses a separate OUT data pipe for bool DeviceUsesOUTPipe; /**< Indicates if the current interface instance uses a separate OUT data pipe for
* OUT reports, or if OUT reports are sent via the control pipe instead. * OUT reports, or if OUT reports are sent via the control pipe instead.
*/ */
bool UsingBootProtocol; /**< Indicates that the interface is currently initialized in Boot Protocol mode */ bool UsingBootProtocol; /**< Indicates that the interface is currently initialized in Boot Protocol mode */
uint16_t HIDReportSize; /**< Size in bytes of the HID report descriptor in the device */ uint16_t HIDReportSize; /**< Size in bytes of the HID report descriptor in the device. */
uint8_t LargestReportSize; /**< Largest report the device will send, in bytes */ uint8_t LargestReportSize; /**< Largest report the device will send, in bytes. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -138,11 +138,11 @@
/** Enum for the possible error codes returned by the \ref HID_Host_ConfigurePipes() function. */ /** Enum for the possible error codes returned by the \ref HID_Host_ConfigurePipes() function. */
enum HIDHost_EnumerationFailure_ErrorCodes_t enum HIDHost_EnumerationFailure_ErrorCodes_t
{ {
HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
HID_ENUMERROR_NoHIDInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor */ HID_ENUMERROR_NoHIDInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor. */
HID_ENUMERROR_NoHIDDescriptorFound = 3, /**< The HID descriptor was not found in the device's HID interface */ HID_ENUMERROR_NoHIDDescriptorFound = 3, /**< The HID descriptor was not found in the device's HID interface. */
HID_ENUMERROR_EndpointsNotFound = 4, /**< Compatible HID endpoints were not found in the device's HID interface */ HID_ENUMERROR_EndpointsNotFound = 4, /**< Compatible HID endpoints were not found in the device's HID interface. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */
@ -155,11 +155,11 @@
* \note Once the device pipes are configured, the HID device's reporting protocol <b>must</b> be set via a call * \note Once the device pipes are configured, the HID device's reporting protocol <b>must</b> be set via a call
* to either the \ref HID_Host_SetBootProtocol() or \ref HID_Host_SetReportProtocol() function. * to either the \ref HID_Host_SetBootProtocol() or \ref HID_Host_SetReportProtocol() function.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -167,16 +167,16 @@
/** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe. /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.
* *
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \note The destination buffer should be large enough to accommodate the largest report that the attached device * \note The destination buffer should be large enough to accommodate the largest report that the attached device
* can generate. * can generate.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* \param[in] Buffer Buffer to store the received report into * \param[in] Buffer Buffer to store the received report into.
* *
* \return An error code from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return An error code from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, void* Buffer) uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, void* Buffer)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -189,11 +189,11 @@
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* \param[in] ReportID Report ID of the received report if ControlRequest is false, set by the to the Report ID to fetch * \param[in] ReportID Report ID of the received report if ControlRequest is false, set by the to the Report ID to fetch.
* \param[in] Buffer Buffer to store the received report into * \param[in] Buffer Buffer to store the received report into.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, const uint8_t ReportID, uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, const uint8_t ReportID,
void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -208,14 +208,14 @@
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed
* from the parameter list of this function. * from the parameter list of this function.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs * \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs.
* \param[in] ReportType Type of report to issue to the device, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature * \param[in] ReportType Type of report to issue to the device, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature.
* \param[in] Buffer Buffer containing the report to send to the attached device * \param[in] Buffer Buffer containing the report to send to the attached device.
* \param[in] ReportSize Report size in bytes to send to the attached device * \param[in] ReportSize Report size in bytes to send to the attached device.
* *
* \return An error code from the \ref USB_Host_SendControlErrorCodes_t enum if the DeviceUsesOUTPipe flag is set in * \return An error code from the \ref USB_Host_SendControlErrorCodes_t enum if the DeviceUsesOUTPipe flag is set in
* the interface's state structure, a value from the \ref Pipe_Stream_RW_ErrorCodes_t enum otherwise * the interface's state structure, a value from the \ref Pipe_Stream_RW_ErrorCodes_t enum otherwise.
*/ */
uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
@ -233,9 +233,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* *
* \return Boolean true if a report has been received, false otherwise * \return Boolean true if a report has been received, false otherwise.
*/ */
bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -244,10 +244,10 @@
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method must still be called * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method must still be called
* to explicitly place the attached device into boot protocol mode before use. * to explicitly place the attached device into boot protocol mode before use.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* *
* \return \ref HID_ERROR_LOGICAL if the device does not support Boot Protocol mode, a value from the * \return \ref HID_ERROR_LOGICAL if the device does not support Boot Protocol mode, a value from the
* \ref USB_Host_SendControlErrorCodes_t enum otherwise * \ref USB_Host_SendControlErrorCodes_t enum otherwise.
*/ */
uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -261,12 +261,12 @@
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum if an error occurs while retrieving the HID * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum if an error occurs while retrieving the HID
* Report descriptor or the setting of the Report protocol, \ref HID_ERROR_LOGICAL if the HID interface does * Report descriptor or the setting of the Report protocol, \ref HID_ERROR_LOGICAL if the HID interface does
* not have a valid \ref HID_ReportInfo_t structure set in its configuration, a mask of \ref HID_ERROR_LOGICAL * not have a valid \ref HID_ReportInfo_t structure set in its configuration, a mask of \ref HID_ERROR_LOGICAL
* and a value from the \ref HID_Parse_ErrorCodes_t otherwise * and a value from the \ref HID_Parse_ErrorCodes_t otherwise.
*/ */
uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
#endif #endif
@ -276,7 +276,7 @@
* the interface. This should be called frequently in the main program loop, before the master USB management task * the interface. This should be called frequently in the main program loop, before the master USB management task
* \ref USB_USBTask(). * \ref USB_USBTask().
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
*/ */
static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo); static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo);
static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)

@ -133,12 +133,12 @@
* left-aligned to the given data type. This allows for signed data to be interpreted correctly, by shifting the data * left-aligned to the given data type. This allows for signed data to be interpreted correctly, by shifting the data
* leftwards until the data's sign bit is in the correct position. * leftwards until the data's sign bit is in the correct position.
* *
* \param[in] reportitem HID Report Item whose retrieved value is to be aligned * \param[in] ReportItem HID Report Item whose retrieved value is to be aligned.
* \param[in] type Data type to align the HID report item's value to * \param[in] Type Data type to align the HID report item's value to.
* *
* \return Left-aligned data of the given report item's pre-retrieved value for the given datatype * \return Left-aligned data of the given report item's pre-retrieved value for the given datatype.
*/ */
#define HID_ALIGN_DATA(reportitem, type) ((type)(reportitem->Value << ((8 * sizeof(type)) - reportitem->Attributes.BitSize))) #define HID_ALIGN_DATA(ReportItem, Type) ((Type)(ReportItem->Value << ((8 * sizeof(Type)) - ReportItem->Attributes.BitSize)))
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Enums: */ /* Enums: */
@ -239,9 +239,9 @@
*/ */
typedef struct typedef struct
{ {
uint8_t ReportID; /**< Report ID of the report within the HID interface */ uint8_t ReportID; /**< Report ID of the report within the HID interface. */
uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID, uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID,
* indexed by the \ref HID_ReportItemTypes_t enum * indexed by the \ref HID_ReportItemTypes_t enum.
*/ */
} HID_ReportSizeInfo_t; } HID_ReportSizeInfo_t;
@ -272,11 +272,11 @@
/** Function to process a given HID report returned from an attached device, and store it into a given /** Function to process a given HID report returned from an attached device, and store it into a given
* \ref HID_ReportInfo_t structure. * \ref HID_ReportInfo_t structure.
* *
* \param[in] ReportData Buffer containing the device's HID report table * \param[in] ReportData Buffer containing the device's HID report table.
* \param[in] ReportSize Size in bytes of the HID report table * \param[in] ReportSize Size in bytes of the HID report table.
* \param[out] ParserData Pointer to a \ref HID_ReportInfo_t instance for the parser output * \param[out] ParserData Pointer to a \ref HID_ReportInfo_t instance for the parser output.
* *
* \return A value in the \ref HID_Parse_ErrorCodes_t enum * \return A value in the \ref HID_Parse_ErrorCodes_t enum.
*/ */
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_ReportInfo_t* const ParserData) uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_ReportInfo_t* const ParserData)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -287,10 +287,10 @@
* When called, this copies the report item's Value element to it's PreviousValue element for easy * When called, this copies the report item's Value element to it's PreviousValue element for easy
* checking to see if an item's value has changed before processing a report. * checking to see if an item's value has changed before processing a report.
* *
* \param[in] ReportData Buffer containing an IN or FEATURE report from an attached device * \param[in] ReportData Buffer containing an IN or FEATURE report from an attached device.
* \param[in,out] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array * \param[in,out] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array.
* *
* \returns Boolean true if the item to retrieve was located in the given report, false otherwise * \returns Boolean true if the item to retrieve was located in the given report, false otherwise.
*/ */
bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem) bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -305,20 +305,20 @@
* *
* If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item. * If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item.
* *
* \param[out] ReportData Buffer holding the current OUT or FEATURE report data * \param[out] ReportData Buffer holding the current OUT or FEATURE report data.
* \param[in] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array * \param[in] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array.
*/ */
void USB_SetHIDReportItemInfo(uint8_t* ReportData, HID_ReportItem_t* const ReportItem) void USB_SetHIDReportItemInfo(uint8_t* ReportData, HID_ReportItem_t* const ReportItem)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/** Retrieves the size of a given HID report in bytes from it's Report ID. /** Retrieves the size of a given HID report in bytes from it's Report ID.
* *
* \param[in] ParserData Pointer to a \ref HID_ReportInfo_t instance containing the parser output * \param[in] ParserData Pointer to a \ref HID_ReportInfo_t instance containing the parser output.
* \param[in] ReportID Report ID of the report whose size is to be retrieved * \param[in] ReportID Report ID of the report whose size is to be retrieved.
* \param[in] ReportType Type of the report whose size is to be determined, a valued from the * \param[in] ReportType Type of the report whose size is to be determined, a valued from the
* \ref HID_ReportItemTypes_t enum * \ref HID_ReportItemTypes_t enum.
* *
* \return Size of the report in bytes, or 0 if the report does not exist * \return Size of the report in bytes, or 0 if the report does not exist.
*/ */
uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, const uint8_t ReportID, uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, const uint8_t ReportID,
const uint8_t ReportType) ATTR_CONST ATTR_NON_NULL_PTR_ARG(1); const uint8_t ReportType) ATTR_CONST ATTR_NON_NULL_PTR_ARG(1);
@ -328,9 +328,9 @@
* HID_ReportInfo_t structure. This can be used to filter only those items the application will be using, so that * HID_ReportInfo_t structure. This can be used to filter only those items the application will be using, so that
* no RAM is wasted storing the attributes for report items which will never be referenced by the application. * no RAM is wasted storing the attributes for report items which will never be referenced by the application.
* *
* \param[in] CurrentItem Pointer to the current report item for user checking * \param[in] CurrentItem Pointer to the current report item for user checking.
* *
* \return Boolean true if the item should be stored into the HID_ReportInfo_t structure, false if it should be ignored * \return Boolean true if the item should be stored into the HID_ReportInfo_t structure, false if it should be ignored.
*/ */
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* CurrentItem); bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* CurrentItem);

@ -79,11 +79,11 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -91,11 +91,11 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref MIDI_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref MIDI_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint16_t DataINPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the MIDI Streaming Data interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -106,10 +106,10 @@
/** Enum for the possible error codes returned by the \ref MIDI_Host_ConfigurePipes() function. */ /** Enum for the possible error codes returned by the \ref MIDI_Host_ConfigurePipes() function. */
enum MIDIHost_EnumerationFailure_ErrorCodes_t enum MIDIHost_EnumerationFailure_ErrorCodes_t
{ {
MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MIDI_ENUMERROR_NoStreamingInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor */ MIDI_ENUMERROR_NoStreamingInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor. */
MIDI_ENUMERROR_EndpointsNotFound = 3, /**< Compatible MIDI data endpoints were not found in the device's MIDI interface */ MIDI_ENUMERROR_EndpointsNotFound = 3, /**< Compatible MIDI data endpoints were not found in the device's MIDI interface. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */
@ -119,11 +119,11 @@
* This should be called once after the stack has enumerated the attached device, while the host state machine is in * This should be called once after the stack has enumerated the attached device, while the host state machine is in
* the Addressed state. * the Addressed state.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref MIDIHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref MIDIHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -133,10 +133,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send * \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -146,9 +146,9 @@
* pipe bank until either the pipe bank is full, or \ref MIDI_Host_Flush() is called. This allows for multiple MIDI * pipe bank until either the pipe bank is full, or \ref MIDI_Host_Flush() is called. This allows for multiple MIDI
* events to be packed into a single pipe packet, increasing data throughput. * events to be packed into a single pipe packet, increasing data throughput.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* *
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
*/ */
uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -157,10 +157,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
* \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed * \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed.
* *
* \return Boolean true if a MIDI event packet was received, false otherwise * \return Boolean true if a MIDI event packet was received, false otherwise.
*/ */
bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -169,7 +169,7 @@
/** General management task for a given MIDI host class interface, required for the correct operation of the interface. This should /** General management task for a given MIDI host class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state.
*/ */
static inline void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) static inline void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo)

@ -83,11 +83,11 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Mass Storage interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the Mass Storage interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Mass Storage interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the Mass Storage interface's OUT data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -95,14 +95,14 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref MS_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref MS_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device */ uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe. */
uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets */ uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -117,17 +117,17 @@
*/ */
typedef struct typedef struct
{ {
uint32_t Blocks; /**< Number of blocks in the addressed LUN of the device */ uint32_t Blocks; /**< Number of blocks in the addressed LUN of the device. */
uint32_t BlockSize; /**< Number of bytes in each block in the addressed LUN */ uint32_t BlockSize; /**< Number of bytes in each block in the addressed LUN. */
} SCSI_Capacity_t; } SCSI_Capacity_t;
/* Enums: */ /* Enums: */
enum MSHost_EnumerationFailure_ErrorCodes_t enum MSHost_EnumerationFailure_ErrorCodes_t
{ {
MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MS_ENUMERROR_NoMSInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor */ MS_ENUMERROR_NoMSInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */
MS_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Mass Storage endpoints were not found in the device's interfaces */ MS_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Mass Storage endpoints were not found in the device's interfaces. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */
@ -137,11 +137,11 @@
* is found within the device. This should be called once after the stack has enumerated the attached device, while * is found within the device. This should be called once after the stack has enumerated the attached device, while
* the host state machine is in the Addressed state. * the host state machine is in the Addressed state.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -149,9 +149,9 @@
/** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface /** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface
* and readying it for the next Mass Storage command. * and readying it for the next Mass Storage command.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -163,10 +163,10 @@
* on unsupported devices the max LUN index will be reported as zero and no error will be returned * on unsupported devices the max LUN index will be reported as zero and no error will be returned
* if the device STALLs the request. * if the device STALLs the request.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[out] MaxLUNIndex Pointer to a location where the highest LUN index value should be stored * \param[out] MaxLUNIndex Pointer to a location where the highest LUN index value should be stored.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint8_t* const MaxLUNIndex) uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint8_t* const MaxLUNIndex)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -177,11 +177,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[out] InquiryData Location where the read inquiry data should be stored * \param[out] InquiryData Location where the read inquiry data should be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED.
*/ */
uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
SCSI_Inquiry_Response_t* const InquiryData) ATTR_NON_NULL_PTR_ARG(1) SCSI_Inquiry_Response_t* const InquiryData) ATTR_NON_NULL_PTR_ARG(1)
@ -189,10 +189,10 @@
/** Sends a TEST UNIT READY command to the device, to determine if it is ready to accept other SCSI commands. /** Sends a TEST UNIT READY command to the device, to determine if it is ready to accept other SCSI commands.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex) uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex)
ATTR_NON_NULL_PTR_ARG(1); ATTR_NON_NULL_PTR_ARG(1);
@ -202,11 +202,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored * \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1) SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1)
@ -218,11 +218,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[out] SenseData Pointer to the location where the sense information should be stored * \param[out] SenseData Pointer to the location where the sense information should be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1) SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1)
@ -234,11 +234,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[in] PreventRemoval Boolean true if the device should be locked from removal, false otherwise * \param[in] PreventRemoval Boolean true if the device should be locked from removal, false otherwise.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1); const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);
@ -248,14 +248,14 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[in] BlockAddress Starting block address within the device to read from * \param[in] BlockAddress Starting block address within the device to read from.
* \param[in] Blocks Total number of blocks to read * \param[in] Blocks Total number of blocks to read.
* \param[in] BlockSize Size in bytes of each block within the device * \param[in] BlockSize Size in bytes of each block within the device.
* \param[out] BlockBuffer Pointer to where the read data from the device should be stored * \param[out] BlockBuffer Pointer to where the read data from the device should be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize, const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize,
@ -266,14 +266,14 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state.
* \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] LUNIndex LUN index within the device the command is being issued to.
* \param[in] BlockAddress Starting block address within the device to write to * \param[in] BlockAddress Starting block address within the device to write to.
* \param[in] Blocks Total number of blocks to read * \param[in] Blocks Total number of blocks to read.
* \param[in] BlockSize Size in bytes of each block within the device * \param[in] BlockSize Size in bytes of each block within the device.
* \param[in] BlockBuffer Pointer to where the data to write should be sourced from * \param[in] BlockBuffer Pointer to where the data to write should be sourced from.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready.
*/ */
uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,
const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize, const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize,
@ -284,7 +284,7 @@
* the interface. This should be called frequently in the main program loop, before the master USB management task * the interface. This should be called frequently in the main program loop, before the master USB management task
* \ref USB_USBTask(). * \ref USB_USBTask().
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state * \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state.
*/ */
static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo); static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo);
static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)

@ -79,11 +79,11 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Printer interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the Printer interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Printer interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the Printer interface's OUT data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -91,13 +91,13 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref PRNT_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref PRNT_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint8_t InterfaceNumber; /**< Interface index of the Printer interface within the attached device */ uint8_t InterfaceNumber; /**< Interface index of the Printer interface within the attached device. */
uint8_t AlternateSetting; /**< Alternate setting within the Printer Interface in the attached device */ uint8_t AlternateSetting; /**< Alternate setting within the Printer Interface in the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the Printer interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the Printer interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Printer interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the Printer interface's OUT data pipe. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -107,10 +107,10 @@
/* Enums: */ /* Enums: */
enum PRNTHost_EnumerationFailure_ErrorCodes_t enum PRNTHost_EnumerationFailure_ErrorCodes_t
{ {
PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
PRNT_ENUMERROR_NoPrinterInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor */ PRNT_ENUMERROR_NoPrinterInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor. */
PRNT_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Printer endpoints were not found in the device's interfaces */ PRNT_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Printer endpoints were not found in the device's interfaces. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */
@ -120,11 +120,11 @@
* the device. This should be called once after the stack has enumerated the attached device, while the host state * the device. This should be called once after the stack has enumerated the attached device, while the host state
* machine is in the Addressed state. * machine is in the Addressed state.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref PRNTHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref PRNTHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -132,28 +132,28 @@
/** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called /** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called
* once the connected device's configuration has been set, to ensure the printer is ready to accept commands. * once the connected device's configuration has been set, to ensure the printer is ready to accept commands.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Retrieves the status of the virtual Printer port's inbound status lines. The result can then be masked against the /** Retrieves the status of the virtual Printer port's inbound status lines. The result can then be masked against the
* PRNT_PORTSTATUS_* macros to determine the printer port's status. * PRNT_PORTSTATUS_* macros to determine the printer port's status.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* \param[out] PortStatus Location where the retrieved port status should be stored * \param[out] PortStatus Location where the retrieved port status should be stored.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint8_t* const PortStatus) uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint8_t* const PortStatus)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/** Soft-resets the attached printer, readying it for new commands. /** Soft-resets the attached printer, readying it for new commands.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -164,11 +164,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* \param[in] PrinterCommands Pointer to a buffer containing the raw command stream to send to the printer * \param[in] PrinterCommands Pointer to a buffer containing the raw command stream to send to the printer.
* \param[in] CommandSize Size in bytes of the command stream to be sent * \param[in] CommandSize Size in bytes of the command stream to be sent.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, void* PrinterCommands, uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, void* PrinterCommands,
uint16_t CommandSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); uint16_t CommandSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -180,11 +180,11 @@
* *
* This string, when supported, contains the model, manufacturer and acceptable printer languages for the attached device. * This string, when supported, contains the model, manufacturer and acceptable printer languages for the attached device.
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
* \param[out] DeviceIDString Pointer to a buffer where the Device ID string should be stored, in ASCII format * \param[out] DeviceIDString Pointer to a buffer where the Device ID string should be stored, in ASCII format.
* \param[in] BufferSize Size in bytes of the buffer allocated for the Device ID string * \param[in] BufferSize Size in bytes of the buffer allocated for the Device ID string.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, char* DeviceIDString, uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, char* DeviceIDString,
uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -194,7 +194,7 @@
* the interface. This should be called frequently in the main program loop, before the master USB management task * the interface. This should be called frequently in the main program loop, before the master USB management task
* \ref USB_USBTask(). * \ref USB_USBTask().
* *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state.
*/ */
static inline void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) static inline void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)

@ -83,16 +83,16 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the RNDIS interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the RNDIS interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the RNDIS interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the RNDIS interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking. */
uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used */ uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking */ bool NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking. */
uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host */ uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -100,17 +100,17 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref RNDIS_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref RNDIS_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device */ uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */
uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe. */
uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */ uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device */ uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */
uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair */ uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -121,10 +121,10 @@
/** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */ /** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */
enum RNDISHost_EnumerationFailure_ErrorCodes_t enum RNDISHost_EnumerationFailure_ErrorCodes_t
{ {
RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
RNDIS_ENUMERROR_NoRNDISInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor */ RNDIS_ENUMERROR_NoRNDISInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor. */
RNDIS_ENUMERROR_EndpointsNotFound = 3, /**< Compatible RNDIS endpoints were not found in the device's RNDIS interface */ RNDIS_ENUMERROR_EndpointsNotFound = 3, /**< Compatible RNDIS endpoints were not found in the device's RNDIS interface. */
}; };
/* Macros: */ /* Macros: */
@ -138,11 +138,11 @@
* This should be called once after the stack has enumerated the attached device, while the host state machine is in * This should be called once after the stack has enumerated the attached device, while the host state machine is in
* the Addressed state. * the Addressed state.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref RNDISHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref RNDISHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -150,45 +150,45 @@
/** Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods /** Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods
* of long inactivity. * of long inactivity.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* *
* \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
* logical command failure * logical command failure.
*/ */
uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Initializes the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been /** Initializes the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been
* configured via the call to \ref RNDIS_Host_ConfigurePipes(). * configured via the call to \ref RNDIS_Host_ConfigurePipes().
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* *
* \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
* logical command failure * logical command failure.
*/ */
uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Sets a given RNDIS property of an attached RNDIS device. /** Sets a given RNDIS property of an attached RNDIS device.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* \param[in] Oid OID number of the parameter to set * \param[in] Oid OID number of the parameter to set.
* \param[in] Buffer Pointer to where the property data is to be sourced from * \param[in] Buffer Pointer to where the property data is to be sourced from.
* \param[in] Length Length in bytes of the property data to sent to the device * \param[in] Length Length in bytes of the property data to sent to the device.
* *
* \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
* logical command failure * logical command failure.
*/ */
uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint32_t Oid, void* Buffer, uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint32_t Oid, void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
/** Gets a given RNDIS property of an attached RNDIS device. /** Gets a given RNDIS property of an attached RNDIS device.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* \param[in] Oid OID number of the parameter to get * \param[in] Oid OID number of the parameter to get.
* \param[in] Buffer Pointer to where the property data is to be written to * \param[in] Buffer Pointer to where the property data is to be written to.
* \param[in] MaxLength Length in bytes of the destination buffer size * \param[in] MaxLength Length in bytes of the destination buffer size.
* *
* \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
* logical command failure * logical command failure.
*/ */
uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint32_t Oid, void* Buffer, uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint32_t Oid, void* Buffer,
uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -198,9 +198,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* *
* \return Boolean true if a packet is waiting to be read in by the host, false otherwise * \return Boolean true if a packet is waiting to be read in by the host, false otherwise.
*/ */
bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -210,11 +210,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* \param[out] Buffer Pointer to a buffer where the packer data is to be written to * \param[out] Buffer Pointer to a buffer where the packer data is to be written to.
* \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored * \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored.
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t* PacketLength) uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t* PacketLength)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3);
@ -224,11 +224,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
* \param[in] Buffer Pointer to a buffer where the packer data is to be read from * \param[in] Buffer Pointer to a buffer where the packer data is to be read from.
* \param[in] PacketLength Length in bytes of the packet to send * \param[in] PacketLength Length in bytes of the packet to send.
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t PacketLength) uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t PacketLength)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -237,7 +237,7 @@
/** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state.
*/ */
static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo)

@ -83,14 +83,14 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the Still Image interface's IN data pipe should use double banking */ bool DataINPipeDoubleBank; /**< Indicates if the Still Image interface's IN data pipe should use double banking. */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking */ bool DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking. */
uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used */ uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
bool EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking */ bool EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -98,15 +98,15 @@
{ {
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
* after \ref SImage_Host_ConfigurePipes() is called and the Host state machine is in the * after \ref SImage_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state * Configured state.
*/ */
uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe. */
uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe */ uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe. */
bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device */ bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */
uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device */ uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when * <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated. * the interface is enumerated.
@ -117,13 +117,13 @@
/** Enum for the possible error codes returned by the \ref SImage_Host_ConfigurePipes() function. */ /** Enum for the possible error codes returned by the \ref SImage_Host_ConfigurePipes() function. */
enum SIHost_EnumerationFailure_ErrorCodes_t enum SIHost_EnumerationFailure_ErrorCodes_t
{ {
SI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ SI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
SI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor */ SI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
SI_ENUMERROR_NoSIInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's SI_ENUMERROR_NoSIInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's
* Configuration Descriptor * Configuration Descriptor.
*/ */
SI_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Still Image data endpoints were not found in the SI_ENUMERROR_EndpointsNotFound = 3, /**< Compatible Still Image data endpoints were not found in the
* device's Still Image interface * device's Still Image interface.
*/ */
}; };
@ -134,11 +134,11 @@
* found within the device. This should be called once after the stack has enumerated the attached device, while * found within the device. This should be called once after the stack has enumerated the attached device, while
* the host state machine is in the Addressed state. * the host state machine is in the Addressed state.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
* *
* \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum.
*/ */
uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
@ -149,10 +149,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure * returned a logical command failure.
*/ */
uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -162,10 +162,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure * returned a logical command failure.
*/ */
uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -175,10 +175,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[in] PIMAHeader Pointer to a PIMA container structure that is to be sent * \param[in] PIMAHeader Pointer to a PIMA container structure that is to be sent.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
@ -190,10 +190,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[out] PIMAHeader Pointer to a PIMA container structure where the received block is to be stored * \param[out] PIMAHeader Pointer to a PIMA container structure where the received block is to be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
@ -204,13 +204,13 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[in] Operation PIMA operation code to issue to the device * \param[in] Operation PIMA operation code to issue to the device.
* \param[in] TotalParams Total number of 32-bit parameters to send to the device in the issued command block * \param[in] TotalParams Total number of 32-bit parameters to send to the device in the issued command block.
* \param[in] Params Pointer to an array of 32-bit values containing the parameters to send in the command block * \param[in] Params Pointer to an array of 32-bit values containing the parameters to send in the command block.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure * returned a logical command failure.
*/ */
uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, const uint16_t Operation, uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, const uint16_t Operation,
const uint8_t TotalParams, uint32_t* Params) ATTR_NON_NULL_PTR_ARG(1); const uint8_t TotalParams, uint32_t* Params) ATTR_NON_NULL_PTR_ARG(1);
@ -221,10 +221,10 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure * returned a logical command failure.
*/ */
uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -233,9 +233,9 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* *
* \return Boolean true if an event is waiting to be read, false otherwise * \return Boolean true if an event is waiting to be read, false otherwise.
*/ */
bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
@ -244,11 +244,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored * \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure * returned a logical command failure.
*/ */
uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
@ -260,11 +260,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[in] Buffer Pointer to a buffer where the data to send has been stored * \param[in] Buffer Pointer to a buffer where the data to send has been stored.
* \param[in] Bytes Length in bytes of the data in the buffer to send to the attached device * \param[in] Bytes Length in bytes of the data in the buffer to send to the attached device.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer, uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer,
const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -275,11 +275,11 @@
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
* \param[out] Buffer Pointer to a buffer where the received data is to be stored * \param[out] Buffer Pointer to a buffer where the received data is to be stored.
* \param[in] Bytes Length in bytes of the data to read * \param[in] Bytes Length in bytes of the data to read.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer, uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer,
const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
@ -289,7 +289,7 @@
* interface. This should be called frequently in the main program loop, before the master USB management task * interface. This should be called frequently in the main program loop, before the master USB management task
* \ref USB_USBTask(). * \ref USB_USBTask().
* *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
*/ */
static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)

@ -116,7 +116,7 @@
/** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array
* of type void, returning a uint8_t value). * of type void, returning a uint8_t value).
* *
* \see \ref USB_GetNextDescriptorComp function for more details * \see \ref USB_GetNextDescriptorComp function for more details.
*/ */
typedef uint8_t (* ConfigComparatorPtr_t)(void*); typedef uint8_t (* ConfigComparatorPtr_t)(void*);
@ -124,19 +124,19 @@
/** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */ /** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */
enum USB_Host_GetConfigDescriptor_ErrorCodes_t enum USB_Host_GetConfigDescriptor_ErrorCodes_t
{ {
HOST_GETCONFIG_Successful = 0, /**< No error occurred while retrieving the configuration descriptor */ HOST_GETCONFIG_Successful = 0, /**< No error occurred while retrieving the configuration descriptor. */
HOST_GETCONFIG_DeviceDisconnect = 1, /**< The attached device was disconnected while retrieving the configuration HOST_GETCONFIG_DeviceDisconnect = 1, /**< The attached device was disconnected while retrieving the configuration
* descriptor * descriptor.
*/ */
HOST_GETCONFIG_PipeError = 2, /**< An error occurred in the pipe while sending the request */ HOST_GETCONFIG_PipeError = 2, /**< An error occurred in the pipe while sending the request. */
HOST_GETCONFIG_SetupStalled = 3, /**< The attached device stalled the request to retrieve the configuration HOST_GETCONFIG_SetupStalled = 3, /**< The attached device stalled the request to retrieve the configuration
* descriptor * descriptor.
*/ */
HOST_GETCONFIG_SoftwareTimeOut = 4, /**< The request or data transfer timed out */ HOST_GETCONFIG_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
HOST_GETCONFIG_BuffOverflow = 5, /**< The device's configuration descriptor is too large to fit into the allocated HOST_GETCONFIG_BuffOverflow = 5, /**< The device's configuration descriptor is too large to fit into the allocated
* buffer * buffer.
*/ */
HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data */ HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data. */
}; };
/** Enum for return values of a descriptor comparator function. */ /** Enum for return values of a descriptor comparator function. */
@ -161,12 +161,12 @@
* including validity and size checking to prevent a buffer overflow. * including validity and size checking to prevent a buffer overflow.
* *
* \param[in] ConfigNumber Device configuration descriptor number to fetch from the device (usually set to 1 for * \param[in] ConfigNumber Device configuration descriptor number to fetch from the device (usually set to 1 for
* single configuration devices) * single configuration devices).
* \param[in,out] ConfigSizePtr Pointer to a uint16_t for storing the retrieved configuration descriptor size * \param[in,out] ConfigSizePtr Pointer to a uint16_t for storing the retrieved configuration descriptor size.
* \param[out] BufferPtr Pointer to the buffer for storing the configuration descriptor data. * \param[out] BufferPtr Pointer to the buffer for storing the configuration descriptor data.
* \param[out] BufferSize Size of the allocated buffer where the configuration descriptor is to be stored * \param[out] BufferSize Size of the allocated buffer where the configuration descriptor is to be stored.
* *
* \return A value from the \ref USB_Host_GetConfigDescriptor_ErrorCodes_t enum * \return A value from the \ref USB_Host_GetConfigDescriptor_ErrorCodes_t enum.
*/ */
uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const ConfigSizePtr, void* BufferPtr, uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const ConfigSizePtr, void* BufferPtr,
uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3);
@ -174,9 +174,9 @@
/** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value. /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value.
* The bytes remaining value is automatically decremented. * The bytes remaining value is automatically decremented.
* *
* \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
* \param[in] Type Descriptor type value to search for * \param[in] Type Descriptor type value to search for.
*/ */
void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
void** const CurrConfigLoc, void** const CurrConfigLoc,
@ -188,10 +188,10 @@
* descriptor is reached first, the number of bytes remaining to process is set to zero and the * descriptor is reached first, the number of bytes remaining to process is set to zero and the
* function exits. The bytes remaining value is automatically decremented. * function exits. The bytes remaining value is automatically decremented.
* *
* \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
* \param[in] Type Descriptor type value to search for * \param[in] Type Descriptor type value to search for.
* \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor * \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor.
*/ */
void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
void** const CurrConfigLoc, void** const CurrConfigLoc,
@ -203,10 +203,10 @@
* which must come after a descriptor of the second given type value. The bytes remaining value is * which must come after a descriptor of the second given type value. The bytes remaining value is
* automatically decremented. * automatically decremented.
* *
* \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
* \param[in] Type Descriptor type value to search for * \param[in] Type Descriptor type value to search for.
* \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor * \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor.
*/ */
void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
void** const CurrConfigLoc, void** const CurrConfigLoc,
@ -227,11 +227,11 @@
* *
* \note This function is available in USB Host mode only. * \note This function is available in USB Host mode only.
* *
* \param[in,out] BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor * \param[in,out] BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor.
* \param[in,out] CurrConfigLoc Pointer to the current position in the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current position in the configuration descriptor.
* \param[in] ComparatorRoutine Name of the comparator search function to use on the configuration descriptor * \param[in] ComparatorRoutine Name of the comparator search function to use on the configuration descriptor.
* *
* \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum.
* *
* Usage Example: * Usage Example:
* \code * \code
@ -260,8 +260,8 @@
/** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then
points to the next sub-descriptor. The bytes remaining value is automatically decremented. points to the next sub-descriptor. The bytes remaining value is automatically decremented.
* *
* \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
*/ */
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, void** CurrConfigLoc) static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, void** CurrConfigLoc)
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);

@ -92,7 +92,7 @@
* *
* \note This event only exists on USB AVR models which support dual role modes. * \note This event only exists on USB AVR models which support dual role modes.
* *
* \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t.
*/ */
void EVENT_USB_InitFailure(const uint8_t ErrorCode); void EVENT_USB_InitFailure(const uint8_t ErrorCode);
@ -112,7 +112,7 @@
/** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB
* interface is in host mode. * interface is in host mode.
* *
* \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* \n\n * \n\n
@ -155,7 +155,7 @@
* in host mode, and an attached USB device has failed to enumerate completely. * in host mode, and an attached USB device has failed to enumerate completely.
* *
* \param[in] ErrorCode Error code indicating the failure reason, a value in * \param[in] ErrorCode Error code indicating the failure reason, a value in
* \ref USB_Host_EnumerationErrorCodes_t * \ref USB_Host_EnumerationErrorCodes_t.
* *
* \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the * \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the
* ErrorCode parameter indicates a control error, this will give the error * ErrorCode parameter indicates a control error, this will give the error

@ -219,7 +219,7 @@
* Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
* uses LUFA-specific element names to make each element's purpose clearer. * uses LUFA-specific element names to make each element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_Header_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Header_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -234,7 +234,7 @@
* Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
* uses the relevant standard's given element names to ensure compatibility with the standard. * uses the relevant standard's given element names to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_Header_t for the version of this define with non-standard LUFA specific element names * \see \ref USB_Descriptor_Header_t for the version of this define with non-standard LUFA specific element names.
*/ */
typedef struct typedef struct
{ {
@ -249,7 +249,7 @@
* Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each * Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each
* element's purpose clearer. * element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_Device_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Device_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -298,7 +298,7 @@
* Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names * Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names
* to ensure compatibility with the standard. * to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names * \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names.
*/ */
typedef struct typedef struct
{ {
@ -346,7 +346,7 @@
* Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names * Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names
* to make each element's purpose clearer. * to make each element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -375,7 +375,7 @@
* Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names * Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names
* to ensure compatibility with the standard. * to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names * \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names.
*/ */
typedef struct typedef struct
{ {
@ -403,7 +403,7 @@
* Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names * Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names
* to make each element's purpose clearer. * to make each element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_Interface_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Interface_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -431,7 +431,7 @@
* Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names * Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names
* to ensure compatibility with the standard. * to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_Interface_t for the version of this define with non-standard LUFA specific element names * \see \ref USB_Descriptor_Interface_t for the version of this define with non-standard LUFA specific element names.
*/ */
typedef struct typedef struct
{ {
@ -465,7 +465,7 @@
* together at the point of enumeration, loading one generic driver for all the interfaces in the single * together at the point of enumeration, loading one generic driver for all the interfaces in the single
* function. Read the ECN for more information. * function. Read the ECN for more information.
* *
* \see \ref USB_StdDescriptor_Interface_Association_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Interface_Association_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -495,7 +495,7 @@
* function. Read the ECN for more information. * function. Read the ECN for more information.
* *
* \see \ref USB_Descriptor_Interface_Association_t for the version of this define with non-standard LUFA specific * \see \ref USB_Descriptor_Interface_Association_t for the version of this define with non-standard LUFA specific
* element names * element names.
*/ */
typedef struct typedef struct
{ {
@ -518,7 +518,7 @@
* Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names * Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names
* to make each element's purpose clearer. * to make each element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_Endpoint_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_Endpoint_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -547,7 +547,7 @@
* element names to ensure compatibility with the standard. * element names to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_Endpoint_t for the version of this define with non-standard LUFA specific * \see \ref USB_Descriptor_Endpoint_t for the version of this define with non-standard LUFA specific
* element names * element names.
*/ */
typedef struct typedef struct
{ {
@ -582,7 +582,7 @@
* *
* This structure uses LUFA-specific element names to make each element's purpose clearer. * This structure uses LUFA-specific element names to make each element's purpose clearer.
* *
* \see \ref USB_StdDescriptor_String_t for the version of this define with standard element names * \see \ref USB_StdDescriptor_String_t for the version of this define with standard element names.
*/ */
typedef struct typedef struct
{ {
@ -613,7 +613,7 @@
* This structure uses the relevant standard's given element names to ensure compatibility with the standard. * This structure uses the relevant standard's given element names to ensure compatibility with the standard.
* *
* \see \ref USB_Descriptor_String_t for the version of this define with with non-standard LUFA specific * \see \ref USB_Descriptor_String_t for the version of this define with with non-standard LUFA specific
* element names * element names.
*/ */
typedef struct typedef struct
{ {

@ -107,7 +107,7 @@
* *
* \note This global is only present if the user application can be a USB host. * \note This global is only present if the user application can be a USB host.
* *
* \see \ref USB_Host_States_t for a list of possible device states * \see \ref USB_Host_States_t for a list of possible device states.
* *
* \ingroup Group_Host * \ingroup Group_Host
*/ */
@ -140,7 +140,7 @@
* \note This variable should be treated as read-only in the user application, and never manually * \note This variable should be treated as read-only in the user application, and never manually
* changed in value except in the circumstances outlined above. * changed in value except in the circumstances outlined above.
* *
* \see \ref USB_Device_States_t for a list of possible device states * \see \ref USB_Device_States_t for a list of possible device states.
* *
* \ingroup Group_Device * \ingroup Group_Device
*/ */

@ -80,9 +80,9 @@
*/ */
enum USB_DescriptorMemorySpaces_t enum USB_DescriptorMemorySpaces_t
{ {
MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory */ MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */
MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory */ MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */
MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory */ MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */
}; };
#endif #endif

@ -205,7 +205,7 @@
* USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D * USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D
* switch. * switch.
* *
* \return Size in bytes of the descriptor if it exists, zero or \ref NO_DESCRIPTOR otherwise * \return Size in bytes of the descriptor if it exists, zero or \ref NO_DESCRIPTOR otherwise.
*/ */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS) #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)

@ -186,7 +186,7 @@
* *
* \ingroup Group_EndpointRW * \ingroup Group_EndpointRW
* *
* \return Total number of bytes in the currently selected Endpoint's FIFO buffer * \return Total number of bytes in the currently selected Endpoint's FIFO buffer.
*/ */
static inline uint16_t Endpoint_BytesInEndpoint(void); static inline uint16_t Endpoint_BytesInEndpoint(void);
@ -194,7 +194,7 @@
* the currently selected endpoint number so that it can be restored after another endpoint has * the currently selected endpoint number so that it can be restored after another endpoint has
* been manipulated. * been manipulated.
* *
* \return Index of the currently selected endpoint * \return Index of the currently selected endpoint.
*/ */
static inline uint8_t Endpoint_GetCurrentEndpoint(void); static inline uint8_t Endpoint_GetCurrentEndpoint(void);
@ -205,14 +205,14 @@
* Any endpoint operations which do not require the endpoint number to be indicated will operate on * Any endpoint operations which do not require the endpoint number to be indicated will operate on
* the currently selected endpoint. * the currently selected endpoint.
* *
* \param[in] EndpointNumber Endpoint number to select * \param[in] EndpointNumber Endpoint number to select.
*/ */
static inline void Endpoint_SelectEndpoint(uint8_t EndpointNumber); static inline void Endpoint_SelectEndpoint(uint8_t EndpointNumber);
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
* In and Out pointers to the bank's contents. * In and Out pointers to the bank's contents.
* *
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset * \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
*/ */
static inline void Endpoint_ResetFIFO(uint8_t EndpointNumber); static inline void Endpoint_ResetFIFO(uint8_t EndpointNumber);
@ -230,7 +230,7 @@
/** Determines if the currently selected endpoint is enabled, but not necessarily configured. /** Determines if the currently selected endpoint is enabled, but not necessarily configured.
* *
* \return Boolean True if the currently selected endpoint is enabled, false otherwise * \return Boolean True if the currently selected endpoint is enabled, false otherwise.
*/ */
static inline bool Endpoint_IsEnabled(void); static inline bool Endpoint_IsEnabled(void);
@ -242,13 +242,13 @@
* *
* \ingroup Group_EndpointPacketManagement * \ingroup Group_EndpointPacketManagement
* *
* \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction * \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction.
*/ */
static inline bool Endpoint_IsReadWriteAllowed(void); static inline bool Endpoint_IsReadWriteAllowed(void);
/** Determines if the currently selected endpoint is configured. /** Determines if the currently selected endpoint is configured.
* *
* \return Boolean true if the currently selected endpoint has been configured, false otherwise * \return Boolean true if the currently selected endpoint has been configured, false otherwise.
*/ */
static inline bool Endpoint_IsConfigured(void); static inline bool Endpoint_IsConfigured(void);
@ -256,16 +256,16 @@
* interrupt duration has elapsed. Which endpoints have interrupted can be determined by * interrupt duration has elapsed. Which endpoints have interrupted can be determined by
* masking the return value against (1 << {Endpoint Number}). * masking the return value against (1 << {Endpoint Number}).
* *
* \return Mask whose bits indicate which endpoints have interrupted * \return Mask whose bits indicate which endpoints have interrupted.
*/ */
static inline uint8_t Endpoint_GetEndpointInterrupts(void); static inline uint8_t Endpoint_GetEndpointInterrupts(void);
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type /** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
* endpoints). * endpoints).
* *
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested * \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested.
* *
* \return Boolean true if the specified endpoint has interrupted, false otherwise * \return Boolean true if the specified endpoint has interrupted, false otherwise.
*/ */
static inline bool Endpoint_HasEndpointInterrupted(uint8_t EndpointNumber); static inline bool Endpoint_HasEndpointInterrupted(uint8_t EndpointNumber);
@ -339,7 +339,7 @@
* *
* \ingroup Group_EndpointPacketManagement * \ingroup Group_EndpointPacketManagement
* *
* \return Boolean true if the currently selected endpoint is stalled, false otherwise * \return Boolean true if the currently selected endpoint is stalled, false otherwise.
*/ */
static inline bool Endpoint_IsStalled(void); static inline bool Endpoint_IsStalled(void);
@ -501,7 +501,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \return Next byte in the currently selected endpoint's FIFO buffer * \return Next byte in the currently selected endpoint's FIFO buffer.
*/ */
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_Read_Byte(void) static inline uint8_t Endpoint_Read_Byte(void)
@ -513,7 +513,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer * \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/ */
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte) static inline void Endpoint_Write_Byte(const uint8_t Byte)
@ -538,7 +538,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \return Next word in the currently selected endpoint's FIFO buffer * \return Next word in the currently selected endpoint's FIFO buffer.
*/ */
static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_LE(void) static inline uint16_t Endpoint_Read_Word_LE(void)
@ -560,7 +560,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \return Next word in the currently selected endpoint's FIFO buffer * \return Next word in the currently selected endpoint's FIFO buffer.
*/ */
static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_BE(void) static inline uint16_t Endpoint_Read_Word_BE(void)
@ -582,7 +582,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer * \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer.
*/ */
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_LE(const uint16_t Word) static inline void Endpoint_Write_Word_LE(const uint16_t Word)
@ -596,7 +596,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer * \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer.
*/ */
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_BE(const uint16_t Word) static inline void Endpoint_Write_Word_BE(const uint16_t Word)
@ -623,7 +623,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \return Next double word in the currently selected endpoint's FIFO buffer * \return Next double word in the currently selected endpoint's FIFO buffer.
*/ */
static inline uint32_t Endpoint_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint32_t Endpoint_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_Read_DWord_LE(void) static inline uint32_t Endpoint_Read_DWord_LE(void)
@ -647,7 +647,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \return Next double word in the currently selected endpoint's FIFO buffer * \return Next double word in the currently selected endpoint's FIFO buffer.
*/ */
static inline uint32_t Endpoint_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint32_t Endpoint_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_Read_DWord_BE(void) static inline uint32_t Endpoint_Read_DWord_BE(void)
@ -671,7 +671,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer * \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer.
*/ */
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)
@ -687,7 +687,7 @@
* *
* \ingroup Group_EndpointPrimitiveRW * \ingroup Group_EndpointPrimitiveRW
* *
* \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer * \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer.
*/ */
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)
@ -763,7 +763,7 @@
* \note This routine will select the specified endpoint, and the endpoint will remain selected * \note This routine will select the specified endpoint, and the endpoint will remain selected
* once the routine completes regardless of if the endpoint configuration succeeds. * once the routine completes regardless of if the endpoint configuration succeeds.
* *
* \return Boolean true if the configuration succeeded, false otherwise * \return Boolean true if the configuration succeeded, false otherwise.
*/ */
bool Endpoint_ConfigureEndpoint(const uint8_t Number, const uint8_t Type, const uint8_t Direction, bool Endpoint_ConfigureEndpoint(const uint8_t Number, const uint8_t Type, const uint8_t Direction,
const uint16_t Size, const uint8_t Banks); const uint16_t Size, const uint8_t Banks);
@ -801,7 +801,7 @@
* \ingroup Group_EndpointStreamRW * \ingroup Group_EndpointStreamRW
* *
* \param[in] Length Number of bytes to send via the currently selected endpoint. * \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -824,7 +824,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -836,7 +836,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -850,7 +850,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -873,7 +873,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -885,7 +885,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -899,7 +899,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -922,7 +922,7 @@
* *
* \param[out] Buffer Pointer to the destination data buffer to write to. * \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint. * \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -934,7 +934,7 @@
* *
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint. * \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -957,7 +957,7 @@
* *
* \param[out] Buffer Pointer to the destination data buffer to write to. * \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint. * \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -969,7 +969,7 @@
* *
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint. * \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */

@ -134,21 +134,21 @@
* false otherwise. While suspended, no USB communications can occur until the bus is resumed, * false otherwise. While suspended, no USB communications can occur until the bus is resumed,
* except for the Remote Wakeup event from the device if supported. * except for the Remote Wakeup event from the device if supported.
* *
* \return Boolean true if the bus is currently suspended, false otherwise * \return Boolean true if the bus is currently suspended, false otherwise.
*/ */
static inline bool USB_Host_IsBusSuspended(void); static inline bool USB_Host_IsBusSuspended(void);
/** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or /** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or
* false if the attached device is enumerated in Low Speed mode (1.5Mb/s). * false if the attached device is enumerated in Low Speed mode (1.5Mb/s).
* *
* \return Boolean true if the attached device is enumerated in Full Speed mode, false otherwise * \return Boolean true if the attached device is enumerated in Full Speed mode, false otherwise.
*/ */
static inline bool USB_Host_IsDeviceFullSpeed(void); static inline bool USB_Host_IsDeviceFullSpeed(void);
/** Determines if the attached device is currently issuing a Remote Wakeup request, requesting /** Determines if the attached device is currently issuing a Remote Wakeup request, requesting
* that the host resume the USB bus and wake up the device, false otherwise. * that the host resume the USB bus and wake up the device, false otherwise.
* *
* \return Boolean true if the attached device has sent a Remote Wakeup request, false otherwise * \return Boolean true if the attached device has sent a Remote Wakeup request, false otherwise.
*/ */
static inline bool USB_Host_IsRemoteWakeupSent(void); static inline bool USB_Host_IsRemoteWakeupSent(void);
@ -164,7 +164,7 @@
/** Determines if a resume from Remote Wakeup request is currently being sent to an attached /** Determines if a resume from Remote Wakeup request is currently being sent to an attached
* device. * device.
* *
* \return Boolean true if no resume request is currently being sent, false otherwise * \return Boolean true if no resume request is currently being sent, false otherwise.
*/ */
static inline bool USB_Host_IsResumeFromWakeupRequestSent(void); static inline bool USB_Host_IsResumeFromWakeupRequestSent(void);
#else #else
@ -196,7 +196,7 @@
* *
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
* \param[in] ConfigNumber Configuration index to send to the device * \param[in] ConfigNumber Configuration index to send to the device.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/ */
@ -209,7 +209,7 @@
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
* \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where * \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where
* the read data is to be stored * the read data is to be stored.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/ */
@ -222,10 +222,10 @@
* *
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
* \param[in] Index Index of the string index to retrieve * \param[in] Index Index of the string index to retrieve.
* \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is
* to be stored * to be stored.
* \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/ */
@ -235,7 +235,7 @@
* *
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
* \param[in] EndpointIndex Index of the endpoint to clear * \param[in] EndpointIndex Index of the endpoint to clear.
* *
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/ */

@ -66,13 +66,13 @@
/* Macros: */ /* Macros: */
/** Mask for the VBUS pulsing method of SRP, supported by some OTG devices. /** Mask for the VBUS pulsing method of SRP, supported by some OTG devices.
* *
* \see USB_OTG_DEV_Initiate_SRP() * \see \ref USB_OTG_Device_InitiateSRP().
*/ */
#define USB_OTG_SRP_VBUS (1 << SRPSEL) #define USB_OTG_SRP_VBUS (1 << SRPSEL)
/** Mask for the Data + pulsing method of SRP, supported by some OTG devices. /** Mask for the Data + pulsing method of SRP, supported by some OTG devices.
* *
* \see USB_OTG_DEV_Initiate_SRP() * \see \ref USB_OTG_Device_InitiateSRP().
*/ */
#define USB_OTG_STP_DATA 0 #define USB_OTG_STP_DATA 0
@ -94,6 +94,18 @@
*/ */
static inline bool USB_OTG_Device_IsSendingHNP(void); static inline bool USB_OTG_Device_IsSendingHNP(void);
/** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB
* interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in
* host mode indicates that VBUS should be applied and a session started.
*
* There are two different methods of sending a SRP - either pulses on the VBUS line, or by
* pulsing the Data + line via the internal pull-up resistor.
*
* \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or
* \ref USB_OTG_STP_DATA.
*/
static inline void USB_OTG_Device_InitiateSRP(uint8_t SRPTypeMask);
/** Accepts a HNP from a connected device, indicating that both devices should exchange /** Accepts a HNP from a connected device, indicating that both devices should exchange
* device/host roles. * device/host roles.
*/ */
@ -109,17 +121,6 @@
* \return Boolean true if a HNP is currently being issued by the connected device, false otherwise. * \return Boolean true if a HNP is currently being issued by the connected device, false otherwise.
*/ */
static inline bool USB_OTG_Host_IsHNPReceived(void); static inline bool USB_OTG_Host_IsHNPReceived(void);
/** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB
* interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in
* host mode indicates that VBUS should be applied and a session started.
*
* There are two different methods of sending a SRP - either pulses on the VBUS line, or by
* pulsing the Data + line via the internal pull-up resistor.
*
* \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or \ref USB_OTG_STP_DATA.
*/
static inline void USB_OTG_Dev_InitiateSRP(uint8_t SRPTypeMask);
#else #else
#define USB_OTG_Device_RequestHNP() MACROS{ OTGCON |= (1 << HNPREQ); }MACROE #define USB_OTG_Device_RequestHNP() MACROS{ OTGCON |= (1 << HNPREQ); }MACROE
@ -127,13 +128,13 @@
#define USB_OTG_Device_IsSendingHNP() ((OTGCON & (1 << HNPREQ)) ? true : false) #define USB_OTG_Device_IsSendingHNP() ((OTGCON & (1 << HNPREQ)) ? true : false)
#define USB_OTG_Device_InitiateSRP(type) MACROS{ OTGCON = ((OTGCON & ~(1 << SRPSEL)) | ((type) | (1 << SRPREQ))); }MACROE
#define USB_OTG_Host_AcceptHNP() MACROS{ OTGCON |= (1 << HNPREQ); }MACROE #define USB_OTG_Host_AcceptHNP() MACROS{ OTGCON |= (1 << HNPREQ); }MACROE
#define USB_OTG_Host_RejectHNP() MACROS{ OTGCON &= ~(1 << HNPREQ); }MACROE #define USB_OTG_Host_RejectHNP() MACROS{ OTGCON &= ~(1 << HNPREQ); }MACROE
#define USB_OTG_Host_IsHNPReceived() ((OTGCON & (1 << HNPREQ)) ? true : false) #define USB_OTG_Host_IsHNPReceived() ((OTGCON & (1 << HNPREQ)) ? true : false)
#define USB_OTG_Device_InitiateSRP(type) MACROS{ OTGCON = ((OTGCON & ~(1 << SRPSEL)) | ((type) | (1 << SRPREQ))); }MACROE
#endif #endif
#endif #endif

@ -204,27 +204,27 @@
* *
* \ingroup Group_PipeRW * \ingroup Group_PipeRW
* *
* \return Total number of bytes in the currently selected Pipe's FIFO buffer * \return Total number of bytes in the currently selected Pipe's FIFO buffer.
*/ */
static inline uint16_t Pipe_BytesInPipe(void); static inline uint16_t Pipe_BytesInPipe(void);
/** Returns the pipe address of the currently selected pipe. This is typically used to save the /** Returns the pipe address of the currently selected pipe. This is typically used to save the
* currently selected pipe number so that it can be restored after another pipe has been manipulated. * currently selected pipe number so that it can be restored after another pipe has been manipulated.
* *
* \return Index of the currently selected pipe * \return Index of the currently selected pipe.
*/ */
static inline uint8_t Pipe_GetCurrentPipe(void); static inline uint8_t Pipe_GetCurrentPipe(void);
/** Selects the given pipe number. Any pipe operations which do not require the pipe number to be /** Selects the given pipe number. Any pipe operations which do not require the pipe number to be
* indicated will operate on the currently selected pipe. * indicated will operate on the currently selected pipe.
* *
* \param[in] PipeNumber Index of the pipe to select * \param[in] PipeNumber Index of the pipe to select.
*/ */
static inline void Pipe_SelectPipe(uint8_t PipeNumber); static inline void Pipe_SelectPipe(uint8_t PipeNumber);
/** Resets the desired pipe, including the pipe banks and flags. /** Resets the desired pipe, including the pipe banks and flags.
* *
* \param[in] PipeNumber Index of the pipe to reset * \param[in] PipeNumber Index of the pipe to reset.
*/ */
static inline void Pipe_ResetPipe(uint8_t PipeNumber); static inline void Pipe_ResetPipe(uint8_t PipeNumber);
@ -242,13 +242,13 @@
/** Determines if the currently selected pipe is enabled, but not necessarily configured. /** Determines if the currently selected pipe is enabled, but not necessarily configured.
* *
* \return Boolean True if the currently selected pipe is enabled, false otherwise * \return Boolean True if the currently selected pipe is enabled, false otherwise.
*/ */
static inline bool Pipe_IsEnabled(void); static inline bool Pipe_IsEnabled(void);
/** Gets the current pipe token, indicating the pipe's data direction and type. /** Gets the current pipe token, indicating the pipe's data direction and type.
* *
* \return The current pipe token, as a PIPE_TOKEN_* mask * \return The current pipe token, as a PIPE_TOKEN_* mask.
*/ */
static inline uint8_t Pipe_GetPipeToken(void); static inline uint8_t Pipe_GetPipeToken(void);
@ -257,7 +257,7 @@
* control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices * control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices
* which have two endpoints of opposite direction sharing the same endpoint address within the device. * which have two endpoints of opposite direction sharing the same endpoint address within the device.
* *
* \param[in] Token New pipe token to set the selected pipe to, as a PIPE_TOKEN_* mask * \param[in] Token New pipe token to set the selected pipe to, as a PIPE_TOKEN_* mask.
*/ */
static inline void Pipe_SetPipeToken(uint8_t Token); static inline void Pipe_SetPipeToken(uint8_t Token);
@ -267,42 +267,42 @@
/** Configures the currently selected pipe to only allow the specified number of IN requests to be /** Configures the currently selected pipe to only allow the specified number of IN requests to be
* accepted by the pipe before it is automatically frozen. * accepted by the pipe before it is automatically frozen.
* *
* \param[in] TotalINRequests Total number of IN requests that the pipe may receive before freezing * \param[in] TotalINRequests Total number of IN requests that the pipe may receive before freezing.
*/ */
static inline void Pipe_SetFiniteINRequests(uint8_t TotalINRequests); static inline void Pipe_SetFiniteINRequests(uint8_t TotalINRequests);
/** Determines if the currently selected pipe is configured. /** Determines if the currently selected pipe is configured.
* *
* \return Boolean true if the selected pipe is configured, false otherwise * \return Boolean true if the selected pipe is configured, false otherwise.
*/ */
static inline bool Pipe_IsConfigured(void); static inline bool Pipe_IsConfigured(void);
/** Retrieves the endpoint number of the endpoint within the attached device that the currently selected /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
* pipe is bound to. * pipe is bound to.
* *
* \return Endpoint number the currently selected pipe is bound to * \return Endpoint number the currently selected pipe is bound to.
*/ */
static inline uint8_t Pipe_BoundEndpointNumber(void); static inline uint8_t Pipe_BoundEndpointNumber(void);
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds. /** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
* *
* \param[in] Milliseconds Number of milliseconds between each pipe poll * \param[in] Milliseconds Number of milliseconds between each pipe poll.
*/ */
static inline void Pipe_SetInterruptPeriod(uint8_t Milliseconds); static inline void Pipe_SetInterruptPeriod(uint8_t Milliseconds);
/** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should /** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should
* be serviced. * be serviced.
* *
* \return Mask whose bits indicate which pipes have interrupted * \return Mask whose bits indicate which pipes have interrupted.
*/ */
static inline uint8_t Pipe_GetPipeInterrupts(void); static inline uint8_t Pipe_GetPipeInterrupts(void);
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type /** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
* pipes). * pipes).
* *
* \param[in] PipeNumber Index of the pipe whose interrupt flag should be tested * \param[in] PipeNumber Index of the pipe whose interrupt flag should be tested.
* *
* \return Boolean true if the specified pipe has interrupted, false otherwise * \return Boolean true if the specified pipe has interrupted, false otherwise.
*/ */
static inline bool Pipe_HasPipeInterrupted(uint8_t PipeNumber); static inline bool Pipe_HasPipeInterrupted(uint8_t PipeNumber);
@ -314,7 +314,7 @@
/** Determines if the currently selected pipe is frozen, and not able to accept data. /** Determines if the currently selected pipe is frozen, and not able to accept data.
* *
* \return Boolean true if the currently selected pipe is frozen, false otherwise * \return Boolean true if the currently selected pipe is frozen, false otherwise.
*/ */
static inline bool Pipe_IsFrozen(void); static inline bool Pipe_IsFrozen(void);
@ -326,7 +326,7 @@
* *
* \see \ref Pipe_GetErrorFlags() macro for information on retrieving the exact error flag. * \see \ref Pipe_GetErrorFlags() macro for information on retrieving the exact error flag.
* *
* \return Boolean true if an error has occurred on the selected pipe, false otherwise * \return Boolean true if an error has occurred on the selected pipe, false otherwise.
*/ */
static inline bool Pipe_IsError(void); static inline bool Pipe_IsError(void);
@ -338,7 +338,7 @@
/** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This /** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred. * value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.
* *
* \return Mask comprising of PIPE_ERRORFLAG_* bits indicating what error has occurred on the selected pipe * \return Mask comprising of PIPE_ERRORFLAG_* bits indicating what error has occurred on the selected pipe.
*/ */
static inline uint8_t Pipe_GetErrorFlags(void); static inline uint8_t Pipe_GetErrorFlags(void);
@ -352,7 +352,7 @@
* *
* \ingroup Group_PipePacketManagement * \ingroup Group_PipePacketManagement
* *
* \return Boolean true if the currently selected pipe may be read from or written to, depending on its direction * \return Boolean true if the currently selected pipe may be read from or written to, depending on its direction.
*/ */
static inline bool Pipe_IsReadWriteAllowed(void); static inline bool Pipe_IsReadWriteAllowed(void);
@ -409,7 +409,7 @@
* *
* \ingroup Group_PipePacketManagement * \ingroup Group_PipePacketManagement
* *
* \return Boolean true if an NAK has been received on the current pipe, false otherwise * \return Boolean true if an NAK has been received on the current pipe, false otherwise.
*/ */
static inline bool Pipe_IsNAKReceived(void); static inline bool Pipe_IsNAKReceived(void);
@ -425,7 +425,7 @@
* *
* \ingroup Group_PipePacketManagement * \ingroup Group_PipePacketManagement
* *
* \return Boolean true if the current pipe has been stalled by the attached device, false otherwise * \return Boolean true if the current pipe has been stalled by the attached device, false otherwise.
*/ */
static inline bool Pipe_IsStalled(void); static inline bool Pipe_IsStalled(void);
@ -509,13 +509,13 @@
#endif #endif
/* Enums: */ /* Enums: */
/** Enum for the possible error return codes of the Pipe_WaitUntilReady function /** Enum for the possible error return codes of the Pipe_WaitUntilReady function.
* *
* \ingroup Group_PipeRW * \ingroup Group_PipeRW
*/ */
enum Pipe_WaitUntilReady_ErrorCodes_t enum Pipe_WaitUntilReady_ErrorCodes_t
{ {
PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error */ PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error. */
PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */ PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */
PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */ PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */
PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet
@ -549,7 +549,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \return Next byte in the currently selected pipe's FIFO buffer * \return Next byte in the currently selected pipe's FIFO buffer.
*/ */
static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_Read_Byte(void) static inline uint8_t Pipe_Read_Byte(void)
@ -561,7 +561,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \param[in] Byte Next byte to write into the the currently selected pipe's FIFO buffer * \param[in] Byte Next byte to write into the the currently selected pipe's FIFO buffer.
*/ */
static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_Byte(const uint8_t Byte) static inline void Pipe_Write_Byte(const uint8_t Byte)
@ -586,7 +586,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \return Next word in the currently selected pipe's FIFO buffer * \return Next word in the currently selected pipe's FIFO buffer.
*/ */
static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_LE(void) static inline uint16_t Pipe_Read_Word_LE(void)
@ -608,7 +608,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \return Next word in the currently selected pipe's FIFO buffer * \return Next word in the currently selected pipe's FIFO buffer.
*/ */
static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_BE(void) static inline uint16_t Pipe_Read_Word_BE(void)
@ -630,7 +630,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \param[in] Word Next word to write to the currently selected pipe's FIFO buffer * \param[in] Word Next word to write to the currently selected pipe's FIFO buffer.
*/ */
static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_Word_LE(const uint16_t Word) static inline void Pipe_Write_Word_LE(const uint16_t Word)
@ -644,7 +644,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \param[in] Word Next word to write to the currently selected pipe's FIFO buffer * \param[in] Word Next word to write to the currently selected pipe's FIFO buffer.
*/ */
static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_Word_BE(const uint16_t Word) static inline void Pipe_Write_Word_BE(const uint16_t Word)
@ -671,7 +671,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \return Next double word in the currently selected pipe's FIFO buffer * \return Next double word in the currently selected pipe's FIFO buffer.
*/ */
static inline uint32_t Pipe_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint32_t Pipe_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Pipe_Read_DWord_LE(void) static inline uint32_t Pipe_Read_DWord_LE(void)
@ -695,7 +695,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \return Next double word in the currently selected pipe's FIFO buffer * \return Next double word in the currently selected pipe's FIFO buffer.
*/ */
static inline uint32_t Pipe_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint32_t Pipe_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Pipe_Read_DWord_BE(void) static inline uint32_t Pipe_Read_DWord_BE(void)
@ -719,7 +719,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer * \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer.
*/ */
static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_DWord_LE(const uint32_t DWord) static inline void Pipe_Write_DWord_LE(const uint32_t DWord)
@ -735,7 +735,7 @@
* *
* \ingroup Group_PipePrimitiveRW * \ingroup Group_PipePrimitiveRW
* *
* \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer * \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer.
*/ */
static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_DWord_BE(const uint32_t DWord) static inline void Pipe_Write_DWord_BE(const uint32_t DWord)
@ -806,7 +806,7 @@
* \note This routine will select the specified pipe, and the pipe will remain selected once the * \note This routine will select the specified pipe, and the pipe will remain selected once the
* routine completes regardless of if the pipe configuration succeeds. * routine completes regardless of if the pipe configuration succeeds.
* *
* \return Boolean true if the configuration is successful, false otherwise * \return Boolean true if the configuration is successful, false otherwise.
*/ */
bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber, bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,
const uint16_t Size, const uint8_t Banks); const uint16_t Size, const uint8_t Banks);
@ -823,10 +823,10 @@
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given
* endpoint is found, it is automatically selected. * endpoint is found, it is automatically selected.
* *
* \param[in] EndpointAddress Address and direction mask of the endpoint within the attached device to check * \param[in] EndpointAddress Address and direction mask of the endpoint within the attached device to check.
* *
* \return Boolean true if a pipe bound to the given endpoint address of the specified direction is found, false * \return Boolean true if a pipe bound to the given endpoint address of the specified direction is found, false
* otherwise * otherwise.
*/ */
bool Pipe_IsEndpointBound(const uint8_t EndpointAddress); bool Pipe_IsEndpointBound(const uint8_t EndpointAddress);
@ -846,7 +846,7 @@
* \ingroup Group_PipeStreamRW * \ingroup Group_PipeStreamRW
* *
* \param[in] Length Number of bytes to send via the currently selected pipe. * \param[in] Length Number of bytes to send via the currently selected pipe.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -869,7 +869,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -881,7 +881,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -895,7 +895,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -918,7 +918,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -930,7 +930,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -944,7 +944,7 @@
* *
* \param[in] Buffer Pointer to the source data buffer to read from. * \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -967,7 +967,7 @@
* *
* \param[out] Buffer Pointer to the source data buffer to write to. * \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -979,7 +979,7 @@
* *
* \param[out] Buffer Pointer to the source data buffer to write to. * \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -1002,7 +1002,7 @@
* *
* \param[out] Buffer Pointer to the source data buffer to write to. * \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -1014,7 +1014,7 @@
* *
* \param[out] Buffer Pointer to the source data buffer to write to. * \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* *
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/ */

@ -37,7 +37,7 @@
* including any headers in the USB/LowLevel/ or USB/HighLevel/ subdirectories. * including any headers in the USB/LowLevel/ or USB/HighLevel/ subdirectories.
*/ */
/** @defgroup Group_USB USB - LUFA/Drivers/USB/USB.h /** @defgroup Group_USB USB Core - LUFA/Drivers/USB/USB.h
* *
* \section Sec_Dependencies Module Source Dependencies * \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module: * The following files must be built with any user project that uses this module:
@ -67,8 +67,7 @@
* of USB management functions found \ref Group_USBManagement. * of USB management functions found \ref Group_USBManagement.
*/ */
/** \ingroup Group_USB /** @defgroup Group_USBClassDrivers USB Class Drivers
* @defgroup Group_USBClassDrivers USB Class Drivers
* *
* Drivers for both host and device mode of the standard USB classes, for rapid application development. * Drivers for both host and device mode of the standard USB classes, for rapid application development.
* Class drivers give a framework which sits on top of the low level library API, allowing for standard * Class drivers give a framework which sits on top of the low level library API, allowing for standard

@ -20,6 +20,7 @@
* - Changed over the AVRISP-MKII and TemperatureDataLogger projects to use eeprom_update_byte() when writing non-volatile * - Changed over the AVRISP-MKII and TemperatureDataLogger projects to use eeprom_update_byte() when writing non-volatile
* parameters to EEPROM to preserve its lifespan * parameters to EEPROM to preserve its lifespan
* - Removed unused line encoding data and control requests from the CDC Bootloader code, to save space * - Removed unused line encoding data and control requests from the CDC Bootloader code, to save space
* - Renamed SERIAL_STREAM_ASSERT() macro to STDOUT_ASSERT()
* *
* <b>Fixed:</b> * <b>Fixed:</b>
* - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from * - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from

@ -128,14 +128,14 @@
#define TASK_LIST TaskEntry_t Scheduler_TaskList[] = #define TASK_LIST TaskEntry_t Scheduler_TaskList[] =
/** Constant, giving the maximum delay in scheduler ticks which can be stored in a variable of type /** Constant, giving the maximum delay in scheduler ticks which can be stored in a variable of type
* SchedulerDelayCounter_t. * \ref SchedulerDelayCounter_t.
*/ */
#define TASK_MAX_DELAY (MAX_DELAYCTR_COUNT - 1) #define TASK_MAX_DELAY (MAX_DELAYCTR_COUNT - 1)
/** Task status mode constant, for passing to Scheduler_SetTaskMode() or Scheduler_SetGroupTaskMode(). */ /** Task status mode constant, for passing to \ref Scheduler_SetTaskMode() or \ref Scheduler_SetGroupTaskMode(). */
#define TASK_RUN true #define TASK_RUN true
/** Task status mode constant, for passing to Scheduler_SetTaskMode() or Scheduler_SetGroupTaskMode(). */ /** Task status mode constant, for passing to \ref Scheduler_SetTaskMode() or \ref Scheduler_SetGroupTaskMode(). */
#define TASK_STOP false #define TASK_STOP false
/* Pseudo-Function Macros: */ /* Pseudo-Function Macros: */
@ -152,7 +152,6 @@
void Scheduler_Init(void); void Scheduler_Init(void);
#else #else
#define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS); #define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS);
#define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS); #define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS);
#endif #endif
@ -184,7 +183,7 @@
exter TaskEntry_t Scheduler_TaskList[]; exter TaskEntry_t Scheduler_TaskList[];
/** Contains the total number of tasks in the task list, irrespective of if the task's status is set to /** Contains the total number of tasks in the task list, irrespective of if the task's status is set to
* TASK_RUN or TASK_STOP. * \ref TASK_RUN or \ref TASK_STOP.
* *
* \note This value should be treated as read-only, and never altered in user-code. * \note This value should be treated as read-only, and never altered in user-code.
*/ */
@ -213,12 +212,12 @@
} }
/* Function Prototypes: */ /* Function Prototypes: */
/** Determines if the given tick delay has elapsed, based on the given . /** Determines if the given tick delay has elapsed, based on the given delay period and tick counter value.
* *
* \param[in] Delay The delay to test for, measured in ticks * \param[in] Delay The delay to test for, measured in ticks.
* \param[in] DelayCounter The counter which is storing the starting tick value for the delay * \param[in] DelayCounter The counter which is storing the starting tick value for the delay.
* *
* \return Boolean true if the delay has elapsed, false otherwise * \return Boolean true if the delay has elapsed, false otherwise.
* *
* Usage Example: * Usage Example:
* \code * \code
@ -237,16 +236,16 @@
/** Sets the task mode for a given task. /** Sets the task mode for a given task.
* *
* \param[in] Task Name of the task whose status is to be changed * \param[in] Task Name of the task whose status is to be changed.
* \param[in] TaskStatus New task status for the task (TASK_RUN or TASK_STOP) * \param[in] TaskStatus New task status for the task (\ref TASK_RUN or \ref TASK_STOP).
*/ */
void Scheduler_SetTaskMode(const TaskPtr_t Task, const bool TaskStatus); void Scheduler_SetTaskMode(const TaskPtr_t Task, const bool TaskStatus);
/** Sets the task mode for a given task group ID, allowing for an entire group of tasks to have their /** Sets the task mode for a given task group ID, allowing for an entire group of tasks to have their
* statuses changed at once. * statuses changed at once.
* *
* \param[in] GroupID Value of the task group ID whose status is to be changed * \param[in] GroupID Value of the task group ID whose status is to be changed.
* \param[in] TaskStatus New task status for tasks in the specified group (TASK_RUN or TASK_STOP) * \param[in] TaskStatus New task status for tasks in the specified group (\ref TASK_RUN or \ref TASK_STOP).
*/ */
void Scheduler_SetGroupTaskMode(const uint8_t GroupID, const bool TaskStatus); void Scheduler_SetGroupTaskMode(const uint8_t GroupID, const bool TaskStatus);

Loading…
Cancel
Save