aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/Webserver
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/Webserver')
-rw-r--r--Projects/Webserver/Descriptors.h6
-rw-r--r--Projects/Webserver/Lib/DHCPCommon.c1
-rw-r--r--Projects/Webserver/Lib/DHCPCommon.h2
-rw-r--r--Projects/Webserver/Lib/DHCPServerApp.c28
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.c7
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.h1
-rw-r--r--Projects/Webserver/Lib/SCSI.c5
-rw-r--r--Projects/Webserver/Lib/SCSI.h2
-rw-r--r--Projects/Webserver/Lib/uIPManagement.c10
-rw-r--r--Projects/Webserver/Lib/uIPManagement.h2
-rw-r--r--Projects/Webserver/USBDeviceMode.c2
-rw-r--r--Projects/Webserver/USBHostMode.c2
12 files changed, 36 insertions, 32 deletions
diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h
index da8456e93..b1825a0ff 100644
--- a/Projects/Webserver/Descriptors.h
+++ b/Projects/Webserver/Descriptors.h
@@ -74,7 +74,7 @@
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
-
+
// RNDIS CDC Command Interface
USB_Descriptor_Interface_Association_t CDC_IAD;
USB_Descriptor_Interface_t CDC_CCI_Interface;
@@ -82,12 +82,12 @@
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
-
+
// RNDIS CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint;
-
+
// Mass Storage Interface
USB_Descriptor_Interface_t MS_Interface;
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
diff --git a/Projects/Webserver/Lib/DHCPCommon.c b/Projects/Webserver/Lib/DHCPCommon.c
index dac5fa797..818433b08 100644
--- a/Projects/Webserver/Lib/DHCPCommon.c
+++ b/Projects/Webserver/Lib/DHCPCommon.c
@@ -100,3 +100,4 @@ bool DHCPCommon_GetOption(const uint8_t* DHCPOptionList,
}
#endif
+
diff --git a/Projects/Webserver/Lib/DHCPCommon.h b/Projects/Webserver/Lib/DHCPCommon.h
index 652db683c..9fc9ad06e 100644
--- a/Projects/Webserver/Lib/DHCPCommon.h
+++ b/Projects/Webserver/Lib/DHCPCommon.h
@@ -40,7 +40,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
-
+
#include <uip.h>
/* Macros: */
diff --git a/Projects/Webserver/Lib/DHCPServerApp.c b/Projects/Webserver/Lib/DHCPServerApp.c
index 43d539f7a..fadb9e828 100644
--- a/Projects/Webserver/Lib/DHCPServerApp.c
+++ b/Projects/Webserver/Lib/DHCPServerApp.c
@@ -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;
}
diff --git a/Projects/Webserver/Lib/FATFs/ff.c b/Projects/Webserver/Lib/FATFs/ff.c
index 4f76915b6..1b7c7ca46 100644
--- a/Projects/Webserver/Lib/FATFs/ff.c
+++ b/Projects/Webserver/Lib/FATFs/ff.c
@@ -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 */
+
diff --git a/Projects/Webserver/Lib/FATFs/ff.h b/Projects/Webserver/Lib/FATFs/ff.h
index a3aad840a..b6a747154 100644
--- a/Projects/Webserver/Lib/FATFs/ff.h
+++ b/Projects/Webserver/Lib/FATFs/ff.h
@@ -333,3 +333,4 @@ int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
#endif
#endif /* _FATFS */
+
diff --git a/Projects/Webserver/Lib/SCSI.c b/Projects/Webserver/Lib/SCSI.c
index a13fd1a35..bf7f5f55c 100644
--- a/Projects/Webserver/Lib/SCSI.c
+++ b/Projects/Webserver/Lib/SCSI.c
@@ -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;
}
+
diff --git a/Projects/Webserver/Lib/SCSI.h b/Projects/Webserver/Lib/SCSI.h
index 4351c571d..c5149caec 100644
--- a/Projects/Webserver/Lib/SCSI.h
+++ b/Projects/Webserver/Lib/SCSI.h
@@ -41,7 +41,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../Descriptors.h"
#include "DataflashManager.h"
diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c
index 5e0a3082e..9225d92f6 100644
--- a/Projects/Webserver/Lib/uIPManagement.c
+++ b/Projects/Webserver/Lib/uIPManagement.c
@@ -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)
{
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
index 8fe656d68..0fd7d68cd 100644
--- a/Projects/Webserver/Lib/uIPManagement.h
+++ b/Projects/Webserver/Lib/uIPManagement.h
@@ -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.
diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c
index 54c626103..c555c4fab 100644
--- a/Projects/Webserver/USBDeviceMode.c
+++ b/Projects/Webserver/USBDeviceMode.c
@@ -62,7 +62,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device =
.AdapterMACAddress = {{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}},
},
};
-
+
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
* passed to all Mass Storage Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
diff --git a/Projects/Webserver/USBHostMode.c b/Projects/Webserver/USBHostMode.c
index 1620cb5d8..524d442ef 100644
--- a/Projects/Webserver/USBHostMode.c
+++ b/Projects/Webserver/USBHostMode.c
@@ -67,7 +67,7 @@ void USBHostMode_USBTask(void)
return;
uIPManagement_ManageNetwork();
-
+
RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface_Host);
}