2 #include "memory_map.h"
5 #include "buffer_pool.h"
14 #define PORT 2 // ethernet = 2, serdes = 0
15 int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf;
16 int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle;
21 wait_until_status_nonzero(void)
23 while (buffer_pool_status->status == 0)
34 dsp_tx_regs->freq = 0;
35 dsp_tx_regs->scale_iq = (1 << 16) | 1;
36 dsp_tx_regs->interp_rate = 8;
38 // Write data to be sent into the first buffer
39 volatile unsigned int *buffer0 = buffer_ram(0);
40 volatile unsigned int *buffer1 = buffer_ram(1);
43 putstr("Starting to fill in RAM\n");
46 putstr("Filled in RAM\n");
48 buffer0[0] = 7; // start and end of buffer, send immediately
49 buffer0[1] = 0x0000; // start time
51 bp_send_from_buf(0, 1, 1, 0, 9);
52 while (buffer_pool_status->status == 0)
54 while(timer_regs -> time < 0x6000)
57 buffer0[0] = 3; // start and end of buffer
58 buffer0[1] = 0x8000; // start time
60 bp_send_from_buf(0, 1, 1, 0, 9);
61 while (buffer_pool_status->status == 0)
63 while(timer_regs -> time < 0x8400)
66 buffer0[0] = 3; // start and end of buffer
67 buffer0[1] = 0x8800; // start time
69 bp_send_from_buf(0, 1, 1, 0, 9);
70 while (buffer_pool_status->status == 0)
72 while(timer_regs -> time < 0x9000)
75 buffer0[0] = 0x2; // not last
76 buffer0[1] = 0x9100; // start time
78 bp_send_from_buf(0, 1, 1, 0, 9);
79 while (buffer_pool_status->status == 0)
81 buffer0[0] = 0x1; // last
82 buffer0[1] = 0x0000; // start time
84 bp_send_from_buf(0, 1, 1, 0, 9);
85 while (buffer_pool_status->status == 0)
89 buffer0[0] = 0x3; // first and last
90 buffer0[1] = 0x8000; // Time in the past
92 bp_send_from_buf(0, 1, 1, 0, 9);
93 while (buffer_pool_status->status == 0)
97 buffer0[0] = 0x2; // not last
98 buffer0[1] = 0x9600; // start time
100 bp_send_from_buf(0, 1, 1, 0, 9);
101 while (buffer_pool_status->status == 0)
105 while(timer_regs -> time < 0xa000)
114 // Send a bunch, let them pile up in FIFO
115 bp_send_from_buf(0, 2, 1, 21, 80); wait_until_status_nonzero();
117 putstr("First add'l TX done\n");
118 bp_send_from_buf(0, 2, 1, 81, 288); wait_until_status_nonzero();
120 bp_send_from_buf(0, 2, 1, 289, 292); wait_until_status_nonzero();
122 bp_send_from_buf(0, 2, 1, 293, 326); wait_until_status_nonzero();
124 bp_send_from_buf(0, 2, 1, 327, 399); wait_until_status_nonzero();
126 bp_send_from_buf(0, 2, 1, 400, 511); wait_until_status_nonzero();
128 putstr("All add'l TX done\n");
130 bp_receive_to_buf(1, 2, 1, 21, 80); wait_until_status_nonzero();
132 putstr("First add'l RX done\n");
133 bp_receive_to_buf(1, 2, 1, 81, 288); wait_until_status_nonzero();
135 bp_receive_to_buf(1, 2, 1, 289, 292); wait_until_status_nonzero();
137 bp_receive_to_buf(1, 2, 1, 293, 326); wait_until_status_nonzero();
139 bp_receive_to_buf(1, 2, 1, 327, 399); wait_until_status_nonzero();
141 bp_receive_to_buf(1, 2, 1, 400, 511); wait_until_status_nonzero();
143 putstr("All add'l RX done\n");
146 if(buffer0[i] != buffer1[i]) {
147 putstr("ERROR at location: ");
149 putstr("Value sent: ");
150 puthex_nl(buffer0[i]);
151 putstr("Value rcvd: ");
152 puthex_nl(buffer1[i]);
156 putstr("Done Testing\n");