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: Markus Kuhn Subject: Re: inb/outb for GNAT (Linux) ?? Date: 1998/01/28 Message-ID: <34CE7805.6AED6789@cl.cam.ac.uk>#1/1 X-Deja-AN: 319819931 Content-Transfer-Encoding: 7bit References: <6al3th$ptb$1@muller.loria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Cambridge University, Computer Laboratory Newsgroups: comp.lang.ada Date: 1998-01-28T00:00:00+00:00 List-Id: 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. If you are running as root, you can access ports indirectly via the /dev/port device (read "man 4 port" on this) using the open(), lseek(), read(), and write() system calls or their Ada equivalents. For everything more sophisticated, you'll have to write a loadable kernel module (either in Ada or in C, as you wish) to do the job as a device driver. > I' have searched through the packages for functions like > inb()/outb() but without result. Not surprising, because these functions would be useless except for kernel developers. You can always directly include these assembler instructions, but it will cause a Bus Error and abort your process unless you are inside the kernel. This has nothing to do with Ada, it happens under C exactly the same way. 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. Hope this helped ... Markus -- Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK email: mkuhn at acm.org, home page: