|  | Home · Overviews · Examples |

# Porting Qtopia Core to a New Architecture

When porting Qtopia Core to a new architecture there are several issues to be aware of: You must provide suitable hardware drivers, and you must ensure to implement platform dependent atomic operations to enable multithreading on the new architecture.

## Hardware Drivers

When running a Qtopia Core application, it either runs as a server or connects to an existing server. All system generated events, including keyboard and mouse events, are passed to the server application which then propagates the event to the appropiate client. When rendering, the default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen.

The various hardware drivers are loaded by the server application when it starts running, using Qt's plugin system.

Derive from the QWSMouseHandler, QWSKeyboardHandler and QScreen classes to create a custom mouse, keyboard and screen driver respectively. To load the drivers into the server application at runtime, you must also create corresponding plugins. See the following documentation for more details:

- Pointer Handling
- Character Input
- Display Management

## Atomic Operations

Using Qt/Embedded, Linux was always supported as long as you had a compiler for the architecture. Starting with Qt 4.0 and Qtopia Core, Qt uses an optimization called implicit sharing for many of its value classes; implicitly shared classes can safely be copied across threads. This technology is implemented using atomic operations.i.e., Qtopia Core requires that platform-specific atomic operations are implemented to support Linux.

When porting Qtopia Core to a new architecture, it is important to ensure that the platform-specific atomic operations are implemented in a corresponding header file, and that this file is located in Qt's `src/corelib/arch` directory.

See the atomic operations documentation for more details.