From: Francesco PIRANEO GIULIANO <liste.fpiraneo@gmail.com>
Subject: Does mmap gives a right result?!
Date: Sun, 3 Oct 2010 04:27:25 -0700 (PDT)
Date: 2010-10-03T04:27:25-07:00 [thread overview]
Message-ID: <459d08e4-1370-4925-9d9f-64ee0f472c19@f25g2000yqc.googlegroups.com> (raw)
Hi all,
always trying to handle linux framebuffer with ada; big goal reached
yesterday accessing fixed and variable data structures importing and
executing ioctl functions.
Now I have to draw inside the framebuffer and I've imported mmap as
follows:
function mmap(addr : in u32; length : in u32; prot : in mmap_prot;
flags : in mmap_flag; fd : in file_id; offset : in u32) return
Void_Ptr;
pragma import( C, mmap, "mmap" );
pragma import_function(mmap);
Void_Ptr is defined as follows:
type void is mod System.Memory_Size;
for void'Size use System.Word_Size;
type Void_Ptr is access all Void;
pragma Convention (C, Void_Ptr);
The lines above has been derived by:
http://en.wikibooks.org/wiki/Ada_Programming/Types/access#Where_is_void.2A.3F
Finally, the mmap has been called as follows:
fbindex := mmap(0, fbhandler.fixinfo.smem_len,
fbhandler.PROT_READ + fbhandler.PROT_WRITE, fbhandler.MAP_FILE +
fbhandler.MAP_SHARED, fbid, 0);
NOTE: I defined PROT_READ and so on as constants in my code;
First question: I have to analyze if fbindex is /= -1 otherwise I have
to raise an exception:
if integer(fbindex) = -1 then
raise BADMMAPRESULT;
end if;
...seems to be the most logical comparision BUT the following error in
compile phase appears: "illegal operand for numeric conversion" -- Any
help is really apreciated here! :-)
When commenting out the above instructions and starting the compiled
application, everything goes right except, when I try to draw inside
the first location the program hungs with the following:
raised STORAGE_ERROR : stack overflow (or erroneous memory access)
I'm quite sure my mmap doesn't run properly. I'm about to makes all
framebuffer's interfacing functions in C then implement the remaining
in Ada but it will be a nice things if everything can be made with the
same language.
Any clues or opinion is welcome about.
Francesco
next reply other threads:[~2010-10-03 11:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-03 11:27 Francesco PIRANEO GIULIANO [this message]
2010-10-03 17:04 ` Does mmap gives a right result?! Jeffrey Carter
2010-10-03 17:49 ` Björn
2010-10-03 19:22 ` Francesco PIRANEO GIULIANO
2010-10-03 19:32 ` Shark8
2010-10-11 3:03 ` David Thompson
2010-10-04 8:05 ` Ludovic Brenta
2010-10-04 21:11 ` Francesco PIRANEO GIULIANO
2010-10-04 9:06 ` Jacob Sparre Andersen
2010-10-04 21:08 ` Francesco PIRANEO GIULIANO
2010-10-05 8:19 ` Ludovic Brenta
2010-10-05 13:17 ` Jacob Sparre Andersen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox