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 destination array.

uint8_t *
rsi_itoa(uint32_t val, uint8_t *str)

Convert integer value into null-terminated string and stores the result in the array given by str parameter.

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 notation MAC address to a 6-byte hex address.

void
rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress)

Convert 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.

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 is returned here.

Returns

  • Hex address


Definition at line 142 of file driver/rsi_utils.c

Referenced by rsi_ble_set_random_address_with_value , rsi_ble_start_advertising , rsi_ble_connect_with_params , rsi_ble_connect , rsi_ble_connect_cancel , rsi_ble_disconnect , rsi_ble_conn_param_resp , rsi_ble_smp_pair_request , rsi_ble_ltk_req_reply , rsi_ble_smp_pair_response , rsi_ble_smp_passkey , rsi_ble_get_le_ping_timeout , rsi_ble_set_le_ping_timeout , rsi_ble_addto_whitelist , rsi_ble_deletefrom_whitelist , rsi_ble_resolvlist , rsi_ble_set_privacy_mode , rsi_ble_readphy , rsi_ble_setphy , rsi_ble_conn_params_update , rsi_ble_set_data_len , rsi_ble_update_directed_address , rsi_ble_start_encryption , rsi_ble_get_profiles_async , rsi_ble_get_profile_async , rsi_ble_get_char_services_async , rsi_ble_get_inc_services_async , rsi_ble_get_char_value_by_uuid_async , rsi_ble_get_att_descriptors_async , rsi_ble_get_att_value_async , rsi_ble_get_multiple_att_values_async , rsi_ble_get_long_att_value_async , rsi_ble_set_att_value_async , rsi_ble_prepare_write_async , rsi_ble_execute_write_async , rsi_ble_get_profiles , rsi_ble_get_profile , rsi_ble_get_char_services , rsi_ble_get_inc_services , rsi_ble_get_char_value_by_uuid , rsi_ble_get_att_descriptors , rsi_ble_get_att_value , rsi_ble_get_multiple_att_values , rsi_ble_get_long_att_value , rsi_ble_set_att_value , rsi_ble_set_att_cmd , rsi_ble_set_long_att_value , rsi_ble_prepare_write , rsi_ble_execute_write , rsi_ble_set_wo_resp_notify_buf_info , rsi_ble_notify_value , rsi_ble_indicate_value , rsi_ble_indicate_confirm , rsi_ble_gatt_read_response , rsi_ble_att_error_response , rsi_ble_mtu_exchange_event , rsi_ble_gatt_write_response , rsi_ble_gatt_prepare_write_response , rsi_bt_a2dp_connect , rsi_bt_a2dp_disconnect , rsi_bt_a2dp_send_pcm_mp3_data , rsi_bt_a2dp_send_sbc_aac_data , rsi_bt_a2dp_start , rsi_bt_a2dp_suspend , rsi_bt_a2dp_close , rsi_bt_a2dp_abort , rsi_bt_a2dp_get_config , rsi_bt_a2dp_set_config , rsi_bt_avrcp_conn , rsi_bt_avrcp_disconn , rsi_bt_avrcp_play , rsi_bt_avrcp_pause , rsi_bt_avrcp_stop , rsi_bt_avrcp_next , rsi_bt_avrcp_previous , rsi_bt_avrcp_vol_up , rsi_bt_avrcp_vol_down , rsi_bt_avrcp_get_capabilities , rsi_bt_avrcp_get_att_list , rsi_bt_avrcp_get_att_vals_list , rsi_bt_avrcp_get_cur_att_val , rsi_bt_avrcp_set_cur_att_val , rsi_bt_avrcp_get_element_att , rsi_bt_avrcp_get_play_status , rsi_bt_avrcp_reg_notification , rsi_bt_avrcp_get_remote_version , rsi_bt_avrcp_get_att_text , rsi_bt_avrcp_get_att_val_text , rsi_bt_avrcp_batt_status , rsi_bt_avrcp_supp_char_sets , rsi_bt_avrcp_set_abs_vol , rsi_bt_avrcp_cap_resp , rsi_bt_avrcp_att_list_resp , rsi_bt_avrcp_att_val_list_resp , rsi_bt_avrcp_cur_att_val_resp , rsi_bt_avrcp_set_cur_att_val_resp , rsi_bt_avrcp_ele_att_resp , rsi_bt_avrcp_play_status_resp , rsi_bt_avrcp_reg_notify_resp , rsi_bt_avrcp_att_text_resp , rsi_bt_avrcp_att_vals_text_resp , rsi_bt_avrcp_batt_status_resp , rsi_bt_avrcp_char_set_status_resp , rsi_bt_avrcp_notify , rsi_bt_avrcp_cmd_reject , rsi_bt_avrcp_set_abs_vol_resp , rsi_bt_avrcp_set_addr_player_resp , rsi_bt_avrcp_get_folder_items_resp , rsi_bt_avrcp_get_tot_num_items_resp , rsi_bt_prepare_le_pkt , rsi_bt_set_bd_addr , rsi_bt_get_rssi , rsi_bt_remote_name_request_async , rsi_bt_remote_name_request_cancel , rsi_bt_connect , rsi_bt_cancel_connect , rsi_bt_disconnect , rsi_bt_accept_ssp_confirm , rsi_bt_reject_ssp_confirm , rsi_bt_passkey , rsi_bt_pincode_request_reply , rsi_bt_linkkey_request_reply , rsi_bt_get_local_device_role , rsi_bt_set_local_device_role , rsi_bt_get_services_async , rsi_bt_search_service_async , rsi_bt_sniff_mode , rsi_bt_sniff_exit_mode , rsi_bt_sniff_subrating_mode , rsi_bt_change_pkt_type , rsi_bt_request_authentication , rsi_bt_encryption_enable_or_disable , rsi_bt_spp_connect , and rsi_bt_spp_disconnect

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 destination 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 the result in the array given by str parameter.

Parameters
[in]val

- Value to be converted to a string

[in]str

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

Returns

  • 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

- This is the string representation of an integral number

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 num


Definition at line 412 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

  • value in integer


Definition at line 431 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 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 449 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 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 481 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 522 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 548 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