Sep. 20th, 2005

Geek Help!

Sep. 20th, 2005 08:21 am
bethlakshmi: (Default)
OK guys,

The OS class is giving me a pointer problem that's making me nuts. I'm sure some of this is that I'm so damn rusty at C coding. Here's the deal:

The calling function passes an argument (Z509_REG1 which is an INT32 type) to the function GET_TIME_OF_DAY

GET_TIME_OF_DAY assigns it's own "argument register" to the space allocated to that argument (which it accepted as arg1):

Z502_REG_ARG1.PTR = (void *)arg1;

This is a union, whose declaration looks like this:

typedef union
{
void *PTR;
INT32 VAL;
} Z502_ARG;

Now... I have a service call underneath all this that actually uses our 'hardware' to get the time of day (no problem, got it - as an INT32). And I need to send this information back - via Z502_REG_ARG1.

Since the original call expects a specific address, the challenge is - getting the value into the Z502_REG_ARG1 pointer, without changing the location of the pointer's address. I'd have thought that would be:

(INT32 *)Z502_REG_ARG1.PTR = os_get_time();

Where os_get_time() is the function I'm using to get the time from the hardware.

But that doesn't get the value where it needs to go. I've tried a couple other permutations, but I'm out of ideas.

February 2021

S M T W T F S
 123456
78910111213
14151617181920
212223 24252627
28      

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 27th, 2026 05:56 am
Powered by Dreamwidth Studios