forked from M-Labs/artiq
1
0
Fork 0

runtime: support arbitrarily long initial DDS setup time

This commit is contained in:
Sebastien Bourdeauducq 2014-09-12 15:40:34 +08:00
parent 92efde1e40
commit 6861d28d2d
3 changed files with 16 additions and 7 deletions

View File

@ -73,7 +73,7 @@ class LinkInterface:
class Environment(LinkInterface): class Environment(LinkInterface):
def __init__(self, ref_period): def __init__(self, ref_period):
self.ref_period = ref_period self.ref_period = ref_period
self.initial_time = 10000 self.initial_time = 2000
def emit_object(self): def emit_object(self):
tm = lt.TargetMachine.new(triple="or1k", cpu="generic") tm = lt.TargetMachine.new(triple="or1k", cpu="generic")

View File

@ -18,9 +18,19 @@
#define RTIO_FUD_CHANNEL 4 #define RTIO_FUD_CHANNEL 4
static void fud_sync(void)
{
rtio_chan_sel_write(RTIO_FUD_CHANNEL);
while(rtio_o_level_read() != 0);
}
static void fud(long long int fud_time) static void fud(long long int fud_time)
{ {
int r;
r = rtio_reset_read();
rtio_reset_write(0); rtio_reset_write(0);
rtio_chan_sel_write(RTIO_FUD_CHANNEL); rtio_chan_sel_write(RTIO_FUD_CHANNEL);
if(fud_time < 0) { if(fud_time < 0) {
rtio_counter_update_write(1); rtio_counter_update_write(1);
@ -32,12 +42,11 @@ static void fud(long long int fud_time)
rtio_o_timestamp_write(fud_time+3*8); rtio_o_timestamp_write(fud_time+3*8);
rtio_o_value_write(0); rtio_o_value_write(0);
rtio_o_we_write(1); rtio_o_we_write(1);
}
static void fud_sync(void) if(r) {
{ fud_sync();
rtio_chan_sel_write(RTIO_FUD_CHANNEL); rtio_reset_write(1);
while(rtio_o_level_read() != 0); }
} }
void dds_init(void) void dds_init(void)

View File

@ -29,8 +29,8 @@ int main(void)
if(length > 0) { if(length > 0) {
k = load_elf(resolve_symbol, "run", kbuf, length, kcode, sizeof(kcode)); k = load_elf(resolve_symbol, "run", kbuf, length, kcode, sizeof(kcode));
if(k != NULL) { if(k != NULL) {
dds_init();
rtio_init(); rtio_init();
dds_init();
flush_cpu_icache(); flush_cpu_icache();
k(); k();
kernel_finished(); kernel_finished();