From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Iverson To: koi@ssa.crane.navy.mil (mark koi) Cc: gnu-win32@cygnus.com Subject: Re: Serial IO focusing Date: Thu, 21 Aug 1997 22:56:00 -0000 Message-id: <199708220548.WAA17194@stars.cisco.com> References: <33FB542A.8271A54F@ssa.crane.navy.mil> X-SW-Source: 1997-08/msg00433.html Cygnus may have some of these already coded in their machine.h file, but if you don't find it there, most folks usually just write their own using GCC's inline asm; eg. in your very own machine.h file ... static unsigned char inline inb (const unsigned short port) { register unsigned char val; __asm __volatile ("inb %%dx,%%al" : "=a" (val) : "d" (port)); return val; } If I managed to remember the gas syntax for inb correctly, { int x = inb(0x3f8); } Will produce the following assembly movw %dx, $0x3f8 inb %dx, %al movzbl %al, -4(%epb) Or something quite similar -- GCC is smart enough to keep 0x3f8 in a register and not reload it every time if you're in a loop. It will also skip the move to automatic storage if it can and just use the value in AL. There is some cryptic documentation on inline asm for GCC in the info files. For the details, you will need to read the source -- particularly the machine description file in gcc/config/i386/i386.md. This is the only place you can find the descriptions for the various register fields (eg. the "=a") to use in the asm lines. - Tim +---------------- | Date: Wed, 20 Aug 1997 16:31:39 -0400 | From: mark koi | To: gnu-win32@cygnus.com | Subject: Serial IO focusing | | method. Now I am trying to use gnu-win32, and I see no libraries for | things like outp(), inp(). Can someone steer me in the right direction | for examples/how-tos for controlling a serial port in WIN95. The - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request@cygnus.com" with one line of text: "help".