Add some timer related constants.

This commit is contained in:
Jean-Philip Desjardins 2019-01-02 21:32:11 -05:00
parent e9a6f17ab8
commit d507c7df9d
2 changed files with 17 additions and 5 deletions

View File

@ -30,18 +30,18 @@ void CTimer::Count(unsigned int ticks)
uint32 nextCount = timer.nCOUNT;
uint32 divider = 1;
switch(timer.nMODE & 0x03)
switch(timer.nMODE & MODE_CLOCK_SELECT)
{
case 0x00:
case MODE_CLOCK_SELECT_BUSCLOCK:
divider = 1;
break;
case 0x01:
case MODE_CLOCK_SELECT_BUSCLOCK16:
divider = 16;
break;
case 0x02:
case MODE_CLOCK_SELECT_BUSCLOCK256:
divider = 256;
break;
case 0x03:
case MODE_CLOCK_SELECT_EXTERNAL:
divider = 9437; // PAL
break;
}

View File

@ -10,6 +10,13 @@ class CTimer
public:
enum
{
MODE_CLOCK_SELECT = 0x003,
MODE_CLOCK_SELECT_BUSCLOCK = 0x000,
MODE_CLOCK_SELECT_BUSCLOCK16 = 0x001,
MODE_CLOCK_SELECT_BUSCLOCK256 = 0x002,
MODE_CLOCK_SELECT_EXTERNAL = 0x003,
MODE_GATE_ENABLE = 0x004,
MODE_GATE_SELECT = 0x008,
@ -28,6 +35,11 @@ public:
MODE_OVERFLOW_FLAG = 0x800,
};
enum REGISTER
{
T3_MODE = 0x10001810,
};
CTimer(CINTC&);
virtual ~CTimer() = default;