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.5 2006/05/27 22:30:56 bernie
19 *#* Add some delay to slow things down.
21 *#* Revision 1.4 2006/02/24 01:35:40 bernie
22 *#* Update for new emulator.
24 *#* Revision 1.3 2006/02/20 02:00:40 bernie
27 *#* Revision 1.2 2006/01/16 03:51:51 bernie
30 *#* Revision 1.1 2006/01/16 03:37:12 bernie
31 *#* Add emulator skeleton.
37 #include <cfg/module.h>
39 #include <appconfig.h>
41 #include <config_kern.h>
45 #include <cstdlib> // std::exit()
48 #include <qapplication.h>
50 #include <QtGui/qapplication.h>
54 /// The global emulator instance.
58 #include <mware/list.h>
60 /// List of process stacks
63 // HACK: Reserve 64KB of stack space for kernel processes
65 int stacks[NPROC][(64 * 1024) / sizeof(int)];
68 Emulator::Emulator(int &argc, char **argv) :
69 emulApp(new QApplication(argc, argv)),
70 emulWin(new EmulWin(this))
72 #if QT_VERSION < ((4 << 16) + (0 << 8) + 0)
73 emulApp->setMainWidget(emulWin);
81 // we don't delete emulWin because it automatically
82 // deletes itself when closed
87 NORETURN void Emulator::quit()
93 // do we have a better way to shut down the emulation?
99 /// Main emulator entry point.
100 extern "C" void emul_init(int *argc, char *argv[])
102 // setup global emulator pointer
103 emul = new Emulator(*argc, argv);
106 LIST_INIT(&StackFreeList);
107 for (int i = 0; i < NPROC; i++)
108 ADDTAIL(&StackFreeList, (Node *)stacks[i]);
114 extern "C" void emul_cleanup()
122 extern "C" void emul_idle()
124 // We process GUI events when the application is idle.
125 emul->emulApp->processEvents();