~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/emu/watchdog.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    watchdog_init - one time initialization
37
37
-------------------------------------------------*/
38
38
 
39
 
void watchdog_init(running_machine *machine)
 
39
void watchdog_init(running_machine &machine)
40
40
{
41
41
        /* allocate a timer for the watchdog */
42
 
        watchdog_timer = timer_alloc(machine, watchdog_callback, NULL);
 
42
        watchdog_timer = machine.scheduler().timer_alloc(FUNC(watchdog_callback));
43
43
 
44
 
        machine->add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset);
 
44
        machine.add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset);
45
45
 
46
46
        /* save some stuff in the default tag */
47
 
        state_save_register_item(machine, "watchdog", NULL, 0, watchdog_enabled);
48
 
        state_save_register_item(machine, "watchdog", NULL, 0, watchdog_counter);
 
47
        machine.state().save_item(NAME(watchdog_enabled));
 
48
        machine.state().save_item(NAME(watchdog_counter));
49
49
}
50
50
 
51
51
 
57
57
static void watchdog_internal_reset(running_machine &machine)
58
58
{
59
59
        /* set up the watchdog timer; only start off enabled if explicitly configured */
60
 
        watchdog_enabled = (machine.m_config.m_watchdog_vblank_count != 0 || attotime_compare(machine.m_config.m_watchdog_time, attotime_zero) != 0);
61
 
        watchdog_reset(&machine);
 
60
        watchdog_enabled = (machine.config().m_watchdog_vblank_count != 0 || machine.config().m_watchdog_time != attotime::zero);
 
61
        watchdog_reset(machine);
62
62
        watchdog_enabled = TRUE;
63
63
}
64
64
 
75
75
        popmessage("Reset caused by the watchdog!!!\n");
76
76
#endif
77
77
 
78
 
        machine->schedule_soft_reset();
 
78
        machine.schedule_soft_reset();
79
79
}
80
80
 
81
81
 
90
90
        if (vblank_state && watchdog_enabled)
91
91
        {
92
92
                /* check the watchdog */
93
 
                if (screen.machine->config->m_watchdog_vblank_count != 0)
 
93
                if (screen.machine().config().m_watchdog_vblank_count != 0)
94
94
                {
95
95
                        watchdog_counter = watchdog_counter - 1;
96
96
 
97
97
                        if (watchdog_counter == 0)
98
 
                                watchdog_callback(screen.machine, NULL, 0);
 
98
                                watchdog_callback(screen.machine(), NULL, 0);
99
99
                }
100
100
        }
101
101
}
105
105
    watchdog_reset - reset the watchdog timer
106
106
-------------------------------------------------*/
107
107
 
108
 
void watchdog_reset(running_machine *machine)
 
108
void watchdog_reset(running_machine &machine)
109
109
{
110
110
        /* if we're not enabled, skip it */
111
111
        if (!watchdog_enabled)
112
 
                timer_adjust_oneshot(watchdog_timer, attotime_never, 0);
 
112
                watchdog_timer->adjust(attotime::never);
113
113
 
114
114
        /* VBLANK-based watchdog? */
115
 
        else if (machine->config->m_watchdog_vblank_count != 0)
 
115
        else if (machine.config().m_watchdog_vblank_count != 0)
116
116
        {
117
 
                watchdog_counter = machine->config->m_watchdog_vblank_count;
 
117
                watchdog_counter = machine.config().m_watchdog_vblank_count;
118
118
 
119
119
                /* register a VBLANK callback for the primary screen */
120
 
                if (machine->primary_screen != NULL)
121
 
                        machine->primary_screen->register_vblank_callback(on_vblank, NULL);
 
120
                if (machine.primary_screen != NULL)
 
121
                        machine.primary_screen->register_vblank_callback(on_vblank, NULL);
122
122
        }
123
123
 
124
124
        /* timer-based watchdog? */
125
 
        else if (attotime_compare(machine->config->m_watchdog_time, attotime_zero) != 0)
126
 
                timer_adjust_oneshot(watchdog_timer, machine->config->m_watchdog_time, 0);
 
125
        else if (machine.config().m_watchdog_time != attotime::zero)
 
126
                watchdog_timer->adjust(machine.config().m_watchdog_time);
127
127
 
128
128
        /* default to an obscene amount of time (3 seconds) */
129
129
        else
130
 
                timer_adjust_oneshot(watchdog_timer, ATTOTIME_IN_SEC(3), 0);
 
130
                watchdog_timer->adjust(attotime::from_seconds(3));
131
131
}
132
132
 
133
133
 
135
135
    watchdog_enable - reset the watchdog timer
136
136
-------------------------------------------------*/
137
137
 
138
 
void watchdog_enable(running_machine *machine, int enable)
 
138
void watchdog_enable(running_machine &machine, int enable)
139
139
{
140
140
        /* when re-enabled, we reset our state */
141
141
        if (watchdog_enabled != enable)