X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/1f8dfd0205d431351425f468627984280b21cd5a..fec31947a6b4e77f65d92bf14b32533bbbc39b2d:/Projects/XPLAINBridge/Lib/SoftUART.S?ds=inline diff --git a/Projects/XPLAINBridge/Lib/SoftUART.S b/Projects/XPLAINBridge/Lib/SoftUART.S deleted file mode 100644 index 673067b84..000000000 --- a/Projects/XPLAINBridge/Lib/SoftUART.S +++ /dev/null @@ -1,464 +0,0 @@ -/* - - uart_soft - - v0.2 - - copyright John Steggall 2009 - -*/ - - -/* - Copyright 2009 John Steggall (steggall.j@gmail.com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include -#include "SoftUARTConf.h" - - -#define SFT_TX_EN 7 - -#define SF_UART_TX 1 -#define SF_UART_RX 2 - - .section .data - -rxdata: - .byte 0 -txShifter: - .byte 0 -txBitcount: - .byte 0 -rxShifter: - .byte 0 -rxBitcount: - .byte 0 - - .global status -status: - .byte 0 - - .section .text - - - .global RX_PIN_INT - -/********************************************* - * External interrupt - * - * RX pin has gone low. - */ -RX_PIN_INT: - push r16 - lds r16,SREG - push r16 - -#if (RXPORT>=32) - lds r16,RXPORT - sbrc r16,0 // anti glitch - -#else - sbic RXPORT,0 -#endif - - rjmp ignore - nop - nop - nop - nop - -#if (RXPORT>=32) - lds r16,RXPORT - sbrc r16,0 // anti glitch - -#else - sbic RXPORT,0 -#endif - - rjmp ignore - - push r17 - - // grab timer value - lds r16,TC_COUNTL - lds r17,TC_COUNTH - - // set trigger for RX timer (will need to add a little more though) - sts TC_RX_COMPH,r17 - sts TC_RX_COMPL,r16 - - pop r17 - - // set bitcount to 0 - ldi r16,0 - sts rxBitcount,r16 - - - // turn off interrupt, will get annoying. - cbi EXTI_MASK_REG,EXTI_MASK_BIT - - // turn on interrupt on compare match - - sbi TC_INTFLAG_REG,TC_RX_IF_BIT - - lds r16,TC_INT_MASK_REG - ori r16,(1<=32) - lds r17, TXPORT - sbrs r16,0 - andi r17,~(1<64 - lds r16,RXPORT - andi r16,~(1<=32) - lds r16,RXPORT - sbrs r16,RXPIN -#else - sbic RXPORT,RXPIN - -#endif - - inc r17 - dec r18 - nop - nop - nop - nop - brne loopGetBit - -#ifdef DEBUG - -#if RXPORT>64 - lds r16,RXPORT - ori r16,1<=32) - lds r16,RXPORT - sbrc r16,RXPIN - -#else - sbic RXPORT,RXPIN - -#endif - - ori r17,0x02 // set flag if stop bit was high - sts status,r17 - - lds r16,rxShifter // get contents of shifter - sbrc r17,1 // check if we just received a valid byte - sts rxdata,r16 // if valid rxdata = shifter - - // switch interrupt back on to get another go - - sbi EXTI_FLAG_REG,EXTI_MASK_BIT // clear interrupt flag - sbi EXTI_MASK_REG,EXTI_MASK_BIT // enable external interrupt 0 (RX) - - // switch off rx bit timer - lds r16,TC_INT_MASK_REG - andi r16,~(1<=32) - lds r18,TXPORT - ori r18,0x02 - sts TXPORT,r18 - - lds r18,TXDIR_REG - ori r18,0x02 - sts TXDIR_REG,r18 - -#else - sbi TXPORT,TXPIN - sbi TXDIR_REG,TXPIN - -#endif - - ldi r18,(1<=32) - lds r20, TXPORT - andi r20,~(1<