mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-01-17 02:30:10 +00:00
test program for C implementation of timer_seconds
Makefile changes are missing.
This commit is contained in:
parent
58d3721058
commit
1b19f15b6a
34
test/clk_timer.c
Normal file
34
test/clk_timer.c
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* test for timer_seconds function */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <conio.h>
|
||||||
|
|
||||||
|
extern void timer_init(void);
|
||||||
|
extern unsigned int timer_seconds(void);
|
||||||
|
|
||||||
|
static int done;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
unsigned char sec, sec2, c;
|
||||||
|
unsigned int x;
|
||||||
|
|
||||||
|
timer_init();
|
||||||
|
printf("Hit <SPACE> to exit...\n");
|
||||||
|
sec = timer_seconds();
|
||||||
|
printf("%02x\n", sec);
|
||||||
|
while (!done) {
|
||||||
|
x = timer_seconds();
|
||||||
|
sec2 = x & 255;
|
||||||
|
if (sec != sec2) {
|
||||||
|
sec = sec2;
|
||||||
|
printf("%02x\n", sec);
|
||||||
|
}
|
||||||
|
if (kbhit()) {
|
||||||
|
c = cgetc();
|
||||||
|
if (c == ' ')
|
||||||
|
done = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
9
test/clk_timer_helper.s
Normal file
9
test/clk_timer_helper.s
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
; helper object file to export clr_timer ASM symbols to C
|
||||||
|
|
||||||
|
.import timer_init, timer_seconds
|
||||||
|
.export _timer_init, _timer_seconds
|
||||||
|
|
||||||
|
_timer_init = timer_init
|
||||||
|
_timer_seconds = timer_seconds
|
||||||
|
|
||||||
|
.end
|
Loading…
x
Reference in New Issue
Block a user