/* File: Serialio.asm Copyright ©1998 - 2002 Larry Barello This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. http://www.gnu.org/copyleft/lgpl.html Revision: 20020907 - Delete all header file references. Fix this in "avrx.inc" - Added _SFR_IO_ADDR() macro to all i/o access (3.2 compat) 8/27/02 - Changed "io.h" to "io-avr.h" as the former includes some C only header files. 6/4/02 - Changed Rx and UDRE interrupt routines to use the #defined names to conform with the new GCC interrupt vector table handling mechanism (this breaks IAR support in general for the mega stuff). - fixed alias support for UCR and USR for bigger mega chips. 6/13/01 - Added aliases for UCR and USR as the mega series changed the names for some reason... 1/31/01 - Changed InitSerialIO parameter register to conform to new GCC calling conventions (R25 -> R24) 5/30/02 - Fixed re-defines of various USART registers. What a mess. Added code to initialize mega128 upper baud rate register. NOTE: This code is might be C compatible. I have not tested it or gone over it carefully to insure compatibility. In general the Monitor and the serial routines should run in their own task space and not be called by any C code. */ #include "avrx.inc" // #include "io-avr.h" /* this is included in avrx.inc */ // #include "avrx-signal.h" /* this is obsolete > 3.02 */ _MODULE(serialio) _EXTERN(_Epilog) _EXTERN(IntProlog) _EXTERN(AvrXWaitSemaphore) _EXTERN(AvrXIntSetSemaphore) ; ; Needed for USART interrupt ; Asynch, 8 bit, no parity, one stop, USART 0. is assumed in this code ; #define UCR_INIT lo8((1< 9 brlt ph01 ; subi 9 and add A subi p1l, lo8('9' + 1 - 'A') ph01: rcall PutChar ph02: dec tmp2 brne ph00 ret _ENDFUNC ;----------------------------------------- ; Put out a hex word ; ; Passed: Y = word ; _FUNCTION(PutHexWord) PutHexWord: ldi p2l, 4 rjmp _PutHex _ENDFUNC ;----------------------------------------- ; Put out a two ascii hex byte ; Yl = byte ; _FUNCTION(PutHexByte) PutHexByte: ldi p2l, 2 rjmp _PutHex _ENDFUNC _END