Digi XBee(R) ANSI C Host Library
|
Common header for Hardware Abstraction Layer. More...
#include <errno.h>
#include <stddef.h>
#include "xbee/jslong_glue.h"
Go to the source code of this file.
Macros | |
#define | XBEE_BEGIN_DECLS |
Macro defined to. More... | |
#define | XBEE_END_DECLS |
Macro defined to. More... | |
#define | ZCL_TIME_EPOCH_DELTA_1980 ((UINT32_C(20) * 365 + 5) * 24 * 60 * 60) |
For 1/1/1980 epoch (Rabbit), add 20 years, plus 5 leap days (1980, 1984, 1988, 1992, 1996) to get to ZigBee epoch of 1/1/2000. More... | |
#define | ZCL_TIME_EPOCH_DELTA_1970 ((UINT32_C(30) * 365 + 7) * 24 * 60 * 60) |
For 1/1/1970 epoch (Win32, Unix), add 30 years, plus 7 leap days (1972, 1976, 1980, 1984, 1988, 1992, 1996) to get to ZigBee epoch of 1/1/2000. More... | |
#define | TRUE 1 |
#define | FALSE 0 |
#define | xbee_get_unaligned16(p) (*(uint16_t FAR *)(p)) |
#define | xbee_get_unaligned32(p) (*(uint32_t FAR *)(p)) |
#define | xbee_set_unaligned16(p, v) *(uint16_t FAR *)(p) = (v) |
#define | xbee_set_unaligned32(p, v) *(uint32_t FAR *)(p) = (v) |
#define | _TABLE_ENTRIES(array) ((sizeof (array)) / (sizeof (*array))) |
Helper macro for calculating the number of entries in an array. | |
#define | XBEE_TIMER_COMPARE(a, op, b) ( ((int16_t)((uint16_t)(a) - (uint16_t)(b))) op 0 ) |
Compare two uint16_t timer values, with proper handling of rollover (e.g., 0xFFFF < 0x0000). More... | |
#define | XBEE_SET_TIMEOUT_MS(delay) ((uint16_t)xbee_millisecond_timer() + (delay)) |
Macro used to load a variable with an expiration time, later used with XBEE_CHECK_TIMEOUT_MS() macro. More... | |
#define | XBEE_CHECK_TIMEOUT_MS(timer) ((int16_t)((uint16_t)xbee_millisecond_timer() - (timer)) >= 0) |
Macro used to check a timer set by XBEE_SET_TIMEOUT_MS(). More... | |
#define | XBEE_SET_TIMEOUT_SEC(delay) ((uint16_t)xbee_seconds_timer() + (delay)) |
Macro used to load a variable with an expiration time, later used with XBEE_CHECK_TIMEOUT_SEC() macro. More... | |
#define | XBEE_CHECK_TIMEOUT_SEC(timer) ((int16_t)((uint16_t)xbee_seconds_timer() - (timer)) >= 0) |
Macro used to check a timer set by XBEE_SET_TIMEOUT_SEC(). More... | |
Functions | |
uint32_t() | xbee_seconds_timer (void) |
Platform-specific function to return the number of elapsed seconds. More... | |
uint32_t() | xbee_millisecond_timer (void) |
Platform-specific function to return the number of elapsed milliseconds. More... | |
int | hexstrtobyte (const char FAR *p) |
Converts two hex characters (0-9A-Fa-f) to a byte. More... | |
int | xbee_readline (char *buffer, int length) |
This function is a non-blocking version of gets(), used to read a line of input from the user. More... | |
void | hex_dump (const void FAR *address, uint16_t length, uint16_t flags) |
Helper function for printing a hex dump of memory to stdout. More... | |
int | memcheck (const void FAR *src, int c, size_t length) |
Test whether a block of memory is set to a single byte value. More... | |
error codes | |
These error names are used throughout the library. Some platforms don't define them in errno.h, so we define them here using arbitrary values. | |
#define | ENODATA 20000 |
no message is available on the STREAM head read queue (POSIX.1) | |
#define | EINVAL 20001 |
invalid argument (POSIX.1) | |
#define | EIO 20002 |
input/output error (POSIX.1) | |
#define | EBUSY 20003 |
device or resource busy (POSIX.1) | |
#define | EEXIST 20004 |
file exists (POSIX.1) | |
#define | ENOSPC 20005 |
no space left on device (POSIX.1) | |
#define | ENOENT 20006 |
no such file or directory (POSIX.1) | |
#define | E2BIG 20007 |
argument list too long (POSIX.1) | |
#define | EBADMSG 20010 |
bad message (POSIX.1) | |
#define | ENOTSUP 20011 |
operation not supported (POSIX.1) | |
#define | ETIMEDOUT 20012 |
connection timed out (POSIX.1) | |
#define | EILSEQ 20013 |
illegal byte sequence (POSIX.1, C99) | |
#define | EAGAIN 20014 |
resource temporarily unavailable (POSIX.1) | |
#define | ENOSYS 20015 |
function not implemented (POSIX.1) | |
#define | EACCES 20016 |
permission denied (POSIX.1) | |
#define | ECANCELED 20017 |
operation canceled (POSIX.1) | |
#define | EMSGSIZE 20018 |
message too long (POSIX.1) | |
#define | EPERM 20019 |
operation not permitted (POSIX.1) | |
Platform-specific Macros | |
Documentation for things that must be defined in the platform-specific header files. | |
#define | PACKED_STRUCT struct |
Deprecated macro, replaced by XBEE_PACKED(). More... | |
#define | INTERRUPT_ENABLE |
Enable CPU interrupts (at the level of the serial port driver, at least). More... | |
#define | INTERRUPT_DISABLE |
Disable CPU interrupts (at the level of the serial port driver, at least). | |
#define | XBEE_SERIAL_MAX_BAUDRATE 115200 |
Maximum baud rate supported by serial ports. More... | |
#define | XBEE_UNUSED_PARAMETER(p) (void) p |
Functions with unused parameters (common due to the use of function pointers) can use this macro to dismiss compiler warnings about unused parameters. More... | |
#define | XBEE_RESET_FN NULL |
Function pointer to pass to xbee_dev_init() in shared sample code for the xbee_reset_fn parameter. More... | |
#define | XBEE_IS_AWAKE_FN NULL |
Function pointer to pass to xbee_dev_init() in shared sample code for the xbee_is_awake_fn parameter. More... | |
platform_far | |
#define | FAR |
On platforms with "far" pointers, define to the proper keyword; empty definition if not required. | |
#define | CAST_FAR_TO_NEAR(p) (p) |
On platforms with "far" pointers, define to a series of explicit casts to convert a "far" pointer back to "near". More... | |
#define | PRIsFAR "s" |
Literal string format specifier for printing a far string, typically "s" . | |
#define | PRIpFAR "p" |
Literal string format specifier for printing a far pointer, typically "p" . | |
platform_inttypes | |
Macros typically defined in <inttypes.h>, define manually if inttypes.h is not available on this platform. | |
#define | PRId16 "hd" |
Format specifier for 16-bit signed (usually "d" or "hd" ) | |
#define | PRId32 "ld" |
Format specifier for 32-bit signed (usually "ld" or "d" ) | |
#define | PRIu16 "hu" |
Format specifier for 16-bit unsigned (usually "u" or "hu" ) | |
#define | PRIu32 "lu" |
Format specifier for 32-bit unsigned (usually "lu" or "u" ) | |
#define | PRIx16 "hx" |
Format specifier for 16-bit lowercase hex (usually "x" or "hx" ) | |
#define | PRIx32 "lx" |
Format specifier for 32-bit lowercase hex (usually "lx" or "x" ) | |
#define | PRIX16 "hX" |
Format specifier for 16-bit uppercase hex (usually "X" or "hX" ) | |
#define | PRIX32 "lX" |
Format specifier for 32-bit uppercase hex (usually "lX" or "X" ) | |
Flags to pass to hex_dump(). | |
#define | HEX_DUMP_FLAG_NONE 0x0000 |
Default settings (no prefix). | |
#define | HEX_DUMP_FLAG_OFFSET 0x0001 |
Prefix each line with the memory offset (0000: xx xx xx). | |
#define | HEX_DUMP_FLAG_ADDRESS 0x0002 |
Prefix each line with the address (uses p specifier) (000000: xx xx xx). | |
#define | HEX_DUMP_FLAG_TAB 0x0004 |
Prefix each line with a tab character. | |
Common header for Hardware Abstraction Layer.
This file should be included by all other files in the library.