RadiSys EPC-26A/27 Manual page 50

Table of Contents

Advertisement

Programming Interface
void
writesection(UCHAR FAR *source, ULONG sramoffset)
{
UCHAR ob;
register USHORT rinductor;
/*
// Enable the card to allow register access
*/
outp(EXMID,Slot);
ob = inp(0x102);
outp(0x102,ob | EXMENABLE);
/*
// Load initial offset value (sramoffset should be
// divisible by 256)
*/
outp(MSWHIGHBYTE,(USHORT) (sramoffset >> 24));
outp(MSWLOWBYTE,(USHORT) (sramoffset >> 16));
outp(LSWHIGHBYTE,(USHORT) (sramoffset >>8));
outp(LSWLOWBYTE,(USHORT) sramoffset);
/*
// Write a section using the autoincrement feature.
*/
for (rinductor = 0; rinductor < BYTESPERSECTION; rinductor++) {
outp(SRAMDATA,*source++);
}
outp(0x102,ob);
/* restore the option byte */
}
void
main()
{
UCHAR test[BYTESPERSECTION];
UCHAR readbuffer[BYTESPERSECTION];
register USHORT minductor;
for (minductor = 0; minductor < BYTESPERSECTION; minductor++)
test[minductor] = minductor;
writesection(test,0);
readsection(readbuffer,0);
if (memcmp(test,readbuffer,BYTESPERSECTION))
printf("Buffer did not compare \n\r")
else printf("Buffers comparison ok \n\r"):
}
6
Page 43
6

Advertisement

Table of Contents
loading

Table of Contents