Utils#

Functions#

void
rsi_uint16_to_2bytes(uint8_t *dBuf, uint16_t val)

Convert uint16 to two byte array.

void
rsi_uint32_to_4bytes(uint8_t *dBuf, uint32_t val)

Convert uint32 to four byte array.

uint16_t
rsi_bytes2R_to_uint16(uint8_t *dBuf)

Convert a 2 byte array to uint16, first byte in array is LSB.

uint32_t
rsi_bytes4R_to_uint32(uint8_t *dBuf)

Convert a 4 byte array to uint32, first byte in array is LSB.

int8_t
rsi_ascii_hex2num(int8_t ascii_hex_in)

ASCII to HEX conversion.

int8_t
rsi_char_hex2dec(int8_t *cBuf)

Convert given ASCII HEX notation to decimal notation (used for MAC address).

uint8_t *
rsi_ascii_dev_address_to_6bytes_rev(uint8_t *hex_addr, int8_t *ascii_mac_address)

Convert notation MAC address to a 6-byte HEX address.

int8_t
hex_to_ascii(uint8_t hex_num)

Hex to ascii conversion.

uint8_t *
rsi_6byte_dev_address_to_ascii(uint8_t *ascii_mac_address, uint8_t *hex_addr)

Convert given 6-byte HEX address to ASCII Mac address.

uint8_t
lmac_crc8_c(uint8_t crc8_din, uint8_t crc8_state, uint8_t end)

Calculate CRC for a given byte and accumulate CRC.

uint8_t
multicast_mac_hash(uint8_t *mac)

Calculate 6-bit hash value for given MAC address.

uint8_t

Convert the given lower-case character to upper case.

void
string2array(uint8_t *dst, uint8_t *src, uint32_t length)

Convert the given string to array.

uint8_t *
rsi_itoa(uint32_t val, uint8_t *str)

Convert integer value into null-terminated string and stores it.

int32_t
rsi_atoi(const int8_t *str)

Convert string to an integer.

int8_t
asciihex_2_num(int8_t ascii_hex_in)

ASCII to hex conversion.

int8_t
rsi_charhex_2_dec(int8_t *cBuf)

Convert given ASCII HEX notation to decimal notation (used for mac address).

void
rsi_ascii_mac_address_to_6bytes(uint8_t *hexAddr, int8_t *asciiMacAddress)

Convert ASCII notation MAC address to a 6-byte HEX address.

void
rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress)

Convert ASCII notation network address to 4-byte HEX address.

uint64_t

Convert IP address to reverse HEX format.

uint32_t
rsi_ntohl(uint32_t a)

Converts the unsigned integer from network byte order to host byte order.

uint8_t
ascii_to_dec(uint8_t *num)

Convert ASCII to Decimal Value.

void
rsi_reverse(char *str, int len)

Reverses the given string.

int
rsi_intToStr(int x, char str[], int d)

converts the integer into a string.

void
rsi_ftoa(char *res, float n, int afterpoint)
void
ROM_WL_rsi_uint16_to_2bytes(global_cb_t *global_cb_p, uint8_t *dBuf, uint16_t val)

Convert uint16 to two byte array.

void
ROM_WL_rsi_uint32_to_4bytes(global_cb_t *global_cb_p, uint8_t *dBuf, uint32_t val)

Convert uint32 to four byte array.

uint16_t
ROM_WL_rsi_bytes2R_to_uint16(global_cb_t *global_cb_p, uint8_t *dBuf)

Convert a 2 byte array to uint16, first byte in array is LSB.

uint32_t
ROM_WL_rsi_bytes4R_to_uint32(global_cb_t *global_cb_p, uint8_t *dBuf)

Convert a 4 byte array to uint32, first byte in array is LSB.

Function Documentation#

rsi_uint16_to_2bytes#

void rsi_uint16_to_2bytes (uint8_t * dBuf, uint16_t val)

Convert uint16 to two byte array.

Parameters
[in]dBuf

- Pointer to buffer to put the data in

[in]val

- Data to convert

Returns

  • void


Definition at line 37 of file driver/rsi_utils.c

rsi_uint32_to_4bytes#

void rsi_uint32_to_4bytes (uint8_t * dBuf, uint32_t val)

Convert uint32 to four byte array.

Parameters
[in]dBuf

- Pointer to buffer to put the data in

[in]val

- Data to convert

Returns

  • void


Definition at line 55 of file driver/rsi_utils.c

rsi_bytes2R_to_uint16#

uint16_t rsi_bytes2R_to_uint16 (uint8_t * dBuf)

Convert a 2 byte array to uint16, first byte in array is LSB.

Parameters
[in]dBuf

- Pointer to a buffer to get the data from


