Run wspurify script on /trunk/ and /branches/ C source files, to remove any trailing whitespace at the end of each line.
This commit is contained in:
parent
77f354609f
commit
f201f6697b
278 changed files with 1000 additions and 910 deletions
|
@ -100,3 +100,4 @@ bool DHCPCommon_GetOption(const uint8_t* DHCPOptionList,
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <uip.h>
|
||||
|
||||
/* Macros: */
|
||||
|
|
|
@ -42,20 +42,20 @@
|
|||
struct uip_conn* BroadcastConnection;
|
||||
|
||||
uint8_t LeasedIPs[255 / 8];
|
||||
|
||||
|
||||
/** Initialization function for the DHCP server. */
|
||||
void DHCPServerApp_Init(void)
|
||||
{
|
||||
/* Listen on port 67 for DHCP server connections from hosts */
|
||||
uip_listen(HTONS(DHCP_SERVER_PORT));
|
||||
|
||||
|
||||
/* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
|
||||
struct uip_udp_conn* BroadcastConnection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCP_CLIENT_PORT));
|
||||
|
||||
/* If the connection was successfully created, bind it to the local DHCP client port */
|
||||
if (BroadcastConnection != NULL)
|
||||
uip_udp_bind(BroadcastConnection, HTONS(DHCP_SERVER_PORT));
|
||||
|
||||
|
||||
/* Set all IP addresses as unleased */
|
||||
memset(LeasedIPs, 0x00, sizeof(LeasedIPs));
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ void DHCPServerApp_Callback(void)
|
|||
|
||||
/* Try to extract out the client's preferred IP address if it is indicated in the packet */
|
||||
if (!(DHCPCommon_GetOption(AppData->Options, DHCP_OPTION_REQ_IPADDR, &PreferredClientIP)))
|
||||
memcpy(&PreferredClientIP, &uip_all_zeroes_addr, sizeof(uip_ipaddr_t));
|
||||
|
||||
memcpy(&PreferredClientIP, &uip_all_zeroes_addr, sizeof(uip_ipaddr_t));
|
||||
|
||||
switch (DHCPMessageType)
|
||||
{
|
||||
case DHCP_DISCOVER:
|
||||
|
@ -116,7 +116,7 @@ void DHCPServerApp_Callback(void)
|
|||
/* Check to see if the requested IP address has already been leased to a client */
|
||||
if (!(DHCPServerApp_CheckIfIPLeased(&PreferredClientIP)))
|
||||
{
|
||||
/* Create a new DHCP ACK packet to accept the IP address lease */
|
||||
/* Create a new DHCP ACK packet to accept the IP address lease */
|
||||
AppDataSize += DHCPServerApp_FillDHCPHeader(AppData, DHCP_ACK, &RemoteMACAddress, &PreferredClientIP, TransactionID);
|
||||
|
||||
/* Add network mask and router information to the list of DHCP ACK packet options */
|
||||
|
@ -133,12 +133,12 @@ void DHCPServerApp_Callback(void)
|
|||
/* Create a new DHCP NAK packet to reject the requested allocation */
|
||||
AppDataSize += DHCPServerApp_FillDHCPHeader(AppData, DHCP_NAK, &RemoteMACAddress, &uip_all_zeroes_addr, TransactionID);
|
||||
}
|
||||
|
||||
|
||||
/* Send the DHCP ACK or NAK packet */
|
||||
uip_poll_conn(BroadcastConnection);
|
||||
memcpy(&uip_udp_conn->ripaddr, &uip_broadcast_addr, sizeof(uip_ipaddr_t));
|
||||
uip_udp_send(AppDataSize);
|
||||
|
||||
|
||||
break;
|
||||
case DHCP_RELEASE:
|
||||
/* Mark the IP address as released in the allocation table */
|
||||
|
@ -179,7 +179,7 @@ static uint16_t DHCPServerApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
|
|||
memcpy(&DHCPHeader->YourIP, PreferredClientIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->ClientHardwareAddress, ClientHardwareAddress, sizeof(struct uip_eth_addr));
|
||||
DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
|
||||
|
||||
|
||||
/* Add a DHCP message type and terminator options to the start of the DHCP options field */
|
||||
DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
|
||||
DHCPHeader->Options[1] = 1;
|
||||
|
@ -202,7 +202,7 @@ static bool DHCPServerApp_CheckIfIPLeased(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Make sure that the requested IP address isn't already leased to the virtual server or another client */
|
||||
if (IPAddress->u8[3] && !(IPAddress->u8[3] == uip_hostaddr.u8[3]) && !(LeasedIPs[Byte] & Mask))
|
||||
return false;
|
||||
|
@ -217,13 +217,13 @@ static bool DHCPServerApp_CheckIfIPLeased(const uip_ipaddr_t* const IPAddress)
|
|||
static void DHCPServerApp_GetUnleasedIP(uip_ipaddr_t* const NewIPAddress)
|
||||
{
|
||||
uip_ipaddr_copy(NewIPAddress, &uip_hostaddr);
|
||||
|
||||
|
||||
/** Look through the current subnet, skipping the broadcast and zero IP addresses */
|
||||
for (uint8_t IP = 1; IP < 254; IP++)
|
||||
{
|
||||
/* Update new IP address to lease with the current IP address to test */
|
||||
NewIPAddress->u8[3] = IP;
|
||||
|
||||
|
||||
/* If we've found an unleased IP, abort with the updated IP stored for the called */
|
||||
if (!(DHCPServerApp_CheckIfIPLeased(NewIPAddress)))
|
||||
return;
|
||||
|
@ -241,7 +241,7 @@ static void DHCPServerApp_LeaseIP(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Mark the IP address as leased in the allocation table */
|
||||
LeasedIPs[Byte] |= Mask;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ static void DHCPServerApp_UnleaseIP(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Mark the IP address as unleased in the allocation table */
|
||||
LeasedIPs[Byte] &= ~Mask;
|
||||
}
|
||||
|
|
|
@ -946,7 +946,7 @@ FRESULT remove_chain (
|
|||
#if _USE_ERASE
|
||||
if (ecl + 1 == nxt) { /* Next cluster is contiguous */
|
||||
ecl = nxt;
|
||||
} else { /* End of contiguous clusters */
|
||||
} else { /* End of contiguous clusters */
|
||||
resion[0] = clust2sect(fs, scl); /* Start sector */
|
||||
resion[1] = clust2sect(fs, ecl) + fs->csize - 1; /* End sector */
|
||||
disk_ioctl(fs->drv, CTRL_ERASE_SECTOR, resion); /* Erase the block */
|
||||
|
@ -2650,7 +2650,7 @@ FRESULT f_close (
|
|||
#if _FS_REENTRANT
|
||||
res = validate(fp->fs, fp->id);
|
||||
if (res == FR_OK) {
|
||||
res = dec_lock(fp->lockid);
|
||||
res = dec_lock(fp->lockid);
|
||||
unlock_fs(fp->fs, FR_OK);
|
||||
}
|
||||
#else
|
||||
|
@ -2749,7 +2749,7 @@ FRESULT f_getcwd (
|
|||
res = dir_read(&dj);
|
||||
if (res != FR_OK) break;
|
||||
if (ccl == LD_CLUST(dj.dir)) break; /* Found the entry */
|
||||
res = dir_next(&dj, 0);
|
||||
res = dir_next(&dj, 0);
|
||||
} while (res == FR_OK);
|
||||
if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
|
||||
if (res != FR_OK) break;
|
||||
|
@ -3978,3 +3978,4 @@ int f_printf (
|
|||
|
||||
#endif /* !_FS_READONLY */
|
||||
#endif /* _USE_STRFUNC */
|
||||
|
||||
|
|
|
@ -333,3 +333,4 @@ int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
|||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
SCSI_ASENSE_WRITE_PROTECTED,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
|
@ -306,7 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
|
||||
if (IsDataRead == DATA_READ)
|
||||
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
|
||||
|
@ -340,3 +340,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <avr/pgmspace.h>
|
||||
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
||||
|
||||
#include "../Descriptors.h"
|
||||
#include "DataflashManager.h"
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void uIPManagement_Init(void)
|
|||
MACAddress.addr[5] = SERVER_MAC_ADDRESS[5];
|
||||
|
||||
#if defined(ENABLE_DHCP_SERVER)
|
||||
DHCPServerApp_Init();
|
||||
DHCPServerApp_Init();
|
||||
#endif
|
||||
|
||||
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
|
||||
|
@ -84,7 +84,7 @@ void uIPManagement_Init(void)
|
|||
else
|
||||
{
|
||||
#if defined(ENABLE_DHCP_CLIENT)
|
||||
DHCPClientApp_Init();
|
||||
DHCPClientApp_Init();
|
||||
#else
|
||||
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
|
||||
uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
|
||||
|
@ -170,7 +170,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
|
|||
/* If no packet received, exit processing routine */
|
||||
if (!(RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface_Device)))
|
||||
return;
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
/* Read the Incoming packet straight into the UIP packet buffer */
|
||||
|
@ -181,13 +181,13 @@ static void uIPManagement_ProcessIncomingPacket(void)
|
|||
/* If no packet received, exit processing routine */
|
||||
if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface_Host)))
|
||||
return;
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
/* Read the Incoming packet straight into the UIP packet buffer */
|
||||
RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface_Host, uip_buf, &uip_len);
|
||||
}
|
||||
|
||||
|
||||
/* If the packet contains an Ethernet frame, process it */
|
||||
if (uip_len > 0)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
* (when DHCP is disabled).
|
||||
*/
|
||||
#define DEVICE_GATEWAY (uint8_t[]){10, 0, 0, 1}
|
||||
|
||||
|
||||
/** Ethernet MAC address of the virtual webserver. When in device RNDIS mode, the virtual webserver requires
|
||||
* a unique MAC address that it can use when sending packets to the RNDIS adapter, which contains a seperate
|
||||
* MAC address as set in the RNDIS class driver configuration structure.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue