QNX sample driver

Hi
I am new to QNX, like to understand how to add and build an application and driver.
Please suggest with examples. Right now I have ported i.MX6 QNX BSP on sabresd
board, need to develop applications and drivers.

Thanks

Unlike most OS’s, code that talks directly to hardware (drivers) in QNX does not have to run as part of the kernel. That’s part of why it is called a microkernel.

The most common model for a driver is to build it into a resource manager. Resource manager’s can appear to the system as /dev/ devices which can be opened, read and written to etc.

Another model is for the QNX to provide a resource manager that itself can mount driver code. An example would be the USB manager. In this case, the interface is defined by the resource manager. Other examples would be the file system, or PCMCIA.

A third model is to create a library that accesses the hardware. This is appropriate if only one process will access the hardware.

When writing code you need to check out how ThreadCtl() can you give you I/O privileges.

Thanks for the reply. If I want to create a driver outside the BSP tree, should I create it as static/shared library. SInce in linux terms driver would be a module or built-in. So in these way how do I create a driver inside the BSP tree and outside the BSP. Looking for suggestions

So go ahead and create it outside your BSP tree.

Probably not. In QNX, drivers are usually separate processes.

The internal structure of QNX is completely different. You should read the System Architecture manual for QNX. It’s not long but it will give you some insight. Drivers for QNX are not part of the kernel the way they are for Linux.

The BSP tree is a file system construct. Create your new program inside or outside of that part of the file system as you like.