blob: a7f8d2c7dd88d730000166ffa8f79248ea2ad965 [file] [log] [blame]
kthacker62e146c2006-04-17 15:11:35 +00001/*
2 * Copyright (c) 2002-2004, 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 operating system
31 *
32 * $Id: main.c,v 1.1 2006/04/17 15:11:44 kthacker Exp $
33 *
34 */
35
36#include "contiki.h"
37
38#include "ctk.h"
39#include "ctk-draw.h"
40#include "ek.h"
41#include "log.h"
42#include "program-handler.h"
43
44#include "uip.h"
45#include "uip_arp.h"
46
47#include "resolv.h"
48
49#include "configedit-dsc.h"
50#include "directory-dsc.h"
51#include "processes-dsc.h"
52
53//#include "cfs-cbm.h"
54#include "cfs-cpc.h"
55
56#include "clock.h"
57
58#include "arch.h"
59
60unsigned char
61uip_fw_forward(void)
62{
63 return 0;
64}
65void
66uip_fw_periodic(void)
67{
68 return;
69}
70/*-----------------------------------------------------------------------------------*/
71EK_EVENTHANDLER(init_eventhandler, ev, data)
72{
73 switch(ev) {
74 case EK_EVENT_INIT:
75 program_handler_load("conio.prg",NULL);
76// program_handler_load("config.prg", NULL);
77 break;
78 }
79}
80/*-----------------------------------------------------------------------------------*/
81EK_PROCESS(init, "Init", EK_PRIO_LOWEST,
82 init_eventhandler, NULL, NULL);
83/*-----------------------------------------------------------------------------------*/
84#if LOG_CONF_ENABLED
85void
86log_message(char *part1, char *part2)
87{
88}
89#endif
90void
91main(void)
92{
93
94 log_message("Starting ", CONTIKI_VERSION_STRING);
95
96 ek_init();
97
98 ek_start(&init);
99
100 // log_message(": TCP/IP", "");
101
102 // tcpip_init(NULL);
103
104 // resolv_init(NULL);
105
106 log_message(": CTK GUI", "");
107 ctk_init();
108
109 log_message(": Initial filesystem", "");
110 cfs_cpc_init(NULL);
111
112 program_handler_init();
113
114 program_handler_add(&directory_dsc, "Directory", 1);
115// program_handler_add(&configedit_dsc, "Configuration", 1);
116 program_handler_add(&processes_dsc, "Processes", 1);
117
118
119 log_message("Starting process scheduling", "");
120
121 while(1) {
122 if(ek_run() == 0) {
123 program_handler_load("welcome.prg", NULL);
124 break;
125 }
126 }
127
128 while(1) {
129 ek_run();
130 }
131}
132/*-----------------------------------------------------------------------------------*/
133void
134reset(void)
135{
136/* asm("lda #$36");
137 asm("sta $01");
138 asm("jmp $fce2");
139*/
140}
141