Digi XBee(R) ANSI C Host Library
platform_config.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2012 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
24 #ifndef __XBEE_PLATFORM_HCS08
25 #define __XBEE_PLATFORM_HCS08
26  // Latest version of CW6 was 5032, tested version of CW10 was 5035.
27  // Assuming 5033 and 5034 were beta versions of Eclipse-based CW10.
28  #if (__VERSION__ <= 5032)
29  #define XBEE_CW6
30  #else
31  #define XBEE_CW10
32  #endif
33 
34  #ifdef XBEE_CW6
35  #include "derivative.h"
36  #endif
37 
38  // Ignore warnings about unused parameters in functions. The API includes
39  // parameters that aren't used in all instances (callbacks, future flags,
40  // etc.)
41  #pragma MESSAGE DISABLE C5703
42 
43  // Disable warning C3303 since we use this feature intentionally.
44  #pragma MESSAGE DISABLE C3303 // Implicit concatenation of strings
45 
46  // Ignore warnings about inlined functions.
47  #pragma MESSAGE DISABLE C4301
48 
49  // Disable warning C4800, triggered when assigning NULL to a function
50  // pointer, or a function that is less-const than the function pointer.
51  // (both behaviors are acceptable).
52  #pragma MESSAGE DISABLE C4800 // Implicit cast in assignment
53 
54  // Disable warning C1420, triggered when we don't use the result of a
55  // function call. Good idea to disable, since common functions (like
56  // printf) have return values.
57  #pragma MESSAGE DISABLE C1420 // Result of function-call is ignored
58 
59  // HCS08 doesn't have automatic __FUNCTION__ macro.
60  #define __FUNCTION__ "xbee"
61 
62  // CodeWarrior doesn't have an endian.h, so define its macros here.
63  #define LITTLE_ENDIAN 1234
64  #define BIG_ENDIAN 4321
65  #define PDP_ENDIAN 3412
66 
67  #ifdef __LITTLE_ENDIAN__
68  #error "This platform is supposed to be BIG ENDIAN"
69  #endif
70  #define BYTE_ORDER BIG_ENDIAN
71 
72  // CodeWarrior has a memcpy2() that is more efficient than standard memcpy().
73  // It returns void instead of dest, and assumes count > 0. Decided not to
74  // use it since too many locations required explicit checks for count == 0.
75  #define _f_memcpy memcpy
76  #define _f_memset memset
77 
78  // Use these until we have an official stdint.h to ship
79  typedef signed char int8_t;
80  typedef unsigned char uint8_t;
81  typedef int int16_t;
82  typedef unsigned int uint16_t;
83  typedef long int32_t;
84  typedef unsigned long uint32_t;
85 
86  typedef unsigned char uint_fast8_t;
87  typedef signed char int_fast8_t;
88 
89  #define INT16_C(x) (x)
90  #define UINT16_C(x) (x ## U)
91  #define INT32_C(x) (x ## L)
92  #define UINT32_C(x) (x ## UL)
93 
94  // CodeWarrior printf doesn't like "h" modifier, so define these
95  // format specifiers and don't use the defaults.
96  #define PRId16 "d"
97  #define PRIu16 "u"
98  #define PRIx16 "x"
99  #define PRIX16 "X"
100 
101  // This type isn't in stdint.h
102  typedef uint8_t bool_t;
103 
104  // the "FAR" modifier is not used
105  #define FAR
106 
107  // Elements needed to keep track of serial port settings. Must have a
108  // baudrate member, other fields are platform-specific.
109 
110  #define SERIAL_PORT_SCI1 1
111  #define SERIAL_PORT_SCI2 2
112 
113  struct xbee_cbuf_t; // defined in xbee/cbuf.h
114  typedef struct xbee_serial_t {
115  uint32_t baudrate;
116  uint8_t port;
117  struct xbee_cbuf_t *rxbuf;
118  } xbee_serial_t;
119 
120  // Two serial ports on Programmable XBee.
121  extern xbee_serial_t HOST_SERIAL_PORT;
122  extern xbee_serial_t EMBER_SERIAL_PORT;
123 
124  // We'll use 1/1/2000 as the epoch, to match ZigBee.
125  #define ZCL_TIME_EPOCH_DELTA 0
126 
127  #define HAVE_SWAP_FUNCS 1
128  #ifdef XBEE_CW6
129  #include "rtc.h"
130  // Instead of calling functions, reference global variables directly.
131  #define xbee_seconds_timer() (SEC_TIMER)
132  #define xbee_millisecond_timer() (MS_TIMER)
133  #endif
134 
135  // our millisecond timer has a 4ms resolution
136  #define XBEE_MS_TIMER_RESOLUTION 4
137 
138  void xbee_reset_radio( struct xbee_dev_t *xbee, bool_t asserted);
139 #endif // __XBEE_PLATFORM_HCS08
140 
unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
signed char int8_t
8-bit signed integer
Definition: platform_config.h:38
Definition: platform_config.h:71
void xbee_reset_radio(struct xbee_dev_t *xbee, bool_t asserted)
Function to pass to xbee_dev_init() to control the EM250&#39;s /RESET pin on PTCD4.
Definition: xbee_platform_hcs08.c:108
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
short int16_t
16-bit signed integer
Definition: platform_config.h:40
Definition: device.h:361
long int32_t
32-bit signed integer
Definition: platform_config.h:42
Circular buffer used by transparent serial cluster handler.
Definition: cbuf.h:31
int bool_t
Variable that can hold 0 or 1, may be an int for speed purporses or uint8_t for size optimization...
Definition: platform_config.h:51