-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdma_h2c.sh
More file actions
executable file
·33 lines (23 loc) · 877 Bytes
/
Copy pathdma_h2c.sh
File metadata and controls
executable file
·33 lines (23 loc) · 877 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 S2MM channel (H2C) ---------------------#
echo "Setting current descriptor address (CURDESC) ..."
reg_write $S2MM_CURDESC $((DMA_DESC0 + XDMA_BIAS))
echo "Starting channel (DMACR.RS=1) ..."
s2mm_dmacr_dec=$(reg_read $S2MM_DMACR)
reg_write $S2MM_DMACR $((s2mm_dmacr_dec | RS_MASK))
echo "Setting tail descriptor address (TAILDESC) and trigger the transfer..."
reg_write $S2MM_TAILDESC $((DMA_DESC1 + XDMA_BIAS))
echo "Polling S2MM (H2C) status..."
while true; do
s2mm_dmasr_dec=$(reg_read $S2MM_DMASR)
check_dma_error $s2mm_dmasr_dec
if [ $((s2mm_dmasr_dec & HALTED_MASK)) -ne 0 ]; then
echo "\033[31m[Error] S2MMchannel has been halted.\033[0m"
exit 1
fi
if [ $((s2mm_dmasr_dec & IDLE_MASK)) -ne 0 ]; then
break
fi
sleep 0.01
done
echo "S2MM (H2C) transfer completed."