29#define NULL ((void*)0)
33#define _STR(item) #item
35#define STR(item) _STR(item)
38#define IN_RANGE(num, lower, upper) \
39 (((number) >= (lower)) && ((number) <= (upper)))
42#define container_of(ptr, type, member) ({ \
43 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
44 (type *)( (char *)__mptr - offsetof(type,member) );})
47#define PACKED __attribute__((__packed__))
52#define SECTION(name) __attribute__((section(#name)))
55#define ROM_TEXT(name) SECTION(.text.ro_text.name)
57#define ROM_DATA(name) SECTION(.text.ro_data.name)
60#define ARRAY_ROWS(array_2d) (sizeof(array_2d) / sizeof(array_2d[0]) / sizeof(array_2d[0][0]))
62#define ARRAY_COLS(array_2d) (sizeof(array_2d[0]) / sizeof(array_2d[0][0]))
65#define UNUSED_PARAM(x) (void)x
69#define MAX(a, b) ((a)>(b)?(a):(b))
73#define MIN(a, b) ((a)<(b)?(a):(b))
77#define ByteSwapWord(w) (uint16_t)((((uint16_t)(w))>>8) | (((uint16_t)(w))<<8))
80#define ByteSwapDWord(dw) (uint32_t)((((uint32_t)(dw))>>24) | \
81 ((((uint32_t)(dw))>>8) & 0xFF00) | ((((uint32_t)(dw)) & 0xFF00)<<8) | \
82 (((uint32_t)(dw))<<24))
91 for (i = 0; str[i] !=
'\0'; i++) {
92 if ((str[i] >=
'a') && (str[i] <=
'z'))
218int long_to_str(
long num,
char *str,
int buf_len,
int pad_len,
char pad_chr);
297 uint8_t num_pairs,
char *output, uint16_t max_len);
uint8_t uint16_to_str(uint16_t num, char *str)
Converts an unsigned 16-bit number to its character string representation.
uint16_t concat_strings(const char **str, uint8_t num_strs, char *output, uint16_t max_len)
Concatenates an array of strings into an output string, separated by a '\0' character.
int long_to_str(long num, char *str, int buf_len, int pad_len, char pad_chr)
Converts an integer to a character string.
const char * str_is_uint8(const char *str)
Evaluates if a string points to a number that can be stored in a uint8_t type variable.
uint16_t concat_kv_pairs(const char **key, const char **value, uint8_t num_pairs, char *output, uint16_t max_len)
Concatenates two arrays of key/value pairs, into an output string, separating each key and value with...
const char * str_to_uint8(const char *strIn, uint8_t *result)
Converts a character string representing an 8-bit unsigned number, to its binary (uint8_t) representa...
int8_t int8_to_str(int8_t num, char *str)
Converts an signed 8-bit number to its character string representation.
int version_to_str(const uint8_t version[3], char *str)
Converts version numbers (major, minor, micro) into its string representation [major]....
int ip_validate(const char *str)
This function evaluates the data entered on the input Menu structure, to guess if it corresponds to a...
int version_cmp(const uint8_t old[3], const uint8_t cur[3])
Compares two version number arrays (major, minor, micro).
int uint32_to_ip_str(uint32_t ip_u32, char *ip_str)
Writes the corresponding string representing an IPv4 stored in the input DWORD (32-bit) integer.
static void to_upper(char *str)
Converts input string to uppercase.
uint8_t int16_to_str(int16_t num, char *str)
Converts an signed 16-bit number to its character string representation.
uint16_t uint8_to_str(uint8_t num, char *str)
Converts an unsigned 8-bit number to its character string representation.
int uint32_to_hex_str(uint32_t num, char *str, int pad)
Converts a 32-bit number to its hexadecimal string representation.
uint32_t ip_str_to_uint32(const char *ip)
Returns the binary IP addres (uint32) corresponding to the input string.
void uint8_to_hex_str(uint8_t num, char *str)
Converts a 8-bit number to its hexadecimal string representation.