comp.lang.ada
 help / color / mirror / Atom feed
* no crash dump ?
@ 2002-03-07 20:56 Bj�rn Lundin
  2002-03-07 22:08 ` Anders Gidenstam
  2002-03-08  0:37 ` sk
  0 siblings, 2 replies; 7+ messages in thread
From: Bj�rn Lundin @ 2002-03-07 20:56 UTC (permalink / raw)


Hi!
I'm trying to get access to the joystick port with this program 
(using linux mandrake 8.1 and gnat 3.13)
I don't get access (running as root) AND I don't get a crash dump either?
Does anyone know why?

/Bj�rn

--------
with Text_io; use Text_io;
with system;
with GNAT.Traceback.Symbolic;

procedure interrupt is

  Joystick_address : system.address := system'to_address(16#0201#);

  type byte is range 0..255;
  for byte'size use 8;
  Joystick : byte;
  for Joystick'address use Joystick_address;

begin
   put_line("Main program started!");
   loop
     put_line("In loop");
     put_line(byte'image(b));
     delay 0.2;
   end loop;

exception
  when Event : others =>
    Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (Event));

end interrupt;



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-07 20:56 no crash dump ? Bj�rn Lundin
@ 2002-03-07 22:08 ` Anders Gidenstam
  2002-03-08  0:37 ` sk
  1 sibling, 0 replies; 7+ messages in thread
From: Anders Gidenstam @ 2002-03-07 22:08 UTC (permalink / raw)


In article <20020307215639.37cf3f6d.bjorn.lundin@swipnet.se>,
	Bj�rn Lundin <bjorn.lundin@swipnet.se> writes:
> Hi!
> I'm trying to get access to the joystick port with this program 
> (using linux mandrake 8.1 and gnat 3.13)
> I don't get access (running as root) AND I don't get a crash dump either?
> Does anyone know why?

Hi!

Well, doesn't Linux use a page-based VM system? I'd suspect that your
address clause only places your data at a certain address in the
(virtual) address space of your process, ie the address has no
correlation whatsoever with any "real" memory address. Besides doesn't
x86 use special instructions for IO and not plain memory mapped
registers?

If you program is intended as user-level, then use the proper device
file to access it instead. (I don't know which one that is, though.)

Linux is a real OS, not some kind of DOS where you can poke at any
memory address you like.. ;)

/Anders
-- 
--------------------------------------------
"A well-written program is its own heaven; 
 a poorly-written program is its own hell."
  - The Tao of Programming 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-07 20:56 no crash dump ? Bj�rn Lundin
  2002-03-07 22:08 ` Anders Gidenstam
@ 2002-03-08  0:37 ` sk
  2002-03-08 16:22   ` Bj�rn Lundin
  1 sibling, 1 reply; 7+ messages in thread
From: sk @ 2002-03-08  0:37 UTC (permalink / raw)


Hi,

Firstly, wont compile without a line adding a 
definition for "b"

  b : Byte;

for the line 

     put_line(byte'image(b));

But, the real issue is where are you actually
trying to write data to the "Joystick" ?

For Linux Mandrake 7.1 and GNAT 3.13p (and
running as root or setting the "run as" attribute
to root through "chmod" etc), I have had success 
writing through the "/dev/" file hierarchy ...

    TIO.Open (Printer, TIO.Out_file, "/dev/lpt0");

Perhaps the joysticj is in the "/dev/" hierarchy ?

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-08  0:37 ` sk
@ 2002-03-08 16:22   ` Bj�rn Lundin
  2002-03-08 22:13     ` Jeffrey Carter
  2002-03-08 22:49     ` sk
  0 siblings, 2 replies; 7+ messages in thread
From: Bj�rn Lundin @ 2002-03-08 16:22 UTC (permalink / raw)


On Thu, 07 Mar 2002 18:37:36 -0600
sk <noname@myob.com> wrote:

> Firstly, wont compile without a line adding a  definition for "b"

How embarrissing , I sent modified code. Below is what i meant to send

> But, the real issue is where are you actually
> trying to write data to the "Joystick" ?
No read from it, putline was for print on screen

Thanks for suggetions
/Bj�rn


with Text_io; use Text_io;
with system;
with GNAT.Traceback.Symbolic;

procedure interrupt is

  Joystick_address : system.address := system'to_address(16#0201#);

  type byte is range 0..255;
  for byte'size use 8;
  Joystick : byte;
  for Joystick'address use Joystick_address;

begin
   put_line("Main program started!");
   loop
     put_line(byte'image(Joystick));
     delay 0.2;
   end loop;

exception
  when Event : others =>
    Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (Event));

end interrupt;




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-08 16:22   ` Bj�rn Lundin
@ 2002-03-08 22:13     ` Jeffrey Carter
  2002-03-08 22:49     ` sk
  1 sibling, 0 replies; 7+ messages in thread