Returns

  • Converted 16 bit data


Definition at line 71 of file driver/rsi_utils.c

rsi_bytes4R_to_uint32#

uint32_t rsi_bytes4R_to_uint32 (uint8_t * dBuf)

Convert a 4 byte array to uint32, first byte in array is LSB.

Parameters
[in]dBuf

- Pointer to a buffer to get the data from

Returns

  • Converted 32 bit data


Definition at line 88 of file driver/rsi_utils.c

rsi_ascii_hex2num#

int8_t rsi_ascii_hex2num (int8_t ascii_hex_in)

ASCII to HEX conversion.

Parameters
[in]ascii_hex_in

- ASCII HEX input

Returns

  • HEX number


Definition at line 104 of file driver/rsi_utils.c

rsi_char_hex2dec#

int8 rsi_char_hex2dec (int8_t * cBuf)

Convert given ASCII HEX notation to decimal notation (used for MAC address).

Parameters
[in]cBuf

- ASCII HEX notation string

Returns

  • Integer Value


Definition at line 123 of file driver/rsi_utils.c

rsi_ascii_dev_address_to_6bytes_rev#

uint8_t * rsi_ascii_dev_address_to_6bytes_rev (uint8_t * hex_addr, int8_t * ascii_mac_address)

Convert notation MAC address to a 6-byte HEX address.

Parameters
[in]hex_addr

- Source address to convert, must be a null terminated string.

[out]ascii_mac_address

- Converted HEX address.

Returns

  • HEX address


Definition at line 142 of file driver/rsi_utils.c

hex_to_ascii#

int8_t hex_to_ascii (uint8_t hex_num)

Hex to ascii conversion.

Parameters
[in]hex_num

- HEX number

Returns

  • Ascii value for given HEX value


Definition at line 176 of file driver/rsi_utils.c

rsi_6byte_dev_address_to_ascii#

int8_t * rsi_6byte_dev_address_to_ascii (uint8_t * ascii_mac_address, uint8_t * hex_addr)

Convert given 6-byte HEX address to ASCII Mac address.

Parameters
[in]ascii_mac_address

- HEX address input.

[out]hex_addr

- Converted ASCII mac address is returned here.

Returns

  • Converted ASCII mac address


Definition at line 219 of file driver/rsi_utils.c

lmac_crc8_c#

uint8_t lmac_crc8_c (uint8_t crc8_din, uint8_t crc8_state, uint8_t end)

Calculate CRC for a given byte and accumulate CRC.

Parameters
[in]crc8_din

- CRC byte input

[in]crc8_state

- accumulated CRC

[in]end

- last byte CRC

Returns

  • CRC value


Definition at line 247 of file driver/rsi_utils.c

multicast_mac_hash#

uint8_t multicast_mac_hash (uint8_t * mac)

Calculate 6-bit hash value for given MAC address.

Parameters
[in]mac

- pointer to MAC address

Returns

  • 6-bit Hash value


Definition at line 310 of file driver/rsi_utils.c

convert_lower_case_to_upper_case#

uint8_t convert_lower_case_to_upper_case (uint8_t lwrcase)

Convert the given lower-case character to upper case.

Parameters
[in]lwrcase

- Lower case character to convert

Returns

  • Converted Upper case character


Definition at line 327 of file driver/rsi_utils.c

string2array#

void string2array (uint8_t * dst, uint8_t * src, uint32_t length)

Convert the given string to array.

Parameters
[in]dst

- Pointer to destination array

[in]src

- Pointer to source string

[in]length

- Length of the string

Returns

  • Void


Definition at line 343 of file driver/rsi_utils.c

rsi_itoa#

uint8_t * rsi_itoa (uint32_t val, uint8_t * str)

Convert integer value into null-terminated string and stores it.

Parameters
[in]val

- Value to be converted to a string

[in]str

- Array in memory where to store the resulting null-terminated string

Returns

  • Null-terminated string


Definition at line 363 of file driver/rsi_utils.c

rsi_atoi#

int32_t rsi_atoi (const int8_t * str)

Convert string to an integer.

Parameters
[in]str

- String to be converted to integer

Returns

  • Converted Integer


Definition at line 396 of file driver/rsi_utils.c

asciihex_2_num#

int8_t asciihex_2_num (int8_t ascii_hex_in)

ASCII to hex conversion.

Parameters
[in]ascii_hex_in

- ASCII hex input

Returns

  • HEX number


Definition at line 422 of file driver/rsi_utils.c

rsi_charhex_2_dec#

int8_t rsi_charhex_2_dec (int8_t * cBuf)

Convert given ASCII HEX notation to decimal notation (used for mac address).

Parameters
[in]cBuf

