File: uart_poll.s

package info (click to toggle)
tkisem 4.5.12-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 964 kB
  • ctags: 1,372
  • sloc: cpp: 4,844; tcl: 3,047; asm: 1,991; makefile: 335; ansic: 269; sh: 155
file content (43 lines) | stat: -rw-r--r-- 627 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
	!
	! 12/31/96
	! A.B. Maccabe
	!
	! write a simple message to the UART
	!

	UARTSTATUS	= 0X140000 
	UARTCREG	= 0x140000
	UARTTXREG	= 0x140004
	UARTRXREG	= 0x140004

	.data
msg:	.asciz	"hello\n"

	.text
	.global start
	
start:	
	set	UARTSTATUS, %l0
	
	! set the UART control register -- disable interrupts and set the
	! rx/tx rate fairly low
	set	0x40, %l2
	st	%l2, [%l0]
	set	msg, %g1

top:
	! poll the uart, waiting until the transmit buffer is empty
poll:	ld	[%l0], %l1
	andcc	%l1, 1, %g0
	be	poll
	nop

	! get the next character to send
	ldub	[%g1], %g2
	inc	%g1
	cmp	%g2, 0
	bne,a	top
	st	%g2, [%l0+4]

	! all done
	ta	0