Skip to Content
Programming Embedded Systems in C and C++
book

Programming Embedded Systems in C and C++

by Michael Barr
January 1999
Beginner to intermediate
200 pages
7h 43m
English
O'Reilly Media, Inc.
Content preview from Programming Embedded Systems in C and C++
70 Chapter 6: Memory
baseAddress[offset] = pattern;
}
/*
* Check for address bits stuck high.
*/
testOffset = 0;
baseAddress[testOffset] = antipattern;
for (offset = sizeof(datum); (offset & addressMask) != 0; offset <<= 1)
{
if (baseAddress[offset] != pattern)
{
return ((datum *) &baseAddress[offset]);
}
}
baseAddress[testOffset] = pattern;
/*
* Check for address bits stuck low or shorted.
*/
for (testOffset = sizeof(datum); (testOffset & addressMask) != 0;
testOffset <<= 1)
{
baseAddress[testOffset] = antipattern;
for (offset = sizeof(datum); (offset & addressMask) != 0;
offset <<= 1)
{
if ((baseAddress[offset] != pattern) && (offset != testOffset))
{
return ((datum *) &baseAddress[testOffset]);
}
}
baseAddress[testOffset] = pattern;
}
return (NULL);
} /* memTestAddressBus() */
Device test
Once you know that the address and data bus wiring are correct, it is necessary to
test the integrity of the memory device itself. The thing to test is that every bit in
the device is capable of holding both 0 and 1. This is a fairly straightforward test
to implement, but it takes significantly longer to execute than the previous two.
For a complete device test, you must visit (write and verify) every memory loca-
tion twice. You are free to choose any data value for the first pass, so long as you
invert that value during the second. And because there is a possibility of missing
Memory Testing 71
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

You might also like

Embedded Systems Object-Oriented Programming in C and C++

Embedded Systems Object-Oriented Programming in C and C++

Israel Gbati

Publisher Resources

ISBN: 1565923545Catalog PageErrata