beautypg.com

Rainbow Electronics AT75C310 User Manual

Page 130

background image

AT75C310

130

tst rl, #OxO1

beq rx_poll_timed

ldr rl, USARTO_RHR_Reg

ldr r2, [r1]

mov pc, lr

;-----------------------------------------------------------------------------

; rx_poll

; Wait for a character to be received. The wait is not time limited

; Trashes rl, r2

;-----------------------------------------------------------------------------r

rx_poll

ldr rl, USARTO_CSR_Reg

ldr rl, [r1]

tst rl, #OxO1

beq rx_poll

ldr rl, USARTO - RHR_Reg

ldr r2, [r1]

mov pc, lr

;-----------------------------------------------------------------------------

; send-byte

; Wait for TXRDY then write the byte in r2

; Trashes rl

;-----------------------------------------------------------------------------s

send-byte

ldr rl, USARTO_CSR_Reg

ldr rl, [rl]

tst rl, #OxO2

beq send_byte

ldr rl, USARTO_THR_Reg

str r2, [r1]

mov PC, lr

;-----------------------------------------------------------------------------

; Fail Loop - If any problem that can't be solved arises in the code then

; branch to here.

;-----------------------------------------------------------------------------

fail-loop

B fail-loop

;-----------------------------------------------------------------------------

; remap - Code will jump here if there is a timeout on receiving the first

; byte of data, or there is an error in the initial sequence. Set the REMAP

; bit in the SIAP register, then set the PC to 0 - this will map in the memory at CSO

;-----------------------------------------------------------------------------

remap

ldr rl, SIAP_Mode_Reg

ldr r2, = OxO1

str r2, [rl]

mov PC, #OXOO

;-----------------------------------------------------------------------------

; USARTO Register Definitions

;-----------------------------------------------------------------------------

USARTO_CR_Reg

DCD OxFF018000

USARTO_MR_Reg

DCD OxFF018004

USARTO_ID_Reg