HELP TO WRITE A QNX DEVICE DRIVER

i have been assigned to develop a device driver for Specialix card(eight channel serial communication controller)(a PCI card)for QNX.

Can anybody give an overall idea of the different steps to write a device driver.
Please suggest some of the materials for reference.

Start by looking at the documentation on how to write a resource manager.

You will need to write a resmgr that has multiple devices in the namespace for the 8 device channels.

Each channel will need to have tx and rx buffers, pointers, counters, mutexes, rcvid of blocked clients, and various other info pertinent to the serial port in the control structure.

The resmgr will have to handle, at a minimum, io_open, io_close, io_read, io_write, io_devtl, and io_unblock.

Set up the interrupt to deliver a pulse on interrupt.

An interrupt thread should receive the interrupt pulse, figure out the source, and handle the event (send next byte from tx buffer, read and buffer incoming bytes). When a client does a read and no data is available it may block (depending on blocking options) and in that case if a client is blocked on a channel and data comes in you’ll have to manage unblocking the client at the appropriate time.

The source to Dev.ser is probably on Foundry27 somewhere.

The source is available and is the best place to start.

davidmat50, are you developing for QNX6? If the answer is yes: You may want to use the Character DDK, it contains a library called libio-char which does a lot of the routine work to expose a real serial device to the client application (RX/TX buffers, stty support and so on) You only have to implement the tti() and tto() callbacks and the initialization sequence. Best look at the source for devc-ser8250, it shows you how to use that library to create a driver.

Regards,
Albrecht

Thanks for the reply.