00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _MOTE_TYPES_H_
00036 #define _MOTE_TYPES_H_
00037
00038 #if defined(TINYOS) && defined(TOS_ONE)
00039 # include <inttypes.h>
00040 #else
00041 # include <stdint.h>
00042 #endif
00043
00044 #ifdef WORDSIZE
00045 #error WORDSIZE already defined
00046 #endif
00047
00048 #ifdef DEBUG
00049 # include <stdio.h>
00050 # define log_info(...) fprintf(stdout, __VA_ARGS__)
00051 # define log_error(...) fprintf(stderr, __VA_ARGS__)
00052 #else
00053 # define log_info(...)
00054 # define log_error(...)
00055 #endif
00056
00057 #if defined(TINYOS)
00058 # define SIXTEEN_BIT
00059 # define SMALL_RAM
00060 #else
00061 # if defined(PLATFORM_TELOSB)
00062 # define SIXTEEN_BIT
00063 # define MED_RAM
00064 # elif defined(PLATFORM_MICA_ANY) || defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_MICAZ)
00065 # define EIGHT_BIT
00066 # define SMALL_RAM
00067 # endif
00068 #endif
00069
00070
00071 #if defined(EIGHT_BIT)
00072 # define WORDSIZE 1
00073 # define MAX_VALUE 0xfe
00074 # define WORD int8_t
00075
00076 typedef int8_t int_t;
00077 typedef uint8_t uint_t;
00078
00079 #elif defined(SIXTEEN_BIT)
00080 # define WORDSIZE 2
00081 # define MAX_VALUE 0xfffe
00082 # define WORD int16_t
00083
00084 typedef int16_t int_t;
00085 typedef uint16_t uint_t;
00086
00087 #else // default to 32 bit
00088 # define WORDSIZE 4
00089 # define MAX_VALUE 0xfffffffe
00090 # define WORD int32_t
00091
00092 typedef int32_t int_t;
00093 typedef uint32_t uint_t;
00094 #endif
00095
00096
00097
00098
00099 typedef uint8_t byte_t;
00100
00101 #ifndef NULL
00102 # define NULL (void*)0
00103 #endif
00104
00105 enum {
00106 #if defined(SMALL_RAM) // i.e. Mica2/Z (4 kb)
00107 MAX_RESULTS = 64,
00108 MAX_CAPABILITIES = 16,
00109 MAX_CMD_SIZE = 256,
00110
00111 #elif defined(MED_RAM) // i.e TelosB (10 kb)
00112 MAX_RESULTS = 64,
00113 MAX_CAPABILITIES = 16,
00114 MAX_CMD_SIZE = 256,
00115
00116 #elif defined(BIG_RAM) // i.e. one-third of ~1Mb
00117 MAX_RESULTS = 256,
00118 MAX_CAPABILITIES = 64,
00119 MAX_CMD_SIZE = 1024,
00120
00121 #else // default to large (> 16Mb) or paged
00122 MAX_RESULTS = 1024,
00123 MAX_CAPABILITIES = 256,
00124 MAX_CMD_SIZE = 4096,
00125 #endif
00126 };
00127
00128
00129 #endif // _MOTE_TYPES_H_