Contiki 2.6

8051def.h

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