AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Reference FAQ Example Projects

ina90.h

01	1 Copyright (c) 2002,2004 Marek Michalkiewicz
	022All rights reserved.
	033
044Redistribution and use in source and binary forms, with or without
055modification, are permitted provided that the following conditions are met: 066 077* Redistributions of source code must retain the above copyright 088notice, this list of conditions and the following disclaimer. 099 1010* Redistributions in binary form must reproduce the above copyright 1111notice, this list of conditions and the following disclaimer in 1212the documentation and/or other materials provided with the 1313distribution. 1414 1515* Neither the name of the copyright holders nor the names of 1616contributors may be used to endorse or promote products derived 1717from this software without specific prior written permission. 1818 1919THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2020AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2121IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2222ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2323LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2424CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2525SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2626INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2727CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2828ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2929POSSIBILITY OF SUCH DAMAGE. */ 3030 3131/* $Id: ina90.h 932 2005-11-05 21:22:33Z joerg_wunsch $ */ 3232/* copied from: Id: avr/ina90.h,v 1.8 2004/11/09 19:16:09 arcanum Exp */ 3333 3434/* 3535ina90.h 3636 3737Contributors: 3838Created by Marek Michalkiewicz <marekm@linux.org.pl> 3939*/ 4040 4141/** 4242\defgroup compat_ina90 <compat/ina90.h>: Compatibility with IAR EWB 3.x 4343 4444\code #include <compat/ina90.h> \endcode 4545 4646This is an attempt to provide some compatibility with 4747header files that come with IAR C, to make porting applications 4848between different compilers easier. No 100% compatibility though. 4949 5050\note For actual documentation, please see the IAR manual. 5151*/ 5252 5353#ifndef _INA90_H_ 5454#define _INA90_H_ 1 5555 5656#define _CLI() do { __asm__ __volatile__ ("cli"); } while (0) 5757#define _SEI() do { __asm__ __volatile__ ("sei"); } while (0) 5858#define _NOP() do { __asm__ __volatile__ ("nop"); } while (0) 5959#define _WDR() do { __asm__ __volatile__ ("wdr"); } while (0) 6060#define _SLEEP() do { __asm__ __volatile__ ("sleep"); } while (0) 6161#define _OPC(op) do { __asm__ __volatile__ (".word %0" : : "n" (op)); } while (0) 6262 6363/* _LPM, _ELPM */ 6464#include <avr/pgmspace.h> 6565#define _LPM(x) do { __LPM(x); } while (0) 6666#define _ELPM(x) do { __ELPM(x); } while (0) 6767 6868/* _EEGET, _EEPUT */ 6969#include <avr/eeprom.h> 7070 7171#define input(port) (port) 7272#define output(port, val) do { (port) = (val); } while (0) 7373 7474#define __inp_blk__(port, addr, cnt, op) do { \ 7575unsigned char __i = (cnt); \ 7676unsigned char *__addr = (addr); \ 7777while (__i) { \ 7878*(__addr op) = input(port); \ 7979__i--; \ 8080} \ 8181} while (0) 8282 8383#define input_block_inc(port, addr, cnt) __inp_blk__(port, addr, cnt, ++) 8484#define input_block_dec(port, addr, cnt) __inp_blk__(port, addr, cnt, --) 8585 8686#define __out_blk__(port, addr, cnt, op) do { \ 8787unsigned char __i = (cnt); \ 8888const unsigned char *__addr = (addr); \ 8989while (__i) { \ 9090output(port, *(__addr op)); \ 9191__i--; \ 9292} \ 9393} while (0) 9494 9595#define output_block_inc(port, addr, cnt) __out_blk__(port, addr, cnt, ++) 9696#define output_block_dec(port, addr, cnt) __out_blk__(port, addr, cnt, --) 9797 9898#endif 9999

pgmspace.h