blob: a6462125d31d93788ec46d40c5fc62fb95a29bf4 [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/*-----------------------------------------------------------------------------------*/
PulkoMandy73da4fe2014-06-28 17:06:01 +020081EK_PROCESS(init, "Init", EK_PRIO_LOWEST,
PulkoMandy8f961bf2014-06-28 11:44:31 +020082 eventhandler, NULL, NULL);
kthacker62e146c2006-04-17 15:11:35 +000083/*-----------------------------------------------------------------------------------*/
84#if LOG_CONF_ENABLED
PulkoMandy81050b82023-05-06 22:16:49 +020085#define putchar ((void(*)(char))(0xBB5A))
86
kthacker62e146c2006-04-17 15:11:35 +000087void
88log_message(char *part1, char *part2)
89{
PulkoMandy8f961bf2014-06-28 11:44:31 +020090 while(*part1 != 0) {
91 putchar(*part1++);
92 }
93
94 while(*part2 != 0) {
95 putchar(*part2++);
96 }
97
98 putchar('\r');
99 putchar('\n');
kthacker62e146c2006-04-17 15:11:35 +0000100}
101#endif
PulkoMandy8f961bf2014-06-28 11:44:31 +0200102/*-----------------------------------------------------------------------------------*/
kthacker62e146c2006-04-17 15:11:35 +0000103void
104main(void)
105{
106
PulkoMandy8f961bf2014-06-28 11:44:31 +0200107 log_message("Starting ", CONTIKI_VERSION_STRING);
kthacker62e146c2006-04-17 15:11:35 +0000108
109 ek_init();
110
111 ek_start(&init);
112
113 // log_message(": TCP/IP", "");
114
115 // tcpip_init(NULL);
116
117 // resolv_init(NULL);
118
119 log_message(": CTK GUI", "");
120 ctk_init();
121
122 log_message(": Initial filesystem", "");
123 cfs_cpc_init(NULL);
124
125 program_handler_init();
126
127 program_handler_add(&directory_dsc, "Directory", 1);
128// program_handler_add(&configedit_dsc, "Configuration", 1);
129 program_handler_add(&processes_dsc, "Processes", 1);
130
131
132 log_message("Starting process scheduling", "");
133
PulkoMandy73da4fe2014-06-28 17:06:01 +0200134 while(ek_run());
135
136 program_handler_load("welcome.prg", NULL);
PulkoMandydf6b0dd2014-06-29 16:19:08 +0200137
PulkoMandy73da4fe2014-06-28 17:06:01 +0200138 for(;;) {
kthacker62e146c2006-04-17 15:11:35 +0000139 ek_run();
140 }
141}
142/*-----------------------------------------------------------------------------------*/
143void
144reset(void)
145{
146/* asm("lda #$36");
147 asm("sta $01");
148 asm("jmp $fce2");
149*/
150}
151