Contiki 2.6

8051def.h

00001 /*
00002  * \file
00003  *      This file contains a set of configuration for using SDCC as a compiler.
00004  *      Modified from z80 port for cc2430 port.
00005  *
00006  * \author
00007  *       Takahide Matsutsuka <markn@markn.org> (Original)
00008  *       George Oikonomou - <oikonomou@users.sourceforge.net>
00009  *         (recent updates for the sensinode/cc2430 port)
00010  */
00011 
00012 #ifndef __8051_DEF_H__
00013 #define __8051_DEF_H__
00014 
00015 #include <stdint.h>
00016 
00017 /* This port no longer implements the legacy clock_delay. Hack its usages
00018  * outta the way till it gets phased out completely
00019  * NB: This also overwrites the prototype so delay_usec() is declared twice */
00020 #define clock_delay(t) clock_delay_usec(t)
00021 
00022 /*
00023  * lint - style defines to help syntax parsers with sdcc-specific 8051 code
00024  * They don't interfere with actual compilation
00025  */
00026 #if !defined(__SDCC_mcs51) && !defined(SDCC_mcs51)
00027 #define __data
00028 #define __xdata
00029 #define __code
00030 #define __bit bool
00031 #define __sfr volatile unsigned char
00032 #define __sbit volatile bool
00033 #define __critical
00034 #define __at(x)
00035 #define __using(x)
00036 #define __interrupt(x)
00037 #define __naked
00038 #endif
00039 
00040 #define CC_CONF_FUNCTION_POINTER_ARGS   1
00041 #define CC_CONF_FASTCALL
00042 #define CC_CONF_VA_ARGS         1
00043 #define CC_CONF_UNSIGNED_CHAR_BUGS      0
00044 #define CC_CONF_REGISTER_ARGS           0
00045 #define CC_CONF_FUNCTION_POINTER_KEYWORD __reentrant
00046 #define CC_CONF_NON_BANKED_OPTIMIZATION 1
00047 
00048 #if (defined(__SDCC_mcs51) || defined(SDCC_mcs51)) && CC_CONF_NON_BANKED_OPTIMIZATION
00049 #define CC_NON_BANKED __nonbanked
00050 #else
00051 #define CC_NON_BANKED
00052 #endif
00053 
00054 /* Generic types. */
00055 typedef unsigned short uip_stats_t;
00056 
00057 /* Time type. */
00058 typedef unsigned short clock_time_t;
00059 #define MAX_TICKS (~((clock_time_t)0) / 2)
00060 /* Defines tick counts for a second. */
00061 #define CLOCK_CONF_SECOND   128
00062 
00063 /* Compiler configurations */
00064 #define CCIF
00065 #define CLIF
00066 
00067 /* Single asm instruction without messing up syntax highlighting */
00068 #if defined(__SDCC_mcs51) || defined(SDCC_mcs51)
00069 #define ASM(x) __asm \
00070   x \
00071   __endasm
00072 #else
00073 #define ASM(x)
00074 #endif
00075 
00076 /* Critical section management */
00077 #define DISABLE_INTERRUPTS()  do {EA = 0;} while(0)
00078 #define ENABLE_INTERRUPTS()   do {EA = 1;} while(0)
00079 
00080 /* Macro for a soft reset. */
00081 #define SOFT_RESET() do {((void (__code *) (void)) 0x0000) ();} while(0)
00082 
00083 /* We don't provide architecture-specific checksum calculations */
00084 #define UIP_ARCH_ADD32    0
00085 #define UIP_ARCH_CHKSUM   0
00086 
00087 #define CC_CONF_ASSIGN_AGGREGATE(dest, src)     \
00088     memcpy(dest, src, sizeof(*dest))
00089 
00090 #define uip_ipaddr_copy(dest, src)              \
00091     memcpy(dest, src, sizeof(*dest))
00092 
00093 #endif /* __8051_DEF_H__ */