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 
23 #ifndef __XBEE_PLATFORM_RABBIT
24 #define __XBEE_PLATFORM_RABBIT
25 
26  // Load platform's endian header to learn whether we're big or little.
27  #include <endian.h>
28 
29 // On the Rabbit platform, some pointers are "far". Many platforms just have
30 // a single pointer type and will define FAR to nothing.
31 
32 #if 1
33  #define FAR __far
34  #define CAST_FAR_TO_NEAR(p) ((void *)(uint16_t)(uint32_t)(p))
35 // Following in the standard set by inttypes.h, use fprintf macro PRIsFAR for
36 // printing far strings (will be just "s" on most platforms).
37  #define PRIsFAR "Fs"
38  #define PRIpFAR "Fp"
39 #else
40  #define PRIsFAR "s"
41  #define PRIpFAR "p"
42 #endif
43 
44  #include <stdint.h>
45  #include <inttypes.h>
46 
47  // This type isn't in stdint.h
48  typedef int bool_t;
49 
50 // Elements needed to keep track of serial port settings. Must have a
51 // baudrate member, other fields are platform-specific.
52 typedef struct xbee_serial_t {
53  uint32_t baudrate;
54  int port;
56 
57 // Rabbit doesn't have separate functions for opening a serial port and setting
58 // its baudrate, so just map xbee_ser_baudrate() to xbee_ser_open().
59 #define xbee_ser_baudrate( serial, baudrate) xbee_ser_open( serial, baudrate)
60 
61 // Rabbit epoch is 1/1/1980.
62 #define ZCL_TIME_EPOCH_DELTA ZCL_TIME_EPOCH_DELTA_1980
63 
64 // our millisecond timer has a 1ms resolution
65 #define XBEE_MS_TIMER_RESOLUTION 1
66 
67 // use an inline-assembly version of _xbee_checksum()
68 #define _xbee_checksum( bytes, length, initial) \
69  _xbee_checksum_inline( bytes, length, initial)
70 
71 #use "xbee_platform_rabbit.c"
72 #use "hexdump.c"
73 
74 #endif // __XBEE_PLATFORM_RABBIT
75 
unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
Definition: platform_config.h:71
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