blob: 6bd890f934d34a497880dc86bfc55809b8eaf140 [file] [log] [blame]
/*
* Copyright 2021, Adrien Destugues, pulkomandy@pulkomandy.tk
* Distributed under terms of the MIT license.
*/
// Contiki includes
#include "ctk.h"
#include "clock-conf.h"
#include "program-handler.h"
// Applications
#include "netconf-dsc.h"
#include "dhcp-dsc.h"
#include "www-dsc.h"
#include "webserver-dsc.h"
#include "ftp-dsc.h"
#include "telnet-dsc.h"
#include "email-dsc.h"
#include "irc-dsc.h"
#include "editor-dsc.h"
#include "calc-dsc.h"
#include "processes-dsc.h"
#include "shell-dsc.h"
#include "about-dsc.h"
// Use the vga_frame counter as a main clock. It would be nice to have a
// millisecond-precision (or more) clock, but this will do for now.
clock_time_t clock_time(void)
{
return 0;
}
// For debugging purposes only. Actually I didn't see it being called yet.
void
log_message(const char *part1, const char *part2)
{
//printf("%s%s\n", part1, part2);
}
int main(void)
{
static volatile int* const SYSTEM_CTRL = 0x3d20;
static volatile int* const WATCHDOG_CLEAR = 0x3d24;
*SYSTEM_CTRL = 0;
*WATCHDOG_CLEAR = 0x55aa;
ek_init();
conio_init();
ctk_init();
program_handler_init();
#if 0
#if 0
program_handler_add(&netconf_dsc, "Network setup", 1);
program_handler_add(&dhcp_dsc, "DHCP client", 1);
program_handler_add(&www_dsc, "Web browser", 1);
program_handler_add(&webserver_dsc, "Web server", 1);
program_handler_add(&ftp_dsc, "FTP client", 1);
program_handler_add(&telnet_dsc, "Telnet", 1);
program_handler_add(&email_dsc, "E-mail", 1);
program_handler_add(&irc_dsc, "IRC client", 1);
#endif
program_handler_add(&editor_dsc, "Editor", 1);
#endif
program_handler_add(&calc_dsc, "Calculator", 1);
program_handler_add(&processes_dsc, "Processes", 1);
#if 0
program_handler_add(&shell_dsc, "Command shell", 1);
#endif
program_handler_add(&about_dsc, "About Contiki", 0);
// Call ek_run until everything is initialized. Then, load welcome.prg.
while(1) {
if(ek_run() == 0) {
welcome_init();
break;
}
}
// Run the main loop.
while(1) {
if (ek_run() == 0) {
// We are out of events to run, sleep a little.
// TODO wait_vsync(1);
}
}
return 0;
}