Create arch_init function, enable interrupts

This commit is contained in:
Jeremy Soller
2020-02-03 15:27:27 -07:00
parent ce22dd5208
commit c1fbbce805
7 changed files with 35 additions and 65 deletions

20
src/arch/8051/arch.c Normal file
View 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;
}

View File

@ -0,0 +1,6 @@
#ifndef _ARCH_ARCH_H
#define _ARCH_ARCH_H
void arch_init(void);
#endif // _ARCH_ARCH_H

View File

@ -1,6 +1,8 @@
#ifndef _ARCH_TIME_H
#define _ARCH_TIME_H
#include <stdint.h>
void time_init(void);
uint32_t time_get(void);

View File

@ -1,7 +1,6 @@
// Uses timer 0 to keep track of global time
#include <8051.h>
#include <stdint.h>
#include <arch/time.h>

View File

@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdio.h>
#include <arch/arch.h>
#include <arch/delay.h>
#include <arch/time.h>
#include <board/battery.h>
@ -20,28 +21,8 @@
uint8_t main_cycle = 0;
void external_0(void) __interrupt(0) {
TRACE("external_0\n");
}
void external_1(void) __interrupt(2) {
TRACE("external_1\n");
}
void timer_1(void) __interrupt(3) {
TRACE("timer_1\n");
}
void serial(void) __interrupt(4) {
TRACE("serial\n");
}
void timer_2(void) __interrupt(5) {
TRACE("timer_2\n");
}
void init(void) {
time_init();
arch_init();
gpio_init();
gctrl_init();

View File

@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdio.h>
#include <arch/arch.h>
#include <arch/delay.h>
#include <arch/time.h>
#include <board/battery.h>
@ -21,28 +22,8 @@
uint8_t main_cycle = 0;
void external_0(void) __interrupt(0) {
TRACE("external_0\n");
}
void external_1(void) __interrupt(2) {
TRACE("external_1\n");
}
void timer_1(void) __interrupt(3) {
TRACE("timer_1\n");
}
void serial(void) __interrupt(4) {
TRACE("serial\n");
}
void timer_2(void) __interrupt(5) {
TRACE("timer_2\n");
}
void init(void) {
time_init();
arch_init();
gpio_init();
gctrl_init();

View File

@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdio.h>
#include <arch/arch.h>
#include <arch/delay.h>
#include <arch/time.h>
#include <board/battery.h>
@ -21,28 +22,8 @@
uint8_t main_cycle = 0;
void external_0(void) __interrupt(0) {
TRACE("external_0\n");
}
void external_1(void) __interrupt(2) {
TRACE("external_1\n");
}
void timer_1(void) __interrupt(3) {
TRACE("timer_1\n");
}
void serial(void) __interrupt(4) {
TRACE("serial\n");
}
void timer_2(void) __interrupt(5) {
TRACE("timer_2\n");
}
void init(void) {
time_init();
arch_init();
gpio_init();
gctrl_init();