forked from M-Labs/artiq
1
0
Fork 0
artiq/soc/runtime/main.c

43 lines
874 B
C
Raw Normal View History

2014-07-04 23:49:08 +08:00
#include <stdio.h>
#include <irq.h>
#include <uart.h>
#include <system.h>
2014-08-28 16:56:48 +08:00
#include "corecom.h"
2014-07-04 23:49:08 +08:00
#include "elf_loader.h"
2014-08-28 16:56:48 +08:00
#include "symbols.h"
#include "rtio.h"
#include "dds.h"
2014-07-24 07:10:49 +08:00
2014-07-06 04:47:23 +08:00
typedef void (*kernel_function)(void);
2014-07-04 23:49:08 +08:00
int main(void)
{
2014-09-05 12:03:22 +08:00
unsigned char kbuf[256*1024];
unsigned char kcode[256*1024];
kernel_function k;
2014-09-05 12:03:22 +08:00
int length;
2014-07-04 23:49:08 +08:00
2014-09-05 12:03:22 +08:00
irq_setmask(0);
irq_setie(1);
uart_init();
puts("ARTIQ runtime built "__DATE__" "__TIME__"\n");
2014-07-21 08:28:56 +08:00
2014-09-05 12:03:22 +08:00
while(1) {
length = ident_and_download_kernel(kbuf, sizeof(kbuf));
if(length > 0) {
k = load_elf(resolve_symbol, "run", kbuf, length, kcode, sizeof(kcode));
if(k != NULL) {
2014-09-05 12:03:22 +08:00
rtio_init();
dds_init();
flush_cpu_icache();
k();
kernel_finished();
}
}
}
2014-08-28 16:56:48 +08:00
2014-09-05 12:03:22 +08:00
return 0;
2014-07-04 23:49:08 +08:00
}