blob: 0a405b929fb62214b5b49a071c3e662f7702e6d9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001;--------------------------------------------------------------------------
2; Initialize SERIAL 0 as console for zx297520v3_fpga linux: 115200 8/N/1
3; created by xuzhiguo / ZTE-TSP at 03.18.2013
4;--------------------------------------------------------------------------
5&UART_BASE_SYS=0x1408000 // UART1 Base Address
6
7&DBGU_DR=&UART_BASE_SYS+0x4 // data Register
8&DBGU_SC=&UART_BASE_SYS+0x8 // special character Register
9&DBGU_FR=&UART_BASE_SYS+0x14 // flag Register
10&DBGU_IBRD=&UART_BASE_SYS+0x24 // integer Baud Rate Generator Register
11&DBGU_FBRD=&UART_BASE_SYS+0x28 // fractional Baud Rate Generator Register
12&DBGU_LCR_H=&UART_BASE_SYS+0x30 // Line Control Register
13&DBGU_CR=&UART_BASE_SYS+0x34 // Control Register
14&DBGU_IMSC=&UART_BASE_SYS+0x40 // Interrupt Mask Register
15
16&TOP_FUNC_SEL_BASE=0x0013C000 // 0-AON FUNC
17&AON_FUNC_SEL_BASE=0x0013C000 // 0-rxd or txd func
18&UART0_TOP_FUNC=&TOP_FUNC_SEL_BASE+0x10
19&UART0_AON_FUNC=&AON_FUNC_SEL_BASE+0
20
21// set gpio function to UART0 TX and RX
22;&tmp=data.long(D:&UART0_TOP_FUNC)
23;&tmp=&tmp&0xFFE7FFFF // AON func
24;&tmp=data.long(D:&UART0_AON_FUNC)
25;&tmp=&tmp&0xFFFF0FFF // UART FUNC
26
27//set uart1 works clock divison to 1
28; it is done in evb297510.cmm
29
30//disable uart
31data.set &DBGU_CR %LONG 0x0
32
33// mask all interrupt
34data.set &DBGU_IMSC %LONG 0x0
35
36// Set baud rate 115200
37data.set &DBGU_IBRD %LONG 0xD //on FPGA platform, uart work clock is 25MHz
38data.set &DBGU_FBRD %LONG 0x24
39
40// set the port to no parity, no loopback, 8/N/1, enable FIFO
41data.set &DBGU_LCR_H %LONG 0x70
42
43// Enable
44data.set &DBGU_CR %LONG 0x301
45
46print "printing 'UART OK' on console"
47data.set &DBGU_DR %BYTE 0x0a //next line
48wait 10.ms
49data.set &DBGU_DR %BYTE 0x0d //enter
50wait 10.ms
51data.set &DBGU_DR %BYTE 0x55 //U
52wait 10.ms
53data.set &DBGU_DR %BYTE 0x41 //A
54wait 10.ms
55data.set &DBGU_DR %BYTE 0x52 //R
56wait 10.ms
57data.set &DBGU_DR %BYTE 0x54 //T
58wait 10.ms
59data.set &DBGU_DR %BYTE 0x20 //space
60wait 10.ms
61data.set &DBGU_DR %BYTE 0x4f //O
62wait 10.ms
63data.set &DBGU_DR %BYTE 0x4b //K
64wait 10.ms
65data.set &DBGU_DR %BYTE 0x0a //next line
66wait 10.ms
67data.set &DBGU_DR %BYTE 0x0d //enter
68wait 10.ms
69
70enddo
71