From 147b28e84e970a5812a5d9ff84d7fc2f06820198 Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 9 Jun 2012 17:56:11 -0400 Subject: [PATCH] misc edits --- devpnc.h | 8 ++++++-- emdev.h | 25 ++++++++++++++----------- makefile | 22 ++++++++++++++-------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/devpnc.h b/devpnc.h index 85ab994..cba933f 100644 --- a/devpnc.h +++ b/devpnc.h @@ -206,7 +206,7 @@ #define PNCNSRCVINT 0x8000 /* bit 1 rcv interrupt (rcv complete) */ #define PNCNSXMITINT 0x4000 /* bit 2 xmit interrupt (xmit complete) */ - //#define PNCNSPNC2 0x2000 /* bit 3 PNC II = 1 (aka pncbooster) */ +#define PNCNSPNC2 0x2000 /* bit 3 PNC II = 1 (aka pncbooster) */ //#define PNCNSNEWMODE 0x1000 /* bit 4 PNC in "new"/II mode */ //#define PNCNSERROR 0x0800 /* bit 5 u-verify failure or bad command (II) */ #define PNCNSCONNECTED 0x0400 /* bit 6 connected to ring */ @@ -832,6 +832,7 @@ int devpnc (int class, int func, int device) { } pncstat = 0; + pncstat = PNCNSPNC2; /* this enables PNC II */ intstat = 0; rcvstat = 0; xmitstat = 0; @@ -1010,7 +1011,7 @@ int devpnc (int class, int func, int device) { rcv.state = PNCBSIDLE; rcvstat = PNCRSBUSY; xmitstat = PNCXSBUSY; - pncstat &= PNCNSNODEIDMASK; + pncstat &= (PNCNSPNC2 | PNCNSNODEIDMASK); } else if (func == 01) { /* OCP '0107 connect to the ring */ TRACE(T_INST|T_RIO, " OCP '%02o%02o - connect\n", func, device); @@ -1142,6 +1143,9 @@ int devpnc (int class, int func, int device) { pncdiag = getcrs16(A); IOSKIP; + } else if (func == 0) { /* PNC2: set statistics update frequency */ + IOSKIP; + } else if (func == 014) { /* initiate recv, dma chan in A */ if (!(pncstat & PNCNSCONNECTED)) { break; /* yes, return and don't skip */ diff --git a/emdev.h b/emdev.h index 31eafcd..c816615 100644 --- a/emdev.h +++ b/emdev.h @@ -1575,7 +1575,7 @@ int devcp (int class, int func, int device) { if (datnowea != 0) initclock(datnowea); } - elapsedms = (tv.tv_sec-start_tv.tv_sec-1)*1000 + (tv.tv_usec+1000000-start_tv.tv_usec)/1000; + elapsedms = (tv.tv_sec-start_tv.tv_sec)*1000.0 + (tv.tv_usec-start_tv.tv_usec)/1000.0; targetticks = elapsedms/(-clkpic*clkrate/1000); #if 0 absticks++; @@ -1615,26 +1615,29 @@ int devcp (int class, int func, int device) { } #endif - /* update instpermsec every 5 seconds. Check for instcount - overflow and reset when it occurs. Also, suspend can cause - instpermsec to be zero. That causes hangs in the BDX idle - code, so don't update instpermsec in that case. + /* update instpermsec every IPMTIME milliseconds. Check for + instcount overflow and reset when it occurs. Also, suspend + can cause instpermsec to be zero. That causes hangs in the + BDX idle code, so don't update instpermsec in that case. XXX: this code should probably be done whether or not the clock is running */ - if ((gvp->instcount < previnstcount) || (gvp->instcount-previnstcount > gvp->instpermsec*1000*5)) { - if (gvp->instcount-previnstcount > gvp->instpermsec*1000*5) { +#define IPMTIME 5000 + + if ((gvp->instcount < previnstcount) || (gvp->instcount-previnstcount > gvp->instpermsec*IPMTIME)) { + if (gvp->instcount-previnstcount > gvp->instpermsec*IPMTIME) { i = (gvp->instcount-previnstcount) / - ((tv.tv_sec-prev_tv.tv_sec-1)*1000 + (tv.tv_usec+1000000-prev_tv.tv_usec)/1000); - if (i > 0) + ((tv.tv_sec-prev_tv.tv_sec)*1000.0 + (tv.tv_usec-prev_tv.tv_usec)/1000.0); + if (i > 0) { + //printf("ic= %u, prev= %u, diff= %u, ipmsec= %d, prev= %d, diff= %d\n", gvp->instcount, previnstcount, gvp->instcount-previnstcount, i, gvp->instpermsec, i-gvp->instpermsec); gvp->instpermsec = i; - printf("instcount = %u, previnstcount = %u, diff=%u, instpermsec=%d\n", gvp->instcount, previnstcount, gvp->instcount-previnstcount, gvp->instpermsec); + } #ifdef NOIDLE //printf("\ninstpermsec=%d\n", gvp->instpermsec); #endif - /* call the security check code every 5 seconds */ + /* call the security check code */ secure(tv); } diff --git a/makefile b/makefile index f44e739..587ee4e 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ REV=${shell hg id -n} -.PHONY: broken em emp debug debugp trace tracep vfy vfyp fixed fixedp demo demop dongleprog lmserver magrst magsav parts smad smag mtread mtwrite +.PHONY: broken em emp debug debugp trace tracep vfy vfyp fixed fixedp demo demop demol dongleprog lmserver magrst magsav parts smad smag mtread mtwrite em: # production (Intel) @@ -14,7 +14,7 @@ em: # production (Intel) emp: # production (PowerPC) - cc -arch ppc -mmacosx-version-min=10.4 -DWITHREGS -DREV=\"${REV}\" -DNOTRACE -DFAST -DNOMEM -O -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/ppc/api;g++ -arch ppc -o em em.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -DNOREGS -mmacosx-version-min=10.4 -fno-stack-protector -DREV=\"${REV}\" -DNOTRACE -DFAST -DNOMEM -O -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/Universal/api;g++ -arch ppc -o em em.o dongle/mx/Universal/api/libmxmac260.a -framework IOKit -framework CoreFoundation strip em rm em.o @@ -27,7 +27,7 @@ debug: # gdb (Intel) debugp: # gdb (PowerPC) - cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DNOREGS -g -O0 -DNOTRACE -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/ppc/api;g++ -arch ppc -o em em.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DNOREGS -g -O0 -DNOTRACE -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/PPC/api;g++ -arch ppc -o em em.o dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation rm em.o @@ -38,7 +38,7 @@ trace: # tracing + gdb (Intel) tracep: # tracing + gdb (PowerPC) - cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DNOREGS -g -O0 -DNOFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/ppc/api;g++ -arch ppc -o em em.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DNOREGS -g -O0 -DNOFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/PPC/api;g++ -arch ppc -o em em.o dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation vfy: # prod + tracing to verify em changes (Intel) @@ -48,7 +48,7 @@ vfy: # prod + tracing to verify em changes (Intel) vfyp: # prod + tracing to verify em changes (PowerPC) - cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"\" -O -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/ppc/api;g++ -arch ppc -o em em.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"\" -O -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/PPC/api;g++ -arch ppc -o em em.o dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation fixed: # fixed clock rate, gdb (Intel) @@ -59,7 +59,7 @@ fixed: # fixed clock rate, gdb (Intel) fixedp: # fixed clock rate, gdb (PowerPC) - cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DFIXEDCLOCK -DNOIDLE -DNOREGS -g -O0 -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/ppc/api;g++ -arch ppc -o em em.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -mmacosx-version-min=10.4 -DREV=\"${REV}\" -DFIXEDCLOCK -DNOIDLE -DNOREGS -g -O0 -DFAST -c em.c -fobey-inline -mdynamic-no-pic -Idongle/mx/PPC/api;g++ -arch ppc -o em em.o dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation rm em.o @@ -75,15 +75,21 @@ demop: # demo (PowerPC) strip em +demol: # demo (limited: 1-2 amlc, 1 disk drive up to 160MB, one PNC node) (Intel, LLVM) + + llvm-gcc -DREV=\"${REV}\" -DNOREGS -DDEMO -DNOTRACE -DFAST -O em.c -fobey-inline -mdynamic-no-pic -o em + strip em + + dongleprog: # utility to program a dongle - cc -arch ppc -DREV=\"${REV}\" -c dongleprog.c -Idongle/mx/ppc/api;g++ -arch ppc -o dongleprog dongleprog.o dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -DREV=\"${REV}\" -c dongleprog.c -Idongle/mx/PPC/api;g++ -arch ppc -o dongleprog dongleprog.o dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation rm dongleprog.o lmserver: # license server - cc -arch ppc -DREV=\"${REV}\" -c lmserver.c -Idongle/mx/ppc/api;g++ -arch ppc lmserver.o -o lmserver dongle/mx/ppc/api/libmxmac260.a -framework IOKit -framework CoreFoundation + cc -arch ppc -DREV=\"${REV}\" -c lmserver.c -Idongle/mx/PPC/api;g++ -arch ppc lmserver.o -o lmserver dongle/mx/PPC/api/libmxmac260.a -framework IOKit -framework CoreFoundation rm lmserver.o mtread: # Dump a tape to a .tap disk file (Linux only)