User mode driver for PCMCIA card - How?

I need to develop a driver for a multifunction PCMCIA card with a standard serial interface (16550) and a proprietary FIFO interface. I can access the serial port now, but the FIFO is the problem.

Since I have so far no experience with Kernel driver development, and since the application is not very demanding and all this happens in a controlled embedded environment (x86 based), I'm tempted to do this in user land if possible...

Any help now at the design stage would be much appreciated, so that I don't run into the wrong direction!

- First of all: is this possible? I need to access a few registers on the PCMCIA card and that should be it. No IRQs, I think I can get away with polling.

- Any hints for documentation on how to do it? Does anybody know of any similar drivers that already exist?

Thanks a lot already...

Wolfgang

Reply to
W. Tolkien
Loading thread data ...

Seems quite easy. But doing it in USER mode would make it by far more complicated and by far less appropriate for the task.

You should just copy the source code of the serial driver from the Kernel source into your own file and modify it to support the FiFo control. Use Rubini's book "Linux device drivers" (even readable online) if you need to understand how to compile a driver and learn about some driver internals. I suppose if you know how the hardware works, it will be quite obvious what modifications need to be made.

If you just need to set some bits in the card and don't need to do anything while data is sent and received, a user mode thing might be doable.

-Michael

Reply to
Michael Schnell

Thanks for the quick reply!

Hmm, I actually own Rubinis book and scanned through it. I will have another look, maybe I'm just too paranoid. Still - since this would be my first kernel project and stability is paramount in an embedded system, I am still considering the User mode option.

Does anybody have some pointers where to start here?

Wolfgang

Michael Schnell wrote:

Reply to
W. Tolkien

Don't ! I've been there - in most cases, user mode drivers are by far more complex then kernel mode. And you will have to run some code in kernel mode anyway.

Reply to
Alexander Sirotkin

I did a similar thing (modified the RTC driver) as my first Linux project). I found this task not very hard.

-Michael

Reply to
Michael Schnell

I don't quite understand you. A 16550 has a FIFO. If your board has another kind of FIFO then it is not 16550...

- In this case I would suggest you try to modify the driver in kernel (and release the source)

Or is the FIFO not related to the serial port?

- Slow data, then it could be OK with user driver. Take care, what happens if the processor does something else?

as root call ioperm() and iopl() after that you can use inb/outb

/RogerL

--
Roger Larsson
Skellefteå
Sweden
Reply to
Roger Larsson

Well, if you don't need interrupts, then yes it should be possible.

You can use the dummy_cs driver to configure the card for you. Then your user-mode program can open /dev/port, which provides raw access to IO port space.

-- Dave

Reply to
dhinds

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.