[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
programming the serial port
For a school assignment, i have to write a program that uses a
nullmodem to let 2 computers communicate with each other by exchanging
some data and doing some simple calculations with the data they
exchange.
We can choose which programming language we use... i thought C would
be the best choice considering the following:
We are not allowed to do it 'the POSIX way'... that means, just
opening a file descriptor to /dev/ttySX and writing and reading from
that file descriptor isn't the way we should do it... we really have
to set and change bits from the UART (16550 or 16450 that is i
guess...)
Now my question is: what would be the best 'tactic' to do this? Can
this be done completely in userland or do i have to write a kernel
module for that (I have the Linux device driver book here, so i think
i could manage writing a simple module...)
I've been looking on the Internet for information on how to do this,
but the best things i can come up with are pages illustrating how it
is done 'the POSIX' way and pages which present me DOS-code... some
examples of such DOS code are:
http://www.beyondlogic.org/serial/buff1024.c
http://www-personal.engin.umich.edu/~hphe/lab/rs232.html
I'm looking for how to do this kind of stuff 'the linux way'... where
should i start, what would be the 'nicest' way of programming this and
where can i find more info or examples?
Thanks,
Bart
PS: the full assignment (only in Dutch... sorry) is at
http://mc303.ulyssis.org/downloads/Opgave2.jpg
--
Ing. Bart Vandewoestyne Bart.Vandewoestyne@pandora.be
Hugo Verrieststraat 48 GSM: +32 (0)478 397 697
B-8550 Zwevegem http://users.pandora.be/vandewoestyne
----------------------------------------------------------------------
"Any fool can know, the point is to understand." - Albert Einstein
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/