Commit 6bda6287 authored by Dean Camera's avatar Dean Camera
Browse files

Update all demos, projects and bootloaders to indent all function parameters,...

Update all demos, projects and bootloaders to indent all function parameters, one per line, for better readability.

Add missing const qualifiers to the demos.
parent 83e293a6
......@@ -228,18 +228,31 @@
} TCP_Header_t;
/* Function Prototypes: */
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* RNDISInterfaceInfo);
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo);
void TCP_Init(void);
bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*));
uint8_t TCP_GetPortState(uint16_t Port);
bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort, uint8_t State);
uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort);
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort);
int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void* TCPHeaderOutStart);
bool TCP_SetPortState(const uint16_t Port,
const uint8_t State,
void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*));
uint8_t TCP_GetPortState(const uint16_t Port);
bool TCP_SetConnectionState(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort,
const uint8_t State);
uint8_t TCP_GetConnectionState(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort);
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort);
int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
void* TCPHeaderInStart,
void* TCPHeaderOutStart);
#if defined(INCLUDE_FROM_TCP_C)
static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, IP_Address_t SourceAddress,
IP_Address_t DestinationAddress, uint16_t TCPOutSize);
static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
const IP_Address_t SourceAddress,
const IP_Address_t DestinationAddress,
uint16_t TCPOutSize);
#endif
#endif
......@@ -46,7 +46,9 @@
*
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
*/
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart, void* UDPHeaderInStart, void* UDPHeaderOutStart)
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
void* UDPHeaderInStart,
void* UDPHeaderOutStart)
{
UDP_Header_t* UDPHeaderIN = (UDP_Header_t*)UDPHeaderInStart;
UDP_Header_t* UDPHeaderOUT = (UDP_Header_t*)UDPHeaderOutStart;
......
......@@ -62,6 +62,8 @@
} UDP_Header_t;
/* Function Prototypes: */
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart, void* UDPHeaderInStart, void* UDPHeaderOutStart);
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
void* UDPHeaderInStart,
void* UDPHeaderOutStart);
#endif
......@@ -90,7 +90,8 @@ void Webserver_Init(void)
*
* \return Boolean true if the command matches the request, false otherwise
*/
static bool IsHTTPCommand(uint8_t* RequestHeader, char* Command)
static bool IsHTTPCommand(uint8_t* RequestHeader,
char* Command)
{
/* Returns true if the non null terminated string in RequestHeader matches the null terminated string Command */
return (strncmp((char*)RequestHeader, Command, strlen(Command)) == 0);
......@@ -102,7 +103,8 @@ static bool IsHTTPCommand(uint8_t* RequestHeader, char* Command)
* \param[in] ConnectionState Pointer to a TCP Connection State structure giving connection information
* \param[in,out] Buffer Pointer to the application's send/receive packet buffer
*/
void Webserver_ApplicationCallback(TCP_ConnectionState_t* ConnectionState, TCP_ConnectionBuffer_t* Buffer)
void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
TCP_ConnectionBuffer_t* const Buffer)
{
char* BufferDataStr = (char*)Buffer->Data;
static uint8_t PageBlock = 0;
......
......@@ -50,6 +50,7 @@
/* Function Prototypes: */
void Webserver_Init(void);
void Webserver_ApplicationCallback(TCP_ConnectionState_t* ConnectionState, TCP_ConnectionBuffer_t* Buffer);
void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
TCP_ConnectionBuffer_t* const Buffer);
#endif
......@@ -224,7 +224,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
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)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
......
......@@ -77,7 +77,8 @@
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
......@@ -311,7 +311,9 @@ USB_Descriptor_String_t PROGMEM ProductString =
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
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)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
......
......@@ -88,7 +88,8 @@
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
......@@ -199,8 +199,11 @@ void EVENT_USB_Device_StartOfFrame(void)
*
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
*/
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize)
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
......@@ -235,8 +238,11 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
* \param[in] ReportData Pointer to a buffer where the created report has been stored
* \param[in] ReportSize Size in bytes of the received HID report
*/
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
......@@ -76,8 +76,14 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
......@@ -154,7 +154,9 @@ USB_OSCompatibleIDDescriptor_t PROGMEM DevCompatIDs =
SubCompatibleID: "UNIV1"}
};
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)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
......@@ -207,11 +209,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
return Size;
}
bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
void** const DescriptorAddress, uint16_t* const DescriptorSize)
uint16_t USB_GetOSFeatureDescriptor(const uint16_t wValue,
const uint8_t wIndex,
void** const DescriptorAddress)
{
void* Address = NULL;
uint16_t Size = 0;
uint16_t Size = NO_DESCRIPTOR;
/* Check if a device level OS feature descriptor is being requested */
if (wValue == 0x0000)
......@@ -224,13 +227,6 @@ bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
}
}
if (Address != NULL)
{
*DescriptorAddress = Address;
*DescriptorSize = Size;
return true;
}
return false;
return Size;
}
\ No newline at end of file
......@@ -85,11 +85,12 @@
} USB_OSCompatibleIDDescriptor_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3);
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
void** const DescriptorAddress, uint16_t* const DescriptorSize)
ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4);
uint16_t USB_GetOSFeatureDescriptor(const uint16_t wValue,
const uint8_t wIndex,
void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
......@@ -44,7 +44,7 @@ SideShow_Application_t* SideShow_GetFreeApplication(void)
return NULL;
}
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID)
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID)
{
for (uint8_t App = 0; App < ARRAY_ELEMENTS(InstalledApplications); App++)
{
......
......@@ -57,6 +57,6 @@
/* Function Prototypes: */
SideShow_Application_t* SideShow_GetFreeApplication(void);
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID);
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID);
#endif
......@@ -280,7 +280,8 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
return;
}
static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, void* const UnicodeStruct)
static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
void* const UnicodeStruct)
{
Endpoint_ClearOUT();
......
......@@ -151,7 +151,8 @@
static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, void* const UnicodeStruct);
static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
void* const UnicodeStruct);
static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader);
......
......@@ -30,7 +30,8 @@
#include "SideshowCommon.h"
uint16_t SideShow_Read_Unicode_String(void* const UnicodeString, const uint16_t MaxBytes)
uint16_t SideShow_Read_Unicode_String(void* const UnicodeString,
const uint16_t MaxBytes)
{
Unicode_String_t* const UnicodeStruct = (Unicode_String_t*)UnicodeString;
uint32_t UnicodeCharsToRead;
......
......@@ -96,7 +96,8 @@
} SideShow_PacketHeader_t;
/* Function Prototypes: */
uint16_t SideShow_Read_Unicode_String(void* UnicodeString, const uint16_t MaxBytes);
uint16_t SideShow_Read_Unicode_String(void* UnicodeString,
const uint16_t MaxBytes);
void SideShow_Write_Unicode_String(void* UnicodeString);
void SideShow_Discard_Byte_Stream(void);
......
......@@ -31,7 +31,8 @@
#define INCLUDE_FROM_SIDESHOWCONTENT_C
#include "SideshowContent.h"
bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, SideShow_Application_t* const Application)
bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
SideShow_Application_t* const Application)
{
uint32_t ContentSize;
uint32_t ContentID;
......@@ -69,7 +70,8 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, Side
return true;
}
static void SideShow_ProcessXMLContent(void* ContentData, uint32_t ContentSize)
static void SideShow_ProcessXMLContent(void* ContentData,
uint32_t ContentSize)
{
printf(" XML");
Endpoint_Discard_Stream(ContentSize);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment