From: leslie <unknown> Date: Sat, 14 Jun 2008 23:31:15 +0000 (+0800) Subject: nagra: include timer nr in debug X-Git-Tag: 0.9.1~61 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=67b157e3264091e19accabedc4346487d3e11000;p=sasc-ng.git nagra: include timer nr in debug --- diff --git a/systems/nagra/nagra2.c b/systems/nagra/nagra2.c index ba4f79e..025d0fd 100644 --- a/systems/nagra/nagra2.c +++ b/systems/nagra/nagra2.c @@ -56,8 +56,10 @@ bool cN2Timer::AddCycles(unsigned int count) cycles=0; Stop(); } - if((ctrl&tmINTERRUPT) && stop) + if((ctrl&tmINTERRUPT) && stop) { + PRINTF(L_SYS_EMU,"n2timer %d: IRQ triggered",nr); irq=true; + } } return irq; } @@ -77,7 +79,7 @@ void cN2Timer::Ctrl(unsigned char val) ctrl=(ctrl&~tmRUNNING) | (val&tmRUNNING); if(!Running()) { Stop(); - PRINTF(L_SYS_EMU,"n2timer: stopped cycles=%x ctrl=%x",cycles,ctrl); + PRINTF(L_SYS_EMU,"n2timer %d: stopped cycles=%x ctrl=%x",nr,cycles,ctrl); } } else { @@ -87,7 +89,7 @@ void cN2Timer::Ctrl(unsigned char val) else divisor=4; // This is wrong, but we haven't figured the right value out yet if(divisor<=0) divisor=1; // sanity if(!(ctrl&tmLATCHED)) cycles=(unsigned int)(cycles-1)&0xFF; - PRINTF(L_SYS_EMU,"n2timer: started latch=%x div=%d cycles=%x ctrl=%x",latch,divisor,cycles,ctrl); + PRINTF(L_SYS_EMU,"n2timer %d: started latch=%x div=%d cycles=%x ctrl=%x",nr,latch,divisor,cycles,ctrl); remainder=-1; if(!(ctrl&tmCONTINUOUS) && cycles==0) ctrl&=~tmRUNNING; } @@ -109,6 +111,7 @@ cMapMemHW::cMapMemHW(void) cycles=0; CRCvalue=0xffff; CRCpos=0; CRCstarttime=0; CRCinput=0; CRCupdate=false; GenCRC16Table(); + for(int i=0; i<MAX_TIMERS; i++) timer[i].SetNumber(HW_NUM(i)); PRINTF(L_SYS_EMU,"mapmemhw: new HW map off=%04x size=%04x",offset,size); } @@ -134,7 +137,7 @@ int cMapMemHW::AddCycles(unsigned int num) int mask=0; cycles+=num; for(int i=0; i<MAX_TIMERS; i++) - if(timer[i].AddCycles(num)) mask|=(1<<HW_NUM(i)); + if(timer[i].AddCycles(num)) mask|=1<<timer[i].Number(); return mask; } diff --git a/systems/nagra/nagra2.h b/systems/nagra/nagra2.h index e58db97..c7367a6 100644 --- a/systems/nagra/nagra2.h +++ b/systems/nagra/nagra2.h @@ -180,7 +180,7 @@ public: class cN2Timer { private: - int ctrl, divisor, cycles, remainder, latch; + int ctrl, divisor, cycles, remainder, latch, nr; enum { tmCONTINUOUS=0x01, tmRUNNING=0x02, tmINTERRUPT=0x04, tmMASK=0xFF, tmLATCHED=0x100 }; // bool Running(void) { return ctrl&tmRUNNING; } @@ -193,6 +193,8 @@ public: void Ctrl(unsigned char c); unsigned char Latch(void) { return latch&0xFF; } void Latch(unsigned char val); + void SetNumber(int Nr) { nr=Nr; } + int Number(void) { return nr; } }; // ----------------------------------------------------------------