$treeview $search $mathjax $extrastylesheet
avr-libc  2.0.0
$projectbrief
$projectbrief
$searchbox

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

ina90.h

00001 /* Copyright (c) 2002,2004 Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009 
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in
00012      the documentation and/or other materials provided with the
00013      distribution.
00014 
00015    * Neither the name of the copyright holders nor the names of
00016      contributors may be used to endorse or promote products derived
00017      from this software without specific prior written permission.
00018 
00019   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029   POSSIBILITY OF SUCH DAMAGE. */
00030 
00031 /* $Id$ */
00032 /* copied from: Id: avr/ina90.h,v 1.8 2004/11/09 19:16:09 arcanum Exp */
00033 
00034 /*
00035    ina90.h
00036 
00037    Contributors:
00038      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00039  */
00040 
00041 /**
00042    \defgroup compat_ina90 <compat/ina90.h>: Compatibility with IAR EWB 3.x
00043 
00044    \code #include <compat/ina90.h> \endcode
00045 
00046    This is an attempt to provide some compatibility with
00047    header files that come with IAR C, to make porting applications
00048    between different compilers easier.  No 100% compatibility though.
00049 
00050    \note For actual documentation, please see the IAR manual.
00051  */
00052 
00053 #ifndef _INA90_H_
00054 #define _INA90_H_ 1
00055 
00056 #define _CLI() do { __asm__ __volatile__ ("cli"); } while (0)
00057 #define _SEI() do { __asm__ __volatile__ ("sei"); } while (0)
00058 #define _NOP() do { __asm__ __volatile__ ("nop"); } while (0)
00059 #define _WDR() do { __asm__ __volatile__ ("wdr"); } while (0)
00060 #define _SLEEP() do { __asm__ __volatile__ ("sleep"); } while (0)
00061 #define _OPC(op) do { __asm__ __volatile__ (".word %0" : : "n" (op)); } while (0)
00062 
00063 /* _LPM, _ELPM */
00064 #include <avr/pgmspace.h>
00065 #define _LPM(x) do { __LPM(x); } while (0)
00066 #define _ELPM(x) do { __ELPM(x); } while (0)
00067 
00068 /* _EEGET, _EEPUT */
00069 #include <avr/eeprom.h>
00070 
00071 #define input(port) (port)
00072 #define output(port, val) do { (port) = (val); } while (0)
00073 
00074 #define __inp_blk__(port, addr, cnt, op) do {   \
00075     unsigned char __i = (cnt);      \
00076     unsigned char *__addr = (addr);     \
00077     while (__i) {               \
00078         *(__addr op) = input(port); \
00079         __i--;              \
00080     }                   \
00081  } while (0)
00082 
00083 #define input_block_inc(port, addr, cnt) __inp_blk__(port, addr, cnt, ++)
00084 #define input_block_dec(port, addr, cnt) __inp_blk__(port, addr, cnt, --)
00085 
00086 #define __out_blk__(port, addr, cnt, op) do {   \
00087     unsigned char __i = (cnt);      \
00088     const unsigned char *__addr = (addr);   \
00089     while (__i) {               \
00090         output(port, *(__addr op)); \
00091         __i--;              \
00092     }                   \
00093  } while (0)
00094 
00095 #define output_block_inc(port, addr, cnt) __out_blk__(port, addr, cnt, ++)
00096 #define output_block_dec(port, addr, cnt) __out_blk__(port, addr, cnt, --)
00097 
00098 #endif
00099 
 All Data Structures Files Functions Variables Typedefs Enumerations Defines