- ASCII HEX notation string.

Returns

  • Integer value


Definition at line 441 of file driver/rsi_utils.c

rsi_ascii_mac_address_to_6bytes#

void rsi_ascii_mac_address_to_6bytes (uint8_t * hexAddr, int8_t * asciiMacAddress)

Convert ASCII notation MAC address to a 6-byte HEX address.

Parameters
[in]hexAddr

- Source address to convert, must be a null terminated string.

[out]asciiMacAddress

- Converted HEX address is returned here.

Returns

  • Void


Definition at line 459 of file driver/rsi_utils.c

rsi_ascii_dot_address_to_4bytes#

void rsi_ascii_dot_address_to_4bytes (uint8_t * hexAddr, int8_t * asciiDotAddress)

Convert ASCII notation network address to 4-byte HEX address.

Parameters
[in]hexAddr

- Source address to convert, must be a null terminated string.

[out]asciiDotAddress

- Output value is passed back in the 4-byte HEX Address.

Returns

  • Void


Definition at line 491 of file driver/rsi_utils.c

ip_to_reverse_hex#

uint64_t ip_to_reverse_hex (char * ip)

Convert IP address to reverse HEX format.

Parameters
[in]ip

- IP address to convert.

Returns

  • IP address in reverse HEX format


Definition at line 532 of file driver/rsi_utils.c

rsi_ntohl#

uint32_t rsi_ntohl (uint32_t a)

Converts the unsigned integer from network byte order to host byte order.

Parameters
[in]a

- Unsigned integer to convert.

Returns

  • Unsigned integer in host byte order


Definition at line 558 of file driver/rsi_utils.c

ascii_to_dec#

uint8_t ascii_to_dec (uint8_t * num)

Convert ASCII to Decimal Value.

Parameters
[in]num

- ASCII input

Returns

  • dec_val - value after conversion


Definition at line 569 of file driver/rsi_utils.c

rsi_reverse#

void rsi_reverse (char * str, int len)

Reverses the given string.

Parameters
[in]str

- string to be reversed

[in]len

- the length of the given string

Returns

  • void


Definition at line 589 of file driver/rsi_utils.c

rsi_intToStr#

int rsi_intToStr (int x, char str, int d)

converts the integer into a string.

Parameters
[in]x

- the string in which the result must be stored

[in]str

- the float number that needs to be converted into a string

[in]d

- the number of points after the decimal that needs to be printed, should be less than 6.

Converts a floating-point/double number to a string.

Returns

  • the lenght of the string

Returns

  • void


Definition at line 610 of file driver/rsi_utils.c

rsi_ftoa#

void rsi_ftoa (char * res, float n, int afterpoint)
Parameters
N/Ares
N/An
N/Aafterpoint

Definition at line 637 of file driver/rsi_utils.c

ROM_WL_rsi_uint16_to_2bytes#

void ROM_WL_rsi_uint16_to_2bytes (global_cb_t * global_cb_p, uint8_t * dBuf, uint16_t val)

Convert uint16 to two byte array.

Parameters
[in]global_cb_p

- pointer to the common buffer

[in]dBuf

- pointer to buffer to put the data in

[in]val

- data to convert

Returns

  • void


Definition at line 40 of file driver/rsi_utils_rom.c

ROM_WL_rsi_uint32_to_4bytes#

void ROM_WL_rsi_uint32_to_4bytes (global_cb_t * global_cb_p, uint8_t * dBuf, uint32_t val)

Convert uint32 to four byte array.

Parameters
[in]global_cb_p

- pointer to the common buffer

[in]dBuf

- pointer to the buffer to put the data in

[in]val

- data to convert

Returns

  • void


Definition at line 61 of file driver/rsi_utils_rom.c

ROM_WL_rsi_bytes2R_to_uint16#

uint16_t ROM_WL_rsi_bytes2R_to_uint16 (global_cb_t * global_cb_p, uint8_t * dBuf)

Convert a 2 byte array to uint16, first byte in array is LSB.

Parameters
[in]global_cb_p

- pointer to the common buffer

[in]dBuf

- pointer to a buffer to get the data from

Returns

  • Converted data


Definition at line 85 of file driver/rsi_utils_rom.c

ROM_WL_rsi_bytes4R_to_uint32#

uint32_t ROM_WL_rsi_bytes4R_to_uint32 (global_cb_t * global_cb_p, uint8_t * dBuf)

Convert a 4 byte array to uint32, first byte in array is LSB.

Parameters
[in]global_cb_p

- pointer to the common buffer

[in]dBuf

- pointer to buffer to get the data from

Returns

  • Converted data


Definition at line 109 of file driver/rsi_utils_rom.c