A
Anh-Tu Vo
Hi all,
I have a weird problem on a variable assignment. It seems that the
variable is only updated with the value at the second time the
function is called. My program looks like this:
myClass
{
typedef struct
{
union
{
struct _bit
{
UINT32 reservedBits0_15:16; // bits 0..15 Reserved
UINT32 phyStatus:16; // bits 16..32 PHY data
}bit;
UINT32 reg;
}u;
} miimstat_register_s;
volatile miimstat_register_s* ap_tsec1MiimstatReg;
}
myClass::myClass()
{
ap_tsec1MiimstatReg = (miimstat_register_s*)0x00024530;
}
void myClass::foo( unsigned int *p_data)
{
*p_data = (unsigned int)(ap_tsec1MiimstatReg->u.bit.phyStatus);
}
The problem is that *p_data is only updated with
ap_tsec1MiimstatReg->u.bit.phyStatus value when foo() is called the
second time.
Does anybody have an idea what the problem is?
thank you,
Anh Tu
I have a weird problem on a variable assignment. It seems that the
variable is only updated with the value at the second time the
function is called. My program looks like this:
myClass
{
typedef struct
{
union
{
struct _bit
{
UINT32 reservedBits0_15:16; // bits 0..15 Reserved
UINT32 phyStatus:16; // bits 16..32 PHY data
}bit;
UINT32 reg;
}u;
} miimstat_register_s;
volatile miimstat_register_s* ap_tsec1MiimstatReg;
}
myClass::myClass()
{
ap_tsec1MiimstatReg = (miimstat_register_s*)0x00024530;
}
void myClass::foo( unsigned int *p_data)
{
*p_data = (unsigned int)(ap_tsec1MiimstatReg->u.bit.phyStatus);
}
The problem is that *p_data is only updated with
ap_tsec1MiimstatReg->u.bit.phyStatus value when foo() is called the
second time.
Does anybody have an idea what the problem is?
thank you,
Anh Tu