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 outw
00034 #define outw(addr, data) addr = (data)
00035 #endif
00036 #ifndef inw
00037 #define inw(addr) (addr)
00038 #endif
00039 #ifndef BV
00040 #define BV(bit) (1<<(bit))
00041 #endif
00042 #ifndef cbi
00043 #define cbi(reg,bit) reg &= ~(BV(bit))
00044 #endif
00045 #ifndef sbi
00046 #define sbi(reg,bit) reg |= (BV(bit))
00047 #endif
00048 #ifndef cli
00049 #define cli() __asm__ __volatile__ ("cli" ::)
00050 #endif
00051 #ifndef sei
00052 #define sei() __asm__ __volatile__ ("sei" ::)
00053 #endif
00054
00055
00056
00057 #ifdef __AVR_ATmega128__
00058
00059
00060
00061 #ifndef PD0
00062 #include "port128.h"
00063 #endif
00064 #endif
00065
00066
00067
00068
00069 #define GNUC_PACKED __attribute__((packed))
00070
00071
00072 #define DDR(x) ((x)-1) // address of data direction register of port x
00073 #define PIN(x) ((x)-2) // address of input register of port x
00074
00075
00076 #define MIN(a,b) ((a<b)?(a):(b))
00077 #define MAX(a,b) ((a>b)?(a):(b))
00078 #define ABS(x) ((x>0)?(x):(-x))
00079
00080
00081 #define PI 3.14159265359
00082
00083 #endif