Module development - how to start ?

Hello all and sorry for (probably stupid) question.

I need to capture data from UART, analyze them and then one of reactions is to read some internal registers in ARM and send them back to UART.

The problem is that the process must be really fast, allowed delay is around 1ms. So I was thinking to do it in kernel space (speed, direct reading of memory registers). But I can not find the way how to use actual serial driver in my code. I feel that I can't use /dev/ttySx directly, can I ?

Probably the first step will be to try everything in user space.

Or does anybody have better idea ? Can you point me there ?

Thank you in advance, V.

Reply to
vaclavpe
Loading thread data ...

On Fri, 20 Feb 2009 07:50:58 -0800, vaclavpe@gmail rearranged some electrons to say:

Not sure what speed you're running your serial port, but, for example, at 9600 bps, it will take 1 ms to just to receive or transmit one character.

Reply to
david

In kernel space you'll have to deal directly with the UART register set or the raw API provided by the UART driver.

Reply to
Janaka

to use it. Do you have some example ?

Its hard to comment without knowing the exact UART and surrounding HW. However, in general, most UART drivers in the kernel will provide a CHAR device that then can be mounted on a file system via "mknod / dev/ttySx c " (NOTE that the file system contex is only in usermode. NOT KERNEL MODE). These drivers fills out a structure "struct file_operations", which has pointers to functions it supports (ie: read, write, ioctl ...). In your custom device driver, you cant get a pointer to this structure and call the functions directly to do whatever you have to do. You will have to do some digging yourself to find out a clean way to do this (or a member of the group can help you) .

Reply to
Janaka

Am Fri, 20 Feb 2009 07:50:58 -0800 schrieb vaclavpe@gmail:

It's not stupid, I once asked the same thing :-D

...

You can't.

But you could implement a line discipline and access the serial driver this way. PPP and SLIP are implemented as line disciplines,

formatting link

Bye, Vitus

--
'Trust me, I haven't done this before and it didn't work then either'

Vitus Jensen, Hannover, Germany, Earth, Milky Way, Universe (current)
Reply to
Vitus Jensen

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.