Contiki 3.x
8051def.h
1 /*
2  * \file
3  * This file contains a set of configuration for using SDCC as a compiler.
4  * This is based on the cc2430 file (which in turn is based on the z80 one)
5  *
6  * \author
7  * Takahide Matsutsuka <markn@markn.org> (Original)
8  * George Oikonomou - <oikonomou@users.sourceforge.net>
9  * (updates for the cc2530 ports)
10  */
11 
12 #ifndef E051_DEF_H_
13 #define E051_DEF_H_
14 
15 #include <stdint.h>
16 
17 /* This port no longer implements the legacy clock_delay. Hack its usages
18  * outta the way till it gets phased out completely
19  * NB: This also overwrites the prototype so delay_usec() is declared twice */
20 #define clock_delay(t) clock_delay_usec(t)
21 
22 /*
23  * lint - style defines to help syntax parsers with sdcc-specific 8051 code
24  * They don't interfere with actual compilation
25  */
26 #if !defined(__SDCC_mcs51) && !defined(SDCC_mcs51)
27 #define __data
28 #define __xdata
29 #define __code
30 #define __bit bool
31 #define __sfr volatile unsigned char
32 #define __sbit volatile bool
33 #define __critical
34 #define __at(x)
35 #define __using(x)
36 #define __interrupt(x)
37 #define __naked
38 #endif
39 
40 #define CC_CONF_FUNCTION_POINTER_ARGS 1
41 #define CC_CONF_VA_ARGS 1
42 #define CC_CONF_UNSIGNED_CHAR_BUGS 0
43 #define CC_CONF_REGISTER_ARGS 0
44 #define CC_CONF_FUNCTION_POINTER_KEYWORD __reentrant
45 #define CC_CONF_NON_BANKED_OPTIMIZATION 1
46 
47 #if (defined(__SDCC_mcs51) || defined(SDCC_mcs51)) && CC_CONF_NON_BANKED_OPTIMIZATION
48 #define CC_NON_BANKED __nonbanked
49 #else
50 #define CC_NON_BANKED
51 #endif
52 
53 /*
54  * Max Stack Depth manipulation. It is possible to get up to 247 bytes
55  * allocated for the stack if:
56  * - You set this to 1 and
57  * - You have a patched toolchain and
58  * - You don't use __bit variables
59  * - You do not link libraries using BIT registers (e.g. printf_large)
60  * Enabling this will mean ISRs will NOT push bits (#pragma exclude bits) so
61  * make sure you know what you're doing
62  *
63  * More information on the wiki
64  */
65 #define CC_CONF_OPTIMIZE_STACK_SIZE 0
66 
67 #if CC_CONF_OPTIMIZE_STACK_SIZE
68 #define CC_AT_DATA
69 #else
70 #define CC_AT_DATA __data
71 #endif
72 
73 /* Generic types. */
74 typedef unsigned short uip_stats_t;
75 
76 /* Time type. */
77 typedef unsigned short clock_time_t;
78 #define MAX_TICKS (~((clock_time_t)0) / 2)
79 /* Defines tick counts for a second. */
80 #define CLOCK_CONF_SECOND 128
81 
82 /* Compiler configurations */
83 #define CCIF
84 #define CLIF
85 
86 /* Single asm instruction without messing up syntax highlighting */
87 #if defined(__SDCC_mcs51) || defined(SDCC_mcs51)
88 #define ASM(x) __asm \
89  x \
90  __endasm
91 #else
92 #define ASM(x)
93 #endif
94 
95 /* Critical section management */
96 #define DISABLE_INTERRUPTS() do {EA = 0;} while(0)
97 #define ENABLE_INTERRUPTS() do {EA = 1;} while(0)
98 
99 /* Macro for a soft reset. */
100 #define SOFT_RESET() do {((void (__code *) (void)) 0x0000) ();} while(0)
101 
102 /* We don't provide architecture-specific checksum calculations */
103 #define UIP_ARCH_ADD32 0
104 #define UIP_ARCH_CHKSUM 0
105 
106 #define CC_CONF_ASSIGN_AGGREGATE(dest, src) \
107  memcpy(dest, src, sizeof(*dest))
108 
109 #define uip_ipaddr_copy(dest, src) \
110  memcpy(dest, src, sizeof(*dest))
111 
112 #endif /* E051_DEF_H_ */