fix case when no timer is installed at all

This commit is contained in:
Oliver Lehmann 2016-07-02 10:46:38 +02:00
parent 0f11ff363a
commit 675e2feb8c
2 changed files with 16 additions and 12 deletions

4
WEGA/src/cmd/standalone/sa.timer/kernel/timer.c Normal file → Executable file
View File

@ -45,6 +45,7 @@ gettime()
long (*clock_fget)();
void (*clock_fset)();
void (*clock_fstart)();
int clock_found = 0;
t = clock_devs;
@ -53,6 +54,7 @@ gettime()
b = t->clock_det_str;
if(a == b) {
printf("%s found\n",t->clock_name);
clock_found = 1;
clock_finit = t->clock_finit;
clock_fget = t->clock_fget;
clock_fset = t->clock_fset;
@ -64,7 +66,7 @@ gettime()
}
/* function pointer assigned? => RTC found?*/
if (clock_finit > 0) {
if (clock_found == 1) {
clock_finit();
time = clock_fget();
}

4
WEGA/src/cmd/standalone/sa.timer/standalone/sa.timer.c Normal file → Executable file
View File

@ -50,6 +50,7 @@ main()
register i;
struct clock_type *t;
int a,b;
int clock_found = 0;
t = clock_devs;
@ -58,6 +59,7 @@ main()
b = t->clock_det_str;
if(a == b) {
printf("%s found\n",t->clock_name);
clock_found = 1;
clock_finit = t->clock_finit;
clock_fget = t->clock_fget;
clock_fset = t->clock_fset;
@ -69,7 +71,7 @@ main()
}
/* function pointer assigned? => RTC found?*/
if (clock_finit > 0) {
if (clock_found == 1) {
clock_finit();
time = clock_fget();
outtime(time);