OpenCores
URL https://opencores.org/ocsvn/rise/rise/trunk

Subversion Repositories rise

[/] [rise/] [trunk/] [examples/] [uart_complex.s] - Blame information for rev 148

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 143 cwalter
/*
2
 * RISE microprocessor - Test program for UART
3
 *
4
 * Copyright (c) 2006 Jakob Lechner
5
 * All rights reserved.
6
 *
7
 * Redistribution and use in source and binary forms, with or without
8
 * modification, are permitted provided that the following conditions
9
 * are met:
10
 * 1. Redistributions of source code must retain the above copyright
11
 *    notice, this list of conditions and the following disclaimer.
12
 * 2. Redistributions in binary form must reproduce the above copyright
13
 *    notice, this list of conditions and the following disclaimer in the
14
 *    documentation and/or other materials provided with the distribution.
15
 * 3. The name of the author may not be used to endorse or promote products
16
 *    derived from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * File: $Id: uart_complex.s,v 1.1 2007-01-25 22:31:12 cwalter Exp $
30
 */
31
 
32
  .text
33
  .org    0x0000
34
 
35
  /* address for status register */
36
  ld      r8, #0x00
37
  ldhb    r8, #0x80
38
  /* address for uart data register */
39
  ld      r9, #0x01
40
  ldhb    r9, #0x80
41
  /* address for data buffer */
42
  ld      r10, addrlo(buffer)
43
  ldhb    r10, addrhi(buffer)
44
  /* addresses for branch targets */
45
  ld      r7, addrlo(main)
46
  ldhb    r7, addrhi(main)
47
  ld      r11, addrlo(check_rdrf)
48
  ldhb    r11, addrhi(check_rdrf)
49
  ld      r12, addrlo(check_tdre)
50
  ldhb    r12, addrhi(check_tdre)
51
 
52
  /* wait for uart receiver data */
53
main:
54
  ld      r6, r10
55
check_rdrf:
56
  ld      r2, [r8]
57
  ld      r3, #0x2
58
  and     r2, r3
59
  jmpz    r11
60
 
61
  /* data available, read data */
62
  ld      r4, [r9]
63
  /* compare for newline. if newline output data */
64
  ld      r1, #0x0a
65
  sub     r1, r4
66
  jmpz    r12
67
  st      r4, [r6]
68
  add     r6, #1
69
  jmp     r11
70
 
71
  /* wait for transmitter register empty */
72
check_tdre:
73
  ld      r2, [r8]
74
  ld      r3, #0x1
75
  and     r2, r3
76
  jmpz    r12
77
 
78
  /* transmitter register empty: send data */
79
  ld      r2, r10
80
  sub     r2, r6
81
  jmpz    r7
82
 
83
  sub     r6, #1
84
  ld      r4, [r6]
85
  st      r4, [r9]
86
  jmp     r12
87
 
88
  .data
89
  .org    0x0200
90
buffer:
91
  .space  128

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.