view src/timer.h @ 58:bed2d84eeabe

Fix ldimh special casing of loading labels for the case when the label is not a forward reference
author Michael Pavone <pavone@retrodev.com>
date Tue, 06 Sep 2016 09:42:31 -0700
parents fb14515266f4
children
line wrap: on
line source

#ifndef TIMER_H_
#define TIMER_H_

typedef struct {
	uint32_t cycles;
	uint32_t clock_inc;
	
	uint16_t load;
	uint16_t current;
	uint8_t  pending;
} timer;

void timer_init(timer *context, uint32_t clock_div);
void timer_run(timer *context, uint32_t target);
uint32_t timer_next_interrupt(timer *context);
void timer_write(timer *context, uint16_t value);

#endif