| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | ;--------------------------------------------------------------------------
 | 
 | 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
 | 
 | 31 | data.set &DBGU_CR %LONG 0x0
 | 
 | 32 | 
 | 
 | 33 | // mask all interrupt
 | 
 | 34 | data.set &DBGU_IMSC %LONG 0x0
 | 
 | 35 | 
 | 
 | 36 | // Set baud rate 115200
 | 
 | 37 | data.set &DBGU_IBRD %LONG 0xD     //on FPGA platform, uart work clock is 25MHz
 | 
 | 38 | data.set &DBGU_FBRD %LONG 0x24
 | 
 | 39 | 
 | 
 | 40 | // set the port to no parity, no loopback, 8/N/1, enable FIFO
 | 
 | 41 | data.set &DBGU_LCR_H %LONG 0x70
 | 
 | 42 | 
 | 
 | 43 | // Enable
 | 
 | 44 | data.set &DBGU_CR %LONG 0x301
 | 
 | 45 | 
 | 
 | 46 | print "printing 'UART OK' on console"
 | 
 | 47 | data.set &DBGU_DR %BYTE 0x0a  //next line
 | 
 | 48 | wait 10.ms
 | 
 | 49 | data.set &DBGU_DR %BYTE 0x0d  //enter
 | 
 | 50 | wait 10.ms
 | 
 | 51 | data.set &DBGU_DR %BYTE 0x55  //U
 | 
 | 52 | wait 10.ms
 | 
 | 53 | data.set &DBGU_DR %BYTE 0x41  //A
 | 
 | 54 | wait 10.ms
 | 
 | 55 | data.set &DBGU_DR %BYTE 0x52  //R
 | 
 | 56 | wait 10.ms
 | 
 | 57 | data.set &DBGU_DR %BYTE 0x54  //T
 | 
 | 58 | wait 10.ms
 | 
 | 59 | data.set &DBGU_DR %BYTE 0x20  //space
 | 
 | 60 | wait 10.ms
 | 
 | 61 | data.set &DBGU_DR %BYTE 0x4f  //O
 | 
 | 62 | wait 10.ms
 | 
 | 63 | data.set &DBGU_DR %BYTE 0x4b  //K
 | 
 | 64 | wait 10.ms
 | 
 | 65 | data.set &DBGU_DR %BYTE 0x0a  //next line
 | 
 | 66 | wait 10.ms
 | 
 | 67 | data.set &DBGU_DR %BYTE 0x0d  //enter
 | 
 | 68 | wait 10.ms
 | 
 | 69 | 
 | 
 | 70 | enddo
 | 
 | 71 | 
 |