00001 /* Name: iarcompat.h 00002 * Project: AVR USB driver 00003 * Author: Christian Starkjohann 00004 * Creation Date: 2006-03-01 00005 * Tabsize: 4 00006 * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH 00007 * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) 00008 * This Revision: $Id: iarcompat.h 533 2008-02-28 15:35:25Z cs $ 00009 */ 00010 00011 /* 00012 General Description: 00013 This header is included when we compile with the IAR C-compiler and assembler. 00014 It defines macros for cross compatibility between gcc and IAR-cc. 00015 00016 Thanks to Oleg Semyonov for his help with the IAR tools port! 00017 */ 00018 00019 #ifndef __iarcompat_h_INCLUDED__ 00020 #define __iarcompat_h_INCLUDED__ 00021 00022 #if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ 00023 00024 /* Enable bit definitions */ 00025 #ifndef ENABLE_BIT_DEFINITIONS 00026 # define ENABLE_BIT_DEFINITIONS 1 00027 #endif 00028 00029 /* Include IAR headers */ 00030 #include <ioavr.h> 00031 #ifndef __IAR_SYSTEMS_ASM__ 00032 # include <inavr.h> 00033 #endif 00034 00035 #define __attribute__(arg) 00036 00037 #ifdef __IAR_SYSTEMS_ASM__ 00038 # define __ASSEMBLER__ 00039 #endif 00040 00041 #ifdef __HAS_ELPM__ 00042 # define PROGMEM __farflash 00043 #else 00044 # define PROGMEM __flash 00045 #endif 00046 00047 #define PRG_RDB(addr) (*(PROGMEM char *)(addr)) 00048 00049 /* The following definitions are not needed by the driver, but may be of some 00050 * help if you port a gcc based project to IAR. 00051 */ 00052 #define cli() __disable_interrupt() 00053 #define sei() __enable_interrupt() 00054 #define wdt_reset() __watchdog_reset() 00055 00056 /* Depending on the device you use, you may get problems with the way usbdrv.h 00057 * handles the differences between devices. Since IAR does not use #defines 00058 * for MCU registers, we can't check for the existence of a particular 00059 * register with an #ifdef. If the autodetection mechanism fails, include 00060 * definitions for the required USB_INTR_* macros in your usbconfig.h. See 00061 * usbconfig-prototype.h and usbdrv.h for details. 00062 */ 00063 00064 #endif /* defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ */ 00065 #endif /* __iarcompat_h_INCLUDED__ */