GAS LISTING /tmp/ccEAqm16.s page 1 1 .file "test.c" 2 __SP_H__ = 0x3e 3 __SP_L__ = 0x3d 4 __SREG__ = 0x3f 5 __tmp_reg__ = 0 6 __zero_reg__ = 1 7 .text 8 .Ltext0: 9 .cfi_sections .debug_frame 10 .global delay_ms 12 delay_ms: 13 .LFB7: 14 .file 1 "test.c" 1:test.c **** #include 2:test.c **** #include 3:test.c **** #include 4:test.c **** #include 5:test.c **** #include "huetabler.h" 6:test.c **** 7:test.c **** void delay_ms(uint32_t time) { 15 .loc 1 7 0 16 .cfi_startproc 17 .LVL0: 18 0000 0F93 push r16 19 .LCFI0: 20 .cfi_def_cfa_offset 3 21 .cfi_offset 16, -2 22 0002 1F93 push r17 23 .LCFI1: 24 .cfi_def_cfa_offset 4 25 .cfi_offset 17, -3 26 /* prologue: function */ 27 /* frame size = 0 */ 28 /* stack size = 2 */ 29 .L__stack_usage = 2 30 .LVL1: 8:test.c **** uint32_t i; 9:test.c **** for (i = 0; i < time; i++) { 31 .loc 1 9 0 32 0004 00E0 ldi r16,0 33 0006 10E0 ldi r17,0 34 0008 9801 movw r18,r16 35 .LVL2: 36 .L2: 37 .loc 1 9 0 is_stmt 0 discriminator 1 38 000a 0617 cp r16,r22 39 000c 1707 cpc r17,r23 40 000e 2807 cpc r18,r24 41 0010 3907 cpc r19,r25 42 0012 01F0 breq .L5 43 .LVL3: 44 .LBB10: 45 .LBB11: 46 .file 2 "/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h" 1:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz 2:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch 3:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Copyright (c) 2007 Florin-Viorel Petrov GAS LISTING /tmp/ccEAqm16.s page 2 4:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** All rights reserved. 5:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 6:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Redistribution and use in source and binary forms, with or without 7:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** modification, are permitted provided that the following conditions are met: 8:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 9:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** * Redistributions of source code must retain the above copyright 10:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer. 11:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 12:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** * Redistributions in binary form must reproduce the above copyright 13:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer in 14:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** the documentation and/or other materials provided with the 15:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** distribution. 16:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 17:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** * Neither the name of the copyright holders nor the names of 18:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** contributors may be used to endorse or promote products derived 19:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** from this software without specific prior written permission. 20:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 21:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** POSSIBILITY OF SUCH DAMAGE. */ 32:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 33:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /* $Id$ */ 34:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 35:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #ifndef _UTIL_DELAY_H_ 36:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #define _UTIL_DELAY_H_ 1 37:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 38:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #ifndef __HAS_DELAY_CYCLES 39:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #define __HAS_DELAY_CYCLES 1 40:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 41:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 42:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #include 43:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #include 44:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #include 45:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 46:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /** \file */ 47:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops 48:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \code 49:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #define F_CPU 1000000UL // 1 MHz 50:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** //#define F_CPU 14.7456E6 51:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #include 52:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \endcode 53:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 54:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \note As an alternative method, it is possible to pass the 55:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** F_CPU macro down to the compiler from the Makefile. 56:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Obviously, in that case, no \c \#define statement should be 57:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** used. 58:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 59:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The functions in this header file are wrappers around the basic 60:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** busy-wait functions from . They are meant as GAS LISTING /tmp/ccEAqm16.s page 3 61:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** convenience functions where actual time values can be specified 62:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** rather than a number of cycles to wait for. The idea behind is 63:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** that compile-time constant expressions will be eliminated by 64:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** compiler optimization so floating-point expressions can be used 65:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** to calculate the number of delay cycles needed based on the CPU 66:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** frequency passed by the macro F_CPU. 67:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 68:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \note In order for these functions to work as intended, compiler 69:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** optimizations must be enabled, and the delay time 70:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** must be an expression that is a known constant at 71:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** compile-time. If these requirements are not met, the resulting 72:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** delay will be much longer (and basically unpredictable), and 73:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** applications that otherwise do not use floating-point calculations 74:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** will experience severe code bloat by the floating-point library 75:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** routines linked into the application. 76:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 77:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The functions available allow the specification of microsecond, and 78:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** millisecond delays directly, using the application-supplied macro 79:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** F_CPU as the CPU clock frequency (in Hertz). 80:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 81:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** */ 82:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 83:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if !defined(__DOXYGEN__) 84:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); 85:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); 86:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 87:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 88:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #ifndef F_CPU 89:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /* prevent compiler error by supplying a default */ 90:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** # warning "F_CPU not defined for " 91:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** # define F_CPU 1000000UL 92:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 93:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 94:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #ifndef __OPTIMIZE__ 95:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" 96:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 97:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 98:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 99:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 100:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __STDC_HOSTED__ 101:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** # include 102:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 103:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 104:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /** 105:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \ingroup util_delay 106:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 107:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). 108:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 109:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The macro F_CPU is supposed to be defined to a 110:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** constant defining the CPU clock frequency (in Hertz). 111:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 112:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. 113:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 114:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** When the user request delay which exceed the maximum possible one, 115:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_ms() provides a decreased resolution functionality. In this 116:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing 117:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The GAS LISTING /tmp/ccEAqm16.s page 4 118:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** user will not be informed about decreased resolution. 119:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 120:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) 121:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For 122:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** values greater than the maximal possible delay, overflows results in 123:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** no delay i.e., 0ms. 124:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 125:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Conversion of __us into clock cycles may not always result in integer. 126:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** By default, the clock cycles rounded up to next integer. This ensures that 127:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** the user gets atleast __us microseconds of delay. 128:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 129:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ 130:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** to round down and round to closest integer. 131:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 132:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Note: The new implementation of _delay_ms(double __ms) with 133:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. 134:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. 135:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Also, the backward compatible 136:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** algorithm will be chosen if the code is compiled in a freestanding 137:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** environment (GCC option \c -ffreestanding), as the math functions 138:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** required for rounding are not available to the compiler then. 139:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 140:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** */ 141:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** void 142:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_ms(double __ms) 143:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** { 144:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** double __tmp ; 145:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 146:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 147:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __STDC_HOSTED__ 148:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** uint32_t __ticks_dc; 149:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); 150:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; 151:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 152:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) 153:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); 154:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 155:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) 156:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); 157:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 158:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #else 159:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** //round up by default 160:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); 161:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 162:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 163:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); 47 .loc 2 163 0 is_stmt 1 48 0014 E7E8 ldi r30,lo8(4999) 49 0016 F3E1 ldi r31,hi8(4999) 50 0018 3197 1: sbiw r30,1 51 001a 01F4 brne 1b 52 001c 00C0 rjmp . 53 001e 0000 nop 54 .LBE11: 55 .LBE10: 56 .loc 1 9 0 57 0020 0F5F subi r16,-1 GAS LISTING /tmp/ccEAqm16.s page 5 58 0022 1F4F sbci r17,-1 59 0024 2F4F sbci r18,-1 60 0026 3F4F sbci r19,-1 61 .LVL4: 62 0028 00C0 rjmp .L2 63 .LVL5: 64 .L5: 65 /* epilogue start */ 10:test.c **** _delay_ms(1); 11:test.c **** } 12:test.c **** } 66 .loc 1 12 0 67 002a 1F91 pop r17 68 002c 0F91 pop r16 69 .LVL6: 70 002e 0895 ret 71 .cfi_endproc 72 .LFE7: 74 .section .text.startup,"ax",@progbits 75 .global main 77 main: 78 .LFB8: 13:test.c **** 14:test.c **** #define NOOP asm volatile("nop" ::) 15:test.c **** 16:test.c **** void SendTick(); 17:test.c **** void SendAPacket(); 18:test.c **** void SendBPacket(); 19:test.c **** void SendCPacket(); 20:test.c **** 21:test.c **** //Notes 22:test.c **** //when using PA0-4, sourcing 4.61V is the output, 3.65 at LED. LED Gets warm <> 23:test.c **** //When using PA0-4, sinking, 4.67V is the output, 3.73 at LED. LED seems to get hot. VERY HOT 24:test.c **** 25:test.c **** #define SOURCING 26:test.c **** #define WHITE 27:test.c **** 28:test.c **** #define WSPORT PORTA 29:test.c **** #define WSDDR DDRA 30:test.c **** #define WSPIN (0x0f) 31:test.c **** 32:test.c **** #define SEND_WS( var ) \ 33:test.c **** mask = 0x80; \ 34:test.c **** v = var; \ 35:test.c **** while( mask ) \ 36:test.c **** { \ 37:test.c **** if( mask & v ) \ 38:test.c **** { \ 39:test.c **** WSPORT |= WSPIN; mask>>=1; \ 40:test.c **** NOOP; NOOP; NOOP; NOOP; \ 41:test.c **** NOOP; NOOP; NOOP; NOOP; NOOP; NOOP;\ 42:test.c **** WSPORT &= ~WSPIN; NOOP; NOOP; NOOP; NOOP;NOOP; NOOP;NOOP;\ 43:test.c **** } \ 44:test.c **** else \ 45:test.c **** { \ 46:test.c **** WSPORT |= WSPIN; NOOP; NOOP;\ 47:test.c **** WSPORT &= ~WSPIN; \ GAS LISTING /tmp/ccEAqm16.s page 6 48:test.c **** mask>>=1; \ 49:test.c **** NOOP; NOOP; NOOP; NOOP;NOOP; NOOP; NOOP;\ 50:test.c **** } \ 51:test.c **** \ 52:test.c **** } 53:test.c **** 54:test.c **** 55:test.c **** 56:test.c **** #define HUE(x) pgm_read_byte( &huetable[(x)&0xff] ) 57:test.c **** #define RAND(x) pgm_read_byte( &rands[(x)&0xff] ) 58:test.c **** #define ST(x) pgm_read_byte( &sintable[(x)&0xff] ) 59:test.c **** 60:test.c **** #define MUX(x,y) ((x*y)>>8) 61:test.c **** 62:test.c **** int main( ) 63:test.c **** { 79 .loc 1 63 0 80 .cfi_startproc 81 /* prologue: function */ 82 /* frame size = 0 */ 83 /* stack size = 0 */ 84 .L__stack_usage = 0 85 .LVL7: 64:test.c **** int i = 0, j; 65:test.c **** uint8_t v, mask; 66:test.c **** cli(); 86 .loc 1 66 0 87 /* #APP */ 88 ; 66 "test.c" 1 89 0000 F894 cli 90 ; 0 "" 2 91 .LVL8: 92 /* #NOAPP */ 93 .LBB12: 94 .LBB13: 95 .loc 2 163 0 96 0002 87E8 ldi r24,lo8(4999) 97 0004 93E1 ldi r25,hi8(4999) 98 0006 0197 1: sbiw r24,1 99 0008 01F4 brne 1b 100 000a 00C0 rjmp . 101 000c 0000 nop 102 .LBE13: 103 .LBE12: 67:test.c **** _delay_ms(1); 68:test.c **** OSCCAL0 = 0xf0; 104 .loc 1 68 0 105 000e 80EF ldi r24,lo8(-16) 106 0010 8093 7400 sts 116,r24 69:test.c **** WSDDR |= WSPIN; 107 .loc 1 69 0 108 0014 8AB3 in r24,0x1a 109 0016 8F60 ori r24,lo8(15) 110 0018 8ABB out 0x1a,r24 64:test.c **** int i = 0, j; 111 .loc 1 64 0 112 001a 80E0 ldi r24,0 GAS LISTING /tmp/ccEAqm16.s page 7 113 001c 90E0 ldi r25,0 114 .LVL9: 115 .L20: 70:test.c **** 71:test.c **** while(1) 72:test.c **** { 73:test.c **** i++; 116 .loc 1 73 0 117 001e 0196 adiw r24,1 118 .LVL10: 74:test.c **** if( i == 255 ) i = 0; 119 .loc 1 74 0 120 0020 8F3F cpi r24,-1 121 0022 9105 cpc r25,__zero_reg__ 122 0024 01F4 brne .L7 123 0026 80E0 ldi r24,0 124 0028 90E0 ldi r25,0 125 .LVL11: 126 .L7: 75:test.c **** #if defined( WHITE ) 76:test.c **** for( j = 0; j < 1; j++ ) 77:test.c **** { 78:test.c **** SEND_WS( i|0xfe ); 127 .loc 1 78 0 128 002a 682F mov r22,r24 129 002c 582F mov r21,r24 130 002e 5E6F ori r21,lo8(-2) 131 .LVL12: 132 0030 20E8 ldi r18,lo8(-128) 133 .LVL13: 134 .L11: 135 .loc 1 78 0 is_stmt 0 discriminator 2 136 0032 422F mov r20,r18 137 0034 4523 and r20,r21 138 0036 322F mov r19,r18 139 0038 3695 lsr r19 140 003a 2BB3 in r18,0x1b 141 .LVL14: 142 003c 2F60 ori r18,lo8(15) 143 003e 2BBB out 0x1b,r18 144 0040 4423 tst r20 145 0042 01F0 breq .L8 146 .loc 1 78 0 discriminator 1 147 0044 232F mov r18,r19 148 .LVL15: 149 /* #APP */ 150 ; 78 "test.c" 1 151 0046 0000 nop 152 ; 0 "" 2 153 ; 78 "test.c" 1 154 0048 0000 nop 155 ; 0 "" 2 156 ; 78 "test.c" 1 157 004a 0000 nop 158 ; 0 "" 2 159 ; 78 "test.c" 1 160 004c 0000 nop GAS LISTING /tmp/ccEAqm16.s page 8 161 ; 0 "" 2 162 ; 78 "test.c" 1 163 004e 0000 nop 164 ; 0 "" 2 165 ; 78 "test.c" 1 166 0050 0000 nop 167 ; 0 "" 2 168 ; 78 "test.c" 1 169 0052 0000 nop 170 ; 0 "" 2 171 ; 78 "test.c" 1 172 0054 0000 nop 173 ; 0 "" 2 174 ; 78 "test.c" 1 175 0056 0000 nop 176 ; 0 "" 2 177 ; 78 "test.c" 1 178 0058 0000 nop 179 ; 0 "" 2 180 /* #NOAPP */ 181 005a 4BB3 in r20,0x1b 182 005c 407F andi r20,lo8(-16) 183 005e 4BBB out 0x1b,r20 184 0060 00C0 rjmp .L22 185 .LVL16: 186 .L8: 187 .loc 1 78 0 discriminator 2 188 /* #APP */ 189 ; 78 "test.c" 1 190 0062 0000 nop 191 ; 0 "" 2 192 ; 78 "test.c" 1 193 0064 0000 nop 194 ; 0 "" 2 195 /* #NOAPP */ 196 0066 2BB3 in r18,0x1b 197 0068 207F andi r18,lo8(-16) 198 006a 2BBB out 0x1b,r18 199 006c 232F mov r18,r19 200 .L22: 201 .LVL17: 202 /* #APP */ 203 ; 78 "test.c" 1 204 006e 0000 nop 205 ; 0 "" 2 206 ; 78 "test.c" 1 207 0070 0000 nop 208 ; 0 "" 2 209 ; 78 "test.c" 1 210 0072 0000 nop 211 ; 0 "" 2 212 ; 78 "test.c" 1 213 0074 0000 nop 214 ; 0 "" 2 215 ; 78 "test.c" 1 216 0076 0000 nop 217 ; 0 "" 2 GAS LISTING /tmp/ccEAqm16.s page 9 218 ; 78 "test.c" 1 219 0078 0000 nop 220 ; 0 "" 2 221 ; 78 "test.c" 1 222 007a 0000 nop 223 ; 0 "" 2 224 /* #NOAPP */ 225 007c 3111 cpse r19,__zero_reg__ 226 007e 00C0 rjmp .L11 227 .LVL18: 79:test.c **** SEND_WS( i|0xc0); 228 .loc 1 79 0 is_stmt 1 229 0080 606C ori r22,lo8(-64) 230 .LVL19: 231 0082 20E8 ldi r18,lo8(-128) 232 .LVL20: 233 .L15: 234 .loc 1 79 0 is_stmt 0 discriminator 2 235 0084 422F mov r20,r18 236 0086 4623 and r20,r22 237 0088 322F mov r19,r18 238 008a 3695 lsr r19 239 008c 2BB3 in r18,0x1b 240 .LVL21: 241 008e 2F60 ori r18,lo8(15) 242 0090 2BBB out 0x1b,r18 243 0092 4423 tst r20 244 0094 01F0 breq .L12 245 .loc 1 79 0 discriminator 1 246 0096 232F mov r18,r19 247 .LVL22: 248 /* #APP */ 249 ; 79 "test.c" 1 250 0098 0000 nop 251 ; 0 "" 2 252 ; 79 "test.c" 1 253 009a 0000 nop 254 ; 0 "" 2 255 ; 79 "test.c" 1 256 009c 0000 nop 257 ; 0 "" 2 258 ; 79 "test.c" 1 259 009e 0000 nop 260 ; 0 "" 2 261 ; 79 "test.c" 1 262 00a0 0000 nop 263 ; 0 "" 2 264 ; 79 "test.c" 1 265 00a2 0000 nop 266 ; 0 "" 2 267 ; 79 "test.c" 1 268 00a4 0000 nop 269 ; 0 "" 2 270 ; 79 "test.c" 1 271 00a6 0000 nop 272 ; 0 "" 2 273 ; 79 "test.c" 1 GAS LISTING /tmp/ccEAqm16.s page 10 274 00a8 0000 nop 275 ; 0 "" 2 276 ; 79 "test.c" 1 277 00aa 0000 nop 278 ; 0 "" 2 279 /* #NOAPP */ 280 00ac 4BB3 in r20,0x1b 281 00ae 407F andi r20,lo8(-16) 282 00b0 4BBB out 0x1b,r20 283 00b2 00C0 rjmp .L23 284 .LVL23: 285 .L12: 286 .loc 1 79 0 discriminator 2 287 /* #APP */ 288 ; 79 "test.c" 1 289 00b4 0000 nop 290 ; 0 "" 2 291 ; 79 "test.c" 1 292 00b6 0000 nop 293 ; 0 "" 2 294 /* #NOAPP */ 295 00b8 2BB3 in r18,0x1b 296 00ba 207F andi r18,lo8(-16) 297 00bc 2BBB out 0x1b,r18 298 00be 232F mov r18,r19 299 .L23: 300 .LVL24: 301 /* #APP */ 302 ; 79 "test.c" 1 303 00c0 0000 nop 304 ; 0 "" 2 305 ; 79 "test.c" 1 306 00c2 0000 nop 307 ; 0 "" 2 308 ; 79 "test.c" 1 309 00c4 0000 nop 310 ; 0 "" 2 311 ; 79 "test.c" 1 312 00c6 0000 nop 313 ; 0 "" 2 314 ; 79 "test.c" 1 315 00c8 0000 nop 316 ; 0 "" 2 317 ; 79 "test.c" 1 318 00ca 0000 nop 319 ; 0 "" 2 320 ; 79 "test.c" 1 321 00cc 0000 nop 322 ; 0 "" 2 323 /* #NOAPP */ 324 00ce 3111 cpse r19,__zero_reg__ 325 00d0 00C0 rjmp .L15 326 .loc 1 79 0 327 00d2 20E8 ldi r18,lo8(-128) 328 .LVL25: 329 .L19: 80:test.c **** SEND_WS( i|0xfe ); GAS LISTING /tmp/ccEAqm16.s page 11 330 .loc 1 80 0 is_stmt 1 discriminator 2 331 00d4 422F mov r20,r18 332 00d6 4523 and r20,r21 333 00d8 322F mov r19,r18 334 00da 3695 lsr r19 335 00dc 2BB3 in r18,0x1b 336 .LVL26: 337 00de 2F60 ori r18,lo8(15) 338 00e0 2BBB out 0x1b,r18 339 00e2 4423 tst r20 340 00e4 01F0 breq .L16 341 .loc 1 80 0 is_stmt 0 discriminator 1 342 00e6 232F mov r18,r19 343 .LVL27: 344 /* #APP */ 345 ; 80 "test.c" 1 346 00e8 0000 nop 347 ; 0 "" 2 348 ; 80 "test.c" 1 349 00ea 0000 nop 350 ; 0 "" 2 351 ; 80 "test.c" 1 352 00ec 0000 nop 353 ; 0 "" 2 354 ; 80 "test.c" 1 355 00ee 0000 nop 356 ; 0 "" 2 357 ; 80 "test.c" 1 358 00f0 0000 nop 359 ; 0 "" 2 360 ; 80 "test.c" 1 361 00f2 0000 nop 362 ; 0 "" 2 363 ; 80 "test.c" 1 364 00f4 0000 nop 365 ; 0 "" 2 366 ; 80 "test.c" 1 367 00f6 0000 nop 368 ; 0 "" 2 369 ; 80 "test.c" 1 370 00f8 0000 nop 371 ; 0 "" 2 372 ; 80 "test.c" 1 373 00fa 0000 nop 374 ; 0 "" 2 375 /* #NOAPP */ 376 00fc 4BB3 in r20,0x1b 377 00fe 407F andi r20,lo8(-16) 378 0100 4BBB out 0x1b,r20 379 0102 00C0 rjmp .L24 380 .LVL28: 381 .L16: 382 .loc 1 80 0 discriminator 2 383 /* #APP */ 384 ; 80 "test.c" 1 385 0104 0000 nop 386 ; 0 "" 2 GAS LISTING /tmp/ccEAqm16.s page 12 387 ; 80 "test.c" 1 388 0106 0000 nop 389 ; 0 "" 2 390 /* #NOAPP */ 391 0108 2BB3 in r18,0x1b 392 010a 207F andi r18,lo8(-16) 393 010c 2BBB out 0x1b,r18 394 010e 232F mov r18,r19 395 .L24: 396 .LVL29: 397 /* #APP */ 398 ; 80 "test.c" 1 399 0110 0000 nop 400 ; 0 "" 2 401 ; 80 "test.c" 1 402 0112 0000 nop 403 ; 0 "" 2 404 ; 80 "test.c" 1 405 0114 0000 nop 406 ; 0 "" 2 407 ; 80 "test.c" 1 408 0116 0000 nop 409 ; 0 "" 2 410 ; 80 "test.c" 1 411 0118 0000 nop 412 ; 0 "" 2 413 ; 80 "test.c" 1 414 011a 0000 nop 415 ; 0 "" 2 416 ; 80 "test.c" 1 417 011c 0000 nop 418 ; 0 "" 2 419 /* #NOAPP */ 420 011e 3111 cpse r19,__zero_reg__ 421 0120 00C0 rjmp .L19 422 .LVL30: 81:test.c **** } 82:test.c **** #else 83:test.c **** for( j = 0; j < 2; j++ ) 84:test.c **** { 85:test.c **** // SEND_WS( i ); 86:test.c **** SEND_WS( HUE(i) ); 87:test.c **** SEND_WS( HUE(i+85)); 88:test.c **** SEND_WS( HUE(i+170) ); 89:test.c **** } 90:test.c **** #endif 91:test.c **** 92:test.c **** #ifdef SOURCING 93:test.c **** WSPORT|= WSPIN; 423 .loc 1 93 0 is_stmt 1 discriminator 1 424 0122 2BB3 in r18,0x1b 425 .LVL31: 426 0124 2F60 ori r18,lo8(15) 427 0126 2BBB out 0x1b,r18 428 .LVL32: 429 .LBB14: 430 .LBB15: GAS LISTING /tmp/ccEAqm16.s page 13 431 .loc 2 163 0 discriminator 1 432 0128 EFE4 ldi r30,lo8(-15537) 433 012a F3EC ldi r31,hi8(-15537) 434 012c 3197 1: sbiw r30,1 435 012e 01F4 brne 1b 436 0130 00C0 rjmp . 437 0132 0000 nop 438 .LBE15: 439 .LBE14: 94:test.c **** _delay_ms(10); 95:test.c **** WSPORT&=~WSPIN; 440 .loc 1 95 0 discriminator 1 441 0134 2BB3 in r18,0x1b 442 0136 207F andi r18,lo8(-16) 443 0138 2BBB out 0x1b,r18 444 .LVL33: 445 .LBB16: 446 .LBB17: 164:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 165:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #else 166:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** uint16_t __ticks; 167:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __tmp = ((F_CPU) / 4e3) * __ms; 168:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** if (__tmp < 1.0) 169:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks = 1; 170:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** else if (__tmp > 65535) 171:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** { 172:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** // __ticks = requested delay in 1/10 ms 173:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks = (uint16_t) (__ms * 10.0); 174:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** while(__ticks) 175:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** { 176:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** // wait 1/10 ms 177:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_loop_2(((F_CPU) / 4e3) / 10); 178:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks --; 179:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** } 180:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** return; 181:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** } 182:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** else 183:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks = (uint16_t)__tmp; 184:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_loop_2(__ticks); 185:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 186:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** } 187:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 188:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** /** 189:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** \ingroup util_delay 190:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 191:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Perform a delay of \c __us microseconds, using _delay_loop_1(). 192:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 193:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The macro F_CPU is supposed to be defined to a 194:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** constant defining the CPU clock frequency (in Hertz). 195:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 196:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** The maximal possible delay is 768 us / F_CPU in MHz. 197:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 198:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** If the user requests a delay greater than the maximal possible one, 199:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_us() will automatically call _delay_ms() instead. The user 200:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** will not be informed about this case. 201:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 202:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) GAS LISTING /tmp/ccEAqm16.s page 14 203:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** support, maximal possible delay is 4294967.295 us/ F_CPU in MHz. For 204:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** values greater than the maximal possible delay, overflow results in 205:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** no delay i.e., 0us. 206:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 207:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Conversion of __us into clock cycles may not always result in integer. 208:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** By default, the clock cycles rounded up to next integer. This ensures that 209:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** the user gets atleast __us microseconds of delay. 210:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 211:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ 212:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** to round down and round to closest integer. 213:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 214:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Note: The new implementation of _delay_us(double __us) with 215:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. 216:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. 217:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** Also, the backward compatible 218:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** algorithm will be chosen if the code is compiled in a freestanding 219:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** environment (GCC option \c -ffreestanding), as the math functions 220:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** required for rounding are not available to the compiler then. 221:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 222:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** */ 223:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** void 224:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** _delay_us(double __us) 225:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** { 226:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** double __tmp ; 227:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 228:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 229:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __STDC_HOSTED__ 230:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** uint32_t __ticks_dc; 231:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); 232:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e6) * __us; 233:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 234:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) 235:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); 236:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 237:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) 238:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); 239:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 240:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #else 241:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** //round up by default 242:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); 243:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** #endif 244:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** 245:/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); 447 .loc 2 245 0 discriminator 1 448 013a F2E4 ldi r31,lo8(66) 449 013c FA95 1: dec r31 450 013e 01F4 brne 1b 451 0140 00C0 rjmp . 452 0142 00C0 rjmp .L20 453 .LBE17: 454 .LBE16: 455 .cfi_endproc 456 .LFE8: 458 .global huetable 459 .section .progmem.data,"a",@progbits 462 huetable: 463 0000 00 .byte 0 GAS LISTING /tmp/ccEAqm16.s page 15 464 0001 06 .byte 6 465 0002 0C .byte 12 466 0003 12 .byte 18 467 0004 18 .byte 24 468 0005 1E .byte 30 469 0006 24 .byte 36 470 0007 2A .byte 42 471 0008 30 .byte 48 472 0009 36 .byte 54 473 000a 3C .byte 60 474 000b 42 .byte 66 475 000c 48 .byte 72 476 000d 4E .byte 78 477 000e 54 .byte 84 478 000f 5A .byte 90 479 0010 60 .byte 96 480 0011 66 .byte 102 481 0012 6C .byte 108 482 0013 72 .byte 114 483 0014 78 .byte 120 484 0015 7E .byte 126 485 0016 84 .byte -124 486 0017 8A .byte -118 487 0018 90 .byte -112 488 0019 96 .byte -106 489 001a 9C .byte -100 490 001b A2 .byte -94 491 001c A8 .byte -88 492 001d AE .byte -82 493 001e B4 .byte -76 494 001f BA .byte -70 495 0020 C0 .byte -64 496 0021 C6 .byte -58 497 0022 CC .byte -52 498 0023 D2 .byte -46 499 0024 D8 .byte -40 500 0025 DE .byte -34 501 0026 E4 .byte -28 502 0027 EA .byte -22 503 0028 F0 .byte -16 504 0029 F6 .byte -10 505 002a FF .byte -1 506 002b FF .byte -1 507 002c FF .byte -1 508 002d FF .byte -1 509 002e FF .byte -1 510 002f FF .byte -1 511 0030 FF .byte -1 512 0031 FF .byte -1 513 0032 FF .byte -1 514 0033 FF .byte -1 515 0034 FF .byte -1 516 0035 FF .byte -1 517 0036 FF .byte -1 518 0037 FF .byte -1 519 0038 FF .byte -1 520 0039 FF .byte -1 GAS LISTING /tmp/ccEAqm16.s page 16 521 003a FF .byte -1 522 003b FF .byte -1 523 003c FF .byte -1 524 003d FF .byte -1 525 003e FF .byte -1 526 003f FF .byte -1 527 0040 FF .byte -1 528 0041 FF .byte -1 529 0042 FF .byte -1 530 0043 FF .byte -1 531 0044 FF .byte -1 532 0045 FF .byte -1 533 0046 FF .byte -1 534 0047 FF .byte -1 535 0048 FF .byte -1 536 0049 FF .byte -1 537 004a FF .byte -1 538 004b FF .byte -1 539 004c FF .byte -1 540 004d FF .byte -1 541 004e FF .byte -1 542 004f FF .byte -1 543 0050 FF .byte -1 544 0051 FF .byte -1 545 0052 FF .byte -1 546 0053 FF .byte -1 547 0054 FF .byte -1 548 0055 FF .byte -1 549 0056 FF .byte -1 550 0057 FF .byte -1 551 0058 FF .byte -1 552 0059 FF .byte -1 553 005a FF .byte -1 554 005b FF .byte -1 555 005c FF .byte -1 556 005d FF .byte -1 557 005e FF .byte -1 558 005f FF .byte -1 559 0060 FF .byte -1 560 0061 FF .byte -1 561 0062 FF .byte -1 562 0063 FF .byte -1 563 0064 FF .byte -1 564 0065 FF .byte -1 565 0066 FF .byte -1 566 0067 FF .byte -1 567 0068 FF .byte -1 568 0069 FF .byte -1 569 006a FF .byte -1 570 006b FF .byte -1 571 006c FF .byte -1 572 006d FF .byte -1 573 006e FF .byte -1 574 006f FF .byte -1 575 0070 FF .byte -1 576 0071 FF .byte -1 577 0072 FF .byte -1 GAS LISTING /tmp/ccEAqm16.s page 17 578 0073 FF .byte -1 579 0074 FF .byte -1 580 0075 FF .byte -1 581 0076 FF .byte -1 582 0077 FF .byte -1 583 0078 FF .byte -1 584 0079 FF .byte -1 585 007a FF .byte -1 586 007b FF .byte -1 587 007c FF .byte -1 588 007d FF .byte -1 589 007e FF .byte -1 590 007f FF .byte -1 591 0080 FF .byte -1 592 0081 F9 .byte -7 593 0082 F3 .byte -13 594 0083 ED .byte -19 595 0084 E7 .byte -25 596 0085 E1 .byte -31 597 0086 DB .byte -37 598 0087 D5 .byte -43 599 0088 CF .byte -49 600 0089 C9 .byte -55 601 008a C3 .byte -61 602 008b BD .byte -67 603 008c B7 .byte -73 604 008d B1 .byte -79 605 008e AB .byte -85 606 008f A5 .byte -91 607 0090 9F .byte -97 608 0091 99 .byte -103 609 0092 93 .byte -109 610 0093 8D .byte -115 611 0094 87 .byte -121 612 0095 81 .byte -127 613 0096 7B .byte 123 614 0097 75 .byte 117 615 0098 6F .byte 111 616 0099 69 .byte 105 617 009a 63 .byte 99 618 009b 5D .byte 93 619 009c 57 .byte 87 620 009d 51 .byte 81 621 009e 4B .byte 75 622 009f 45 .byte 69 623 00a0 3F .byte 63 624 00a1 39 .byte 57 625 00a2 33 .byte 51 626 00a3 2D .byte 45 627 00a4 27 .byte 39 628 00a5 21 .byte 33 629 00a6 1B .byte 27 630 00a7 15 .byte 21 631 00a8 0F .byte 15 632 00a9 09 .byte 9 633 00aa 00 .byte 0 634 00ab 00 .byte 0 GAS LISTING /tmp/ccEAqm16.s page 18 635 00ac 00 .byte 0 636 00ad 00 .byte 0 637 00ae 00 .byte 0 638 00af 00 .byte 0 639 00b0 00 .byte 0 640 00b1 00 .byte 0 641 00b2 00 .byte 0 642 00b3 00 .byte 0 643 00b4 00 .byte 0 644 00b5 00 .byte 0 645 00b6 00 .byte 0 646 00b7 00 .byte 0 647 00b8 00 .byte 0 648 00b9 00 .byte 0 649 00ba 00 .byte 0 650 00bb 00 .byte 0 651 00bc 00 .byte 0 652 00bd 00 .byte 0 653 00be 00 .byte 0 654 00bf 00 .byte 0 655 00c0 00 .byte 0 656 00c1 00 .byte 0 657 00c2 00 .byte 0 658 00c3 00 .byte 0 659 00c4 00 .byte 0 660 00c5 00 .byte 0 661 00c6 00 .byte 0 662 00c7 00 .byte 0 663 00c8 00 .byte 0 664 00c9 00 .byte 0 665 00ca 00 .byte 0 666 00cb 00 .byte 0 667 00cc 00 .byte 0 668 00cd 00 .byte 0 669 00ce 00 .byte 0 670 00cf 00 .byte 0 671 00d0 00 .byte 0 672 00d1 00 .byte 0 673 00d2 00 .byte 0 674 00d3 00 .byte 0 675 00d4 00 .byte 0 676 00d5 00 .byte 0 677 00d6 00 .byte 0 678 00d7 00 .byte 0 679 00d8 00 .byte 0 680 00d9 00 .byte 0 681 00da 00 .byte 0 682 00db 00 .byte 0 683 00dc 00 .byte 0 684 00dd 00 .byte 0 685 00de 00 .byte 0 686 00df 00 .byte 0 687 00e0 00 .byte 0 688 00e1 00 .byte 0 689 00e2 00 .byte 0 690 00e3 00 .byte 0 691 00e4 00 .byte 0 GAS LISTING /tmp/ccEAqm16.s page 19 692 00e5 00 .byte 0 693 00e6 00 .byte 0 694 00e7 00 .byte 0 695 00e8 00 .byte 0 696 00e9 00 .byte 0 697 00ea 00 .byte 0 698 00eb 00 .byte 0 699 00ec 00 .byte 0 700 00ed 00 .byte 0 701 00ee 00 .byte 0 702 00ef 00 .byte 0 703 00f0 00 .byte 0 704 00f1 00 .byte 0 705 00f2 00 .byte 0 706 00f3 00 .byte 0 707 00f4 00 .byte 0 708 00f5 00 .byte 0 709 00f6 00 .byte 0 710 00f7 00 .byte 0 711 00f8 00 .byte 0 712 00f9 00 .byte 0 713 00fa 00 .byte 0 714 00fb 00 .byte 0 715 00fc 00 .byte 0 716 00fd 00 .byte 0 717 00fe 00 .byte 0 718 00ff 00 .byte 0 719 .text 720 .Letext0: 721 .file 3 "/home/cnlohr/cpptest/avr-toolchain/avr-toolchain/avr/include/stdint.h" 722 .file 4 "huetabler.h" GAS LISTING /tmp/ccEAqm16.s page 20 DEFINED SYMBOLS *ABS*:0000000000000000 test.c /tmp/ccEAqm16.s:2 *ABS*:000000000000003e __SP_H__ /tmp/ccEAqm16.s:3 *ABS*:000000000000003d __SP_L__ /tmp/ccEAqm16.s:4 *ABS*:000000000000003f __SREG__ /tmp/ccEAqm16.s:5 *ABS*:0000000000000000 __tmp_reg__ /tmp/ccEAqm16.s:6 *ABS*:0000000000000001 __zero_reg__ /tmp/ccEAqm16.s:12 .text:0000000000000000 delay_ms /tmp/ccEAqm16.s:77 .text.startup:0000000000000000 main /tmp/ccEAqm16.s:462 .progmem.data:0000000000000000 huetable NO UNDEFINED SYMBOLS