diff src/timer.h @ 25:fb14515266f4

Implemented timer and timer interrupts. Added get/setvbr instructions. Fixed assembler bug. Moved mnemonics into a separate source file
author Michael Pavone <pavone@retrodev.com>
date Thu, 31 Mar 2016 23:25:52 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/timer.h	Thu Mar 31 23:25:52 2016 -0700
@@ -0,0 +1,18 @@
+#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