Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (23 sloc) 0.645 kB
#include "bemu.h"
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
extern beta_cpu CPU;
static void clock_tick(int signal) {
CPU.set_interrupt(INT_CLK);
}
void start_clock(void) {
struct itimerval timer = {
{ 0, 1000000 / BETA_HZ }, /* Interval */
{ 0, 1000000 / BETA_HZ }, /* Current */
};
if(signal(SIGALRM, clock_tick) < 0) {
perror("signal");
panic("Can't set timer signal handler");
}
if(setitimer(ITIMER_REAL, &timer, NULL) < 0) {
perror("setitimer");
panic("Unable to start the Beta clock.");
}
LOG("Started the clock at %dHz", BETA_HZ);
}
Jump to Line
Something went wrong with that request. Please try again.