V
vicky
Hi,
I have a function that checks or compare to see if the read value is same as
the written value in the register. (i.e. check if READ_value==WRITE_value in
REG_1)
It also checks if the READ==WRITE, then writes a value of 0x1 in REG_2.
Thank you for your suggestion, if the code below would do the same.
Kind regards,
vick
//--------------------------------------------------------------------------
---
// Function to check if the written value in the variable is same as the
read value
//--------------------------------------------------------------------------
---
int Prog(const Info *progInfo) {
int errors=0;
if (progInfo!=NULL) {
Regs RegPoint;
unsigned int i;
UInt32 tmp0;
int sig = 1;
/* Set registers base address */
RegPoint = (Regs)progInfo->location;
/* Write a value in the register */
// See if the value written in REG_1 writes a value in REG_2
PrintfMessage("Starting REG_2 test at %x\n", RegPoint);
RegPoint->REG_1 = 0x0F;
/* Read data of REG_1*/
/* See if REG_2 is triggered.... \n") */
tmp0 = RegPoint->REG_1;
if (tmp0 == 0x0F) {
sig = 0;
PrintfMessage("REG_2 is not triggered %x\n", RegPoint);
} else {
vhPrintfMessage("REG_2 is triggered %x\n", RegPoint);
}
PrintfMessage("Now clear the value in REG_2 %x\n", RegPoint);
RegPoint->REG_2 = 0x00;
return (sig);
}
return errors;
}
I have a function that checks or compare to see if the read value is same as
the written value in the register. (i.e. check if READ_value==WRITE_value in
REG_1)
It also checks if the READ==WRITE, then writes a value of 0x1 in REG_2.
Thank you for your suggestion, if the code below would do the same.
Kind regards,
vick
//--------------------------------------------------------------------------
---
// Function to check if the written value in the variable is same as the
read value
//--------------------------------------------------------------------------
---
int Prog(const Info *progInfo) {
int errors=0;
if (progInfo!=NULL) {
Regs RegPoint;
unsigned int i;
UInt32 tmp0;
int sig = 1;
/* Set registers base address */
RegPoint = (Regs)progInfo->location;
/* Write a value in the register */
// See if the value written in REG_1 writes a value in REG_2
PrintfMessage("Starting REG_2 test at %x\n", RegPoint);
RegPoint->REG_1 = 0x0F;
/* Read data of REG_1*/
/* See if REG_2 is triggered.... \n") */
tmp0 = RegPoint->REG_1;
if (tmp0 == 0x0F) {
sig = 0;
PrintfMessage("REG_2 is not triggered %x\n", RegPoint);
} else {
vhPrintfMessage("REG_2 is triggered %x\n", RegPoint);
}
PrintfMessage("Now clear the value in REG_2 %x\n", RegPoint);
RegPoint->REG_2 = 0x00;
return (sig);
}
return errors;
}