HP (Hewlett-Packard) B Network Router User Manual


 
void RegInst::SetMapping(int mapSpace, unsigned int pageStart, unsigned int
pageCount, UBYTE *suggestedAddr) {
int WasMapped;
if (this != NULL) {
WasMapped = Mapped;
if (Mapped)
Unmap();
MapSpace = mapSpace;
PageStart = pageStart;
PageCount = pageCount;
SuggestedAddr = suggestedAddr;
if (WasMapped)
Map();
}
}
void RegInst::Map(void) {
if (this != NULL) {
Valid = 0;
if (Inst != NULL) {
MappedInst->Unmap();
BaseAddr = imap(Inst,MapSpace,PageStart,PageCount,SuggestedAddr);
if (BaseAddr != NULL) {
MappedInst = this;
Valid = 1;
Mapped = 1;
}
}
}
}
void RegInst::Unmap(void) {
if (this != NULL) {
Valid = 0;
if (Inst != NULL) {
if (this == MappedInst) {
iunmap(Inst,BaseAddr,MapSpace,PageStart,PageCount);
MappedInst = NULL;
}
Valid = 1;
}
BaseAddr = NULL;
Mapped = 0;
}
}
Continued on Next Page
80 Usin
g
the Di
g
itizer Chapter 2