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