From 6bda628718f67c04ed43e8328f55bdce5319c504 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 21 Jul 2010 16:19:32 +0000 Subject: Update all demos, projects and bootloaders to indent all function parameters, one per line, for better readability. Add missing const qualifiers to the demos. --- Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c | 4 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h | 4 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h | 3 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c | 2 +- Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h | 11 +++++--- Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c | 29 ++++++++++++++++------ Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h | 29 ++++++++++++++++------ Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c | 4 ++- Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h | 4 ++- .../Device/LowLevel/RNDISEthernet/Lib/Webserver.c | 6 +++-- .../Device/LowLevel/RNDISEthernet/Lib/Webserver.h | 3 ++- 18 files changed, 85 insertions(+), 35 deletions(-) (limited to 'Demos/Device/LowLevel/RNDISEthernet/Lib') diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c index 6eb74faff..853d50542 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c @@ -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); diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h index 6ae9b7be3..8de76f3b6 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h @@ -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 diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c index eeed88491..41265aa27 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c @@ -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; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h index 2c8c4d884..3bfdb29be 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h @@ -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 diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c index 044b0695b..0b9563347 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c @@ -120,7 +120,8 @@ void Ethernet_ProcessPacket(void) * * \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; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h index 683b187c3..49c6b1c25 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h @@ -109,6 +109,7 @@ /* Function Prototypes: */ void Ethernet_ProcessPacket(void); - uint16_t Ethernet_Checksum16(void* Data, uint16_t Bytes); + uint16_t Ethernet_Checksum16(void* Data, + uint16_t Bytes); #endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c index a43ffca54..7e4be9c3d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c @@ -45,7 +45,8 @@ * * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise */ -int16_t ICMP_ProcessICMPPacket(void* InDataStart, void* OutDataStart) +int16_t ICMP_ProcessICMPPacket(void* InDataStart, + void* OutDataStart) { ICMP_Header_t* ICMPHeaderIN = (ICMP_Header_t*)InDataStart; ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h index dfffae249..dcea1ada4 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h @@ -75,6 +75,7 @@ } ICMP_Header_t; /* Function Prototypes: */ - int16_t ICMP_ProcessICMPPacket(void* InDataStart, void* OutDataStart); + int16_t ICMP_ProcessICMPPacket(void* InDataStart, + void* OutDataStart); #endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c index 078f5b58f..85ccf426e 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c @@ -46,7 +46,8 @@ * response was generated, NO_PROCESS if the packet processing was deferred until the * next Ethernet packet handler iteration */ -int16_t IP_ProcessIPPacket(void* InDataStart, void* OutDataStart) +int16_t IP_ProcessIPPacket(void* InDataStart, + void* OutDataStart) { DecodeIPHeader(InDataStart); diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h index b0a06b8d0..8f45113be 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h @@ -90,6 +90,7 @@ } IP_Header_t; /* Function Prototypes: */ - int16_t IP_ProcessIPPacket(void* InDataStart, void* OutDataStart); + int16_t IP_ProcessIPPacket(void* InDataStart, + void* OutDataStart); #endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c index 80b8bc813..3875f8801 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c @@ -239,7 +239,7 @@ void ProcessRNDISControlMessage(void) * * \return Boolean true if the query was handled, false otherwise */ -static bool ProcessNDISQuery(uint32_t OId, void* QueryData, uint16_t QuerySize, +static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t QuerySize, void* ResponseData, uint16_t* ResponseSize) { /* Handler for REMOTE_NDIS_QUERY_MSG messages */ diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h index cabea97bb..5168dc8ef 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h @@ -215,9 +215,14 @@ void ProcessRNDISControlMessage(void); #if defined(INCLUDE_FROM_RNDIS_C) - static bool ProcessNDISQuery(uint32_t OId, void* QueryData, uint16_t QuerySize, - void* ResponseData, uint16_t* ResponseSize); - static bool ProcessNDISSet(uint32_t OId, void* SetData, uint16_t SetSize); + static bool ProcessNDISQuery(const uint32_t OId, + void* QueryData, + uint16_t QuerySize, + void* ResponseData, + uint16_t* ResponseSize); + static bool ProcessNDISSet(const uint32_t OId, + void* SetData, + uint16_t SetSize); #endif #endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c index 76031490d..f75b828bc 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c @@ -175,7 +175,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 */ @@ -222,7 +224,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 */ @@ -247,7 +249,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 */ @@ -287,7 +292,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 */ @@ -314,7 +321,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 */ @@ -343,7 +352,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; @@ -590,8 +601,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, + uint16_t TCPOutSize) { uint32_t Checksum = 0; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h index 1e9b99bb1..984793e59 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h @@ -231,16 +231,29 @@ /* Function Prototypes: */ void TCP_Init(void); void TCP_Task(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 diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c index c9c523f71..15b065656 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c @@ -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; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h index 6cbc0b819..42d7925a3 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h @@ -65,6 +65,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 diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c index 51a9fadec..807c1a2e3 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c @@ -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; diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h index 3ba4186ea..87fe1c91d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h @@ -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 -- cgit v1.2.3