Mercurial > repos > simple16
comparison 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 |
comparison
equal
deleted
inserted
replaced
24:4c9dbfa30a66 | 25:fb14515266f4 |
---|---|
1 #ifndef TIMER_H_ | |
2 #define TIMER_H_ | |
3 | |
4 typedef struct { | |
5 uint32_t cycles; | |
6 uint32_t clock_inc; | |
7 | |
8 uint16_t load; | |
9 uint16_t current; | |
10 uint8_t pending; | |
11 } timer; | |
12 | |
13 void timer_init(timer *context, uint32_t clock_div); | |
14 void timer_run(timer *context, uint32_t target); | |
15 uint32_t timer_next_interrupt(timer *context); | |
16 void timer_write(timer *context, uint16_t value); | |
17 | |
18 #endif |