-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdma_c2h.sh
More file actions
executable file
·33 lines (23 loc) · 878 Bytes
/
Copy pathdma_c2h.sh
File metadata and controls
executable file
·33 lines (23 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
. ./dma_param.sh
#--------------------- Start MM2S channel (C2H) ---------------------#
echo "Setting current descriptor address (CURDESC) ..."
reg_write $MM2S_CURDESC $((DMA_DESC2 + XDMA_BIAS))
echo "Starting channel (DMACR.RS=1) ..."
mm2s_dmacr_dec=$(reg_read $MM2S_DMACR)
reg_write $MM2S_DMACR $((mm2s_dmacr_dec | RS_MASK))
echo "Setting tail descriptor address (TAILDESC) and trigger the transfer..."
reg_write $MM2S_TAILDESC $((DMA_DESC3 + XDMA_BIAS))
echo "Polling MM2S (C2H) status..."
while true; do
mm2s_dmasr_dec=$(reg_read $MM2S_DMASR)
check_dma_error $mm2s_dmasr_dec
if [ $((mm2s_dmasr_dec & HALTED_MASK)) -ne 0 ]; then
echo "\033[31m[Error] MM2S channel has been halted.\033[0m"
exit 1
fi
if [ $((mm2s_dmasr_dec & IDLE_MASK)) -ne 0 ]; then
break
fi
sleep 0.01
done
echo "MM2S (C2H) transfer completed."