暂时屏蔽了fsmc两个诊断宏,便于调试;增加汇编代码,已经看到Tx0作为下行输出的波形了
This commit is contained in:
@@ -34,6 +34,7 @@ x31, 最大的服务中断号
|
||||
#define REG_min_isr_num x30
|
||||
#define REG_max_isr_num x31
|
||||
|
||||
#define REG_4 x23
|
||||
|
||||
.globl _prog_start
|
||||
.globl _rv32i_plic_handle
|
||||
@@ -60,71 +61,21 @@ _prog_start:
|
||||
init_system_func:
|
||||
mv REG_plic_claim, a1 # plic_claim
|
||||
|
||||
/*初始化isr_hdl_table,中断表*/
|
||||
la x16, isr_hdl_table
|
||||
|
||||
la x17, isr_tx0_end_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_tx1_end_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx0_err_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx1_err_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx0_start_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx1_start_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx0_end_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx1_end_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_tx0_deq_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_tx1_deq_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx0_enq_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, isr_rx1_enq_hdl
|
||||
addi x16, x16, 4
|
||||
sw x17, 0(x16)
|
||||
|
||||
la x17, _rv32i_plic_handle
|
||||
|
||||
mv a0, x17
|
||||
|
||||
li REG_TL2CDR_BASE, TL2CDR_BASE
|
||||
la REG_ISR_ADDR, isr_hdl_table
|
||||
li REG_min_isr_num, 14
|
||||
li REG_max_isr_num, 25
|
||||
li x23, 4
|
||||
li REG_4, 4
|
||||
ret
|
||||
|
||||
//主站启动发送数据
|
||||
//a1, 当前需要发送的数据的地址
|
||||
//a2, 当前数据发送的长度
|
||||
//a3, dummy
|
||||
//a4, dummy
|
||||
send_data_func:
|
||||
mv REG_tx_data, a1
|
||||
mv REG_tx_data_len, a2
|
||||
@@ -139,12 +90,11 @@ send_data_func:
|
||||
sw x17, TX0_WriteTxFifo(REG_TL2CDR_BASE)
|
||||
|
||||
//*tx0_txFifo = data[0]
|
||||
lw x17, 0(REG_tx_data)
|
||||
sw x17, TX0_WriteTxFifo(REG_TL2CDR_BASE)
|
||||
#lw x17, 0(REG_tx_data)
|
||||
#sw x17, TX0_WriteTxFifo(REG_TL2CDR_BASE)
|
||||
|
||||
//li x16, 4
|
||||
add REG_tx_data, REG_tx_data, x23
|
||||
sub REG_tx_data_len, REG_tx_data_len, x23
|
||||
#add REG_tx_data, REG_tx_data, REG_4
|
||||
#sub REG_tx_data_len, REG_tx_data_len, REG_4
|
||||
|
||||
li a0, 1
|
||||
ret
|
||||
@@ -175,9 +125,13 @@ exit_handle:
|
||||
mret
|
||||
|
||||
isr_tx0_end_hdl:
|
||||
#li x17, 1
|
||||
#sw x17, TX0_WriteSoftReset(REG_TL2CDR_BASE)
|
||||
mret
|
||||
|
||||
isr_tx1_end_hdl:
|
||||
#li x17, 1
|
||||
#sw x17, TX0_WriteSoftReset(REG_TL2CDR_BASE)
|
||||
mret
|
||||
|
||||
isr_rx0_err_hdl:
|
||||
@@ -192,7 +146,7 @@ isr_rx0_start_hdl:
|
||||
isr_rx1_start_hdl:
|
||||
lw x22, RX1_ReadRxLen(REG_TL2CDR_BASE)
|
||||
sw x22, 0(REG_rx_data)
|
||||
add REG_rx_data, REG_rx_data, x23
|
||||
add REG_rx_data, REG_rx_data, REG_4
|
||||
mret
|
||||
|
||||
isr_rx0_end_hdl:
|
||||
@@ -202,13 +156,12 @@ isr_rx1_end_hdl:
|
||||
mret
|
||||
|
||||
isr_tx0_deq_hdl:
|
||||
bgtz REG_tx_data_len, 1f //if (REG_tx_data_len > 0)
|
||||
beqz REG_tx_data_len, 1f //if (REG_tx_data_len > 0)
|
||||
lw x17, 0(REG_tx_data)
|
||||
sw x17, TX0_WriteTxFifo(REG_TL2CDR_BASE)
|
||||
|
||||
//li x16, 4
|
||||
add REG_tx_data, REG_tx_data, x23
|
||||
sub REG_tx_data_len, REG_tx_data_len, x23
|
||||
add REG_tx_data, REG_tx_data, REG_4
|
||||
sub REG_tx_data_len, REG_tx_data_len, REG_4
|
||||
1:
|
||||
mret
|
||||
|
||||
@@ -216,16 +169,24 @@ isr_tx1_deq_hdl:
|
||||
mret
|
||||
|
||||
isr_rx0_enq_hdl:
|
||||
lw x17, RX1_ReadRxFifo(REG_TL2CDR_BASE)
|
||||
sw x17, 0(REG_rx_data)
|
||||
add REG_rx_data, REG_rx_data, x23
|
||||
mret
|
||||
|
||||
isr_rx1_enq_hdl:
|
||||
lw x17, RX1_ReadRxFifo(REG_TL2CDR_BASE)
|
||||
sw x17, 0(REG_rx_data)
|
||||
add REG_rx_data, REG_rx_data, REG_4
|
||||
mret
|
||||
|
||||
.balign 4
|
||||
isr_hdl_table:
|
||||
.space 64
|
||||
|
||||
nop
|
||||
j isr_tx0_end_hdl
|
||||
j isr_tx1_end_hdl
|
||||
j isr_rx0_err_hdl
|
||||
j isr_rx1_err_hdl
|
||||
j isr_rx0_start_hdl
|
||||
j isr_rx1_start_hdl
|
||||
j isr_rx0_end_hdl
|
||||
j isr_rx1_end_hdl
|
||||
j isr_tx0_deq_hdl
|
||||
j isr_tx1_deq_hdl
|
||||
j isr_rx0_enq_hdl
|
||||
j isr_rx1_enq_hdl
|
||||
|
||||
Reference in New Issue
Block a user