artiq/soc/runtime/main.c

42 lines
733 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)
{
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");
2014-07-21 08:28:56 +08:00
2014-07-04 23:49:08 +08:00
while(1) {
length = ident_and_download_kernel(kbuf, sizeof(kbuf));
2014-07-04 23:49:08 +08:00
if(length > 0) {
2014-08-28 16:56:48 +08:00
if(load_elf(resolve_symbol, kbuf, length, kcode, sizeof(kcode))) {
rtio_init();
2014-07-24 07:10:49 +08:00
dds_init();
2014-08-28 16:56:48 +08:00
flush_cpu_icache();
2014-07-08 01:13:43 +08:00
k();
2014-08-28 16:56:48 +08:00
kernel_finished();
2014-07-08 01:13:43 +08:00
}
2014-07-04 23:49:08 +08:00
}
}
2014-08-28 16:56:48 +08:00
2014-07-04 23:49:08 +08:00
return 0;
}