📄 link_port_tx.asm
字号:
/*****************************************************************************************************
Example code showing the DMA transfer from and to internal memory using Link port 1
Data from the file tx_data.dat is stored into internal memory. This data is then transferred in
quad words from internal memory space to link port output channel 1 and then receives the data
back in again through link port 1 and places it in internal memory.
******************************************************************************************************/
#define N 64 // Number of normal words to be transmitted via link port DMA
.section data1;
.align 4;
.var link_data_tx[64] = "tx_data.dat"; // storage for data contained within the file to be transmitted
.var link_data_rx[64]; // storage for data received through the link port
.section program;
/************************* Disable all link ports, DMA's and Vector Interrupts************************/
XR0 = 0x00000000;;
LCTL0 = XR0;;
LCTL1 = XR0;;
LCTL2 = XR0;;
LCTL3 = XR0;;
XR1 = 0x00040004;; // count =4, modify = 4
XR3 = 0x00000000;; // disable DMA
DC4 = XR3:0;; // disable link 0 tx DMA
DC5 = XR3:0;; // disable link 1 tx DMA
DC6 = XR3:0;; // disable link 2 tx DMA
DC7 = XR3:0;; // disable link 3 tx DMA
DC8 = XR3:0;; // disable link 0 rx DMA
DC9 = XR3:0;; // disable link 1 rx DMA
DC10 = XR3:0;; // disable link 2 rx DMA
DC11 = XR3:0;; // disable link 3 rx DMA
xr0 = 0x90010000;;
xr1 = 0x00000000;;
IMASKH = xr0;; // enable emulation debug, Global enable HW interrupts and enable vector interrupts
IMASKL = xr1;; // disable all interrupt vector DMA channels until required
/*******************************************************************************************************/
xr0 = IMASKL;;
xr1 = 0x40800000;;
xr0 = r0 or r1;;
IMASKL = xr0;; // enable DMA5 & DMA9 interrupt---link 1 tx & rx DMA
j0 = j31 + _dma_int;; // set DMA interrupt vector
IVDMA5 = j0;;
IVDMA9 = j0;;
xr8 = N;; // Count value
xr9 = lshift r8 by 16;; // Shift count value so ready to be ORed with modify value
xr10 = 4;; // Modify value
xr4 = link_data_tx;; // Source index
xr5 = r9 or r10;; // 0000000001000000 0000000000000100
// |--------------| |--------------|
// | |
// | Modify Value
// Number of normal words to be transferred
xr6 = 0x00000000;; // Not a 2 dimensional array so value does not matter
xr7 = 0x47000000;; // 010 0 0 11 1 0 0 00000 00 000000000000000
// | | | | | | | | | |
// | | | | | | | | | Chain Pointer Quad Word Address
// | | | | | | | | Memory select for chain pointer
// | | | | | | | Chaining Destination Channel
// | | | | | | Chaining Enabled (disabled)
// | | | | | DMA Request Enable (0=once DMA channel is enabled entire block is transferred)
// | | | | Interrupt Enable (enabled)
// | | | Operand Length 00=Reserved, 01=Normal word, 10=Long word, 11=Quad word
// | | Two Dimensional DMA (disabled)
// | Determines Priority 0=DMA request priority normal 1=high
// Specify Device Type (010=Internal memory)
xr0 = 0x000004DA;;
LCTL1 = xr0;; // Link port control setup
// 00000000000000000000 0 1 0 0 1 1 011 0 1 0
// |-----RESERVED-----| | | | | | | | | | |
// | | | | | | | | | RESERVED
// | | | | | | | | Direction Enable (enabled)
// | | | | | | | Verification Enable (disabled)
// | | | | | | SPD Transfer speed 000=CCLK/8, 001=CCLK/4, 010=CCLK/3, 011=CCLK/2
// | | | | | Transmit Enable (enabled)
// | | | | Packet Size 0=64 quads in one packet, 1=Indefinite number of bytes in one packet
// | | | Transmit Time Out Check Enable (disabled)
// | | Connectivity Error Check Enable (disabled)
// | Receive Enable (enabled)
// Receive Time Out Check Enable
DC5 = xr7:4;; // start Link1 transmit DMA
idle;; // once DMA is completed an interrupt is generated which brings out of idle and jumps to _dma_int
xr4 = link_data_rx;; // xr4 = destination index
DC9 = xr7:4;; // start Link1 receive DMA
idle;; // once DMA is completed an interrupt is generated which brings out of idle and jumps to _dma_int
_end_loop:
jump _end_loop;nop;nop;nop;;
_dma_int: // Once tx and rx DMA's are completed an interrupt is generated. This is the isr
nop;;
nop;;
nop;;
rti(ABS);nop;nop;nop;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -