Sram Standard Memory Array - RadiSys EPC-26A/27 Manual

Table of Contents

Advertisement

6
EPC-26A/27 Hardware Reference

SRAM Standard Memory Array

Typically, access to the SRAM is via a file system installed by the device
driver SRAMDISK.SYS. For users who wish to bypass the file system and
use the SRAM as a standard memory array, the following ANSI C routine is
provided as an example of how to program an executable file.
#include <stdio.h>
#include <memory.h>
#include <conio.h>
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
#define FAR
#define BYTESPERSECTION 0x100
#define EXMID
#define EXMENABLE
#define LSWLOWBYTE
#define LSWHIGHBYTE
#define MSWLOWBYTE
#define MSWHIGHBYTE
#define SRAMDATA
UCHAR
Slot
=
6
void
readsection(UCHAR FAR *target, 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);
/*
// Read a section using the autoincrement feature.
*/
for (rinductor = 0; rinductor < BYTESPERSECTION; rinductor++) {
*target++ = (UCHAR) inp(SRAMDATA);
}
outp(0x102,ob);
}
Page 42
_far
0x96
0x00000001
0x8380
0x8381
0x8382
0x8386
0x8384
5;
/* presumes Flash is in slot 5 */
/* restore the option byte */

Advertisement

Table of Contents
loading

Table of Contents