Previous 199869 Revisions Next

r19741 Sunday 23rd December, 2012 at 05:28:04 UTC by Nathan Woods
[MSM6242] Fixing RTC regressions regarding interrupt callbacks
[src/emu/machine]msm6242.c msm6242.h

trunk/src/emu/machine/msm6242.c
r19740r19741
4141
4242#define TIMER_RTC_CALLBACK      1
4343
44#define LOG_UNMAPPED         1
45#define LOG_IRQ               1
44#define LOG_UNMAPPED         0
45#define LOG_IRQ               0
46#define LOG_IRQ_ENABLE         0
4647
4748
4849
r19740r19741
316317   // if set, convert ticks to an attotime
317318   if (callback_ticks > 0)
318319   {
319      callback_time = attotime::from_ticks(callback_ticks, clock()) - machine().time();
320      // get the current time
321      UINT64 curtime = current_time();
322
323      // we need the absolute callback time, in ticks
324      UINT64 absolute_callback_ticks = curtime + callback_ticks;
325
326      // convert that to an attotime
327      attotime absolute_callback_time = attotime::from_ticks(absolute_callback_ticks, clock());     
328
329      // and finally get the delta as an attotime
330      callback_time = absolute_callback_time - machine().time();
320331   }
321332
322333   m_timer->adjust(callback_time);
r19740r19741
342353void msm6242_device::rtc_timer_callback()
343354{
344355   update_rtc_registers();
356   update_timer();
345357}
346358
347359
r19740r19741
359371
360372
361373
374//-------------------------------------------------
375//  get_clock_nibble
376//-------------------------------------------------
377
378const char *msm6242_device::irq_type_string(UINT8 irq_type)
379{
380   switch(irq_type)
381   {
382      case IRQ_64THSECOND:   return "1/64th second";
383      case IRQ_SECOND:      return "second";
384      case IRQ_MINUTE:      return "minute";
385      case IRQ_HOUR:         return "hour";
386      default:            return "???";
387   }
388}
389
390
391
362392//**************************************************************************
363393//  READ/WRITE HANDLERS
364394//**************************************************************************
r19740r19741
487517         {
488518            m_irq_flag = 1;
489519            m_irq_type = (data & 0xc) >> 2;
520
521            if (LOG_IRQ_ENABLE)
522               logerror("%s: MSM6242 enabling irq '%s'\n", machine().describe_context(), irq_type_string(m_irq_type));
490523         }
491524         else
492525         {
493526            m_irq_flag = 0;
494527            if ( !m_res_out_int_func.isnull() )
495528               m_res_out_int_func( CLEAR_LINE );
529
530            if (LOG_IRQ_ENABLE)
531               logerror("%s: MSM6242 disabling irq\n", machine().describe_context());
496532         }
497533         break;
498534
trunk/src/emu/machine/msm6242.h
r19740r19741
8181   void update_rtc_registers();
8282   void update_timer();
8383   UINT8 get_clock_nibble(int rtc_register, bool high);
84   static const char *irq_type_string(UINT8 irq_type);
8485};
8586
8687

Previous 199869 Revisions Next


© 1997-2024 The MAME Team