Digi XBee(R) ANSI C Host Library
platform_config.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2013 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 
29 #ifndef __XBEE_PLATFORM_POSIX
30 #define __XBEE_PLATFORM_POSIX
31  #include <strings.h>
32 
33  #define strcmpi strcasecmp
34  #define strncmpi strncasecmp
35 
36  // Load platform's endian header to learn whether we're big or little.
37  #include <sys/types.h>
38 
39  // macros used to declare a packed structure (no alignment of elements)
40  // The more-flexible XBEE_PACKED() replaced PACKED_STRUCT in 2019.
41  #define PACKED_STRUCT struct __attribute__ ((__packed__))
42  #define XBEE_PACKED(name, decl) PACKED_STRUCT name decl
43 
44  #define _f_memcpy memcpy
45  #define _f_memset memset
46 
47  // stdint.h for int8_t, uint8_t, int16_t, etc. types
48  #include <stdint.h>
49 
50  typedef int bool_t;
51 
52  // inttypes.h for PRIx16, PRIx32, etc. macros
53  #include <inttypes.h>
54 
55  // enable the Wi-Fi code by default
56  #ifndef XBEE_WIFI_ENABLED
57  #define XBEE_WIFI_ENABLED 1
58  #endif
59 
60  // enable the cellular code by default
61  #ifndef XBEE_CELLULAR_ENABLED
62  #define XBEE_CELLULAR_ENABLED 1
63  #endif
64 
65  // compiler natively supports 64-bit integers
66  #define XBEE_NATIVE_64BIT
67 
68 // Elements needed to keep track of serial port settings. Must have a
69 // baudrate member, other fields are platform-specific.
70 typedef struct xbee_serial_t {
71  uint32_t baudrate;
72  int fd;
73  char device[40]; // /dev/ttySxx
75 
76 #ifndef XBEE_SERIAL_MAX_BAUDRATE
77  #include <termios.h>
78  #if defined B921600
79  #define XBEE_SERIAL_MAX_BAUDRATE 921600
80  #elif defined B460800
81  #define XBEE_SERIAL_MAX_BAUDRATE 460800
82  #elif defined B230400
83  #define XBEE_SERIAL_MAX_BAUDRATE 230400
84  #else
85  #define XBEE_SERIAL_MAX_BAUDRATE 115200
86  #endif
87 #endif // def XBEE_SERIAL_MAX_BAUDRATE
88 
89 // Unix epoch is 1/1/1970
90 #define ZCL_TIME_EPOCH_DELTA ZCL_TIME_EPOCH_DELTA_1970
91 
92 // Per POSIX standard, "The resolution of the system clock is unspecified."
93 // We assume the millisecond timer has at least a 10ms resolution.
94 #define XBEE_MS_TIMER_RESOLUTION 10
95 
96 #endif // __XBEE_PLATFORM_POSIX
97 
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