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