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 
24 #ifndef __XBEE_PLATFORM_WIN32
25 #define __XBEE_PLATFORM_WIN32
26 
27  // Load platform's endian header to learn whether we're big or little.
28  #ifdef __MINGW32__
29  #include <sys/param.h>
30  #else
31  #include <endian.h>
32  #endif
33 
34  // These seem to work for both old MinGW and new MSYS2/MINGW64.
35  #define strcmpi strcasecmp
36  #define strncmpi strncasecmp
37 
38  // macros used to declare a packed structure (no alignment of elements)
39  // "__gcc_struct__" added to fix problems with gcc 4.7.0 in MinGW/MSYS
40  // The more-flexible XBEE_PACKED() replaced PACKED_STRUCT in 2019.
41  #define PACKED_STRUCT struct __attribute__ ((__packed__, __gcc_struct__))
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  // for HANDLE type used in xbee_serial_t, GetTickCount, str[n]cmpi, etc.
56  #include <windows.h>
57 
58  // enable the Wi-Fi code by default
59  #ifndef XBEE_WIFI_ENABLED
60  #define XBEE_WIFI_ENABLED 1
61  #endif
62 
63  // enable the cellular code by default
64  #ifndef XBEE_CELLULAR_ENABLED
65  #define XBEE_CELLULAR_ENABLED 1
66  #endif
67 
68  // compiler natively supports 64-bit integers
69  #define XBEE_NATIVE_64BIT
70 
71  // size of OS-level serial buffers
72  #define XBEE_SER_TX_BUFSIZE 2048
73  #define XBEE_SER_RX_BUFSIZE 4096
74 
75 // Elements needed to keep track of serial port settings. Must have a
76 // baudrate member, other fields are platform-specific.
77 typedef struct xbee_serial_t {
78  uint32_t baudrate;
79  int comport; // COMx:
80  HANDLE hCom;
82 
83 // assume serial support for 921600bps by default
84 #ifndef XBEE_SERIAL_MAX_BAUDRATE
85  #define XBEE_SERIAL_MAX_BAUDRATE 921600
86 #endif
87 
88 // Win32 epoch is 1/1/1970
89 #define ZCL_TIME_EPOCH_DELTA ZCL_TIME_EPOCH_DELTA_1970
90 
91 // Per MSDN, "The resolution of the GetTickCount function is limited to the
92 // resolution of the system timer, which is typically in the range of 10
93 // milliseconds to 16 milliseconds."
94 #define XBEE_MS_TIMER_RESOLUTION 16
95 
96 #endif // __XBEE_PLATFORM_WIN32
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