blob: 6bd890f934d34a497880dc86bfc55809b8eaf140 [file] [log] [blame]
PulkoMandy612e2cf2021-09-20 23:00:40 +02001/*
2 * Copyright 2021, Adrien Destugues, pulkomandy@pulkomandy.tk
3 * Distributed under terms of the MIT license.
4 */
5
6// Contiki includes
7#include "ctk.h"
8
9#include "clock-conf.h"
10
11#include "program-handler.h"
12
13// Applications
14#include "netconf-dsc.h"
15#include "dhcp-dsc.h"
16#include "www-dsc.h"
17#include "webserver-dsc.h"
18#include "ftp-dsc.h"
19#include "telnet-dsc.h"
20#include "email-dsc.h"
21#include "irc-dsc.h"
22#include "editor-dsc.h"
23#include "calc-dsc.h"
24#include "processes-dsc.h"
25#include "shell-dsc.h"
26#include "about-dsc.h"
27
28// Use the vga_frame counter as a main clock. It would be nice to have a
29// millisecond-precision (or more) clock, but this will do for now.
30clock_time_t clock_time(void)
31{
32 return 0;
33}
34
35// For debugging purposes only. Actually I didn't see it being called yet.
36void
37log_message(const char *part1, const char *part2)
38{
39 //printf("%s%s\n", part1, part2);
40}
41
42
43int main(void)
44{
45 static volatile int* const SYSTEM_CTRL = 0x3d20;
46 static volatile int* const WATCHDOG_CLEAR = 0x3d24;
47
48 *SYSTEM_CTRL = 0;
49 *WATCHDOG_CLEAR = 0x55aa;
50
51 ek_init();
52 conio_init();
53 ctk_init();
54
55 program_handler_init();
56#if 0
57#if 0
58 program_handler_add(&netconf_dsc, "Network setup", 1);
59 program_handler_add(&dhcp_dsc, "DHCP client", 1);
60 program_handler_add(&www_dsc, "Web browser", 1);
61 program_handler_add(&webserver_dsc, "Web server", 1);
62 program_handler_add(&ftp_dsc, "FTP client", 1);
63 program_handler_add(&telnet_dsc, "Telnet", 1);
64 program_handler_add(&email_dsc, "E-mail", 1);
65 program_handler_add(&irc_dsc, "IRC client", 1);
66#endif
67 program_handler_add(&editor_dsc, "Editor", 1);
PulkoMandy42349612021-09-23 22:18:46 +020068#endif
PulkoMandy612e2cf2021-09-20 23:00:40 +020069 program_handler_add(&calc_dsc, "Calculator", 1);
70 program_handler_add(&processes_dsc, "Processes", 1);
PulkoMandy42349612021-09-23 22:18:46 +020071#if 0
PulkoMandy612e2cf2021-09-20 23:00:40 +020072 program_handler_add(&shell_dsc, "Command shell", 1);
73#endif
74 program_handler_add(&about_dsc, "About Contiki", 0);
75
76 // Call ek_run until everything is initialized. Then, load welcome.prg.
77 while(1) {
78 if(ek_run() == 0) {
PulkoMandy5500b682021-09-21 21:27:13 +020079 welcome_init();
PulkoMandy612e2cf2021-09-20 23:00:40 +020080 break;
81 }
82 }
83
84 // Run the main loop.
85 while(1) {
86 if (ek_run() == 0) {
87 // We are out of events to run, sleep a little.
88 // TODO wait_vsync(1);
89 }
90 }
91
92 return 0;
93}