Port IO with Gnat

This is a discussion on Port IO with Gnat within the ADA forums in Programming Languages category; Could anyone point me at how to do simple port IO under Windows XP with GNAT 2005? Thanks Dave...

Go Back   Application Development Forum > Programming Languages > ADA

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-31-2008, 09:15 AM
levy.david.c@gmail.com
Guest
 
Default Port IO with Gnat

Could anyone point me at how to do simple port IO under Windows XP
with GNAT 2005?

Thanks

Dave
Reply With Quote
  #2  
Old 08-31-2008, 05:06 PM
anon
Guest
 
Default Re: Port IO with Gnat

-- There is a workable example in the gnat doc that comes with GNAT.
-- But these you routine should give you and idea.

--
-- If your using x86 processors
--
procedure Out_Byte ( Port : unsigned_16 ;
Data : unsigned_8 ) is

begin -- Out_Byte
Asm ( Template => "outb %%al, %%dx" & ASCII.LF,
Inputs => ( Unsigned_8'Asm_Input ( "a", Data ),
Unsigned_16'Asm_Input ( "d", Port )
),
Volatile => True ) ;
end Out_Byte ;


function In_Byte ( Port : unsigned_16 ) return unsigned_8 is

Data : unsigned_8 ;

begin -- In_Byte
Asm ( Template => "inb %%dx, %%al" & ASCII.LF,
Inputs => Unsigned_16'Asm_Input ( "d", Port ),
Outputs => Unsigned_8'Asm_Output ( "=a", Data ),
Volatile => True ) ;
return Data ;
end In_Byte ;


In <6e0427b4-4871-4e51-a1b1-696136aa45a6@i20g2000prf.googlegroups.com>, levy.david.c@gmail.com writes:
>Could anyone point me at how to do simple port IO under Windows XP
>with GNAT 2005?
>
>Thanks
>
>Dave


Reply With Quote
  #3  
Old 09-01-2008, 08:41 AM
Stephen Leake
Guest
 
Default Re: Port IO with Gnat

levy.david.c@gmail.com writes:

> Could anyone point me at how to do simple port IO under Windows XP
> with GNAT 2005?


I think the best answer is that there is no such thing as "simple port
IO" under Windows XP.

What, specifically, are you trying to do?

--
-- Stephe
Reply With Quote
  #4  
Old 09-01-2008, 10:50 AM
Gary Scott
Guest
 
Default Re: Port IO with Gnat

Stephen Leake wrote:

> levy.david.c@gmail.com writes:
>
>
>>Could anyone point me at how to do simple port IO under Windows XP
>>with GNAT 2005?

>
>
> I think the best answer is that there is no such thing as "simple port
> IO" under Windows XP.
>
> What, specifically, are you trying to do?
>

There is a library targeted at Fortran that should be pretty easy to use:

http://www.microglyph.com/prdpag.html


--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford
Reply With Quote
  #5  
Old 09-25-2008, 08:34 PM
levy.david.c@gmail.com
Guest
 
Default Re: Port IO with Gnat

On Sep 1, 7:06*am, a...@anon.org (anon) wrote:
> -- There is a workable example in the gnat doc that comes with GNAT.
> -- But these you routine should give you and idea. *
>
> --
> -- *If your using x86 processors
> --
> procedure Out_Byte ( Port : unsigned_16 ;
> * * * * * * * * * * * *Data : unsigned_8 ) is
>
> * begin -- Out_Byte
> * * Asm ( Template => "outb %%al, %%dx" *& ASCII.LF,
> * * * * * Inputs => ( Unsigned_8'Asm_Input ( "a", Data ),
> * * * * * * * * * * * Unsigned_16'Asm_Input ( "d", Port )
> * * * * * * * * * * * ),
> * * * * * Volatile => True ) ;
> * end Out_Byte ;
>
> function In_Byte ( Port : unsigned_16 ) return unsigned_8 is
>
> * * Data : unsigned_8 ;
>
> * begin -- In_Byte
> * * Asm ( Template => "inb *%%dx, %%al" *& ASCII.LF,
> * * * * * Inputs * => *Unsigned_16'Asm_Input ( "d", Port ),
> * * * * * Outputs => Unsigned_8'Asm_Output ( "=a", Data ),
> * * * * * Volatile => True ) ;
> * * return Data ;
> * end In_Byte ;
>
> In <6e0427b4-4871-4e51-a1b1-696136aa4...@i20g2000prf.googlegroups.com>,levy.da vi...@gmail.com writes:
> >Could anyone point me at how to do simple port IO under Windows XP
> >with GNAT 2005?

>
> >Thanks

