|
SASC-NG
DVBSoftCAM
|
#include <nagra2.h>
Public Member Functions | |
| cN2Timer (void) | |
| bool | AddCycles (unsigned int count) |
| unsigned int | Cycles (void) |
| unsigned char | Ctrl (void) |
| void | Ctrl (unsigned char c) |
| unsigned char | Latch (void) |
| void | Latch (unsigned char val) |
| void | SetNumber (int Nr) |
| int | Number (void) |
| cN2Timer::cN2Timer | ( | void | ) |
| bool cN2Timer::AddCycles | ( | unsigned int | count | ) |
Definition at line 42 of file nagra2.c.
References count.
{
if(Running()) {
cycles+=count;
if(!delayInterrupt && InterruptSet() && cycles>=intrCycles) {
delayInterrupt=intrCycles-cycles+3;
if(delayInterrupt<0) delayInterrupt=count; else delayInterrupt+=count;
intrCycles=0;
if((ctrl&tmCONTINUOUS)) Update();
}
}
if(delayInterrupt) {
delayInterrupt-=count;
if(delayInterrupt<0) delayInterrupt=0;
if(!delayInterrupt) {
Update();
return true;
}
}
return false;
}
| void cN2Timer::Ctrl | ( | unsigned char | c | ) |
Definition at line 131 of file nagra2.c.
References L_SYS_EMU, Latch(), and PRINTF.
{
if(Running()) {
ctrl=(ctrl&~tmRUNNING) | (val&tmRUNNING);
if(!Running()) {
Stop();
--cycles;
Update();
PRINTF(L_SYS_EMU,"n2timer %d: stopped cycles=%d (%02x) ctrl=%02x latch=%02x\n",nr,cycles,val,ctrl,latch&0xff);
}
}
else {
ctrl=(ctrl&~tmMASK) | (val&tmMASK);
divisor=GetDivisor();
if(divisor) invDivisor=1.0/divisor;
if(Running()) {
if(!(ctrl&tmLATCHED) && divisor>0) {
if(this->val==0) {
timerBugged=true;
cycles=(unsigned int)divisor;
}
else {
cycles=(unsigned int)(((timerBugged?0x100:latch)-this->val+1) * divisor);
}
}
if((ctrl&tmINTERRUPT)) {
intrCycles=cycles+(unsigned int)((timerBugged?0x101:this->val?this->val:latch)*divisor);
if(nr==2) PRINTF(L_SYS_EMU,"n2timer %d: set for %u cycles (%02x %02x)",nr,intrCycles-cycles,Latch(),ctrl&0xff);
}
ctrl&=~tmLATCHED;
}
}
}
| unsigned char cN2Timer::Ctrl | ( | void | ) |
Definition at line 115 of file nagra2.c.
Referenced by cMapMemHW::Get(), and cMapMemHW::Set().
{
if(Running()) Update();
return ctrl;
}
| unsigned int cN2Timer::Cycles | ( | void | ) |
| unsigned char cN2Timer::Latch | ( | void | ) | [inline] |
Definition at line 209 of file nagra2.h.
Referenced by Ctrl(), cMapMemHW::Get(), and cMapMemHW::Set().
{ return latch&0xFF; }
| void cN2Timer::Latch | ( | unsigned char | val | ) |
| int cN2Timer::Number | ( | void | ) | [inline] |