
Programming Examples
16-76
ADSP-BF59x Blackfin Processor Hardware Reference
In general, the block size is bigger than the size of the temporary buffer.
Therefore, the boot kernel may need to divide the processing of a single
block into multiple steps. The callback routine may also need to be
invoked multiple times—every time the temporary buffer is filled up and
once for the remaining bytes. The boot kernel passes the
dFlags
parame-
ter, so that the callback routines knows whether it is called the first time,
the last time or neither. The
dUserLong
variable in the
ADI_BOOT_DATA
structure is used to store the intermediate results between function calls.
Listing 16-7. XOR Checksum
s32 xor_callback(
ADI_BOOT_DATA* pBS,
ADI_BOOT_BUFFER* pCS,
s32 dFlags)
{
s32 i;
if ((pCS!= NULL) && (pBS->pHeader!= NULL)) {
if (dFlags & CBFLAG_FIRST) {
pBS->dUserLong = 0;
}
for (i=0; i<pCS->dByteCount/sizeof(s32); i++) {
pBS->dUserLong^= ((s32 *)pCS->pSource)[i];
}
if (dFlags & CBFLAG_FINAL) {
if (pBS->dUserLong!= pBS->pHeader->dArgument) {
idle ();
}
}
}
return 0;
}
void xor_initcode (ADI_BOOT_DATA *pBS)
{
Summary of Contents for ADSP-BF59x Blackfin
Page 64: ...Development Tools 1 22 ADSP BF59x Blackfin Processor Hardware Reference...
Page 74: ...Processor Specific MMRs 2 10 ADSP BF59x Blackfin Processor Hardware Reference...
Page 244: ...Programming Examples 6 40 ADSP BF59x Blackfin Processor Hardware Reference...
Page 700: ...Programming Examples 16 78 ADSP BF59x Blackfin Processor Hardware Reference...
Page 738: ...Boundary Scan Architecture B 8 ADSP BF59x Blackfin Processor Hardware Reference...