>
> >Dave

>
>


Unfortunately this does not work because of Windows XP's security,
which disallows port io.

How does one ask XP for permission to do the port IO from GNAT?

Thanks

Dave
Reply With Quote
  #6  
Old 09-25-2008, 09:32 PM
Steve
Guest
 
Default Re: Port IO with Gnat

<levy.david.c@gmail.com> wrote in message
news:de90dcd1-8540-446b-9926-06d671416736@i20g2000prf.googlegroups.com...
On Sep 1, 7:06 am, a...@anon.org (anon) wrote:
> -- There is a workable example in the gnat doc that comes with GNAT.
> -- But these you routine should give you and idea.
>
> --
> -- If your using x86 processors
> --
> procedure Out_Byte ( Port : unsigned_16 ;
> Data : unsigned_8 ) is
>
> begin -- Out_Byte
> Asm ( Template => "outb %%al, %%dx" & ASCII.LF,
> Inputs => ( Unsigned_8'Asm_Input ( "a", Data ),
> Unsigned_16'Asm_Input ( "d", Port )

[snip]

Unfortunately this does not work because of Windows XP's security,
which disallows port io.

How does one ask XP for permission to do the port IO from GNAT?

Thanks

Dave

A quick search on "port io from xp" (on ixquick) finds:

http://www.geekhideout.com/iodll.shtml

There is an IO.DLL that does the grubby work for you, so all you have to do
is use the DLL.

Regards,
Steve

BTW: Some times my newsreader (outlook express) doesn't qoute replies
properly (sometimes it does)... sorry


Reply With Quote
  #7  
Old 09-25-2008, 09:50 PM
Dennis Lee Bieber
Guest
 
Default Re: Port IO with Gnat

On Thu, 25 Sep 2008 17:34:44 -0700 (PDT), levy.david.c@gmail.com
declaimed the following in comp.lang.ada:

>
> Unfortunately this does not work because of Windows XP's security,
> which disallows port io.
>

Ah, now it comes out...

> How does one ask XP for permission to do the port IO from GNAT?
>

This would seem better answered in an XP specific forum, as the
answer applies to all programming languages under XP.

http://www.beyondlogic.org/porttalk/porttalk.htm
http://www.cs.ucr.edu/~eblock/pages/...ls/giveio.html
http://www.embeddedtronics.com/publi...idaq/userport/
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com wulfraed@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: web-asst@bestiaria.com)
HTTP://www.bestiaria.com/
Reply With Quote
  #8  
Old 09-25-2008, 11:32 PM
anon
Guest
 
Default Re: Port IO with Gnat

It depends on the XP or Vista security mode. With the security mode active
a program must request and be granted rights to use the I/O instructions.
Check Win security apps for those routines. Once rights have been granted
the routines works perfectly. But, if the OS does not give the rights then a
"System I/O Access" exception will occur if you try to execute any I/O
instruction. There are other ways (hacked) but microsoft and some schools
do not support those and it may void any hardware warranties on new
equipment or get one expelled.

But in either case, you will need to write an Ada Interface package to import
those routines to Ada.

In <3aydnfE84t4XpkHVnZ2dnUVZ_uqdnZ2d@comcast.com>, "Steve" <nospam_steved94@comcast.net> writes:
><levy.david.c@gmail.com> wrote in message
>news:de90dcd1-8540-446b-9926-06d671416736@i20g2000prf.googlegroups.com...
>On Sep 1, 7:06 am, a...@anon.org (anon) wrote:
>> -- There is a workable example in the gnat doc that comes with GNAT.
>> -- But these you routine should give you and idea.
>>
>> --
>> -- If your using x86 processors
>> --
>> procedure Out_Byte ( Port : unsigned_16 ;
>> Data : unsigned_8 ) is
>>
>> begin -- Out_Byte
>> Asm ( Template => "outb %%al, %%dx" & ASCII.LF,
>> Inputs => ( Unsigned_8'Asm_Input ( "a", Data ),
>> Unsigned_16'Asm_Input ( "d", Port )

>[snip]
>
>Unfortunately this does not work because of Windows XP's security,
>which disallows port io.
>
>How does one ask XP for permission to do the port IO from GNAT?
>
>Thanks
>
>Dave
>
>A quick search on "port io from xp" (on ixquick) finds:
>
>http://www.geekhideout.com/iodll.shtml
>
>There is an IO.DLL that does the grubby work for you, so all you have to do
>is use the DLL.
>
>Regards,
>Steve
>
>BTW: Some times my newsreader (outlook express) doesn't qoute replies
>properly (sometimes it does)... sorry
>
>


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:42 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.