Commit f1076ac4 authored by Dean Camera's avatar Dean Camera
Browse files

Added const modifiers to device mode class drivers.

Added parameter directions to function parameter documentation.

Added new experimental FAST_STREAM_FUNCTIONS compile time option to speed up stream transfers at the expense of a higher FLASH consumption (needs testing to verify improved throughput).
parent 3cbdcd36
...@@ -79,8 +79,8 @@ ...@@ -79,8 +79,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 BaudRate Baud rate to configure the USART to * \param[in] BaudRate Baud rate to configure the USART to
* \param 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)
{ {
......
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
/** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number. /** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
* *
* \param freq Required audio sampling frequency in HZ * \param[in] freq Required audio sampling frequency in HZ
*/ */
#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)}
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,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 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 \
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
/** 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 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)
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "Audio.h" #include "Audio.h"
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo) void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;
...@@ -83,7 +83,7 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfac ...@@ -83,7 +83,7 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfac
return true; return true;
} }
void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo) void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{ {
} }
...@@ -124,7 +124,7 @@ int32_t Audio_Device_ReadSample24(void) ...@@ -124,7 +124,7 @@ int32_t Audio_Device_ReadSample24(void)
return Sample; return Sample;
} }
void Audio_Device_WriteSample8(int8_t Sample) void Audio_Device_WriteSample8(const int8_t Sample)
{ {
Endpoint_Write_Byte(Sample); Endpoint_Write_Byte(Sample);
...@@ -132,7 +132,7 @@ void Audio_Device_WriteSample8(int8_t Sample) ...@@ -132,7 +132,7 @@ void Audio_Device_WriteSample8(int8_t Sample)
Endpoint_ClearIN(); Endpoint_ClearIN();
} }
void Audio_Device_WriteSample16(int16_t Sample) void Audio_Device_WriteSample16(const int16_t Sample)
{ {
Endpoint_Write_Word_LE(Sample); Endpoint_Write_Word_LE(Sample);
...@@ -140,7 +140,7 @@ void Audio_Device_WriteSample16(int16_t Sample) ...@@ -140,7 +140,7 @@ void Audio_Device_WriteSample16(int16_t Sample)
Endpoint_ClearIN(); Endpoint_ClearIN();
} }
void Audio_Device_WriteSample24(int32_t Sample) void Audio_Device_WriteSample24(const int32_t Sample)
{ {
Endpoint_Write_Byte(Sample >> 16); Endpoint_Write_Byte(Sample >> 16);
Endpoint_Write_Word_LE(Sample); Endpoint_Write_Word_LE(Sample);
...@@ -149,13 +149,13 @@ void Audio_Device_WriteSample24(int32_t Sample) ...@@ -149,13 +149,13 @@ void Audio_Device_WriteSample24(int32_t Sample)
Endpoint_ClearIN(); Endpoint_ClearIN();
} }
bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo) bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{ {
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber); Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
return Endpoint_IsOUTReceived(); return Endpoint_IsOUTReceived();
} }
bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo) bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{ {
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber); Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
return Endpoint_IsINReady(); return Endpoint_IsINReady();
......
...@@ -97,25 +97,25 @@ ...@@ -97,25 +97,25 @@
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
* given Audio interface is selected. * given Audio interface is selected.
* *
* \param 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 sucessfully configured, false otherwise * \return Boolean true if the endpoints were sucessfully configured, false otherwise
*/ */
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo); bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be /** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
* *
* \param 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_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo); void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** 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 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_USBTask(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo); void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** Reads the next 8-bit audio sample from the current audio interface. /** Reads the next 8-bit audio sample from the current audio interface.
* *
...@@ -149,43 +149,43 @@ ...@@ -149,43 +149,43 @@
* \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that * \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that
* the correct endpoint is selected and ready for data. * the correct endpoint is selected and ready for data.
* *
* \param Sample Signed 8-bit audio sample * \param[in] Sample Signed 8-bit audio sample
*/ */
void Audio_Device_WriteSample8(int8_t Sample); void Audio_Device_WriteSample8(const int8_t Sample);
/** Writes the next 16-bit audio sample to the current audio interface. /** Writes the next 16-bit audio sample to the current audio interface.
* *
* \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that * \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that
* the correct endpoint is selected and ready for data. * the correct endpoint is selected and ready for data.
* *
* \param Sample Signed 16-bit audio sample * \param[in] Sample Signed 16-bit audio sample
*/ */
void Audio_Device_WriteSample16(int16_t Sample); void Audio_Device_WriteSample16(const int16_t Sample);
/** Writes the next 24-bit audio sample to the current audio interface. /** Writes the next 24-bit audio sample to the current audio interface.
* *
* \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that * \note This should be preceeded immediately by a call to the USB_Audio_IsReadyForNextSample() function to ensure that
* the correct endpoint is selected and ready for data. * the correct endpoint is selected and ready for data.
* *
* \param Sample Signed 24-bit audio sample * \param[in] Sample Signed 24-bit audio sample
*/ */
void Audio_Device_WriteSample24(int32_t Sample); void Audio_Device_WriteSample24(const int32_t Sample);
/** Determines if the given audio interface is ready for a sample to be read from it. /** Determines if the given audio interface is ready for a sample to be read from it.
* *
* \param 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
*/ */
bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo); bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** Determines if the given audio interface is ready to accept the next sample to be written to it. /** Determines if the given audio interface is ready to accept the next sample to be written to it.
* *
* \param 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
*/ */
bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo); bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus) #if defined(__cplusplus)
......
...@@ -131,7 +131,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) ...@@ -131,7 +131,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
Endpoint_ClearIN(); Endpoint_ClearIN();
} }
void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, char* Data, uint16_t Length) void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length)
{ {
if (!(USB_IsConnected)) if (!(USB_IsConnected))
return; return;
...@@ -140,7 +140,7 @@ void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, char* D ...@@ -140,7 +140,7 @@ void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, char* D
Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK); Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
} }
void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, uint8_t Data) void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data)
{ {
if (!(USB_IsConnected)) if (!(USB_IsConnected))
return; return;
...@@ -156,7 +156,7 @@ void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, uint8_t D ...@@ -156,7 +156,7 @@ void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, uint8_t D
Endpoint_Write_Byte(Data); Endpoint_Write_Byte(Data);
} }
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
{ {
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
...@@ -178,7 +178,7 @@ uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) ...@@ -178,7 +178,7 @@ uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
return DataByte; return DataByte;
} }
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
{ {
if (!(USB_IsConnected)) if (!(USB_IsConnected))
return; return;
......
...@@ -108,34 +108,34 @@ ...@@ -108,34 +108,34 @@
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
* given CDC interface is selected. * given CDC interface is selected.
* *
* \param 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 sucessfully configured, false otherwise * \return Boolean true if the endpoints were sucessfully configured, false otherwise
*/ */
bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo); bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be /** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
* *
* \param 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_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo); void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** 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 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* CDCInterfaceInfo); void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** CDC class driver event for a line encoding change on a CDC interface. This event fires each time the host requests a /** CDC class driver event for a line encoding change on a CDC interface. This event fires each time the host requests a
* line encoding change (containing the serial parity, baud and other configuration information) and may be hooked in the * line encoding change (containing the serial parity, baud and other configuration information) and may be hooked in the
* 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 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* CDCInterfaceInfo); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a /** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a
* control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the * control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the
...@@ -143,62 +143,62 @@ ...@@ -143,62 +143,62 @@
* 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 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* CDCInterfaceInfo); void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the /** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
* string is discarded. * string is discarded.
* *
* \param 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 Data Pointer to the string to send to the host * \param[in] Data Pointer to the string to send to the host
* \param 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
*/ */
void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, char* Data, uint16_t Length); void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length);
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the /** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
* byte is discarded. * byte is discarded.
* *
* \param 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 Data Byte of data to send to the host * \param[in] Data Byte of data to send to the host
*/ */
void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, uint8_t Data); void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data);
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read. /** Determines the number of bytes received by the CDC interface from the host, waiting to be read.
* *
* \param 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* CDCInterfaceInfo); uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function /** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function
* returns 0. The USB_CDC_BytesReceived() function should be queried before data is recieved to ensure that no data * returns 0. The USB_CDC_BytesReceived() function should be queried before data is recieved to ensure that no data
* underflow occurs. * underflow occurs.
* *
* \param 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* CDCInterfaceInfo); uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial /** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist * control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist
* until they are cleared via a second notification. This should be called each time the CDC class driver's * until they are cleared via a second notification. This should be called each time the CDC class driver's
* ControlLineStates.DeviceToHost value is updated to push the new states to the USB host. * ControlLineStates.DeviceToHost value is updated to push the new states to the USB host.
* *
* \param 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* CDCInterfaceInfo); void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
/* Function Prototypes: */ /* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_DEVICE_C) #if defined(INCLUDE_FROM_CDC_CLASS_DEVICE_C)
void CDC_Device_Event_Stub(void); void CDC_Device_Event_Stub(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub); ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub); ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);
#endif #endif
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "HID.h" #include "HID.h"
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;
...@@ -130,7 +130,7 @@ void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInf ...@@ -130,7 +130,7 @@ void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInf
} }
} }
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{ {
HIDInterfaceInfo->State.UsingReportProtocol = true; HIDInterfaceInfo->State.UsingReportProtocol = true;
...@@ -143,7 +143,7 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ...@@ -143,7 +143,7 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)
return true; return true;
} }
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{ {
if (!(USB_IsConnected)) if (!(USB_IsConnected))
return; return;
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_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 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 sucessfully configured, false otherwise * \return Boolean true if the endpoints were sucessfully configured, false otherwise
*/ */
...@@ -98,14 +98,14 @@ ...@@ -98,14 +98,14 @@
/** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be /** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
* *
* \param 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_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
/** 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 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); void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
...@@ -113,11 +113,11 @@ ...@@ -113,11 +113,11 @@
* 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 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 ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, this should * \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 multiple reports are not sent via the * be set to the report ID of the generated HID input report. If multiple reports are not sent via the
* given HID interface, this parameter should be ignored. * given HID interface, this parameter should be ignored.
* \param 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.
* *
* \return Number of bytes in the generated input report, or zero if no report is to be sent * \return Number of bytes in the generated input report, or zero if no report is to be sent
*/ */
...@@ -127,14 +127,14 @@ ...@@ -127,14 +127,14 @@
* 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 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.