Create arch_init function, enable interrupts
This commit is contained in:
20
src/arch/8051/arch.c
Normal file
20
src/arch/8051/arch.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <8051.h>
|
||||
|
||||
#include <arch/time.h>
|
||||
|
||||
void external_0(void) __interrupt(0) {}
|
||||
// timer_0 is in time.c
|
||||
void external_1(void) __interrupt(2) {}
|
||||
void timer_1(void) __interrupt(3) {}
|
||||
void serial(void) __interrupt(4) {}
|
||||
void timer_2(void) __interrupt(5) {}
|
||||
|
||||
void arch_init(void) {
|
||||
// Disable interrupts
|
||||
EA = 0;
|
||||
|
||||
time_init();
|
||||
|
||||
// Enable interrupts
|
||||
EA = 1;
|
||||
}
|
6
src/arch/8051/include/arch/arch.h
Normal file
6
src/arch/8051/include/arch/arch.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _ARCH_ARCH_H
|
||||
#define _ARCH_ARCH_H
|
||||
|
||||
void arch_init(void);
|
||||
|
||||
#endif // _ARCH_ARCH_H
|
@ -1,6 +1,8 @@
|
||||
#ifndef _ARCH_TIME_H
|
||||
#define _ARCH_TIME_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void time_init(void);
|
||||
uint32_t time_get(void);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Uses timer 0 to keep track of global time
|
||||
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arch/time.h>
|
||||
|
||||
@ -9,7 +8,7 @@ static volatile uint32_t time_overflows = 0;
|
||||
|
||||
void timer_0(void) __interrupt(1) {
|
||||
time_overflows++;
|
||||
|
||||
|
||||
// Restart timer
|
||||
TR0 = 0;
|
||||
TF0 = 0;
|
||||
|
Reference in New Issue
Block a user