blob: 35e055abb7b7493d5b619e71efeb528bd40aa00a [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:15: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/*-----------------------------------------------------------------------------------*/
PulkoMandy8f961bf2014-06-28 11:44:31 +020071EK_EVENTHANDLER(eventhandler, ev, data)
kthacker62e146c2006-04-17 15:11:35 +000072{
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/*-----------------------------------------------------------------------------------*/
PulkoMandy8f961bf2014-06-28 11:44:31 +020081const EK_PROCESS(init, "Init", EK_PRIO_LOWEST,
82 eventhandler, NULL, NULL);
kthacker62e146c2006-04-17 15:11:35 +000083/*-----------------------------------------------------------------------------------*/
84#if LOG_CONF_ENABLED
85void
86log_message(char *part1, char *part2)
87{
PulkoMandy8f961bf2014-06-28 11:44:31 +020088 while(*part1 != 0) {
89 putchar(*part1++);
90 }
91
92 while(*part2 != 0) {
93 putchar(*part2++);
94 }
95
96 putchar('\r');
97 putchar('\n');
kthacker62e146c2006-04-17 15:11:35 +000098}
99#endif
PulkoMandy8f961bf2014-06-28 11:44:31 +0200100/*-----------------------------------------------------------------------------------*/
kthacker62e146c2006-04-17 15:11:35 +0000101void
102main(void)
103{
104
PulkoMandy8f961bf2014-06-28 11:44:31 +0200105 log_message("Starting ", CONTIKI_VERSION_STRING);
kthacker62e146c2006-04-17 15:11:35 +0000106
107 ek_init();
108
109 ek_start(&init);
110
111 // log_message(": TCP/IP", "");
112
113 // tcpip_init(NULL);
114
115 // resolv_init(NULL);
116
117 log_message(": CTK GUI", "");
118 ctk_init();
119
120 log_message(": Initial filesystem", "");
121 cfs_cpc_init(NULL);
122
123 program_handler_init();
124
125 program_handler_add(&directory_dsc, "Directory", 1);
126// program_handler_add(&configedit_dsc, "Configuration", 1);
127 program_handler_add(&processes_dsc, "Processes", 1);
128
129
130 log_message("Starting process scheduling", "");
131
132 while(1) {
133 if(ek_run() == 0) {
134 program_handler_load("welcome.prg", NULL);
135 break;
136 }
137 }
138
139 while(1) {
140 ek_run();
141 }
142}
143/*-----------------------------------------------------------------------------------*/
144void
145reset(void)
146{
147/* asm("lda #$36");
148 asm("sta $01");
149 asm("jmp $fce2");
150*/
151}
152