2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 11:48:27 +08:00
artiq/soc/runtime/main.c
2014-09-05 12:03:22 +08:00

42 lines
865 B
C

#include <stdio.h>
#include <irq.h>
#include <uart.h>
#include <system.h>
#include "corecom.h"
#include "elf_loader.h"
#include "symbols.h"
#include "rtio.h"
#include "dds.h"
typedef void (*kernel_function)(void);
int main(void)
{
unsigned char kbuf[256*1024];
unsigned char kcode[256*1024];
kernel_function k = (kernel_function)kcode;
int length;
irq_setmask(0);
irq_setie(1);
uart_init();
puts("ARTIQ runtime built "__DATE__" "__TIME__"\n");
while(1) {
length = ident_and_download_kernel(kbuf, sizeof(kbuf));
if(length > 0) {
if(load_elf(resolve_symbol, kbuf, length, kcode, sizeof(kcode))) {
rtio_init();
dds_init();
flush_cpu_icache();
k();
kernel_finished();
}
}
}
return 0;
}