SASC
DVBSoftCAM

cN2Timer Class Reference

#include <nagra2.h>

List of all members.

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 (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)

Detailed Description

Definition at line 189 of file nagra2.h.


Constructor & Destructor Documentation

cN2Timer::cN2Timer ( void  )

Definition at line 36 of file nagra2.c.

{
  cycles=intrCycles=delayInterrupt=0; ctrl=0; val=0; divisor=0; invDivisor=0; latch=0xFF;
  timerBugged=false;
}
cN2Timer::cN2Timer ( void  )

Member Function Documentation

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;
}
bool cN2Timer::AddCycles ( unsigned int  count)
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  )
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;
}
void cN2Timer::Ctrl ( unsigned char  c)
unsigned int cN2Timer::Cycles ( void  )

Definition at line 108 of file nagra2.c.

References L_SYS_EMU, and PRINTF.

Referenced by cMapMemHW::Get().

{
  if(Running()) Update();
  PRINTF(L_SYS_EMU,"n2timer %d: read %u %02x %02x = %02x",nr,cycles,ctrl&0xff,latch&0xff,val);
  return val;
}
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)

Definition at line 121 of file nagra2.c.

{
  if(!Running()) {
    latch=val; if(latch==0) latch=0x100;
    cycles=0;
    ctrl|=tmLATCHED;
    timerBugged=false;
    }
}
void cN2Timer::Latch ( unsigned char  val)
unsigned char cN2Timer::Latch ( void  ) [inline]

Definition at line 209 of file nagra2.h.

{ return latch&0xFF; }
int cN2Timer::Number ( void  ) [inline]

Definition at line 212 of file nagra2.h.

{ return nr; }
int cN2Timer::Number ( void  ) [inline]

Definition at line 212 of file nagra2.h.

Referenced by cMapMemHW::AddCycles().

{ return nr; }
void cN2Timer::SetNumber ( int  Nr) [inline]

Definition at line 211 of file nagra2.h.

{ nr=Nr; }
void cN2Timer::SetNumber ( int  Nr) [inline]

Definition at line 211 of file nagra2.h.

{ nr=Nr; }

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines