4 * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
5 * Copyright 2000, 2001 Bernardo Innocenti <bernie@codewiz.org>
6 * This file is part of DevLib - See README.devlib for information.
11 * \author Bernardo Innocenti <bernie@develer.com>
13 * \brief Qt-based emulator framework for embedded applications (implementation)
18 *#* Revision 1.6 2006/05/28 12:17:57 bernie
19 *#* Drop almost all the Qt3 cruft.
21 *#* Revision 1.5 2006/05/27 22:30:56 bernie
22 *#* Add some delay to slow things down.
24 *#* Revision 1.4 2006/02/24 01:35:40 bernie
25 *#* Update for new emulator.
27 *#* Revision 1.3 2006/02/20 02:00:40 bernie
30 *#* Revision 1.2 2006/01/16 03:51:51 bernie
33 *#* Revision 1.1 2006/01/16 03:37:12 bernie
34 *#* Add emulator skeleton.
40 #include <cfg/module.h>
42 #include <appconfig.h>
44 #include <config_kern.h>
48 #include <cstdlib> // std::exit()
50 #include <QtGui/qapplication.h>
53 /// The global emulator instance.
57 #include <mware/list.h>
59 /// List of process stacks
62 // HACK: Reserve 64KB of stack space for kernel processes
64 int stacks[NPROC][(64 * 1024) / sizeof(int)];
67 Emulator::Emulator(int &argc, char **argv) :
68 emulApp(new QApplication(argc, argv)),
69 emulWin(new EmulWin(this))
77 // we don't delete emulWin because it automatically
78 // deletes itself when closed
83 NORETURN void Emulator::quit()
89 // do we have a better way to shut down the emulation?
95 /// Main emulator entry point.
96 extern "C" void emul_init(int *argc, char *argv[])
98 // setup global emulator pointer
99 emul = new Emulator(*argc, argv);
102 LIST_INIT(&StackFreeList);
103 for (int i = 0; i < NPROC; i++)
104 ADDTAIL(&StackFreeList, (Node *)stacks[i]);
110 extern "C" void emul_cleanup()
118 extern "C" void emul_idle()
120 // We process GUI events when the application is idle.
121 emul->emulApp->processEvents();