From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: .h header file in ObjectAda 8.2.2 source code?
Date: Mon, 22 Jul 2013 23:04:10 +0300
Date: 2013-07-22T23:04:10+03:00 [thread overview]
Message-ID: <b55hhqFm1tiU1@mid.individual.net> (raw)
In-Reply-To: <18255aa3-c926-4e18-a8a6-d19fe6b3ad93@googlegroups.com>
On 13-07-22 22:08 , dd24fan wrote:
> Thanks for the insight. My latest debugging efforts have pointed me
> to the Initialization of the device. I do have a compare of what
> the C code is doing because the vendor has software in a
> analyzer/simulator that i was able to run.
>
> Here is the snippet of the C code:
>
> ==============
> .
> .
> .
> S16BIT s16Result = 0x0000;
> S16BIT s16DevNum = LOGICAL_DEVICE_NUMBER;
> .
> .
> /* Initialize device */
> s16Result = Initialize(s16DevNum, ACCESS_CARD, MODE, 0, 0, 0);
> .
> .
> ==============
> ACCESS_CARD is defined as 16BIT
> MODE is U16BIT
Are those the types of the variables ACCESS_CARD and MODE -- the actual
parameters in the Initialize call -- or the types of the corresponding
formal parameters of Initialize? In other words, how is Initialize
declared in the .h file? The actual and formal types in C are not
necessarily the same, since C converts automatically. For the Ada
declaration, you should use the formal types.
Also, what are the values of ACCESS_CARD and MODE in the C program?
> The last 3 parameters are defined U32BIT
>
> so in my latest ada code i have this:
> ==============
> .
> .
> function Initialize (DevNum : S16Bit_Type;
> wAccess: S16Bit_Type;
> Mode : U16Bit_Type;
> Mem_Wrd_Size : U32Bit_Type;
> Reg_Addr : U32Bit_Type;
> Mem_Addr : U32Bit_Type
> ) return S16Bit_Type;
> pragma Import (Stdcall, Initialize, "Initialize");
> .
> .
> procedure Open (Device_Num : in S16Bit_Type;
> Is_Open : in out Boolean;
> Good : out Boolean) is
>
> Result : S16Bit_Type;
>
> ACCESS_CARD : U16Bit_Type := 16#0000#;
> MODE : S16Bit_Type := 1;
I assume that these values of ACCESS_CARD and MODE match the values used
in the C program, right?
> Result := Initialize (S16Bit_Type (Device_Num),
> ACCESS_CARD,
> MODE,
> 16#00000000#,
> 16#00000000#,
> 16#00000000#);
(You could as well write the three last parameters using a single "0"
for each, just as in the C code. The hexadecimal base and the multiple
zeros make no difference.)
> Some notes: Device_Num is originally defined as an integer
> elsewhere in the code so I type cast it.
That seems unnecessary, if (as your code suggests) this Device_Num is
the parameter to the Open procedure, because that parameter is declared
as S16Bit_Type, so there is no need to convert it to S16Bit_Type in the
calls. (But it does no harm either.)
You didn't say if this Ada code still hangs. Does it?
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2013-07-22 20:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 11:47 .h header file in ObjectAda 8.2.2 source code? dd24fan
2013-07-19 13:02 ` Niklas Holsti
2013-07-19 15:36 ` dd24fan
2013-07-20 5:41 ` Randy Brukardt
2013-07-22 19:06 ` dd24fan
2013-07-22 19:08 ` dd24fan
2013-07-22 20:04 ` Niklas Holsti [this message]
2013-07-23 12:05 ` dd24fan
2013-07-22 19:50 ` dd24fan
2013-07-20 8:07 ` Niklas Holsti
2013-08-01 15:03 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox