Macros

Core macros. More...

Macros

#define GOS_LOG (msg, ...) gos_log (msg, ## __VA_ARGS__)
General logging macro.
#define GOS_VLOG (msg, arg_list) gos_vlog (msg, arg_list)
General logging macro.
#define GOS_NEVER_TIMEOUT 0xFFFFFFFFULL
Used for APIs that require a timeout, never timeout.
#define GOS_WAIT_FOREVER GOS_NEVER_TIMEOUT
Used for APIs that require a timeout, never timeout.
#define GOS_NO_WAIT 0
Used for APIs that require a timeout, timeout immediately.
#define GOS_FAILED (result, func)   ((result = (func)) != GOS_SUCCESS )
Store the result of API call, return TRUE if API was successful, FALSE else.
#define GOS_VERIFY (func)   { gos_result_t _result = (func); if(_result != GOS_SUCCESS ) return _result; } while(0)
Verify the result of an API call, return the result on failure.
#define GOS_IS_NULL_ARG (arg)   ( arg == NULL )
Check if the argument is NULL.
#define MIN (x, y)   ((x) < (y) ? (x) : (y))
Return minimum of two integers.
#define MAX (x, y)   ((x) > (y) ? (x) : (y))
Return maximum of two integers.
#define ROUND_UP (x, y)   ((x) % (y) ? (x) + (y)-((x)%(y)) : (x))
Divide x by y rounding up.
#define DIV_ROUND_UP (m, n)   (((m) + (n) - 1) / (n))
Divide x by y rounding up.
#define OFFSETOF (type, member)   ((uintptr_t)&((type *)0)->member)
Get offset (i.e. index) of member of struct.
#define ARRAY_COUNT (x)   (sizeof (x) / sizeof *(x))
Return number of elements in static array.
#define ALIGN_n (x, n)   ((((uint32_t)x) + ((n)-1)) & ~((n)-1))
Align x to a multiple of n (rounding up) where n is a power of two.
#define ALIGN_8 (x) ALIGN_n (x, 8)
Align x to a multiple of 8 (rounding up)
#define ALIGN_4 (x) ALIGN_n (x, 4)
Align x to a multiple of 4 (rounding up)
#define UNUSED_PARAMETER (x)   (void)x
Removes complier warning for unused function parameters.
#define GOS_NULL_HANDLE 0
Invalid handle, this value is considered invalid when reading/writing streams.
#define GOS_DEVICE_UUID_LEN 40
The module's UUID length in hex characters. This is the number of characters returned by the command: 'get system.uuid' See Wi-Fi Command API, system.uuid
#define GOS_URL_MAX_LENGTH 128
The maximum size of a URL.
#define GOS_MAX_STREAMS PLATFORM_MAX_STREAMS
The maximum number of simultaneous streams.
#define GOS_CREATE_OBJECT (object_type) gos_malloc_named (STRINGIFY(object_type), sizeof(object_type))
Allocate object memory on heap Call GOS_DESTROY_OBJECT() to cleanup allocated memory.
#define GOS_DESTROY_OBJECT (object_ptr) gos_free (object_ptr)
De-allocate object memory from heap.
#define BUILD_ASSERTION (condition)   ((void)sizeof(char[1 - 2*!(condition)]))
Compile-time assertion if given condition is NOT true.

Detailed Description

Core macros.