runtime/analyzer: fix zero data corner case, handle cache

This commit is contained in:
Sebastien Bourdeauducq 2015-12-18 15:17:22 +08:00
parent 40e10caf0a
commit f431add20e
1 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#include <system.h>
#include <generated/csr.h> #include <generated/csr.h>
#include "log.h"
#include "analyzer.h" #include "analyzer.h"
@ -30,6 +32,8 @@ static void disarm(void)
{ {
rtio_analyzer_dma_enable_write(0); rtio_analyzer_dma_enable_write(0);
while(rtio_analyzer_dma_busy_read()); while(rtio_analyzer_dma_busy_read());
flush_cpu_dcache();
flush_l2_cache();
} }
void analyzer_init(void) void analyzer_init(void)
@ -77,7 +81,7 @@ void analyzer_end(void)
int analyzer_input(void *data, int length) int analyzer_input(void *data, int length)
{ {
/* The analyzer never accepts input. */ log("no input should be received by analyzer, dropping connection");
return -1; return -1;
} }
@ -99,6 +103,9 @@ void analyzer_poll(void **data, int *length)
case SEND_STATE_TERMINATE: case SEND_STATE_TERMINATE:
*length = -1; *length = -1;
break; break;
default:
*length = 0;
break;
} }
} }
@ -117,8 +124,12 @@ void analyzer_ack_sent(int length)
offset_sent = 0; offset_sent = 0;
if(wraparound) if(wraparound)
send_state = SEND_STATE_POST_POINTER; send_state = SEND_STATE_POST_POINTER;
else else {
if(pointer)
send_state = SEND_STATE_PRE_POINTER; send_state = SEND_STATE_PRE_POINTER;
else
send_state = SEND_STATE_TERMINATE;
}
} }
break; break;
case SEND_STATE_POST_POINTER: case SEND_STATE_POST_POINTER: