2 blender for the Gameboy Advance
3 Copyright (C) 2021 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
23 #define enable_timer(x) \
24 do { REG_TMCNT_H(x) |= TMCNT_EN; } while(0)
26 #define disable_timer(x) \
27 do { REG_TMCNT_H(x) &= ~TMCNT_EN; } while(0)
29 volatile unsigned long timer_msec;
31 void init_timer(int tm, unsigned long rate_hz, void (*intr)(void));
33 void reset_msec_timer(void);
35 void delay(unsigned long ms);
38 #define udelay(x) asm volatile ( \
39 "0: sub %0, %0, #1\n\t" \
43 #define udelay(x) asm volatile ( \
44 "0: subs %0, %0, #1\n\t" \
49 #endif /* _TIMER_H_ */