00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVRLIBDEFS_H
00023 #define AVRLIBDEFS_H
00024
00025
00026
00027 #ifndef outb
00028 #define outb(addr, data) addr = (data)
00029 #endif
00030 #ifndef inb
00031 #define inb(addr) (addr)
00032 #endif
00033 #ifndef BV
00034 #define BV(bit) (1<<(bit))
00035 #endif
00036 #ifndef cbi
00037 #define cbi(reg,bit) reg &= ~(BV(bit))
00038 #endif
00039 #ifndef sbi
00040 #define sbi(reg,bit) reg |= (BV(bit))
00041 #endif
00042 #ifndef cli
00043 #define cli() __asm__ __volatile__ ("cli" ::)
00044 #endif
00045 #ifndef sei
00046 #define sei() __asm__ __volatile__ ("sei" ::)
00047 #endif
00048
00049
00050
00051 #ifdef __AVR_ATmega128__
00052
00053
00054
00055 #ifndef PD0
00056 #include "port128.h"
00057 #endif
00058 #endif
00059
00060
00061
00062
00063 #define GNUC_PACKED __attribute__((packed))
00064
00065
00066 #define DDR(x) ((x)-1) // address of data direction register of port x
00067 #define PIN(x) ((x)-2) // address of input register of port x
00068
00069
00070 #define MIN(a,b) ((a<b)?(a):(b))
00071 #define MAX(a,b) ((a>b)?(a):(b))
00072 #define ABS(x) ((x>0)?(x):(-x))
00073
00074
00075 #define PI 3.14159265359
00076
00077 #endif