Made use of the new high-level config macros.

This commit is contained in:
oliverschmidt 2007-12-23 12:33:57 +00:00
parent 125f261b7d
commit 14a8cf7200
3 changed files with 38 additions and 7 deletions

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: config.c,v 1.5 2007/12/21 01:04:29 oliverschmidt Exp $ * $Id: config.c,v 1.6 2007/12/23 12:33:57 oliverschmidt Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -89,7 +89,7 @@ config_read(char *filename)
log_message("IP Address: ", ipaddrtoa(&config.hostaddr, uip_buf)); log_message("IP Address: ", ipaddrtoa(&config.hostaddr, uip_buf));
log_message("Subnet Mask: ", ipaddrtoa(&config.netmask, uip_buf)); log_message("Subnet Mask: ", ipaddrtoa(&config.netmask, uip_buf));
log_message("Def. Router: ", ipaddrtoa(&config.draddr, uip_buf)); log_message("Def. Router: ", ipaddrtoa(&config.draddr, uip_buf));
//log_message("DNS Server: ", ipaddrtoa(&config.resolvaddr, uip_buf)); log_message("DNS Server: ", ipaddrtoa(&config.resolvaddr, uip_buf));
log_message("Eth. Driver: ", config.ethernetcfg.name); log_message("Eth. Driver: ", config.ethernetcfg.name);
log_message("Driver Port: $", utoa(config.ethernetcfg.addr, uip_buf, 16)); log_message("Driver Port: $", utoa(config.ethernetcfg.addr, uip_buf, 16));
@ -97,7 +97,9 @@ config_read(char *filename)
uip_sethostaddr(&config.hostaddr); uip_sethostaddr(&config.hostaddr);
uip_setnetmask(&config.netmask); uip_setnetmask(&config.netmask);
uip_setdraddr(&config.draddr); uip_setdraddr(&config.draddr);
//resolv_conf(&config.resolvaddr); #if WITH_DNS
resolv_conf(&config.resolvaddr);
#endif /* WITH_DNS */
return &config.ethernetcfg; return &config.ethernetcfg;
} }

View file

@ -30,15 +30,30 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: contiki-main.c,v 1.12 2007/12/16 13:08:09 oliverschmidt Exp $ * $Id: contiki-main.c,v 1.13 2007/12/23 12:35:38 oliverschmidt Exp $
*/ */
#include "contiki-net.h" #include "contiki-net.h"
#include "ctk/ctk.h"
#include "sys/log.h" #include "sys/log.h"
#include "lib/config.h" #include "lib/config.h"
#include "net/ethernet-drv.h" #include "net/ethernet-drv.h"
#if WITH_GUI
#define CTK_PROCESS &ctk_process,
#else /* WITH_GUI */
#define CTK_PROCESS
#endif /* WITH_GUI */
#if WITH_DNS
#define RESOLV_PROCESS &resolv_process,
#else /* WITH_DNS */
#define RESOLV_PROCESS
#endif /* WITH_DNS */
PROCINIT(&etimer_process, PROCINIT(&etimer_process,
CTK_PROCESS
RESOLV_PROCESS
&tcpip_process); &tcpip_process);
void clock_update(void); void clock_update(void);

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: contiki-main.c,v 1.13 2007/12/20 22:54:22 oliverschmidt Exp $ * $Id: contiki-main.c,v 1.14 2007/12/23 12:35:03 oliverschmidt Exp $
*/ */
#include <string.h> #include <string.h>
@ -41,7 +41,21 @@
#include "lib/config.h" #include "lib/config.h"
#include "net/ethernet-drv.h" #include "net/ethernet-drv.h"
#if WITH_GUI
#define CTK_PROCESS &ctk_process,
#else /* WITH_GUI */
#define CTK_PROCESS
#endif /* WITH_GUI */
#if WITH_DNS
#define RESOLV_PROCESS &resolv_process,
#else /* WITH_DNS */
#define RESOLV_PROCESS
#endif /* WITH_DNS */
PROCINIT(&etimer_process, PROCINIT(&etimer_process,
CTK_PROCESS
RESOLV_PROCESS
&tcpip_process); &tcpip_process);
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
@ -106,7 +120,7 @@ main(void)
process_start((struct process *)&ethernet_process, (char *)ethernet_config); process_start((struct process *)&ethernet_process, (char *)ethernet_config);
#if CTK_CONF_MOUSE_SUPPORT #if (WITH_GUI && WITH_MOUSE)
{ {
static const u8_t mouse_sprite[64] = { static const u8_t mouse_sprite[64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -121,7 +135,7 @@ main(void)
memcpy((void*)0x0340, mouse_sprite, sizeof(mouse_sprite)); memcpy((void*)0x0340, mouse_sprite, sizeof(mouse_sprite));
*(u8_t*)0x07F8 = 0x0340 / 64; *(u8_t*)0x07F8 = 0x0340 / 64;
} }
#endif /* CTK_CONF_MOUSE_SUPPORT */ #endif /* WITH_GUI && WITH_MOUSE */
log_message("Contiki up and running ...", ""); log_message("Contiki up and running ...", "");