-//This approach is probably wrong, since the timer is continuously counting down, though
-//it might only be a problem if the # of interrupts generated is greater than 1--the M68K's
-//timeslice should be running during that phase... (The DSP needs to be aware of this!)
-
-//This is only used by the old system, so once the new timer system is working this
-//should be safe to nuke.
-void JERRYI2SExec(uint32 cycles)
-{
-#ifndef NEW_TIMER_SYSTEM
-#warning "externed var in source--should be in header file. !!! FIX !!!"
- extern uint16 serialMode; // From DAC.CPP
- if (serialMode & 0x01) // INTERNAL flag (JERRY is master)
- {
-
- // Why is it called this? Instead of SCLK? Shouldn't this be read from DAC.CPP???
-//Yes, it should. !!! FIX !!!
- JERRYI2SInterruptDivide &= 0xFF;
-
- if (JERRYI2SInterruptTimer == -1)
- {
- // We don't have to divide the RISC clock rate by this--the reason is a bit
- // convoluted. Will put explanation here later...
-// What's needed here is to find the ratio of the frequency to the number of clock cycles
-// in one second. For example, if the sample rate is 44100, we divide the clock rate by
-// this: 26590906 / 44100 = 602 cycles.
-// Which means, every 602 cycles that go by we have to generate an interrupt.
- jerryI2SCycles = 32 * (2 * (JERRYI2SInterruptDivide + 1));
- }
-
- JERYI2SInterruptTimer -= cycles;
- if (JERRYI2SInterruptTimer <= 0)
- {
-//This is probably wrong as well (i.e., need to check enable lines)... !!! FIX !!!
- DSPSetIRQLine(DSPIRQ_SSI, ASSERT_LINE);
- JERRYI2SInterruptTimer += jerryI2SCycles;
-#ifdef JERRY_DEBUG
- if (JERRYI2SInterruptTimer < 0)
- WriteLog("JERRY: Missed generating an interrupt (missed %u)!\n", (-JERRYI2SInterruptTimer / jerryI2SCycles) + 1);
-#endif
- }
- }
- else // JERRY is slave to external word clock
- {
- // This is just a temporary kludge to see if the CD bus mastering works
- // I.e., this is totally faked...!
-// The whole interrupt system is pretty much borked and is need of an overhaul.
-// What we need is a way of handling these interrupts when they happen instead of
-// scanline boundaries the way it is now.
- JERRYI2SInterruptTimer -= cycles;
- if (JERRYI2SInterruptTimer <= 0)
- {
-//This is probably wrong as well (i.e., need to check enable lines)... !!! FIX !!! [DONE]
- if (ButchIsReadyToSend())//Not sure this is right spot to check...
- {
-// return GetWordFromButchSSI(offset, who);
- SetSSIWordsXmittedFromButch();
- DSPSetIRQLine(DSPIRQ_SSI, ASSERT_LINE);
- }
- JERRYI2SInterruptTimer += 602;
- }
- }
-#else
- RemoveCallback(JERRYI2SCallback);
- JERRYI2SCallback();
-#endif
-}
-
-//NOTE: This is only used by the old execution core. Safe to nuke once it's stable.
-void JERRYExecPIT(uint32 cycles)
-{
-//This is wrong too: Counters are *always* spinning! !!! FIX !!! [DONE]
-// if (jerry_timer_1_counter)
- jerry_timer_1_counter -= cycles;
-
- if (jerry_timer_1_counter <= 0)
- {
-//Also, it can generate a CPU interrupt as well... !!! FIX !!! or does it? Maybe it goes Timer->GPU->CPU?
- DSPSetIRQLine(DSPIRQ_TIMER0, ASSERT_LINE); // This does the 'IRQ enabled' checking...
-// JERRYResetPIT1();
- jerry_timer_1_counter += (JERRYPIT1Prescaler + 1) * (JERRYPIT1Divider + 1);
- }
-
-//This is wrong too: Counters are *always* spinning! !!! FIX !!! [DONE]
-// if (jerry_timer_2_counter)
- jerry_timer_2_counter -= cycles;
-
- if (jerry_timer_2_counter <= 0)
- {
-//Also, it can generate a CPU interrupt as well... !!! FIX !!! or does it? Maybe it goes Timer->GPU->CPU?
- DSPSetIRQLine(DSPIRQ_TIMER1, ASSERT_LINE); // This does the 'IRQ enabled' checking...
-// JERRYResetPIT2();
- jerry_timer_2_counter += (JERRYPIT2Prescaler + 1) * (JERRYPIT2Divider + 1);
- }
-}