From: Jeffrey Carter @ 2002-03-08 22:13 UTC (permalink / raw)


"Bj�rn Lundin" wrote:
> 
> with Text_io; use Text_io;
> with system;
> with GNAT.Traceback.Symbolic;
> 
> procedure interrupt is
> 
>   Joystick_address : system.address := system'to_address(16#0201#);
> 
>   type byte is range 0..255;
>   for byte'size use 8;
>   Joystick : byte;
>   for Joystick'address use Joystick_address;
> 
> begin
>    put_line("Main program started!");
>    loop
>      put_line(byte'image(Joystick));
>      delay 0.2;
>    end loop;
> 
> exception
>   when Event : others =>
>     Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (Event));
> 
> end interrupt;

You probably want to apply pragma Volatile to Joystick.


-- 
Jeffrey Carter



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-08 16:22   ` Bj�rn Lundin
  2002-03-08 22:13     ` Jeffrey Carter
@ 2002-03-08 22:49     ` sk
  2002-03-09 18:07       ` Bj�rn Lundin
  1 sibling, 1 reply; 7+ messages in thread
From: sk @ 2002-03-08 22:49 UTC (permalink / raw)


Hi,

If this is the complete code sample  for your "Joystick"
program, there are no calls within it  which actually do
an operation likely to cause a system level "core dump".

As "anders@localhost.localdomain (Anders Gidenstam)" 
pointed out, the line

Joystick_address : system.address := 
    system'to_address(16#0201#);

probably locates the code in your own address space and
*not* into the kernel address space.

If this is an Intel based platform, the I/O address space
is different from the memory address space, so 16#0201# 
will at best refer to a memory location and not the I/O 
port 16#0201#

If you are running your Linux installation "unhacked" and
you are not by-passing the system to talk to your hardware,
you might find it easier to use the device drivers and 
develop your application to "talk" to them (assuming that
your Linux installation process recognised your joystick
and installed a suitable driver).

I would suggest that you do an internet search for "linux 
device drivers" and you should get several articles 
explaining how to code and use device drivers. 

From there, I would suggest you visit "www.gnuada.org"
which has, or has links to, several binding packages
for Linux which might make "talking" to device drivers 
easier ... you never know, someone might have already 
built a "Joystick" package :-)

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: no crash dump ?
  2002-03-08 22:49     ` sk
@ 2002-03-09 18:07       ` Bj�rn Lundin
  0 siblings, 0 replies; 7+ messages in thread
From: Bj�rn Lundin @ 2002-03-09 18:07 UTC (permalink / raw)


On Fri, 08 Mar 2002 16:49:26 -0600
sk <noname@myob.com> wrote:

> If this is the complete code sample  for your "Joystick"
> program, there are no calls within it  which actually do
> an operation likely to cause a system level "core dump".

Yes it's the whole program, running on a x86 platform, "untouched". I'm just trying 
to make contact to it for future use. I realized that the joystick port can be
 used as a primitive A/D converter to hook up strange things to the computer, 
like thermometers, or sensors in general. I only need a way to write out 
something to adevice, which the parallel port migth be able to. 
 
> As "anders@localhost.localdomain (Anders Gidenstam)" 
> pointed out, the line
> 
> Joystick_address : system.address := 
>     system'to_address(16#0201#);
> 
> probably locates the code in your own address space and
> *not* into the kernel address space.


Thanks for the tips (all 3 of you), I have located a joystick driver and will try from there...

/Bj�rn




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-03-09 18:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-07 20:56 no crash dump ? Bj�rn Lundin
2002-03-07 22:08 ` Anders Gidenstam
2002-03-08  0:37 ` sk
2002-03-08 16:22   ` Bj�rn Lundin
2002-03-08 22:13     ` Jeffrey Carter
2002-03-08 22:49     ` sk
2002-03-09 18:07       ` Bj�rn Lundin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox