From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9cf87fd8fe05bc5e X-Google-Attributes: gid103376,public From: Corey Minyard Subject: Re: inb/outb for GNAT (Linux) ?? Date: 1998/01/28 Message-ID: #1/1 X-Deja-AN: 319915863 Sender: minyard@wf-rch.cirr.com References: <6al3th$ptb$1@muller.loria.fr> <34CE7805.6AED6789@cl.cam.ac.uk> Organization: Wonderforce Research Newsgroups: comp.lang.ada Date: 1998-01-28T00:00:00+00:00 List-Id: Markus Kuhn writes: > Nicolas NAVET wrote: > > I'am using GNAT for Linux. I need to write > > data to a serial port. Is it possible to do that with ADA > > without using a device driver ? > > This has nothing to do with Ada or GNAT: > > No Linux process can directly access the peripherial hardware > directly with in/out assembler instructions. Linux is not DOS. > The same applies for WinNT, btw. Wrong. On an ix86 under linux, you can call ioperm() or iopl() with the proper parameters then do inb and outb instructions to your heart's content (you have to be root to do this, obviously). Most X servers require this to set things up properly, dosemu allows it for direct port acess, and I have done it for writing some test drivers. To do this , you will have to create bindings to all the functions that you need. I doubt any standard binding exist to do this since it is very non-portable and non-standard. Also note that you cannot get interrupts from the serial port. > What you probably really want to do instead is to access the > serial port via the existing Linux kernel driver as the > devices /dev/ttyS0 and /dev/ttyS1 just as any other Unix process > is doing it. This I agree with. Learning the semantics of termios is kind of a pain, but your program will be MUCH more portable between *nix system, it will be able to use any type of serial port on Linux, etc. Richard Steven's book "Advanced Programming in the Unix Environment" is my favorite book on the subject, well worth having if you do any serious programming under Unix. With the Posix Ada bindings, you don't even have to write any C code. If you are interested, I have a program to page alphanumeric pagers on a modem on my web page written in Ada95 that uses the Posix bindings. I also have a copy of the forest Posix binding there that will compile on Linux with gnat-3.10p. -- Corey Minyard Internet: minyard@acm.org Work: minyard@nortel.ca UUCP: minyard@wf-rch.cirr.com