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