SASC-NG
DVBSoftCAM

cMapMemHW Class Reference

#include <nagra2.h>

Inheritance diagram for cMapMemHW:

List of all members.

Public Member Functions

 cMapMemHW (void)
virtual unsigned char Get (unsigned short ea)
virtual void Set (unsigned short ea, unsigned char val)
int AddCycles (unsigned int num)

Detailed Description

Definition at line 245 of file nagra2.h.


Constructor & Destructor Documentation

cMapMemHW::cMapMemHW ( void  )

Definition at line 249 of file nagra2.c.

References HW_NUM, i, L_SYS_EMU, MAX_TIMERS, cMapMem::offset, PRINTF, and cMapMem::size.

:cMapMem(HW_OFFSET,HW_REGS)
{
  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);
}

Member Function Documentation

int cMapMemHW::AddCycles ( unsigned int  num)

Definition at line 256 of file nagra2.c.

References cN2CRC::AddCycles(), i, MAX_TIMERS, and cN2Timer::Number().

Referenced by cN2Prov0501::TimerHandler(), and cN2Prov0101::TimerHandler().

{
  crc.AddCycles(num);
  int mask=0;
  for(int i=0; i<MAX_TIMERS; i++)
    if(timer[i].AddCycles(num)) mask|=1<<timer[i].Number();
  return mask;
}
unsigned char cMapMemHW::Get ( unsigned short  ea) [virtual]

Reimplemented from cMapMem.

Definition at line 265 of file nagra2.c.

References cN2CRC::Ctrl(), cN2Timer::Ctrl(), cN2Timer::Cycles(), cN2CRC::Data(), cN2Timer::Latch(), cMapMem::mem, cMapMem::offset, cMapMem::size, and TIMER_NUM.

{
  if(ea<offset || ea>=offset+size) return 0;
  ea-=offset;
  switch(ea) {
    case HW_SECURITY:
      return (mem[ea]&0x70)|0x0F;
    case HW_TIMER0_CONTROL:
    case HW_TIMER1_CONTROL:
    case HW_TIMER2_CONTROL:
      return timer[TIMER_NUM(ea)].Ctrl();
    case HW_TIMER0_DATA:
    case HW_TIMER1_DATA:
    case HW_TIMER2_DATA:
      return timer[TIMER_NUM(ea)].Cycles();
    case HW_TIMER0_LATCH:
    case HW_TIMER1_LATCH:
    case HW_TIMER2_LATCH:
      return timer[TIMER_NUM(ea)].Latch();
    case HW_CRC_CONTROL:
      return crc.Ctrl();
    case HW_CRC_DATA:
      return crc.Data();
    default:
      return mem[ea];
    }
}
void cMapMemHW::Set ( unsigned short  ea,
unsigned char  val 
) [virtual]

Reimplemented from cMapMem.

Definition at line 293 of file nagra2.c.

References cN2CRC::Ctrl(), cN2Timer::Ctrl(), cN2CRC::Data(), cN2Timer::Latch(), cMapMem::mem, cMapMem::offset, cMapMem::size, and TIMER_NUM.

{
  if(ea<offset || ea>=offset+size) return;
  ea-=offset;
  switch(ea) {
    case HW_TIMER0_CONTROL:
    case HW_TIMER1_CONTROL:
    case HW_TIMER2_CONTROL:
      timer[TIMER_NUM(ea)].Ctrl(val);
      break;
    case HW_TIMER0_LATCH:
    case HW_TIMER1_LATCH:
    case HW_TIMER2_LATCH:
      timer[TIMER_NUM(ea)].Latch(val);
      break;
    case HW_CRC_CONTROL:
      crc.Ctrl(val);
      break;
    case HW_CRC_DATA:
      crc.Data(val);
      break;
    default:
      mem[ea]=val;
      break;
    }
}

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