Blame | Last modification | View Log | SVN | RSS feed
/******************************************************************************** $FILE: qt_asm_tiny_mega.S* Atmel Corporation: http://www.atmel.com \n* Support email: touch@atmel.com******************************************************************************//* License* Copyright (c) 2010, Atmel Corporation All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions are met:** 1. Redistributions of source code must retain the above copyright notice,* this list of conditions and the following disclaimer.** 2. Redistributions in binary form must reproduce the above copyright notice,* this list of conditions and the following disclaimer in the documentation* and/or other materials provided with the distribution.** 3. The name of ATMEL may not be used to endorse or promote products derived* from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/#include "qt_asm_avr.h"FILE_HEADERFILE_SEGMENT#if (_POWER_OPTIMIZATION_ == 1)#if defined(__IAR_SYSTEMS_ASM__)EXPORT temp1EXPORT temp2temp1 GLOBAL_VAR 0temp2 GLOBAL_VAR 0#else.global temp1.global temp2.EQU temp1,0.EQU temp2,0#endif#endif#if (_STATIC_PORT_PIN_CONF_ == 0)GLOBAL_FUNCTION _0111010111__0111010111_:push r19push r25in r19, REG( DDR, SNS1 )mov r25, p_1com r25and r19, r25out REG( DDR, SNS1 ), r19in r19, REG( DDR, SNSK1 )and r19, r25out REG( DDR, SNSK1 ), r19in r19, REG( PORT, SNS1 )#if (_POWER_OPTIMIZATION_ == 1)sts temp1, r19#endifor r19, p_1out REG( PORT, SNS1 ), r19in r19, REG( PORT, SNSK1 )and r19, r25out REG( PORT, SNSK1 ), r19in r19, REG( DDR, SNSK1 )or r19, p_1out REG( DDR, SNSK1 ), r19#if (_POWER_OPTIMIZATION_ == 1)sts temp2, r19#endifpop r25pop r19ret#if (_POWER_OPTIMIZATION_ == 0)GLOBAL_FUNCTION _01001010111__01001010111_:push r19push r23push r25in r23, REG( DDR, SNSK1 )mov r25, p_1com r25and r23, r25out REG( DDR, SNSK1 ), r23in r19, REG( DDR, SNS1 )or r19, p_1and r25, r19or r23, p_1out REG( DDR, SNS1 ), r19#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100011__01101001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100011__01101001__00011001_#else_11100011__10100011__01101001__00011001__00011001_#endifout REG( DDR, SNS1 ), r25out REG( DDR, SNSK1 ), r23pop r25in r_v, REG( PIN, SNS1 )and r_v, p_2pop r23pop r19ret#elseGLOBAL_FUNCTION _01001010111__01001010111_:out REG( DDR, SNSK1 ), p_4out REG( DDR, SNS1 ), p_1#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100011__01101001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100011__01101001__00011001_#else_11100011__10100011__01101001__00011001__00011001_#endifout REG( DDR, SNS1 ), p_2out REG( DDR, SNSK1 ), p_3nopin r_v, REG( PIN, SNS1 )and r_v, p_5ret#endifGLOBAL_FUNCTION _0101110111__0101110111_:push r19push r25mov r25, p_1com r25in r19, REG( PORT, SNS1 )and r19, r25out REG( PORT, SNS1 ), r19in r19, REG( DDR, SNS1 )or r19, p_1out REG( DDR, SNS1 ), r19pop r25pop r19ret#endif///////////////////////////////////////////////////////#if ((_STATIC_PORT_PIN_CONF_ == 1) && (QTOUCH_SNS_PORT_COUNT >= 1))GLOBAL_FUNCTION _1101010101__1101010101_:push r19push r23push r25mov r23, p_2com r23mov r25, p_1com r25in r19, REG( DDR, SNS1 )and r19, r25out REG( DDR, SNS1 ), r19#if (_POWER_OPTIMIZATION_ == 1)sts temp1, r19#endifin r19, REG( DDR, SNSK1 )and r19, r23out REG( DDR, SNSK1 ), r19in r19, REG( PORT, SNS1 )or r19, p_1out REG( PORT, SNS1 ), r19in r19, REG( PORT, SNSK1 )and r19, r23out REG( PORT, SNSK1 ), r19in r19, REG( DDR, SNSK1 )#if (_POWER_OPTIMIZATION_ == 1)sts temp1, r19#endifor r19, p_2out REG( DDR, SNSK1 ), r19pop r25pop r23pop r19ret#if (_POWER_OPTIMIZATION_ == 0)GLOBAL_FUNCTION _1101010111__1101010111_:push r19push r23push r25mov r23, p_2com r23mov r25, p_1com r25in r19, REG( DDR, SNSK1 )and r23, r19out REG( DDR, SNSK1 ), r23in r19, REG( DDR, SNS1 )or r23, p_2or r19, p_1and r25, r19out REG( DDR, SNS1 ), r19#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100011__01101001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100011__01101001__00011001_#else_11100011__10100011__01101001__00011001__00011001_#endifout REG( DDR, SNS1 ), r25out REG( DDR, SNSK1 ), r23pop r25in r_v, REG( PIN, SNS1 )and r_v, p_3pop r23pop r19ret#elseGLOBAL_FUNCTION _1101010111__1101010111_:out REG( DDR, SNSK1 ), p_4out REG( DDR, SNS1 ), p_1#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100011__01101001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100011__01101001__00011001_#else_11100011__10100011__01101001__00011001__00011001_#endifout REG( DDR, SNS1 ), p_2out REG( DDR, SNSK1 ), p_3nopin r_v, REG( PIN, SNS1 )and r_v, p_5ret#endifGLOBAL_FUNCTION _1101010110__1101010110_:push r19push r25mov r25, p_1com r25in r19, REG( PORT, SNS1 )and r19, r25out REG( PORT, SNS1 ), r19in r19, REG( DDR, SNS1 )or r19, p_1out REG( DDR, SNS1 ), r19pop r25pop r19ret#endif#if ((_STATIC_PORT_PIN_CONF_ == 1) && (QTOUCH_SNS_PORT_COUNT == 2))GLOBAL_FUNCTION _1101011111__1101011111_:push r19push r23push r25mov r23, p_2com r23mov r25, p_1com r25in r19, REG( DDR, SNS2 )#if (_POWER_OPTIMIZATION_ == 1)sts temp1, r19#endifand r19, r25out REG( DDR, SNS2 ), r19in r19, REG( DDR, SNSK2 )and r19, r23out REG( DDR, SNSK2 ), r19in r19, REG( PORT, SNS2 )or r19, p_1out REG( PORT, SNS2 ), r19in r19, REG( PORT, SNSK2 )and r19, r23out REG( PORT, SNSK2 ), r19in r19, REG( DDR, SNSK2 )#if (_POWER_OPTIMIZATION_ == 1)sts temp1, r19#endifor r19, p_2out REG( DDR, SNSK2 ), r19pop r25pop r23pop r19ret#if (_POWER_OPTIMIZATION_ == 0)GLOBAL_FUNCTION _1101011110__1101011110_:push r19push r23push r25mov r23, p_2com r23mov r25, p_1com r25in r19, REG( DDR, SNSK2 )and r23, r19out REG( DDR, SNSK2 ), r23in r19, REG( DDR, SNS2 )or r23, p_2or r19, p_1and r25, r19out REG( DDR, SNS2 ), r19#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100111__01101011_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100111__01101011__00011001_#else_11100011__10100111__01101011__00011001__00011001_#endifout REG( DDR, SNS2 ), r25out REG( DDR, SNSK2 ), r23pop r25in r_v, REG( PIN, SNS2 )and r_v, p_3pop r23pop r19ret#elseGLOBAL_FUNCTION _1101011110__1101011110_:out REG( DDR, SNSK2 ), p_4out REG( DDR, SNS2 ), p_1#if (QT_DELAY_CYCLES == 1)#elif (QT_DELAY_CYCLES == 2)_00011001_#elif (QT_DELAY_CYCLES == 3)_00011001__00011001_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 0)_11100011__10100111__01101011_#elif ((QT_DELAY_CYCLES - 1) - (3 * ((QT_DELAY_CYCLES - 1)/3)) == 1)_11100011__10100111__01101011__00011001_#else_11100011__10100111__01101011__00011001__00011001_#endifout REG( DDR, SNS2 ), p_2out REG( DDR, SNSK2 ), p_3nopin r_v, REG( PIN, SNS2 )and r_v, p_5ret#endifGLOBAL_FUNCTION _1101011010__1101011010_:push r19push r25mov r25, p_1com r25in r19, REG( PORT, SNS2 )and r19, r25out REG( PORT, SNS2 ), r19in r19, REG( DDR, SNS2 )or r19, p_1out REG( DDR, SNS2 ), r19pop r25pop r19ret#endifFILE_FOOTER