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.4 2006/02/24 01:35:40 bernie
19 *#* Update for new emulator.
21 *#* Revision 1.3 2006/02/20 02:00:40 bernie
24 *#* Revision 1.2 2006/01/16 03:51:51 bernie
27 *#* Revision 1.1 2006/01/16 03:37:12 bernie
28 *#* Add emulator skeleton.
34 #include <cfg/module.h>
36 #include <appconfig.h>
38 #include <config_kern.h>
42 #include <cstdlib> // std::exit()
45 #include <qapplication.h>
47 #include <QtGui/qapplication.h>
51 /// The global emulator instance.
55 #include <mware/list.h>
57 /// List of process stacks
60 // HACK: Reserve 64KB of stack space for kernel processes
62 int stacks[NPROC][(64 * 1024) / sizeof(int)];
65 Emulator::Emulator(int &argc, char **argv) :
66 emulApp(new QApplication(argc, argv)),
67 emulWin(new EmulWin(this))
69 #if QT_VERSION < ((4 << 16) + (0 << 8) + 0)
70 emulApp->setMainWidget(emulWin);
78 // we don't delete emulWin because it automatically
79 // deletes itself when closed
84 NORETURN void Emulator::quit()
90 // do we have a better way to shut down the emulation?
96 /// Main emulator entry point.
97 extern "C" void emul_init(int *argc, char *argv[])
99 // setup global emulator pointer
100 emul = new Emulator(*argc, argv);
103 LIST_INIT(&StackFreeList);
104 for (int i = 0; i < NPROC; i++)
105 ADDTAIL(&StackFreeList, (Node *)stacks[i]);
111 extern "C" void emul_cleanup()
119 extern "C" void emul_idle()
121 // We process GUI events when the application is idle.
122 emul->emulApp->processEvents();