 | ULINK2 User's Guide |  |
|
|
| BlankCheck| Summary |
int BlankCheck (
unsigned long adr, /* Block start address */
unsigned long sz, /* Block size in bytes */
unsigned char pat); /* Pattern to compare */
| | Description | The BlankCheck function can be used to check whether the specified block is empty, or whether the content is equal to a specific pattern pat. | | Return Value | The BlankCheck function returns the value: - 0 - when the block content is equal to the pattern pat.
- 1 - when the block content differs from the pattern pat.
| | Example |
int BlankCheck (unsigned long adr, unsigned long sz, unsigned char pat) {
unsigned long i, j, k;
// Recalculate address for External SDRAM addresses
if (adr >= SDRAM_START)
adr = adr - SDRAM_START + USER_OFFSET;
for (i = 0; i < sz; i += 256) {
// Read 256 bytes
ReadPage_HW (adr+i, 256, &rd_buf[0]);
// Determine size to compare
if ((sz-i) >= 256) k = 256;
else k = (sz-i);
// Check up to 256 bytes if equal to pattern "pat"
for (j = 0; j < k; j++)
if (rd_buf[j] != pat) return (1); // Memory is not blank
}
return (0); // Memory is blank
}
Complete example exists in folder \KEIL\ARM\FLASH\AS352x_M25P40. |
|
|