|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the documentation of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 /*! |
|
43 \page qt-embedded-porting-operatingsystem.html |
|
44 |
|
45 \title Porting Qt for Embedded Linux to Another Operating System |
|
46 \ingroup qt-embedded-linux |
|
47 |
|
48 \l{Qt for Embedded Linux} is reasonably platform-independent, making use of |
|
49 the standard C library and some POSIX functions, but only a Linux |
|
50 implementation is publically available. If you are looking for a |
|
51 non-Linux commercial implementation, it is worth contacting \l |
|
52 {mailto:qt-info@nokia.com}{qt-info@nokia.com} to see if we can |
|
53 help. |
|
54 |
|
55 There are several issues to be aware of if you plan to do your own |
|
56 port to another operating system. In particular you must resolve |
|
57 \l{Qt for Embedded Linux}'s shared memory and semaphores (used to share |
|
58 window regions), and you must provide something similar to |
|
59 Unix-domain sockets for inter-application communication. You must |
|
60 also provide a screen driver, and if you want to implement sound |
|
61 you must provide your own sound server. Finally you must modify |
|
62 the event dispatcher used by \l{Qt for Embedded Linux}. |
|
63 |
|
64 Contents: |
|
65 |
|
66 \tableofcontents |
|
67 |
|
68 \section1 Shared Memory and Semaphores |
|
69 |
|
70 \l{Qt for Embedded Linux} uses System V IPC (shared memory and semaphores) |
|
71 to share window regions between client and server. When porting, |
|
72 something similar must be provided; otherwise it will not be |
|
73 possible to run multiple applications. |
|
74 |
|
75 System V semaphores are also used for synchronizing access to the |
|
76 framebuffer. |
|
77 |
|
78 \list |
|
79 \o Modify \c qsharedmemory_p.cpp |
|
80 \o Modify \c qlock_qws.cpp |
|
81 \o Modify \c qwslock.cpp |
|
82 \endlist |
|
83 |
|
84 \section1 Inter-Application Communication |
|
85 |
|
86 To communicate between applications, \l{Qt for Embedded Linux} uses the |
|
87 Unix-domain sockets. When porting, something similar must be |
|
88 provided; otherwise it will not be possible to run multiple |
|
89 applications. |
|
90 |
|
91 It should be possible to use message queues or similar mechanisms |
|
92 to achieve this. With the exception of QCOP messages, individual |
|
93 messages should be no more than a few bytes in length (QCOP |
|
94 messages are generated by the client applications and not Qt for |
|
95 Embedded Linux). |
|
96 |
|
97 \list |
|
98 \o Modify \c qwssocket_qws.cpp |
|
99 \endlist |
|
100 |
|
101 \section1 Screen Management |
|
102 |
|
103 When rendering, the default behavior in \l{Qt for Embedded Linux} is |
|
104 for each client to render its widgets into memory while the server is |
|
105 responsible for putting the contents of the memory onto the screen |
|
106 using the screen driver. |
|
107 |
|
108 When porting, a new screen driver must be implemented, providing a |
|
109 byte pointer to a memory-mapped framebuffer and information about |
|
110 width, height and bit depth (the latter information can most |
|
111 likely be hard-coded). |
|
112 |
|
113 \list |
|
114 \o Reimplement \c qscreen_qws.cpp |
|
115 \endlist |
|
116 |
|
117 \section1 Sound Management |
|
118 |
|
119 To implement sound, \l{Qt for Embedded Linux} uses a Linux style device (\c |
|
120 /dev/dsp). If you want to use the \l{Qt for Embedded Linux} sound server on |
|
121 another platform you must reimplement it. |
|
122 |
|
123 \list |
|
124 \o Reimplement \c qsoundqss_qws.cpp |
|
125 \endlist |
|
126 |
|
127 \section1 Event Dispatching |
|
128 |
|
129 \l{Qt for Embedded Linux} uses an event dispatcher to pass events to and |
|
130 from the \l{Qt for Embedded Linux} server application. Reimplement the \c |
|
131 select() function to enable \l{Qt for Embedded Linux} to dispatch events on |
|
132 your platform. |
|
133 |
|
134 \list |
|
135 \o Modify \c qeventdispatcher_qws.cpp |
|
136 \endlist |
|
137 */ |
|
138 |
|
139 /*! |
|
140 \page qt-embedded-porting-device.html |
|
141 |
|
142 \title Porting Qt for Embedded Linux to a New Architecture |
|
143 \ingroup qt-embedded-linux |
|
144 |
|
145 When porting \l{Qt for Embedded Linux} to a new architecture there are |
|
146 several issues to be aware of: You must provide suitable hardware |
|
147 drivers, and you must ensure to implement platform dependent |
|
148 atomic operations to enable multithreading on the new |
|
149 architecture. |
|
150 |
|
151 \section1 Hardware Drivers |
|
152 |
|
153 When running a \l{Qt for Embedded Linux} application, it either runs as a |
|
154 server or connects to an existing server. All system generated |
|
155 events, including keyboard and mouse events, are passed to the |
|
156 server application which then propagates the event to the |
|
157 appropriate client. When rendering, the default behavior is for |
|
158 each client to render its widgets into memory while the server is |
|
159 responsible for putting the contents of the memory onto the |
|
160 screen. |
|
161 |
|
162 The various hardware drivers are loaded by the server |
|
163 application when it starts running, using Qt's \l {How to Create |
|
164 Qt Plugins}{plugin system}. |
|
165 |
|
166 Derive from the QWSMouseHandler, QWSKeyboardHandler and QScreen |
|
167 classes to create a custom mouse, keyboard and screen driver |
|
168 respectively. To load the drivers into the server application at |
|
169 runtime, you must also create corresponding plugins. See the |
|
170 following documentation for more details: |
|
171 |
|
172 \list |
|
173 \o \l{Qt for Embedded Linux Pointer Handling}{Pointer Handling} |
|
174 \o \l{Qt for Embedded Linux Character Input}{Character Input} |
|
175 \o \l{Qt for Embedded Linux Display Management}{Display Management} |
|
176 \endlist |
|
177 |
|
178 \section1 Atomic Operations |
|
179 |
|
180 Qt uses an optimization called \l {Implicitly Shared Classes}{implicit sharing} |
|
181 for many of its value classes; implicitly shared classes can safely be |
|
182 copied across threads. This technology is implemented using atomic |
|
183 operations; i.e., \l{Qt for Embedded Linux} requires that platform-specific |
|
184 atomic operations are implemented to support Linux. |
|
185 |
|
186 When porting \l{Qt for Embedded Linux} to a new architecture, it is |
|
187 important to ensure that the platform-specific atomic operations |
|
188 are implemented in a corresponding header file, and that this file |
|
189 is located in Qt's \c src/corelib/arch directory. |
|
190 |
|
191 See the \l {Implementing Atomic Operations}{atomic operations} |
|
192 documentation for more details. |
|
193 */ |