import migen in litex/gen
[litex.git] / litex / soc / misoc / software / bios / dataflow.c
1 #include <stdio.h>
2
3 #include "dataflow.h"
4
5 void print_isd_info(unsigned int baseaddr)
6 {
7 volatile unsigned int *regs;
8 int neps;
9 int nbytes;
10 int i, j;
11 int offset;
12 unsigned int ack_count, nack_count, cur_status;
13
14 regs = (unsigned int *)baseaddr;
15 if((regs[0] != 0x6a) || (regs[1] != 0xb4)) {
16 printf("Incorrect magic number\n");
17 return;
18 }
19 neps = regs[2];
20 nbytes = (regs[3] + 7)/8;
21
22 regs[4] = 1; // freeze
23 offset = 6; // regs[5] is reset
24 for(i=0;i<neps;i++) {
25 ack_count = 0;
26 for(j=0;j<nbytes;j++) {
27 ack_count <<= 8;
28 ack_count |= regs[offset++];
29 }
30 nack_count = 0;
31 for(j=0;j<nbytes;j++) {
32 nack_count <<= 8;
33 nack_count |= regs[offset++];
34 }
35 cur_status = regs[offset++];
36 printf("#%d: ACK_CNT:%10u NAK_CNT:%10u %s %s\n",
37 i, ack_count, nack_count,
38 cur_status & 1 ? "stb" : " ",
39 cur_status & 2 ? "ack" : " ");
40 }
41 regs[4] = 0; // unfreeze
42 }