Fix DHCPClient init code in the Webserver project writing to the incorrect applicatio...
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 12 Feb 2010 05:05:03 +0000 (05:05 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 12 Feb 2010 05:05:03 +0000 (05:05 +0000)
Projects/Webserver/Lib/DHCPClientApp.c
Projects/Webserver/Lib/uip/uipopt.h
Projects/Webserver/makefile

index 2097062..0e51d57 100644 (file)
@@ -43,17 +43,19 @@ struct timer DHCPTimer;
 /** Initialization function for the DHCP client. */\r
 void DHCPClientApp_Init(void)\r
 {\r
-       uip_udp_appstate_t* const AppState = &uip_udp_conn->appstate;\r
-       \r
-       /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */\r
+       /* Create an IP address to the broadcast network address */\r
        uip_ipaddr_t DHCPServerIPAddress;\r
        uip_ipaddr(&DHCPServerIPAddress, 255, 255, 255, 255);\r
-       AppState->DHCPClient.Connection = uip_udp_new(&DHCPServerIPAddress, HTONS(DHCPC_SERVER_PORT));\r
+\r
+       /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */\r
+       struct uip_udp_conn* Connection = uip_udp_new(&DHCPServerIPAddress, HTONS(DHCPC_SERVER_PORT));\r
        \r
        /* If the connection was successfully created, bind it to the local DHCP client port */\r
-       if(AppState->DHCPClient.Connection != NULL)\r
+       if (Connection != NULL)\r
        {\r
-               uip_udp_bind(AppState->DHCPClient.Connection, HTONS(DHCPC_CLIENT_PORT));\r
+               uip_udp_appstate_t* const AppState = &Connection->appstate;\r
+\r
+               uip_udp_bind(Connection, HTONS(DHCPC_CLIENT_PORT));\r
                AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;\r
        }\r
 \r
@@ -188,13 +190,13 @@ uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMes
        DHCPHeader->TransactionID         = DHCP_TRANSACTION_ID;\r
        DHCPHeader->ElapsedSeconds        = 0;\r
        DHCPHeader->Flags                 = HTONS(BOOTP_BROADCAST);\r
-       memcpy(&DHCPHeader->ClientIP, &uip_hostaddr, sizeof(uip_ipaddr_t));\r
-       memcpy(&DHCPHeader->YourIP, &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));\r
-       memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));\r
+       memcpy(&DHCPHeader->ClientIP,     &uip_hostaddr,        sizeof(uip_ipaddr_t));\r
+       memcpy(&DHCPHeader->YourIP,       &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));\r
+       memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP,    sizeof(uip_ipaddr_t));\r
        memcpy(&DHCPHeader->ClientHardwareAddress, &MACAddress, sizeof(struct uip_eth_addr));\r
        DHCPHeader->Cookie                = DHCP_MAGIC_COOKIE;\r
        \r
-       /* Add a DHCP type and terminator options to the start of the DHCP options field */\r
+       /* Add a DHCP message type and terminator options to the start of the DHCP options field */\r
        DHCPHeader->Options[0]            = DHCP_OPTION_MSG_TYPE;\r
        DHCPHeader->Options[1]            = 1;\r
        DHCPHeader->Options[2]            = DHCPMessageType;\r
index c8d0cd2..8a09c72 100644 (file)
@@ -717,7 +717,6 @@ typedef union
        struct
        {
                uint8_t CurrentState;
-               struct  uip_udp_conn* Connection;
                
                struct
                {
index 2097988..b0e26f3 100644 (file)
@@ -119,6 +119,7 @@ LUFA_PATH = ../../
 LUFA_OPTS  = -D FIXED_CONTROL_ENDPOINT_SIZE=8\r
 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1\r
 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS\r
+LUFA_OPTS += -D FAST_STREAM_TRANSFERS\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r