Rev Author Line No. Line
3331 kaklik 1 /* Name: iarcompat.h
2 * Project: AVR USB driver
3 * Author: Christian Starkjohann
4 * Creation Date: 2006-03-01
5 * Tabsize: 4
6 * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: iarcompat.h,v 1.2 2007/05/19 12:30:11 harbaum Exp $
9 */
10  
11 /*
12 General Description:
13 This header is included when we compile with the IAR C-compiler and assembler.
14 It defines macros for cross compatibility between gcc and IAR-cc.
15  
16 Thanks to Oleg Semyonov for his help with the IAR tools port!
17 */
18  
19 #ifndef __iarcompat_h_INCLUDED__
20 #define __iarcompat_h_INCLUDED__
21  
22 #if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__
23  
24 /* Enable bit definitions */
25 #ifndef ENABLE_BIT_DEFINITIONS
26 # define ENABLE_BIT_DEFINITIONS 1
27 #endif
28  
29 /* Include IAR headers */
30 #include <ioavr.h>
31 #ifndef __IAR_SYSTEMS_ASM__
32 # include <inavr.h>
33 #endif
34  
35 #define __attribute__(arg)
36 #define IAR_SECTION(section) @ section
37  
38 #ifndef USB_BUFFER_SECTION
39 # define USB_BUFFER_SECTION "TINY_Z" /* if user has not selected a named section */
40 #endif
41  
42 #ifdef __IAR_SYSTEMS_ASM__
43 # define __ASSEMBLER__
44 #endif
45  
46 #ifdef __HAS_ELPM__
47 # define PROGMEM __farflash
48 #else
49 # define PROGMEM __flash
50 #endif
51  
52 #define PRG_RDB(addr) (*(PROGMEM char *)(addr))
53  
54 /* The following definitions are not needed by the driver, but may be of some
55 * help if you port a gcc based project to IAR.
56 */
57 #define cli() __disable_interrupt()
58 #define sei() __enable_interrupt()
59 #define wdt_reset() __watchdog_reset()
60  
61 /* Depending on the device you use, you may get problems with the way usbdrv.h
62 * handles the differences between devices. Since IAR does not use #defines
63 * for MCU registers, we can't check for the existence of a particular
64 * register with an #ifdef. If the autodetection mechanism fails, include
65 * definitions for the required USB_INTR_* macros in your usbconfig.h. See
66 * usbconfig-prototype.h and usbdrv.h for details.
67 */
68  
69 #endif /* defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ */
70 #endif /* __iarcompat_h_INCLUDED__ */