写了一部分软件

This commit is contained in:
RuigeLee
2024-10-29 15:08:45 +08:00
parent 683b6cad92
commit ff4508ec35
2 changed files with 125 additions and 20 deletions

View File

@@ -6,6 +6,7 @@
#define cdr_0_rx_status 0x40000014
#define cdr_0_rx_rxLen 0x40000018
#define cdr_0_rx_rxFifo 0x4000001c
#define cdr_1_tx_status 0x40000080
#define cdr_1_tx_txLen 0x40000084
#define cdr_1_tx_txFifo 0x40000088
@@ -13,11 +14,135 @@
#define cdr_1_rx_status 0x40000094
#define cdr_1_rx_rxLen 0x40000098
#define cdr_1_rx_rxFifo 0x4000009c
#define isWriteGpio 0x60000000
#define isReadGpio 0x60000000
#define isReadIsLast 0x60000008
# x2
# x5
# x6 1
# x7 1)
# x8 1
# x9
# x10 len 0
# x11
# x12
# x13 1
# x14
# x15
.global main
@ io.interrupt(0) := intTxError
@ io.interrupt(1) := intTxFifoFull
@ io.interrupt(2) := intTxFinish
@ io.interrupt(3) := intRxError
@ io.interrupt(4) := intRxValid
main:
beqz x15, main #
bneq x15, 0x10, error # 0x100
li x15, 0 # x15
lui x13, %hi(0x40000000) #
lw x10, 0x1c(x13) # rxfifo 0
1: # 2
beqz x15, 1b #
bneq x15, 0x10, error # 0x100
li x15, 0 # x15
lw x11, 0x1c(x13) # rxfifo 12
#
#
srli x6, x10, 16 # , 16
srli x7, x6, 4 # 4
andi x6, x6, 0xf # 4
beqz x6, opInit # 0
li x8, 1
beq x6, x8, opSync # 1
li x8, 2
beq x6, x8, opBCast # 1广
li x8, 3
beq x6, x8, opUCast # 1广
j error #
opInit:
srli x6, x7, 3 #8
sub x6, x0, x6 # x6=-x6
addi x6, x6, 64 x6=x6+64
li x2 #
opSync:
j error #
opBCast:
j error #
opUCast:
j error #
2: #
beqz x15, 2b #
bneq x15, 0x10, error # 0x100
li x15, 0 # x15
# rxfifo
# +1
# 2
downpay:
beqz x15, 1b #
bneq x15, 0x10, error # 0x100 full
#
# 0
# 1 2
1:
bnez x15, 0x10, 2f
2:
error:
3:
4:
5:
6:
7:
8:
beq x15, 0x200, 2f # 1
beq x15, 0x01, 1f # 0
beq x15, 0x02, 2f # fifo0
beq x15, 0x04, 3f # 0
beq x15, 0x08, 4f # 0
beq x15, 0x20, 6f # 1
beq x15, 0x40, 7f # fifo1
beq x15, 0x80, 8f # 1
beq x15, 0x100, 9f # 1
j main #
lui x5, %hi(cdr_0_tx_status)
li x6, 128

View File

@@ -16,26 +16,6 @@ _prog_start:
li gp, 1;
ecall
.balign 32
.section .trap_entry, "ax", %progbits