]> www.vanbest.org Git - sasc-ng.git/commitdiff
nagra: map cycle tweaks
authorleslie <unknown>
Sun, 15 Jun 2008 02:28:18 +0000 (10:28 +0800)
committerleslie <unknown>
Sun, 15 Jun 2008 02:28:18 +0000 (10:28 +0800)
systems/nagra/nagra2-0101.c
systems/nagra/nagra2-0501.c
systems/nagra/nagra2-4101.c
systems/nagra/nagra2.c
systems/nagra/nagra2.h

index 0ae84ce0e1b6c72d1d2ac469c9b1cf60ae1ad6e2..0e4f4b6912a01f0223647576910d5205cf90f1c8 100644 (file)
@@ -126,7 +126,7 @@ private:
   //
   void MakePrime(BIGNUM *n, unsigned char *residues);
 protected:
-  bool Map(int f, unsigned char *data, int l);
+  virtual bool Map(int f, unsigned char *data, int l);
   };
 
 const unsigned char cMap0101::primes[] = {
@@ -378,7 +378,7 @@ protected:
   virtual void Stepper(void);
   virtual void TimerHandler(unsigned int num);
   virtual void AddMapCycles(unsigned int num);
-  virtual unsigned int MapCycles(void) { return Cycles(); }
+  virtual unsigned int CpuCycles(void) { return Cycles(); }
 public:
   cN2Prov0101(int Id, int Flags);
   virtual bool PostProcAU(int id, unsigned char *data);
index c15266153e8523359122348b1d70a596189e6af8..3beac087e5a8ffe0eac62a76d6be426f65fa15fd 100644 (file)
@@ -27,7 +27,7 @@
 
 class cMap0501 : public cMapCore {
 protected:
-  bool Map(int f, unsigned char *data, int l);
+  virtual bool Map(int f, unsigned char *data, int l);
   };
 
 bool cMap0501::Map(int f, unsigned char *data, int l)
index 35a45f3cfe196531fbe31ec24f16bd476ff45e7e..2154985c2022c713d0d3ea7229d6ac3eade0a7e8 100644 (file)
@@ -27,7 +27,7 @@
 
 class cMap4101 : public cMapCore {
 protected:
-  bool Map(int f, unsigned char *data, int l);
+  virtual bool Map(int f, unsigned char *data, int l);
   };
 
 bool cMap4101::Map(int f, unsigned char *data, int l)
index 025d0fde11eb82b1a7ab33b089cfc05b9c1a1a7d..cc5a424bad4e0171ac45ae7a3676ca958c9ae96d 100644 (file)
@@ -669,15 +669,18 @@ void cMapCore::DoMap(int f, unsigned char *data, int l)
 {
   PRINTF(L_SYS_MAP,"%04x: calling function %02X",mapid,f);
   cycles=0;
-  unsigned int startcycles=MapCycles();
+  unsigned int startcycles=CpuCycles();
   interrupted=false; interruptible=true;
   try {
     if(!Map(f,data,l) && !MapGeneric(f,data,l))
       PRINTF(L_SYS_MAP,"%04x: unsupported call %02x",mapid,f);
+    if(cycles) {
+      unsigned int elapsed=CpuCycles()-startcycles;
+      if(cycles>elapsed) AddMapCycles(cycles-elapsed);
+      }
     } catch(int) { interrupted=true; }
   interruptible=false;
-  if(!interrupted && cycles)
-    AddMapCycles(MapCycles()-startcycles);
+  cycles=CpuCycles()-startcycles;
 }
 
 bool cMapCore::MapGeneric(int f, unsigned char *data, int l)
index c7367a65bbecaef4d5591d39b9a5d54520446c31..1d4f4babcc39bfc737971500fecaec2565b9cbaa 100644 (file)
@@ -170,7 +170,8 @@ protected:
   bool Interruptible(void) { return interruptible; }
   bool Interrupted(void) { return interrupted; }
   virtual void AddMapCycles(unsigned int num) {}
-  virtual unsigned int MapCycles(void) { return 0; }
+  unsigned int MapCycles(void) { return cycles; }
+  virtual unsigned int CpuCycles(void) { return 0; }
 public:
   cMapCore(void);
   virtual ~cMapCore() {}