adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2002, 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. All advertising materials mentioning features or use of this |
| 15 | * software must display the following acknowledgement: |
| 16 | * This product includes software developed by Adam Dunkels. |
| 17 | * 4. The name of the author may not be used to endorse or promote |
| 18 | * products derived from this software without specific prior |
| 19 | * written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 22 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 25 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 27 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | * |
| 33 | * This file is part of the Contiki desktop environment |
| 34 | * |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 35 | * $Id: contiki-main.c,v 1.4 2004/07/04 19:51:19 adamdunkels Exp $ |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 36 | * |
| 37 | */ |
| 38 | |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 39 | #include "contiki.h" |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 40 | #include "ctk-draw.h" |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 41 | #include "ek.h" |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 42 | |
| 43 | #include "program-handler.h" |
adamdunkels | 0bde665 | 2003-09-07 18:13:16 +0000 | [diff] [blame] | 44 | #include "processes-dsc.h" |
| 45 | #include "about-dsc.h" |
| 46 | #include "netconf-dsc.h" |
| 47 | #include "memstat-dsc.h" |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 48 | |
adamdunkels | 07476a0 | 2004-06-06 06:35:12 +0000 | [diff] [blame] | 49 | #include "uiplib.h" |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 50 | #include "uip.h" |
| 51 | #include "uip_arp.h" |
| 52 | #if WITH_TFE |
| 53 | #include "cs8900a.h" |
| 54 | #endif /* WITH_TFE */ |
| 55 | #include "resolv.h" |
| 56 | |
| 57 | |
| 58 | |
| 59 | /*-----------------------------------------------------------------------------------*/ |
| 60 | int |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 61 | main(void) |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 62 | { |
adamdunkels | 0bde665 | 2003-09-07 18:13:16 +0000 | [diff] [blame] | 63 | /* toggle_videomode(); */ /* Turn on 80 column mode */ |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 64 | |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 65 | ek_init(); |
adamdunkels | 0bde665 | 2003-09-07 18:13:16 +0000 | [diff] [blame] | 66 | |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 67 | #ifdef WITH_UIP |
| 68 | uip_init(); |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 69 | tcpip_init(); |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 70 | resolv_init(); |
| 71 | |
| 72 | #ifdef WITH_TFE |
| 73 | cs8900a_init(); |
| 74 | #endif /* WITH_TFE */ |
| 75 | |
| 76 | |
| 77 | #ifdef WITH_RS232 |
| 78 | rs232dev_init(); |
| 79 | #endif /* WITH_RS232 */ |
| 80 | |
| 81 | #ifdef WITH_TAPDEV |
| 82 | tapdev_init(); |
| 83 | #endif /* WITH_TAPDEV */ |
| 84 | |
| 85 | |
| 86 | #endif /* WITH_UIP */ |
| 87 | |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 88 | ctk_init(); |
| 89 | |
| 90 | program_handler_init(); |
adamdunkels | 0bde665 | 2003-09-07 18:13:16 +0000 | [diff] [blame] | 91 | program_handler_add(&about_dsc, "About", 1); |
| 92 | program_handler_add(&netconf_dsc, "Netconf", 1); |
| 93 | program_handler_add(&processes_dsc, "Processes", 1); |
| 94 | program_handler_add(&memstat_dsc, "Memory stats", 1); |
| 95 | |
| 96 | |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 97 | while(1) { |
| 98 | ek_run(); |
| 99 | } |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 100 | |
| 101 | clrscr(); |
| 102 | |
| 103 | return 0; |
adamdunkels | 42071e2 | 2003-04-08 18:08:24 +0000 | [diff] [blame] | 104 | } |
| 105 | /*-----------------------------------------------------------------------------------*/ |
adamdunkels | 78b7a82 | 2004-07-04 19:51:19 +0000 | [diff] [blame] | 106 | clock_time_t |
| 107 | clock_time(void) |
adamdunkels | 07476a0 | 2004-06-06 06:35:12 +0000 | [diff] [blame] | 108 | { |
| 109 | return clock(); |
| 110 | } |