kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 60 | unsigned char |
| 61 | uip_fw_forward(void) |
| 62 | { |
| 63 | return 0; |
| 64 | } |
| 65 | void |
| 66 | uip_fw_periodic(void) |
| 67 | { |
| 68 | return; |
| 69 | } |
| 70 | /*-----------------------------------------------------------------------------------*/ |
PulkoMandy | 8f961bf | 2014-06-28 11:44:31 +0200 | [diff] [blame] | 71 | EK_EVENTHANDLER(eventhandler, ev, data) |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 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 | /*-----------------------------------------------------------------------------------*/ |
PulkoMandy | 73da4fe | 2014-06-28 17:06:01 +0200 | [diff] [blame] | 81 | EK_PROCESS(init, "Init", EK_PRIO_LOWEST, |
PulkoMandy | 8f961bf | 2014-06-28 11:44:31 +0200 | [diff] [blame] | 82 | eventhandler, NULL, NULL); |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 83 | /*-----------------------------------------------------------------------------------*/ |
| 84 | #if LOG_CONF_ENABLED |
PulkoMandy | 81050b8 | 2023-05-06 22:16:49 +0200 | [diff] [blame^] | 85 | #define putchar ((void(*)(char))(0xBB5A)) |
| 86 | |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 87 | void |
| 88 | log_message(char *part1, char *part2) |
| 89 | { |
PulkoMandy | 8f961bf | 2014-06-28 11:44:31 +0200 | [diff] [blame] | 90 | while(*part1 != 0) { |
| 91 | putchar(*part1++); |
| 92 | } |
| 93 | |
| 94 | while(*part2 != 0) { |
| 95 | putchar(*part2++); |
| 96 | } |
| 97 | |
| 98 | putchar('\r'); |
| 99 | putchar('\n'); |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 100 | } |
| 101 | #endif |
PulkoMandy | 8f961bf | 2014-06-28 11:44:31 +0200 | [diff] [blame] | 102 | /*-----------------------------------------------------------------------------------*/ |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 103 | void |
| 104 | main(void) |
| 105 | { |
| 106 | |
PulkoMandy | 8f961bf | 2014-06-28 11:44:31 +0200 | [diff] [blame] | 107 | log_message("Starting ", CONTIKI_VERSION_STRING); |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 108 | |
| 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 | |
PulkoMandy | 73da4fe | 2014-06-28 17:06:01 +0200 | [diff] [blame] | 134 | while(ek_run()); |
| 135 | |
| 136 | program_handler_load("welcome.prg", NULL); |
PulkoMandy | df6b0dd | 2014-06-29 16:19:08 +0200 | [diff] [blame] | 137 | |
PulkoMandy | 73da4fe | 2014-06-28 17:06:01 +0200 | [diff] [blame] | 138 | for(;;) { |
kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 139 | ek_run(); |
| 140 | } |
| 141 | } |
| 142 | /*-----------------------------------------------------------------------------------*/ |
| 143 | void |
| 144 | reset(void) |
| 145 | { |
| 146 | /* asm("lda #$36"); |
| 147 | asm("sta $01"); |
| 148 | asm("jmp $fce2"); |
| 149 | */ |
| 150 | } |
| 151 | |