diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-27 13:15:49 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-27 13:15:49 +0000 |
commit | a960e4b3b2ae72c6c3573fb690a1b9cde1642bc0 (patch) | |
tree | 97eeeedafe3c60ce692f6eec00e9427866a4b8d1 /Projects/Webserver/Lib/uip | |
parent | 1aeb5056d6943331ee2d11807bcc0a6480ad1ca0 (diff) | |
download | lufa-a960e4b3b2ae72c6c3573fb690a1b9cde1642bc0.tar.gz lufa-a960e4b3b2ae72c6c3573fb690a1b9cde1642bc0.tar.bz2 lufa-a960e4b3b2ae72c6c3573fb690a1b9cde1642bc0.zip |
Add DHCP server to the Webserver demo for automatic network configuration. Correct uIP timer clock not tracking the correct timespan.
Diffstat (limited to 'Projects/Webserver/Lib/uip')
-rw-r--r-- | Projects/Webserver/Lib/uip/conf/apps-conf.h | 23 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/conf/clock-arch.c | 3 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/conf/global-conf.h | 4 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/conf/uip-conf.h | 6 |
4 files changed, 22 insertions, 14 deletions
diff --git a/Projects/Webserver/Lib/uip/conf/apps-conf.h b/Projects/Webserver/Lib/uip/conf/apps-conf.h index 22bab81bf..fc9727dcd 100644 --- a/Projects/Webserver/Lib/uip/conf/apps-conf.h +++ b/Projects/Webserver/Lib/uip/conf/apps-conf.h @@ -1,20 +1,29 @@ #ifndef __APPS_CONF_H__
#define __APPS_CONF_H__
- enum Webserver_States_t
- {
- WEBSERVER_STATE_SendHeaders,
- WEBSERVER_STATE_SendData,
- WEBSERVER_STATE_Closed,
- };
-
typedef struct
{
uint8_t CurrentState;
char* SendPos;
} uip_tcp_appstate_t;
+ typedef struct
+ {
+ uint8_t CurrentState;
+ struct uip_udp_conn* Connection;
+
+ struct
+ {
+ uint8_t AllocatedIP[4];
+ uint8_t Netmask[4];
+ uint8_t GatewayIP[4];
+ uint8_t ServerIP[4];
+ } DHCPOffer_Data;
+ } uip_udp_appstate_t;
+
#define UIP_APPCALL WebserverApp_Callback
+ #define UIP_UDP_APPCALL DHCPApp_Callback
void UIP_APPCALL(void);
+ void UIP_UDP_APPCALL(void);
#endif /*__APPS_CONF_H__*/
diff --git a/Projects/Webserver/Lib/uip/conf/clock-arch.c b/Projects/Webserver/Lib/uip/conf/clock-arch.c index 8363d96e0..2007de4e9 100644 --- a/Projects/Webserver/Lib/uip/conf/clock-arch.c +++ b/Projects/Webserver/Lib/uip/conf/clock-arch.c @@ -21,8 +21,7 @@ ISR(TIMER1_COMPA_vect) void clock_init()
{
OCR1A = ((F_CPU / 1024) / 100); - TCCR1A = (1 << WGM12); - TCCR1B = ((1 << CS12) | (1 << CS10)); + TCCR1B = ((1 << WGM12) | (1 << CS12) | (1 << CS10)); TIMSK1 = (1 << OCIE1A); } diff --git a/Projects/Webserver/Lib/uip/conf/global-conf.h b/Projects/Webserver/Lib/uip/conf/global-conf.h index a9f118d4d..5cfc60746 100644 --- a/Projects/Webserver/Lib/uip/conf/global-conf.h +++ b/Projects/Webserver/Lib/uip/conf/global-conf.h @@ -2,10 +2,6 @@ #ifndef __GLOBAL_CONF_H__
#define __GLOBAL_CONF_H__
-//Define frequency
-// #define F_CPU 12500000UL
-//
-
//Include uip.h gives all the uip configurations in uip-conf.h
#include "uip.h"
diff --git a/Projects/Webserver/Lib/uip/conf/uip-conf.h b/Projects/Webserver/Lib/uip/conf/uip-conf.h index d3d9bc453..e89e7c4c6 100644 --- a/Projects/Webserver/Lib/uip/conf/uip-conf.h +++ b/Projects/Webserver/Lib/uip/conf/uip-conf.h @@ -79,7 +79,11 @@ typedef unsigned short uip_stats_t; *
* \hideinitializer
*/
-#define UIP_CONF_UDP 0
+#if defined(ENABLE_DHCP)
+ #define UIP_CONF_UDP 1
+#else
+ #define UIP_CONF_UDP 0
+#endif
/**
* UDP checksums on or off
|