adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2003, Adam Dunkels. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above |
| 11 | * copyright notice, this list of conditions and the following |
| 12 | * disclaimer in the documentation and/or other materials provided |
| 13 | * with the distribution. |
| 14 | * 3. The name of the author may not be used to endorse or promote |
| 15 | * products derived from this software without specific prior |
| 16 | * written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 24 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | * |
| 30 | * This file is part of the Contiki desktop environment |
| 31 | * |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 32 | * $Id: contiki-main.c,v 1.3 2003/11/27 15:56:57 adamdunkels Exp $ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 33 | * |
| 34 | */ |
| 35 | |
| 36 | #include <io.h> |
| 37 | #include <signal.h> |
| 38 | |
| 39 | |
| 40 | #include "ctk.h" |
| 41 | #include "ctk-draw.h" |
| 42 | #include "ctk-vncserver.h" |
| 43 | #include "dispatcher.h" |
| 44 | |
| 45 | |
| 46 | #include "uip_main.h" |
| 47 | #include "uip.h" |
| 48 | #include "uip_arp.h" |
| 49 | #include "resolv.h" |
| 50 | |
| 51 | #include "webserver.h" |
| 52 | #include "program-handler.h" |
| 53 | #include "about-dsc.h" |
| 54 | #include "netconf-dsc.h" |
| 55 | #include "processes-dsc.h" |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 56 | #include "www-dsc.h" |
| 57 | #include "webserver-dsc.h" |
| 58 | |
| 59 | #include "sensorview-dsc.h" |
| 60 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 61 | #include "sensors.h" |
| 62 | |
| 63 | #include "uip.h" |
| 64 | #include "uip_arp.h" |
| 65 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 66 | #include "msp430.h" |
| 67 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 68 | |
| 69 | #include "rs232.h" |
| 70 | void slip_drv_init(char *arg); |
| 71 | |
| 72 | |
| 73 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 74 | static u16_t addr[2]; |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 75 | /*-----------------------------------------------------------------------------------*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 76 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 77 | int |
| 78 | main(int argc, char **argv) |
| 79 | { |
| 80 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 81 | msp430_init(); |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 82 | |
adamdunkels | 36a9266 | 2003-09-05 21:22:48 +0000 | [diff] [blame] | 83 | rs232_init(0); |
| 84 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 85 | sensors_init(); |
| 86 | |
| 87 | rs232_print("uip_init()...\n"); |
| 88 | uip_init(); |
| 89 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 90 | /* rs232_print("resolv_init()...\n"); |
| 91 | resolv_init();*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 92 | |
| 93 | |
| 94 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 95 | #if 0 |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 96 | uip_ipaddr(addr, 193,10,67,150); |
| 97 | uip_sethostaddr(addr); |
| 98 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 99 | /* uip_ipaddr(addr, 193,10,66,195); |
| 100 | resolv_conf(addr);*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 101 | |
| 102 | #else |
| 103 | |
| 104 | uip_ipaddr(addr, 172,16,0,2); |
| 105 | uip_sethostaddr(addr); |
| 106 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 107 | /* uip_ipaddr(addr, 193,10,66,195); |
| 108 | resolv_conf(addr);*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 109 | #endif |
| 110 | |
| 111 | |
| 112 | rs232_print("dispatcher_init()...\n"); |
| 113 | dispatcher_init(); |
| 114 | |
| 115 | |
| 116 | rs232_print("slip_drv_init()...\n"); |
| 117 | slip_drv_init(NULL); |
| 118 | |
| 119 | |
| 120 | rs232_print("ctk_init()...\n"); |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 121 | /* ctk_init();*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 122 | |
| 123 | rs232_print("ctk_vncserver_init()...\n"); |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 124 | /* ctk_vncserver_init(NULL); */ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 125 | |
| 126 | rs232_print("program_handler_init()...\n"); |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 127 | /* program_handler_init();*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 128 | |
| 129 | /* rs232_print("processes_init()...\n"); |
| 130 | processes_init(NULL);*/ |
| 131 | |
| 132 | rs232_print("webserver_init()...\n"); |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 133 | /* webserver_init(NULL);*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 134 | |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 135 | sensorcheck_init(NULL); |
| 136 | |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 137 | |
| 138 | /* program_handler_add(&directory_dsc, "Directory", 1);*/ |
| 139 | /* program_handler_add(&about_dsc, "About", 1);*/ |
| 140 | /* program_handler_add(&webserver_dsc, "Web server", 1);*/ |
| 141 | /* program_handler_add(&www_dsc, "Web browser", 1);*/ |
| 142 | /* program_handler_add(&calc_dsc, "Calculator", 0);*/ |
| 143 | /* program_handler_add(&processes_dsc, "Processes", 0);*/ |
| 144 | |
| 145 | rs232_print("program_handler_addd()...\n"); |
adamdunkels | 72d3248 | 2003-11-27 15:56:57 +0000 | [diff] [blame] | 146 | /* program_handler_add(&sensorview_dsc, "Sensors", 1);*/ |
adamdunkels | 9fcf9d6 | 2003-09-04 19:46:32 +0000 | [diff] [blame] | 147 | |
| 148 | |
| 149 | rs232_print("dispatcher_run()...\n"); |
| 150 | beep(); |
| 151 | dispatcher_run(); |
| 152 | |
| 153 | return 0; |
| 154 | |
| 155 | argv = argv; |
| 156 | argc = argc; |
| 157 | |
| 158 | |
| 159 | |
| 160 | } |
| 161 | /*-----------------------------------------------------------------------------------*/ |
| 162 | char *arg_alloc(char size) {return NULL;} |
| 163 | void arg_init(void) {} |
| 164 | void arg_free(char *arg) {} |
| 165 | /*-----------------------------------------------------------------------------------*/ |