1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/* tag: openbios qt user interface
*
* Copyright (C) 2003-2004 Stefan Reinauer
*
* See the file "COPYING" for further information about
* the copyright and warranty status of this work.
*/
extern "C" {
#include <pthread.h>
#include <unistd.h>
#include "unix/plugins.h"
#include "unix/plugin_pci.h"
}
#include "gui-qt.h"
#define DEBUG
volatile unsigned char * fb=0;
volatile int gui_running=0;
typedef struct {
int argc;
char **argv;
} threaddata;
void *gui_thread(void *ptr)
{
threaddata *td=(threaddata *)ptr;
QApplication a(td->argc, td->argv);
FrameBufferWidget w;
a.setMainWidget(&w);
w.show();
fb=w.getFrameBuffer();
gui_running=-1;
a.exec();
gui_running=0;
return 0;
}
extern "C" {
extern int plugin_qt_init(void);
int plugin_qt_init(void)
{
pthread_t mythread;
char *args[]={ "plugin_qt" };
threaddata mytd = { 1, args };
#ifdef DEBUG
printf("Initializing \"framebuffer\" plugin...");
#endif
pthread_create(&mythread, NULL, gui_thread, &mytd);
while (!fb)
usleep(20);
#if 0
/* now we have the framebuffer start address.
* updating pci config space to reflect this
*/
#if (BITS > 32)
*(u32 *)(pci_config_space+0x14)=(u32)((unsigned long)fb>>32);
#else
*(u32 *)(pci_config_space+0x14)=0;
#endif
*(u32 *)(pci_config_space+0x10)=(u32)((unsigned long)fb&0xffffffff);
/* next is to write the rom address. We write that at a random
* address in pci config space for now.
*/
#if (BITS > 32)
*(u32 *)(pci_config_space+0x34)=(u32)((unsigned long)qt_fcode>>32);
#else
*(u32 *)(pci_config_space+0x34)=0;
#endif
*(u32 *)(pci_config_space+0x30)=(u32)((unsigned long)qt_fcode&0xffffffff);
/* FIXME: we need to put the fcode image for this
* device to the rom resource, once it exists
*/
/* register pci device to be available to beginagain */
pci_register_device(0, 2, 0, pci_config_space);
#endif
#ifdef DEBUG
printf("done.\n");
#endif
return 0;
}
}
|