diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-07-23 21:56:27 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-07-23 21:56:27 +0000 |
commit | 63a93e9dd606b8760bf9bb26320978629c8f45a1 (patch) | |
tree | 2159dc01b5426b338d16268aa78192ea52fe3a1a /libgloss/m68hc11/sci-inout.S | |
parent | d254189b38bb5b0b77a18a401c05c415ce0733c9 (diff) | |
download | cygnal-63a93e9dd606b8760bf9bb26320978629c8f45a1.tar.gz cygnal-63a93e9dd606b8760bf9bb26320978629c8f45a1.tar.bz2 cygnal-63a93e9dd606b8760bf9bb26320978629c8f45a1.zip |
2002-07-23 Stephane Carrez <stcarrez@nerim.fr>
* README: Mention 68HC11/68HC12 support.
* configure.in: Recognize m6811-elf and m6812-elf.
* configure: Regenerated.
* m68hc11/Makefile.in: New file.
* m68hc11/configure.in: New file.
* m68hc11/configure: New file.
* m68hc11/crt0.S: New file.
* m68hc11/sci-inout.S: New file for 68hc11/68hc12 sio.
* m68hc11/sim-valid-m68hc11.ld: New file.
* m68hc11/sim-valid-m68hc12.ld: New file.
* m68hc11/syscalls.c: New file.
Diffstat (limited to 'libgloss/m68hc11/sci-inout.S')
-rw-r--r-- | libgloss/m68hc11/sci-inout.S | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/libgloss/m68hc11/sci-inout.S b/libgloss/m68hc11/sci-inout.S new file mode 100644 index 000000000..070fd7da2 --- /dev/null +++ b/libgloss/m68hc11/sci-inout.S @@ -0,0 +1,134 @@ +/* M68HC11/M68HC12 serial line operations + * Copyright (C) 1999, 2001 Stephane Carrez (stcarrez@nerim.fr) + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifdef mc68hc12 + SC0CR1 = 0xC2 + SC0CR2 = 0xC3 + SC0SR1 = 0xC4 + SC0DRL = 0xC7 + SC0BD = 0xC0 + + .sect .data + .globl _m68hc12_ports +_m68hc12_ports: .word 0 + + .sect .text + .globl outbyte +;;; +;;; int outbyte(char c); +;;; +;;; B : Character to send +;;; +outbyte: + bsr _sci_init +L1: + ldaa SC0SR1,x + bge L1 + stab SC0DRL,x + ldab SC0CR2,x + orab #0x8 + stab SC0CR2,x + rts + + .sect .text + .globl inbyte +;;; +;;; char inbyte(void); +;;; +inbyte: + bsr _sci_init + ldaa SC0SR1,x + bita #0x20 + beq inbyte + ldab SC0CR2,x + rts + + .globl _sci_init + .sect .text +_sci_init: + ldx _m68hc12_ports + beq do_init + dex + rts +do_init: + ldx #0x1 + stx _m68hc12_ports + dex + ldd #26 + std SC0BD,x + ldaa #0 + staa SC0CR1,x + ldaa #0xC + staa SC0CR2,x + rts +#else + BAUD = 0x2b + SCCR1= 0x2c + SCCR2= 0x2d + SCSR = 0x2e + SCDR = 0x2f + + .sect .data + .globl _m68hc11_ports +_m68hc11_ports: .word 0 + + .sect .text + .globl outbyte +;;; +;;; int outbyte(char c); +;;; +;;; B : Character to send +;;; +outbyte: + bsr _sci_init +L1: + ldaa SCSR,x + bge L1 + stab SCDR,x + ldab SCCR2,x + orab #0x8 + stab SCCR2,x + rts + + .sect .text + .globl inbyte +;;; +;;; char inbyte(void); +;;; +inbyte: + bsr _sci_init + ldaa SCSR,x + bita #0x20 + beq inbyte + ldab SCDR,x + rts + + .globl _sci_init + .sect .text +_sci_init: + ldx _m68hc11_ports + beq do_init + rts +do_init: + ldx #0x1000 + stx _m68hc11_ports + ldaa #0x30 + staa BAUD,x + clra + staa SCCR1,x + ldaa #0xC + staa SCCR2,x + rts + +#endif |