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
......@@ -86,10 +86,15 @@
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
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
......@@ -199,7 +199,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);
......
......@@ -63,7 +63,8 @@
#define MOUSE_EPSIZE 8
/* 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
......@@ -137,8 +137,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;
......@@ -173,8 +176,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,9 +76,15 @@
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
......@@ -212,7 +212,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
......@@ -46,7 +46,8 @@
*
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
*/
int16_t ARP_ProcessARPPacket(void* InDataStart, void* OutDataStart)
int16_t ARP_ProcessARPPacket(void* InDataStart,
void* OutDataStart)
{
DecodeARPHeader(InDataStart);
......
......@@ -69,6 +69,7 @@
} ARP_Header_t;
/* Function Prototypes: */
int16_t ARP_ProcessARPPacket(void* InDataStart, void* OutDataStart);
int16_t ARP_ProcessARPPacket(void* InDataStart,
void* OutDataStart);
#endif
......@@ -46,7 +46,9 @@
*
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
*/
int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, void* DHCPHeaderInStart, void* DHCPHeaderOutStart)
int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
void* DHCPHeaderInStart,
void* DHCPHeaderOutStart)
{
IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart;
......
......@@ -120,6 +120,8 @@
} DHCP_Header_t;
/* Function Prototypes: */
int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, void* DHCPHeaderInStart, void* DHCPHeaderOutStart);
int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
void* DHCPHeaderInStart,
void* DHCPHeaderOutStart);
#endif
......@@ -56,7 +56,8 @@ const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS};
/** Processes an incoming Ethernet frame, and writes the appropriate response to the output Ethernet
* frame buffer if the sub protocol handlers create a valid response.
*/
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_t* FrameOUT)
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
Ethernet_Frame_Info_t* const FrameOUT)
{
DecodeEthernetFrameHeader(FrameIN);
......@@ -115,7 +116,8 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_
*
* \return A 16-bit Ethernet checksum value
*/
uint16_t Ethernet_Checksum16(void* Data, uint16_t Bytes)
uint16_t Ethernet_Checksum16(void* Data,
uint16_t Bytes)
{
uint16_t* Words = (uint16_t*)Data;
uint32_t Checksum = 0;
......
......@@ -96,7 +96,9 @@
extern const IP_Address_t ClientIPAddress;
/* Function Prototypes: */
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_t* FrameOUT);
uint16_t Ethernet_Checksum16(void* Data, uint16_t Bytes);
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
Ethernet_Frame_Info_t* const FrameOUT);
uint16_t Ethernet_Checksum16(void* Data,
uint16_t Bytes);
#endif
......@@ -46,7 +46,9 @@
*
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
*/
int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* FrameIN, void* InDataStart, void* OutDataStart)
int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart)
{
ICMP_Header_t* ICMPHeaderIN = (ICMP_Header_t*)InDataStart;
ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart;
......
......@@ -75,6 +75,8 @@
} ICMP_Header_t;
/* Function Prototypes: */
int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* FrameIN, void* InDataStart, void* OutDataStart);
int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart);
#endif
......@@ -47,7 +47,9 @@
* response was generated, NO_PROCESS if the packet processing was deferred until the
* next Ethernet packet handler iteration
*/
int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* FrameIN, void* InDataStart, void* OutDataStart)
int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart)
{
DecodeIPHeader(InDataStart);
......
......@@ -90,6 +90,8 @@
} IP_Header_t;
/* Function Prototypes: */
int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* FrameIN, void* InDataStart, void* OutDataStart);
int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart);
#endif
......@@ -53,7 +53,7 @@
*
* \param[in] FrameINData Pointer to the start of an Ethernet frame information structure
*/
void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* FrameINData)
void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData)
{
#if !defined(NO_DECODE_ETHERNET)
Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)FrameINData->FrameData;
......
......@@ -48,7 +48,7 @@
#include "Ethernet.h"
/* Function Prototypes: */
void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* FrameINData);
void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData);
void DecodeARPHeader(void* InDataStart);
void DecodeIPHeader(void* InDataStart);
void DecodeICMPHeader(void* InDataStart);
......
......@@ -55,7 +55,7 @@ TCP_ConnectionState_t ConnectionStateTable[MAX_TCP_CONNECTIONS];
* level. If an application produces a response, this task constructs the appropriate Ethernet frame and places it into the Ethernet OUT
* buffer for later transmission.
*/
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* RNDISInterfaceInfo)
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
{
/* Run each application in sequence, to process incoming and generate outgoing packets */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
......@@ -178,7 +178,9 @@ void TCP_Init(void)
*
* \return Boolean true if the port state was set, false otherwise (no more space in the port state table)
*/
bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*))
bool TCP_SetPortState(const uint16_t Port,
const uint8_t State,
void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*))
{
/* Note, Port number should be specified in BIG endian to simplify network code */
......@@ -225,7 +227,7 @@ bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_Connecti
*
* \return A value from the TCP_PortStates_t enum
*/
uint8_t TCP_GetPortState(uint16_t Port)
uint8_t TCP_GetPortState(const uint16_t Port)
{
/* Note, Port number should be specified in BIG endian to simplify network code */
......@@ -250,7 +252,10 @@ uint8_t TCP_GetPortState(uint16_t Port)
*
* \return Boolean true if the connection was updated or created, false otherwise (no more space in the connection state table)
*/
bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort, uint8_t State)
bool TCP_SetConnectionState(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort,
const uint8_t State)
{
/* Note, Port number should be specified in BIG endian to simplify network code */
......@@ -290,7 +295,9 @@ bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t
*
* \return A value from the TCP_ConnectionStates_t enum
*/
uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort)
uint8_t TCP_GetConnectionState(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort)
{
/* Note, Port number should be specified in BIG endian to simplify network code */
......@@ -317,7 +324,9 @@ uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16
*
* \return ConnectionInfo structure of the connection if found, NULL otherwise
*/
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort)
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
const IP_Address_t RemoteAddress,
const uint16_t RemotePort)
{
/* Note, Port number should be specified in BIG endian to simplify network code */
......@@ -346,7 +355,9 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAd
* response was generated, NO_PROCESS if the packet processing was deferred until the
* next Ethernet packet handler iteration
*/
int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void* TCPHeaderOutStart)
int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
void* TCPHeaderInStart,
void* TCPHeaderOutStart)
{
IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
TCP_Header_t* TCPHeaderIN = (TCP_Header_t*)TCPHeaderInStart;
......@@ -593,8 +604,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void
*
* \return A 16-bit TCP checksum value
*/
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,
const uint16_t TCPOutSize)
{
uint32_t Checksum = 0;
......
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