For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > August 2005 > Re: Need sample C code for access I/O ports









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Need sample C code for access I/O ports
Steven Woody

2005-08-25, 6:58 pm

Henrik Carlqvist <Henrik.Carlqvist@deadspam.com> writes:

> Steven Woody <anti-spam.narkewoody@gmail.com.dont-post-to> wrote:
>
> It sounds as if you are going to write a driver for that card? There are a
> lot of "sample code" in /usr/src/linux. Check in
> /usr/src/linux/driver/char for files like moxa.c and serial.c.
>
> regards Henrik
> --
> The address in the header is only to prevent spam. My real address is:
> hc7(at)uthyres.com Examples of addresses which go to spammers:
> info@k-soft.se info@k-software.biz info@webrider.ru root@localhost
>


no! i am not about to write any driver. i just want to do some setting things
on a multiport serial board. the board got some eeprom and use it to store io
addresses and irq numbers for each serial port build on it. according to the
manual, if i want to get/change those data stored in the eeprom, i have to do
it via read/write some specific io ports which is dedicated for configuration.

today, i skimmed the Linux's IO Port Programming HOWTO, i think i should use
inb/outb to do the job, is that right?

thanks.


--
steven woody (id: narke)

How Far You Fall Doesn't Matter, It's How You Land

- Haine, La (1995)
Henrik Carlqvist

2005-08-25, 6:59 pm

Steven Woody <anti-spam.narkewoody@gmail.com.dont-post-to> wrote:
> no! i am not about to write any driver. i just want to do some setting things
> on a multiport serial board. the board got some eeprom and use it to store io
> addresses and irq numbers for each serial port build on it. according to the
> manual, if i want to get/change those data stored in the eeprom, i have to do
> it via read/write some specific io ports which is dedicated for configuration.
>
> today, i skimmed the Linux's IO Port Programming HOWTO, i think i should use
> inb/outb to do the job, is that right?


Yes, you can probably write a program using ioperm and outb to change
those settings. But then what? If you from user space change the IRQ
and/or address of a serial port the kernel is going to be if it
before thought that the port should have other values. Maybe you could fix
this with the program setserial.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc7(at)uthyres.com Examples of addresses which go to spammers:
info@k-soft.se info@k-software.biz info@webrider.ru root@localhost

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com