70 lines
1.1 KiB
C
70 lines
1.1 KiB
C
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <exec/task.h>
|
|
#include <exec/hal.h>
|
|
|
|
int interrupts_enabled = 0;
|
|
|
|
void HandleTimerInterrupt(int sig) {
|
|
if (!interrupts_enabled) {
|
|
signal(SIGALRM, HandleTimerInterrupt);
|
|
return;
|
|
}
|
|
execTicks++;
|
|
signal(SIGALRM, HandleTimerInterrupt);
|
|
Yield();
|
|
}
|
|
|
|
void HalInit(void) {
|
|
signal(SIGALRM, HandleTimerInterrupt);
|
|
HalSetTimerFrequency(100);
|
|
}
|
|
|
|
void HalPrintChar(char c) {
|
|
putchar(c);
|
|
fflush(stdout);
|
|
}
|
|
|
|
void HalSetTimerFrequency(uint32_t frequency) {
|
|
uint32_t us = 1000000 / frequency;
|
|
ualarm(us, us);
|
|
}
|
|
|
|
void HalEnableInterrupts(void) {
|
|
interrupts_enabled = 1;
|
|
}
|
|
|
|
void HalDisableInterrupts(void) {
|
|
interrupts_enabled = 0;
|
|
}
|
|
|
|
int HalCheckInterrupts(void) {
|
|
return interrupts_enabled;
|
|
}
|
|
|
|
void HalMaskInterrupt(int irq) {
|
|
|
|
}
|
|
|
|
void HalUnmaskInterrupt(int irq) {
|
|
|
|
}
|
|
|
|
void HalAcknowledgeInterrupt(int irq) {
|
|
|
|
}
|
|
|
|
void HalSetIRQHandler(int irq, void (*handler)(void)) {
|
|
|
|
}
|
|
|
|
void HalDetect(void) {
|
|
|
|
}
|
|
|
|
void HalSetupTask(struct Task *task, uintptr_t initial_pc, uintptr_t final_pc) {
|
|
|
|
} |