test of data bus
Posted: Mon Jul 03, 2023 9:35 am
trying to test the status of the bus connected to the 80C196. I have this program:
typedef unsigned char datum;
/* Set the data bus width to 8 bits. */
/**********************************************************************
*
* Function: memTestDataBus()
*
* Description: Test the data bus wiring in a memory region by
* performing a walking 1's test at a fixed address
* within that region. The address (and hence the
* memory region) is selected by the caller.
*
* Notes:
*
* Returns: 0 if the test succeeds.
* A nonzero result is the first pattern that failed.
* **********************************************************************/
datum
memTestDataBus(volatile datum * address)
{ datum pattern;
/*
* Perform a walking 1's test at the given address.
*/
for (pattern = 1; pattern != 0; pattern <<= 1)
{
/*
* Write the test pattern.
*/
*address = pattern;
/*
* Read it back (immediately is okay for this test).
*/
if (*address != pattern)
{
return (pattern);
}
}
return (0);
} /* memTestDataBus() */
unfortunately, the pattern I send to the databus is not returned. There is a mistake somewhere.
typedef unsigned char datum;
/* Set the data bus width to 8 bits. */
/**********************************************************************
*
* Function: memTestDataBus()
*
* Description: Test the data bus wiring in a memory region by
* performing a walking 1's test at a fixed address
* within that region. The address (and hence the
* memory region) is selected by the caller.
*
* Notes:
*
* Returns: 0 if the test succeeds.
* A nonzero result is the first pattern that failed.
* **********************************************************************/
datum
memTestDataBus(volatile datum * address)
{ datum pattern;
/*
* Perform a walking 1's test at the given address.
*/
for (pattern = 1; pattern != 0; pattern <<= 1)
{
/*
* Write the test pattern.
*/
*address = pattern;
/*
* Read it back (immediately is okay for this test).
*/
if (*address != pattern)
{
return (pattern);
}
}
return (0);
} /* memTestDataBus() */
unfortunately, the pattern I send to the databus is not returned. There is a mistake somewhere.