iomux 代码:
LCR offset 000c
//set uart2 LCR bit7 and bit1-0
mov x0,0xfeb50000
movk,x0,0x000c
mov w1,0b10000011
str w1,[x0]
0xfd7c03ac
.global _start
_start:
//set iomux
movz x0,0xFD5F,lsl #16
movk x0,0x800C
movz w1,0x0ff0,lsl #16
str w1,[x0]
movk w1,0x0aa0
str w1,[x0]
movz x0,0xFD5F,lsl #16
movk x0,0x4000
movz w1,0x0ff0,lsl #16
str w1,[x0]
movk w1,0x0880
str w1,[x0]
//set uart2 LCR bit7 and bit1-0
mov x0,0xfeb50000
movk x0,0x000c
mov w1,0b10000011
ldr w2,[x0]
orr w2,w2,w1
str w2,[x0]
//set clk_uart2_src_sel s43 clk_cpll_mux clk_uart2_src_div=3
movz x0,0xFD7C,lsl #16
movk x0,0x03ac
movz w1,0b11111100,lsl #16
str w1,[x0]
movk w1,0b10001100
str w1,[x0]
//clk_uart2_en clk_uart2_src
movz x0,0xFD7C,lsl #16
movk x0,0x0830
movz w1,0x4000,lsl #16
str w1,[x0]
str w1,[x0]
//sclk_uart2 clock mux. s45 1:0=00
movz x0,0xFD7C,lsl #16
movk x0,0x03b4
movz w1,0x0003,lsl #16
str w1,[x0]
str w1,[x0]
//g13 sclk_uart2_en sclk_uart2 clock gating control bit0=0
movz x0,0xFD7C,lsl #16
movk x0,0x0834
movz w1,0x0001,lsl #16
str w1,[x0]
str w1,[x0]
//set DLL
mov x0,0xfeb50000
mov x1,#16
strb w1,[x0]
//set LCR bit7 to 0,initial baud rate complete
mov x0,0xfeb50000
movk x0,0x000c
mov w1,0b10000000
ldr w2,[x0]
bic w2,w2,w1
str w2,[x0]
//try send data
send:
mov x0,0xfeb50000
mov w1,0x40
strb w1,[x0]
b send
当然运行不了。。。。