2985 lines
92 KiB
Text
2985 lines
92 KiB
Text
# 0 "main.c"
|
|
# 1 "/home/plex/Documents/code/c/dhbw-sys/src/blink//"
|
|
# 0 "<built-in>"
|
|
# 0 "<command-line>"
|
|
# 1 "main.c"
|
|
|
|
# 1 "/usr/avr/include/avr/io.h" 1 3
|
|
|
|
# 1 "/usr/avr/include/avr/io.h" 3
|
|
/* Copyright (c) 2002,2003,2005,2006,2007 Marek Michalkiewicz, Joerg Wunsch
|
|
Copyright (c) 2007 Eric B. Weddington
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/** \file */
|
|
/** \defgroup avr_io <avr/io.h>: AVR device-specific IO definitions
|
|
\code #include <avr/io.h> \endcode
|
|
|
|
This header file includes the apropriate IO definitions for the
|
|
device that has been specified by the <tt>-mmcu=</tt> compiler
|
|
command-line switch. This is done by diverting to the appropriate
|
|
file <tt><avr/io</tt><em>XXXX</em><tt>.h></tt> which should
|
|
never be included directly. Some register names common to all
|
|
AVR devices are defined directly within <tt><avr/common.h></tt>,
|
|
which is included in <tt><avr/io.h></tt>,
|
|
but most of the details come from the respective include file.
|
|
|
|
Note that this file always includes the following files:
|
|
\code
|
|
#include <avr/sfr_defs.h>
|
|
#include <avr/portpins.h>
|
|
#include <avr/common.h>
|
|
#include <avr/version.h>
|
|
\endcode
|
|
See \ref avr_sfr for more details about that header file.
|
|
|
|
Included are definitions of the IO register set and their
|
|
respective bit values as specified in the Atmel documentation.
|
|
Note that inconsistencies in naming conventions,
|
|
so even identical functions sometimes get different names on
|
|
different devices.
|
|
|
|
Also included are the specific names useable for interrupt
|
|
function definitions as documented
|
|
\ref avr_signames "here".
|
|
|
|
Finally, the following macros are defined:
|
|
|
|
- \b RAMEND
|
|
<br>
|
|
The last on-chip RAM address.
|
|
<br>
|
|
- \b XRAMEND
|
|
<br>
|
|
The last possible RAM location that is addressable. This is equal to
|
|
RAMEND for devices that do not allow for external RAM. For devices
|
|
that allow external RAM, this will be larger than RAMEND.
|
|
<br>
|
|
- \b E2END
|
|
<br>
|
|
The last EEPROM address.
|
|
<br>
|
|
- \b FLASHEND
|
|
<br>
|
|
The last byte address in the Flash program space.
|
|
<br>
|
|
- \b SPM_PAGESIZE
|
|
<br>
|
|
For devices with bootloader support, the flash pagesize
|
|
(in bytes) to be used for the \c SPM instruction.
|
|
- \b E2PAGESIZE
|
|
<br>
|
|
The size of the EEPROM page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# 1 "/usr/avr/include/avr/sfr_defs.h" 1 3
|
|
/* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* avr/sfr_defs.h - macros for accessing AVR special function registers */
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
/** \defgroup avr_sfr_notes Additional notes from <avr/sfr_defs.h>
|
|
\ingroup avr_sfr
|
|
|
|
The \c <avr/sfr_defs.h> file is included by all of the \c <avr/ioXXXX.h>
|
|
files, which use macros defined here to make the special function register
|
|
definitions look like C variables or simple constants, depending on the
|
|
<tt>_SFR_ASM_COMPAT</tt> define. Some examples from \c <avr/iocanxx.h> to
|
|
show how to define such macros:
|
|
|
|
\code
|
|
#define PORTA _SFR_IO8(0x02)
|
|
#define EEAR _SFR_IO16(0x21)
|
|
#define UDR0 _SFR_MEM8(0xC6)
|
|
#define TCNT3 _SFR_MEM16(0x94)
|
|
#define CANIDT _SFR_MEM32(0xF0)
|
|
\endcode
|
|
|
|
If \c _SFR_ASM_COMPAT is not defined, C programs can use names like
|
|
<tt>PORTA</tt> directly in C expressions (also on the left side of
|
|
assignment operators) and GCC will do the right thing (use short I/O
|
|
instructions if possible). The \c __SFR_OFFSET definition is not used in
|
|
any way in this case.
|
|
|
|
Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants
|
|
(addresses of the I/O registers). This is necessary when included in
|
|
preprocessed assembler (*.S) source files, so it is done automatically if
|
|
\c __ASSEMBLER__ is defined. By default, all addresses are defined as if
|
|
they were memory addresses (used in \c lds/sts instructions). To use these
|
|
addresses in \c in/out instructions, you must subtract 0x20 from them.
|
|
|
|
For more backwards compatibility, insert the following at the start of your
|
|
old assembler source file:
|
|
|
|
\code
|
|
#define __SFR_OFFSET 0
|
|
\endcode
|
|
|
|
This automatically subtracts 0x20 from I/O space addresses, but it's a
|
|
hack, so it is recommended to change your source: wrap such addresses in
|
|
macros defined here, as shown below. After this is done, the
|
|
<tt>__SFR_OFFSET</tt> definition is no longer necessary and can be removed.
|
|
|
|
Real example - this code could be used in a boot loader that is portable
|
|
between devices with \c SPMCR at different addresses.
|
|
|
|
\verbatim
|
|
<avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
|
|
<avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)
|
|
\endverbatim
|
|
|
|
\code
|
|
#if _SFR_IO_REG_P(SPMCR)
|
|
out _SFR_IO_ADDR(SPMCR), r24
|
|
#else
|
|
sts _SFR_MEM_ADDR(SPMCR), r24
|
|
#endif
|
|
\endcode
|
|
|
|
You can use the \c in/out/cbi/sbi/sbic/sbis instructions, without the
|
|
<tt>_SFR_IO_REG_P</tt> test, if you know that the register is in the I/O
|
|
space (as with \c SREG, for example). If it isn't, the assembler will
|
|
complain (I/O address out of range 0...0x3f), so this should be fairly
|
|
safe.
|
|
|
|
If you do not define \c __SFR_OFFSET (so it will be 0x20 by default), all
|
|
special register addresses are defined as memory addresses (so \c SREG is
|
|
0x5f), and (if code size and speed are not important, and you don't like
|
|
the ugly \#if above) you can always use lds/sts to access them. But, this
|
|
will not work if <tt>__SFR_OFFSET</tt> != 0x20, so use a different macro
|
|
(defined only if <tt>__SFR_OFFSET</tt> == 0x20) for safety:
|
|
|
|
\code
|
|
sts _SFR_ADDR(SPMCR), r24
|
|
\endcode
|
|
|
|
In C programs, all 3 combinations of \c _SFR_ASM_COMPAT and
|
|
<tt>__SFR_OFFSET</tt> are supported - the \c _SFR_ADDR(SPMCR) macro can be
|
|
used to get the address of the \c SPMCR register (0x57 or 0x68 depending on
|
|
device). */
|
|
# 125 "/usr/avr/include/avr/sfr_defs.h" 3
|
|
/* These only work in C programs. */
|
|
# 1 "/usr/avr/include/inttypes.h" 1 3
|
|
/* Copyright (c) 2004,2005,2007,2012 Joerg Wunsch
|
|
Copyright (c) 2005, Carlos Lamas
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
# 1 "/usr/lib/gcc/avr/13.2.0/include/stdint.h" 1 3 4
|
|
# 9 "/usr/lib/gcc/avr/13.2.0/include/stdint.h" 3 4
|
|
# 1 "/usr/avr/include/stdint.h" 1 3 4
|
|
/* Copyright (c) 2002,2004,2005 Marek Michalkiewicz
|
|
Copyright (c) 2005, Carlos Lamas
|
|
Copyright (c) 2005,2007 Joerg Wunsch
|
|
Copyright (c) 2013 Embecosm
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/*
|
|
* ISO/IEC 9899:1999 7.18 Integer types <stdint.h>
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file */
|
|
/** \defgroup avr_stdint <stdint.h>: Standard Integer Types
|
|
\code #include <stdint.h> \endcode
|
|
|
|
Use [u]intN_t if you need exactly N bits.
|
|
|
|
Since these typedefs are mandated by the C99 standard, they are preferred
|
|
over rolling your own typedefs. */
|
|
|
|
|
|
/*
|
|
* __USING_MINT8 is defined to 1 if the -mint8 option is in effect.
|
|
*/
|
|
# 64 "/usr/avr/include/stdint.h" 3 4
|
|
/* Integer types */
|
|
# 123 "/usr/avr/include/stdint.h" 3 4
|
|
/* actual implementation goes here */
|
|
|
|
typedef signed int int8_t __attribute__((__mode__(__QI__)));
|
|
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
|
|
typedef signed int int16_t __attribute__ ((__mode__ (__HI__)));
|
|
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
|
|
typedef signed int int32_t __attribute__ ((__mode__ (__SI__)));
|
|
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
|
|
|
|
typedef signed int int64_t __attribute__((__mode__(__DI__)));
|
|
typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
|
|
|
|
|
|
|
|
|
|
/** \name Integer types capable of holding object pointers
|
|
These allow you to declare variables of the same size as a pointer. */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
Signed pointer compatible type. */
|
|
|
|
typedef int16_t intptr_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
Unsigned pointer compatible type. */
|
|
|
|
typedef uint16_t uintptr_t;
|
|
|
|
/*@}*/
|
|
|
|
/** \name Minimum-width integer types
|
|
Integer types having at least the specified width */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
signed int with at least 8 bits. */
|
|
|
|
typedef int8_t int_least8_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
unsigned int with at least 8 bits. */
|
|
|
|
typedef uint8_t uint_least8_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
signed int with at least 16 bits. */
|
|
|
|
typedef int16_t int_least16_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
unsigned int with at least 16 bits. */
|
|
|
|
typedef uint16_t uint_least16_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
signed int with at least 32 bits. */
|
|
|
|
typedef int32_t int_least32_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
unsigned int with at least 32 bits. */
|
|
|
|
typedef uint32_t uint_least32_t;
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
signed int with at least 64 bits.
|
|
\note This type is not available when the compiler
|
|
option -mint8 is in effect. */
|
|
|
|
typedef int64_t int_least64_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
unsigned int with at least 64 bits.
|
|
\note This type is not available when the compiler
|
|
option -mint8 is in effect. */
|
|
|
|
typedef uint64_t uint_least64_t;
|
|
|
|
|
|
/*@}*/
|
|
|
|
|
|
/** \name Fastest minimum-width integer types
|
|
Integer types being usually fastest having at least the specified width */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest signed int with at least 8 bits. */
|
|
|
|
typedef int8_t int_fast8_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest unsigned int with at least 8 bits. */
|
|
|
|
typedef uint8_t uint_fast8_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest signed int with at least 16 bits. */
|
|
|
|
typedef int16_t int_fast16_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest unsigned int with at least 16 bits. */
|
|
|
|
typedef uint16_t uint_fast16_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest signed int with at least 32 bits. */
|
|
|
|
typedef int32_t int_fast32_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest unsigned int with at least 32 bits. */
|
|
|
|
typedef uint32_t uint_fast32_t;
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest signed int with at least 64 bits.
|
|
\note This type is not available when the compiler
|
|
option -mint8 is in effect. */
|
|
|
|
typedef int64_t int_fast64_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
fastest unsigned int with at least 64 bits.
|
|
\note This type is not available when the compiler
|
|
option -mint8 is in effect. */
|
|
|
|
typedef uint64_t uint_fast64_t;
|
|
|
|
|
|
/*@}*/
|
|
|
|
|
|
/** \name Greatest-width integer types
|
|
Types designating integer data capable of representing any value of
|
|
any integer type in the corresponding signed or unsigned category */
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest signed int available. */
|
|
|
|
typedef int64_t intmax_t;
|
|
|
|
/** \ingroup avr_stdint
|
|
largest unsigned int available. */
|
|
|
|
typedef uint64_t uintmax_t;
|
|
|
|
|
|
/*@}*/
|
|
|
|
|
|
/* Helping macro */
|
|
# 298 "/usr/avr/include/stdint.h" 3 4
|
|
/** \name Limits of specified-width integer types
|
|
C++ implementations should define these macros only when
|
|
__STDC_LIMIT_MACROS is defined before <stdint.h> is included */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int8_t can hold. */
|
|
# 328 "/usr/avr/include/stdint.h" 3 4
|
|
/** \ingroup avr_stdint
|
|
largest value an uint8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint32_t can hold. */
|
|
|
|
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint64_t can hold. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** \name Limits of minimum-width integer types */
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_least8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_least8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_least8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_least16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_least16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_least16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_least32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_least32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_least32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_least64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_least64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_least64_t can hold. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** \name Limits of fastest minimum-width integer types */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_fast8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_fast8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_fast8_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_fast16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_fast16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_fast16_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_fast32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_fast32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_fast32_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an int_fast64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an int_fast64_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uint_fast64_t can hold. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** \name Limits of integer types capable of holding object pointers */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an intptr_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an intptr_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uintptr_t can hold. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** \name Limits of greatest-width integer types */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value an intmax_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value an intmax_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value an uintmax_t can hold. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** \name Limits of other integer types
|
|
C++ implementations should define these macros only when
|
|
__STDC_LIMIT_MACROS is defined before <stdint.h> is included */
|
|
|
|
/*@{*/
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value a ptrdiff_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value a ptrdiff_t can hold. */
|
|
|
|
|
|
|
|
|
|
/* Limits of sig_atomic_t */
|
|
/* signal.h is currently not implemented (not avr/signal.h) */
|
|
|
|
/** \ingroup avr_stdint
|
|
largest positive value a sig_atomic_t can hold. */
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
smallest negative value a sig_atomic_t can hold. */
|
|
|
|
|
|
|
|
|
|
/** \ingroup avr_stdint
|
|
largest value a size_t can hold. */
|
|
|
|
|
|
|
|
|
|
/* Limits of wchar_t */
|
|
/* wchar.h is currently not implemented */
|
|
/* #define WCHAR_MAX */
|
|
/* #define WCHAR_MIN */
|
|
|
|
|
|
/* Limits of wint_t */
|
|
/* wchar.h is currently not implemented */
|
|
# 615 "/usr/avr/include/stdint.h" 3 4
|
|
/** \name Macros for integer constants
|
|
C++ implementations should define these macros only when
|
|
__STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
|
|
|
|
These definitions are valid for integer constants without suffix and
|
|
for macros defined as integer constant without suffix */
|
|
|
|
/* The GNU C preprocessor defines special macros in the implementation
|
|
namespace to allow a definition that works in #if expressions. */
|
|
# 700 "/usr/avr/include/stdint.h" 3 4
|
|
/*@}*/
|
|
# 10 "/usr/lib/gcc/avr/13.2.0/include/stdint.h" 2 3 4
|
|
# 38 "/usr/avr/include/inttypes.h" 2 3
|
|
|
|
/** \file */
|
|
/** \defgroup avr_inttypes <inttypes.h>: Integer Type conversions
|
|
\code #include <inttypes.h> \endcode
|
|
|
|
This header file includes the exact-width integer definitions from
|
|
<tt><stdint.h></tt>, and extends them with additional facilities
|
|
provided by the implementation.
|
|
|
|
Currently, the extensions include two additional integer types
|
|
that could hold a "far" pointer (i.e. a code pointer that can
|
|
address more than 64 KB), as well as standard names for all printf
|
|
and scanf formatting options that are supported by the \ref avr_stdio.
|
|
As the library does not support the full range of conversion
|
|
specifiers from ISO 9899:1999, only those conversions that are
|
|
actually implemented will be listed here.
|
|
|
|
The idea behind these conversion macros is that, for each of the
|
|
types defined by <stdint.h>, a macro will be supplied that portably
|
|
allows formatting an object of that type in printf() or scanf()
|
|
operations. Example:
|
|
|
|
\code
|
|
#include <inttypes.h>
|
|
|
|
uint8_t smallval;
|
|
int32_t longval;
|
|
...
|
|
printf("The hexadecimal value of smallval is %" PRIx8
|
|
", the decimal value of longval is %" PRId32 ".\n",
|
|
smallval, longval);
|
|
\endcode
|
|
*/
|
|
|
|
/** \name Far pointers for memory access >64K */
|
|
|
|
/*@{*/
|
|
/** \ingroup avr_inttypes
|
|
signed integer type that can hold a pointer > 64 KB */
|
|
typedef int32_t int_farptr_t;
|
|
|
|
/** \ingroup avr_inttypes
|
|
unsigned integer type that can hold a pointer > 64 KB */
|
|
typedef uint32_t uint_farptr_t;
|
|
/*@}*/
|
|
|
|
|
|
|
|
|
|
/** \name macros for printf and scanf format specifiers
|
|
|
|
For C++, these are only included if __STDC_LIMIT_MACROS
|
|
is defined before including <inttypes.h>.
|
|
*/
|
|
|
|
/*@{*/
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_fast8_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_fast16_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for int_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for int_fast32_t */
|
|
# 173 "/usr/avr/include/inttypes.h" 3
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for intptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
integer printf format for intptr_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_fast8_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_fast16_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uint_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uint_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uint_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uint_fast32_t */
|
|
# 328 "/usr/avr/include/inttypes.h" 3
|
|
/** \ingroup avr_inttypes
|
|
octal printf format for uintptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal printf format for uintptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal printf format for uintptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
uppercase hexadecimal printf format for uintptr_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_fast8_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_fast16_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for int_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for int_fast32_t */
|
|
# 420 "/usr/avr/include/inttypes.h" 3
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for intptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
generic-integer scanf format for intptr_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_least8_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_fast8_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_fast16_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_least16_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_fast16_t */
|
|
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uint_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uint_fast32_t */
|
|
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_least32_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uint_fast32_t */
|
|
# 539 "/usr/avr/include/inttypes.h" 3
|
|
/** \ingroup avr_inttypes
|
|
octal scanf format for uintptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
decimal scanf format for uintptr_t */
|
|
|
|
/** \ingroup avr_inttypes
|
|
hexadecimal scanf format for uintptr_t */
|
|
|
|
|
|
/*@}*/
|
|
# 127 "/usr/avr/include/avr/sfr_defs.h" 2 3
|
|
# 194 "/usr/avr/include/avr/sfr_defs.h" 3
|
|
/** \name Bit manipulation */
|
|
|
|
/*@{*/
|
|
/** \def _BV
|
|
\ingroup avr_sfr
|
|
|
|
\code #include <avr/io.h>\endcode
|
|
|
|
Converts a bit number into a byte value.
|
|
|
|
\note The bit shift is performed by the compiler which then inserts the
|
|
result into the code. Thus, there is no run-time overhead when using
|
|
_BV(). */
|
|
|
|
|
|
|
|
/*@}*/
|
|
# 219 "/usr/avr/include/avr/sfr_defs.h" 3
|
|
/** \name IO register bit manipulation */
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
/** \def bit_is_set
|
|
\ingroup avr_sfr
|
|
|
|
\code #include <avr/io.h>\endcode
|
|
|
|
Test whether bit \c bit in IO register \c sfr is set.
|
|
This will return a 0 if the bit is clear, and non-zero
|
|
if the bit is set. */
|
|
|
|
|
|
|
|
/** \def bit_is_clear
|
|
\ingroup avr_sfr
|
|
|
|
\code #include <avr/io.h>\endcode
|
|
|
|
Test whether bit \c bit in IO register \c sfr is clear.
|
|
This will return non-zero if the bit is clear, and a 0
|
|
if the bit is set. */
|
|
|
|
|
|
|
|
/** \def loop_until_bit_is_set
|
|
\ingroup avr_sfr
|
|
|
|
\code #include <avr/io.h>\endcode
|
|
|
|
Wait until bit \c bit in IO register \c sfr is set. */
|
|
|
|
|
|
|
|
/** \def loop_until_bit_is_clear
|
|
\ingroup avr_sfr
|
|
|
|
\code #include <avr/io.h>\endcode
|
|
|
|
Wait until bit \c bit in IO register \c sfr is clear. */
|
|
|
|
|
|
|
|
/*@}*/
|
|
# 100 "/usr/avr/include/avr/io.h" 2 3
|
|
# 272 "/usr/avr/include/avr/io.h" 3
|
|
# 1 "/usr/avr/include/avr/iom328p.h" 1 3
|
|
/* Copyright (c) 2007 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:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
|
|
*/
|
|
|
|
/* $Id: iom328p.h 2444 2014-08-11 22:10:47Z joerg_wunsch $ */
|
|
|
|
/* avr/iom328p.h - definitions for ATmega328P. */
|
|
|
|
/* This file should only be included from <avr/io.h>, never directly. */
|
|
# 52 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* Registers and associated bit numbers */
|
|
# 799 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* Interrupt Vectors */
|
|
/* Interrupt Vector 0 is the reset vector. */
|
|
# 881 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* Constants */
|
|
# 893 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* Fuses */
|
|
|
|
|
|
/* Low Fuse Byte */
|
|
# 907 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* High Fuse Byte */
|
|
# 918 "/usr/avr/include/avr/iom328p.h" 3
|
|
/* Extended Fuse Byte */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Lock Bits */
|
|
|
|
|
|
|
|
|
|
|
|
/* Signature */
|
|
# 273 "/usr/avr/include/avr/io.h" 2 3
|
|
# 627 "/usr/avr/include/avr/io.h" 3
|
|
# 1 "/usr/avr/include/avr/portpins.h" 1 3
|
|
/* Copyright (c) 2003 Theodore A. Roth
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
/* This file should only be included from <avr/io.h>, never directly. */
|
|
|
|
|
|
|
|
|
|
|
|
/* Define Generic PORTn, DDn, and PINn values. */
|
|
|
|
/* Port Data Register (generic) */
|
|
# 54 "/usr/avr/include/avr/portpins.h" 3
|
|
/* Port Data Direction Register (generic) */
|
|
# 64 "/usr/avr/include/avr/portpins.h" 3
|
|
/* Port Input Pins (generic) */
|
|
# 74 "/usr/avr/include/avr/portpins.h" 3
|
|
/* Define PORTxn an Pxn values for all possible port pins if not defined already by io.h. */
|
|
|
|
/* PORT A */
|
|
# 119 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT B */
|
|
# 162 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT C */
|
|
# 205 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT D */
|
|
# 248 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT E */
|
|
# 291 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT F */
|
|
# 334 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT G */
|
|
# 377 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT H */
|
|
# 420 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT J */
|
|
# 463 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT K */
|
|
# 506 "/usr/avr/include/avr/portpins.h" 3
|
|
/* PORT L */
|
|
# 628 "/usr/avr/include/avr/io.h" 2 3
|
|
|
|
# 1 "/usr/avr/include/avr/common.h" 1 3
|
|
/* Copyright (c) 2007 Eric B. Weddington
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
|
|
# 1 "/usr/avr/include/avr/sfr_defs.h" 1 3
|
|
/* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* avr/sfr_defs.h - macros for accessing AVR special function registers */
|
|
|
|
/* $Id$ */
|
|
# 38 "/usr/avr/include/avr/common.h" 2 3
|
|
|
|
/*
|
|
This purpose of this header is to define registers that have not been
|
|
previously defined in the individual device IO header files, and to define
|
|
other symbols that are common across AVR device families.
|
|
|
|
This file is designed to be included in <avr/io.h> after the individual
|
|
device IO header files, and after <avr/sfr_defs.h>
|
|
|
|
*/
|
|
|
|
/*------------ Registers Not Previously Defined ------------*/
|
|
|
|
/*
|
|
These are registers that are not previously defined in the individual
|
|
IO header files, OR they are defined here because they are used in parts of
|
|
avr-libc even if a device is not selected but a general architecture has
|
|
been selected.
|
|
*/
|
|
|
|
|
|
/*
|
|
Stack pointer register.
|
|
|
|
AVR architecture 1 has no RAM, thus no stack pointer.
|
|
|
|
All other architectures do have a stack pointer. Some devices have only
|
|
less than 256 bytes of possible RAM locations (128 Bytes of SRAM
|
|
and no option for external RAM), thus SPH is officially "reserved"
|
|
for them.
|
|
*/
|
|
# 98 "/usr/avr/include/avr/common.h" 3
|
|
/* Status Register */
|
|
# 108 "/usr/avr/include/avr/common.h" 3
|
|
/* SREG bit definitions */
|
|
# 206 "/usr/avr/include/avr/common.h" 3
|
|
/*------------ Common Symbols ------------*/
|
|
|
|
/*
|
|
Generic definitions for registers that are common across multiple AVR devices
|
|
and families.
|
|
*/
|
|
|
|
/* Pointer registers definitions */
|
|
# 224 "/usr/avr/include/avr/common.h" 3
|
|
/* Status Register */
|
|
# 234 "/usr/avr/include/avr/common.h" 3
|
|
/* Stack Pointer (combined) Register */
|
|
# 244 "/usr/avr/include/avr/common.h" 3
|
|
/* Stack Pointer High Register */
|
|
# 255 "/usr/avr/include/avr/common.h" 3
|
|
/* Stack Pointer Low Register */
|
|
# 265 "/usr/avr/include/avr/common.h" 3
|
|
/* RAMPD Register */
|
|
# 275 "/usr/avr/include/avr/common.h" 3
|
|
/* RAMPX Register */
|
|
# 285 "/usr/avr/include/avr/common.h" 3
|
|
/* RAMPY Register */
|
|
# 295 "/usr/avr/include/avr/common.h" 3
|
|
/* RAMPZ Register */
|
|
# 305 "/usr/avr/include/avr/common.h" 3
|
|
/* Extended Indirect Register */
|
|
# 315 "/usr/avr/include/avr/common.h" 3
|
|
/*------------ Workaround to old compilers (4.1.2 and earlier) ------------*/
|
|
# 630 "/usr/avr/include/avr/io.h" 2 3
|
|
|
|
# 1 "/usr/avr/include/avr/version.h" 1 3
|
|
/* Copyright (c) 2005, Joerg Wunsch -*- c -*-
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/** \defgroup avr_version <avr/version.h>: avr-libc version macros
|
|
\code #include <avr/version.h> \endcode
|
|
|
|
This header file defines macros that contain version numbers and
|
|
strings describing the current version of avr-libc.
|
|
|
|
The version number itself basically consists of three pieces that
|
|
are separated by a dot: the major number, the minor number, and
|
|
the revision number. For development versions (which use an odd
|
|
minor number), the string representation additionally gets the
|
|
date code (YYYYMMDD) appended.
|
|
|
|
This file will also be included by \c <avr/io.h>. That way,
|
|
portable tests can be implemented using \c <avr/io.h> that can be
|
|
used in code that wants to remain backwards-compatible to library
|
|
versions prior to the date when the library version API had been
|
|
added, as referenced but undefined C preprocessor macros
|
|
automatically evaluate to 0.
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \ingroup avr_version
|
|
String literal representation of the current library version. */
|
|
|
|
|
|
/** \ingroup avr_version
|
|
Numerical representation of the current library version.
|
|
|
|
In the numerical representation, the major number is multiplied by
|
|
10000, the minor number by 100, and all three parts are then
|
|
added. It is intented to provide a monotonically increasing
|
|
numerical value that can easily be used in numerical checks.
|
|
*/
|
|
|
|
|
|
/** \ingroup avr_version
|
|
String literal representation of the release date. */
|
|
|
|
|
|
/** \ingroup avr_version
|
|
Numerical representation of the release date. */
|
|
|
|
|
|
/** \ingroup avr_version
|
|
Library major version number. */
|
|
|
|
|
|
/** \ingroup avr_version
|
|
Library minor version number. */
|
|
|
|
|
|
/** \ingroup avr_version
|
|
Library revision number. */
|
|
# 632 "/usr/avr/include/avr/io.h" 2 3
|
|
|
|
|
|
|
|
|
|
|
|
/* Include fuse.h after individual IO header files. */
|
|
# 1 "/usr/avr/include/avr/fuse.h" 1 3
|
|
/* Copyright (c) 2007, 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:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/* avr/fuse.h - Fuse API */
|
|
|
|
|
|
|
|
|
|
/* This file must be explicitly included by <avr/io.h>. */
|
|
|
|
|
|
|
|
|
|
|
|
/** \file */
|
|
/** \defgroup avr_fuse <avr/fuse.h>: Fuse Support
|
|
|
|
\par Introduction
|
|
|
|
The Fuse API allows a user to specify the fuse settings for the specific
|
|
AVR device they are compiling for. These fuse settings will be placed
|
|
in a special section in the ELF output file, after linking.
|
|
|
|
Programming tools can take advantage of the fuse information embedded in
|
|
the ELF file, by extracting this information and determining if the fuses
|
|
need to be programmed before programming the Flash and EEPROM memories.
|
|
This also allows a single ELF file to contain all the
|
|
information needed to program an AVR.
|
|
|
|
To use the Fuse API, include the <avr/io.h> header file, which in turn
|
|
automatically includes the individual I/O header file and the <avr/fuse.h>
|
|
file. These other two files provides everything necessary to set the AVR
|
|
fuses.
|
|
|
|
\par Fuse API
|
|
|
|
Each I/O header file must define the FUSE_MEMORY_SIZE macro which is
|
|
defined to the number of fuse bytes that exist in the AVR device.
|
|
|
|
A new type, __fuse_t, is defined as a structure. The number of fields in
|
|
this structure are determined by the number of fuse bytes in the
|
|
FUSE_MEMORY_SIZE macro.
|
|
|
|
If FUSE_MEMORY_SIZE == 1, there is only a single field: byte, of type
|
|
unsigned char.
|
|
|
|
If FUSE_MEMORY_SIZE == 2, there are two fields: low, and high, of type
|
|
unsigned char.
|
|
|
|
If FUSE_MEMORY_SIZE == 3, there are three fields: low, high, and extended,
|
|
of type unsigned char.
|
|
|
|
If FUSE_MEMORY_SIZE > 3, there is a single field: byte, which is an array
|
|
of unsigned char with the size of the array being FUSE_MEMORY_SIZE.
|
|
|
|
A convenience macro, FUSEMEM, is defined as a GCC attribute for a
|
|
custom-named section of ".fuse".
|
|
|
|
A convenience macro, FUSES, is defined that declares a variable, __fuse, of
|
|
type __fuse_t with the attribute defined by FUSEMEM. This variable
|
|
allows the end user to easily set the fuse data.
|
|
|
|
\note If a device-specific I/O header file has previously defined FUSEMEM,
|
|
then FUSEMEM is not redefined. If a device-specific I/O header file has
|
|
previously defined FUSES, then FUSES is not redefined.
|
|
|
|
Each AVR device I/O header file has a set of defined macros which specify the
|
|
actual fuse bits available on that device. The AVR fuses have inverted
|
|
values, logical 1 for an unprogrammed (disabled) bit and logical 0 for a
|
|
programmed (enabled) bit. The defined macros for each individual fuse
|
|
bit represent this in their definition by a bit-wise inversion of a mask.
|
|
For example, the FUSE_EESAVE fuse in the ATmega128 is defined as:
|
|
\code
|
|
#define FUSE_EESAVE ~_BV(3)
|
|
\endcode
|
|
\note The _BV macro creates a bit mask from a bit number. It is then
|
|
inverted to represent logical values for a fuse memory byte.
|
|
|
|
To combine the fuse bits macros together to represent a whole fuse byte,
|
|
use the bitwise AND operator, like so:
|
|
\code
|
|
(FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_EESAVE & FUSE_SPIEN & FUSE_JTAGEN)
|
|
\endcode
|
|
|
|
Each device I/O header file also defines macros that provide default values
|
|
for each fuse byte that is available. LFUSE_DEFAULT is defined for a Low
|
|
Fuse byte. HFUSE_DEFAULT is defined for a High Fuse byte. EFUSE_DEFAULT
|
|
is defined for an Extended Fuse byte.
|
|
|
|
If FUSE_MEMORY_SIZE > 3, then the I/O header file defines macros that
|
|
provide default values for each fuse byte like so:
|
|
FUSE0_DEFAULT
|
|
FUSE1_DEFAULT
|
|
FUSE2_DEFAULT
|
|
FUSE3_DEFAULT
|
|
FUSE4_DEFAULT
|
|
....
|
|
|
|
\par API Usage Example
|
|
|
|
Putting all of this together is easy. Using C99's designated initializers:
|
|
|
|
\code
|
|
#include <avr/io.h>
|
|
|
|
FUSES =
|
|
{
|
|
.low = LFUSE_DEFAULT,
|
|
.high = (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_EESAVE & FUSE_SPIEN & FUSE_JTAGEN),
|
|
.extended = EFUSE_DEFAULT,
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
}
|
|
\endcode
|
|
|
|
Or, using the variable directly instead of the FUSES macro,
|
|
|
|
\code
|
|
#include <avr/io.h>
|
|
|
|
__fuse_t __fuse __attribute__((section (".fuse"))) =
|
|
{
|
|
.low = LFUSE_DEFAULT,
|
|
.high = (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_EESAVE & FUSE_SPIEN & FUSE_JTAGEN),
|
|
.extended = EFUSE_DEFAULT,
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
}
|
|
\endcode
|
|
|
|
If you are compiling in C++, you cannot use the designated intializers so
|
|
you must do:
|
|
|
|
\code
|
|
#include <avr/io.h>
|
|
|
|
FUSES =
|
|
{
|
|
LFUSE_DEFAULT, // .low
|
|
(FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_EESAVE & FUSE_SPIEN & FUSE_JTAGEN), // .high
|
|
EFUSE_DEFAULT, // .extended
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
}
|
|
\endcode
|
|
|
|
|
|
However there are a number of caveats that you need to be aware of to
|
|
use this API properly.
|
|
|
|
Be sure to include <avr/io.h> to get all of the definitions for the API.
|
|
The FUSES macro defines a global variable to store the fuse data. This
|
|
variable is assigned to its own linker section. Assign the desired fuse
|
|
values immediately in the variable initialization.
|
|
|
|
The .fuse section in the ELF file will get its values from the initial
|
|
variable assignment ONLY. This means that you can NOT assign values to
|
|
this variable in functions and the new values will not be put into the
|
|
ELF .fuse section.
|
|
|
|
The global variable is declared in the FUSES macro has two leading
|
|
underscores, which means that it is reserved for the "implementation",
|
|
meaning the library, so it will not conflict with a user-named variable.
|
|
|
|
You must initialize ALL fields in the __fuse_t structure. This is because
|
|
the fuse bits in all bytes default to a logical 1, meaning unprogrammed.
|
|
Normal uninitialized data defaults to all locgial zeros. So it is vital that
|
|
all fuse bytes are initialized, even with default data. If they are not,
|
|
then the fuse bits may not programmed to the desired settings.
|
|
|
|
Be sure to have the -mmcu=<em>device</em> flag in your compile command line and
|
|
your linker command line to have the correct device selected and to have
|
|
the correct I/O header file included when you include <avr/io.h>.
|
|
|
|
You can print out the contents of the .fuse section in the ELF file by
|
|
using this command line:
|
|
\code
|
|
avr-objdump -s -j .fuse <ELF file>
|
|
\endcode
|
|
The section contents shows the address on the left, then the data going from
|
|
lower address to a higher address, left to right.
|
|
|
|
*/
|
|
# 239 "/usr/avr/include/avr/fuse.h" 3
|
|
typedef struct
|
|
{
|
|
unsigned char low;
|
|
unsigned char high;
|
|
unsigned char extended;
|
|
} __fuse_t;
|
|
# 639 "/usr/avr/include/avr/io.h" 2 3
|
|
|
|
/* Include lock.h after individual IO header files. */
|
|
# 1 "/usr/avr/include/avr/lock.h" 1 3
|
|
/* Copyright (c) 2007, 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:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/* avr/lock.h - Lock Bits API */
|
|
|
|
|
|
|
|
|
|
|
|
/** \file */
|
|
/** \defgroup avr_lock <avr/lock.h>: Lockbit Support
|
|
|
|
\par Introduction
|
|
|
|
The Lockbit API allows a user to specify the lockbit settings for the
|
|
specific AVR device they are compiling for. These lockbit settings will be
|
|
placed in a special section in the ELF output file, after linking.
|
|
|
|
Programming tools can take advantage of the lockbit information embedded in
|
|
the ELF file, by extracting this information and determining if the lockbits
|
|
need to be programmed after programming the Flash and EEPROM memories.
|
|
This also allows a single ELF file to contain all the
|
|
information needed to program an AVR.
|
|
|
|
To use the Lockbit API, include the <avr/io.h> header file, which in turn
|
|
automatically includes the individual I/O header file and the <avr/lock.h>
|
|
file. These other two files provides everything necessary to set the AVR
|
|
lockbits.
|
|
|
|
\par Lockbit API
|
|
|
|
Each I/O header file may define up to 3 macros that controls what kinds
|
|
of lockbits are available to the user.
|
|
|
|
If __LOCK_BITS_EXIST is defined, then two lock bits are available to the
|
|
user and 3 mode settings are defined for these two bits.
|
|
|
|
If __BOOT_LOCK_BITS_0_EXIST is defined, then the two BLB0 lock bits are
|
|
available to the user and 4 mode settings are defined for these two bits.
|
|
|
|
If __BOOT_LOCK_BITS_1_EXIST is defined, then the two BLB1 lock bits are
|
|
available to the user and 4 mode settings are defined for these two bits.
|
|
|
|
If __BOOT_LOCK_APPLICATION_TABLE_BITS_EXIST is defined then two lock bits
|
|
are available to set the locking mode for the Application Table Section
|
|
(which is used in the XMEGA family).
|
|
|
|
If __BOOT_LOCK_APPLICATION_BITS_EXIST is defined then two lock bits are
|
|
available to set the locking mode for the Application Section (which is used
|
|
in the XMEGA family).
|
|
|
|
If __BOOT_LOCK_BOOT_BITS_EXIST is defined then two lock bits are available
|
|
to set the locking mode for the Boot Loader Section (which is used in the
|
|
XMEGA family).
|
|
|
|
The AVR lockbit modes have inverted values, logical 1 for an unprogrammed
|
|
(disabled) bit and logical 0 for a programmed (enabled) bit. The defined
|
|
macros for each individual lock bit represent this in their definition by a
|
|
bit-wise inversion of a mask. For example, the LB_MODE_3 macro is defined
|
|
as:
|
|
\code
|
|
#define LB_MODE_3 (0xFC)
|
|
` \endcode
|
|
|
|
To combine the lockbit mode macros together to represent a whole byte,
|
|
use the bitwise AND operator, like so:
|
|
\code
|
|
(LB_MODE_3 & BLB0_MODE_2)
|
|
\endcode
|
|
|
|
<avr/lock.h> also defines a macro that provides a default lockbit value:
|
|
LOCKBITS_DEFAULT which is defined to be 0xFF.
|
|
|
|
See the AVR device specific datasheet for more details about these
|
|
lock bits and the available mode settings.
|
|
|
|
A convenience macro, LOCKMEM, is defined as a GCC attribute for a
|
|
custom-named section of ".lock".
|
|
|
|
A convenience macro, LOCKBITS, is defined that declares a variable, __lock,
|
|
of type unsigned char with the attribute defined by LOCKMEM. This variable
|
|
allows the end user to easily set the lockbit data.
|
|
|
|
\note If a device-specific I/O header file has previously defined LOCKMEM,
|
|
then LOCKMEM is not redefined. If a device-specific I/O header file has
|
|
previously defined LOCKBITS, then LOCKBITS is not redefined. LOCKBITS is
|
|
currently known to be defined in the I/O header files for the XMEGA devices.
|
|
|
|
\par API Usage Example
|
|
|
|
Putting all of this together is easy:
|
|
|
|
\code
|
|
#include <avr/io.h>
|
|
|
|
LOCKBITS = (LB_MODE_1 & BLB0_MODE_3 & BLB1_MODE_4);
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
}
|
|
\endcode
|
|
|
|
Or:
|
|
|
|
\code
|
|
#include <avr/io.h>
|
|
|
|
unsigned char __lock __attribute__((section (".lock"))) =
|
|
(LB_MODE_1 & BLB0_MODE_3 & BLB1_MODE_4);
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
}
|
|
\endcode
|
|
|
|
|
|
|
|
However there are a number of caveats that you need to be aware of to
|
|
use this API properly.
|
|
|
|
Be sure to include <avr/io.h> to get all of the definitions for the API.
|
|
The LOCKBITS macro defines a global variable to store the lockbit data. This
|
|
variable is assigned to its own linker section. Assign the desired lockbit
|
|
values immediately in the variable initialization.
|
|
|
|
The .lock section in the ELF file will get its values from the initial
|
|
variable assignment ONLY. This means that you can NOT assign values to
|
|
this variable in functions and the new values will not be put into the
|
|
ELF .lock section.
|
|
|
|
The global variable is declared in the LOCKBITS macro has two leading
|
|
underscores, which means that it is reserved for the "implementation",
|
|
meaning the library, so it will not conflict with a user-named variable.
|
|
|
|
You must initialize the lockbit variable to some meaningful value, even
|
|
if it is the default value. This is because the lockbits default to a
|
|
logical 1, meaning unprogrammed. Normal uninitialized data defaults to all
|
|
locgial zeros. So it is vital that all lockbits are initialized, even with
|
|
default data. If they are not, then the lockbits may not programmed to the
|
|
desired settings and can possibly put your device into an unrecoverable
|
|
state.
|
|
|
|
Be sure to have the -mmcu=<em>device</em> flag in your compile command line and
|
|
your linker command line to have the correct device selected and to have
|
|
the correct I/O header file included when you include <avr/io.h>.
|
|
|
|
You can print out the contents of the .lock section in the ELF file by
|
|
using this command line:
|
|
\code
|
|
avr-objdump -s -j .lock <ELF file>
|
|
\endcode
|
|
|
|
*/
|
|
# 197 "/usr/avr/include/avr/lock.h" 3
|
|
/* Lock Bit Modes */
|
|
# 642 "/usr/avr/include/avr/io.h" 2 3
|
|
# 3 "main.c" 2
|
|
# 1 "/usr/avr/include/util/delay.h" 1 3
|
|
/* Copyright (c) 2002, Marek Michalkiewicz
|
|
Copyright (c) 2004,2005,2007 Joerg Wunsch
|
|
Copyright (c) 2007 Florin-Viorel Petrov
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
# 44 "/usr/avr/include/util/delay.h" 3
|
|
# 1 "/usr/avr/include/inttypes.h" 1 3
|
|
/* Copyright (c) 2004,2005,2007,2012 Joerg Wunsch
|
|
Copyright (c) 2005, Carlos Lamas
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
# 45 "/usr/avr/include/util/delay.h" 2 3
|
|
# 1 "/usr/avr/include/util/delay_basic.h" 1 3
|
|
/* Copyright (c) 2002, Marek Michalkiewicz
|
|
Copyright (c) 2007 Joerg Wunsch
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
# 1 "/usr/avr/include/inttypes.h" 1 3
|
|
/* Copyright (c) 2004,2005,2007,2012 Joerg Wunsch
|
|
Copyright (c) 2005, Carlos Lamas
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
# 38 "/usr/avr/include/util/delay_basic.h" 2 3
|
|
|
|
|
|
static __inline__ void _delay_loop_1(uint8_t __count) __attribute__((__always_inline__));
|
|
static __inline__ void _delay_loop_2(uint16_t __count) __attribute__((__always_inline__));
|
|
|
|
|
|
/** \file */
|
|
/** \defgroup util_delay_basic <util/delay_basic.h>: Basic busy-wait delay loops
|
|
\code
|
|
#include <util/delay_basic.h>
|
|
\endcode
|
|
|
|
The functions in this header file implement simple delay loops
|
|
that perform a busy-waiting. They are typically used to
|
|
facilitate short delays in the program execution. They are
|
|
implemented as count-down loops with a well-known CPU cycle
|
|
count per loop iteration. As such, no other processing can
|
|
occur simultaneously. It should be kept in mind that the
|
|
functions described here do not disable interrupts.
|
|
|
|
In general, for long delays, the use of hardware timers is
|
|
much preferrable, as they free the CPU, and allow for
|
|
concurrent processing of other events while the timer is
|
|
running. However, in particular for very short delays, the
|
|
overhead of setting up a hardware timer is too much compared
|
|
to the overall delay time.
|
|
|
|
Two inline functions are provided for the actual delay algorithms.
|
|
|
|
*/
|
|
|
|
/** \ingroup util_delay_basic
|
|
|
|
Delay loop using an 8-bit counter \c __count, so up to 256
|
|
iterations are possible. (The value 256 would have to be passed
|
|
as 0.) The loop executes three CPU cycles per iteration, not
|
|
including the overhead the compiler needs to setup the counter
|
|
register.
|
|
|
|
Thus, at a CPU speed of 1 MHz, delays of up to 768 microseconds
|
|
can be achieved.
|
|
*/
|
|
void
|
|
_delay_loop_1(uint8_t __count)
|
|
{
|
|
__asm__ volatile (
|
|
"1: dec %0" "\n\t"
|
|
"brne 1b"
|
|
: "=r" (__count)
|
|
: "0" (__count)
|
|
);
|
|
}
|
|
|
|
/** \ingroup util_delay_basic
|
|
|
|
Delay loop using a 16-bit counter \c __count, so up to 65536
|
|
iterations are possible. (The value 65536 would have to be
|
|
passed as 0.) The loop executes four CPU cycles per iteration,
|
|
not including the overhead the compiler requires to setup the
|
|
counter register pair.
|
|
|
|
Thus, at a CPU speed of 1 MHz, delays of up to about 262.1
|
|
milliseconds can be achieved.
|
|
*/
|
|
void
|
|
_delay_loop_2(uint16_t __count)
|
|
{
|
|
__asm__ volatile (
|
|
"1: sbiw %0,1" "\n\t"
|
|
"brne 1b"
|
|
: "=w" (__count)
|
|
: "0" (__count)
|
|
);
|
|
}
|
|
# 46 "/usr/avr/include/util/delay.h" 2 3
|
|
# 1 "/usr/avr/include/math.h" 1 3
|
|
/* Copyright (c) 2002,2007-2009 Michael Stumpf
|
|
|
|
Portions of documentation Copyright (c) 1990 - 1994
|
|
The Regents of the University of California.
|
|
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/*
|
|
math.h - mathematical functions
|
|
|
|
Author : Michael Stumpf
|
|
Michael.Stumpf@t-online.de
|
|
|
|
__ATTR_CONST__ added by marekm@linux.org.pl for functions
|
|
that "do not examine any values except their arguments, and have
|
|
no effects except the return value", for better optimization by gcc.
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file */
|
|
/** \defgroup avr_math <math.h>: Mathematics
|
|
\code #include <math.h> \endcode
|
|
|
|
This header file declares basic mathematics constants and
|
|
functions.
|
|
|
|
\par Notes:
|
|
- In order to access the functions declared herein, it is usually
|
|
also required to additionally link against the library \c libm.a.
|
|
See also the related \ref faq_libm "FAQ entry".
|
|
- Math functions do not raise exceptions and do not change the
|
|
\c errno variable. Therefore the majority of them are declared
|
|
with const attribute, for better optimization by GCC. */
|
|
|
|
|
|
/** \ingroup avr_math */
|
|
/*@{*/
|
|
|
|
/** The constant \a e. */
|
|
|
|
|
|
/** The logarithm of the \a e to base 2. */
|
|
|
|
|
|
/** The logarithm of the \a e to base 10. */
|
|
|
|
|
|
/** The natural logarithm of the 2. */
|
|
|
|
|
|
/** The natural logarithm of the 10. */
|
|
|
|
|
|
/** The constant \a pi. */
|
|
|
|
|
|
/** The constant \a pi/2. */
|
|
|
|
|
|
/** The constant \a pi/4. */
|
|
|
|
|
|
/** The constant \a 1/pi. */
|
|
|
|
|
|
/** The constant \a 2/pi. */
|
|
|
|
|
|
/** The constant \a 2/sqrt(pi). */
|
|
|
|
|
|
/** The square root of 2. */
|
|
|
|
|
|
/** The constant \a 1/sqrt(2). */
|
|
|
|
|
|
/** NAN constant. */
|
|
|
|
|
|
/** INFINITY constant. */
|
|
# 124 "/usr/avr/include/math.h" 3
|
|
/**
|
|
The cos() function returns the cosine of \a __x, measured in radians.
|
|
*/
|
|
extern double cos(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The sin() function returns the sine of \a __x, measured in radians.
|
|
*/
|
|
extern double sin(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The tan() function returns the tangent of \a __x, measured in radians.
|
|
*/
|
|
extern double tan(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The fabs() function computes the absolute value of a floating-point
|
|
number \a __x.
|
|
*/
|
|
extern double fabs(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The function fmod() returns the floating-point remainder of <em>__x /
|
|
__y</em>.
|
|
*/
|
|
extern double fmod(double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The modf() function breaks the argument \a __x into integral and
|
|
fractional parts, each of which has the same sign as the argument.
|
|
It stores the integral part as a double in the object pointed to by
|
|
\a __iptr.
|
|
|
|
The modf() function returns the signed fractional part of \a __x.
|
|
|
|
\note This implementation skips writing by zero pointer. However,
|
|
the GCC 4.3 can replace this function with inline code that does not
|
|
permit to use NULL address for the avoiding of storing.
|
|
*/
|
|
extern double modf(double __x, double *__iptr);
|
|
|
|
/** An alias for modf(). */
|
|
extern float modff (float __x, float *__iptr);
|
|
|
|
/**
|
|
The sqrt() function returns the non-negative square root of \a __x.
|
|
*/
|
|
extern double sqrt(double __x) __attribute__((__const__));
|
|
|
|
/** An alias for sqrt(). */
|
|
extern float sqrtf (float) __attribute__((__const__));
|
|
|
|
/**
|
|
The cbrt() function returns the cube root of \a __x.
|
|
*/
|
|
extern double cbrt(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The hypot() function returns <em>sqrt(__x*__x + __y*__y)</em>. This
|
|
is the length of the hypotenuse of a right triangle with sides of
|
|
length \a __x and \a __y, or the distance of the point (\a __x, \a
|
|
__y) from the origin. Using this function instead of the direct
|
|
formula is wise, since the error is much smaller. No underflow with
|
|
small \a __x and \a __y. No overflow if result is in range.
|
|
*/
|
|
extern double hypot (double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The function square() returns <em>__x * __x</em>.
|
|
|
|
\note This function does not belong to the C standard definition.
|
|
*/
|
|
extern double square(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The floor() function returns the largest integral value less than or
|
|
equal to \a __x, expressed as a floating-point number.
|
|
*/
|
|
extern double floor(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The ceil() function returns the smallest integral value greater than
|
|
or equal to \a __x, expressed as a floating-point number.
|
|
*/
|
|
extern double ceil(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The frexp() function breaks a floating-point number into a normalized
|
|
fraction and an integral power of 2. It stores the integer in the \c
|
|
int object pointed to by \a __pexp.
|
|
|
|
If \a __x is a normal float point number, the frexp() function
|
|
returns the value \c v, such that \c v has a magnitude in the
|
|
interval [1/2, 1) or zero, and \a __x equals \c v times 2 raised to
|
|
the power \a __pexp. If \a __x is zero, both parts of the result are
|
|
zero. If \a __x is not a finite number, the frexp() returns \a __x as
|
|
is and stores 0 by \a __pexp.
|
|
|
|
\note This implementation permits a zero pointer as a directive to
|
|
skip a storing the exponent.
|
|
*/
|
|
extern double frexp(double __x, int *__pexp);
|
|
|
|
|
|
/**
|
|
The ldexp() function multiplies a floating-point number by an integral
|
|
power of 2. It returns the value of \a __x times 2 raised to the power
|
|
\a __exp.
|
|
*/
|
|
extern double ldexp(double __x, int __exp) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The exp() function returns the exponential value of \a __x.
|
|
*/
|
|
extern double exp(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The cosh() function returns the hyperbolic cosine of \a __x.
|
|
*/
|
|
extern double cosh(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The sinh() function returns the hyperbolic sine of \a __x.
|
|
*/
|
|
extern double sinh(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The tanh() function returns the hyperbolic tangent of \a __x.
|
|
*/
|
|
extern double tanh(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The acos() function computes the principal value of the arc cosine of
|
|
\a __x. The returned value is in the range [0, pi] radians. A domain
|
|
error occurs for arguments not in the range [-1, +1].
|
|
*/
|
|
extern double acos(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The asin() function computes the principal value of the arc sine of
|
|
\a __x. The returned value is in the range [-pi/2, pi/2] radians. A
|
|
domain error occurs for arguments not in the range [-1, +1].
|
|
*/
|
|
extern double asin(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The atan() function computes the principal value of the arc tangent
|
|
of \a __x. The returned value is in the range [-pi/2, pi/2] radians.
|
|
*/
|
|
extern double atan(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The atan2() function computes the principal value of the arc tangent
|
|
of <em>__y / __x</em>, using the signs of both arguments to determine
|
|
the quadrant of the return value. The returned value is in the range
|
|
[-pi, +pi] radians.
|
|
*/
|
|
extern double atan2(double __y, double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The log() function returns the natural logarithm of argument \a __x.
|
|
*/
|
|
extern double log(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The log10() function returns the logarithm of argument \a __x to base 10.
|
|
*/
|
|
extern double log10(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The function pow() returns the value of \a __x to the exponent \a __y.
|
|
*/
|
|
extern double pow(double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The function isnan() returns 1 if the argument \a __x represents a
|
|
"not-a-number" (NaN) object, otherwise 0.
|
|
*/
|
|
extern int isnan(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The function isinf() returns 1 if the argument \a __x is positive
|
|
infinity, -1 if \a __x is negative infinity, and 0 otherwise.
|
|
|
|
\note The GCC 4.3 can replace this function with inline code that
|
|
returns the 1 value for both infinities (gcc bug #35509).
|
|
*/
|
|
extern int isinf(double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The isfinite() function returns a nonzero value if \a __x is finite:
|
|
not plus or minus infinity, and not NaN.
|
|
*/
|
|
__attribute__((__const__)) static inline int isfinite (double __x)
|
|
{
|
|
unsigned char __exp;
|
|
__asm__ (
|
|
"mov %0, %C1 \n\t"
|
|
"lsl %0 \n\t"
|
|
"mov %0, %D1 \n\t"
|
|
"rol %0 "
|
|
: "=r" (__exp)
|
|
: "r" (__x) );
|
|
return __exp != 0xff;
|
|
}
|
|
|
|
|
|
/**
|
|
The copysign() function returns \a __x but with the sign of \a __y.
|
|
They work even if \a __x or \a __y are NaN or zero.
|
|
*/
|
|
__attribute__((__const__)) static inline double copysign (double __x, double __y)
|
|
{
|
|
__asm__ (
|
|
"bst %D2, 7 \n\t"
|
|
"bld %D0, 7 "
|
|
: "=r" (__x)
|
|
: "0" (__x), "r" (__y) );
|
|
return __x;
|
|
}
|
|
|
|
|
|
/**
|
|
The signbit() function returns a nonzero value if the value of \a __x
|
|
has its sign bit set. This is not the same as `\a __x < 0.0',
|
|
because IEEE 754 floating point allows zero to be signed. The
|
|
comparison `-0.0 < 0.0' is false, but `signbit (-0.0)' will return a
|
|
nonzero value.
|
|
*/
|
|
extern int signbit (double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The fdim() function returns <em>max(__x - __y, 0)</em>. If \a __x or
|
|
\a __y or both are NaN, NaN is returned.
|
|
*/
|
|
extern double fdim (double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The fma() function performs floating-point multiply-add. This is the
|
|
operation <em>(__x * __y) + __z</em>, but the intermediate result is
|
|
not rounded to the destination type. This can sometimes improve the
|
|
precision of a calculation.
|
|
*/
|
|
extern double fma (double __x, double __y, double __z) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The fmax() function returns the greater of the two values \a __x and
|
|
\a __y. If an argument is NaN, the other argument is returned. If
|
|
both arguments are NaN, NaN is returned.
|
|
*/
|
|
extern double fmax (double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The fmin() function returns the lesser of the two values \a __x and
|
|
\a __y. If an argument is NaN, the other argument is returned. If
|
|
both arguments are NaN, NaN is returned.
|
|
*/
|
|
extern double fmin (double __x, double __y) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The trunc() function rounds \a __x to the nearest integer not larger
|
|
in absolute value.
|
|
*/
|
|
extern double trunc (double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The round() function rounds \a __x to the nearest integer, but rounds
|
|
halfway cases away from zero (instead of to the nearest even integer).
|
|
Overflow is impossible.
|
|
|
|
\return The rounded value. If \a __x is an integral or infinite, \a
|
|
__x itself is returned. If \a __x is \c NaN, then \c NaN is returned.
|
|
*/
|
|
extern double round (double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The lround() function rounds \a __x to the nearest integer, but rounds
|
|
halfway cases away from zero (instead of to the nearest even integer).
|
|
This function is similar to round() function, but it differs in type of
|
|
return value and in that an overflow is possible.
|
|
|
|
\return The rounded long integer value. If \a __x is not a finite number
|
|
or an overflow was, this realization returns the \c LONG_MIN value
|
|
(0x80000000).
|
|
*/
|
|
extern long lround (double __x) __attribute__((__const__));
|
|
|
|
|
|
/**
|
|
The lrint() function rounds \a __x to the nearest integer, rounding the
|
|
halfway cases to the even integer direction. (That is both 1.5 and 2.5
|
|
values are rounded to 2). This function is similar to rint() function,
|
|
but it differs in type of return value and in that an overflow is
|
|
possible.
|
|
|
|
\return The rounded long integer value. If \a __x is not a finite
|
|
number or an overflow was, this realization returns the \c LONG_MIN
|
|
value (0x80000000).
|
|
*/
|
|
extern long lrint (double __x) __attribute__((__const__));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*@}*/
|
|
# 47 "/usr/avr/include/util/delay.h" 2 3
|
|
|
|
/** \file */
|
|
/** \defgroup util_delay <util/delay.h>: Convenience functions for busy-wait delay loops
|
|
\code
|
|
#define F_CPU 1000000UL // 1 MHz
|
|
//#define F_CPU 14.7456E6
|
|
#include <util/delay.h>
|
|
\endcode
|
|
|
|
\note As an alternative method, it is possible to pass the
|
|
F_CPU macro down to the compiler from the Makefile.
|
|
Obviously, in that case, no \c \#define statement should be
|
|
used.
|
|
|
|
The functions in this header file are wrappers around the basic
|
|
busy-wait functions from <util/delay_basic.h>. They are meant as
|
|
convenience functions where actual time values can be specified
|
|
rather than a number of cycles to wait for. The idea behind is
|
|
that compile-time constant expressions will be eliminated by
|
|
compiler optimization so floating-point expressions can be used
|
|
to calculate the number of delay cycles needed based on the CPU
|
|
frequency passed by the macro F_CPU.
|
|
|
|
\note In order for these functions to work as intended, compiler
|
|
optimizations <em>must</em> be enabled, and the delay time
|
|
<em>must</em> be an expression that is a known constant at
|
|
compile-time. If these requirements are not met, the resulting
|
|
delay will be much longer (and basically unpredictable), and
|
|
applications that otherwise do not use floating-point calculations
|
|
will experience severe code bloat by the floating-point library
|
|
routines linked into the application.
|
|
|
|
The functions available allow the specification of microsecond, and
|
|
millisecond delays directly, using the application-supplied macro
|
|
F_CPU as the CPU clock frequency (in Hertz).
|
|
|
|
*/
|
|
|
|
|
|
static __inline__ void _delay_us(double __us) __attribute__((__always_inline__));
|
|
static __inline__ void _delay_ms(double __ms) __attribute__((__always_inline__));
|
|
# 118 "/usr/avr/include/util/delay.h" 3
|
|
# 1 "/usr/avr/include/math.h" 1 3
|
|
/* Copyright (c) 2002,2007-2009 Michael Stumpf
|
|
|
|
Portions of documentation Copyright (c) 1990 - 1994
|
|
The Regents of the University of California.
|
|
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* 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.
|
|
|
|
* Neither the name of the copyright holders nor the names of
|
|
contributors may be used to endorse or promote products derived
|
|
from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
|
|
|
/* $Id$ */
|
|
|
|
/*
|
|
math.h - mathematical functions
|
|
|
|
Author : Michael Stumpf
|
|
Michael.Stumpf@t-online.de
|
|
|
|
__ATTR_CONST__ added by marekm@linux.org.pl for functions
|
|
that "do not examine any values except their arguments, and have
|
|
no effects except the return value", for better optimization by gcc.
|
|
*/
|
|
# 119 "/usr/avr/include/util/delay.h" 2 3
|
|
|
|
|
|
/**
|
|
\ingroup util_delay
|
|
|
|
Perform a delay of \c __ms milliseconds, using _delay_loop_2().
|
|
|
|
The macro F_CPU is supposed to be defined to a
|
|
constant defining the CPU clock frequency (in Hertz).
|
|
|
|
The maximal possible delay is 262.14 ms / F_CPU in MHz.
|
|
|
|
When the user request delay which exceed the maximum possible one,
|
|
_delay_ms() provides a decreased resolution functionality. In this
|
|
mode _delay_ms() will work with a resolution of 1/10 ms, providing
|
|
delays up to 6.5535 seconds (independent from CPU frequency). The
|
|
user will not be informed about decreased resolution.
|
|
|
|
If the avr-gcc toolchain has __builtin_avr_delay_cycles()
|
|
support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For
|
|
values greater than the maximal possible delay, overflows results in
|
|
no delay i.e., 0ms.
|
|
|
|
Conversion of \c __ms into clock cycles may not always result in
|
|
integer. By default, the clock cycles rounded up to next
|
|
integer. This ensures that the user gets at least \c __ms
|
|
microseconds of delay.
|
|
|
|
Alternatively, by defining the macro \c __DELAY_ROUND_DOWN__, or
|
|
\c __DELAY_ROUND_CLOSEST__, before including this header file, the
|
|
algorithm can be made to round down, or round to closest integer,
|
|
respectively.
|
|
|
|
\note
|
|
|
|
The implementation of _delay_ms() based on
|
|
__builtin_avr_delay_cycles() is not backward compatible with older
|
|
implementations. In order to get functionality backward compatible
|
|
with previous versions, the macro \c "__DELAY_BACKWARD_COMPATIBLE__"
|
|
must be defined before including this header file. Also, the
|
|
backward compatible algorithm will be chosen if the code is
|
|
compiled in a <em>freestanding environment</em> (GCC option
|
|
\c -ffreestanding), as the math functions required for rounding are
|
|
not available to the compiler then.
|
|
|
|
*/
|
|
void
|
|
_delay_ms(double __ms)
|
|
{
|
|
double __tmp ;
|
|
|
|
|
|
|
|
uint32_t __ticks_dc;
|
|
extern void __builtin_avr_delay_cycles(unsigned long);
|
|
__tmp = ((
|
|
# 174 "/usr/avr/include/util/delay.h"
|
|
16000000UL /* CPU Frequency*/
|
|
# 174 "/usr/avr/include/util/delay.h" 3
|
|
) / 1e3) * __ms;
|
|
# 183 "/usr/avr/include/util/delay.h" 3
|
|
//round up by default
|
|
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
|
|
|
|
|
__builtin_avr_delay_cycles(__ticks_dc);
|
|
# 210 "/usr/avr/include/util/delay.h" 3
|
|
}
|
|
|
|
/**
|
|
\ingroup util_delay
|
|
|
|
Perform a delay of \c __us microseconds, using _delay_loop_1().
|
|
|
|
The macro F_CPU is supposed to be defined to a
|
|
constant defining the CPU clock frequency (in Hertz).
|
|
|
|
The maximal possible delay is 768 us / F_CPU in MHz.
|
|
|
|
If the user requests a delay greater than the maximal possible one,
|
|
_delay_us() will automatically call _delay_ms() instead. The user
|
|
will not be informed about this case.
|
|
|
|
If the avr-gcc toolchain has __builtin_avr_delay_cycles()
|
|
support, maximal possible delay is 4294967.295 us/ F_CPU in MHz. For
|
|
values greater than the maximal possible delay, overflow results in
|
|
no delay i.e., 0us.
|
|
|
|
Conversion of \c __us into clock cycles may not always result in
|
|
integer. By default, the clock cycles rounded up to next
|
|
integer. This ensures that the user gets at least \c __us
|
|
microseconds of delay.
|
|
|
|
Alternatively, by defining the macro \c __DELAY_ROUND_DOWN__, or
|
|
\c __DELAY_ROUND_CLOSEST__, before including this header file, the
|
|
algorithm can be made to round down, or round to closest integer,
|
|
respectively.
|
|
|
|
\note
|
|
|
|
The implementation of _delay_ms() based on
|
|
__builtin_avr_delay_cycles() is not backward compatible with older
|
|
implementations. In order to get functionality backward compatible
|
|
with previous versions, the macro \c __DELAY_BACKWARD_COMPATIBLE__
|
|
must be defined before including this header file. Also, the
|
|
backward compatible algorithm will be chosen if the code is
|
|
compiled in a <em>freestanding environment</em> (GCC option
|
|
\c -ffreestanding), as the math functions required for rounding are
|
|
not available to the compiler then.
|
|
|
|
*/
|
|
void
|
|
_delay_us(double __us)
|
|
{
|
|
double __tmp ;
|
|
|
|
|
|
|
|
uint32_t __ticks_dc;
|
|
extern void __builtin_avr_delay_cycles(unsigned long);
|
|
__tmp = ((
|
|
# 263 "/usr/avr/include/util/delay.h"
|
|
16000000UL /* CPU Frequency*/
|
|
# 263 "/usr/avr/include/util/delay.h" 3
|
|
) / 1e6) * __us;
|
|
# 272 "/usr/avr/include/util/delay.h" 3
|
|
//round up by default
|
|
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
|
|
|
|
|
__builtin_avr_delay_cycles(__ticks_dc);
|
|
# 299 "/usr/avr/include/util/delay.h" 3
|
|
}
|
|
# 4 "main.c" 2
|
|
|
|
|
|
# 5 "main.c"
|
|
int main(void) {
|
|
while (1) {
|
|
}
|
|
}
|