From d5734918fbd21f4a3094287d5967db31b516b78b Mon Sep 17 00:00:00 2001 From: Ryan Winter Date: Mon, 18 Oct 2021 15:50:28 -0700 Subject: [PATCH] Azure RTOS 2.1.9 (#298) * Update Azure RTOS to 2.1.9 * Update Azure RTOS middleware API to PNP * Move to tcpip offload for STM and Renesas boards * Move core to shared --- .gitmodules | 12 +- MXChip/AZ3166/CMakeLists.txt | 6 +- MXChip/AZ3166/app/nx_client.c | 112 +- MXChip/AZ3166/azure-pipelines.yml | 2 +- MXChip/AZ3166/lib/CMakeLists.txt | 6 +- .../lib/wiced_sdk/binary_build/CMakeLists.txt | 2 +- Microchip/ATSAME54-XPRO/CMakeLists.txt | 6 +- Microchip/ATSAME54-XPRO/app/nx_client.c | 86 +- Microchip/ATSAME54-XPRO/azure-pipelines.yml | 2 +- Microchip/ATSAME54-XPRO/lib/CMakeLists.txt | 6 +- NXP/MIMXRT1050-EVKB/CMakeLists.txt | 6 +- NXP/MIMXRT1050-EVKB/app/nx_client.c | 86 +- NXP/MIMXRT1050-EVKB/lib/CMakeLists.txt | 6 +- NXP/MIMXRT1060-EVK/CMakeLists.txt | 6 +- NXP/MIMXRT1060-EVK/app/nx_client.c | 86 +- NXP/MIMXRT1060-EVK/azure-pipelines.yml | 2 +- NXP/MIMXRT1060-EVK/lib/CMakeLists.txt | 6 +- README.md | 4 + Renesas/RSK_RX65N_2MB/CMakeLists.txt | 6 +- Renesas/RSK_RX65N_2MB/app/nx_client.c | 87 +- Renesas/RSK_RX65N_2MB/lib/CMakeLists.txt | 8 +- Renesas/RX65N_Cloud_Kit/CMakeLists.txt | 6 +- Renesas/RX65N_Cloud_Kit/app/nx_client.c | 99 +- Renesas/RX65N_Cloud_Kit/app/rx_networking.c | 85 +- Renesas/RX65N_Cloud_Kit/lib/CMakeLists.txt | 14 +- .../lib/netx_driver/CMakeLists.txt | 4 +- .../lib/netx_driver/LICENSE.txt | 246 -- .../lib/netx_driver/LICENSED-HARDWARE.txt | 16 - .../netx_driver/nx_driver_rx65n_cloud_kit.c | 1692 ++++++++ .../netx_driver/nx_driver_rx65n_cloud_kit.h | 52 +- .../lib/netx_driver/src/nx_wifi.c | 1698 -------- .../lib/netxduo/CMakeLists.txt | 496 --- .../RX65N_Cloud_Kit/lib/netxduo/LICENSE.txt | 246 -- .../lib/netxduo/LICENSED-HARDWARE.txt | 16 - .../lib/netxduo/common/nx_api.h | 3850 ----------------- .../lib/netxduo/common/nx_ip.h | 270 -- .../lib/netxduo/common/nx_ip_create.c | 269 -- .../lib/netxduo/common/nx_ip_delete.c | 172 - .../lib/netxduo/common/nx_ip_initialize.c | 84 - .../lib/netxduo/common/nx_ipv4.h | 211 - .../lib/netxduo/common/nx_ipv6.h | 324 -- .../lib/netxduo/common/nx_packet.h | 164 - .../lib/netxduo/common/nx_packet_allocate.c | 284 -- .../lib/netxduo/common/nx_packet_copy.c | 239 - .../netxduo/common/nx_packet_data_adjust.c | 189 - .../netxduo/common/nx_packet_data_append.c | 296 -- .../common/nx_packet_data_extract_offset.c | 216 - .../netxduo/common/nx_packet_data_retrieve.c | 132 - .../netxduo/common/nx_packet_debug_info_get.c | 130 - .../lib/netxduo/common/nx_packet_length_get.c | 84 - .../netxduo/common/nx_packet_pool_cleanup.c | 163 - .../netxduo/common/nx_packet_pool_create.c | 243 -- .../netxduo/common/nx_packet_pool_delete.c | 174 - .../netxduo/common/nx_packet_pool_info_get.c | 138 - .../common/nx_packet_pool_initialize.c | 84 - .../common/nx_packet_pool_low_watermark_set.c | 96 - .../lib/netxduo/common/nx_packet_release.c | 256 -- .../common/nx_packet_transmit_release.c | 130 - .../lib/netxduo/common/nx_system.h | 156 - .../lib/netxduo/common/nx_system_initialize.c | 264 -- .../lib/netxduo/common/nx_tcp.h | 424 -- .../common/nx_tcp_client_socket_bind.c | 239 - .../common/nx_tcp_client_socket_connect.c | 101 - .../common/nx_tcp_client_socket_unbind.c | 193 - .../lib/netxduo/common/nx_tcp_enable.c | 78 - .../netxduo/common/nx_tcp_free_port_find.c | 186 - .../lib/netxduo/common/nx_tcp_initialize.c | 79 - .../common/nx_tcp_socket_block_cleanup.c | 118 - .../lib/netxduo/common/nx_tcp_socket_create.c | 236 - .../lib/netxduo/common/nx_tcp_socket_delete.c | 162 - .../netxduo/common/nx_tcp_socket_disconnect.c | 91 - .../common/nx_tcp_socket_establish_notify.c | 82 - .../netxduo/common/nx_tcp_socket_receive.c | 89 - .../common/nx_tcp_socket_receive_notify.c | 103 - .../lib/netxduo/common/nx_tcp_socket_send.c | 88 - .../netxduo/common/nx_tcp_socket_state_wait.c | 116 - .../lib/netxduo/common/nx_udp.h | 167 - .../lib/netxduo/common/nx_udp_enable.c | 78 - .../netxduo/common/nx_udp_free_port_find.c | 186 - .../lib/netxduo/common/nx_udp_socket_bind.c | 215 - .../lib/netxduo/common/nx_udp_socket_create.c | 181 - .../lib/netxduo/common/nx_udp_socket_delete.c | 154 - .../netxduo/common/nx_udp_socket_receive.c | 87 - .../common/nx_udp_socket_receive_notify.c | 98 - .../lib/netxduo/common/nx_udp_socket_send.c | 101 - .../lib/netxduo/common/nx_udp_socket_unbind.c | 161 - .../common/nxd_tcp_client_socket_connect.c | 92 - .../lib/netxduo/common/nxd_udp_socket_send.c | 95 - .../common/nxde_tcp_client_socket_connect.c | 141 - .../common/nxde_tcp_socket_peer_info_get.c | 108 - .../lib/netxduo/common/nxde_udp_socket_send.c | 184 - .../lib/netxduo/common/nxe_ip_create.c | 163 - .../lib/netxduo/common/nxe_ip_delete.c | 99 - .../lib/netxduo/common/nxe_packet_allocate.c | 110 - .../lib/netxduo/common/nxe_packet_copy.c | 117 - .../netxduo/common/nxe_packet_data_append.c | 124 - .../common/nxe_packet_data_extract_offset.c | 98 - .../netxduo/common/nxe_packet_data_retrieve.c | 93 - .../netxduo/common/nxe_packet_length_get.c | 95 - .../netxduo/common/nxe_packet_pool_create.c | 198 - .../netxduo/common/nxe_packet_pool_delete.c | 98 - .../netxduo/common/nxe_packet_pool_info_get.c | 108 - .../nxe_packet_pool_low_watermark_set.c | 110 - .../lib/netxduo/common/nxe_packet_release.c | 121 - .../common/nxe_packet_transmit_release.c | 121 - .../common/nxe_tcp_client_socket_bind.c | 106 - .../common/nxe_tcp_client_socket_connect.c | 132 - .../common/nxe_tcp_client_socket_unbind.c | 99 - .../lib/netxduo/common/nxe_tcp_enable.c | 97 - .../netxduo/common/nxe_tcp_socket_create.c | 192 - .../netxduo/common/nxe_tcp_socket_delete.c | 99 - .../common/nxe_tcp_socket_disconnect.c | 100 - .../common/nxe_tcp_socket_establish_notify.c | 85 - .../netxduo/common/nxe_tcp_socket_receive.c | 101 - .../common/nxe_tcp_socket_receive_notify.c | 108 - .../lib/netxduo/common/nxe_tcp_socket_send.c | 151 - .../common/nxe_tcp_socket_state_wait.c | 113 - .../lib/netxduo/common/nxe_udp_enable.c | 97 - .../lib/netxduo/common/nxe_udp_socket_bind.c | 107 - .../netxduo/common/nxe_udp_socket_create.c | 166 - .../netxduo/common/nxe_udp_socket_delete.c | 99 - .../netxduo/common/nxe_udp_socket_receive.c | 101 - .../common/nxe_udp_socket_receive_notify.c | 94 - .../lib/netxduo/common/nxe_udp_socket_send.c | 166 - .../netxduo/common/nxe_udp_socket_unbind.c | 99 - Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_port.h | 225 - Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_user.h | 61 +- Renesas/RX65N_Cloud_Kit/lib/netxduo/readme.md | 6 - .../src/r_wifi_sx_ulpgn/r_wifi_sx_ulpgn_api.c | 13 +- STMicroelectronics/STM32L4_L4+/CMakeLists.txt | 6 +- .../STM32L4_L4+/app/nx_client.c | 94 +- .../STM32L4_L4+/app/stm_networking.c | 97 +- .../STM32L4_L4+/app/stm_networking.h | 6 +- .../STM32L4_L4+/azure-pipelines-l4s5.yml | 2 +- .../STM32L4_L4+/azure-pipelines.yml | 2 +- .../STM32L4_L4+/lib/CMakeLists.txt | 10 +- .../lib/netx_driver/CMakeLists.txt | 3 +- .../lib/netx_driver/inventek/wifi.c | 16 + .../lib/netx_driver/inventek/wifi.h | 1 + .../lib/netx_driver/nx_driver_stm32l4.c | 1846 ++++++++ .../lib/netx_driver/nx_driver_stm32l4.h | 50 +- .../STM32L4_L4+/lib/netx_driver/nx_wifi.c | 1663 ------- .../STM32L4_L4+/lib/netxduo/CMakeLists.txt | 497 --- .../STM32L4_L4+/lib/netxduo/LICENSE.txt | 246 -- .../lib/netxduo/LICENSED-HARDWARE.txt | 16 - .../STM32L4_L4+/lib/netxduo/common/nx_api.h | 3850 ----------------- .../STM32L4_L4+/lib/netxduo/common/nx_ip.h | 270 -- .../lib/netxduo/common/nx_ip_create.c | 269 -- .../lib/netxduo/common/nx_ip_delete.c | 172 - .../lib/netxduo/common/nx_ip_initialize.c | 84 - .../STM32L4_L4+/lib/netxduo/common/nx_ipv4.h | 211 - .../STM32L4_L4+/lib/netxduo/common/nx_ipv6.h | 324 -- .../lib/netxduo/common/nx_packet.h | 164 - .../lib/netxduo/common/nx_packet_allocate.c | 284 -- .../lib/netxduo/common/nx_packet_copy.c | 239 - .../netxduo/common/nx_packet_data_adjust.c | 189 - .../netxduo/common/nx_packet_data_append.c | 296 -- .../common/nx_packet_data_extract_offset.c | 216 - .../netxduo/common/nx_packet_data_retrieve.c | 132 - .../netxduo/common/nx_packet_debug_info_get.c | 130 - .../lib/netxduo/common/nx_packet_length_get.c | 84 - .../netxduo/common/nx_packet_pool_cleanup.c | 163 - .../netxduo/common/nx_packet_pool_create.c | 243 -- .../netxduo/common/nx_packet_pool_delete.c | 174 - .../netxduo/common/nx_packet_pool_info_get.c | 138 - .../common/nx_packet_pool_initialize.c | 84 - .../common/nx_packet_pool_low_watermark_set.c | 96 - .../lib/netxduo/common/nx_packet_release.c | 256 -- .../common/nx_packet_transmit_release.c | 130 - .../lib/netxduo/common/nx_system.h | 156 - .../lib/netxduo/common/nx_system_initialize.c | 264 -- .../STM32L4_L4+/lib/netxduo/common/nx_tcp.h | 424 -- .../common/nx_tcp_client_socket_bind.c | 239 - .../common/nx_tcp_client_socket_connect.c | 101 - .../common/nx_tcp_client_socket_unbind.c | 193 - .../lib/netxduo/common/nx_tcp_enable.c | 78 - .../netxduo/common/nx_tcp_free_port_find.c | 186 - .../lib/netxduo/common/nx_tcp_initialize.c | 79 - .../common/nx_tcp_socket_block_cleanup.c | 118 - .../lib/netxduo/common/nx_tcp_socket_create.c | 236 - .../lib/netxduo/common/nx_tcp_socket_delete.c | 162 - .../netxduo/common/nx_tcp_socket_disconnect.c | 91 - .../common/nx_tcp_socket_establish_notify.c | 82 - .../netxduo/common/nx_tcp_socket_receive.c | 89 - .../common/nx_tcp_socket_receive_notify.c | 103 - .../lib/netxduo/common/nx_tcp_socket_send.c | 88 - .../netxduo/common/nx_tcp_socket_state_wait.c | 116 - .../STM32L4_L4+/lib/netxduo/common/nx_udp.h | 167 - .../lib/netxduo/common/nx_udp_enable.c | 78 - .../netxduo/common/nx_udp_free_port_find.c | 186 - .../lib/netxduo/common/nx_udp_socket_bind.c | 215 - .../lib/netxduo/common/nx_udp_socket_create.c | 181 - .../lib/netxduo/common/nx_udp_socket_delete.c | 154 - .../netxduo/common/nx_udp_socket_receive.c | 87 - .../common/nx_udp_socket_receive_notify.c | 98 - .../lib/netxduo/common/nx_udp_socket_send.c | 101 - .../lib/netxduo/common/nx_udp_socket_unbind.c | 161 - .../common/nxd_tcp_client_socket_connect.c | 92 - .../lib/netxduo/common/nxd_udp_socket_send.c | 95 - .../common/nxde_tcp_client_socket_connect.c | 141 - .../common/nxde_tcp_socket_peer_info_get.c | 109 - .../lib/netxduo/common/nxde_udp_socket_send.c | 184 - .../lib/netxduo/common/nxe_ip_create.c | 163 - .../lib/netxduo/common/nxe_ip_delete.c | 99 - .../lib/netxduo/common/nxe_packet_allocate.c | 110 - .../lib/netxduo/common/nxe_packet_copy.c | 117 - .../netxduo/common/nxe_packet_data_append.c | 124 - .../common/nxe_packet_data_extract_offset.c | 98 - .../netxduo/common/nxe_packet_data_retrieve.c | 93 - .../netxduo/common/nxe_packet_length_get.c | 95 - .../netxduo/common/nxe_packet_pool_create.c | 198 - .../netxduo/common/nxe_packet_pool_delete.c | 98 - .../netxduo/common/nxe_packet_pool_info_get.c | 108 - .../nxe_packet_pool_low_watermark_set.c | 110 - .../lib/netxduo/common/nxe_packet_release.c | 121 - .../common/nxe_packet_transmit_release.c | 121 - .../common/nxe_tcp_client_socket_bind.c | 106 - .../common/nxe_tcp_client_socket_connect.c | 132 - .../common/nxe_tcp_client_socket_unbind.c | 99 - .../lib/netxduo/common/nxe_tcp_enable.c | 97 - .../netxduo/common/nxe_tcp_socket_create.c | 192 - .../netxduo/common/nxe_tcp_socket_delete.c | 99 - .../common/nxe_tcp_socket_disconnect.c | 100 - .../common/nxe_tcp_socket_establish_notify.c | 85 - .../netxduo/common/nxe_tcp_socket_receive.c | 101 - .../common/nxe_tcp_socket_receive_notify.c | 108 - .../lib/netxduo/common/nxe_tcp_socket_send.c | 151 - .../common/nxe_tcp_socket_state_wait.c | 113 - .../lib/netxduo/common/nxe_udp_enable.c | 97 - .../lib/netxduo/common/nxe_udp_socket_bind.c | 107 - .../netxduo/common/nxe_udp_socket_create.c | 166 - .../netxduo/common/nxe_udp_socket_delete.c | 99 - .../netxduo/common/nxe_udp_socket_receive.c | 101 - .../common/nxe_udp_socket_receive_notify.c | 94 - .../lib/netxduo/common/nxe_udp_socket_send.c | 166 - .../netxduo/common/nxe_udp_socket_unbind.c | 99 - .../STM32L4_L4+/lib/netxduo/nx_user.h | 8 +- .../netxduo/ports/cortex_m4/gnu/inc/nx_port.h | 192 - .../netxduo/ports/cortex_m4/iar/inc/nx_port.h | 214 - .../ports/cortex_m4/keil/inc/nx_port.h | 214 - .../STM32L4_L4+/lib/netxduo/readme.md | 6 - SiliconLabs/EFR32MG12/CMakeLists.txt | 6 +- SiliconLabs/EFR32MG12/app/nx_client.c | 89 +- SiliconLabs/EFR32MG12/lib/CMakeLists.txt | 6 +- cmake/arm-gcc-cortex-toolchain.cmake | 6 +- core/lib/netxduo | 1 - core/lib/threadx | 1 - .../azure_iot_nx/nx_azure_iot_pnp_helpers.c | 450 -- .../azure_iot_nx/nx_azure_iot_pnp_helpers.h | 139 - {core => shared}/lib/jsmn/CMakeLists.txt | 0 {core => shared}/lib/jsmn/jsmn.c | 0 {core => shared}/lib/jsmn/src | 0 shared/lib/netxduo | 1 + shared/lib/threadx | 1 + .../model/deviceinformation-1.json | 0 {core => shared}/model/gsg-1.json | 0 {core => shared}/model/gsg-2.json | 0 {core => shared}/model/gsgmqtt-1.json | 0 {core => shared}/model/gsgmxchip-1.json | 0 {core => shared}/model/gsgmxchip-2.json | 0 {core => shared}/model/gsgrx65ncloud-1.json | 0 {core => shared}/model/readme.md | 6 +- {core => shared}/src/CMakeLists.txt | 7 +- {core => shared}/src/azure_iot_cert.c | 0 {core => shared}/src/azure_iot_cert.h | 0 {core => shared}/src/azure_iot_ciphersuites.c | 0 {core => shared}/src/azure_iot_ciphersuites.h | 0 .../src/azure_iot_mqtt/azure_iot_dps_mqtt.c | 0 .../src/azure_iot_mqtt/azure_iot_dps_mqtt.h | 0 .../src/azure_iot_mqtt/azure_iot_mqtt.c | 0 .../src/azure_iot_mqtt/azure_iot_mqtt.h | 0 .../src/azure_iot_mqtt/hmac_sha256.c | 0 .../src/azure_iot_mqtt/hmac_sha256.h | 0 .../src/azure_iot_mqtt}/json_utils.c | 0 .../src/azure_iot_mqtt}/json_utils.h | 0 .../src/azure_iot_mqtt/sas_token.c | 0 .../src/azure_iot_mqtt/sas_token.h | 0 {core => shared}/src/azure_iot_mqtt/sha256.c | 0 {core => shared}/src/azure_iot_mqtt/sha256.h | 0 .../src}/azure_iot_nx_client.c | 666 +-- .../src}/azure_iot_nx_client.h | 52 +- {core => shared}/src/cmsis_utils.h | 0 {core => shared}/src/networking.c | 0 {core => shared}/src/networking.h | 0 {core => shared}/src/newlib_nano.c | 0 {core => shared}/src/sntp_client.c | 0 {core => shared}/src/sntp_client.h | 0 287 files changed, 4614 insertions(+), 41561 deletions(-) delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSE.txt delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSED-HARDWARE.txt create mode 100644 Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.c rename STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_wifi.h => Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.h (53%) delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netx_driver/src/nx_wifi.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/CMakeLists.txt delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSE.txt delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSED-HARDWARE.txt delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_api.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_initialize.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv4.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv6.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_allocate.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_copy.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_adjust.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_append.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_extract_offset.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_retrieve.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_debug_info_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_length_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_cleanup.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_info_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_initialize.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_low_watermark_set.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_release.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_transmit_release.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system_initialize.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_bind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_connect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_unbind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_enable.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_free_port_find.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_initialize.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_block_cleanup.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_disconnect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_establish_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_state_wait.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_enable.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_free_port_find.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_bind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_unbind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_tcp_client_socket_connect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_udp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_client_socket_connect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_udp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_allocate.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_copy.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_append.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_extract_offset.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_retrieve.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_length_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_info_get.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_release.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_transmit_release.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_bind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_connect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_unbind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_enable.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_disconnect.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_establish_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_state_wait.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_enable.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_bind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_create.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_delete.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive_notify.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_send.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_unbind.c delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_port.h delete mode 100644 Renesas/RX65N_Cloud_Kit/lib/netxduo/readme.md create mode 100644 STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.c rename Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_wifi.h => STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.h (54%) delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_wifi.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/CMakeLists.txt delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSE.txt delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSED-HARDWARE.txt delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_api.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_initialize.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv4.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv6.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_allocate.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_copy.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_adjust.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_append.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_extract_offset.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_retrieve.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_debug_info_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_length_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_cleanup.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_info_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_initialize.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_low_watermark_set.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_release.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_transmit_release.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system_initialize.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_bind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_connect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_unbind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_enable.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_free_port_find.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_initialize.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_block_cleanup.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_disconnect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_establish_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_state_wait.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_enable.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_free_port_find.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_bind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_unbind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_tcp_client_socket_connect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_udp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_client_socket_connect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_udp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_allocate.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_copy.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_append.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_extract_offset.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_retrieve.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_length_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_info_get.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_release.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_transmit_release.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_bind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_connect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_unbind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_enable.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_disconnect.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_establish_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_state_wait.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_enable.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_bind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_create.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_delete.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive_notify.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_send.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_unbind.c delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/gnu/inc/nx_port.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/iar/inc/nx_port.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/keil/inc/nx_port.h delete mode 100644 STMicroelectronics/STM32L4_L4+/lib/netxduo/readme.md delete mode 160000 core/lib/netxduo delete mode 160000 core/lib/threadx delete mode 100644 core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.c delete mode 100644 core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.h rename {core => shared}/lib/jsmn/CMakeLists.txt (100%) rename {core => shared}/lib/jsmn/jsmn.c (100%) rename {core => shared}/lib/jsmn/src (100%) create mode 160000 shared/lib/netxduo create mode 160000 shared/lib/threadx rename {core => shared}/model/deviceinformation-1.json (100%) rename {core => shared}/model/gsg-1.json (100%) rename {core => shared}/model/gsg-2.json (100%) rename {core => shared}/model/gsgmqtt-1.json (100%) rename {core => shared}/model/gsgmxchip-1.json (100%) rename {core => shared}/model/gsgmxchip-2.json (100%) rename {core => shared}/model/gsgrx65ncloud-1.json (100%) rename {core => shared}/model/readme.md (55%) rename {core => shared}/src/CMakeLists.txt (87%) rename {core => shared}/src/azure_iot_cert.c (100%) rename {core => shared}/src/azure_iot_cert.h (100%) rename {core => shared}/src/azure_iot_ciphersuites.c (100%) rename {core => shared}/src/azure_iot_ciphersuites.h (100%) rename {core => shared}/src/azure_iot_mqtt/azure_iot_dps_mqtt.c (100%) rename {core => shared}/src/azure_iot_mqtt/azure_iot_dps_mqtt.h (100%) rename {core => shared}/src/azure_iot_mqtt/azure_iot_mqtt.c (100%) rename {core => shared}/src/azure_iot_mqtt/azure_iot_mqtt.h (100%) rename {core => shared}/src/azure_iot_mqtt/hmac_sha256.c (100%) rename {core => shared}/src/azure_iot_mqtt/hmac_sha256.h (100%) rename {core/src => shared/src/azure_iot_mqtt}/json_utils.c (100%) rename {core/src => shared/src/azure_iot_mqtt}/json_utils.h (100%) rename {core => shared}/src/azure_iot_mqtt/sas_token.c (100%) rename {core => shared}/src/azure_iot_mqtt/sas_token.h (100%) rename {core => shared}/src/azure_iot_mqtt/sha256.c (100%) rename {core => shared}/src/azure_iot_mqtt/sha256.h (100%) rename {core/src/azure_iot_nx => shared/src}/azure_iot_nx_client.c (52%) rename {core/src/azure_iot_nx => shared/src}/azure_iot_nx_client.h (61%) rename {core => shared}/src/cmsis_utils.h (100%) rename {core => shared}/src/networking.c (100%) rename {core => shared}/src/networking.h (100%) rename {core => shared}/src/newlib_nano.c (100%) rename {core => shared}/src/sntp_client.c (100%) rename {core => shared}/src/sntp_client.h (100%) diff --git a/.gitmodules b/.gitmodules index a8d69154..b1335aba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "core/lib/threadx"] - path = core/lib/threadx +[submodule "shared/lib/threadx"] + path = shared/lib/threadx url = https://github.com/azure-rtos/threadx.git -[submodule "core/lib/netxduo"] - path = core/lib/netxduo +[submodule "shared/lib/netxduo"] + path = shared/lib/netxduo url = https://github.com/azure-rtos/netxduo.git -[submodule "core/lib/jsmn/src"] - path = core/lib/jsmn/src +[submodule "shared/lib/jsmn/src"] + path = shared/lib/jsmn/src url = https://github.com/zserge/jsmn diff --git a/MXChip/AZ3166/CMakeLists.txt b/MXChip/AZ3166/CMakeLists.txt index b4f1e5eb..a0e47df9 100644 --- a/MXChip/AZ3166/CMakeLists.txt +++ b/MXChip/AZ3166/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -29,6 +29,6 @@ project(mxchip_azure_iot C ASM) # Disable common networking component, MXCHIP has it's own set(DISABLE_COMMON_NETWORK true) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/MXChip/AZ3166/app/nx_client.c b/MXChip/AZ3166/app/nx_client.c index 8fd74a86..3f6c89b2 100644 --- a/MXChip/AZ3166/app/nx_client.c +++ b/MXChip/AZ3166/app/nx_client.c @@ -15,7 +15,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -57,7 +56,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -106,7 +105,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { lps22hb_t lps22hb_data = lps22hb_data_read(); hts221_data_t hts221_data = hts221_data_read(); @@ -127,7 +126,7 @@ static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry_magnetometer(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry_magnetometer(NX_AZURE_IOT_JSON_WRITER* json_writer) { lis2mdl_data_t lis2mdl_data = lis2mdl_data_read(); @@ -153,7 +152,7 @@ static UINT append_device_telemetry_magnetometer(NX_AZURE_IOT_JSON_WRITER* json_ return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry_accelerometer(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry_accelerometer(NX_AZURE_IOT_JSON_WRITER* json_writer) { lsm6dsl_data_t lsm6dsl_data = lsm6dsl_data_read(); @@ -179,7 +178,7 @@ static UINT append_device_telemetry_accelerometer(NX_AZURE_IOT_JSON_WRITER* json return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_writer) { lsm6dsl_data_t lsm6dsl_data = lsm6dsl_data_read(); @@ -209,77 +208,83 @@ static void set_led_state(bool level) { if (level) { - printf("LED is turned ON\r\n"); + printf("\tLED is turned ON\r\n"); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET); } else { - printf("LED is turned OFF\r\n"); + printf("\tLED is turned OFF\r\n"); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - else if (strncmp((CHAR*)method, SET_DISPLAY_TEXT_COMMAND, method_length) == 0) { // drop the first and last character to remove the quotes screen_printn((CHAR*)payload + 1, payload_length - 2, L0); - - http_status = 200; + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -288,17 +293,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -350,9 +361,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -360,15 +371,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -385,19 +396,20 @@ UINT azure_iot_nx_client_entry( switch (telemetry_state) { case TELEMETRY_STATE_DEFAULT: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); break; case TELEMETRY_STATE_MAGNETOMETER: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry_magnetometer); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry_magnetometer); break; case TELEMETRY_STATE_ACCELEROMETER: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry_accelerometer); + azure_iot_nx_client_publish_telemetry( + &azure_iot_nx_client, NULL, append_device_telemetry_accelerometer); break; case TELEMETRY_STATE_GYROSCOPE: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry_gyroscope); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry_gyroscope); break; default: diff --git a/MXChip/AZ3166/azure-pipelines.yml b/MXChip/AZ3166/azure-pipelines.yml index d28b1e37..d26b68e2 100644 --- a/MXChip/AZ3166/azure-pipelines.yml +++ b/MXChip/AZ3166/azure-pipelines.yml @@ -36,7 +36,7 @@ jobs: scriptType: 'ps' scriptLocation: 'scriptPath' scriptPath: '$(Build.SourcesDirectory)\Device-Lab\generate_creds.ps1' - arguments: '$(Build.SourcesDirectory)\getting-started\core\model' + arguments: '$(Build.SourcesDirectory)\getting-started\shared\model' useGlobalConfig: true displayName: "Start Certification" diff --git a/MXChip/AZ3166/lib/CMakeLists.txt b/MXChip/AZ3166/lib/CMakeLists.txt index 9ecc3149..558d9c6d 100644 --- a/MXChip/AZ3166/lib/CMakeLists.txt +++ b/MXChip/AZ3166/lib/CMakeLists.txt @@ -13,9 +13,9 @@ set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo" set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(stm32cubef4) add_subdirectory(mxchip_bsp) diff --git a/MXChip/AZ3166/lib/wiced_sdk/binary_build/CMakeLists.txt b/MXChip/AZ3166/lib/wiced_sdk/binary_build/CMakeLists.txt index 536a6da2..da7130e0 100644 --- a/MXChip/AZ3166/lib/wiced_sdk/binary_build/CMakeLists.txt +++ b/MXChip/AZ3166/lib/wiced_sdk/binary_build/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../../../../..) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/core/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) diff --git a/Microchip/ATSAME54-XPRO/CMakeLists.txt b/Microchip/ATSAME54-XPRO/CMakeLists.txt index 8888510a..ac862496 100644 --- a/Microchip/ATSAME54-XPRO/CMakeLists.txt +++ b/Microchip/ATSAME54-XPRO/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -23,6 +23,6 @@ include(${GSG_BASE_DIR}/cmake/utilities.cmake) # Define the Project project(atsame54_azure_iot C ASM) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/Microchip/ATSAME54-XPRO/app/nx_client.c b/Microchip/ATSAME54-XPRO/app/nx_client.c index ebd0dda0..fac84cc6 100644 --- a/Microchip/ATSAME54-XPRO/app/nx_client.c +++ b/Microchip/ATSAME54-XPRO/app/nx_client.c @@ -14,7 +14,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -36,7 +35,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -85,7 +84,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { struct bme280_data data; @@ -132,59 +131,62 @@ static void set_led_state(bool level) gpio_set_pin_level(PC18, !level); } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -193,17 +195,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -254,9 +262,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -264,15 +272,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -285,7 +293,7 @@ UINT azure_iot_nx_client_entry( tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/Microchip/ATSAME54-XPRO/azure-pipelines.yml b/Microchip/ATSAME54-XPRO/azure-pipelines.yml index 9befb9db..9de1b5cf 100644 --- a/Microchip/ATSAME54-XPRO/azure-pipelines.yml +++ b/Microchip/ATSAME54-XPRO/azure-pipelines.yml @@ -36,7 +36,7 @@ jobs: scriptType: 'ps' scriptLocation: 'scriptPath' scriptPath: '$(Build.SourcesDirectory)\Device-Lab\generate_creds.ps1' - arguments: '$(Build.SourcesDirectory)\getting-started\core\model' + arguments: '$(Build.SourcesDirectory)\getting-started\shared\model' useGlobalConfig: true displayName: "Start Certification" diff --git a/Microchip/ATSAME54-XPRO/lib/CMakeLists.txt b/Microchip/ATSAME54-XPRO/lib/CMakeLists.txt index 29d0a055..7f452967 100644 --- a/Microchip/ATSAME54-XPRO/lib/CMakeLists.txt +++ b/Microchip/ATSAME54-XPRO/lib/CMakeLists.txt @@ -13,9 +13,9 @@ set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo" set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(netx_driver) add_subdirectory(atmel_start) diff --git a/NXP/MIMXRT1050-EVKB/CMakeLists.txt b/NXP/MIMXRT1050-EVKB/CMakeLists.txt index 011b0c6a..85345551 100644 --- a/NXP/MIMXRT1050-EVKB/CMakeLists.txt +++ b/NXP/MIMXRT1050-EVKB/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -23,6 +23,6 @@ include(${GSG_BASE_DIR}/cmake/utilities.cmake) # Define the Project project(mimxrt1050_azure_iot C ASM) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/NXP/MIMXRT1050-EVKB/app/nx_client.c b/NXP/MIMXRT1050-EVKB/app/nx_client.c index 9f843239..33b99f4b 100644 --- a/NXP/MIMXRT1050-EVKB/app/nx_client.c +++ b/NXP/MIMXRT1050-EVKB/app/nx_client.c @@ -11,7 +11,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -33,7 +32,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -82,7 +81,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { TEMPMON_StartMeasure(TEMPMON); float temperature = TEMPMON_GetCurrentTemperature(TEMPMON); @@ -113,59 +112,62 @@ static void set_led_state(bool level) } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -174,17 +176,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -235,9 +243,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -245,15 +253,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -266,7 +274,7 @@ UINT azure_iot_nx_client_entry( tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/NXP/MIMXRT1050-EVKB/lib/CMakeLists.txt b/NXP/MIMXRT1050-EVKB/lib/CMakeLists.txt index c7faf79b..92c41aac 100644 --- a/NXP/MIMXRT1050-EVKB/lib/CMakeLists.txt +++ b/NXP/MIMXRT1050-EVKB/lib/CMakeLists.txt @@ -13,9 +13,9 @@ set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo" set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(netx_driver) add_subdirectory(MIMXRT1050-evk) diff --git a/NXP/MIMXRT1060-EVK/CMakeLists.txt b/NXP/MIMXRT1060-EVK/CMakeLists.txt index ac4e881f..0002228e 100644 --- a/NXP/MIMXRT1060-EVK/CMakeLists.txt +++ b/NXP/MIMXRT1060-EVK/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -23,6 +23,6 @@ include(${GSG_BASE_DIR}/cmake/utilities.cmake) # Define the Project project(mimxrt1060_azure_iot C ASM) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/NXP/MIMXRT1060-EVK/app/nx_client.c b/NXP/MIMXRT1060-EVK/app/nx_client.c index 8936ba5f..1fd68dc7 100644 --- a/NXP/MIMXRT1060-EVK/app/nx_client.c +++ b/NXP/MIMXRT1060-EVK/app/nx_client.c @@ -11,7 +11,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -33,7 +32,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -82,7 +81,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { TEMPMON_StartMeasure(TEMPMON); float temperature = TEMPMON_GetCurrentTemperature(TEMPMON); @@ -113,59 +112,62 @@ static void set_led_state(bool level) } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -174,17 +176,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -235,9 +243,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -245,15 +253,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -266,7 +274,7 @@ UINT azure_iot_nx_client_entry( tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/NXP/MIMXRT1060-EVK/azure-pipelines.yml b/NXP/MIMXRT1060-EVK/azure-pipelines.yml index 934f30f1..8577dc84 100644 --- a/NXP/MIMXRT1060-EVK/azure-pipelines.yml +++ b/NXP/MIMXRT1060-EVK/azure-pipelines.yml @@ -36,7 +36,7 @@ jobs: scriptType: 'ps' scriptLocation: 'scriptPath' scriptPath: '$(Build.SourcesDirectory)\Device-Lab\generate_creds.ps1' - arguments: '$(Build.SourcesDirectory)\getting-started\core\model' + arguments: '$(Build.SourcesDirectory)\getting-started\shared\model' useGlobalConfig: true displayName: "Start Certification" diff --git a/NXP/MIMXRT1060-EVK/lib/CMakeLists.txt b/NXP/MIMXRT1060-EVK/lib/CMakeLists.txt index 3e08ff0f..c782d811 100644 --- a/NXP/MIMXRT1060-EVK/lib/CMakeLists.txt +++ b/NXP/MIMXRT1060-EVK/lib/CMakeLists.txt @@ -13,9 +13,9 @@ set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo" set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(netx_driver) add_subdirectory(MIMXRT1060-evk) diff --git a/README.md b/README.md index c801c4ee..94fdb4ce 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ The following guides will get you started: **Device Lab Status:** A DevOps pipeline running on actual hardware in the lab. +## Device Plug and Play Models + +The Plug and Play models associated with these guides can be found in the [shared/model](shared/model) directory. + ## Contributing For details on contributing to this repository, see the [contributing](CONTRIBUTING.md) guide. diff --git a/Renesas/RSK_RX65N_2MB/CMakeLists.txt b/Renesas/RSK_RX65N_2MB/CMakeLists.txt index 2e9a8bb1..ad2987d1 100644 --- a/Renesas/RSK_RX65N_2MB/CMakeLists.txt +++ b/Renesas/RSK_RX65N_2MB/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -23,6 +23,6 @@ include(${GSG_BASE_DIR}/cmake/utilities.cmake) # Define the Project project(rx65n_azure_iot C ASM) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/Renesas/RSK_RX65N_2MB/app/nx_client.c b/Renesas/RSK_RX65N_2MB/app/nx_client.c index c390f739..5676c009 100644 --- a/Renesas/RSK_RX65N_2MB/app/nx_client.c +++ b/Renesas/RSK_RX65N_2MB/app/nx_client.c @@ -11,7 +11,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -40,7 +39,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -89,7 +88,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { const float temperature = 28.5; @@ -122,59 +121,62 @@ static void set_led_state(bool level) } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -183,17 +185,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -244,9 +252,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -254,27 +262,28 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( &azure_iot_nx_client, DEVICE_INFO_COMPONENT_NAME, append_device_info_properties); printf("\r\nStarting Main loop\r\n"); + while (true) { tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/Renesas/RSK_RX65N_2MB/lib/CMakeLists.txt b/Renesas/RSK_RX65N_2MB/lib/CMakeLists.txt index cf9a51d6..b0028bed 100644 --- a/Renesas/RSK_RX65N_2MB/lib/CMakeLists.txt +++ b/Renesas/RSK_RX65N_2MB/lib/CMakeLists.txt @@ -9,13 +9,13 @@ set(NX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/netxduo/nx_user.h" CACHE STRING "Ena set(NXD_ENABLE_AZURE_IOT ON CACHE BOOL "Enable Azure IoT") set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo") -# Enable security module +# Azure Security Center set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(netx_driver) add_subdirectory(rx_driver_package) diff --git a/Renesas/RX65N_Cloud_Kit/CMakeLists.txt b/Renesas/RX65N_Cloud_Kit/CMakeLists.txt index f33e4ab0..cffc116d 100644 --- a/Renesas/RX65N_Cloud_Kit/CMakeLists.txt +++ b/Renesas/RX65N_Cloud_Kit/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -26,6 +26,6 @@ project(rx65n_azure_iot C ASM) # Disable common networking component, Cloud kit has it's own set(DISABLE_COMMON_NETWORK true) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/Renesas/RX65N_Cloud_Kit/app/nx_client.c b/Renesas/RX65N_Cloud_Kit/app/nx_client.c index 21961f74..18231ff6 100644 --- a/Renesas/RX65N_Cloud_Kit/app/nx_client.c +++ b/Renesas/RX65N_Cloud_Kit/app/nx_client.c @@ -11,7 +11,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -61,7 +60,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -110,7 +109,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { struct bme68x_data data; read_bme680(&data); @@ -136,7 +135,7 @@ static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_accelerometer(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_accelerometer(NX_AZURE_IOT_JSON_WRITER* json_writer) { struct bmi160_sensor_data data; read_bmi160_accel(&data); @@ -156,7 +155,7 @@ static UINT append_device_accelerometer(NX_AZURE_IOT_JSON_WRITER* json_writer, V return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_writer) { struct bmi160_sensor_data data; read_bmi160_gyro(&data); @@ -176,7 +175,7 @@ static UINT append_device_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_light(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_light(NX_AZURE_IOT_JSON_WRITER* json_writer) { double als; @@ -207,59 +206,62 @@ static void set_led_state(bool level) } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -268,17 +270,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -330,9 +338,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -340,21 +348,22 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( &azure_iot_nx_client, DEVICE_INFO_COMPONENT_NAME, append_device_info_properties); printf("\r\nStarting Main loop\r\n"); + while (true) { tx_event_flags_get( @@ -363,19 +372,19 @@ UINT azure_iot_nx_client_entry( switch (telemetry_state) { case TELEMETRY_STATE_DEFAULT: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); break; case TELEMETRY_STATE_ACCELEROMETER: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_accelerometer); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_accelerometer); break; case TELEMETRY_STATE_GYROSCOPE: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_gyroscope); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_gyroscope); break; case TELEMETRY_STATE_LIGHT: - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_light); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_light); break; default: diff --git a/Renesas/RX65N_Cloud_Kit/app/rx_networking.c b/Renesas/RX65N_Cloud_Kit/app/rx_networking.c index 3682e3f0..b9583f17 100644 --- a/Renesas/RX65N_Cloud_Kit/app/rx_networking.c +++ b/Renesas/RX65N_Cloud_Kit/app/rx_networking.c @@ -4,22 +4,26 @@ #include "rx_networking.h" #include "nx_api.h" +#include "nx_driver_rx65n_cloud_kit.h" #include "nx_secure_tls_api.h" -#include "nx_wifi.h" #include "nxd_dns.h" #include -#define THREADX_PACKET_COUNT 60 -#define THREADX_PACKET_SIZE 1536 -#define THREADX_POOL_SIZE ((THREADX_PACKET_SIZE + sizeof(NX_PACKET)) * THREADX_PACKET_COUNT) +#define THREADX_IP_STACK_SIZE 2048 +#define THREADX_PACKET_COUNT 60 +#define THREADX_PACKET_SIZE 1500 +#define THREADX_POOL_SIZE ((THREADX_PACKET_SIZE + sizeof(NX_PACKET)) * THREADX_PACKET_COUNT) +static UCHAR threadx_ip_stack[THREADX_IP_STACK_SIZE]; static UCHAR threadx_ip_pool[THREADX_POOL_SIZE]; NX_IP nx_ip; NX_PACKET_POOL nx_pool; NX_DNS nx_dns_client; +wifi_ip_configuration_t ip_cfg = {0}; + // Print IPv4 address static void print_address(CHAR* preable, uint32_t address) { @@ -66,11 +70,8 @@ static bool wifi_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) return false; } - // checkWifiVersion(); - // Connect to the specified SSID - int32_t wifiConnectCounter = 1; - wifi_ip_configuration_t ip_cfg = {0}; + int32_t wifiConnectCounter = 1; printf("\tConnecting to SSID '%s'\r\n", ssid); while (R_WIFI_SX_ULPGN_Connect(ssid, password, security_mode, 1, &ip_cfg)) { @@ -80,19 +81,6 @@ static bool wifi_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) printf("SUCCESS: WiFi connected to %s\r\n\r\n", ssid); - printf("Initializing DHCP\r\n"); - - if (R_WIFI_SX_ULPGN_GetIpAddress(&ip_cfg) != WIFI_SUCCESS) - { - return false; - } - - // Output IP address and gateway address - print_address("IP address", ip_cfg.ipaddress); - print_address("Gateway", ip_cfg.gateway); - - printf("SUCCESS: DHCP initialized\r\n\r\n"); - return true; } @@ -132,9 +120,7 @@ static UINT dns_create() print_address("DNS address", dns_address_1); // Add an IPv4 server address to the Client list. - status = nx_dns_server_add(&nx_dns_client, - IP_ADDRESS( - dns_address_1 >> 24 & 0xFF, dns_address_1 >> 16 & 0xFF, dns_address_1 >> 8 & 0xFF, dns_address_1 & 0xFF)); + status = nx_dns_server_add(&nx_dns_client, dns_address_1); if (status != NX_SUCCESS) { printf("ERROR: Failed to add DNS server (0x%04x)\r\n", status); @@ -150,6 +136,9 @@ static UINT dns_create() int rx_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) { UINT status; + UCHAR ip_address[4]; + UCHAR ip_mask[4]; + UCHAR gateway_address[4]; // Intialize Wifi if (!wifi_init(ssid, password, mode)) @@ -157,6 +146,16 @@ int rx_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) return NX_NOT_SUCCESSFUL; } + printf("Initializing DHCP\r\n"); + + R_WIFI_SX_ULPGN_GetIpAddress(&ip_cfg); + + // Output IP address and gateway address + print_address("IP address", ip_cfg.ipaddress); + print_address("Gateway", ip_cfg.gateway); + + printf("SUCCESS: DHCP initialized\r\n\r\n"); + // Initialize the NetX system nx_system_initialize(); @@ -170,7 +169,15 @@ int rx_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) } // Create an IP instance - status = nx_ip_create(&nx_ip, "NetX IP Instance 0", 0, 0, &nx_pool, NULL, NULL, 0, 0); + status = nx_ip_create(&nx_ip, + "NetX IP Instance 0", + ip_cfg.ipaddress, + ip_cfg.subnetmask, + &nx_pool, + nx_driver_rx65n_cloud_kit, + (UCHAR*)threadx_ip_stack, + THREADX_IP_STACK_SIZE, + 1); if (status != NX_SUCCESS) { nx_packet_pool_delete(&nx_pool); @@ -178,14 +185,34 @@ int rx_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) return status; } - // Initialize NetX WiFi - status = nx_wifi_initialize(&nx_ip, &nx_pool); + // Set gateway address + status = nx_ip_gateway_address_set(&nx_ip, ip_cfg.gateway); if (status != NX_SUCCESS) { nx_ip_delete(&nx_ip); nx_packet_pool_delete(&nx_pool); - printf("ERROR: WiFi initialize fail.\r\n"); - return status; + printf("THREADX platform initialize fail: Gateway set FAIL.\r\n"); + return false; + } + + // Enable TCP traffic + status = nx_tcp_enable(&nx_ip); + if (status != NX_SUCCESS) + { + nx_ip_delete(&nx_ip); + nx_packet_pool_delete(&nx_pool); + printf("THREADX platform initialize fail: TCP ENABLE FAIL.\r\n"); + return false; + } + + // Enable UDP traffic + status = nx_udp_enable(&nx_ip); + if (status != NX_SUCCESS) + { + nx_ip_delete(&nx_ip); + nx_packet_pool_delete(&nx_pool); + printf("THREADX platform initialize fail: UDP ENABLE FAIL.\r\n"); + return false; } // Initialize TLS diff --git a/Renesas/RX65N_Cloud_Kit/lib/CMakeLists.txt b/Renesas/RX65N_Cloud_Kit/lib/CMakeLists.txt index e5fac38c..f85b9126 100644 --- a/Renesas/RX65N_Cloud_Kit/lib/CMakeLists.txt +++ b/Renesas/RX65N_Cloud_Kit/lib/CMakeLists.txt @@ -1,10 +1,6 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -# Define the CPU architecture for Threadx -set(THREADX_ARCH "rxv2") -set(THREADX_TOOLCHAIN "gnu") - # Define ThreadX user configuration set(TX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/threadx/tx_user.h" CACHE STRING "Enable TX user configuration") @@ -14,14 +10,12 @@ set(NXD_ENABLE_AZURE_IOT ON CACHE BOOL "Enable Azure IoT") set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo") # Azure Security Center -set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE ON CACHE BOOL "Security Center") +set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Module") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) - -# Using a local copy of NetXDuo that has been customized for this boards WiFi module -add_subdirectory(netxduo) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(netx_driver) add_subdirectory(rx_driver_package) diff --git a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/CMakeLists.txt b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/CMakeLists.txt index 9d047e64..3ce80e10 100644 --- a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/CMakeLists.txt +++ b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/CMakeLists.txt @@ -2,7 +2,7 @@ # Licensed under the MIT License. set(SOURCES - src/nx_wifi.c + nx_driver_rx65n_cloud_kit.c ) set(TARGET netx_driver) @@ -13,7 +13,7 @@ add_library(${TARGET} OBJECT target_include_directories(${TARGET} PUBLIC - src + . ) target_link_libraries(${TARGET} diff --git a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSE.txt b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSE.txt deleted file mode 100644 index 76974a36..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSE.txt +++ /dev/null @@ -1,246 +0,0 @@ -MICROSOFT SOFTWARE LICENSE TERMS - -MICROSOFT AZURE RTOS - -Shape - -These license terms are an agreement between you and Microsoft Corporation (or -one of its affiliates). They apply to the software named above and any Microsoft -services or software updates (except to the extent such services or updates are -accompanied by new or additional terms, in which case those different terms -apply prospectively and do not alter your or Microsoft’s rights relating to -pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU -HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. - -INSTALLATION AND USE RIGHTS. - -General. You may install and use the software and the included Microsoft -applications solely for internal development, testing and evaluation purposes. -Any distribution or production use requires a separate license as set forth in -Section 2. - -Contributions. Microsoft welcomes contributions to this software. In the event -that you make a contribution to this software you will be required to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and -actually do, grant Microsoft the rights to use your contribution. For details, -visit https://cla.microsoft.com. - -Included Microsoft Applications. The software includes other Microsoft -applications which are governed by the licenses embedded in or made available -with those applications. - -Third Party Components. The software may include third party components with -separate legal notices or governed by other agreements, as may be described -within the software or in the ThirdPartyNotices file(s) accompanying the -software. - -Competitive Benchmarking. If you are a direct competitor, and you access or use -the software for purposes of competitive benchmarking, analysis, or intelligence -gathering, you waive as against Microsoft, its subsidiaries, and its affiliated -companies (including prospectively) any competitive use, access, and -benchmarking test restrictions in the terms governing your software to the -extent your terms of use are, or purport to be, more restrictive than -Microsoft’s terms. If you do not waive any such purported restrictions in the -terms governing your software, you are not allowed to access or use this -software, and will not do so. - -DISTRIBUTION AND PRODUCTION USE. If you have obtained and/or are developing on -microprocessor(s) and/or microcontroller(s) (“hardware”) listed in the file -named “LICENSED-HARDWARE.txt” included in the repository and/or distributed with -the software you have the following rights in and to the software solely when -used in combination with the hardware. In the event hardware is not listed in -the LICENSED-HARDWARE.txt file, you do not have the rights in this Section 2. - -Distribution and Production Use Rights. - -You may use the software in production (e.g. program the modified or unmodified -software to devices you own or control) and distribute (i.e. make available to -third parties) the modified or unmodified binary image produced from this code. - - -You may permit your device distributors or developers to copy and distribute the -binary image as programmed or to be programmed to your devices. - -You may redistribute the unmodified or modified source to your device -distributors or developers. Modifications must be clearly marked. Any -redistribution in source code form must contain this license and any other -licenses that accompany the software. - -Requirements. For any code you distribute, you must: - -when distributed in binary form, except as embedded in a device, include with -such distribution the terms of this agreement; - -when distributed in source code form to distributors or developers of your -devices, include with such distribution the terms of this agreement; and - -indemnify, defend and hold harmless Microsoft from any claims, including -attorneys’ fees, related to the distribution or use of your devices, except to -the extent that any claim is based solely on the unmodified software. - -Restrictions. You may not: - -use or modify the software to create a competing real time operating system -software; - -remove any copyright notices or licenses contained in the software; - -use Microsoft’s trademarks or trade dress in your application in any way that -suggests your device or application comes from or is endorsed by Microsoft; - -transfer individual components, specific libraries, classes, functions or code -fragments of the software separately for purposes unrelated to the software; or - -use or distribute the software in any way that would subject the software or -Microsoft’s intellectual property or technology to any other license terms. - -SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all -other rights. Unless applicable law gives you more rights despite this -limitation, you will not (and have no right to): - -remove, minimize, block, or modify any notices of Microsoft or its suppliers in -the software; - -use the software in any way that is against the law or to create or propagate -malware; or - -share, publish, distribute, or lease the software (except as permitted in -Section 2 above), or provide the software as a stand-alone offering for others -to use. - -DATA. This software may interact with other Microsoft products that collect data -that is transmitted to Microsoft. To learn more about how Microsoft processes -personal data we collect, please see the Microsoft Privacy Statement at -https://go.microsoft.com/fwlink/?LinkId=248681. - -EXPORT RESTRICTIONS. You must comply with all domestic and international export -laws and regulations that apply to the software, which include restrictions on -destinations, end users, and end use. For further information on export -restrictions, visit https://aka.ms/exporting. - -SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any -support services for the software. Any support provided is “as is”, “with all -faults”, and without warranty of any kind. - -UPDATES. Microsoft may periodically update the software. You may obtain updates -only from Microsoft or Microsoft-authorized sources. Updates may not include or -support all existing software features, services, or peripheral devices. - -TERMINATION. Without prejudice to any other rights, Microsoft may terminate this -agreement if you fail to comply with any of its terms or conditions. In such -event, you must destroy all copies of the software and all of its component -parts. - -ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for -supplements, updates, or third-party applications, is the entire agreement for -the software. To the extent you have entered into a separate agreement with -Microsoft relating specifically to the software, the terms in such agreement -shall control. - -APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in -the United States or Canada, the laws of the state or province where you live -(or, if a business, where your principal place of business is located) govern -the interpretation of this agreement, claims for its breach, and all other -claims (including consumer protection, unfair competition, and tort claims), -regardless of conflict of laws principles. If you acquired the software in any -other country, its laws apply. If U.S. federal jurisdiction exists, you and -Microsoft consent to exclusive jurisdiction and venue in the federal court in -King County, Washington for all disputes heard in court. If not, you and -Microsoft consent to exclusive jurisdiction and venue in the Superior Court of -King County, Washington for all disputes heard in court. - -CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal -rights. You may have other rights, including consumer rights, under the laws of -your state or country. Separate and apart from your relationship with Microsoft, -you may also have rights with respect to the party from which you acquired the -software. This agreement does not change those other rights if the laws of your -state or country do not permit it to do so. For example, if you acquired the -software in one of the below regions, or mandatory country law applies, then the -following provisions apply to you: - -Australia. You have statutory guarantees under the Australian Consumer Law and -nothing in this agreement is intended to affect those rights. - -Germany and Austria. - -i.Warranty. The properly licensed software will perform substantially as -described in any Microsoft materials that accompany the software. However, -Microsoft gives no contractual guarantee in relation to the licensed software. - -ii.Limitation of Liability. In case of intentional conduct, gross negligence, -claims based on the Product Liability Act, as well as, in case of death or -personal or physical injury, Microsoft is liable according to the statutory law. - - -Subject to the foregoing clause ii., Microsoft will only be liable for slight -negligence if Microsoft is in breach of such material contractual obligations, -the fulfillment of which facilitate the due performance of this agreement, the -breach of which would endanger the purpose of this agreement and the compliance -with which a party may constantly trust in (so-called "cardinal obligations"). -In other cases of slight negligence, Microsoft will not be liable for slight -negligence. - -DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF -USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO -THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED -WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND -NON-INFRINGEMENT. - -LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING -DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM -MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT -RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, -INDIRECT, OR INCIDENTAL DAMAGES. - -This limitation applies to (a) anything related to the software, services, -content (including code) on third party Internet sites, or third party -applications; and (b) claims for breach of contract, warranty, guarantee, or -condition; strict liability, negligence, or other tort; or any other claim; in -each case to the extent permitted by applicable law. - -It also applies even if Microsoft knew or should have known about the -possibility of the damages. The above limitation or exclusion may not apply to -you because your state, province, or country may not allow the exclusion or -limitation of incidental, consequential, or other damages. - - - -Please note: As this software is distributed in Canada, some of the clauses in -this agreement are provided below in French. - -Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce -contrat sont fournies ci-dessous en français. - -EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel -». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft -n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits -additionnels en vertu du droit local sur la protection des consommateurs, que ce -contrat ne peut modifier. La ou elles sont permises par le droit locale, les -garanties implicites de qualité marchande, d’adéquation à un usage particulier -et d’absence de contrefaçon sont exclues. - -LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES -DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une -indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous -ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris -les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. - -Cette limitation concerne: - -•tout ce qui est relié au logiciel, aux services ou au contenu (y compris le -code) figurant sur des sites Internet tiers ou dans des programmes tiers; et - -•les réclamations au titre de violation de contrat ou de garantie, ou au titre -de responsabilité stricte, de négligence ou d’une autre faute dans la limite -autorisée par la loi en vigueur. - -Elle s’applique également, même si Microsoft connaissait ou devrait connaître -l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la -limitation de responsabilité pour les dommages indirects, accessoires ou de -quelque nature que ce soit, il se peut que la limitation ou l’exclusion -ci-dessus ne s’appliquera pas à votre égard. - -EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous -pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent -contrat ne modifie pas les droits que vous confèrent les lois de votre pays si -celles-ci ne le permettent pas. \ No newline at end of file diff --git a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSED-HARDWARE.txt b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSED-HARDWARE.txt deleted file mode 100644 index 77dd1abf..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/LICENSED-HARDWARE.txt +++ /dev/null @@ -1,16 +0,0 @@ -LICENSED HARDWARE LIST - -Last Updated: 2020-05-08 - -Microsoft has entered into OEM Agreements with manufacturers of the following -microprocessors and microcontrollers (the “hardware”) to enable those -manufacturers to include and distribute Azure RTOS in certain hardware. If you -have obtained and/or are developing on microprocessor(s) and/or -microcontroller(s) (“hardware”) listed below you inherit the “Distribution and -Production Use” rights in Section 2 of the Microsoft Software License Terms for -Microsoft Azure RTOS. If hardware is not listed below, you do not have those -rights. - --------------------------------------------------------------------------------- - -More coming soon. Please check back frequently for updates. \ No newline at end of file diff --git a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.c b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.c new file mode 100644 index 00000000..260c75fe --- /dev/null +++ b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.c @@ -0,0 +1,1692 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) Microsoft Corporation. All rights reserved. */ +/* */ +/* This software is licensed under the Microsoft Software License */ +/* Terms for Microsoft Azure RTOS. Full text of the license can be */ +/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ +/* and in the root directory of this software. */ +/* */ +/**************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** NetX Component */ +/** */ +/** Ethernet driver for RX65N Cloud Kit family of microprocessors */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Indicate that driver source is being compiled. */ + +#include "nx_driver_rx65n_cloud_kit.h" + +#ifndef NX_ENABLE_TCPIP_OFFLOAD +#error "NX_ENABLE_TCPIP_OFFLOAD must be defined to use this driver" +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + +#ifndef NX_DRIVER_IP_MTU +#define NX_DRIVER_IP_MTU 1500 +#endif /* NX_DRIVER_IP_MTU */ + +#ifndef NX_DRIVER_RECEIVE_QUEUE_SIZE +#define NX_DRIVER_RECEIVE_QUEUE_SIZE 10 +#endif /* NX_DRIVER_RECEIVE_QUEUE_SIZE */ + +#ifndef NX_DRIVER_STACK_SIZE +#define NX_DRIVER_STACK_SIZE 1024 +#endif /* NX_DRIVER_STACK_SIZE */ + +/* Interval to receive packets when there is no packet. The default value is 100 ticks which is 1s. */ +#ifndef NX_DRIVER_THREAD_INTERVAL +#define NX_DRIVER_THREAD_INTERVAL NX_IP_PERIODIC_RATE +#endif /* NX_DRIVER_THREAD_INTERVAL */ + +/* Define the maximum sockets at the same time. This is limited by hardware TCP/IP on RX65N. */ +#define NX_DRIVER_SOCKETS_MAXIMUM 4 + +/* Define the maximum wait timeout in ms for socket send. This is limited by hardware TCP/IP on RX65N. */ +#define NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM 3000 + +#define NX_DRIVER_CAPABILITY (NX_INTERFACE_CAPABILITY_TCPIP_OFFLOAD) + + +/* Define basic netword driver information typedef. */ + +typedef struct NX_DRIVER_INFORMATION_STRUCT +{ + + /* NetX IP instance that this driver is attached to. */ + NX_IP *nx_driver_information_ip_ptr; + + /* Driver's current states. */ + ULONG nx_driver_information_states; + + /* Packet pool used for receiving packets. */ + NX_PACKET_POOL *nx_driver_information_packet_pool_ptr; + + /* Define the driver interface association. */ + NX_INTERFACE *nx_driver_information_interface; +} NX_DRIVER_INFORMATION; + + +/* Define socket structure for hardware TCP/IP. */ + +typedef struct NX_DRIVER_SOCKET_STRUCT +{ + VOID *socket_ptr; + UINT protocol; + ULONG local_ip; + ULONG remote_ip; + USHORT local_port; + USHORT remote_port; + UINT socket_id; +} NX_DRIVER_SOCKET; + +static NX_DRIVER_INFORMATION nx_driver_information; +static NX_DRIVER_SOCKET nx_driver_sockets[NX_DRIVER_SOCKETS_MAXIMUM]; +static TX_THREAD nx_driver_thread; +static UCHAR nx_driver_thread_stack[NX_DRIVER_STACK_SIZE]; + +/* Define the routines for processing each driver entry request. The contents of these routines will change with + each driver. However, the main driver entry function will not change, except for the entry function name. */ + +static VOID _nx_driver_interface_attach(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_initialize(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_enable(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_disable(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_multicast_join(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_multicast_leave(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_get_status(NX_IP_DRIVER *driver_req_ptr); +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +static VOID _nx_driver_capability_get(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_capability_set(NX_IP_DRIVER *driver_req_ptr); +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ +static VOID _nx_driver_deferred_processing(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_thread_entry(ULONG thread_input); +static UINT _nx_driver_tcpip_handler(struct NX_IP_STRUCT *ip_ptr, + struct NX_INTERFACE_STRUCT *interface_ptr, + VOID *socket_ptr, UINT operation, NX_PACKET *packet_ptr, + NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip, + UINT local_port, UINT *remote_port, UINT wait_option); + +/* Define the prototypes for the hardware implementation of this driver. The contents of these routines are + driver-specific. */ + +static UINT _nx_driver_hardware_initialize(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_enable(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_disable(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_get_status(NX_IP_DRIVER *driver_req_ptr); +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +static UINT _nx_driver_hardware_capability_set(NX_IP_DRIVER *driver_req_ptr); +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* nx_driver_rx65n_cloud_kit PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This is the entry point of the NetX Driver. This driver */ +/* function is responsible for initializing the network controller, */ +/* enabling or disabling the controller as need, preparing */ +/* a packet for transmission, and getting status information. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr The driver request from the */ +/* IP layer. */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_interface_attach Process attach request */ +/* _nx_driver_initialize Process initialize request */ +/* _nx_driver_enable Process link enable request */ +/* _nx_driver_disable Process link disable request */ +/* _nx_driver_multicast_join Process multicast join request*/ +/* _nx_driver_multicast_leave Process multicast leave req */ +/* _nx_driver_get_status Process get status request */ +/* _nx_driver_deferred_processing Drive deferred processing */ +/* _nx_driver_capability_get Get interface capability */ +/* _nx_driver_capability_set Set interface capability */ +/* */ +/* CALLED BY */ +/* */ +/* IP layer */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +VOID nx_driver_rx65n_cloud_kit(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Process according to the driver request type in the IP control + block. */ + switch (driver_req_ptr -> nx_ip_driver_command) + { + + case NX_LINK_INTERFACE_ATTACH: + { + /* Process link interface attach requests. */ + _nx_driver_interface_attach(driver_req_ptr); + break; + } + + case NX_LINK_INITIALIZE: + { + + /* Process link initialize requests. */ + _nx_driver_initialize(driver_req_ptr); + break; + } + + case NX_LINK_ENABLE: + { + + /* Process link enable requests. */ + _nx_driver_enable(driver_req_ptr); + break; + } + + case NX_LINK_DISABLE: + { + + /* Process link disable requests. */ + _nx_driver_disable(driver_req_ptr); + break; + } + + + case NX_LINK_ARP_SEND: + case NX_LINK_ARP_RESPONSE_SEND: + case NX_LINK_PACKET_BROADCAST: + case NX_LINK_RARP_SEND: + case NX_LINK_PACKET_SEND: + { + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + nx_packet_transmit_release(driver_req_ptr -> nx_ip_driver_packet); + break; + } + + + case NX_LINK_MULTICAST_JOIN: + { + + /* Process multicast join requests. */ + _nx_driver_multicast_join(driver_req_ptr); + break; + } + + + case NX_LINK_MULTICAST_LEAVE: + { + + /* Process multicast leave requests. */ + _nx_driver_multicast_leave(driver_req_ptr); + break; + } + + case NX_LINK_GET_STATUS: + { + + /* Process get status requests. */ + _nx_driver_get_status(driver_req_ptr); + break; + } + + case NX_LINK_DEFERRED_PROCESSING: + { + + /* Process driver deferred requests. */ + + /* Process a device driver function on behave of the IP thread. */ + _nx_driver_deferred_processing(driver_req_ptr); + + break; + } + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY + case NX_INTERFACE_CAPABILITY_GET: + { + + /* Process get capability requests. */ + _nx_driver_capability_get(driver_req_ptr); + break; + } + + case NX_INTERFACE_CAPABILITY_SET: + { + + /* Process set capability requests. */ + _nx_driver_capability_set(driver_req_ptr); + break; + } +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + default: + + + /* Invalid driver request. */ + + /* Return the unhandled command status. */ + driver_req_ptr -> nx_ip_driver_status = NX_UNHANDLED_COMMAND; + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_interface_attach PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the interface attach request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_interface_attach(NX_IP_DRIVER *driver_req_ptr) +{ +#ifdef NX_ENABLE_INTERFACE_CAPABILITY + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_capability_flag = NX_DRIVER_CAPABILITY; +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + /* Return successful status. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_initialize PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the initialize request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_initialize. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_initialize Process initialize request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_initialize(NX_IP_DRIVER *driver_req_ptr) +{ + +NX_IP *ip_ptr; +NX_INTERFACE *interface_ptr; +UINT status; + + /* Setup the driver state to not initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_NOT_INITIALIZED; + + /* Setup the IP pointer from the driver request. */ + ip_ptr = driver_req_ptr -> nx_ip_driver_ptr; + + /* Setup interface pointer. */ + interface_ptr = driver_req_ptr -> nx_ip_driver_interface; + + /* Initialize the driver's information structure. */ + + /* Default IP pointer to NULL. */ + nx_driver_information.nx_driver_information_ip_ptr = NX_NULL; + + /* Setup the default packet pool for the driver's received packets. */ + nx_driver_information.nx_driver_information_packet_pool_ptr = ip_ptr -> nx_ip_default_packet_pool; + + /* Call the hardware-specific ethernet controller initialization. */ + status = _nx_driver_hardware_initialize(driver_req_ptr); + + /* Determine if the request was successful. */ + if (status == NX_SUCCESS) + { + + /* Successful hardware initialization. */ + + /* Setup driver information to point to IP pointer. */ + nx_driver_information.nx_driver_information_ip_ptr = ip_ptr; + nx_driver_information.nx_driver_information_interface = interface_ptr; + + /* Setup the link maximum transfer unit. */ + interface_ptr -> nx_interface_ip_mtu_size = NX_DRIVER_IP_MTU; + + /* Setup the physical address of this IP instance. */ + /* TODO: Use WIFI_GetMAC_Address() to set the real value. */ + interface_ptr -> nx_interface_physical_address_msw = 0; + interface_ptr -> nx_interface_physical_address_lsw = 0; + + /* Indicate to the IP software that IP to physical mapping + is required. */ + interface_ptr -> nx_interface_address_mapping_needed = NX_FALSE; + + /* Move the driver's state to initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_INITIALIZED; + + /* Indicate successful initialize. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } + else + { + + /* Initialization failed. Indicate that the request failed. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_enable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the initialize request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_enable. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_enable Process enable request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_enable(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + /* See if we can honor the NX_LINK_ENABLE request. */ + if (nx_driver_information.nx_driver_information_states < NX_DRIVER_STATE_INITIALIZED) + { + + /* Mark the request as not successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + return; + } + + /* Check if it is enabled by someone already */ + if (nx_driver_information.nx_driver_information_states >= NX_DRIVER_STATE_LINK_ENABLED) + { + + /* Yes, the request has already been made. */ + driver_req_ptr -> nx_ip_driver_status = NX_ALREADY_ENABLED; + return; + } + + /* Call hardware specific enable. */ + status = _nx_driver_hardware_enable(driver_req_ptr); + + /* Was the hardware enable successful? */ + if (status == NX_SUCCESS) + { + + /* Update the driver state to link enabled. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_LINK_ENABLED; + + /* Mark request as successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Mark the IP interface as link up. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_link_up = NX_TRUE; + + /* Set TCP/IP callback function. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_tcpip_offload_handler = _nx_driver_tcpip_handler; + } + else + { + + /* Enable failed. Indicate that the request failed. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_disable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the disable request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_disable. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_disable Process disable request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_disable(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + /* Check if the link is enabled. */ + if (nx_driver_information.nx_driver_information_states != NX_DRIVER_STATE_LINK_ENABLED) + { + + /* The link is not enabled, so just return an error. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + return; + } + + /* Call hardware specific disable. */ + status = _nx_driver_hardware_disable(driver_req_ptr); + + /* Was the hardware disable successful? */ + if (status == NX_SUCCESS) + { + + /* Mark the IP interface as link down. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_link_up = NX_FALSE; + + /* Update the driver state back to initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_INITIALIZED; + + /* Mark request as successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Clear the TCP/IP callback function. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_tcpip_offload_handler = NX_NULL; + } + else + { + + /* Disable failed, return an error. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_multicast_join PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the multicast join request. The processing */ +/* in this function is generic. All ethernet controller multicast join */ +/* logic is to be placed in _nx_driver_hardware_multicast_join. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_multicast_join(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Not supported. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_multicast_leave PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the multicast leave request. The */ +/* processing in this function is generic. All ethernet controller */ +/* multicast leave logic is to be placed in */ +/* _nx_driver_hardware_multicast_leave. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_multicast_leave(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Not supported. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_get_status PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the get status request. The processing */ +/* in this function is generic. All ethernet controller get status */ +/* logic is to be placed in _nx_driver_hardware_get_status. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_get_status Process get status request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_get_status(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + + /* Call hardware specific get status function. */ + status = _nx_driver_hardware_get_status(driver_req_ptr); + + /* Determine if there was an error. */ + if (status != NX_SUCCESS) + { + + /* Indicate an unsuccessful request. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } + else + { + + /* Indicate the request was successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } +} + + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_capability_get PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the get capability request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_capability_get(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Return the capability of the Ethernet controller. */ + *(driver_req_ptr -> nx_ip_driver_return_ptr) = NX_DRIVER_CAPABILITY; + + /* Return the success status. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_capability_set PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the set capability request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_capability_set(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + + /* Call hardware specific get status function. */ + status = _nx_driver_hardware_capability_set(driver_req_ptr); + + /* Determine if there was an error. */ + if (status != NX_SUCCESS) + { + + /* Indicate an unsuccessful request. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } + else + { + + /* Indicate the request was successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } +} +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_deferred_processing PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the deferred ISR action within the context */ +/* of the IP thread. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_deferred_processing(NX_IP_DRIVER *driver_req_ptr) +{ +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_thread_entry PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function is the driver thread entry. In this thread, it */ +/* performs checking for incoming TCP and UDP packets. On new packet, */ +/* it will be passed to NetX. */ +/* */ +/* INPUT */ +/* */ +/* thread_input Thread input */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* tx_mutex_get Obtain protection mutex */ +/* tx_mutex_put Release protection mutex */ +/* tx_thread_sleep Sleep driver thread */ +/* nx_packet_allocate Allocate a packet for incoming*/ +/* TCP and UDP data */ +/* _nx_tcp_socket_driver_packet_receive Receive TCP packet */ +/* _nx_tcp_socket_driver_establish Establish TCP connection */ +/* _nx_udp_socket_driver_packet_receive Receive UDP packet */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_thread_entry(ULONG thread_input) +{ +UINT i; +NX_PACKET *packet_ptr; +UINT packet_type; +UINT status; +NXD_ADDRESS local_ip; +NXD_ADDRESS remote_ip; +uint16_t data_length; +int32_t size; +NX_IP *ip_ptr = nx_driver_information.nx_driver_information_ip_ptr; +NX_INTERFACE *interface_ptr = nx_driver_information.nx_driver_information_interface; +NX_PACKET_POOL *pool_ptr = nx_driver_information.nx_driver_information_packet_pool_ptr; + + NX_PARAMETER_NOT_USED(thread_input); + + for (;;) + { + + /* Obtain the IP internal mutex before processing the IP event. */ + tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); + + /* Loop through TCP socket. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if ((nx_driver_sockets[i].socket_ptr == NX_NULL) || + (nx_driver_sockets[i].remote_port == 0)) + { + + /* Skip sockets not used. */ + continue; + } + + + /* Set packet type. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + packet_type = NX_TCP_PACKET; + } + else + { + packet_type = NX_UDP_PACKET; + } + + /* Loop to receive all data on current socket. */ + for (;;) + { + if (nx_packet_allocate(pool_ptr, &packet_ptr, packet_type, NX_NO_WAIT)) + { + + /* Packet not available. */ + break; + } + + /* Get available size of packet. */ + data_length = (uint16_t)(packet_ptr -> nx_packet_data_end - packet_ptr -> nx_packet_prepend_ptr); + + /* Receive data without suspending. */ + size = R_WIFI_SX_ULPGN_ReceiveSocket(nx_driver_sockets[i].socket_id, + (uint8_t*)(packet_ptr -> nx_packet_prepend_ptr), + data_length, 10); + + if (size < 0) + { + + /* Connection error. Notify upper layer with Null packet. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + _nx_tcp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, NX_NULL); + } + else + { + _nx_udp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, NX_NULL, + NX_NULL, NX_NULL, 0); + } + nx_packet_release(packet_ptr); + break; + } + + if (size == 0) + { + + /* No incoming data. */ + nx_packet_release(packet_ptr); + break; + } + + /* Set packet length. */ + packet_ptr -> nx_packet_length = (ULONG)size; + packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + size; + packet_ptr -> nx_packet_ip_interface = interface_ptr; + + /* Pass it to NetXDuo. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + _nx_tcp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, packet_ptr); + } + else + { + /* Convert IP version. */ + remote_ip.nxd_ip_version = NX_IP_VERSION_V4; + remote_ip.nxd_ip_address.v4 = nx_driver_sockets[i].remote_ip; + local_ip.nxd_ip_version = NX_IP_VERSION_V4; + local_ip.nxd_ip_address.v4 = nx_driver_sockets[i].local_ip; + + _nx_udp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, + packet_ptr, &local_ip, &remote_ip, + nx_driver_sockets[i].remote_port); + } + } + } + + /* Release the IP internal mutex before processing the IP event. */ + tx_mutex_put(&(ip_ptr -> nx_ip_protection)); + + /* Sleep some ticks to next loop. */ + tx_thread_sleep(NX_DRIVER_THREAD_INTERVAL); + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_tcpip_handler PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the TCP/IP request. */ +/* */ +/* INPUT */ +/* */ +/* ip_ptr Pointer to IP */ +/* interface_ptr Pointer to interface */ +/* socket_ptr Pointer to TCP or UDP socket */ +/* operation Operation of TCP/IP request */ +/* packet_ptr Pointer to packet */ +/* local_ip Pointer to local IP address */ +/* remote_ip Pointer to remote IP address */ +/* local_port Local socket port */ +/* remote_port Remote socket port */ +/* wait_option Wait option in ticks */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* nx_packet_transmit_release Release transmittion packet */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_tcpip_handler(struct NX_IP_STRUCT *ip_ptr, + struct NX_INTERFACE_STRUCT *interface_ptr, + VOID *socket_ptr, UINT operation, NX_PACKET *packet_ptr, + NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip, + UINT local_port, UINT *remote_port, UINT wait_option) +{ +UINT status = NX_NOT_SUCCESSFUL; +UCHAR remote_ip_bytes[4]; +NX_PACKET *current_packet; +ULONG packet_size; +ULONG offset; +uint16_t sent_size; +UINT i; +int32_t socket_id; + + if ((operation == NX_TCPIP_OFFLOAD_TCP_CLIENT_SOCKET_CONNECT) || + (operation == NX_TCPIP_OFFLOAD_UDP_SOCKET_BIND)) + { + + /* Find a socket that is not used. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if (nx_driver_sockets[i].socket_ptr == NX_NULL) + { + + /* Find an empty entry. */ + nx_driver_sockets[i].socket_ptr = socket_ptr; + break; + } + } + + if (i == NX_DRIVER_SOCKETS_MAXIMUM) + { + + /* No more entries. */ + return(NX_NO_MORE_ENTRIES); + } + } + + switch (operation) + { + case NX_TCPIP_OFFLOAD_TCP_CLIENT_SOCKET_CONNECT: + /* Store the index of driver socket. */ + ((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context = (VOID *)i; + + /* Create the socket. */ + socket_id = R_WIFI_SX_ULPGN_CreateSocket(WIFI_SOCKET_IP_PROTOCOL_TCP, WIFI_SOCKET_IP_VERSION_4); + if (socket_id < 0) + { + return(NX_NOT_SUCCESSFUL); + } + + /* Set the socket id. */ + nx_driver_sockets[i].socket_id = socket_id; + + /* Connect. */ + status = R_WIFI_SX_ULPGN_ConnectSocket(nx_driver_sockets[i].socket_id, remote_ip -> nxd_ip_address.v4, *remote_port, NULL); + + if (status) + { + return(NX_NOT_SUCCESSFUL); + } + + /* Store address and port. */ + nx_driver_sockets[i].remote_ip = remote_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].local_port = local_port; + nx_driver_sockets[i].remote_port = *remote_port; + nx_driver_sockets[i].protocol = NX_PROTOCOL_TCP; + + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_TCP_SOCKET_DISCONNECT: + i = (UINT)(((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context); + if (nx_driver_sockets[i].remote_port) + { + + /* Disconnect. */ + status = R_WIFI_SX_ULPGN_CloseSocket(nx_driver_sockets[i].socket_id); + } + + /* Reset socket to free this entry. */ + nx_driver_sockets[i].socket_ptr = NX_NULL; + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_BIND: + /* Note, send data from one port to multiple remotes are not supported. */ + /* Store the index of driver socket. */ + ((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context = (VOID *)i; + + /* Reset the remote port to indicate the socket is not connected yet. */ + nx_driver_sockets[i].remote_port = 0; + +#ifdef NX_DEBUG + printf("UDP socket %u bind to port: %u\r\n", i, local_port); +#endif + + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_UNBIND: + i = (UINT)(((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context); + + if (nx_driver_sockets[i].remote_port) + { + + /* Disconnect. */ + status = R_WIFI_SX_ULPGN_CloseSocket(i); + +#ifdef NX_DEBUG + printf("UDP socket %u unbind port: %u\r\n", i, local_port); +#endif + } + + /* Reset socket to free this entry. */ + nx_driver_sockets[i].socket_ptr = NX_NULL; + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_SEND: + i = (UINT)(((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context); + if (nx_driver_sockets[i].remote_port == 0) + { + /* Create the socket. */ + socket_id = R_WIFI_SX_ULPGN_CreateSocket(WIFI_SOCKET_IP_PROTOCOL_UDP, WIFI_SOCKET_IP_VERSION_4); + + + if (socket_id < 0) + { + return(NX_NOT_SUCCESSFUL); + } + + /* Set the socket id. */ + nx_driver_sockets[i].socket_id = socket_id; + } + + /* Connect. */ + status = R_WIFI_SX_ULPGN_ConnectSocket(nx_driver_sockets[i].socket_id, + remote_ip -> nxd_ip_address.v4, *remote_port, NULL); + + /* Check status. */ + if(status) + { + return(NX_NOT_SUCCESSFUL); + } + +#ifdef NX_DEBUG + printf("UDP socket %u connect to: %u.%u.%u.%u:%u\r\n", + i, remote_ip_bytes[0], remote_ip_bytes[1], + remote_ip_bytes[2], remote_ip_bytes[3], *remote_port); +#endif + + /* Store address and port. */ + nx_driver_sockets[i].local_ip = local_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].remote_ip = remote_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].local_port = local_port; + nx_driver_sockets[i].remote_port = *remote_port; + nx_driver_sockets[i].protocol = NX_PROTOCOL_UDP; + + /* Convert wait option from ticks to ms. */ + if (wait_option > (NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM / 1000 * NX_IP_PERIODIC_RATE)) + { + wait_option = NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM; + } + else + { + wait_option = wait_option / NX_IP_PERIODIC_RATE * 1000; + } + + sent_size = R_WIFI_SX_ULPGN_SendSocket(nx_driver_sockets[i].socket_id, + packet_ptr->nx_packet_prepend_ptr, + (uint16_t)(packet_ptr -> nx_packet_length), + wait_option); + + /* Check status. */ + if (sent_size != packet_ptr -> nx_packet_length) + { + return (NX_NOT_SUCCESSFUL); + } + + /* Release the packet. */ + nx_packet_transmit_release(packet_ptr); + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_TCP_SOCKET_SEND: + i = (UINT)(((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context); + + /* Initialize the current packet to the input packet pointer. */ + current_packet = packet_ptr; + offset = 0; + + /* Convert wait option from ticks to ms. */ + if (wait_option > (NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM / 1000 * NX_IP_PERIODIC_RATE)) + { + wait_option = NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM; + } + else + { + wait_option = wait_option / NX_IP_PERIODIC_RATE * 1000; + } + + /* Loop to send the packet. */ + while(current_packet) + { + /* Calculate current packet size. */ + packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); + packet_size -= offset; + + /* Limit the data size to NX_DRIVER_IP_MTU due to underlayer limitation. */ + if (packet_size > NX_DRIVER_IP_MTU) + { + packet_size = NX_DRIVER_IP_MTU; + } + + /* Send data. */ + sent_size = R_WIFI_SX_ULPGN_SendSocket(nx_driver_sockets[i].socket_id, + (uint8_t *)current_packet-> nx_packet_prepend_ptr + offset, + packet_size, + wait_option); + + /* Check status. */ + if (sent_size != packet_size) + { + return (NX_NOT_SUCCESSFUL); + } + + /* Calculate current packet size. */ + packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); + + if ((sent_size + offset) < packet_size) + { + + /* Partial data sent. Increase the offset. */ + offset += sent_size; + } + else + { + + /* Data in current packet are all sent. */ + offset = 0; + +#ifndef NX_DISABLE_PACKET_CHAIN + /* We have crossed the packet boundary. Move to the next packet structure. */ + current_packet = current_packet -> nx_packet_next; +#else + /* End of the loop. */ + current_packet = NX_NULL; +#endif /* NX_DISABLE_PACKET_CHAIN */ + } + } + + /* Release the packet. */ + nx_packet_transmit_release(packet_ptr); + + status = NX_SUCCESS; + break; + + default: + break; + } + + return(status); +} + + +/****** DRIVER SPECIFIC ****** Start of part/vendor specific internal driver functions. */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_initialize PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific initialization. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_info_get Get thread information */ +/* tx_thread_create Create driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_initialize Driver initialize processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_initialize(NX_IP_DRIVER *driver_req_ptr) +{ +UINT status; +UINT priority = 0; + + /* Get priority of IP thread. */ + tx_thread_info_get(tx_thread_identify(), NX_NULL, NX_NULL, NX_NULL, &priority, + NX_NULL, NX_NULL, NX_NULL, NX_NULL); + + /* Create the driver thread. */ + /* The priority of network thread is lower than IP thread. */ + status = tx_thread_create(&nx_driver_thread, "Driver Thread", _nx_driver_thread_entry, 0, + nx_driver_thread_stack, NX_DRIVER_STACK_SIZE, + priority + 1, priority + 1, + TX_NO_TIME_SLICE, TX_DONT_START); + + /* Return success! */ + return(status); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_enable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific link enable requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_reset Reset driver thread */ +/* tx_thread_resume Resume driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_enable Driver link enable processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_enable(NX_IP_DRIVER *driver_req_ptr) +{ + tx_thread_reset(&nx_driver_thread); + tx_thread_resume(&nx_driver_thread); + + /* Return success! */ + return(NX_SUCCESS); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_disable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific link disable requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_suspend Suspend driver thread */ +/* tx_thread_terminate Terminate driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_disable Driver link disable processing*/ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_disable(NX_IP_DRIVER *driver_req_ptr) +{ +UINT i; + + /* Reset all sockets. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if (nx_driver_sockets[i].socket_ptr) + { + + /* Disconnect. */ + R_WIFI_SX_ULPGN_CloseSocket(nx_driver_sockets[i].socket_id); + nx_driver_sockets[i].socket_ptr = NX_NULL; + } + } + + tx_thread_suspend(&nx_driver_thread); + tx_thread_terminate(&nx_driver_thread); + + /* Return success! */ + return(NX_SUCCESS); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_get_status PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific get status requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR]*/ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_get_status Driver get status processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_get_status(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Return success. */ + return(NX_SUCCESS); +} + + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_capability_set PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific capability set requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_capability_set Capability set processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_capability_set(NX_IP_DRIVER *driver_req_ptr) +{ + + return NX_SUCCESS; +} +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + +/****** DRIVER SPECIFIC ****** Start of part/vendor specific internal driver functions. */ + diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_wifi.h b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.h similarity index 53% rename from STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_wifi.h rename to Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.h index f1db24c5..b60fc49d 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_wifi.h +++ b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/nx_driver_rx65n_cloud_kit.h @@ -15,39 +15,39 @@ /** */ /** NetX Component */ /** */ -/** NetX Porting layer for STM32L4XX */ +/** Ethernet driver for RX65N Cloud Kit family of microprocessors */ /** */ /**************************************************************************/ /**************************************************************************/ -#ifndef _NX_WIFI_H_ -#define _NX_WIFI_H_ -#ifdef __cplusplus - extern "C" { +#ifndef NX_DRIVER_RX65N_CLOUD_KIT_H +#define NX_DRIVER_RX65N_CLOUD_KIT_H + + +#ifdef __cplusplus + +/* Yes, C++ compiler is present. Use standard C. */ +extern "C" { #endif +#include #include "nx_api.h" - -#define WIFI_RECEIVE_QUEUE_SIZE 10 - -UINT nx_wifi_initialize(NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool); -UINT nx_wifi_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option); -UINT nx_wifi_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_wifi_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT nx_wifi_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_wifi_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_wifi_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT nx_wifi_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT nx_wifi_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); - -#ifdef __cplusplus -} -#endif -#endif /* _WIFI_H_ */ +#define NX_DRIVER_STATE_NOT_INITIALIZED 1 +#define NX_DRIVER_STATE_INITIALIZE_FAILED 2 +#define NX_DRIVER_STATE_INITIALIZED 3 +#define NX_DRIVER_STATE_LINK_ENABLED 4 + +#define NX_DRIVER_ERROR 90 + +/* Define global driver entry function. */ + +VOID nx_driver_rx65n_cloud_kit(NX_IP_DRIVER *driver_req_ptr); + +#ifdef __cplusplus +/* Yes, C++ compiler is present. Use standard C. */ + } +#endif +#endif diff --git a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/src/nx_wifi.c b/Renesas/RX65N_Cloud_Kit/lib/netx_driver/src/nx_wifi.c deleted file mode 100644 index 5b73cf43..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netx_driver/src/nx_wifi.c +++ /dev/null @@ -1,1698 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** NetX Porting layer for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#include - -#include "tx_api.h" -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - -#include - -///// -#define WIFI_PAYLOAD_SIZE (1536u) - - -#define WIFI_STATUS_OK (0u) - -#define WIFI_TIMEOUT 30000 - -#define WIFI_TRANSPORT_TIMEOUT 30000 - -///// - -#define WIFI_WRITE_TIMEOUT 100 -#define WIFI_READ_TIMEOUT 100 - -#ifndef WIFI_THREAD_PERIOD -#define WIFI_THREAD_PERIOD 100 -#endif /* WIFI_THREAD_PERIOD */ - -/* Define the default thread priority, stack size, etc. The user can override this - via -D command line option or via project settings. */ - -#ifndef NX_WIFI_STACK_SIZE -#define NX_WIFI_STACK_SIZE (1024) -#endif /* NX_WIFI_STACK_SIZE */ - -#ifndef NX_WIFI_THREAD_PRIORITY -#define NX_WIFI_THREAD_PRIORITY (1) -#endif /* NX_WIFI_THREAD_PRIORITY */ - -/* Define the stack for X-WARE WIFI. */ -static UCHAR nx_wifi_thread_stack[NX_WIFI_STACK_SIZE]; - -/* Define the prototypes for X-WARE. */ -static TX_THREAD nx_wifi_thread; -static NX_PACKET_POOL *nx_wifi_pool; -static NX_IP *nx_wifi_ip; - -/* Define the socket type, TCP socket or UDP socket. */ -#define NX_WIFI_TCP_SOCKET 0 -#define NX_WIFI_UDP_SOCKET 1 - -/* Reserve some packets for applications, such as HTTP, etc. */ -#ifndef NX_WIFI_PACKET_RESERVED -#define NX_WIFI_PACKET_RESERVED 1 -#endif /* NX_WIFI_PACKET_RESERVED */ - -/* Define the WIFI socket structure. */ -typedef struct NX_WIFI_SOCKET_STRUCT -{ - - /* Define socket pointer. */ - VOID *nx_wifi_socket_ptr; - - /* Define socket flag. */ - CHAR nx_wifi_socket_valid; - - /* Define socket type. TCP or UDP. */ - CHAR nx_wifi_socket_type; - - /* Define the connected flag. */ - CHAR nx_wifi_socket_connected; - - /* Reserved. */ - CHAR reserved; - - /* Define the deferred packet processing queue. */ - NX_PACKET *nx_wifi_received_packet_head, - *nx_wifi_received_packet_tail; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Define the UDP connected IP and port. */ - ULONG nx_wifi_udp_socket_connect_ip; - UINT nx_wifi_udp_socket_connect_port; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - int32_t socket_id; - -} NX_WIFI_SOCKET; - -#ifndef NX_WIFI_SOCKET_COUNTER -#define NX_WIFI_SOCKET_COUNTER 4 -#endif /* NX_WIFI_SOCKET_COUNTER */ - -/* Define the TCP socket and UDP socket. */ -static NX_WIFI_SOCKET nx_wifi_socket[NX_WIFI_SOCKET_COUNTER]; - -/* Define the SOCKET ID. */ -static CHAR nx_wifi_socket_counter; - -/* Define the buffer to receive data from wifi. */ -static CHAR nx_wifi_buffer[WIFI_PAYLOAD_SIZE]; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - -/* Define the wifi IP address. */ -static ULONG nx_wifi_ip_address = 0; - -/* Define the buffer to build fake IP header and TCP/UDP header. - IP Header: 20 bytes, TCP header: 20 bytes. */ -static CHAR nx_wifi_ip_buffer[40]; - -/* Define the ip packet filter. */ -static UINT nx_wifi_ip_packet_filter(ULONG source_ip, ULONG destination_ip, - ULONG source_port, ULONG destination_port, - ULONG protocol, ULONG packet_length, UINT direction); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -/* Define the wifi thread. */ -static void nx_wifi_thread_entry(ULONG thread_input); - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the NetX Wifi. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* packet_pool Packet pool pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_initialize(NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool) -{ - -UINT status; - - - /* Set the IP. */ - nx_wifi_ip = ip_ptr; - - /* Set the pool. */ - nx_wifi_pool = packet_pool; - - /* Initialize the wifi. */ - memset(nx_wifi_socket, 0, (NX_WIFI_SOCKET_COUNTER * sizeof(NX_WIFI_SOCKET))); - - /* Initialize the socket id. */ - nx_wifi_socket_counter = 0; - - /* Create the wifi thread. */ - status = tx_thread_create(&nx_wifi_thread, "Wifi Thread", nx_wifi_thread_entry, 0, - nx_wifi_thread_stack, NX_WIFI_STACK_SIZE, - NX_WIFI_THREAD_PRIORITY, NX_WIFI_THREAD_PRIORITY, TX_NO_TIME_SLICE, TX_AUTO_START); - - /* Check for thread create errors. */ - if (status) - return(status); - - return(NX_SUCCESS); -} - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_thread_entry PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function is the entry point for NetX Wifi helper thread. The */ -/* Wifi helper thread is responsible for receiving packet. */ -/* */ -/* INPUT */ -/* */ -/* thread_input Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* optimized internal code, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -void nx_wifi_thread_entry(ULONG thread_input) -{ - -UINT i; -UINT socket_counter; -int32_t size; -UINT status; -NX_PACKET *packet_ptr; -NX_TCP_SOCKET *tcp_socket; -NX_UDP_SOCKET *udp_socket; -#ifdef NX_ENABLE_IP_PACKET_FILTER -wifi_ip_configuration_t ip_cfg; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - -#ifdef NX_ENABLE_IP_PACKET_FILTER - if (R_WIFI_SX_ULPGN_GetIpAddress(&ip_cfg) == WIFI_STATUS_OK) - { - nx_wifi_ip_address = ip_cfg.ipaddress; - } -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - while(1) - { - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - socket_counter = 0; - - /* Check if have socket. */ - if (nx_wifi_socket_counter != 0) - { - - /* Loop to receive the data from */ - for (i = 0; (i < NX_WIFI_SOCKET_COUNTER) && (socket_counter < nx_wifi_socket_counter); i++) - { - - /* Check if the socket is valid and connected. */ - if ((nx_wifi_socket[i].nx_wifi_socket_valid == 0) || (nx_wifi_socket[i].nx_wifi_socket_connected == 0)) - continue; - - /* Update the socket counter. */ - socket_counter++; - - /* Loop to receive the data from wifi for current socket. */ - status = WIFI_STATUS_OK; - do - { - - /* Make sure there is enough space to store the data before receiving data from WIFI. */ - if ((nx_wifi_pool -> nx_packet_pool_available * nx_wifi_pool -> nx_packet_pool_payload_size) < - (WIFI_PAYLOAD_SIZE + (NX_WIFI_PACKET_RESERVED * nx_wifi_pool -> nx_packet_pool_payload_size))) - break; - - /* Receive the data in WIFI_READ_TIMEOUT ms. */ - size = R_WIFI_SX_ULPGN_ReceiveSocket(nx_wifi_socket[i].socket_id, - (uint8_t *)nx_wifi_buffer, WIFI_PAYLOAD_SIZE, WIFI_READ_TIMEOUT); - /* Check status. */ - if ((size <= 0)) - break; - - /* Allocate one packet to store the data. */ - if (nx_packet_allocate(nx_wifi_pool, &packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT)) - break; - - /* Set the data. */ - if (nx_packet_data_append(packet_ptr, nx_wifi_buffer, size, nx_wifi_pool, NX_NO_WAIT)) - { - nx_packet_release(packet_ptr); - break; - } - - /* Check to see if the deferred processing queue is empty. */ - if (nx_wifi_socket[i].nx_wifi_received_packet_head) - { - - /* Not empty, just place the packet at the end of the queue. */ - (nx_wifi_socket[i].nx_wifi_received_packet_tail) -> nx_packet_queue_next = packet_ptr; - packet_ptr -> nx_packet_queue_next = NX_NULL; - nx_wifi_socket[i].nx_wifi_received_packet_tail = packet_ptr; - - } - else - { - - /* Empty deferred receive processing queue. Just setup the head pointers and - set the event flags to ensure the IP helper thread looks at the deferred processing - queue. */ - nx_wifi_socket[i].nx_wifi_received_packet_head = packet_ptr; - nx_wifi_socket[i].nx_wifi_received_packet_tail = packet_ptr; - packet_ptr -> nx_packet_queue_next = NX_NULL; - - /* Check the socket type. */ - if (nx_wifi_socket[i].nx_wifi_socket_type == NX_WIFI_TCP_SOCKET) - { - - /* Get the tcp socket. */ - tcp_socket = (NX_TCP_SOCKET *)nx_wifi_socket[i].nx_wifi_socket_ptr; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - nx_wifi_ip_packet_filter(tcp_socket -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - nx_wifi_ip_address, - tcp_socket -> nx_tcp_socket_connect_port, - tcp_socket -> nx_tcp_socket_port, - NX_IP_TCP, size, NX_IP_PACKET_IN); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Determine if there is a socket receive notification function specified. */ - if (tcp_socket -> nx_tcp_receive_callback) - { - - /* Yes, notification is requested. Call the application's receive notification - function for this socket. */ - (tcp_socket -> nx_tcp_receive_callback)(tcp_socket); - } - } - else - { - - /* Get the udp socket. */ - udp_socket = (NX_UDP_SOCKET *)nx_wifi_socket[i].nx_wifi_socket_ptr; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_socket[i].nx_wifi_udp_socket_connect_ip, - nx_wifi_ip_address, - nx_wifi_socket[i].nx_wifi_udp_socket_connect_port, - udp_socket -> nx_udp_socket_port, - NX_IP_UDP, size, NX_IP_PACKET_IN); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Determine if there is a socket receive notification function specified. */ - if (udp_socket -> nx_udp_receive_callback) - { - - /* Yes, notification is requested. Call the application's receive notification - function for this socket. */ - (udp_socket -> nx_udp_receive_callback)(udp_socket); - } - } - } - - /* Queue the packet. */ - }while (status == WIFI_STATUS_OK); - } - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - /* Sleep some ticks to next loop. */ - tx_thread_sleep(WIFI_THREAD_PERIOD); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tick_convert_ms PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function converts the ticks to milliseconds. */ -/* */ -/* INPUT */ -/* */ -/* tick Tick value */ -/* millisecond Destination to millisecond */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static VOID nx_wifi_tick_convert_ms(ULONG tick, ULONG *millisecond) -{ - -UINT factor = 1000/NX_IP_PERIODIC_RATE; - - - /* Check the wait_option. */ - if (tick) - { - - /* Change ticks to milliseconds to ticks. */ - if (tick >= NX_WAIT_FOREVER/factor) - *millisecond = NX_WAIT_FOREVER; - else - *millisecond = (tick * factor); - } - else - { - *millisecond = 0; - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_entry_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds an available entry. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* entry_index Destination to entry */ -/* entry_find Find flag */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_socket_entry_find(void *socket_ptr, UCHAR *entry_index, UCHAR entry_find) -{ - -UINT i; -UCHAR empty_index = NX_WIFI_SOCKET_COUNTER; - - /* Loop to find an empty entry. */ - for (i = 0; i < NX_WIFI_SOCKET_COUNTER; i++) - { - - /* Check the valid flag. */ - if (nx_wifi_socket[i].nx_wifi_socket_valid) - { - - /* Check if the entry already exist. */ - if (nx_wifi_socket[i].nx_wifi_socket_ptr == socket_ptr) - { - - /* Check if find the entry. */ - if (entry_find) - { - *entry_index = i; - return(NX_SUCCESS); - } - else - { - return(NX_NOT_SUCCESSFUL); - } - } - } - else - { - - /* Set the empty index. */ - if (empty_index > i) - empty_index = i; - } - } - - /* Check if have empty entry. */ - if (empty_index >= NX_WIFI_SOCKET_COUNTER) - return (NX_NOT_SUCCESSFUL); - - (*entry_index) = empty_index; - return(NX_SUCCESS); -} - - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_reset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function resets the entry and release the packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* entry_index Destination to entry */ -/* entry_find Find flag */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static void nx_wifi_socket_reset(UCHAR entry_index) -{ - -NX_PACKET *next_packet; -NX_PACKET *current_packet; - - /* Check if this is an valid entry. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_valid == 0) - return; - - /* Setup next packet to queue head. */ - next_packet = nx_wifi_socket[entry_index].nx_wifi_received_packet_head; - - /* Release any packets queued up. */ - while (next_packet) - { - - /* Setup the current packet pointer. */ - current_packet = next_packet; - - /* Move to the next packet. */ - next_packet = next_packet -> nx_packet_queue_next; - - /* Release the current packet. */ - nx_packet_release(current_packet); - } - - /* Reset the entry. */ - memset(&nx_wifi_socket[entry_index], 0, sizeof(NX_WIFI_SOCKET)); - nx_wifi_socket_counter--; -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives packet for wifi socket */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* packet_ptr Pointer to received packet */ -/* wait_option Suspension option */ -/* socket_type Socket type */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* optimized internal code, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_socket_receive(VOID *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option, UINT socket_type) -{ - -UINT status; -UCHAR entry_index; -ULONG total_millisecond; -ULONG wait_millisecond; -UINT start_time; -ULONG millisecond; -USHORT size; -UINT received_packet = NX_FALSE; -#ifdef NX_ENABLE_IP_PACKET_FILTER -NX_TCP_SOCKET *tcp_socket; -NX_UDP_SOCKET *udp_socket; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Convert the tick to millisecond. */ - nx_wifi_tick_convert_ms(wait_option, &total_millisecond); - - /* Receive the packet from queue. */ - if (nx_wifi_socket[entry_index].nx_wifi_received_packet_head) - { - - /* Remove the first packet and process it! */ - - /* Pickup the first packet. */ - *packet_ptr = nx_wifi_socket[entry_index].nx_wifi_received_packet_head; - - /* Move the head pointer to the next packet. */ - nx_wifi_socket[entry_index].nx_wifi_received_packet_head = (*packet_ptr) -> nx_packet_queue_next; - - /* Check for end of deferred processing queue. */ - if (nx_wifi_socket[entry_index].nx_wifi_received_packet_head == NX_NULL) - { - - /* Yes, the queue is empty. Set the tail pointer to NULL. */ - nx_wifi_socket[entry_index].nx_wifi_received_packet_tail = NX_NULL; - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } - else - { - - /* Get the start time. */ - start_time = tx_time_get(); - - /* Loop to receive a packet. */ - while(total_millisecond) - { - - /* Check if exceed the max value of WIFI_TIMEOUT. */ - if (total_millisecond > WIFI_TIMEOUT) - wait_millisecond = WIFI_TIMEOUT; - else - wait_millisecond = total_millisecond; - - /* Check if exceed the max value of WIFI_TRANSPORT_TIMEOUT. */ - if (wait_millisecond > WIFI_TRANSPORT_TIMEOUT) - wait_millisecond = WIFI_TRANSPORT_TIMEOUT; - - /* Receive the data within a specified time. */ - size = R_WIFI_SX_ULPGN_ReceiveSocket(nx_wifi_socket[entry_index].socket_id, - (uint8_t *)nx_wifi_buffer, WIFI_PAYLOAD_SIZE, WIFI_READ_TIMEOUT); - - /* Check status. */ - if ((size <= 0)) - { - - /* Convert the tick to millisecond. */ - nx_wifi_tick_convert_ms((tx_time_get() - start_time), &millisecond); - - /* Update the remaining millisecond. */ - if (millisecond >= total_millisecond) - total_millisecond = 0; - else - total_millisecond -=millisecond; - - continue; - } - else - { - received_packet = NX_TRUE; - break; - } - } - - /* Check if receive a packet. */ - if (received_packet != NX_TRUE) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NO_PACKET); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Check the socket type. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_type == NX_WIFI_TCP_SOCKET) - { - - /* Get the tcp socket. */ - tcp_socket = (NX_TCP_SOCKET *)nx_wifi_socket[entry_index].nx_wifi_socket_ptr; - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(tcp_socket -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - nx_wifi_ip_address, - tcp_socket -> nx_tcp_socket_connect_port, - tcp_socket -> nx_tcp_socket_port, - NX_IP_TCP, size, NX_IP_PACKET_IN); - } - else - { - - /* Get the udp socket. */ - udp_socket = (NX_UDP_SOCKET *)nx_wifi_socket[entry_index].nx_wifi_socket_ptr; - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip, - nx_wifi_ip_address, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port, - udp_socket -> nx_udp_socket_port, - NX_IP_UDP, size, NX_IP_PACKET_IN); - } -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Allocate one packet to store the data. */ - if (nx_packet_allocate(nx_wifi_pool, packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the data. */ - if (nx_packet_data_append(*packet_ptr, nx_wifi_buffer, size, nx_wifi_pool, NX_NO_WAIT)) - { - - /* Release the packet. */ - nx_packet_release(*packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends wifi connection command */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* packet_ptr Pointer to received packet */ -/* wait_option Suspension option */ -/* socket_type Socket type */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option) -{ - -int32_t status; -UCHAR entry_index; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an available entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 0)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the entry info. */ - nx_wifi_socket[entry_index].nx_wifi_socket_ptr = (void *)socket_ptr; - nx_wifi_socket[entry_index].nx_wifi_socket_valid = 1; - nx_wifi_socket[entry_index].nx_wifi_socket_type = NX_WIFI_TCP_SOCKET; - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 0; - nx_wifi_socket_counter++; - - /* Swap the address. */ - //NX_CHANGE_ULONG_ENDIAN(server_ip -> nxd_ip_address.v4); - - /* Create the socket. */ - status = R_WIFI_SX_ULPGN_CreateSocket(WIFI_SOCKET_IP_PROTOCOL_TCP, WIFI_SOCKET_IP_VERSION_4); - - if (status >= 0) - { - /* Wifi connect. */ - nx_wifi_socket[entry_index].socket_id = status; - status = R_WIFI_SX_ULPGN_ConnectSocket(nx_wifi_socket[entry_index].socket_id, server_ip -> nxd_ip_address.v4, server_port, NULL); - } - - /* Swap the address. */ - //NX_CHANGE_ULONG_ENDIAN(server_ip -> nxd_ip_address.v4); - - if(status == WIFI_SUCCESS) - { - - /* Update the connect flag. */ - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 1; - - /* Update the address and port. */ - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_version = NX_IP_VERSION_V4; - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4 = server_ip -> nxd_ip_address.v4; - socket_ptr -> nx_tcp_socket_connect_port = server_port; - socket_ptr -> nx_tcp_socket_state = NX_TCP_ESTABLISHED; - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } - else - { - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends wifi disconnect command */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - -wifi_err_t wifi_err; -UCHAR entry_index; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Check if the entry already exist. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Close connection. */ - wifi_err = R_WIFI_SX_ULPGN_CloseSocket(nx_wifi_socket[entry_index].socket_id); - /* Reset the entry. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - if(wifi_err != WIFI_SUCCESS) { - return(NX_NOT_SUCCESSFUL); - } - /* Return success. */ - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a TCP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option) -{ - -UINT status ; -UCHAR entry_index; -USHORT send_data_length; -ULONG packet_size; -NX_PACKET *current_packet; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Initialize the current packet to the input packet pointer. */ - current_packet = packet_ptr; - - /* Loop to send the packet. */ - while(current_packet) - { - - /* Calculate current packet size. */ - packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); - - /* Send data. */ - send_data_length = R_WIFI_SX_ULPGN_SendSocket (nx_wifi_socket[entry_index].socket_id, current_packet -> nx_packet_prepend_ptr, packet_size, WIFI_WRITE_TIMEOUT); - - /* Check status. */ - if ((send_data_length != packet_size)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return (NX_NOT_SUCCESSFUL); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_ip_address, - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - socket_ptr -> nx_tcp_socket_port, - socket_ptr -> nx_tcp_socket_connect_port, - NX_IP_TCP, packet_size, NX_IP_PACKET_OUT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* We have crossed the packet boundary. Move to the next packet - structure. */ - current_packet = current_packet -> nx_packet_next; -#else - - /* End the loop. */ - current_packet = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Release the packet. */ - nx_packet_release(packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - return (NX_SUCCESS); -} - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives a TCP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - return(nx_wifi_socket_receive((VOID*)socket_ptr, packet_ptr, wait_option, NX_WIFI_TCP_SOCKET)); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds UDP socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UCHAR entry_index; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 0)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the entry info. */ - nx_wifi_socket[entry_index].nx_wifi_socket_ptr = (void *)socket_ptr; - nx_wifi_socket[entry_index].nx_wifi_socket_valid = 1; - nx_wifi_socket[entry_index].nx_wifi_socket_type = NX_WIFI_UDP_SOCKET; - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 0; - nx_wifi_socket_counter++; - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds UDP socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ -wifi_err_t wifi_err; -UCHAR entry_index; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Check if the entry already exist. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Close connection. */ - wifi_err = R_WIFI_SX_ULPGN_CloseSocket(nx_wifi_socket[entry_index].socket_id); - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - if(wifi_err != WIFI_SUCCESS) { - return(NX_NOT_SUCCESSFUL); - } - - /* Return success. */ - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends UDP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port) -{ -UINT status; -UCHAR entry_index; -USHORT send_data_length; -ULONG packet_size; -NX_PACKET *current_packet; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if already open the connection. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - /* Swap the address. */ -// NX_CHANGE_ULONG_ENDIAN(ip_address -> nxd_ip_address.v4); - - /* Create the socket. */ - status = R_WIFI_SX_ULPGN_CreateSocket(WIFI_SOCKET_IP_PROTOCOL_UDP, WIFI_SOCKET_IP_VERSION_4); - - if (status >= 0) - { - /* Wifi connect. */ - nx_wifi_socket[entry_index].socket_id = status; - status = R_WIFI_SX_ULPGN_ConnectSocket(nx_wifi_socket[entry_index].socket_id, ip_address->nxd_ip_address.v4, port, NULL); - } - - /* Swap the address. */ -// NX_CHANGE_ULONG_ENDIAN(ip_address -> nxd_ip_address.v4); - - /* Check status. */ - if(status != WIFI_SUCCESS) - { - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Update the connect flag. */ - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 1; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Set IP and port. */ - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip = ip_address -> nxd_ip_address.v4; - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port = port; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - } - - /* Initialize the current packet to the input packet pointer. */ - current_packet = packet_ptr; - - /* Loop to send the packet. */ - while(current_packet) - { - - /* Calculate current packet size. */ - packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); - - /* Loop to send data. */ - send_data_length = R_WIFI_SX_ULPGN_SendSocket(nx_wifi_socket[entry_index].socket_id, current_packet->nx_packet_prepend_ptr, packet_size, WIFI_WRITE_TIMEOUT); - - /* Check status. */ - if (send_data_length != packet_size) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_ip_address, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip, - socket_ptr -> nx_udp_socket_port, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port, - NX_IP_UDP, packet_size, NX_IP_PACKET_OUT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* We have crossed the packet boundary. Move to the next packet - structure. */ - current_packet = current_packet -> nx_packet_next; -#else - - /* End the loop. */ - current_packet = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Release the packet. */ - nx_packet_release(packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives UDP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - return(nx_wifi_socket_receive((VOID*)socket_ptr, packet_ptr, wait_option, NX_WIFI_UDP_SOCKET)); -} - - -#ifdef NX_ENABLE_IP_PACKET_FILTER -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_ip_packet_filter PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function builds fake IP header and TCP/UDP header to filter. */ -/* */ -/* Note: Only fill source IP, destination IP and Protocol in IP header */ -/* and fill source port and destination port in TCP/UDP header. */ -/* */ -/* INPUT */ -/* */ -/* source_ip Source IP address */ -/* destination_ip Destination IP address */ -/* source_port Source port */ -/* destination_port Destination port */ -/* protocol Protocol: TCP/UDP */ -/* packet_length Lenght of packet */ -/* direction Direction: IN/OUT */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 09-30-2020 Yuxin Zhou Initial Version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_ip_packet_filter(ULONG source_ip, ULONG destination_ip, - ULONG source_port, ULONG destination_port, - ULONG protocol, ULONG packet_length, UINT direction) -{ - -NX_IPV4_HEADER *ip_header_ptr; -ULONG port; -UINT status; - - /* Check if the IP packet filter is set. */ - if (nx_wifi_ip -> nx_ip_packet_filter) - { - - /* Initialize the buffer. */ - memset(nx_wifi_ip_buffer, 0, 40); - - /* Update packet length. */ - if (protocol == NX_IP_TCP) - { - packet_length += 40; - } - else - { - packet_length += 28; - } - - /* Fill IP header. */ - ip_header_ptr = (NX_IPV4_HEADER *) nx_wifi_ip_buffer; - - /* Build the first 32-bit word of the IP header. */ - ip_header_ptr -> nx_ip_header_word_0 = (NX_IP_VERSION | (0xFFFF & packet_length)); - - /* Build the third 32-bit word of the IP header. */ - ip_header_ptr -> nx_ip_header_word_2 = protocol; - - /* Place the source IP address in the IP header. */ - ip_header_ptr -> nx_ip_header_source_ip = source_ip; - - /* Place the destination IP address in the IP header. */ - ip_header_ptr -> nx_ip_header_destination_ip = destination_ip; - - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_word_0); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_word_2); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_source_ip); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_destination_ip); - - /* Fill the TCP/UDP ports. */ - port = (source_port << NX_SHIFT_BY_16) | (destination_port); - NX_CHANGE_ULONG_ENDIAN(port); - memcpy(&nx_wifi_ip_buffer[20], &port, 4); /* Use case of memcpy is verified. */ - - /* Yes, call the IP packet filter routine. */ - status = nx_wifi_ip -> nx_ip_packet_filter(nx_wifi_ip_buffer, direction); - - if (status) - { - return (status); - } - } - - return(NX_SUCCESS); -} -#endif /* NX_ENABLE_IP_PACKET_FILTER */ diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/CMakeLists.txt b/Renesas/RX65N_Cloud_Kit/lib/netxduo/CMakeLists.txt deleted file mode 100644 index ee962175..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/CMakeLists.txt +++ /dev/null @@ -1,496 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -set(SOURCES - common/nx_ip_create.c - common/nx_ip_delete.c - common/nx_ip_initialize.c - common/nx_packet_allocate.c - common/nx_packet_copy.c - common/nx_packet_data_adjust.c - common/nx_packet_data_append.c - common/nx_packet_data_extract_offset.c - common/nx_packet_data_retrieve.c - common/nx_packet_debug_info_get.c - common/nx_packet_length_get.c - common/nx_packet_pool_cleanup.c - common/nx_packet_pool_create.c - common/nx_packet_pool_delete.c - common/nx_packet_pool_info_get.c - common/nx_packet_pool_initialize.c - common/nx_packet_pool_low_watermark_set.c - common/nx_packet_release.c - common/nx_packet_transmit_release.c - common/nx_system_initialize.c - common/nx_tcp_client_socket_bind.c - common/nx_tcp_client_socket_connect.c - common/nx_tcp_client_socket_unbind.c - common/nx_tcp_enable.c - common/nx_tcp_free_port_find.c - common/nx_tcp_initialize.c - common/nx_tcp_socket_block_cleanup.c - common/nx_tcp_socket_create.c - common/nx_tcp_socket_delete.c - common/nx_tcp_socket_disconnect.c - common/nx_tcp_socket_establish_notify.c - common/nx_tcp_socket_receive.c - common/nx_tcp_socket_receive_notify.c - common/nx_tcp_socket_send.c - common/nx_tcp_socket_state_wait.c - common/nx_udp_enable.c - common/nx_udp_free_port_find.c - common/nx_udp_socket_bind.c - common/nx_udp_socket_create.c - common/nx_udp_socket_delete.c - common/nx_udp_socket_receive.c - common/nx_udp_socket_receive_notify.c - common/nx_udp_socket_send.c - common/nx_udp_socket_unbind.c - common/nxde_tcp_client_socket_connect.c - common/nxde_tcp_socket_peer_info_get.c - common/nxde_udp_socket_send.c - common/nxd_tcp_client_socket_connect.c - common/nxd_udp_socket_send.c - common/nxe_ip_create.c - common/nxe_ip_delete.c - common/nxe_packet_allocate.c - common/nxe_packet_copy.c - common/nxe_packet_data_append.c - common/nxe_packet_data_extract_offset.c - common/nxe_packet_data_retrieve.c - common/nxe_packet_length_get.c - common/nxe_packet_pool_create.c - common/nxe_packet_pool_delete.c - common/nxe_packet_pool_info_get.c - common/nxe_packet_pool_low_watermark_set.c - common/nxe_packet_release.c - common/nxe_packet_transmit_release.c - common/nxe_tcp_client_socket_bind.c - common/nxe_tcp_client_socket_connect.c - common/nxe_tcp_client_socket_unbind.c - common/nxe_tcp_enable.c - common/nxe_tcp_socket_create.c - common/nxe_tcp_socket_delete.c - common/nxe_tcp_socket_disconnect.c - common/nxe_tcp_socket_establish_notify.c - common/nxe_tcp_socket_receive.c - common/nxe_tcp_socket_receive_notify.c - common/nxe_tcp_socket_send.c - common/nxe_tcp_socket_state_wait.c - common/nxe_udp_enable.c - common/nxe_udp_socket_bind.c - common/nxe_udp_socket_create.c - common/nxe_udp_socket_delete.c - common/nxe_udp_socket_receive.c - common/nxe_udp_socket_receive_notify.c - common/nxe_udp_socket_send.c - common/nxe_udp_socket_unbind.c - - ${CORE_LIB_DIR}/netxduo/common/src/nx_utility.c - - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_3des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_aes.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_cbc.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ccm.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ctr.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_dh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_drbg.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecdh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecdsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecjpake.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp192r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp224r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp256r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp384r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp521r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_gcm.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_generic_ciphersuites.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hkdf.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha2.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_huge_number.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_huge_number_extended.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_initialize.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_methods.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_3des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_aes.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_drbg.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_ecdh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_ecdsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_hmac_sha.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_pkcs1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_prf.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_rsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_sha.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_module_start.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_null_cipher.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_phash.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_pkcs1_v1.5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_rsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha2.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha256.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha384.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha512.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_xcbc_mac.c - - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_client_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_client_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_notify_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_stop.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_x509_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_client_info_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_active_certificate_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_client_psk_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_metadata_size_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_buffer_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_free_all.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_alert_value_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_certificate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_verify_enable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_packet_buffer_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_renegotiate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_renegotiate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_server_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_sni_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_sni_extension_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_time_function_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_certificate_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_common_name_dns_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_crl_revocation_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_dns_name_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_extended_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_extension_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_3des.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_aes.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_des.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_hmac_sha.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_md5.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_prf.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_rsa.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_sha.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_rng_self_test.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_table_self_test.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_allocate_handshake_packet.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_hash_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_handshake_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_helloverifyrequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_receive_callback.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_retransmit.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_retransmit_queue_flush.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_handshake_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_helloverifyrequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_notify_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_stop.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_x509_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_cache.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_client_info_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_verify_mac.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_module_hash_compute.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_crypto_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_finished_hash_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_session_keys_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_transcript_hash_save.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_active_certificate_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_allocate_handshake_packet.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_check_protocol_version.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ciphersuite_lookup.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_client_psk_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ecc_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_find_curve_method.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_finished_hash_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_generate_premaster_secret.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_hash_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_hash_update.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_process.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_hash_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_key_material_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_map_error_to_alert.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_metadata_size_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_newest_supported_version.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_certificate_request.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_changecipherspec.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_clienthello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_client_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_encrypted_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_finished.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_handshake_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_newsessionticket.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_remote_certificate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_serverhello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_server_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_protocol_version_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_binder_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_identity_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_update.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_payload_decrypt.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_payload_encrypt.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_buffer_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_free.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_free_all.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_alert.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate_request.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_changecipherspec.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_clienthello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_client_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_encrypted_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_finished.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_handshake_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_hellorequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_newsessionticket.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_serverhello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_server_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_alert_value_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_certificate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_verify_enable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_create_ext.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_iv_size_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_keys_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_packet_buffer_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_receive_records.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_renegotiate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_renegotiate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_server_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_sni_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_sni_extension_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_time_function_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_shutdown.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_verify_mac.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_asn1_tlv_block_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_chain_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_revocation_list_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_common_name_dns_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_crl_revocation_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_crl_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_distinguished_name_compare.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_distinguished_name_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_dns_name_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_ec_private_key_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_expiration_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_extended_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_extension_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_find_certificate_methods.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_find_curve_method.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_free_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_local_device_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_oid_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_pkcs1_rsa_private_key_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_pkcs7_decode.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_remote_endpoint_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_subject_alt_names_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_wildcard_compare.c - - ${CORE_LIB_DIR}/netxduo/addons/dns/nxd_dns.c - ${CORE_LIB_DIR}/netxduo/addons/sntp/nxd_sntp_client.c - ${CORE_LIB_DIR}/netxduo/addons/mqtt/nxd_mqtt_client.c - ${CORE_LIB_DIR}/netxduo/addons/cloud/nx_cloud.c -) - -set(TARGET netxduo) - -add_library(${TARGET} OBJECT) -add_library("azrtos::${TARGET}" ALIAS ${TARGET}) - -# Append Azure IoT file if the user wants it -if(NXD_ENABLE_AZURE_IOT) - list(APPEND SOURCES - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_hub_client.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_json_reader.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_json_writer.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_provisioning_client.c - ) - - set(ENV{AZ_SDK_C_NO_SAMPLES} TRUE) - add_subdirectory(${CORE_LIB_DIR}/netxduo/addons/azure_iot/azure-sdk-for-c azure_sdk_for_c) - target_link_libraries(${TARGET} - PUBLIC - az::iot::hub - az::iot::provisioning) -endif() - -target_sources(${TARGET} - PRIVATE - ${SOURCES} -) - -target_compile_definitions(${TARGET} - PUBLIC - NX_INCLUDE_USER_DEFINE_FILE - NX_AZURE_DISABLE_IOT_SECURITY_MODULE -) - -target_include_directories(${TARGET} - PUBLIC - . - common - ${CORE_LIB_DIR}/netxduo/crypto_libraries/inc - ${CORE_LIB_DIR}/netxduo/nx_secure/inc - ${CORE_LIB_DIR}/netxduo/nx_secure/ports - ${CORE_LIB_DIR}/netxduo/addons/azure_iot - ${CORE_LIB_DIR}/netxduo/addons/cloud - ${CORE_LIB_DIR}/netxduo/addons/dns - ${CORE_LIB_DIR}/netxduo/addons/mqtt - ${CORE_LIB_DIR}/netxduo/addons/sntp -) - -target_link_libraries(${TARGET} - PUBLIC - azrtos::threadx -) diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSE.txt b/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSE.txt deleted file mode 100644 index 76974a36..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSE.txt +++ /dev/null @@ -1,246 +0,0 @@ -MICROSOFT SOFTWARE LICENSE TERMS - -MICROSOFT AZURE RTOS - -Shape - -These license terms are an agreement between you and Microsoft Corporation (or -one of its affiliates). They apply to the software named above and any Microsoft -services or software updates (except to the extent such services or updates are -accompanied by new or additional terms, in which case those different terms -apply prospectively and do not alter your or Microsoft’s rights relating to -pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU -HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. - -INSTALLATION AND USE RIGHTS. - -General. You may install and use the software and the included Microsoft -applications solely for internal development, testing and evaluation purposes. -Any distribution or production use requires a separate license as set forth in -Section 2. - -Contributions. Microsoft welcomes contributions to this software. In the event -that you make a contribution to this software you will be required to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and -actually do, grant Microsoft the rights to use your contribution. For details, -visit https://cla.microsoft.com. - -Included Microsoft Applications. The software includes other Microsoft -applications which are governed by the licenses embedded in or made available -with those applications. - -Third Party Components. The software may include third party components with -separate legal notices or governed by other agreements, as may be described -within the software or in the ThirdPartyNotices file(s) accompanying the -software. - -Competitive Benchmarking. If you are a direct competitor, and you access or use -the software for purposes of competitive benchmarking, analysis, or intelligence -gathering, you waive as against Microsoft, its subsidiaries, and its affiliated -companies (including prospectively) any competitive use, access, and -benchmarking test restrictions in the terms governing your software to the -extent your terms of use are, or purport to be, more restrictive than -Microsoft’s terms. If you do not waive any such purported restrictions in the -terms governing your software, you are not allowed to access or use this -software, and will not do so. - -DISTRIBUTION AND PRODUCTION USE. If you have obtained and/or are developing on -microprocessor(s) and/or microcontroller(s) (“hardware”) listed in the file -named “LICENSED-HARDWARE.txt” included in the repository and/or distributed with -the software you have the following rights in and to the software solely when -used in combination with the hardware. In the event hardware is not listed in -the LICENSED-HARDWARE.txt file, you do not have the rights in this Section 2. - -Distribution and Production Use Rights. - -You may use the software in production (e.g. program the modified or unmodified -software to devices you own or control) and distribute (i.e. make available to -third parties) the modified or unmodified binary image produced from this code. - - -You may permit your device distributors or developers to copy and distribute the -binary image as programmed or to be programmed to your devices. - -You may redistribute the unmodified or modified source to your device -distributors or developers. Modifications must be clearly marked. Any -redistribution in source code form must contain this license and any other -licenses that accompany the software. - -Requirements. For any code you distribute, you must: - -when distributed in binary form, except as embedded in a device, include with -such distribution the terms of this agreement; - -when distributed in source code form to distributors or developers of your -devices, include with such distribution the terms of this agreement; and - -indemnify, defend and hold harmless Microsoft from any claims, including -attorneys’ fees, related to the distribution or use of your devices, except to -the extent that any claim is based solely on the unmodified software. - -Restrictions. You may not: - -use or modify the software to create a competing real time operating system -software; - -remove any copyright notices or licenses contained in the software; - -use Microsoft’s trademarks or trade dress in your application in any way that -suggests your device or application comes from or is endorsed by Microsoft; - -transfer individual components, specific libraries, classes, functions or code -fragments of the software separately for purposes unrelated to the software; or - -use or distribute the software in any way that would subject the software or -Microsoft’s intellectual property or technology to any other license terms. - -SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all -other rights. Unless applicable law gives you more rights despite this -limitation, you will not (and have no right to): - -remove, minimize, block, or modify any notices of Microsoft or its suppliers in -the software; - -use the software in any way that is against the law or to create or propagate -malware; or - -share, publish, distribute, or lease the software (except as permitted in -Section 2 above), or provide the software as a stand-alone offering for others -to use. - -DATA. This software may interact with other Microsoft products that collect data -that is transmitted to Microsoft. To learn more about how Microsoft processes -personal data we collect, please see the Microsoft Privacy Statement at -https://go.microsoft.com/fwlink/?LinkId=248681. - -EXPORT RESTRICTIONS. You must comply with all domestic and international export -laws and regulations that apply to the software, which include restrictions on -destinations, end users, and end use. For further information on export -restrictions, visit https://aka.ms/exporting. - -SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any -support services for the software. Any support provided is “as is”, “with all -faults”, and without warranty of any kind. - -UPDATES. Microsoft may periodically update the software. You may obtain updates -only from Microsoft or Microsoft-authorized sources. Updates may not include or -support all existing software features, services, or peripheral devices. - -TERMINATION. Without prejudice to any other rights, Microsoft may terminate this -agreement if you fail to comply with any of its terms or conditions. In such -event, you must destroy all copies of the software and all of its component -parts. - -ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for -supplements, updates, or third-party applications, is the entire agreement for -the software. To the extent you have entered into a separate agreement with -Microsoft relating specifically to the software, the terms in such agreement -shall control. - -APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in -the United States or Canada, the laws of the state or province where you live -(or, if a business, where your principal place of business is located) govern -the interpretation of this agreement, claims for its breach, and all other -claims (including consumer protection, unfair competition, and tort claims), -regardless of conflict of laws principles. If you acquired the software in any -other country, its laws apply. If U.S. federal jurisdiction exists, you and -Microsoft consent to exclusive jurisdiction and venue in the federal court in -King County, Washington for all disputes heard in court. If not, you and -Microsoft consent to exclusive jurisdiction and venue in the Superior Court of -King County, Washington for all disputes heard in court. - -CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal -rights. You may have other rights, including consumer rights, under the laws of -your state or country. Separate and apart from your relationship with Microsoft, -you may also have rights with respect to the party from which you acquired the -software. This agreement does not change those other rights if the laws of your -state or country do not permit it to do so. For example, if you acquired the -software in one of the below regions, or mandatory country law applies, then the -following provisions apply to you: - -Australia. You have statutory guarantees under the Australian Consumer Law and -nothing in this agreement is intended to affect those rights. - -Germany and Austria. - -i.Warranty. The properly licensed software will perform substantially as -described in any Microsoft materials that accompany the software. However, -Microsoft gives no contractual guarantee in relation to the licensed software. - -ii.Limitation of Liability. In case of intentional conduct, gross negligence, -claims based on the Product Liability Act, as well as, in case of death or -personal or physical injury, Microsoft is liable according to the statutory law. - - -Subject to the foregoing clause ii., Microsoft will only be liable for slight -negligence if Microsoft is in breach of such material contractual obligations, -the fulfillment of which facilitate the due performance of this agreement, the -breach of which would endanger the purpose of this agreement and the compliance -with which a party may constantly trust in (so-called "cardinal obligations"). -In other cases of slight negligence, Microsoft will not be liable for slight -negligence. - -DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF -USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO -THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED -WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND -NON-INFRINGEMENT. - -LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING -DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM -MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT -RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, -INDIRECT, OR INCIDENTAL DAMAGES. - -This limitation applies to (a) anything related to the software, services, -content (including code) on third party Internet sites, or third party -applications; and (b) claims for breach of contract, warranty, guarantee, or -condition; strict liability, negligence, or other tort; or any other claim; in -each case to the extent permitted by applicable law. - -It also applies even if Microsoft knew or should have known about the -possibility of the damages. The above limitation or exclusion may not apply to -you because your state, province, or country may not allow the exclusion or -limitation of incidental, consequential, or other damages. - - - -Please note: As this software is distributed in Canada, some of the clauses in -this agreement are provided below in French. - -Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce -contrat sont fournies ci-dessous en français. - -EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel -». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft -n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits -additionnels en vertu du droit local sur la protection des consommateurs, que ce -contrat ne peut modifier. La ou elles sont permises par le droit locale, les -garanties implicites de qualité marchande, d’adéquation à un usage particulier -et d’absence de contrefaçon sont exclues. - -LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES -DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une -indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous -ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris -les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. - -Cette limitation concerne: - -•tout ce qui est relié au logiciel, aux services ou au contenu (y compris le -code) figurant sur des sites Internet tiers ou dans des programmes tiers; et - -•les réclamations au titre de violation de contrat ou de garantie, ou au titre -de responsabilité stricte, de négligence ou d’une autre faute dans la limite -autorisée par la loi en vigueur. - -Elle s’applique également, même si Microsoft connaissait ou devrait connaître -l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la -limitation de responsabilité pour les dommages indirects, accessoires ou de -quelque nature que ce soit, il se peut que la limitation ou l’exclusion -ci-dessus ne s’appliquera pas à votre égard. - -EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous -pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent -contrat ne modifie pas les droits que vous confèrent les lois de votre pays si -celles-ci ne le permettent pas. \ No newline at end of file diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSED-HARDWARE.txt b/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSED-HARDWARE.txt deleted file mode 100644 index 77dd1abf..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/LICENSED-HARDWARE.txt +++ /dev/null @@ -1,16 +0,0 @@ -LICENSED HARDWARE LIST - -Last Updated: 2020-05-08 - -Microsoft has entered into OEM Agreements with manufacturers of the following -microprocessors and microcontrollers (the “hardware”) to enable those -manufacturers to include and distribute Azure RTOS in certain hardware. If you -have obtained and/or are developing on microprocessor(s) and/or -microcontroller(s) (“hardware”) listed below you inherit the “Distribution and -Production Use” rights in Section 2 of the Microsoft Software License Terms for -Microsoft Azure RTOS. If hardware is not listed below, you do not have those -rights. - --------------------------------------------------------------------------------- - -More coming soon. Please check back frequently for updates. \ No newline at end of file diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_api.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_api.h deleted file mode 100644 index 71d1e352..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_api.h +++ /dev/null @@ -1,3850 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Application Interface (API) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* APPLICATION INTERFACE DEFINITION RELEASE */ -/* */ -/* nx_api.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the basic Application Interface (API) to the */ -/* high-performance NetX TCP/IP implementation for the ThreadX */ -/* real-time kernel. All service prototypes and data structure */ -/* definitions are defined in this file. Please note that basic data */ -/* type definitions and other architecture-specific information is */ -/* contained in the file nx_port.h. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), fixed */ -/* ThreadX version check, */ -/* updated product constants, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_API_H -#define NX_API_H - -/* Determine if a C++ compiler is being used. If so, ensure that standard - C is used to process the API information. */ - -#ifdef __cplusplus - -/* Yes, C++ compiler is present. Use standard C. */ -extern "C" { - -#endif - - -/* Disable warning of parameter not used. */ -#ifndef NX_PARAMETER_NOT_USED -#define NX_PARAMETER_NOT_USED(p) ((void)(p)) -#endif /* NX_PARAMETER_NOT_USED */ - - -/* Bypass ThreadX API error checking for internal NetX calls. */ - -#ifdef NX_SOURCE_CODE -#ifndef TX_DISABLE_ERROR_CHECKING -#define TX_DISABLE_ERROR_CHECKING -#endif -#endif - - - -/* Include the ThreadX and port-specific data type file. */ - -#include "tx_api.h" -#include "nx_port.h" - -#ifdef NX_IPSEC_ENABLE -#include "nx_crypto_const.h" -#endif /* NX_IPSEC_ENABLE */ -/* Include the ThreadX trace information. */ - -#include "tx_trace.h" - -/* Define symbols for compatibility before and after ThreadX 5.8. */ -#if (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508) -#define NX_CLEANUP_PARAMETER , ULONG suspension_sequence -#define NX_CLEANUP_ARGUMENT , 0 -#define NX_CLEANUP_EXTENSION NX_PARAMETER_NOT_USED(suspension_sequence); -#else -#define NX_CLEANUP_PARAMETER -#define NX_CLEANUP_ARGUMENT -#define NX_CLEANUP_EXTENSION -#endif /* (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508) */ - -/* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */ -#ifndef TX_THREAD_GET_SYSTEM_STATE -#define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state -#endif - -/* Define basic alignment type used in block and byte pool operations. This data type must - be at least 32-bits in size and also be large enough to hold a pointer type. */ - -#ifndef ALIGN_TYPE_DEFINED -#define ALIGN_TYPE ULONG -#endif - - -/* Define the extension to hold the control block. */ -#ifndef NX_THREAD_EXTENSION_PTR_SET -#define NX_THREAD_EXTENSION_PTR_SET(a, b) -#endif /* NX_THREAD_EXTENSION_PTR_SET */ - -#ifndef NX_THREAD_EXTENSION_PTR_GET -#define NX_THREAD_EXTENSION_PTR_GET(a, b, c) { \ - (a) = (b *)(c); \ - } -#endif /* NX_THREAD_EXTENSION_PTR_GET */ - -#ifndef NX_TIMER_EXTENSION_PTR_SET -#define NX_TIMER_EXTENSION_PTR_SET(a, b) -#endif /* NX_TIMER_EXTENSION_PTR_SET */ - -#ifndef NX_TIMER_EXTENSION_PTR_GET -#define NX_TIMER_EXTENSION_PTR_GET(a, b, c) { \ - (a) = (b *)(c); \ - } -#endif /* NX_TIMER_EXTENSION_PTR_GET */ - - -#ifdef TX_UCHAR_POINTER_ADD -#define NX_UCHAR_POINTER_ADD(a,b) TX_UCHAR_POINTER_ADD(a,b) -#else -#define NX_UCHAR_POINTER_ADD(a,b) (((UCHAR *) (a)) + ((UINT) (b))) -#endif - - -/* The symbol "NX_IP_PERIODIC_RATE" specifies the number of ThreadX timer ticks in one second. - The value should be derived from TX_TIMER_TICKS_PER_SECOND, which is defined in ThreadX port. - If TX_TIMER_TICKS_PER_SECOND is not defined, NX_IP_PERIODIC_RATE defaults to 100 ticks per second. */ - -#ifndef NX_IP_PERIODIC_RATE -#ifdef TX_TIMER_TICKS_PER_SECOND -#define NX_IP_PERIODIC_RATE TX_TIMER_TICKS_PER_SECOND -#else -#define NX_IP_PERIODIC_RATE 100 -#endif -#endif - - -/* This defines the ASSET and process on ASSET fail. */ -#ifndef NX_DISABLE_ASSERT -#ifndef NX_ASSERT_FAIL -#define NX_ASSERT_FAIL for (;;) {tx_thread_sleep(NX_WAIT_FOREVER); } -#endif /* NX_ASSERT_FAIL */ -#define NX_ASSERT(s) if (!(s)) {NX_ASSERT_FAIL} -#else -#define NX_ASSERT(s) -#endif /* NX_DISABLE_ASSERT */ - - -#ifndef NX_RAND -#ifdef NX_HIGH_SECURITY -#error "The symbol NX_RAND must be defined to use a qualified random number generator." -#else -#define NX_RAND rand -#endif -#endif - -#ifndef NX_SRAND -#ifdef NX_HIGH_SECURITY -#error "The symbol NX_SRAND must be defined to use a qualified random number seed." -#else -#define NX_SRAND srand -#endif -#endif - - -/* Define the max string length. */ -#ifndef NX_MAX_STRING_LENGTH -#define NX_MAX_STRING_LENGTH 1024 -#endif /* NX_MAX_STRING_LENGTH */ - - -/* Determine if tracing is enabled. */ - -#ifdef TX_ENABLE_EVENT_TRACE - -/* Define the object types in NetX, if not defined. */ - -#ifndef NX_TRACE_OBJECT_TYPE_IP -#define NX_TRACE_OBJECT_TYPE_IP 11 /* P1 = stack start address, P2 = stack size */ -#define NX_TRACE_OBJECT_TYPE_PACKET_POOL 12 /* P1 = packet size, P2 = number of packets */ -#define NX_TRACE_OBJECT_TYPE_TCP_SOCKET 13 /* P1 = IP address, P2 = window size */ -#define NX_TRACE_OBJECT_TYPE_UDP_SOCKET 14 /* P1 = IP address, P2 = receive queue maximum */ -#endif - - -/* Define event filters that can be used to selectively disable certain events or groups of events. */ - -#define NX_TRACE_ALL_EVENTS 0x00FF8000 /* All NetX events */ -#define NX_TRACE_INTERNAL_EVENTS 0x00008000 /* NetX internal events */ -#define NX_TRACE_ARP_EVENTS 0x00010000 /* NetX ARP events */ -#define NX_TRACE_ICMP_EVENTS 0x00020000 /* NetX ICMP events */ -#define NX_TRACE_IGMP_EVENTS 0x00040000 /* NetX IGMP events */ -#define NX_TRACE_IP_EVENTS 0x00080000 /* NetX IP events */ -#define NX_TRACE_PACKET_EVENTS 0x00100000 /* NetX Packet events */ -#define NX_TRACE_RARP_EVENTS 0x00200000 /* NetX RARP events */ -#define NX_TRACE_TCP_EVENTS 0x00400000 /* NetX TCP events */ -#define NX_TRACE_UDP_EVENTS 0x00800000 /* NetX UDP events */ - - -/* Define the trace events in NetX, if not defined. */ - -/* Define NetX Trace Events, along with a brief description of the additional information fields, - where I1 -> Information Field 1, I2 -> Information Field 2, etc. */ - -/* Define the NetX internal events first. */ - -#ifndef NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE -#define NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE 300 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_REQUEST_SEND 301 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_RESPONSE_RECEIVE 302 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_RESPONSE_SEND 303 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ICMP_RECEIVE 304 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */ -#define NX_TRACE_INTERNAL_ICMP_SEND 305 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = header 0 */ -#define NX_TRACE_INTERNAL_IGMP_RECEIVE 306 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */ - -#define NX_TRACE_INTERNAL_IP_RECEIVE 308 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = packet length */ -#define NX_TRACE_INTERNAL_IP_SEND 309 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = length */ -#define NX_TRACE_INTERNAL_TCP_DATA_RECEIVE 310 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_DATA_SEND 311 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_FIN_RECEIVE 312 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_FIN_SEND 313 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_RESET_RECEIVE 314 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_RESET_SEND 315 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_SYN_RECEIVE 316 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_SYN_SEND 317 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_UDP_RECEIVE 318 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = header word 0 */ -#define NX_TRACE_INTERNAL_UDP_SEND 319 /* I1 = ip ptr, I2 = socket_ptr, I3 = packet ptr, I4 = header 0 */ -#define NX_TRACE_INTERNAL_RARP_RECEIVE 320 /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */ -#define NX_TRACE_INTERNAL_RARP_SEND 321 /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */ -#define NX_TRACE_INTERNAL_TCP_RETRY 322 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = number of retries */ -#define NX_TRACE_INTERNAL_TCP_STATE_CHANGE 323 /* I1 = ip ptr, I2 = socket ptr, I3 = previous state, I4 = new state */ -#define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_SEND 324 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_INITIALIZE 325 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_LINK_ENABLE 326 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_LINK_DISABLE 327 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_BROADCAST 328 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_ARP_SEND 329 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_ARP_RESPONSE_SEND 330 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_RARP_SEND 331 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_JOIN 332 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_LEAVE 333 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_STATUS 334 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_SPEED 335 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_DUPLEX_TYPE 336 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_ERROR_COUNT 337 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_RX_COUNT 338 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_TX_COUNT 339 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_ALLOC_ERRORS 340 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_UNINITIALIZE 341 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_DEFERRED_PROCESSING 342 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ - -#define NX_TRACE_ARP_DYNAMIC_ENTRIES_INVALIDATE 350 /* I1 = ip ptr, I2 = entries invalidated */ -#define NX_TRACE_ARP_DYNAMIC_ENTRY_SET 351 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_ENABLE 352 /* I1 = ip ptr, I2 = arp cache memory, I3 = arp cache size */ -#define NX_TRACE_ARP_GRATUITOUS_SEND 353 /* I1 = ip ptr */ -#define NX_TRACE_ARP_HARDWARE_ADDRESS_FIND 354 /* I1 = ip ptr, I2 = ip_address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_INFO_GET 355 /* I1 = ip ptr, I2 = arps sent, I3 = arp responses, I3 = arps received */ -#define NX_TRACE_ARP_IP_ADDRESS_FIND 356 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_STATIC_ENTRIES_DELETE 357 /* I1 = ip ptr, I2 = entries deleted */ -#define NX_TRACE_ARP_STATIC_ENTRY_CREATE 358 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical_lsw */ -#define NX_TRACE_ARP_STATIC_ENTRY_DELETE 359 /* I1 = ip ptr, I2 = ip address, I3 = physical_msw, I4 = physical_lsw */ -#define NX_TRACE_ICMP_ENABLE 360 /* I1 = ip ptr */ -#define NX_TRACE_ICMP_INFO_GET 361 /* I1 = ip ptr, I2 = pings sent, I3 = ping responses, I4 = pings received */ -#define NX_TRACE_ICMP_PING 362 /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size */ -#define NX_TRACE_IGMP_ENABLE 363 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_INFO_GET 364 /* I1 = ip ptr, I2 = reports sent, I3 = queries received, I4 = groups joined*/ -#define NX_TRACE_IGMP_LOOPBACK_DISABLE 365 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_LOOPBACK_ENABLE 366 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_MULTICAST_JOIN 367 /* I1 = ip ptr, I2 = group address */ -#define NX_TRACE_IGMP_MULTICAST_LEAVE 368 /* I1 = ip ptr, I2 = group_address */ -#define NX_TRACE_IP_ADDRESS_CHANGE_NOTIFY 369 /* I1 = ip ptr, I2 = ip address change notify, I3 = additional info */ -#define NX_TRACE_IP_ADDRESS_GET 370 /* I1 = ip ptr, I2 = ip address, I3 = network_mask */ -#define NX_TRACE_IP_ADDRESS_SET 371 /* I1 = ip ptr, I2 = ip address, I3 = network_mask */ -#define NX_TRACE_IP_CREATE 372 /* I1 = ip ptr, I2 = ip address, I3 = network mask, I4 = default_pool */ -#define NX_TRACE_IP_DELETE 373 /* I1 = ip ptr */ -#define NX_TRACE_IP_DRIVER_DIRECT_COMMAND 374 /* I1 = ip ptr, I2 = command, I3 = return value */ -#define NX_TRACE_IP_FORWARDING_DISABLE 375 /* I1 = ip ptr */ -#define NX_TRACE_IP_FORWARDING_ENABLE 376 /* I1 = ip ptr */ -#define NX_TRACE_IP_FRAGMENT_DISABLE 377 /* I1 = ip ptr */ -#define NX_TRACE_IP_FRAGMENT_ENABLE 378 /* I1 = ip ptr */ -#define NX_TRACE_IP_GATEWAY_ADDRESS_SET 379 /* I1 = ip ptr, I2 = gateway address */ -#define NX_TRACE_IP_INFO_GET 380 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = packets dropped */ -#define NX_TRACE_IP_RAW_PACKET_DISABLE 381 /* I1 = ip ptr */ -#define NX_TRACE_IP_RAW_PACKET_ENABLE 382 /* I1 = ip ptr */ -#define NX_TRACE_IP_RAW_PACKET_RECEIVE 383 /* I1 = ip ptr, I2 = packet ptr, I3 = wait option */ -#define NX_TRACE_IP_RAW_PACKET_SEND 384 /* I1 = ip ptr, I2 = packet ptr, I3 = destination ip, I4 = type of service */ -#define NX_TRACE_IP_STATUS_CHECK 385 /* I1 = ip ptr, I2 = needed status, I3 = actual status, I4 = wait option */ -#define NX_TRACE_PACKET_ALLOCATE 386 /* I1 = pool ptr, I2 = packet ptr, I3 = packet type, I4 = available packets */ -#define NX_TRACE_PACKET_COPY 387 /* I1 = packet ptr, I2 = new packet ptr, I3 = pool ptr, I4 = wait option */ -#define NX_TRACE_PACKET_DATA_APPEND 388 /* I1 = packet ptr, I2 = data start, I3 = data size, I4 = pool ptr */ -#define NX_TRACE_PACKET_DATA_RETRIEVE 389 /* I1 = packet ptr, I2 = buffer start, I3 = bytes copied */ -#define NX_TRACE_PACKET_LENGTH_GET 390 /* I1 = packet ptr, I2 = length */ -#define NX_TRACE_PACKET_POOL_CREATE 391 /* I1 = pool ptr, I2 = payload size, I3 = memory ptr, I4 = memory_size */ -#define NX_TRACE_PACKET_POOL_DELETE 392 /* I1 = pool ptr */ -#define NX_TRACE_PACKET_POOL_INFO_GET 393 /* I1 = pool ptr, I2 = total_packets, I3 = free packets, I4 = empty requests*/ -#define NX_TRACE_PACKET_RELEASE 394 /* I1 = packet ptr, I2 = packet status, I3 = available packets */ -#define NX_TRACE_PACKET_TRANSMIT_RELEASE 395 /* I1 = packet ptr, I2 = packet status, I3 = available packets */ -#define NX_TRACE_RARP_DISABLE 396 /* I1 = ip ptr */ -#define NX_TRACE_RARP_ENABLE 397 /* I1 = ip ptr */ -#define NX_TRACE_RARP_INFO_GET 398 /* I1 = ip ptr, I2 = requests sent, I3 = responses received, I4 = invalids */ -#define NX_TRACE_SYSTEM_INITIALIZE 399 /* none */ -#define NX_TRACE_TCP_CLIENT_SOCKET_BIND 400 /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option */ -#define NX_TRACE_TCP_CLIENT_SOCKET_CONNECT 401 /* I1 = ip ptr, I2 = socket ptr, I3 = server ip, I4 = server port */ -#define NX_TRACE_TCP_CLIENT_SOCKET_PORT_GET 402 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_TCP_CLIENT_SOCKET_UNBIND 403 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_TCP_ENABLE 404 /* I1 = ip ptr */ -#define NX_TRACE_TCP_FREE_PORT_FIND 405 /* I1 = ip ptr, I2 = port, I3 = free port */ -#define NX_TRACE_TCP_INFO_GET 406 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets */ -#define NX_TRACE_TCP_SERVER_SOCKET_ACCEPT 407 /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_LISTEN 408 /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = listen queue size */ -#define NX_TRACE_TCP_SERVER_SOCKET_RELISTEN 409 /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_UNACCEPT 410 /* I1 = ip ptr, I2 = socket ptr, I3 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_UNLISTEN 411 /* I1 = ip ptr, I2 = port */ -#define NX_TRACE_TCP_SOCKET_CREATE 412 /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = window size */ -#define NX_TRACE_TCP_SOCKET_DELETE 413 /* I1 = ip ptr, I2 = socket ptr, I3 = socket state */ -#define NX_TRACE_TCP_SOCKET_DISCONNECT 414 /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_INFO_GET 415 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received */ -#define NX_TRACE_TCP_SOCKET_MSS_GET 416 /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_MSS_PEER_GET 417 /* I1 = ip ptr, I2 = socket ptr, I3 = peer_mss, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_MSS_SET 418 /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 socket state */ -#define NX_TRACE_TCP_SOCKET_RECEIVE 419 /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = rx sequence */ -#define NX_TRACE_TCP_SOCKET_RECEIVE_NOTIFY 420 /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify */ -#define NX_TRACE_TCP_SOCKET_SEND 421 /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = tx sequence */ -#define NX_TRACE_TCP_SOCKET_STATE_WAIT 422 /* I1 = ip ptr, I2 = socket ptr, I3 = desired state, I4 = previous state */ -#define NX_TRACE_TCP_SOCKET_TRANSMIT_CONFIGURE 423 /* I1 = ip ptr, I2 = socket ptr, I3 = queue depth, I4 = timeout */ -#define NX_TRACE_UDP_ENABLE 424 /* I1 = ip ptr */ -#define NX_TRACE_UDP_FREE_PORT_FIND 425 /* I1 = ip ptr, I2 = port, I3 = free port */ -#define NX_TRACE_UDP_INFO_GET 426 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets */ -#define NX_TRACE_UDP_SOCKET_BIND 427 /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option */ -#define NX_TRACE_UDP_SOCKET_CHECKSUM_DISABLE 428 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_CHECKSUM_ENABLE 429 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_CREATE 430 /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = queue maximum */ -#define NX_TRACE_UDP_SOCKET_DELETE 431 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_INFO_GET 432 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received */ -#define NX_TRACE_UDP_SOCKET_PORT_GET 433 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_UDP_SOCKET_RECEIVE 434 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = packet size */ -#define NX_TRACE_UDP_SOCKET_RECEIVE_NOTIFY 435 /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify */ -#define NX_TRACE_UDP_SOCKET_SEND 436 /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address */ -#define NX_TRACE_UDP_SOCKET_UNBIND 437 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_UDP_SOURCE_EXTRACT 438 /* I1 = packet ptr, I2 = ip address, I3 = port */ -#define NX_TRACE_IP_INTERFACE_ATTACH 439 /* I1 = ip ptr, I2 = ip address, I3 = interface index */ -#define NX_TRACE_UDP_SOCKET_BYTES_AVAILABLE 440 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes available */ -#define NX_TRACE_IP_STATIC_ROUTE_ENABLE 441 /* I1 = ip_ptr, */ -#define NX_TRACE_IP_STATIC_ROUTE_DISABLE 442 /* I1 = ip_ptr, */ -#define NX_TRACE_IP_STATIC_ROUTE_ADD 443 /* I1 = ip_ptr, I2 = network_address, I3 = net_mask, I4 = next_hop */ -#define NX_TRACE_IP_STATIC_ROUTE_DELETE 444 /* I1 = ip_ptr, I2 = network_address, I3 = net_mask */ -#define NX_TRACE_TCP_SOCKET_PEER_INFO_GET 445 /* I1 = socket ptr, I2 = network_address, I3 = port */ -#define NX_TRACE_TCP_SOCKET_WINDOW_UPDATE_NOTIFY_SET 446 /* I1 = socket ptr, */ -#define NX_TRACE_UDP_SOCKET_INTERFACE_SET 447 /* I1 = socket_ptr, I2 = interface_index, */ -#define NX_TRACE_UDP_SOCKET_INTERFACE_CLEAR 448 /* I1 = socket_ptr, */ -#define NX_TRACE_IP_INTERFACE_INFO_GET 449 /* I1 = ip_ptr, I2 = ip_address, I3 = mtu_size, I4 = interface_index */ -#define NX_TRACE_PACKET_DATA_EXTRACT_OFFSET 450 /* I1 = packet_ptr, I2 = buffer_length, I3 = bytes_copied, */ - - -#endif - - -#ifndef NXD_TRACE_ICMP_ENABLE -#define NXD_TRACE_ICMP_ENABLE 470 /* I1 = ip ptr */ -#define NX_TRACE_ICMP_PING6 471 /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size */ -#define NXD_TRACE_UDP_SOURCE_EXTRACT 472 /* I1 = packet ptr, I2 = IP Version (4 or 6), I3 = ip address, I4 = port */ -#define NXD_TRACE_UDP_SOCKET_SET_INTERFACE 473 /* I1 = udp_socket_ptr, I2 = interface_id */ -#define NXD_TRACE_TCP_SOCKET_SET_INTERFACE 474 /* I1 = tcp_socket_ptr, I2 = interface_id */ -#define NXD_TRACE_UDP_SOCKET_SEND 475 /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address */ -#define NXD_TRACE_ND_CACHE_DELETE 476 /* I1 = dest_ip */ -#define NXD_TRACE_ND_CACHE_ENTRY_SET 477 /* I1 = IP address, I2 = physical msw, I3 = physical lsw */ -#define NX_TRACE_ND_CACHE_IP_ADDRESS_FIND 478 /* I1 = ip_ptr, I2 = IP address, I3 = physical msw, I4 = physical lsw */ -#define NXD_TRACE_ND_CACHE_INVALIDATE 479 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_GLOBAL_ADDRESS_GET 480 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NXD_TRACE_IPV6_GLOBAL_ADDRESS_SET 481 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NX_TRACE_IPSTATIC_ROUTE_ADD 482 /* I1 = ip_ptr, I2 = network address, I3 = net_mask, I4 = next hop address */ -#define NX_TRACE_IP_STATIC_ROUTING_ENABLE 483 /* I1 = ip_ptr */ -#define NX_TRACE_IP_STATIC_ROUTING_DISABLE 484 /* I1 = ip_ptr */ -#define NX_TRACE_IPV6_ENABLE 485 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_RAW_PACKET_SEND 486 /* I1 = ip_ptr, I2 = ip address lsw, I3 = protocol, I4 = packet_ptr */ -#define NXD_TRACE_IP_RAW_PACKET_SEND 487 /* I1 = ip_ptr, I2 = ip address lsw, I3 = type of serveice, I4 = packet_ptr */ -#define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_GET 488 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw */ -#define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_SET 489 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NXD_TRACE_IPV6_INITIATE_DAD_PROCESS 490 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_DEFAULT_ROUTER_ADD 491 /* I1 = ip_ptr, I2 = router addr lsw, I3 = router lifetime */ -#define NXD_TRACE_IPV6_DEFAULT_ROUTER_DELETE 492 /* I1 = ip_ptr, I2 = router addr lsw, */ -#define NXD_TRACE_IPV6_INTERFACE_ADDRESS_GET 493 /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */ -#define NXD_TRACE_IPV6_INTERFACE_ADDRESS_SET 494 /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */ -#define NXD_TRACE_TCP_SOCKET_PEER_INFO_GET 495 /* I1 = socket_ptr, I2 = Peer IP address, I3 = peer_port */ -#define NXD_TRACE_IP_MAX_PAYLOAD_SIZE_FIND 496 /* I1 = src address, I2 = dst address,I3 = payload length,I4 = start offset */ -#define NX_TRACE_IPV6_DISABLE 497 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_ADDRESS_CHANGE_NOTIFY 498 /* I1 = ip_ptr, I2 = notify_callback */ -#define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_ENABLE 499 /* I1 = ip_ptr, I2 = interface_index */ -#define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_DISABLE 500 /* I1 = ip_ptr, I2 = interface_index */ -#define NXD_TRACE_IP_RAW_PACKET_FILTER_SET 501 /* I1 = ip_ptr, I2 = raw_pcket_filter */ -#endif - -/* Map the trace macros to internal NetX versions so we can get interrupt protection. */ - -#ifdef NX_SOURCE_CODE - -#define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b) _nx_trace_object_register(t, (VOID *)p, (CHAR *)n, (ULONG)a, (ULONG)b) -#define NX_TRACE_OBJECT_UNREGISTER(o) _nx_trace_object_unregister((VOID *)o) -#define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h) _nx_trace_event_insert((ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d, (ULONG)f, g, h) -#define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d) _nx_trace_event_update((TX_TRACE_BUFFER_ENTRY *)e, (ULONG)t, (ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d) -#endif -/* Define NetX trace prototypes. */ - -VOID _nx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2); -VOID _nx_trace_object_unregister(VOID *object_ptr); -VOID _nx_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp); -VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4); - -#else -#define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b) -#define NX_TRACE_OBJECT_UNREGISTER(o) -#define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h) -#define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d) -#endif - -/* If NX_PACKET_HEADER_PAD is defined, make sure NX_PACKET_HEADER_PAD_SIZE is also defined. The default is 1, for backward compatibility. */ -#ifdef NX_PACKET_HEADER_PAD -#ifndef NX_PACKET_HEADER_PAD_SIZE -#define NX_PACKET_HEADER_PAD_SIZE 1 -#endif /* NX_PACKET_HEADER_PAD_SIZE */ -#endif /* NX_PACKET_HEADER_PAD */ - -/* If NX_PACKET_ALIGNMENT is defined, packet header and payload are aligned automatically to the value specified - in the symbol. The default is to align packet payload area to ULONG. */ -#ifndef NX_PACKET_ALIGNMENT -#define NX_PACKET_ALIGNMENT sizeof(ULONG) -#endif /* NX_PACKET_ALIGNMENT */ - - -/* Define basic constants for the NetX TCP/IP Stack. */ -#define AZURE_RTOS_NETXDUO -#define NETXDUO_MAJOR_VERSION 6 -#define NETXDUO_MINOR_VERSION 1 -#define NETXDUO_PATCH_VERSION 8 - -/* Define the following symbols for backward compatibility */ -#define EL_PRODUCT_NETXDUO -#define __PRODUCT_NETXDUO__ -#define __NETXDUO_MAJOR_VERSION__ NETXDUO_MAJOR_VERSION -#define __NETXDUO_MINOR_VERSION__ NETXDUO_MINOR_VERSION - -/* API input parameters and general constants. */ -#define NX_NO_WAIT 0 -#define NX_WAIT_FOREVER ((ULONG)0xFFFFFFFF) -#define NX_TRUE 1 -#define NX_FALSE 0 -#define NX_NULL 0 -#define NX_FOREVER 1 -#define NX_INIT_PACKET_ID 1 -#ifndef NX_MAX_PORT -#define NX_MAX_PORT 0xFFFF -#endif /* NX_MAX_PORT */ -#define NX_LOWER_16_MASK ((ULONG)0x0000FFFF) -#define NX_CARRY_BIT ((ULONG)0x10000) -#define NX_SHIFT_BY_16 16 -#define NX_TCP_CLIENT 1 -#define NX_TCP_SERVER 2 -#define NX_ANY_PORT 0 -#ifndef NX_SEARCH_PORT_START -#define NX_SEARCH_PORT_START 0xC000 /* Free port search start UDP/TCP */ -#endif /* NX_SEARCH_PORT_START */ - -#ifndef NX_PHYSICAL_HEADER -#define NX_PHYSICAL_HEADER 16 /* Maximum physical header */ -#endif - -#ifndef NX_PHYSICAL_TRAILER -#define NX_PHYSICAL_TRAILER 4 /* Maximum physical trailer */ -#endif - -/* Specify th wait interval, in seconds. */ -#ifndef NX_PATH_MTU_INCREASE_WAIT_INTERVAL -#define NX_PATH_MTU_INCREASE_WAIT_INTERVAL 600 -#endif - -#define NX_PATH_MTU_INCREASE_WAIT_INTERVAL_TICKS (NX_PATH_MTU_INCREASE_WAIT_INTERVAL * NX_IP_PERIODIC_RATE) - -/* Force to disable IPv6 on STM32L4XX. */ -#ifndef NX_DISABLE_IPV6 -#define NX_DISABLE_IPV6 -#endif /* NX_DISABLE_IPV6 */ - -/* Remove the IPv6 component if NX_DISABLE_IPV6 is defined. */ -#ifdef NX_DISABLE_IPV6 -#ifdef FEATURE_NX_IPV6 -#undef FEATURE_NX_IPV6 -#endif /* FEATURE_NX_IPV6 */ -#endif /* NX_DISABLE_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - -/* Define the IPsec header size. The space reserved here is good for ESP/AH header and possiblly IPv4/v6 header in tunnel mode. */ -#ifdef FEATURE_NX_IPV6 -#define NX_IPSEC_MAX_HEADER_SIZE (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 16 + 40) -#else /* !FEATURE_NX_IPV6 */ -#define NX_IPSEC_MAX_HEADER_SIZE (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 12 + 20) -#endif /* FEATURE_NX_IPV6 */ - -#else /* !NX_IPSEC_ENABLE */ -#define NX_IPSEC_MAX_HEADER_SIZE 0 -#endif /* NX_IPSEC_ENABLE */ - -#ifndef NX_IPV6_HOST_ID_LENGTH -#define NX_IPV6_HOST_ID_LENGTH 64 -#endif /* NX_IPV6_HOST_ID_LENGTH */ - -#define NX_IPv4_PACKET (NX_PHYSICAL_HEADER + 20) /* 20 bytes of IP header */ -#define NX_IPv4_TCP_PACKET (NX_IPv4_PACKET + 20) /* IP header plus 20 bytes */ -#define NX_IPv4_UDP_PACKET (NX_IPv4_PACKET + 8) /* IP header plus 8 bytes */ -#define NX_IPv4_ICMP_PACKET (NX_IPv4_PACKET) -#define NX_IPv4_IGMP_PACKET (NX_IPv4_PACKET) - -#define NX_IPv6_PACKET (NX_PHYSICAL_HEADER + 40) /* 40 bytes of basic IPv6 Header */ -#define NX_IPv6_UDP_PACKET (NX_IPv6_PACKET + 8) /* IPv6 header plus 8 bytes */ -#define NX_IPv6_TCP_PACKET (NX_IPv6_PACKET + 20) /* IPv6 header plus 20 bytes */ -#define NX_IPv6_ICMP_PACKET (NX_IPv6_PACKET) -#define NX_RECEIVE_PACKET 0 /* This is for driver receive */ - - -#ifdef FEATURE_NX_IPV6 -/* For systems with IPv6 enabled, the payload offset defaults to IPv6 header size. */ -#define NX_IP_PACKET NX_IPv6_PACKET -#define NX_TCP_PACKET (NX_IPv6_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_UDP_PACKET (NX_IPv6_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_ICMP_PACKET (NX_IPv6_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#else -/* Define payload offset to IPv4 header size if IPv6 is not defined. */ -#define NX_IP_PACKET NX_IPv4_PACKET -#define NX_TCP_PACKET (NX_IPv4_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_UDP_PACKET (NX_IPv4_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_ICMP_PACKET (NX_IPv4_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#endif /* FEATURE_NX_IPV6 */ -#define NX_IGMP_PACKET NX_IPv4_IGMP_PACKET - - -/* Define the ARP update rate, in terms of IP periodic intervals. This can be defined on the - command line as well. */ - -#ifndef NX_ARP_UPDATE_RATE -#define NX_ARP_UPDATE_RATE 10 -#endif - - -/* Define the ARP entry expiration rate, in terms of IP periodic intervals. This can be defined on the - command line as well. A value of 0 disables ARP entry expiration, and is the default. */ - -#ifndef NX_ARP_EXPIRATION_RATE -#define NX_ARP_EXPIRATION_RATE 0 -#endif - - -/* Define the ARP maximum retry constant that specifies the maximum number of ARP requests that will be sent - without receiving an ARP response. Once this limit is reached, the ARP attempt is abandoned and - any queued packet is released. */ - -#ifndef NX_ARP_MAXIMUM_RETRIES -#define NX_ARP_MAXIMUM_RETRIES 18 -#endif - - -/* Define the maximum number of packets that can be queued while waiting for ARP resolution of an - IP address. */ - -#ifndef NX_ARP_MAX_QUEUE_DEPTH -#define NX_ARP_MAX_QUEUE_DEPTH 4 -#endif - - -/* Define the maximum time of IP reassembly. */ -#ifndef NX_IP_MAX_REASSEMBLY_TIME - -/* Define the maximum time of IPv4 reassembly. RFC791, Section3.2, page27. */ -#ifndef NX_IPV4_MAX_REASSEMBLY_TIME -#define NX_IPV4_MAX_REASSEMBLY_TIME 15 -#endif - -/* Define the maximum time of IPv6 reassembly. RFC2460, Section4.5, page22. */ -#ifndef NX_IPV6_MAX_REASSEMBLY_TIME -#define NX_IPV6_MAX_REASSEMBLY_TIME 60 -#endif - -#else /* NX_IP_MAX_REASSEMBLY_TIME */ - -/* Define the maximum time of IP reassembly. */ -#define NX_IPV4_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME -#define NX_IPV6_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME - -#endif /* NX_IP_MAX_REASSEMBLY_TIME */ - - -/* Define the maximum number of the packets that can be queued for raw receive. */ -#ifndef NX_IP_RAW_MAX_QUEUE_DEPTH -#define NX_IP_RAW_MAX_QUEUE_DEPTH 20 -#endif - -#ifndef NX_IP_ROUTING_TABLE_SIZE -#define NX_IP_ROUTING_TABLE_SIZE 8 -#endif /* NX_IP_ROUTING_TABLE_SIZE */ - -/* For backward compatibility, map the smbol NX_RAW_PACKET_FILTER_ENABLE to - NX_ENABLE_IP_RAW_PACKET_FILTER. */ -#ifdef NX_RAW_PACKET_FILTER_ENABLE -#ifndef NX_ENABLE_IP_RAW_PACKET_FILTER -#define NX_ENABLE_IP_RAW_PACKET_FILTER -#endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */ -#endif /* NX_RAW_PACKET_FILTER_ENABLE */ - -/* For backward compatibility, map the symbol NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS - to NX_DISABLE_ICMPV6_REDIRECT_PROCESS. */ -#ifdef NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS -#ifndef NX_DISABLE_ICMPV6_REDIRECT_PROCESS -#define NX_DISABLE_ICMPV6_REDIRECT_PROCESS -#endif /* NX_DISABLE_ICMPV6_REDIRECT_PROCESS */ -#endif /* NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS to NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ -#ifdef NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#ifndef NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#define NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#endif /* NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ -#endif /* NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION to NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ -#ifdef NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION -#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION -#define NX_DISABLE_ICMPV6_ROUTER_SOLICITATION -#endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ -#endif /* NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE to NX_DISABLE_ICMPV6_ERROR_MESSAGE */ -#ifdef NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE -#ifndef NX_DISABLE_ICMPV6_ERROR_MESSAGE -#define NX_DISABLE_ICMPV6_ERROR_MESSAGE -#endif /* NX_DISABLE_ICMPV6_ERROR_MESSAGE */ -#endif /* NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE */ - -/* For backward compatibility, convert map NXDUO_DISABLE_DAD to NX_DISABLE_IPV6_DAD */ -#ifdef NXDUO_DISABLE_DAD -#ifndef NX_DISABLE_IPV6_DAD -#define NX_DISABLE_IPV6_DAD -#endif /* NX_DISABLE_IPV6_DAD */ -#endif /* NXDUO_DISABLE_DAD */ - -/* For backward compatibility, convert map NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE to NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#ifdef NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE -#ifndef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#endif /* NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE */ - -/* For backward compatibility, convert map NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES to NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */ -#ifdef NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES -#ifndef NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES -#define NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES -#endif /* NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */ -#endif /* NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES */ - -/* For backward compatibility, convert map NX_IPV6_MULTICAST_ENABLE to NX_ENABLE_IPV6_MULTICAST */ -#ifdef NX_IPV6_MULTICAST_ENABLE -#ifndef NX_ENABLE_IPV6_MULTICAST -#define NX_ENABLE_IPV6_MULTICAST -#endif /* NX_ENABLE_IPV6_MULTICAST */ -#endif /* NX_IPV6_MULTICAST_ENABLE */ - -/* Define the size of the IPv6 destination table. */ -/* For backward compatibility, convert map NX_DESTINATION_TABLE_SIZE and NXDUO_DESTINATION_TABLE_SIZE to NX_IPV6_DESTINATION_TABLE_SIZE */ -#ifdef NX_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE NX_DESTINATION_TABLE_SIZE -#endif /* NX_DESTINATION_TABLE_SIZE */ - -#ifdef NXDUO_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE NXDUO_DESTINATION_TABLE_SIZE -#endif /* NXDUO_DESTINATION_TABLE_SIZE */ - -#ifndef NX_IPV6_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE 8 -#ifndef NX_DESTINATION_TABLE_SIZE -#define NX_DESTINATION_TABLE_SIZE NX_IPV6_DESTINATION_TABLE_SIZE -#endif /* NX_DESTINATION_TABLE_SIZE */ -#ifndef NXDUO_DESTINATION_TABLE_SIZE -#define NXDUO_DESTINATION_TABLE_SIZE NX_IPV6_DESTINATION_TABLE_SIZE -#endif /* NXDUO_DESTINATION_TABLE_SIZE */ -#endif /* NX_IPV6_DESTINATION_TABLE_SIZE */ - -/* Define the size of the IPv6 ND cache table. */ -#ifndef NX_IPV6_NEIGHBOR_CACHE_SIZE -#define NX_IPV6_NEIGHBOR_CACHE_SIZE 16 -#endif /* NX_IPV6_NEIGHBOR_CACHE_SIZE */ - -/* Define the maximum ICMPv6 Duplicate Address Detect Transmit . */ -/* For backward compatibility, convert map NX_DUP_ADDR_DETECT_TRANSMITS and NXDUO_DUP_ADDR_DETECT_TRANSMITS to NX_IPV6_DAD_TRANSMITS */ -#ifdef NX_DUP_ADDR_DETECT_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS NX_DUP_ADDR_DETECT_TRANSMITS -#endif /* NX_DUP_ADDR_DETECT_TRANSMITS */ - -#ifdef NXDUO_DUP_ADDR_DETECT_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS NXDUO_DUP_ADDR_DETECT_TRANSMITS -#endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */ - -#ifndef NX_IPV6_DAD_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS 3 -#ifndef NX_DUP_ADDR_DETECT_TRANSMITS -#define NX_DUP_ADDR_DETECT_TRANSMITS NX_IPV6_DAD_TRANSMITS -#endif /* NX_DUP_ADDR_DETECT_TRANSMITS */ -#ifndef NXDUO_DUP_ADDR_DETECT_TRANSMITS -#define NXDUO_DUP_ADDR_DETECT_TRANSMITS NX_IPV6_DAD_TRANSMITS -#endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */ -#endif /* NX_IPV6_DAD_TRANSMITS */ - -/* For backward compatibility, convert map NX_ARP_DISABLE_AUTO_ARP_ENTRY to NX_DISABLE_ARP_AUTO_ENTRY. */ -#ifdef NX_ARP_DISABLE_AUTO_ARP_ENTRY -#ifndef NX_DISABLE_ARP_AUTO_ENTRY -#define NX_DISABLE_ARP_AUTO_ENTRY -#endif /* NX_DISABLE_ARP_AUTO_ENTRY */ -#endif /* NX_ARP_DISABLE_AUTO_ARP_ENTRY */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_KEEPALIVE to NX_ENABLE_TCP_KEEPALIVE. */ -#ifdef NX_TCP_ENABLE_KEEPALIVE -#ifndef NX_ENABLE_TCP_KEEPALIVE -#define NX_ENABLE_TCP_KEEPALIVE -#endif /* NX_ENABLE_TCP_KEEPALIVE */ -#endif /* NX_TCP_ENABLE_KEEPALIVE */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_WINDOW_SCALING to NX_ENABLE_TCP_WINDOW_SCALING. */ -#ifdef NX_TCP_ENABLE_WINDOW_SCALING -#ifndef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_ENABLE_TCP_WINDOW_SCALING -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -#endif /* NX_TCP_ENABLE_WINDOW_SCALING */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_MSS_CHECK to NX_ENABLE_TCP_MSS_CHECK. */ -#ifdef NX_TCP_ENABLE_MSS_CHECK -#ifndef NX_ENABLE_TCP_MSS_CHECK -#define NX_ENABLE_TCP_MSS_CHECK -#endif /* NX_ENABLE_TCP_MSS_CHECK */ -#endif /* NX_TCP_ENABLE_MSS_CHECK */ - -/* For backward compatibility, convert map NX_DUAL_PACKET_POOL_ENABLE to NX_ENABLE_DUAL_PACKET_POOL. */ -#ifdef NX_DUAL_PACKET_POOL_ENABLE -#ifndef NX_ENABLE_DUAL_PACKET_POOL -#define NX_ENABLE_DUAL_PACKET_POOL -#endif /* NX_ENABLE_DUAL_PACKET_POOL. */ -#endif /* NX_DUAL_PACKET_POOL_ENABLE */ - -/* For backward compatibility, convert map NX_ENABLE_FEATURE_LOW_WATERMARK to NX_ENABLE_LOW_WATERMARK. */ -#ifdef NX_ENABLE_FEATURE_LOW_WATERMARK -#ifndef NX_ENABLE_LOW_WATERMARK -#define NX_ENABLE_LOW_WATERMARK -#endif /* NX_ENABLE_LOW_WATERMARK */ -#endif /* NX_ENABLE_FEATURE_LOW_WATERMARK */ - -#ifdef NX_DISABLE_ICMP_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM -#define NX_DISABLE_ICMPV4_RX_CHECKSUM -#endif -#ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM -#define NX_DISABLE_ICMPV6_RX_CHECKSUM -#endif -#endif /* NX_DISABLE_ICMP_RX_CHECKSUM */ - -#ifdef NX_DISABLE_ICMP_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM -#define NX_DISABLE_ICMPV4_TX_CHECKSUM -#endif -#ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM -#define NX_DISABLE_ICMPV6_TX_CHECKSUM -#endif -#endif /* NX_DISABLE_ICMP_TX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv4_RX_CHECKSUM to NX_DISABLE_ICMPV4_RX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv4_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM -#define NX_DISABLE_ICMPV4_RX_CHECKSUM -#endif /* NX_DISABLE_ICMPV4_RX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv4_RX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv4_TX_CHECKSUM to NX_DISABLE_ICMPV4_TX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv4_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM -#define NX_DISABLE_ICMPV4_TX_CHECKSUM -#endif /* NX_DISABLE_ICMPV4_TX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv4_TX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv6_RX_CHECKSUM to NX_DISABLE_ICMPV6_RX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv6_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM -#define NX_DISABLE_ICMPV6_RX_CHECKSUM -#endif /* NX_DISABLE_ICMPV6_RX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv6_RX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv6_TX_CHECKSUM to NX_DISABLE_ICMPV6_TX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv6_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM -#define NX_DISABLE_ICMPV6_TX_CHECKSUM -#endif /* NX_DISABLE_ICMPV6_TX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv6_TX_CHECKSUM */ - - - -#ifdef NX_ENABLE_EXTENDED_NOTIFY_SUPPORT -#ifdef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#undef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#endif /* NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */ -#else -#define NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#endif /* !NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */ - -/* Define the IPv4 fragment options. */ - -#define NX_FRAGMENT_OKAY ((ULONG)0x00000000) -#define NX_DONT_FRAGMENT ((ULONG)0x00004000) -#define NX_MORE_FRAGMENTS ((ULONG)0x00002000) -#define NX_FRAG_OFFSET_MASK ((ULONG)0x00001FFF) - - -/* Define the IPv4 Type Of Service constants. These will be supplied to the - IPv4 output packet routine. */ - -#define NX_IP_NORMAL ((ULONG)0x00000000) /* Normal IP delivery */ -#define NX_IP_MIN_DELAY ((ULONG)0x00100000) /* Minimum Delay delivery */ -#define NX_IP_MAX_DATA ((ULONG)0x00080000) /* Maximum Throughput delivery */ -#define NX_IP_MAX_RELIABLE ((ULONG)0x00040000) /* Maximum Reliable delivery */ -#define NX_IP_MIN_COST ((ULONG)0x00020000) /* Minimum Cost deliver */ -#define NX_IP_TOS_MASK ((ULONG)0x00FF0000) /* Type of Service Mask */ - - -/* Define the IPv4 length mask. */ - -#define NX_IP_PACKET_SIZE_MASK ((ULONG)0x0000FFFF) /* Mask for isolating the IP packet length */ - - -/* Define the IPv4 default time to live. */ - -#define NX_IP_TIME_TO_LIVE ((ULONG)0x00000080) /* Default packet time to live */ -#define NX_IP_TIME_TO_LIVE_MASK ((ULONG)0xFF000000) /* Mask for isolating the time to live */ -#define NX_IP_TIME_TO_LIVE_SHIFT 24 /* Number of bits to shift left */ - - - - -/* Define IPv6 protocol types. These types are used in the - "next header" field in IPv6 header and optional headers. */ -#define NX_PROTOCOL_NEXT_HEADER_HOP_BY_HOP 0 -#define NX_PROTOCOL_ICMP 1 -#define NX_PROTOCOL_IGMP 2 -#define NX_PROTOCOL_IPV4 4 /* IP-in-IP encapsulation */ -#define NX_PROTOCOL_TCP 6 -#define NX_PROTOCOL_UDP 17 -#define NX_PROTOCOL_IPV6 41 /* IP-in-IP encapsulation */ -#define NX_PROTOCOL_NEXT_HEADER_ROUTING 43 -#define NX_PROTOCOL_NEXT_HEADER_FRAGMENT 44 -#define NX_PROTOCOL_NEXT_HEADER_ENCAP_SECURITY 50 -#define NX_PROTOCOL_NEXT_HEADER_AUTHENTICATION 51 -#define NX_PROTOCOL_ICMPV6 58 -#define NX_PROTOCOL_NO_NEXT_HEADER 59 -#define NX_PROTOCOL_NEXT_HEADER_DESTINATION 60 -#define NX_PROTOCOL_NEXT_HEADER_MOBILE 135 - -/* Define the type of Protocol in this IPv6 packet. */ -/* Note that these values can be directly mapped to the protocol field in an IPv4 header. */ -#define NX_IP_ICMP ((ULONG)0x00010000) /* ICMP Protocol Type */ -#define NX_IP_IGMP ((ULONG)0x00020000) /* IGMP Protocol Type */ -#define NX_IP_TCP ((ULONG)0x00060000) /* TCP Protocol Type */ -#define NX_IP_UDP ((ULONG)0x00110000) /* UDP Protocol Type */ -#define NX_IP_ESP ((ULONG)0x00320000) /* ESP Protocol Type */ -#define NX_IP_AH ((ULONG)0x00330000) /* UDP Protocol Type */ -#define NX_IP_PROTOCOL_MASK ((ULONG)0x00FF0000) /* Protocol Type mask */ - - -/* Define IPv4 address type masks and values. These will determine the net id and - host id fields of the supplied IPv4 address. */ - -#define NX_IP_CLASS_A_MASK ((ULONG)0x80000000) /* Define mask for class A IP addresses */ -#define NX_IP_CLASS_A_TYPE ((ULONG)0x00000000) /* Define class A address type */ -#define NX_IP_CLASS_A_NETID ((ULONG)0x7F000000) /* Define class A network ID mask */ -#define NX_IP_CLASS_A_HOSTID ((ULONG)0x00FFFFFF) /* Define class A host ID mask */ - -#define NX_IP_CLASS_B_MASK ((ULONG)0xC0000000) /* Define mask for class B IP addresses */ -#define NX_IP_CLASS_B_TYPE ((ULONG)0x80000000) /* Define class B address type */ -#define NX_IP_CLASS_B_NETID ((ULONG)0x3FFF0000) /* Define class B network ID mask */ -#define NX_IP_CLASS_B_HOSTID ((ULONG)0x0000FFFF) /* Define class B host ID mask */ - -#define NX_IP_CLASS_C_MASK ((ULONG)0xE0000000) /* Define mask for class C IP addresses */ -#define NX_IP_CLASS_C_TYPE ((ULONG)0xC0000000) /* Define class C address type */ -#define NX_IP_CLASS_C_NETID ((ULONG)0x1FFFFF00) /* Define class C network ID mask */ -#define NX_IP_CLASS_C_HOSTID ((ULONG)0x000000FF) /* Define class C host ID mask */ - -#define NX_IP_CLASS_D_MASK ((ULONG)0xF0000000) /* Define mask for class D IP addresses */ -#define NX_IP_CLASS_D_TYPE ((ULONG)0xE0000000) /* Define class D address type */ -#define NX_IP_CLASS_D_GROUP ((ULONG)0x0FFFFFFF) /* Define class D group ID mask */ -#define NX_IP_CLASS_D_HOSTID ((ULONG)0x00000000) /* Define class D host ID mask N/A */ - -#define NX_IP_LIMITED_BROADCAST ((ULONG)0xFFFFFFFF) /* Limited broadcast address (local net) */ -#define NX_IP_LOOPBACK_FIRST ((ULONG)0x7F000000) /* First loopback address 127.0.0.0 */ -#define NX_IP_LOOPBACK_LAST ((ULONG)0x7FFFFFFF) /* Last loopback address 127.255.255.255 */ - -#define NX_IP_MULTICAST_UPPER ((ULONG)0x00000100) /* Upper two bytes of multicast Ethernet */ -#define NX_IP_MULTICAST_LOWER ((ULONG)0x5E000000) /* Lower 23 bits of address are from IP */ -#define NX_IP_MULTICAST_MASK ((ULONG)0x007FFFFF) /* Mask to pickup the lower 23 bits of IP */ - - -/* Define the constants that determine how big the hash table is for destination IP - addresses. The value must be a power of two, so subtracting one gives us - the mask. */ - -#define NX_ROUTE_TABLE_SIZE 32 -#define NX_ROUTE_TABLE_MASK (NX_ROUTE_TABLE_SIZE - 1) - -/* By default use 0xFF when sending raw packet. */ -#ifndef NX_IP_RAW -#define NX_IP_RAW 0x00FF0000 -#endif /* NX_IP_RAW */ - -/* - * NX_ROUTE_TABLE_SIZE|MASK are used for ARP table. So we define NX_ARP_TABLE_SIZE|MASK so the - * macro names are more descriptive. - * - * NX_ROUTE_TABLE_SIZE and NX_ROUTE_TABLE_MASK will be deprecated in future releases. - */ -#define NX_ARP_TABLE_SIZE NX_ROUTE_TABLE_SIZE -#define NX_ARP_TABLE_MASK (NX_ARP_TABLE_SIZE - 1) - - - -#ifdef FEATURE_NX_IPV6 -/* Define IPv6 address state. These states are defined in RFC 2462. */ - -#define NX_IPV6_ADDR_STATE_UNKNOWN 0x00 -#define NX_IPV6_ADDR_STATE_TENTATIVE 0x01 -#define NX_IPV6_ADDR_STATE_PREFERRED 0x02 -#define NX_IPV6_ADDR_STATE_DEPRECATED 0x03 -#define NX_IPV6_ADDR_STATE_VALID 0x04 - - - -/* Define the size of the IPv6 Default Router Table. */ -#ifndef NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE -#define NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE 8 -#endif /* NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE */ - -/* Define the size of the IPv6 prefix table. */ -#ifndef NX_IPV6_PREFIX_LIST_TABLE_SIZE -#define NX_IPV6_PREFIX_LIST_TABLE_SIZE 8 -#endif /* NX_IPV6_PREFIX_LIST_TABLE_SIZE */ - -/* Flags for the IPv6 default router table status field. */ -#define NX_IPV6_ROUTE_TYPE_NOT_ROUTER 0x00 -#define NX_IPV6_ROUTE_TYPE_SOLICITATED 0x01 -#define NX_IPV6_ROUTE_TYPE_UNSOLICITATED 0x02 -#define NX_IPV6_ROUTE_TYPE_STATIC 0x04 -#define NX_IPV6_ROUTE_TYPE_DEFAULT 0x40 -#define NX_IPV6_ROUTE_TYPE_VALID 0x80 - -#define NX_IPV6_ADDRESS_NOT_CONFIGURED 0 -#define NX_IPV6_ADDRESS_MANUAL_CONFIG 1 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_IPV6_ADDRESS_STATELESS_AUTO_CONFIG 2 -#define NX_IPV6_ADDRESS_STATEFUL_AUTO_CONFIG 3 -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#define NX_IPV6_ADDRESS_BASED_ON_INTERFACE 4 -#define NX_IPV6_ADDRESS_MANUAL_DELETE 5 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_IPV6_ADDRESS_LIFETIME_EXPIRED 6 -#define NX_IPV6_ADDRESS_DAD_SUCCESSFUL 7 -#define NX_IPV6_ADDRESS_DAD_FAILURE 8 -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ - - - -/* Define the maximum number of packets that can be queued while waiting for Neighbor Discovery - to resolution of an IPv6 address. */ -#ifndef NX_ND_MAX_QUEUE_DEPTH -#define NX_ND_MAX_QUEUE_DEPTH 4 -#endif - -/* Define the ND cache entry structure. */ -typedef struct ND_CACHE_ENTRY_STRUCT -{ - - /* Neighbor IP address. */ - ULONG nx_nd_cache_dest_ip[4]; - - /* Corresponding LLA. */ - UCHAR nx_nd_cache_mac_addr[6]; - - /* Padding. Reserved for future use. */ - /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved1) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_nd_cache_reserved1; - - /* Padding. Reserved for future use. */ - /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved2) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_nd_cache_reserved2; - - /* Number of Solicitation it needs to send before timing out. */ - UCHAR nx_nd_cache_num_solicit; - - /* Entry Status, such as INCOMPLETE, REACHABLE, and so on. */ - UCHAR nx_nd_cache_nd_status; - - /* Number of out going packets waiting for this entry to be resolved. */ - UCHAR nx_nd_cache_packet_waiting_queue_length; - - /* Whether or not this entry is statically configured. */ - UCHAR nx_nd_cache_is_static; - - /* Timeout value. */ - ULONG nx_nd_cache_timer_tick; - - /* Interface through which the destination can be reached. */ - struct NX_INTERFACE_STRUCT *nx_nd_cache_interface_ptr; - - /* Link to the default router table, if this neighbor is a router. */ - struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT *nx_nd_cache_is_router; - - /* - * Queue head and queue tail of the out going packets. - * This queue is used for keeping outgoing packets while the stack is - * resolving the target link layer address. - */ - struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_head; - struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_tail; - - /* - * Local interface associated with this neighbor entry. If outoing_address is known - * outgoing packets shall be sent using this address. - */ - struct NXD_IPV6_ADDRESS_STRUCT *nx_nd_cache_outgoing_address; -} ND_CACHE_ENTRY; - -/* Define the destination table entry type. */ -typedef struct NX_IPV6_DESTINATION_ENTRY_STRUCT -{ - /* Flag indicates whether or not the entry is valid. */ - ULONG nx_ipv6_destination_entry_valid; - - /* Destination IP address. */ - ULONG nx_ipv6_destination_entry_destination_address[4]; - - /* Next hop address. Next hop could be the host, if it - is on the local network, or a router. */ - ULONG nx_ipv6_destination_entry_next_hop[4]; - - /* Cross link to the next hop entry in the ND cache. */ - ND_CACHE_ENTRY *nx_ipv6_destination_entry_nd_entry; - -#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY - - /* Maximum transmission size for this destination. */ - ULONG nx_ipv6_destination_entry_path_mtu; - - /* MTU Timeout value. */ - ULONG nx_ipv6_destination_entry_MTU_timer_tick; -#endif -} NX_IPV6_DESTINATION_ENTRY; - -/* Define data structure for IPv6 prefix table. */ -typedef struct NX_IPV6_PREFIX_ENTRY_STRUCT -{ - /* Network IPv6 prefix address, in host byte order. */ - ULONG nx_ipv6_prefix_entry_network_address[4]; - - /* Number of valid bits in the prefix. */ - ULONG nx_ipv6_prefix_entry_prefix_length; - - /* Valid life time, in seconds. */ - ULONG nx_ipv6_prefix_entry_valid_lifetime; - - /* Pointer to the previous entry. */ - struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_prev; - - /* Pointer to the next entry. */ - struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_next; -} NX_IPV6_PREFIX_ENTRY; - - -/* Define data structure for IPv6 default router table. */ -typedef struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT -{ - /* route type */ - UCHAR nx_ipv6_default_router_entry_flag; - - /* Reserved for future expansion. */ - /*lint -esym(768,NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT::nx_ipv6_default_router_entry_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_ipv6_default_router_entry_reserved; - - /* Router Life Time, in seconds, host-byte order. */ - USHORT nx_ipv6_default_router_entry_life_time; - - /* Router interface address. */ - ULONG nx_ipv6_default_router_entry_router_address[4]; - - /* Router interface index. */ - struct NX_INTERFACE_STRUCT *nx_ipv6_default_router_entry_interface_ptr; - - /* Point to the corresonding neighbor cache entry. */ - ND_CACHE_ENTRY *nx_ipv6_default_router_entry_neighbor_cache_ptr; -} NX_IPV6_DEFAULT_ROUTER_ENTRY; - -#endif /* FEATURE_NX_IPV6 */ -/* Define the constants that determine how big the hash table is for UDP ports. The - value must be a power of two, so subtracting one gives us the mask. */ - -#define NX_UDP_PORT_TABLE_SIZE 32 -#define NX_UDP_PORT_TABLE_MASK (NX_UDP_PORT_TABLE_SIZE - 1) - - -/* Define the constants that determine how big the hash table is for TCP ports. The - value must be a power of two, so subtracting one gives us the mask. */ - -#define NX_TCP_PORT_TABLE_SIZE 32 -#define NX_TCP_PORT_TABLE_MASK (NX_TCP_PORT_TABLE_SIZE - 1) - - -/* Define the maximum number of multicast groups the system can support. This might - be further limited by the underlying physical hardware. */ - -#ifndef NX_MAX_MULTICAST_GROUPS -#define NX_MAX_MULTICAST_GROUPS 7 -#endif - -/* The following symbol defines the number of IPv6 addresses in the system. - A typical system shall have 2 IPv6 addresses: one linklocal address and one global address. */ - - -/* Define the maximum number of internal server resources for TCP connections. Server - connections require a listen control structure. */ - -#ifndef NX_MAX_LISTEN_REQUESTS -#define NX_MAX_LISTEN_REQUESTS 10 -#endif - - -/* Define the IP status checking/return bits. */ - -#define NX_IP_INITIALIZE_DONE ((ULONG)0x0001) -#define NX_IP_ADDRESS_RESOLVED ((ULONG)0x0002) -#define NX_IP_LINK_ENABLED ((ULONG)0x0004) -#define NX_IP_ARP_ENABLED ((ULONG)0x0008) -#define NX_IP_UDP_ENABLED ((ULONG)0x0010) -#define NX_IP_TCP_ENABLED ((ULONG)0x0020) -#define NX_IP_IGMP_ENABLED ((ULONG)0x0040) -#define NX_IP_RARP_COMPLETE ((ULONG)0x0080) -#define NX_IP_INTERFACE_LINK_ENABLED ((ULONG)0x0100) - -/* Define various states in the TCP connection state machine. */ - -#define NX_TCP_CLOSED 1 /* Connection is closed state */ -#define NX_TCP_LISTEN_STATE 2 /* Server listen state */ -#define NX_TCP_SYN_SENT 3 /* SYN sent state */ -#define NX_TCP_SYN_RECEIVED 4 /* SYN received state */ -#define NX_TCP_ESTABLISHED 5 /* Connection established state */ -#define NX_TCP_CLOSE_WAIT 6 /* Close Wait state */ -#define NX_TCP_FIN_WAIT_1 7 /* Finished Wait 1 state */ -#define NX_TCP_FIN_WAIT_2 8 /* Finished Wait 2 state */ -#define NX_TCP_CLOSING 9 /* Closing state */ -#define NX_TCP_TIMED_WAIT 10 /* Timed wait state */ -#define NX_TCP_LAST_ACK 11 /* Last ACK state */ - - -/* API return values. */ - -#define NX_SUCCESS 0x00 -#define NX_NO_PACKET 0x01 -#define NX_UNDERFLOW 0x02 -#define NX_OVERFLOW 0x03 -#define NX_NO_MAPPING 0x04 -#define NX_DELETED 0x05 -#define NX_POOL_ERROR 0x06 -#define NX_PTR_ERROR 0x07 -#define NX_WAIT_ERROR 0x08 -#define NX_SIZE_ERROR 0x09 -#define NX_OPTION_ERROR 0x0a -#define NX_DELETE_ERROR 0x10 -#define NX_CALLER_ERROR 0x11 -#define NX_INVALID_PACKET 0x12 -#define NX_INVALID_SOCKET 0x13 -#define NX_NOT_ENABLED 0x14 -#define NX_ALREADY_ENABLED 0x15 -#define NX_ENTRY_NOT_FOUND 0x16 -#define NX_NO_MORE_ENTRIES 0x17 -#define NX_ARP_TIMER_ERROR 0x18 -#define NX_RESERVED_CODE0 0x19 -#define NX_WAIT_ABORTED 0x1A -#define NX_IP_INTERNAL_ERROR 0x20 -#define NX_IP_ADDRESS_ERROR 0x21 -#define NX_ALREADY_BOUND 0x22 -#define NX_PORT_UNAVAILABLE 0x23 -#define NX_NOT_BOUND 0x24 -#define NX_RESERVED_CODE1 0x25 -#define NX_SOCKET_UNBOUND 0x26 -#define NX_NOT_CREATED 0x27 -#define NX_SOCKETS_BOUND 0x28 -#define NX_NO_RESPONSE 0x29 -#define NX_POOL_DELETED 0x30 -#define NX_ALREADY_RELEASED 0x31 -#define NX_RESERVED_CODE2 0x32 -#define NX_MAX_LISTEN 0x33 -#define NX_DUPLICATE_LISTEN 0x34 -#define NX_NOT_CLOSED 0x35 -#define NX_NOT_LISTEN_STATE 0x36 -#define NX_IN_PROGRESS 0x37 -#define NX_NOT_CONNECTED 0x38 -#define NX_WINDOW_OVERFLOW 0x39 -#define NX_ALREADY_SUSPENDED 0x40 -#define NX_DISCONNECT_FAILED 0x41 -#define NX_STILL_BOUND 0x42 -#define NX_NOT_SUCCESSFUL 0x43 -#define NX_UNHANDLED_COMMAND 0x44 -#define NX_NO_FREE_PORTS 0x45 -#define NX_INVALID_PORT 0x46 -#define NX_INVALID_RELISTEN 0x47 -#define NX_CONNECTION_PENDING 0x48 -#define NX_TX_QUEUE_DEPTH 0x49 -#define NX_NOT_IMPLEMENTED 0x4A -#define NX_NOT_SUPPORTED 0x4B -#define NX_INVALID_INTERFACE 0x4C -#define NX_INVALID_PARAMETERS 0x4D -#define NX_NOT_FOUND 0x4E -#define NX_CANNOT_START 0x4F -#define NX_NO_INTERFACE_ADDRESS 0x50 -#define NX_INVALID_MTU_DATA 0x51 -#define NX_DUPLICATED_ENTRY 0x52 -#define NX_PACKET_OFFSET_ERROR 0x53 -#define NX_OPTION_HEADER_ERROR 0x54 -#define NX_CONTINUE 0x55 - -/* Define Link Driver constants. */ - -#define NX_LINK_PACKET_SEND 0 -#define NX_LINK_INITIALIZE 1 -#define NX_LINK_ENABLE 2 -#define NX_LINK_DISABLE 3 -#define NX_LINK_PACKET_BROADCAST 4 -#define NX_LINK_ARP_SEND 5 -#define NX_LINK_ARP_RESPONSE_SEND 6 -#define NX_LINK_RARP_SEND 7 -#define NX_LINK_MULTICAST_JOIN 8 -#define NX_LINK_MULTICAST_LEAVE 9 -#define NX_LINK_GET_STATUS 10 -#define NX_LINK_GET_SPEED 11 -#define NX_LINK_GET_DUPLEX_TYPE 12 -#define NX_LINK_GET_ERROR_COUNT 13 -#define NX_LINK_GET_RX_COUNT 14 -#define NX_LINK_GET_TX_COUNT 15 -#define NX_LINK_GET_ALLOC_ERRORS 16 -#define NX_LINK_UNINITIALIZE 17 -#define NX_LINK_DEFERRED_PROCESSING 18 -#define NX_LINK_INTERFACE_ATTACH 19 -#define NX_LINK_SET_PHYSICAL_ADDRESS 20 -#define NX_INTERFACE_CAPABILITY_GET 21 -#define NX_INTERFACE_CAPABILITY_SET 22 -#define NX_LINK_INTERFACE_DETACH 23 -#define NX_LINK_FACTORY_ADDRESS_GET 24 -#define NX_LINK_RX_ENABLE 25 -#define NX_LINK_RX_DISABLE 26 -#define NX_LINK_6LOWPAN_COMMAND 27 /* 6LowPAN driver command, the sub command see nx_6lowpan.h. */ - -#define NX_LINK_USER_COMMAND 50 /* Values after this value are reserved for application. */ - -/* Define Link Driver Capability Flags. */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY -#define NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM 0x00000001 -#define NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM 0x00000002 -#define NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM 0x00000004 -#define NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM 0x00000008 -#define NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM 0x00000010 -#define NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM 0x00000020 -#define NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM 0x00000040 -#define NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM 0x00000080 -#define NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM 0x00000100 -#define NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM 0x00000200 -#define NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM 0x00000400 -#define NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM 0x00000800 -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#define NX_IP_VERSION_V4 0x4 -#define NX_IP_VERSION_V6 0x6 - -#if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) -#define NX_STATELESS_ADDRESS_AUTOCONFIG_ENABLED 0 -#define NX_STATELESS_ADDRESS_AUTOCONFIG_DISABLED 1 -#endif /* defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) */ - -/* Define the macro for building IPv4 addresses. */ -#define IP_ADDRESS(a, b, c, d) ((((ULONG)a) << 24) | (((ULONG)b) << 16) | (((ULONG)c) << 8) | ((ULONG)d)) - -/* Define the direction of IP packet. */ -#ifdef NX_ENABLE_IP_PACKET_FILTER -#define NX_IP_PACKET_IN 0 -#define NX_IP_PACKET_OUT 1 -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - -#ifdef NX_ENABLE_THREAD -/* Define the packet type for Thread MLE. */ -#define NX_PACKET_TYPE_THREAD_MLE 0x01 -#endif /* NX_ENABLE_THREAD */ - - -/* Define IPv4/v6 Address structure */ -typedef struct NXD_ADDRESS_STRUCT -{ - /* Flag indicating IP address format. Valid values are: - NX_IP_VERSION_V4 and NX_IP_VERSION_V6. - */ - ULONG nxd_ip_version; - - /* Union that holds either IPv4 or IPv6 address. */ - union - { - -#ifndef NX_DISABLE_IPV4 - ULONG v4; -#endif /* NX_DISABLE_IPV4 */ -#ifdef FEATURE_NX_IPV6 - ULONG v6[4]; -#endif /* FEATURE_NX_IPV6 */ - } nxd_ip_address; -} NXD_ADDRESS; - - -#ifdef NX_IPSEC_ENABLE -/* Define the selector for IPSEC or TUNNEL. */ -typedef struct NX_ADDRESS_SELECTOR_STRUCT -{ - /* Define selector source, destination address. */ - NXD_ADDRESS nx_selector_src_address_start; - NXD_ADDRESS nx_selector_src_address_end; - NXD_ADDRESS nx_selector_dst_address_start; - NXD_ADDRESS nx_selector_dst_address_end; -} NX_ADDRESS_SELECTOR; - -#endif /* NX_IPSEC_ENABLE */ - - -/* Define the control block definitions for all system objects. */ - - -/* Define the basic memory management packet structure. This structure is - used to hold application data as well as internal control data. */ -struct NX_PACKET_POOL_STRUCT; - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/* Define macro to record packet debug information. */ -#define NX_PACKET_DEBUG(f,l,p) {\ - (p) -> nx_packet_debug_file=f;\ - (p) -> nx_packet_debug_line=l;\ - if (tx_thread_identify()) \ - (p) -> nx_packet_debug_thread = tx_thread_identify() -> tx_thread_name; \ - else \ - (p) -> nx_packet_debug_thread = "ISR"; \ - } -#else -#define NX_PACKET_DEBUG(f, l, p) -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - -typedef struct NX_PACKET_STRUCT -{ - - /* Define the pool this packet is associated with. */ - struct NX_PACKET_POOL_STRUCT - *nx_packet_pool_owner; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Define the link to the chain (one or more) of packet extensions. If this is NULL, there - are no packet extensions for this packet. */ - struct NX_PACKET_STRUCT - *nx_packet_next; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Define the pointer to the first byte written closest to the beginning of the - buffer. This is used to prepend information in front of the packet. */ - UCHAR *nx_packet_prepend_ptr; - - /* Define the pointer to the byte after the last character written in the buffer. */ - UCHAR *nx_packet_append_ptr; - - /* Define the packet data area start and end pointer. These will be used to - mark the physical boundaries of the packet. */ - UCHAR *nx_packet_data_start; - UCHAR *nx_packet_data_end; - - /* The above data are required by all packets. */ - /* The following data are required by header packet when optimized packet is not disabled. */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Define the link to the last packet (if any) in the chain. This is used to append - information to the end without having to traverse the entire chain. */ - struct NX_PACKET_STRUCT - *nx_packet_last; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Define the link that will be used to queue the packet. */ - struct NX_PACKET_STRUCT - *nx_packet_queue_next; - - /* Union that holds either tcp_queue_next or fragment_next. */ - union - { - - /* Define the link that will be used to keep outgoing TCP packets queued - so they can be ACKed or re-sent. */ - struct NX_PACKET_STRUCT - *nx_packet_tcp_queue_next; - -#ifndef NX_DISABLE_FRAGMENTATION - /* Define the link to the next fragment. This is only used in IP fragmentation - re-assembly. */ - struct NX_PACKET_STRUCT - *nx_packet_fragment_next; -#endif /* NX_DISABLE_FRAGMENTATION */ - } nx_packet_union_next; - - /* Define the total packet length. */ - ULONG nx_packet_length; - -#ifndef NX_DISABLE_FRAGMENTATION - ULONG nx_packet_reassembly_time; /* Time stamp for measuring the number of seconds a - packet is in the reassebmly logic. Once a time - out value is reached packets of the same FRAG ID - are released. */ -#endif /* NX_DISABLE_FRAGMENTATION */ - -#ifdef FEATURE_NX_IPV6 - UCHAR nx_packet_option_state; /* Used by IPv6, indicating the current option - being processed. */ - UCHAR nx_packet_destination_header; - USHORT nx_packet_option_offset; -#endif /* FEATURE_NX_IPV6 */ - - - /* - Tag the packet type. Valid values are either - NX_IP_VERSION_V4 or NX_IP_VERSION_V6. - */ - UCHAR nx_packet_ip_version; - - /* RFC1122, Section3.2.1.5, Page32-33. RFC1122, Section4.2.2.15, Page90-91. */ - /* nx_packet_identical_copy is to track the IP ID field in the IP header - for the retransmitted TCP packet. The IP ID value should not change - if the TCP header for a retransmitted packet is not changed. - - On retransmission, if the flag nx_packet_identical_copy is set, the same IP ID value is used for the retransmitted packet. - Otherwise the value in the IP ID field is updated with the latest ID value in the IP instance. - */ - UCHAR nx_packet_identical_copy; - - /* Length of IP header including options. It is set for outgoing packet only. */ - UCHAR nx_packet_ip_header_length; - - /*lint -esym(768,NX_PACKET_STRUCT::nx_packet_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_packet_reserved; - - /* Union that holds either IPv4 interface or IPv6 address. */ - union - { - - /* Define the interface from which the packet was received, or the interface to transmit to. */ - struct NX_INTERFACE_STRUCT - *nx_packet_interface_ptr; - - /* Point to the interface IPv6 address structure. On transmit or receive path. */ - struct NXD_IPV6_ADDRESS_STRUCT - *nx_packet_ipv6_address_ptr; - } nx_packet_address; - -#define nx_packet_ip_interface nx_packet_address.nx_packet_interface_ptr - - /* Points to the beginning of IPv4/6 header. This field is used for */ - /* quick refernece to the IP header, in case there are optional headers. */ - UCHAR *nx_packet_ip_header; - -#ifdef NX_ENABLE_THREAD - /* Define the packet type for MLE. */ - UCHAR nx_packet_type; - - /* Define the received signal strength. */ - UCHAR nx_packet_signal_strength; - - /* It is reserved for future use. */ - UCHAR nx_packet_thread_reserved[2]; -#endif /* NX_ENABLE_THREAD */ - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - /* Define the capability flag of hardware to be used by the packet. */ - ULONG nx_packet_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifdef NX_IPSEC_ENABLE - VOID *nx_packet_ipsec_sa_ptr; - - /* Used in HW engine non-block mode. */ - USHORT nx_packet_ipsec_op; - - /* Indicate the current protocol being processed. */ - USHORT nx_packet_ipsec_state; -#endif /* NX_IPSEC_ENABLE */ - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO - /* Indicate the current thread that owns the packet. */ - CHAR *nx_packet_debug_thread; - - /* Indicate the current file that is processing the packet. */ - CHAR *nx_packet_debug_file; - - /* Indicate the current function that is processing the packet. */ - ULONG nx_packet_debug_line; -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - -#ifdef NX_PACKET_HEADER_PAD - - /* Define a pad word for 16-byte alignment, if necessary. */ - ULONG nx_packet_packet_pad[NX_PACKET_HEADER_PAD_SIZE]; -#endif -} NX_PACKET; - - -/* Define the Packet Pool control block that will be used to manage each individual - packet pool. */ - -typedef struct NX_PACKET_POOL_STRUCT -{ - - /* Define the block pool ID used for error checking. */ - ULONG nx_packet_pool_id; - - /* Define the packet pool's name. */ - CHAR *nx_packet_pool_name; - - /* Define the number of available memory packets in the pool. */ - ULONG nx_packet_pool_available; - - /* Save the initial number of blocks. */ - ULONG nx_packet_pool_total; - - /* Define statistics and error counters for this packet pool. */ - ULONG nx_packet_pool_empty_requests; - ULONG nx_packet_pool_empty_suspensions; - ULONG nx_packet_pool_invalid_releases; - - /* Define the head pointer of the available packet pool. */ - struct NX_PACKET_STRUCT *nx_packet_pool_available_list; - - /* Save the start address of the packet pool's memory area. */ - CHAR *nx_packet_pool_start; - - /* Save the packet pool's size in bytes. */ - ULONG nx_packet_pool_size; - - /* Save the individual packet payload size - rounded for alignment. */ - ULONG nx_packet_pool_payload_size; - - /* Define the packet pool suspension list head along with a count of - how many threads are suspended. */ - TX_THREAD *nx_packet_pool_suspension_list; - ULONG nx_packet_pool_suspended_count; - - /* Define the created list next and previous pointers. */ - struct NX_PACKET_POOL_STRUCT - *nx_packet_pool_created_next, - *nx_packet_pool_created_previous; - -#ifdef NX_ENABLE_LOW_WATERMARK - /* Low watermark. */ - UINT nx_packet_pool_low_watermark; -#endif /* NX_ENABLE_LOW_WATERMARK */ -} NX_PACKET_POOL; - - -#ifndef NX_DISABLE_IPV4 -/* Define the Address Resolution Protocol (ARP) structure that makes up the - route table in each IP instance. This is how IP addresses are translated - to physical addresses in the system. */ - -typedef struct NX_ARP_STRUCT -{ - - /* Define a flag that indicates whether or not the mapping in this ARP - entry is static. */ - UINT nx_arp_route_static; - - /* Define the counter that indicates when the next ARP update request is - sent. This is always zero for static entries and initialized to the maximum - value for new entries. */ - UINT nx_arp_entry_next_update; - - /* Define the ARP retry counter that is incremented each time the ARP request - is sent. */ - UINT nx_arp_retries; - - /* Define the links for the IP ARP dynamic structures in the system. This list - is maintained in a most recently used fashion. */ - struct NX_ARP_STRUCT - *nx_arp_pool_next, - *nx_arp_pool_previous; - - /* Define the links for the active ARP entry that is part of route - information inside of an IP instance. */ - struct NX_ARP_STRUCT - *nx_arp_active_next, - *nx_arp_active_previous, - **nx_arp_active_list_head; - - /* Define the IP address that this entry is setup for. */ - ULONG nx_arp_ip_address; - - /* Define the physical address that maps to this IP address. */ - ULONG nx_arp_physical_address_msw; - ULONG nx_arp_physical_address_lsw; - - /* Define the physical interface attached to this IP address. */ - struct NX_INTERFACE_STRUCT *nx_arp_ip_interface; - - /* Define a pointer to the queue holding one or more packets while address - resolution is pending. The maximum number of packets that can be queued - is defined by NX_APR_MAX_QUEUE_DEPTH. If ARP packet queue is exceeded, - the oldest packet is discarded in favor of keeping the newer packet. */ - struct NX_PACKET_STRUCT - *nx_arp_packets_waiting; -} NX_ARP; -#endif /* NX_DISABLE_IPV4 */ - - -/* Determine if the UDP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_UDP_SOCKET_MODULE_EXTENSION -#define NX_UDP_SOCKET_MODULE_EXTENSION -#endif - - -/* Define the basic UDP socket structure. This structure is used to manage all information - necessary to manage UDP transmission and reception. */ - -typedef struct NX_UDP_SOCKET_STRUCT -{ - - /* Define the UDP identification that is used to determine if the UDP socket has - been created. */ - ULONG nx_udp_socket_id; - - /* Define the Application defined name for this UDP socket instance. */ - CHAR *nx_udp_socket_name; - - /* Define the UDP port that was bound to. */ - UINT nx_udp_socket_port; - - /* Define the entry that this UDP socket belongs to. */ - struct NX_IP_STRUCT - *nx_udp_socket_ip_ptr; - - /* Define the statistic and error counters for this UDP socket. */ - ULONG nx_udp_socket_packets_sent; - ULONG nx_udp_socket_bytes_sent; - ULONG nx_udp_socket_packets_received; - ULONG nx_udp_socket_bytes_received; - ULONG nx_udp_socket_invalid_packets; - ULONG nx_udp_socket_packets_dropped; - ULONG nx_udp_socket_checksum_errors; - - /* Define the type of service for this UDP instance. */ - ULONG nx_udp_socket_type_of_service; - - /* Define the time-to-live for this UDP instance. */ - UINT nx_udp_socket_time_to_live; - - /* Define the fragment enable bit for this UDP instance. */ - ULONG nx_udp_socket_fragment_enable; - - /* Define the UDP checksum disable flag for this UDP socket. */ - UINT nx_udp_socket_disable_checksum; - - /* Define the UDP receive packet queue pointers, queue counter, and - the maximum queue depth. */ - ULONG nx_udp_socket_receive_count; - ULONG nx_udp_socket_queue_maximum; - NX_PACKET *nx_udp_socket_receive_head, - *nx_udp_socket_receive_tail; - - /* Define the UDP socket bound list. These pointers are used to manage the list - of UDP sockets on a particular hashed port index. */ - struct NX_UDP_SOCKET_STRUCT - *nx_udp_socket_bound_next, - *nx_udp_socket_bound_previous; - - /* Define the UDP socket bind suspension thread pointer. This pointer points - to the thread that that is suspended attempting to bind to a port that is - already bound to another socket. */ - TX_THREAD *nx_udp_socket_bind_in_progress; - - /* Define the UDP receive suspension list head associated with a count of - how many threads are suspended attempting to receive from the same UDP port. */ - TX_THREAD *nx_udp_socket_receive_suspension_list; - ULONG nx_udp_socket_receive_suspended_count; - - /* Define the UDP bind suspension list head associated with a count of - how many threads are suspended attempting to bind to the same UDP port. The - currently bound socket will maintain the head pointer. When a socket unbinds, - the head of the suspension list is given the port and the remaining entries - of the suspension list are transferred to its suspension list head pointer. */ - TX_THREAD *nx_udp_socket_bind_suspension_list; - ULONG nx_udp_socket_bind_suspended_count; - - /* Define the link between other UDP structures created by the application. This - is linked to the IP instance the socket was created on. */ - struct NX_UDP_SOCKET_STRUCT - *nx_udp_socket_created_next, - *nx_udp_socket_created_previous; - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_udp_receive_callback)(struct NX_UDP_SOCKET_STRUCT *socket_ptr); - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_UDP_SOCKET_STRUCT::nx_udp_socket_reserved_ptr) suppress member not referenced. It is reserved for future use. */ - void *nx_udp_socket_reserved_ptr; - - /* Define the port extension in the UDP socket control block. This - is typically defined to whitespace in nx_port.h. */ - NX_UDP_SOCKET_MODULE_EXTENSION - -} NX_UDP_SOCKET; - - -/* Determine if the TCP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_TCP_SOCKET_MODULE_EXTENSION -#define NX_TCP_SOCKET_MODULE_EXTENSION -#endif - - -/* Define the basic TCP socket structure. This structure is used to manage all information - necessary to manage TCP transmission and reception. */ - -typedef struct NX_TCP_SOCKET_STRUCT -{ - - /* Define the TCP identification that is used to determine if the TCP socket has - been created. */ - ULONG nx_tcp_socket_id; - - /* Define the Application defined name for this TCP socket instance. */ - CHAR *nx_tcp_socket_name; - - /* Define the socket type flag. If true, this socket is a client socket. */ - UINT nx_tcp_socket_client_type; - - /* Define the TCP port that was bound to. */ - UINT nx_tcp_socket_port; - - /* Define the TCP socket's maximum segment size (mss). By default, this is setup to the - IP's MTU less the size of the IP and TCP headers. */ - ULONG nx_tcp_socket_mss; - - /* Define the connected IP and port information. */ - NXD_ADDRESS nx_tcp_socket_connect_ip; - UINT nx_tcp_socket_connect_port; - ULONG nx_tcp_socket_connect_mss; - ULONG nx_tcp_socket_peer_mss; - struct NX_INTERFACE_STRUCT - *nx_tcp_socket_connect_interface; - ULONG nx_tcp_socket_next_hop_address; - - /* mss2 is the holding place for the smss * smss value. - It is computed and stored here once for later use. */ - ULONG nx_tcp_socket_connect_mss2; - - ULONG nx_tcp_socket_tx_slow_start_threshold; - - /* Define the state of the TCP connection. */ - UINT nx_tcp_socket_state; - - /* Define the receive and transmit sequence numbers. */ - ULONG nx_tcp_socket_tx_sequence; - ULONG nx_tcp_socket_rx_sequence; - ULONG nx_tcp_socket_rx_sequence_acked; - ULONG nx_tcp_socket_delayed_ack_timeout; - ULONG nx_tcp_socket_fin_sequence; - USHORT nx_tcp_socket_fin_received; - USHORT nx_tcp_socket_fin_acked; - - /* Track the advertised window size */ - ULONG nx_tcp_socket_tx_window_advertised; - ULONG nx_tcp_socket_tx_window_congestion; - ULONG nx_tcp_socket_tx_outstanding_bytes; /* Data transmitted but not acked. */ - - /* Define the transmit sequence that enters fast transmit. */ - ULONG nx_tcp_socket_tx_sequence_recover; - - /* Define the previous cumulative acknowledgment. */ - ULONG nx_tcp_socket_previous_highest_ack; - - /* Counter for "ack-N-packet" */ - ULONG nx_tcp_socket_ack_n_packet_counter; - - /* Counter for duplicated ACK */ - UINT nx_tcp_socket_duplicated_ack_received; - - /* Define the window size fields of the TCP socket structure. */ - ULONG nx_tcp_socket_rx_window_default; - ULONG nx_tcp_socket_rx_window_current; - ULONG nx_tcp_socket_rx_window_last_sent; - - /* Define the statistic and error counters for this TCP socket. */ - ULONG nx_tcp_socket_packets_sent; - ULONG nx_tcp_socket_bytes_sent; - ULONG nx_tcp_socket_packets_received; - ULONG nx_tcp_socket_bytes_received; - ULONG nx_tcp_socket_retransmit_packets; - ULONG nx_tcp_socket_checksum_errors; - - /* Define data for zero window probe. */ - ULONG nx_tcp_socket_zero_window_probe_failure; - ULONG nx_tcp_socket_zero_window_probe_sequence; - UCHAR nx_tcp_socket_zero_window_probe_has_data; - UCHAR nx_tcp_socket_zero_window_probe_data; - - /* Define whether or not TCP socket is in fast recovery procedure. */ - UCHAR nx_tcp_socket_fast_recovery; - - /* Reserved to four bytes alignment. */ - /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_tcp_socket_reserved; - - /* Define the entry that this TCP socket belongs to. */ - struct NX_IP_STRUCT - *nx_tcp_socket_ip_ptr; - - /* Define the type of service for this TCP instance. */ - ULONG nx_tcp_socket_type_of_service; - - /* Define the time-to-live for this TCP instance. */ - UINT nx_tcp_socket_time_to_live; - - /* Define the fragment enable bit for this TCP instance. */ - ULONG nx_tcp_socket_fragment_enable; - - /* Define the TCP receive packet queue pointers, queue counter, and - the maximum queue depth. */ - ULONG nx_tcp_socket_receive_queue_count; - NX_PACKET *nx_tcp_socket_receive_queue_head, - *nx_tcp_socket_receive_queue_tail; - - /* Define the TCP packet sent queue. This queue is used to keep track of the - transmit packets already send. Before they can be released we need to receive - an ACK back from the other end of the connection. If no ACK is received, the - packet(s) need to be re-transmitted. */ - ULONG nx_tcp_socket_transmit_queue_maximum; - ULONG nx_tcp_socket_transmit_sent_count; - NX_PACKET *nx_tcp_socket_transmit_sent_head, - *nx_tcp_socket_transmit_sent_tail; - - /* Define the maximum TCP packet receive queue. */ -#ifdef NX_ENABLE_LOW_WATERMARK - ULONG nx_tcp_socket_receive_queue_maximum; -#endif /* NX_ENABLE_LOW_WATERMARK */ - - /* Define the TCP transmit timeout parameters. If the socket timeout is non-zero, - there is an active timeout on the TCP socket. Subsequent timeouts are derived - from the timeout rate, which is adjusted higher as timeouts occur. */ - ULONG nx_tcp_socket_timeout; - ULONG nx_tcp_socket_timeout_rate; - ULONG nx_tcp_socket_timeout_retries; - ULONG nx_tcp_socket_timeout_max_retries; - ULONG nx_tcp_socket_timeout_shift; - -#ifdef NX_ENABLE_TCP_WINDOW_SCALING - /* Local receive window size, when user creates the TCP socket. */ - ULONG nx_tcp_socket_rx_window_maximum; - - /* Window scale this side needs to offer to the peer. */ - ULONG nx_tcp_rcv_win_scale_value; - - /* Window scale offered by the peer. 0xFF indicates the peer does not support window scaling. */ - ULONG nx_tcp_snd_win_scale_value; -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Define the TCP keepalive timer parameters. If enabled with NX_ENABLE_TCP_KEEPALIVE, - these parameters are used to implement the keepalive timer. */ -#ifdef NX_ENABLE_TCP_KEEPALIVE - ULONG nx_tcp_socket_keepalive_timeout; - ULONG nx_tcp_socket_keepalive_retries; -#endif /* NX_ENABLE_TCP_KEEPALIVE */ - - /* Define the TCP socket bound list. These pointers are used to manage the list - of TCP sockets on a particular hashed port index. */ - struct NX_TCP_SOCKET_STRUCT - *nx_tcp_socket_bound_next, - *nx_tcp_socket_bound_previous; - - /* Define the TCP socket bind suspension thread pointer. This pointer points - to the thread that that is suspended attempting to bind to a port that is - already bound to another socket. */ - TX_THREAD *nx_tcp_socket_bind_in_progress; - - /* Define the TCP receive suspension list head associated with a count of - how many threads are suspended attempting to receive from the same TCP port. */ - TX_THREAD *nx_tcp_socket_receive_suspension_list; - ULONG nx_tcp_socket_receive_suspended_count; - - /* Define the TCP transmit suspension list head associated with a count of - how many threads are suspended attempting to transmit from the same TCP port. */ - TX_THREAD *nx_tcp_socket_transmit_suspension_list; - ULONG nx_tcp_socket_transmit_suspended_count; - - /* Define the TCP connect suspension pointer that contains the pointer to the - thread suspended attempting to establish a TCP connection. */ - TX_THREAD *nx_tcp_socket_connect_suspended_thread; - - /* Define the TCP disconnect suspension pointer that contains the pointer to the - thread suspended attempting to break a TCP connection. */ - TX_THREAD *nx_tcp_socket_disconnect_suspended_thread; - - /* Define the TCP bind suspension list head associated with a count of - how many threads are suspended attempting to bind to the same TCP port. The - currently bound socket will maintain the head pointer. When a socket unbinds, - the head of the suspension list is given the port and the remaining entries - of the suspension list are transferred to its suspension list head pointer. */ - TX_THREAD *nx_tcp_socket_bind_suspension_list; - ULONG nx_tcp_socket_bind_suspended_count; - - /* Define the link between other TCP structures created by the application. This - is linked to the IP instance the socket was created on. */ - struct NX_TCP_SOCKET_STRUCT - *nx_tcp_socket_created_next, - *nx_tcp_socket_created_previous; - - /* Define the callback function for urgent data reception. This is for future use. */ - VOID (*nx_tcp_urgent_data_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - -#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT - /* Define the callback function for notifying an incoming SYN request. */ - UINT (*nx_tcp_socket_syn_received_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr, NX_PACKET *packet_ptr); - - /* Define the callback function for notifying the host application of a connection handshake completion - with a remote host. */ - VOID (*nx_tcp_establish_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for notifying the host application of disconnection completion - with a remote host. */ - VOID (*nx_tcp_disconnect_complete_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for notifying the host application to set the socket - state in the timed wait state. */ - VOID (*nx_tcp_timed_wait_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); -#endif - - /* Define the callback function for disconnect detection from the other side of - the connection. */ - VOID (*nx_tcp_disconnect_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_tcp_receive_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_tcp_socket_window_update_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - -#ifdef NX_ENABLE_TCP_QUEUE_DEPTH_UPDATE_NOTIFY - VOID (*nx_tcp_socket_queue_depth_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); -#endif - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved_ptr) suppress member not referenced. It is reserved for application specific use. */ - void *nx_tcp_socket_reserved_ptr; - - /* Define the default maximum queue size. This is necessary to dynamically - change the maximum queue size dynamically. */ - ULONG nx_tcp_socket_transmit_queue_maximum_default; - - /* Define a flag for enabling the keepalive feature per TCP socket. */ -#ifdef NX_ENABLE_TCP_KEEPALIVE - UINT nx_tcp_socket_keepalive_enabled; -#endif /* NX_ENABLE_TCP_KEEPALIVE */ - -#ifdef FEATURE_NX_IPV6 - struct NXD_IPV6_ADDRESS_STRUCT *nx_tcp_socket_ipv6_addr; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - /* Stores a pointer to the SA, if the traffic needs to be protected. */ - VOID *nx_tcp_socket_egress_sa; - - /* Number of bytes to offset from IP header. This offset is needed to accommondate security header. */ - UINT nx_tcp_socket_egress_sa_data_offset; - -#endif /* NX_IPSEC_ENABLE */ - - /* Define the port extension in the TCP socket control block. This - is typically defined to whitespace in nx_port.h. */ - NX_TCP_SOCKET_MODULE_EXTENSION - -} NX_TCP_SOCKET; - - -/* Define the basic TCP listen request structure. This structure is used to indicate - which, if any, TCP ports are allowing a client connection. */ - -typedef struct NX_TCP_LISTEN_STRUCT -{ - - /* Define the port number that we are allowing a connection on. */ - UINT nx_tcp_listen_port; - - /* Define the listen callback routine that will be called when a connection - request is received. */ - VOID (*nx_tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port); - - /* Define the previously created socket for this listen request. */ - NX_TCP_SOCKET - *nx_tcp_listen_socket_ptr; - - /* Define the listen queue for connect requests that come in when the previous socket - given for a listen or relisten has been used. */ - ULONG nx_tcp_listen_queue_maximum; - ULONG nx_tcp_listen_queue_current; - NX_PACKET *nx_tcp_listen_queue_head, - *nx_tcp_listen_queue_tail; - - /* Define the link between other TCP listen structures created by the application. */ - struct NX_TCP_LISTEN_STRUCT - *nx_tcp_listen_next, - *nx_tcp_listen_previous; -} NX_TCP_LISTEN; - -/* There should be at least one physical interface. */ -#ifndef NX_MAX_PHYSICAL_INTERFACES -#define NX_MAX_PHYSICAL_INTERFACES 1 -#endif /* NX_MAX_PHYSICAL_INTERFACES */ - -#ifndef NX_MAX_IPV6_ADDRESSES -#define NX_MAX_IPV6_ADDRESSES (NX_MAX_PHYSICAL_INTERFACES * 3) -#endif /* NX_MAX_IPV6_ADDRESSES */ - -#if (NX_MAX_IPV6_ADDRESSES < 2) -#error "NetX Duo needs at least 2 IPv6 interface addresses. " -#endif - -#ifndef NX_DISABLE_LOOPBACK_INTERFACE -/* Inside interface array, entries 0 up to NX_MAX_PHYSICAL_INTERFACES are assigned to the - physical interfaces. Entry NX_MAX_PHYSICAL_INTERFACES is assigned to the loopback interface. */ -#define NX_LOOPBACK_INTERFACE NX_MAX_PHYSICAL_INTERFACES -#define NX_LOOPBACK_IPV6_SOURCE_INDEX NX_MAX_IPV6_ADDRESSES -#define NX_LOOPBACK_IPV6_ENABLED 1 -#else -#define NX_LOOPBACK_INTERFACE 0 -#define NX_LOOPBACK_IPV6_ENABLED 0 -#endif /* NX_DISALBE_LOOPBACK_INTERFACE */ - -#if (defined(NX_DISABLE_LOOPBACK_INTERFACE) && (NX_MAX_PHYSICAL_INTERFACES == 0)) -#error "NetX is built without either physical interfaces or loopback interfaces." -#endif - -#if defined(NX_DISABLE_LOOPBACK_INTERFACE) -#define NX_MAX_IP_INTERFACES NX_MAX_PHYSICAL_INTERFACES -#else -#define NX_MAX_IP_INTERFACES (NX_MAX_PHYSICAL_INTERFACES + 1) -#endif /* NX_DISABLE_LOOPBACK_INTERFACE */ - -#ifdef NX_DISABLE_PACKET_CHAIN -#ifndef NX_DISABLE_FRAGMENTATION -#error "IP fragmentation is not supported if packet chain is disabled." -#endif /* NX_DISABLE_FRAGMENTATION */ -#endif /* NX_DISABLE_PACKET_CHAIN */ - -struct NX_IP_DRIVER_STRUCT; - -typedef struct NXD_IPV6_ADDRESS_STRUCT -{ - UCHAR nxd_ipv6_address_valid; - - UCHAR nxd_ipv6_address_type; /* IPv6 = 6 */ - - /* Current state:Invalid,Tentative...*/ - UCHAR nxd_ipv6_address_state; - - /* Prefix length */ - UCHAR nxd_ipv6_address_prefix_length; - - /* Pointer to the physical interface where this address is attached to.*/ - struct NX_INTERFACE_STRUCT *nxd_ipv6_address_attached; - - /* Interface address,in host byte order */ - ULONG nxd_ipv6_address[4]; - - /* Pointer to the next address, or NX_NULL */ - struct NXD_IPV6_ADDRESS_STRUCT *nxd_ipv6_address_next; - - /* Number of DAD packets to be transmitted. */ - /* This entry is used only if DAD is enabled. */ - UCHAR nxd_ipv6_address_DupAddrDetectTransmit; - - /* Describe how the interface is configured. */ - UCHAR nxd_ipv6_address_ConfigurationMethod; - - /* Define the index in array. */ - UCHAR nxd_ipv6_address_index; - - /* Reserved. */ - /*lint -esym(768,NXD_IPV6_ADDRESS_STRUCT::reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR reserved; -} NXD_IPV6_ADDRESS; - -/* Define the address interface structure. */ -typedef struct NX_INTERFACE_STRUCT -{ - - /* Flag indicating whether or not the interface entry is valid. */ - CHAR *nx_interface_name; - UCHAR nx_interface_valid; - UCHAR nx_interface_address_mapping_needed; - - /* Define the Link Up field that is manipulated by the associated link driver. */ - UCHAR nx_interface_link_up; - - /* Define the index in array. */ - UCHAR nx_interface_index; - - /* Define a flag to check if link status change. */ - UCHAR nx_interface_link_status_change; - - /*lint -esym(768,NX_INTERFACE_STRUCT::nx_interface_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_interface_reserved[3]; - - /* Define the physical address of this IP instance. These field are - setup by the link driver during initialization. */ - ULONG nx_interface_physical_address_msw; - ULONG nx_interface_physical_address_lsw; - -#ifndef NX_DISABLE_IPV4 - /* Define the IP address of this IP instance. Loopback can be done by - either using the same address or by using 127.*.*.*. */ - ULONG nx_interface_ip_address; - - /* Define the network portion of the IP address. */ - ULONG nx_interface_ip_network_mask; - - /* Define the network only bits of the IP address. */ - ULONG nx_interface_ip_network; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the head of the interface IPv6 address list. - Typically the 1st entry on the list is the link local address, - followed by one or more global IPv6 addresses. - */ - struct NXD_IPV6_ADDRESS_STRUCT *nxd_interface_ipv6_address_list_head; - - /* Define information setup by the Link Driver. */ - ULONG nx_interface_ip_mtu_size; - -#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION - - /* Maximum number of router solicitation messages to send. */ - ULONG nx_ipv6_rtr_solicitation_max; - - /* Number of router solicitation messages to be sent. */ - ULONG nx_ipv6_rtr_solicitation_count; - - /* Time (in seconds) before sending out another Router Solicitation message. */ - ULONG nx_ipv6_rtr_solicitation_interval; - - /* Count down timer for sending out router solicitation message. */ - ULONG nx_ipv6_rtr_solicitation_timer; -#endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ - -#ifdef NX_IPV6_STATELESS_AUTOCONFIG_CONTROL - ULONG nx_ipv6_stateless_address_autoconfig_status; -#endif /* NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */ - /* Define a pointer for use by the applicaiton. Typically this is going to be - used by the link drvier. */ - VOID *nx_interface_additional_link_info; - - /* Define the Link Driver entry point. */ - VOID (*nx_interface_link_driver_entry)(struct NX_IP_DRIVER_STRUCT *); - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - /* Define the capability flag of hardware for the interface. */ - ULONG nx_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifndef NX_DISABLE_IPV4 - /* Define the ARP defend timeout. */ - ULONG nx_interface_arp_defend_timeout; - - /* Define the IP probe address. */ - ULONG nx_interface_ip_probe_address; - - /* Define the IP conflict notify handler. A non-null value for this function - pointer results in NetX calling it when an IP address is found in an incoming - ARP packet that matches that of nx_interface_ip_probe_address. */ - VOID (*nx_interface_ip_conflict_notify_handler)(struct NX_IP_STRUCT *, UINT, ULONG, ULONG, ULONG); -#endif /* !NX_DISABLE_IPV4 */ -} NX_INTERFACE; - -/* Define the static IPv4 routing table entry structure. */ -#if defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4) -typedef struct NX_IP_ROUTING_ENTRY_STRUCT -{ - /* Destination IP address, in host byte order */ - ULONG nx_ip_routing_dest_ip; - - /* Net mask, in host byte order */ - ULONG nx_ip_routing_net_mask; - - /* Next hop address, in host byte order. */ - ULONG nx_ip_routing_next_hop_address; - - struct NX_INTERFACE_STRUCT - *nx_ip_routing_entry_ip_interface; -} NX_IP_ROUTING_ENTRY; -#endif /* defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4) */ - -#ifndef NX_DISABLE_IPV4 -typedef struct NX_IPV4_MULTICAST_STRUCT -{ - - /* Define the multicast registered group list. */ - ULONG nx_ipv4_multicast_join_list; - - /* Define the multicast regstiered group interface list. */ - NX_INTERFACE *nx_ipv4_multicast_join_interface_list; - - /* Define the multicast registration count. */ - ULONG nx_ipv4_multicast_join_count; - - /* Define the multicast random time list. */ - ULONG nx_ipv4_multicast_update_time; - - /* Define the multicast loopback flag list. This flag is set based on the global - loopback enable at the time the group was joined. */ - UINT nx_ipv4_multicast_loopback_enable; -} NX_IPV4_MULTICAST_ENTRY; -#endif /* NX_DISABLE_IPV4 */ - -#ifdef NX_ENABLE_IPV6_MULTICAST -typedef struct NX_IPV6_MULTICAST_STRUCT -{ - - /* Define the MLD registered group list. */ - ULONG nx_ip_mld_join_list[4]; - - /* Define the MLD regstiered group interface list. */ - NX_INTERFACE *nx_ip_mld_join_interface_list; - - /* Define the MLD registration count. */ - ULONG nx_ip_mld_join_count; -} NX_IPV6_MULTICAST_ENTRY; - -#endif /* NX_ENABLE_IPV6_MULTICAST */ - - -/* Determine if the IP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_IP_MODULE_EXTENSION -#define NX_IP_MODULE_EXTENSION -#endif - - -/* Define the Internet Protocol (IP) structure. Any number of IP instances - may be used by the application. */ - -typedef struct NX_IP_STRUCT -{ - - /* Define the IP identification that is used to determine if the IP has - been created. */ - ULONG nx_ip_id; - - /* Define the Application defined name for this IP instance. */ - CHAR *nx_ip_name; - - /* Define the IP address of this IP instance. Loopback can be done by - either using the same address or by using 127.*.*.*. */ -#if 1 -#define nx_ip_address nx_ip_interface[0].nx_interface_ip_address -#define nx_ip_driver_mtu nx_ip_interface[0].nx_interface_ip_mtu_size -#define nx_ip_driver_mapping_needed nx_ip_interface[0].nx_interface_address_mapping_needed -#define nx_ip_network_mask nx_ip_interface[0].nx_interface_ip_network_mask -#define nx_ip_network nx_ip_interface[0].nx_interface_ip_network -#define nx_ip_arp_physical_address_msw nx_ip_interface[0].nx_interface_physical_address_msw -#define nx_ip_arp_physical_address_lsw nx_ip_interface[0].nx_interface_physical_address_lsw -#define nx_ip_driver_link_up nx_ip_interface[0].nx_interface_link_up -#define nx_ip_link_driver_entry nx_ip_interface[0].nx_interface_link_driver_entry -#define nx_ip_additional_link_info nx_ip_interface[0].nx_interface_additional_link_info -#endif - -#ifndef NX_DISABLE_IPV4 - /* Define the gateway IP address. */ - ULONG nx_ip_gateway_address; /* In host byte order */ - - struct NX_INTERFACE_STRUCT - *nx_ip_gateway_interface; -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - /* Define IPv6 addresses. NetX6 allows user to specify Global address - in addition to the link-local address generated automatically. */ - /* IPv6 address takes 16 bytes. These addresses are 4-byte aligned */ - struct NXD_IPV6_ADDRESS_STRUCT nx_ipv6_address[NX_MAX_IPV6_ADDRESSES + NX_LOOPBACK_IPV6_ENABLED]; - - /* Define the destination table. */ - NX_IPV6_DESTINATION_ENTRY - nx_ipv6_destination_table[NX_IPV6_DESTINATION_TABLE_SIZE]; - - /* Define the ND cache table. */ - ND_CACHE_ENTRY - nx_ipv6_nd_cache[NX_IPV6_NEIGHBOR_CACHE_SIZE]; - - /* Define the destination table size. */ - UINT nx_ipv6_destination_table_size; -#endif /* FEATURE_NX_IPV6 */ - - /* Define the statistic and error counters for this IP instance. */ - ULONG nx_ip_total_packet_send_requests; - ULONG nx_ip_total_packets_sent; - ULONG nx_ip_total_bytes_sent; - ULONG nx_ip_total_packets_received; - ULONG nx_ip_total_packets_delivered; - ULONG nx_ip_total_bytes_received; - ULONG nx_ip_packets_forwarded; - ULONG nx_ip_packets_reassembled; - ULONG nx_ip_reassembly_failures; - ULONG nx_ip_invalid_packets; - ULONG nx_ip_invalid_transmit_packets; - ULONG nx_ip_invalid_receive_address; - ULONG nx_ip_unknown_protocols_received; - - /*lint -esym(768,NX_IP_STRUCT::nx_ip_transmit_no_route_errors) suppress member not referenced. It is reserved for application specific use. */ - ULONG nx_ip_transmit_resource_errors; - ULONG nx_ip_transmit_no_route_errors; - ULONG nx_ip_receive_packets_dropped; - ULONG nx_ip_receive_checksum_errors; - ULONG nx_ip_send_packets_dropped; - ULONG nx_ip_total_fragment_requests; - ULONG nx_ip_successful_fragment_requests; - ULONG nx_ip_fragment_failures; - ULONG nx_ip_total_fragments_sent; - ULONG nx_ip_total_fragments_received; - ULONG nx_ip_arp_requests_sent; - ULONG nx_ip_arp_requests_received; - ULONG nx_ip_arp_responses_sent; - ULONG nx_ip_arp_responses_received; - ULONG nx_ip_arp_aged_entries; - ULONG nx_ip_arp_invalid_messages; - ULONG nx_ip_arp_static_entries; - ULONG nx_ip_udp_packets_sent; - ULONG nx_ip_udp_bytes_sent; - ULONG nx_ip_udp_packets_received; - ULONG nx_ip_udp_bytes_received; - ULONG nx_ip_udp_invalid_packets; - ULONG nx_ip_udp_no_port_for_delivery; - ULONG nx_ip_udp_receive_packets_dropped; - ULONG nx_ip_udp_checksum_errors; - ULONG nx_ip_tcp_packets_sent; - ULONG nx_ip_tcp_bytes_sent; - ULONG nx_ip_tcp_packets_received; - ULONG nx_ip_tcp_bytes_received; - ULONG nx_ip_tcp_invalid_packets; - ULONG nx_ip_tcp_receive_packets_dropped; - ULONG nx_ip_tcp_checksum_errors; - ULONG nx_ip_tcp_connections; - ULONG nx_ip_tcp_passive_connections; - ULONG nx_ip_tcp_active_connections; - ULONG nx_ip_tcp_disconnections; - ULONG nx_ip_tcp_connections_dropped; - ULONG nx_ip_tcp_retransmit_packets; - ULONG nx_ip_tcp_resets_received; - ULONG nx_ip_tcp_resets_sent; - ULONG nx_ip_icmp_total_messages_received; - ULONG nx_ip_icmp_checksum_errors; - ULONG nx_ip_icmp_invalid_packets; - ULONG nx_ip_icmp_unhandled_messages; - ULONG nx_ip_pings_sent; - ULONG nx_ip_ping_timeouts; - ULONG nx_ip_ping_threads_suspended; - ULONG nx_ip_ping_responses_received; - ULONG nx_ip_pings_received; - ULONG nx_ip_pings_responded_to; - ULONG nx_ip_igmp_invalid_packets; - ULONG nx_ip_igmp_reports_sent; - ULONG nx_ip_igmp_queries_received; - ULONG nx_ip_igmp_checksum_errors; - ULONG nx_ip_igmp_groups_joined; -#ifndef NX_DISABLE_IGMPV2 - ULONG nx_ip_igmp_router_version; -#endif - ULONG nx_ip_rarp_requests_sent; - ULONG nx_ip_rarp_responses_received; - ULONG nx_ip_rarp_invalid_messages; - - - /* Define the IP forwarding flag. This is by default set to NX_NULL. - If forwarding is desired, the nx_ip_forward_packet_process service - pointed to by this member should be called. */ -#ifndef NX_DISABLE_IPV4 - VOID (*nx_ip_forward_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); - -#ifdef NX_NAT_ENABLE - /* Define the NAT forwarded packet handler. This is by default set to NX_NULL. */ - UINT (*nx_ip_nat_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *, UINT packet_process); - - /* Define the NAT port verify handler. This is by default set to NX_NULL. */ - UINT (*nx_ip_nat_port_verify)(struct NX_IP_STRUCT *, UINT protocol, UINT port); -#endif -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the packet ID. */ - ULONG nx_ip_packet_id; - - /* Define the default packet pool. */ - struct NX_PACKET_POOL_STRUCT - *nx_ip_default_packet_pool; - -#ifdef NX_ENABLE_DUAL_PACKET_POOL - /* Define the auxiliary packet pool for internal usage. */ - struct NX_PACKET_POOL_STRUCT - *nx_ip_auxiliary_packet_pool; -#endif /* NX_ENABLE_DUAL_PACKET_POOL */ - - /* Define the internal mutex used for protection inside the NetX - data structures. */ - TX_MUTEX nx_ip_protection; - - /* Define the initialize done flag. */ - UINT nx_ip_initialize_done; - -#ifdef NX_DRIVER_DEFERRED_PROCESSING - /* Define the Link Driver hardware deferred packet queue. */ - NX_PACKET *nx_ip_driver_deferred_packet_head, - *nx_ip_driver_deferred_packet_tail; - - /* Define the Link Driver hardware deferred packet processing routine. If the driver - deferred processing is enabled, this routine is called from the IP helper thread. */ - VOID (*nx_ip_driver_deferred_packet_handler)(struct NX_IP_STRUCT *, NX_PACKET *); -#endif /* NX_DRIVER_DEFERRED_PROCESSING */ - - /* Define the deferred packet processing queue. This is used to - process packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_deferred_received_packet_head, - *nx_ip_deferred_received_packet_tail; - - /* Define the raw IP function pointer that also indicates whether or - not raw IP packet sending and receiving is enabled. */ - UINT (*nx_ip_raw_ip_processing)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *); - -#ifdef NX_ENABLE_IP_RAW_PACKET_FILTER - /* Define the raw packet filter function pointer. */ - UINT (*nx_ip_raw_packet_filter)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *); -#endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */ - - /* Define the pointer to the raw IP packet queue. */ - NX_PACKET *nx_ip_raw_received_packet_head, - *nx_ip_raw_received_packet_tail; - - /* Define the count of raw IP packets on the queue. */ - ULONG nx_ip_raw_received_packet_count; - - /* Define the maximum number of packets queued for receive. */ - ULONG nx_ip_raw_received_packet_max; - - /* Define the raw packet suspension list head along with a count of - how many threads are suspended. */ - TX_THREAD *nx_ip_raw_packet_suspension_list; - ULONG nx_ip_raw_packet_suspended_count; - - /* Define the IP helper thread that processes periodic ARP requests, - reassembles IP messages, and helps handle TCP/IP packets. */ - TX_THREAD nx_ip_thread; - - /* Define the IP event flags that are used to stimulate the IP helper - thread. */ - TX_EVENT_FLAGS_GROUP - nx_ip_events; - - /* Define the IP periodic timer for this IP instance. */ - TX_TIMER nx_ip_periodic_timer; - - /* Define the IP fragment function pointer that also indicates whether or - IP fragmenting is enabled. */ - VOID (*nx_ip_fragment_processing)(struct NX_IP_DRIVER_STRUCT *); - - /* Define the IP unfragment function pointer. */ - VOID (*nx_ip_fragment_assembly)(struct NX_IP_STRUCT *); - - /* Define the IP unfragment timeout checking function pointer. */ - VOID (*nx_ip_fragment_timeout_check)(struct NX_IP_STRUCT *); - - /* Define the fragment pointer to the oldest fragment re-assembly. If this is - the same between any periodic the fragment re-assembly is too old and - will be deleted. */ - NX_PACKET *nx_ip_timeout_fragment; - - /* Define the pointer to the fragmented IP packet queue. This queue is - appended when a fragmented packet is received and is drained inside - the IP. */ - NX_PACKET *nx_ip_received_fragment_head, - *nx_ip_received_fragment_tail; - - /* Define the pointer to the fragment re-assembly queue. */ - NX_PACKET *nx_ip_fragment_assembly_head, - *nx_ip_fragment_assembly_tail; - -#ifdef NX_ENABLE_6LOWPAN - /* Define the created 6LoWPAN list. */ - VOID *nx_ip_6lowpan_created_ptr; - -#ifdef NX_ENABLE_THREAD - /* Define the created Thread list. */ - VOID *nx_ip_thread_created_ptr; -#endif /* NX_ENABLE_THREAD */ -#endif /* NX_ENABLE_6LOWPAN */ - -#ifndef NX_DISABLE_IPV4 - /* Define the IP address change notification callback routine pointer. */ - VOID (*nx_ip_address_change_notify)(struct NX_IP_STRUCT *, VOID *); - VOID *nx_ip_address_change_notify_additional_info; -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY - VOID (*nx_ipv6_address_change_notify)(struct NX_IP_STRUCT *ip_ptr, UINT status, UINT interface_index, UINT addres_index, ULONG *ip_address); -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#endif /* FEATURE_NX_IPV6 */ - -#ifndef NX_DISABLE_IPV4 - /* Define the multicast entry. */ - NX_IPV4_MULTICAST_ENTRY nx_ipv4_multicast_entry[NX_MAX_MULTICAST_GROUPS]; - - /* Define global IGMP loopback enable/disable flag. By default, IGMP loopback is - disabled. */ - UINT nx_ip_igmp_global_loopback_enable; - - /* Define the IGMP receive packet processing routine. This is setup when IGMP - is enabled. */ - void (*nx_ip_igmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the IGMP periodic processing routine. This is also setup when IGMP - is enabled. */ - void (*nx_ip_igmp_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the IGMP packet queue processing routine. This is setup when IGMP is - enabled. */ - void (*nx_ip_igmp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the IGMP message queue. */ - NX_PACKET *nx_ip_igmp_queue_head; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the ICMP sequence number. This is used in ICMP messages that - require a sequence number. */ - ULONG nx_ip_icmp_sequence; - -#ifdef NX_ENABLE_IPV6_MULTICAST - - /* Define the IPv6 Multicast Group structure. */ - NX_IPV6_MULTICAST_ENTRY nx_ipv6_multicast_entry[NX_MAX_MULTICAST_GROUPS]; - - /* Define the MLD join count. */ - ULONG nx_ipv6_multicast_groups_joined; - -#endif /* NX_ENABLE_IPV6_MULTICAST */ - - /* Define the ICMP packet receive routine. This also doubles as a - mechanism to make sure ICMP is enabled. If this function is NULL, ICMP - is not enabled. */ - void (*nx_ip_icmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - -#ifndef NX_DISABLE_IPV4 - /* Define the ICMP packet queue processing routine. This is setup when ICMP is - enabled. */ - void (*nx_ip_icmp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the ICMP packet process routine */ - void (*nx_ip_icmpv4_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - /* Define the ICMPv6 packet process routine. */ - void (*nx_ip_icmpv6_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Define the Neighbor Discovery cache fast (10ms) periodic update routine. */ - void (*nx_nd_cache_fast_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the Neighbor Discovery cache slow (1000 ms) periodic update routine. */ - void (*nx_nd_cache_slow_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the ICMPv6 router advertisement flag callback. */ - void (*nx_icmpv6_ra_flag_callback)(struct NX_IP_STRUCT *, UINT); - -#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY - /* Define the MTU path discovery periodic update. */ - void (*nx_destination_table_periodic_update)(struct NX_IP_STRUCT *); -#endif - -#endif /* FEATURE_NX_IPV6 */ - - - /* Define the ICMP message queue. */ - NX_PACKET *nx_ip_icmp_queue_head; - - /* Define the ICMP ping suspension list head associated with a count of - how many threads are suspended attempting to ping. */ - TX_THREAD *nx_ip_icmp_ping_suspension_list; - ULONG nx_ip_icmp_ping_suspended_count; - - /* Define the UDP port information structure associated with this IP instance. */ - struct NX_UDP_SOCKET_STRUCT - *nx_ip_udp_port_table[NX_UDP_PORT_TABLE_SIZE]; - - /* Define the head pointer of the created UDP socket list. */ - struct NX_UDP_SOCKET_STRUCT - *nx_ip_udp_created_sockets_ptr; - - /* Define the number of created UDP socket instances. */ - ULONG nx_ip_udp_created_sockets_count; - - /* Define the UDP packet receive routine. This also doubles as a - mechanism to make sure UDP is enabled. If this function is NULL, UDP - is not enabled. */ - void (*nx_ip_udp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the TCP port information structure associated with this IP instance. */ - struct NX_TCP_SOCKET_STRUCT - *nx_ip_tcp_port_table[NX_TCP_PORT_TABLE_SIZE]; - - /* Define the head pointer of the created TCP socket list. */ - struct NX_TCP_SOCKET_STRUCT - *nx_ip_tcp_created_sockets_ptr; - - /* Define the number of created TCP socket instances. */ - ULONG nx_ip_tcp_created_sockets_count; - - /* Define the TCP packet receive routine. This also doubles as a - mechanism to make sure TCP is enabled. If this function is NULL, TCP - is not enabled. */ - void (*nx_ip_tcp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the TCP periodic processing routine for transmit timeout logic. */ - void (*nx_ip_tcp_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the TCP fast periodic processing routine for transmit timeout logic. */ - void (*nx_ip_tcp_fast_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the TCP packet queue processing routine. This is setup when TCP is - enabled. */ - void (*nx_ip_tcp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the pointer to the incoming TCP packet queue. */ - NX_PACKET *nx_ip_tcp_queue_head, - *nx_ip_tcp_queue_tail; - - /* Define the count of incoming TCP packets on the queue. */ - ULONG nx_ip_tcp_received_packet_count; - - /* Define the TCP listen request structure that contains the maximum number of - listen requests allowed for this IP instance. */ - NX_TCP_LISTEN - nx_ip_tcp_server_listen_reqs[NX_MAX_LISTEN_REQUESTS]; - - /* Define the head pointer of the available listen request structures. */ - NX_TCP_LISTEN - *nx_ip_tcp_available_listen_requests; - - /* Define the head pointer of the active listen requests. These are made - by issuing the nx_tcp_server_socket_listen service. */ - NX_TCP_LISTEN - *nx_ip_tcp_active_listen_requests; - - /* Define a flag indicating the IP fast timer has been created */ - UINT nx_ip_fast_periodic_timer_created; - - /* Define the fast IP periodic timer used for high resolution events for - this IP instance. */ - TX_TIMER nx_ip_fast_periodic_timer; - -#ifndef NX_DISABLE_IPV4 - /* Define the destination routing information associated with this IP - instance. */ - struct NX_ARP_STRUCT - *nx_ip_arp_table[NX_ARP_TABLE_SIZE]; - - /* Define the head pointer of the static ARP list. */ - struct NX_ARP_STRUCT - *nx_ip_arp_static_list; - - /* Define the head pointer of the dynamic ARP list. */ - struct NX_ARP_STRUCT - *nx_ip_arp_dynamic_list; - - /* Define the number of dynamic entries that are active. */ - ULONG nx_ip_arp_dynamic_active_count; - - /* Define the ARP deferred packet processing queue. This is used to - process ARP packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_arp_deferred_received_packet_head, - *nx_ip_arp_deferred_received_packet_tail; - - /* Define the ARP entry allocate routine. This also doubles as a - mechanism to make sure ARP is enabled. If this function is NULL, ARP - is not enabled. */ - UINT (*nx_ip_arp_allocate)(struct NX_IP_STRUCT *, struct NX_ARP_STRUCT **, UINT); - - /* Define the ARP periodic processing routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the ARP receive queue processing routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the ARP send packet routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_packet_send)(struct NX_IP_STRUCT *, ULONG destination_ip, NX_INTERFACE *nx_interface); - - /* Define the ARP gratuitous response handler. This routine is setup in the - nx_arp_gratuitous_send function. */ - void (*nx_ip_arp_gratuitous_response_handler)(struct NX_IP_STRUCT *, NX_PACKET *); - -#ifdef NX_ENABLE_ARP_MAC_CHANGE_NOTIFICATION - /* Define the ARP collision notify handler. A non-null value for this function - pointer results in NetX calling it whenever an IP address is found in an incoming - ARP packet that matches that of the IP address in our ARP table. */ - void (*nx_ip_arp_collision_notify_response_handler)(void *); -#endif - - /* Define the ARP cache memory area. This memory is supplied - by the ARP enable function and is carved up by that function into as - many ARP entries that will fit. */ - struct NX_ARP_STRUCT - *nx_ip_arp_cache_memory; - - /* Define the number of ARP entries that will fit in the ARP cache. */ - ULONG nx_ip_arp_total_entries; - - /* Define the RARP periodic processing routine. This is setup when RARP is - enabled. It is also used to indicate RARP is enabled. */ - void (*nx_ip_rarp_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the RARP receive queue processing routine. This is setup when RARP is - enabled. */ - void (*nx_ip_rarp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the RARP deferred packet processing queue. This is used to - process RARP packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_rarp_deferred_received_packet_head, - *nx_ip_rarp_deferred_received_packet_tail; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the link between other IP structures created by the application. */ - struct NX_IP_STRUCT - *nx_ip_created_next, - *nx_ip_created_previous; - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_IP_STRUCT::nx_ip_reserved_ptr) suppress member not referenced. */ - void *nx_ip_reserved_ptr; - - /* Define the TCP devered cleanup processing routine. */ - void (*nx_tcp_deferred_cleanup_check)(struct NX_IP_STRUCT *); - - /* Define the interfaces attached to this IP instance. */ - NX_INTERFACE nx_ip_interface[NX_MAX_IP_INTERFACES]; - -#ifndef NX_DISABLE_IPV4 - /* Define the IPv4 packet receive processing routine */ - void (*nx_ipv4_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Define the static routing table, if the feature is enabled. */ -#ifdef NX_ENABLE_IP_STATIC_ROUTING - - /* IPv4 static routing table. */ - NX_IP_ROUTING_ENTRY - nx_ip_routing_table[NX_IP_ROUTING_TABLE_SIZE]; - - /* Number of entries in the IPv4 static routing table. */ - ULONG nx_ip_routing_table_entry_count; - -#endif /* NX_ENABLE_IP_STATIC_ROUTING */ -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - - /* Number of valid entries in the IPv6 default router table. */ - USHORT nx_ipv6_default_router_table_size; - - /* IPv6 default router table. */ - NX_IPV6_DEFAULT_ROUTER_ENTRY nx_ipv6_default_router_table[NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE]; - - /* Create an index for round robin router selection. */ - UINT nx_ipv6_default_router_table_round_robin_index; - - /* - * IPv6 prefix table. Entries in the prefix table are put into two lists: - * the prefix list, and the free list. The prefix list keeps track of a list - * of valid prefix entries. The free list points to the unused entries. - */ - NX_IPV6_PREFIX_ENTRY nx_ipv6_prefix_list_table[NX_IPV6_PREFIX_LIST_TABLE_SIZE]; - - /* Point to the 1st element of the prefix list. */ - NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_list_ptr; - - /* Pointer to the 1st element of the prefix free list entry. */ - NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_entry_free_list; - - /* Define the IPv6 packet receive processing routine */ - void (*nx_ipv6_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Variable tracks the Neighbor Solicitation retransmission timer. */ - ULONG nx_ipv6_retrans_timer_ticks; - - /* Variable tracks the Neighbor reachable timer. */ - ULONG nx_ipv6_reachable_timer; - - /* Variable tracks the current hop_limit. Hop limit is assigned by - routers through the router advertisement message. */ - ULONG nx_ipv6_hop_limit; - -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - /* Define the IPsec Authentication Header process function, for the received packet. */ - UINT (*nx_ip_ipsec_authentication_header_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **); - - /* Define the IPsec Authentication Header process function, for the transmit packet. */ - UINT (*nx_ip_ipsec_authentication_header_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT, UINT); - - /* Define the IPsec Encapsulating Security Payload header process function, for the received packet. */ - UINT (*nx_ip_ipsec_encapsulating_security_payload_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **); - - /* Define the IPsec Encapsulating Security Payload header insert function, for the transmit packet. */ - UINT (*nx_ip_ipsec_encapsulating_security_payload_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT); - - /* Define the IPsec egress SA lookup routine. This is called by TCP/UDP/ICMP/RAW packet send. */ - UINT (*nx_ip_packet_egress_sa_lookup)(struct NX_IP_STRUCT *ip_ptr, NXD_ADDRESS *src_address, - NXD_ADDRESS *dst_address, UCHAR protocol, ULONG src_port, ULONG dest_port, - ULONG *data_offset, VOID **sa_ptr, UINT option); - - /* Define the head pointer of the ingress SA list. */ - VOID *nx_ip_ipsec_ingress_sa_ptr; - - /* Define the head pointer of the egress SA list. */ - VOID *nx_ip_ipsec_egress_sa_ptr; - - /* Define the reference to IKEv2. */ - VOID *nx_ip_ipsec_ikev2_ptr; - - /* Define the packet queue header in which packet is processed by hardware engine. */ - NX_PACKET *nx_ip_hw_done_packet_header_ptr; - - /* Define the packet queue tail in which packet is processed by hardware engine. */ - NX_PACKET *nx_ip_hw_done_packet_tail_ptr; - -#endif /* NX_IPSEC_ENABLE */ - - /* Define the link status change notify routine. */ - VOID (*nx_ip_link_status_change_callback)(struct NX_IP_STRUCT *, UINT, UINT); - -#ifdef NX_ENABLE_IP_PACKET_FILTER - /* Define the IP packet filter routine. */ - UINT (*nx_ip_packet_filter)(VOID *, UINT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Define the port extension in the IP control block. This - is typically defined to whitespace in nx_port.h. */ - NX_IP_MODULE_EXTENSION - -} NX_IP; - - -/* Define the Driver interface structure that is typically allocated off of the - local stack and passed to the IP Link Driver. */ - -typedef struct NX_IP_DRIVER_STRUCT -{ - - /* Define the driver command. */ - UINT nx_ip_driver_command; - - /* Define the driver return status. */ - UINT nx_ip_driver_status; - - /* Define the physical address that maps to the destination IP address. */ - ULONG nx_ip_driver_physical_address_msw; - ULONG nx_ip_driver_physical_address_lsw; - -#ifdef NX_ENABLE_6LOWPAN - /* Define the length of physical address. Used by 6LoWPAN driver. */ - USHORT nx_ip_driver_physical_address_length; - - /* Define the 6LoWPAN sub driver command, see nx_6lowpan.h. Used by 6LoWPAN driver. */ - USHORT nx_ip_driver_sub_command; -#endif /* NX_ENABLE_6LOWPAN */ - - /* Define the datagram packet (if any) for the driver to send. */ - NX_PACKET *nx_ip_driver_packet; - - /* Define the return pointer for raw driver command requests. */ - ULONG *nx_ip_driver_return_ptr; - - /* Define the IP pointer associated with the request. */ - struct NX_IP_STRUCT - *nx_ip_driver_ptr; - - NX_INTERFACE *nx_ip_driver_interface; -} NX_IP_DRIVER; - - -/* Define the system API mappings based on the error checking - selected by the user. Note: this section is only applicable to - application source code, hence the conditional that turns off this - stuff when the include file is processed by the ThreadX source. */ - -#ifndef NX_SOURCE_CODE - -/* Map old APIs to new APIs. */ -#define nx_ip_raw_packet_interface_send nx_ip_raw_packet_source_send -#define nx_udp_socket_interface_send nx_udp_socket_source_send -#define nxd_icmp_interface_ping nxd_icmp_source_ping -#define nxd_ip_raw_packet_interface_send nxd_ip_raw_packet_source_send -#define nxd_ipv6_global_address_set(i, a, p) nxd_ipv6_address_set(i, 0, a, p, NX_NULL) -#define nxd_ipv6_linklocal_address_set(i, a) nxd_ipv6_address_set(i, 0, a, 10, NX_NULL) -#define nxd_udp_socket_interface_send nxd_udp_socket_source_send - - -/* Determine if error checking is desired. If so, map API functions - to the appropriate error checking front-ends. Otherwise, map API - functions to the core functions that actually perform the work. - Note: error checking is enabled by default. */ - -#ifdef NX_DISABLE_ERROR_CHECKING - -#if 0 /* Not support for STM32L4XX. */ -/* Services without error checking. */ -/* APIs for ARP. */ -#define nx_arp_dynamic_entries_invalidate _nx_arp_dynamic_entries_invalidate -#define nx_arp_dynamic_entry_set _nx_arp_dynamic_entry_set -#define nx_arp_enable _nx_arp_enable -#define nx_arp_entry_delete _nx_arp_entry_delete -#define nx_arp_gratuitous_send _nx_arp_gratuitous_send -#define nx_arp_hardware_address_find _nx_arp_hardware_address_find -#define nx_arp_info_get _nx_arp_info_get -#define nx_arp_ip_address_find _nx_arp_ip_address_find -#define nx_arp_static_entries_delete _nx_arp_static_entries_delete -#define nx_arp_static_entry_create _nx_arp_static_entry_create -#define nx_arp_static_entry_delete _nx_arp_static_entry_delete -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ICMP. */ -#define nx_icmp_enable _nx_icmp_enable -#define nx_icmp_info_get _nx_icmp_info_get -#define nx_icmp_ping _nx_icmp_ping -#define nxd_icmp_enable _nxd_icmp_enable -#define nxd_icmp_ping _nxd_icmp_ping -#define nxd_icmp_source_ping _nxd_icmp_source_ping -#define nxd_icmpv6_ra_flag_callback_set _nxd_icmpv6_ra_flag_callback_set -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IGMP. */ -#define nx_igmp_enable _nx_igmp_enable -#define nx_igmp_info_get _nx_igmp_info_get -#define nx_igmp_loopback_disable _nx_igmp_loopback_disable -#define nx_igmp_multicast_leave _nx_igmp_multicast_leave -#define nx_igmp_multicast_interface_join _nx_igmp_multicast_interface_join -#define nx_igmp_multicast_interface_leave _nx_igmp_multicast_interface_leave -#define nx_igmp_loopback_enable _nx_igmp_loopback_enable -#define nx_igmp_multicast_join _nx_igmp_multicast_join -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IP. */ -#define nx_ip_address_change_notify _nx_ip_address_change_notify -#define nx_ip_address_get _nx_ip_address_get -#define nx_ip_address_set _nx_ip_address_set -#define nx_ip_auxiliary_packet_pool_set _nx_ip_auxiliary_packet_pool_set -#endif - -#define nx_ip_create _nx_ip_create -#define nx_ip_delete _nx_ip_delete - -#if 0 /* Not support for STM32L4XX. */ -#define nx_ip_driver_direct_command _nx_ip_driver_direct_command -#define nx_ip_driver_interface_direct_command _nx_ip_driver_interface_direct_command -#define nx_ip_forwarding_disable _nx_ip_forwarding_disable -#define nx_ip_forwarding_enable _nx_ip_forwarding_enable -#define nx_ip_fragment_disable _nx_ip_fragment_disable -#define nx_ip_fragment_enable _nx_ip_fragment_enable -#define nx_ip_gateway_address_clear _nx_ip_gateway_address_clear -#define nx_ip_gateway_address_get _nx_ip_gateway_address_get -#define nx_ip_gateway_address_set _nx_ip_gateway_address_set -#define nx_ip_info_get _nx_ip_info_get -#define nx_ip_interface_address_get _nx_ip_interface_address_get -#define nx_ip_interface_address_mapping_configure _nx_ip_interface_address_mapping_configure -#define nx_ip_interface_address_set _nx_ip_interface_address_set -#define nx_ip_interface_attach _nx_ip_interface_attach -#define nx_ip_interface_capability_get _nx_ip_interface_capability_get -#define nx_ip_interface_capability_set _nx_ip_interface_capability_set -#define nx_ip_interface_detach _nx_ip_interface_detach -#define nx_ip_interface_info_get _nx_ip_interface_info_get -#define nx_ip_interface_mtu_set _nx_ip_interface_mtu_set -#define nx_ip_interface_physical_address_get _nx_ip_interface_physical_address_get -#define nx_ip_interface_physical_address_set _nx_ip_interface_physical_address_set -#define nx_ip_interface_status_check _nx_ip_interface_status_check -#define nx_ip_link_status_change_notify_set _nx_ip_link_status_change_notify_set -#define nx_ip_max_payload_size_find _nx_ip_max_payload_size_find -#define nx_ip_status_check _nx_ip_status_check -#define nx_ip_static_route_add _nx_ip_static_route_add -#define nx_ip_static_route_delete _nx_ip_static_route_delete -#define nx_ipv4_multicast_interface_join _nx_ipv4_multicast_interface_join -#define nx_ipv4_multicast_interface_leave _nx_ipv4_multicast_interface_leave -#define nxd_ipv6_address_change_notify _nxd_ipv6_address_change_notify -#define nxd_ipv6_address_delete _nxd_ipv6_address_delete -#define nxd_ipv6_address_get _nxd_ipv6_address_get -#define nxd_ipv6_address_set _nxd_ipv6_address_set -#define nxd_ipv6_default_router_add _nxd_ipv6_default_router_add -#define nxd_ipv6_default_router_delete _nxd_ipv6_default_router_delete -#define nxd_ipv6_default_router_entry_get _nxd_ipv6_default_router_entry_get -#define nxd_ipv6_default_router_get _nxd_ipv6_default_router_get -#define nxd_ipv6_default_router_number_of_entries_get _nxd_ipv6_default_router_number_of_entries_get -#define nxd_ipv6_disable _nxd_ipv6_disable -#define nxd_ipv6_enable _nxd_ipv6_enable -#define nxd_ipv6_multicast_interface_join _nxd_ipv6_multicast_interface_join -#define nxd_ipv6_multicast_interface_leave _nxd_ipv6_multicast_interface_leave -#define nxd_ipv6_stateless_address_autoconfig_disable _nxd_ipv6_stateless_address_autoconfig_disable -#define nxd_ipv6_stateless_address_autoconfig_enable _nxd_ipv6_stateless_address_autoconfig_enable -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RAW service. */ -#define nx_ip_raw_packet_disable _nx_ip_raw_packet_disable -#define nx_ip_raw_packet_enable _nx_ip_raw_packet_enable -#define nx_ip_raw_packet_filter_set _nx_ip_raw_packet_filter_set -#define nx_ip_raw_packet_receive _nx_ip_raw_packet_receive -#define nx_ip_raw_packet_send _nx_ip_raw_packet_send -#define nx_ip_raw_packet_source_send _nx_ip_raw_packet_source_send -#define nx_ip_raw_receive_queue_max_set _nx_ip_raw_receive_queue_max_set -#define nxd_ip_raw_packet_send _nxd_ip_raw_packet_send -#define nxd_ip_raw_packet_source_send _nxd_ip_raw_packet_source_send -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ND cache. */ -#define nxd_nd_cache_entry_set _nxd_nd_cache_entry_set -#define nxd_nd_cache_entry_delete _nxd_nd_cache_entry_delete -#define nxd_nd_cache_hardware_address_find _nxd_nd_cache_hardware_address_find -#define nxd_nd_cache_invalidate _nxd_nd_cache_invalidate -#define nxd_nd_cache_ip_address_find _nxd_nd_cache_ip_address_find -#endif - -/* APIs for packet pool. */ -#define nx_packet_allocate _nx_packet_allocate -#define nx_packet_copy _nx_packet_copy -#define nx_packet_data_append _nx_packet_data_append -#define nx_packet_data_extract_offset _nx_packet_data_extract_offset -#define nx_packet_data_retrieve _nx_packet_data_retrieve -#define nx_packet_length_get _nx_packet_length_get -#define nx_packet_pool_create _nx_packet_pool_create -#define nx_packet_pool_delete _nx_packet_pool_delete -#define nx_packet_pool_info_get _nx_packet_pool_info_get -#define nx_packet_pool_low_watermark_set _nx_packet_pool_low_watermark_set -#define nx_packet_release _nx_packet_release -#define nx_packet_transmit_release _nx_packet_transmit_release - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RARP. */ -#define nx_rarp_disable _nx_rarp_disable -#define nx_rarp_enable _nx_rarp_enable -#define nx_rarp_info_get _nx_rarp_info_get -#endif - -/* APIs for TCP. */ -#define nx_tcp_client_socket_bind _nx_tcp_client_socket_bind -#define nx_tcp_client_socket_connect _nx_tcp_client_socket_connect -#define nx_tcp_client_socket_port_get _nx_tcp_client_socket_port_get -#define nx_tcp_client_socket_unbind _nx_tcp_client_socket_unbind -#define nx_tcp_enable _nx_tcp_enable -#define nx_tcp_free_port_find _nx_tcp_free_port_find -#define nx_tcp_info_get _nx_tcp_info_get -#define nx_tcp_server_socket_accept _nx_tcp_server_socket_accept -#define nx_tcp_server_socket_listen _nx_tcp_server_socket_listen -#define nx_tcp_server_socket_relisten _nx_tcp_server_socket_relisten -#define nx_tcp_server_socket_unaccept _nx_tcp_server_socket_unaccept -#define nx_tcp_server_socket_unlisten _nx_tcp_server_socket_unlisten -#define nx_tcp_socket_bytes_available _nx_tcp_socket_bytes_available -#define nx_tcp_socket_create _nx_tcp_socket_create -#define nx_tcp_socket_delete _nx_tcp_socket_delete -#define nx_tcp_socket_disconnect _nx_tcp_socket_disconnect -#define nx_tcp_socket_disconnect_complete_notify _nx_tcp_socket_disconnect_complete_notify -#define nx_tcp_socket_establish_notify _nx_tcp_socket_establish_notify -#define nx_tcp_socket_info_get _nx_tcp_socket_info_get -#define nx_tcp_socket_mss_get _nx_tcp_socket_mss_get -#define nx_tcp_socket_mss_peer_get _nx_tcp_socket_mss_peer_get -#define nx_tcp_socket_mss_set _nx_tcp_socket_mss_set -#define nx_tcp_socket_peer_info_get _nx_tcp_socket_peer_info_get -#define nx_tcp_socket_queue_depth_notify_set _nx_tcp_socket_queue_depth_notify_set -#define nx_tcp_socket_receive _nx_tcp_socket_receive -#define nx_tcp_socket_receive_notify _nx_tcp_socket_receive_notify -#define nx_tcp_socket_receive_queue_max_set _nx_tcp_socket_receive_queue_max_set -#define nx_tcp_socket_send _nx_tcp_socket_send -#define nx_tcp_socket_state_wait _nx_tcp_socket_state_wait -#define nx_tcp_socket_timed_wait_callback _nx_tcp_socket_timed_wait_callback -#define nx_tcp_socket_transmit_configure _nx_tcp_socket_transmit_configure -#define nx_tcp_socket_window_update_notify_set _nx_tcp_socket_window_update_notify_set -#define nxd_tcp_client_socket_connect _nxd_tcp_client_socket_connect -#define nxd_tcp_socket_peer_info_get _nxd_tcp_socket_peer_info_get - -/* APIs for UDP. */ - -#define nx_udp_enable _nx_udp_enable -#define nx_udp_free_port_find _nx_udp_free_port_find -#define nx_udp_info_get _nx_udp_info_get -#define nx_udp_packet_info_extract _nx_udp_packet_info_extract -#define nx_udp_socket_bind _nx_udp_socket_bind -#define nx_udp_socket_bytes_available _nx_udp_socket_bytes_available -#define nx_udp_socket_checksum_disable _nx_udp_socket_checksum_disable -#define nx_udp_socket_checksum_enable _nx_udp_socket_checksum_enable -#define nx_udp_socket_create _nx_udp_socket_create -#define nx_udp_socket_delete _nx_udp_socket_delete -#define nx_udp_socket_info_get _nx_udp_socket_info_get -#define nx_udp_socket_port_get _nx_udp_socket_port_get -#define nx_udp_socket_receive _nx_udp_socket_receive -#define nx_udp_socket_receive_notify _nx_udp_socket_receive_notify -#define nx_udp_socket_send _nx_udp_socket_send -#define nx_udp_socket_source_send _nx_udp_socket_source_send -#define nx_udp_socket_unbind _nx_udp_socket_unbind -#define nx_udp_source_extract _nx_udp_source_extract -#define nxd_udp_packet_info_extract _nxd_udp_packet_info_extract -#define nxd_udp_socket_send _nxd_udp_socket_send -#define nxd_udp_socket_source_send _nxd_udp_socket_source_send -#define nxd_udp_source_extract _nxd_udp_source_extract - -/* APIs for others. */ -#define nx_system_initialize _nx_system_initialize - -#else - -#if 0 /* Not support for STM32L4XX. */ -/* Services with error checking. */ -/* APIs for ARP. */ -#define nx_arp_dynamic_entries_invalidate _nxe_arp_dynamic_entries_invalidate -#define nx_arp_dynamic_entry_set _nxe_arp_dynamic_entry_set -#define nx_arp_enable _nxe_arp_enable -#define nx_arp_entry_delete _nxe_arp_entry_delete -#define nx_arp_gratuitous_send _nxe_arp_gratuitous_send -#define nx_arp_hardware_address_find _nxe_arp_hardware_address_find -#define nx_arp_info_get _nxe_arp_info_get -#define nx_arp_ip_address_find _nxe_arp_ip_address_find -#define nx_arp_static_entries_delete _nxe_arp_static_entries_delete -#define nx_arp_static_entry_create _nxe_arp_static_entry_create -#define nx_arp_static_entry_delete _nxe_arp_static_entry_delete -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ICMP. */ -#define nx_icmp_enable _nxe_icmp_enable -#define nx_icmp_info_get _nxe_icmp_info_get -#define nx_icmp_ping _nxe_icmp_ping -#define nxd_icmp_enable _nxde_icmp_enable -#define nxd_icmp_ping _nxde_icmp_ping -#define nxd_icmp_source_ping _nxde_icmp_source_ping -#define nxd_icmpv6_ra_flag_callback_set _nxde_icmpv6_ra_flag_callback_set -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IGMP. */ -#define nx_igmp_enable _nxe_igmp_enable -#define nx_igmp_info_get _nxe_igmp_info_get -#define nx_igmp_loopback_disable _nxe_igmp_loopback_disable -#define nx_igmp_loopback_enable _nxe_igmp_loopback_enable -#define nx_igmp_multicast_interface_join _nxe_igmp_multicast_interface_join -#define nx_igmp_multicast_interface_leave _nxe_igmp_multicast_interface_leave -#define nx_igmp_multicast_join _nxe_igmp_multicast_join -#define nx_igmp_multicast_leave _nxe_igmp_multicast_leave -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IP. */ -#define nx_ip_address_change_notify _nxe_ip_address_change_notify -#define nx_ip_address_get _nxe_ip_address_get -#define nx_ip_address_set _nxe_ip_address_set -#define nx_ip_auxiliary_packet_pool_set _nxe_ip_auxiliary_packet_pool_set -#endif - -#define nx_ip_create(i, n, a, m, d, l, p, s, y) _nxe_ip_create(i, n, a, m, d, l, p, s, y, sizeof(NX_IP)) -#define nx_ip_delete _nxe_ip_delete - -#if 0 /* Not support for STM32L4XX. */ -#define nx_ip_driver_direct_command _nxe_ip_driver_direct_command -#define nx_ip_driver_interface_direct_command _nxe_ip_driver_interface_direct_command -#define nx_ip_forwarding_disable _nxe_ip_forwarding_disable -#define nx_ip_forwarding_enable _nxe_ip_forwarding_enable -#define nx_ip_fragment_disable _nxe_ip_fragment_disable -#define nx_ip_fragment_enable _nxe_ip_fragment_enable -#define nx_ip_gateway_address_clear _nxe_ip_gateway_address_clear -#define nx_ip_gateway_address_get _nxe_ip_gateway_address_get -#define nx_ip_gateway_address_set _nxe_ip_gateway_address_set -#define nx_ip_info_get _nxe_ip_info_get -#define nx_ip_interface_address_get _nxe_ip_interface_address_get -#define nx_ip_interface_address_mapping_configure _nxe_ip_interface_address_mapping_configure -#define nx_ip_interface_address_set _nxe_ip_interface_address_set -#define nx_ip_interface_attach _nxe_ip_interface_attach -#define nx_ip_interface_capability_get _nxe_ip_interface_capability_get -#define nx_ip_interface_capability_set _nxe_ip_interface_capability_set -#define nx_ip_interface_detach _nxe_ip_interface_detach -#define nx_ip_interface_info_get _nxe_ip_interface_info_get -#define nx_ip_interface_mtu_set _nxe_ip_interface_mtu_set -#define nx_ip_interface_physical_address_get _nxe_ip_interface_physical_address_get -#define nx_ip_interface_physical_address_set _nxe_ip_interface_physical_address_set -#define nx_ip_interface_status_check _nxe_ip_interface_status_check -#define nx_ip_link_status_change_notify_set _nxe_ip_link_status_change_notify_set -#define nx_ip_max_payload_size_find _nxe_ip_max_payload_size_find -#define nx_ip_status_check _nxe_ip_status_check -#define nx_ip_static_route_add _nxe_ip_static_route_add -#define nx_ip_static_route_delete _nxe_ip_static_route_delete -#define nx_ipv4_multicast_interface_join _nxe_ipv4_multicast_interface_join -#define nx_ipv4_multicast_interface_leave _nxe_ipv4_multicast_interface_leave -#define nxd_ipv6_address_change_notify _nxde_ipv6_address_change_notify -#define nxd_ipv6_address_delete _nxde_ipv6_address_delete -#define nxd_ipv6_address_get _nxde_ipv6_address_get -#define nxd_ipv6_address_set _nxde_ipv6_address_set -#define nxd_ipv6_default_router_add _nxde_ipv6_default_router_add -#define nxd_ipv6_default_router_delete _nxde_ipv6_default_router_delete -#define nxd_ipv6_default_router_entry_get _nxde_ipv6_default_router_entry_get -#define nxd_ipv6_default_router_get _nxde_ipv6_default_router_get -#define nxd_ipv6_default_router_number_of_entries_get _nxde_ipv6_default_router_number_of_entries_get -#define nxd_ipv6_disable _nxde_ipv6_disable -#define nxd_ipv6_enable _nxde_ipv6_enable -#define nxd_ipv6_multicast_interface_join _nxde_ipv6_multicast_interface_join -#define nxd_ipv6_multicast_interface_leave _nxde_ipv6_multicast_interface_leave -#define nxd_ipv6_stateless_address_autoconfig_disable _nxde_ipv6_stateless_address_autoconfig_disable -#define nxd_ipv6_stateless_address_autoconfig_enable _nxde_ipv6_stateless_address_autoconfig_enable -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RAW service. */ -#define nx_ip_raw_packet_disable _nxe_ip_raw_packet_disable -#define nx_ip_raw_packet_enable _nxe_ip_raw_packet_enable -#define nx_ip_raw_packet_filter_set _nxe_ip_raw_packet_filter_set -#define nx_ip_raw_packet_receive _nxe_ip_raw_packet_receive -#define nx_ip_raw_packet_send(i, p, d, t) _nxe_ip_raw_packet_send(i, &p, d, t) -#define nx_ip_raw_packet_source_send(i, p, d, a, t) _nxe_ip_raw_packet_source_send(i, &p, d, a, t) -#define nx_ip_raw_receive_queue_max_set _nxe_ip_raw_receive_queue_max_set -#define nxd_ip_raw_packet_send(i, p, d, t, l, s) _nxde_ip_raw_packet_send(i, &p, d, t, l, s) -#define nxd_ip_raw_packet_source_send _nxde_ip_raw_packet_source_send -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ND cache. */ -#define nxd_nd_cache_entry_set _nxde_nd_cache_entry_set -#define nxd_nd_cache_entry_delete _nxde_nd_cache_entry_delete -#define nxd_nd_cache_hardware_address_find _nxde_nd_cache_hardware_address_find -#define nxd_nd_cache_invalidate _nxde_nd_cache_invalidate -#define nxd_nd_cache_ip_address_find _nxde_nd_cache_ip_address_find -#endif - -/* APIs for packet pool. */ -#define nx_packet_allocate _nxe_packet_allocate -#define nx_packet_copy _nxe_packet_copy -#define nx_packet_data_append _nxe_packet_data_append -#define nx_packet_data_extract_offset _nxe_packet_data_extract_offset -#define nx_packet_data_retrieve _nxe_packet_data_retrieve -#define nx_packet_length_get _nxe_packet_length_get -#define nx_packet_pool_create(p, n, l, m, s) _nxe_packet_pool_create(p, n, l, m, s, sizeof(NX_PACKET_POOL)) -#define nx_packet_pool_delete _nxe_packet_pool_delete -#define nx_packet_pool_info_get _nxe_packet_pool_info_get -#define nx_packet_pool_low_watermark_set _nxe_packet_pool_low_watermark_set -#define nx_packet_release(p) _nxe_packet_release(&p) -#define nx_packet_transmit_release(p) _nxe_packet_transmit_release(&p) - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RARP. */ -#define nx_rarp_disable _nxe_rarp_disable -#define nx_rarp_enable _nxe_rarp_enable -#define nx_rarp_info_get _nxe_rarp_info_get -#endif - -/* APIs for TCP. */ -#define nx_tcp_client_socket_bind _nxe_tcp_client_socket_bind -#define nx_tcp_client_socket_connect _nxe_tcp_client_socket_connect -#define nx_tcp_client_socket_port_get _nxe_tcp_client_socket_port_get -#define nx_tcp_client_socket_unbind _nxe_tcp_client_socket_unbind -#define nx_tcp_enable _nxe_tcp_enable -#define nx_tcp_free_port_find _nxe_tcp_free_port_find -#define nx_tcp_info_get _nxe_tcp_info_get -#define nx_tcp_server_socket_accept _nxe_tcp_server_socket_accept -#define nx_tcp_server_socket_listen _nxe_tcp_server_socket_listen -#define nx_tcp_server_socket_relisten _nxe_tcp_server_socket_relisten -#define nx_tcp_server_socket_unaccept _nxe_tcp_server_socket_unaccept -#define nx_tcp_server_socket_unlisten _nxe_tcp_server_socket_unlisten -#define nx_tcp_socket_bytes_available _nxe_tcp_socket_bytes_available -#define nx_tcp_socket_create(i, s, n, t, f, l, w, u, d) _nxe_tcp_socket_create(i, s, n, t, f, l, w, u, d, sizeof(NX_TCP_SOCKET)) -#define nx_tcp_socket_delete _nxe_tcp_socket_delete -#define nx_tcp_socket_disconnect _nxe_tcp_socket_disconnect -#define nx_tcp_socket_disconnect_complete_notify _nxe_tcp_socket_disconnect_complete_notify -#define nx_tcp_socket_establish_notify _nxe_tcp_socket_establish_notify -#define nx_tcp_socket_info_get _nxe_tcp_socket_info_get -#define nx_tcp_socket_mss_get _nxe_tcp_socket_mss_get -#define nx_tcp_socket_mss_peer_get _nxe_tcp_socket_mss_peer_get -#define nx_tcp_socket_mss_set _nxe_tcp_socket_mss_set -#define nx_tcp_socket_peer_info_get _nxe_tcp_socket_peer_info_get -#define nx_tcp_socket_queue_depth_notify_set _nxe_tcp_socket_queue_depth_notify_set -#define nx_tcp_socket_receive _nxe_tcp_socket_receive -#define nx_tcp_socket_receive_notify _nxe_tcp_socket_receive_notify -#define nx_tcp_socket_receive_queue_max_set _nxe_tcp_socket_receive_queue_max_set -#define nx_tcp_socket_send(s, p, t) _nxe_tcp_socket_send(s, &p, t) -#define nx_tcp_socket_state_wait _nxe_tcp_socket_state_wait -#define nx_tcp_socket_timed_wait_callback _nxe_tcp_socket_timed_wait_callback -#define nx_tcp_socket_transmit_configure _nxe_tcp_socket_transmit_configure -#define nx_tcp_socket_window_update_notify_set _nxe_tcp_socket_window_update_notify_set -#define nxd_tcp_client_socket_connect _nxde_tcp_client_socket_connect -#define nxd_tcp_socket_peer_info_get _nxde_tcp_socket_peer_info_get - -/* APIs for UDP. */ -#define nx_udp_enable _nxe_udp_enable -#define nx_udp_free_port_find _nxe_udp_free_port_find -#define nx_udp_info_get _nxe_udp_info_get -#define nx_udp_packet_info_extract _nxe_udp_packet_info_extract -#define nx_udp_socket_bind _nxe_udp_socket_bind -#define nx_udp_socket_bytes_available _nxe_udp_socket_bytes_available -#define nx_udp_socket_checksum_disable _nxe_udp_socket_checksum_disable -#define nx_udp_socket_checksum_enable _nxe_udp_socket_checksum_enable -#define nx_udp_socket_create(i, s, n, t, f, l, q) _nxe_udp_socket_create(i, s, n, t, f, l, q, sizeof(NX_UDP_SOCKET)) -#define nx_udp_socket_delete _nxe_udp_socket_delete -#define nx_udp_socket_info_get _nxe_udp_socket_info_get -#define nx_udp_socket_port_get _nxe_udp_socket_port_get -#define nx_udp_socket_receive _nxe_udp_socket_receive -#define nx_udp_socket_receive_notify _nxe_udp_socket_receive_notify -#define nx_udp_socket_send(s, p, i, t) _nxe_udp_socket_send(s, &p, i, t) -#define nx_udp_socket_source_send(s, p, i, t, a) _nxe_udp_socket_source_send(s, &p, i, t, a) -#define nx_udp_socket_unbind _nxe_udp_socket_unbind -#define nx_udp_source_extract _nxe_udp_source_extract -#define nxd_udp_packet_info_extract _nxde_udp_packet_info_extract -#define nxd_udp_socket_send(s, p, i, t) _nxde_udp_socket_send(s, &p, i, t) -#define nxd_udp_socket_source_send _nxde_udp_socket_source_send -#define nxd_udp_source_extract _nxde_udp_source_extract - -/* APIs for others. */ -#define nx_system_initialize _nx_system_initialize -#endif - - -/* Define the function prototypes of the NetX Duo API. */ - -/* APIs for ARP. */ -UINT nx_arp_dynamic_entries_invalidate(NX_IP *ip_ptr); -UINT nx_arp_dynamic_entry_set(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_enable(NX_IP *ip_ptr, VOID *arp_cache_memory, ULONG arp_cache_size); -UINT nx_arp_entry_delete(NX_IP *ip_ptr, ULONG ip_address); -UINT nx_arp_gratuitous_send(NX_IP *ip_ptr, VOID (*response_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -UINT nx_arp_hardware_address_find(NX_IP *ip_ptr, ULONG ip_address, ULONG *physical_msw, ULONG *physical_lsw); -UINT nx_arp_info_get(NX_IP *ip_ptr, ULONG *arp_requests_sent, ULONG *arp_requests_received, - ULONG *arp_responses_sent, ULONG *arp_responses_received, - ULONG *arp_dynamic_entries, ULONG *arp_static_entries, - ULONG *arp_aged_entries, ULONG *arp_invalid_messages); -UINT nx_arp_ip_address_find(NX_IP *ip_ptr, ULONG *ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_static_entries_delete(NX_IP *ip_ptr); -UINT nx_arp_static_entry_create(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_static_entry_delete(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); - -/* APIs for ICMP. */ -UINT nx_icmp_enable(NX_IP *ip_ptr); -UINT nx_icmp_info_get(NX_IP *ip_ptr, ULONG *pings_sent, ULONG *ping_timeouts, - ULONG *ping_threads_suspended, ULONG *ping_responses_received, - ULONG *icmp_checksum_errors, ULONG *icmp_unhandled_messages); -UINT nx_icmp_ping(NX_IP *ip_ptr, ULONG ip_address, CHAR *data, ULONG data_size, - NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmp_enable(NX_IP *ip_ptr); -UINT nxd_icmp_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, CHAR *data_ptr, ULONG data_size, - NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmp_source_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, UINT address_index, CHAR *data_ptr, - ULONG data_size, NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmpv6_ra_flag_callback_set(NX_IP *ip_ptr, - VOID (*icmpv6_ra_flag_callback)(NX_IP *ip_ptr, UINT ra_flag)); - -/* APIs for IGMP. */ -UINT nx_igmp_enable(NX_IP *ip_ptr); -UINT nx_igmp_info_get(NX_IP *ip_ptr, ULONG *igmp_reports_sent, ULONG *igmp_queries_received, - ULONG *igmp_checksum_errors, ULONG *current_groups_joined); -UINT nx_igmp_loopback_disable(NX_IP *ip_ptr); -UINT nx_igmp_loopback_enable(NX_IP *ip_ptr); -UINT nx_igmp_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_igmp_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_igmp_multicast_join(NX_IP *ip_ptr, ULONG group_address); -UINT nx_igmp_multicast_leave(NX_IP *ip_ptr, ULONG group_address); - -/* APIs for IP. */ -UINT nx_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT nx_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT nx_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT nx_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size); -#else -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority); -#endif -UINT nx_ip_delete(NX_IP *ip_ptr); -UINT nx_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT nx_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); -UINT nx_ip_forwarding_disable(NX_IP *ip_ptr); -UINT nx_ip_forwarding_enable(NX_IP *ip_ptr); -UINT nx_ip_fragment_disable(NX_IP *ip_ptr); -UINT nx_ip_fragment_enable(NX_IP *ip_ptr); -UINT nx_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT nx_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT nx_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT nx_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT nx_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT nx_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT nx_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, - VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT nx_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT nx_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT nx_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, ULONG *ip_address, - ULONG *network_mask, ULONG *mtu_size, ULONG *physical_address_msw, - ULONG *physical_address_lsw); -UINT nx_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *physical_msw, - ULONG *physical_lsw); -UINT nx_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG physical_msw, - ULONG physical_lsw, UINT update_driver); -UINT nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, - ULONG *actual_status, ULONG wait_option); -UINT nx_ip_link_status_change_notify_set(NX_IP *ip_ptr, - VOID (*link_status_change_notify)(NX_IP *ip_ptr, - UINT interface_index, - UINT link_up)); -UINT nx_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT nx_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option); -UINT nx_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask, ULONG next_hop); -UINT nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT nx_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nxd_ipv6_address_change_notify(NX_IP *ip_ptr, - VOID (*ip_address_change_notify)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, - ULONG *prefix_length, UINT *interface_index); -UINT nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, - ULONG prefix_length, UINT *address_index); -UINT nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, - ULONG router_lifetime, UINT interface_index); -UINT nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_addr); -UINT nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, - NXD_ADDRESS *router_addr, ULONG *router_lifetime, - ULONG *prefix_length, ULONG *configuration_method); -UINT nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, - ULONG *router_lifetime, ULONG *prefix_length); -UINT nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT nxd_ipv6_disable(NX_IP *ip_ptr); -UINT nxd_ipv6_enable(NX_IP *ip_ptr); -UINT nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); - -/* APIs for RAW service. */ -UINT nx_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT nx_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT nx_ip_raw_packet_filter_set(NX_IP *ip_ptr, UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT nx_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nxe_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -#else -UINT _nx_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nx_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nx_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, NXD_ADDRESS *destination_ip, - ULONG protocol, UINT ttl, ULONG tos); -#else /* NX_DISABLE_ERROR_CHECKING */ -UINT _nxd_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, - ULONG protocol, UINT ttl, ULONG tos); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nxd_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, - UINT address_index, ULONG protocol, UINT ttl, ULONG tos); - -/* APIs for ND cache. */ -UINT nxd_nd_cache_entry_set(NX_IP *ip_ptr, ULONG *dest_ip, UINT interface_index, CHAR *mac); -UINT nxd_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip); -UINT nxd_nd_cache_hardware_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, - ULONG *physical_msw, ULONG *physical_lsw, UINT *interface_index); -UINT nxd_nd_cache_invalidate(NX_IP *ip_ptr); -UINT nxd_nd_cache_ip_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, - ULONG physical_msw, ULONG physical_lsw, UINT *interface_index); - -/* APIs for packet pool. */ -UINT nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, - ULONG buffer_length, ULONG *bytes_copied); -UINT nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size, UINT pool_control_block_size); -#else -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size); -#endif -UINT nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_water_mark); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr); -#else -UINT _nx_packet_release(NX_PACKET *packet_ptr); -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr); -#endif - -/* APIs for RARP. */ -UINT nx_rarp_disable(NX_IP *ip_ptr); -UINT nx_rarp_enable(NX_IP *ip_ptr); -UINT nx_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received, - ULONG *rarp_invalid_messages); - -/* APIs for TCP. */ -UINT nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, - UINT server_port, ULONG wait_option); -UINT nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_enable(NX_IP *ip_ptr); -UINT nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size); -#else -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)); -#endif -UINT nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_establish_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); -UINT nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option); -#else -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -#endif -UINT nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_window_update_notify)(NX_TCP_SOCKET *)); -UINT nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, - UINT server_port, ULONG wait_option); -UINT nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); - -/* APIs for UDP. */ -UINT nx_udp_enable(NX_IP *ip_ptr); -UINT nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT nx_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -UINT nx_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT nx_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum, UINT udp_socket_size); -#else - -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum); -#endif -UINT nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT nx_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *)); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT _nxde_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port, UINT address_index); - -#else /* NX_DISABLE_ERROR_CHECKING */ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT _nxd_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port, UINT address_index); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT nxd_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port); -UINT _nxe_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG ip_address, UINT port, UINT address_index); -#else -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port); -UINT _nx_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port, UINT address_index); - -#endif -UINT nxd_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); - -/* APIs for others. */ -VOID nx_system_initialize(VOID); - -/* Define several function prototypes for exclusive use by NetX I/O drivers. These routines - are used by NetX drivers to report received packets to NetX. */ - -/* Define the driver deferred packet routines. Using these routines results in the lowest - possible ISR processing time. However, it does require slightly more overhead than the - other NetX receive processing routines. The _nx_ip_driver_deferred_enable routine - should be called from the driver's initialization routine, with the driver's deferred - packet processing routine provided. Each packet the driver receives should be - delivered to NetX via the _nx_ip_driver_deferred_receive function. This function - queues the packet for the NetX IP thread. The NetX IP thread will then call the driver's - deferred packet processing routine, which can then process the packet at a thread level - of execution. The deferred packet processing routine should use the _nx_ip_packet_receive, - _nx_arp_packet_deferred_receive, and _nx_rarp_packet_deferred_receive to dispatch the - appropriate packets to NetX. In order to use the deferred packet processing, NetX - must be built with NX_DRIVER_DEFERRED_PROCESSING defined. */ - -VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -VOID _nx_ip_driver_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - - -/* Define the driver deferred processing notification routine. Calling this routine from - the driver will cause the driver to be called with the NX_LINK_DEFERRED_PROCESSING - value specified in the nx_ip_driver_command field of the NX_IP_DRIVER request - structure. This is useful in situations where the driver wishes to process activities - like transmit complete interrupts at the thread level rather than in the ISR. Note - that the driver must set its own internal variables in order to know what processing - needs to be done when subsequently called from the IP helper thread. */ - -VOID _nx_ip_driver_deferred_processing(NX_IP *ip_ptr); - - -/* Define the deferred NetX receive processing routines. These routines depend on the - NetX I/O drive to perform enough processing in the ISR to strip the link protocol - header and dispatch to the appropriate NetX receive processing. These routines - can also be called from the previously mentioned driver deferred processing. */ - -VOID _nx_ip_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_arp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_rarp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - - -/* Define the direct IP packet receive processing. This is the lowest overhead way - to notify NetX of a received IP packet, however, it results in the most amount of - processing in the driver's receive ISR. If the driver deferred packet processing - is used, this routine should be used to notify NetX of the newly received IP packet. */ - -VOID _nx_ip_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - -/* Define the direct link status event. This is the lowest overhead way - to notify NetX of link status event, however, it results in the most amount of - processing in the driver's receive ISR. */ -VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index); - -#endif - -#ifdef FEATURE_NX_IPV6 - -#ifdef NX_LITTLE_ENDIAN -#define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr) _nx_ipv6_address_change_endian(addr) -#else /* BIG ENDIAN */ -#define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr) -#endif /* NX_LITTLE_ENDIAN */ - -#endif /* FEATURE_NX_IPV6 */ - - -#ifdef NX_IPV6_UTIL_INLINE -/* Return 1 if IPv6 address is unspecified (::) */ -#define CHECK_UNSPECIFIED_ADDRESS(ip_addr) \ - (!((ip_addr)[0] || (ip_addr)[1] || (ip_addr)[2] || (ip_addr)[3])) - - -/* Set IPv6 address to unspecified (::) */ -#define SET_UNSPECIFIED_ADDRESS(ip_addr) \ - do { \ - (ip_addr)[0] = 0; \ - (ip_addr)[1] = 0; \ - (ip_addr)[2] = 0; \ - (ip_addr)[3] = 0; \ - } while (0) - - -/* Copy IPv6 address. */ -#define COPY_IPV6_ADDRESS(copy_from, copy_to) \ - do { \ - (copy_to)[0] = (copy_from)[0]; \ - (copy_to)[1] = (copy_from)[1]; \ - (copy_to)[2] = (copy_from)[2]; \ - (copy_to)[3] = (copy_from)[3]; \ - } while (0) - -/* Copy NXD IP address structure */ -#define COPY_NXD_ADDRESS(copy_from, copy_to) \ - do { \ - (copy_to) -> nxd_ip_version = (copy_from) -> nxd_ip_version; \ - (copy_to) -> nxd_ip_address.v6[0] = (copy_from) -> nxd_ip_address.v6[0]; \ - (copy_to) -> nxd_ip_address.v6[1] = (copy_from) -> nxd_ip_address.v6[1]; \ - (copy_to) -> nxd_ip_address.v6[2] = (copy_from) -> nxd_ip_address.v6[2]; \ - (copy_to) -> nxd_ip_address.v6[3] = (copy_from) -> nxd_ip_address.v6[3]; \ - } while (0) - - -#define SET_SOLICITED_NODE_MULTICAST_ADDRESS(address, unicast) \ - do { \ - (address)[0] = 0xFF020000; \ - (address)[1] = 0; \ - (address)[2] = 1; \ - (address)[3] = 0xFF000000 | (unicast)[3]; \ - } while (0) - - -#define CHECK_ALL_ROUTER_MCAST_ADDRESS(addr) \ - (((addr)[0] == 0xFF020000) && \ - ((addr)[1] == 0) && \ - ((addr)[2] == 0) && \ - ((addr)[3] == 2)) - -/* Check whether or not two IPv6 addresses are the same. */ -#define CHECK_IPV6_ADDRESSES_SAME(addr1, addr2) \ - (((addr1)[0] == (addr2)[0]) && \ - ((addr1)[1] == (addr2)[1]) && \ - ((addr1)[2] == (addr2)[2]) && \ - ((addr1)[3] == (addr2)[3])) - - -#endif /* NX_IPV6_UTIL_INLINE */ - -/* Utility functions. */ -UINT _nx_utility_string_length_check(CHAR *input_string, UINT *string_length, UINT max_string_length); -UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number); -UINT _nx_utility_uint_to_string(UINT number, UINT base, CHAR *string_buffer, UINT string_buffer_size); -UINT _nx_utility_base64_encode(UCHAR *name, UINT name_size, UCHAR *base64name, UINT base64name_size, UINT *bytes_copied); -UINT _nx_utility_base64_decode(UCHAR *base64name, UINT base64name_size, UCHAR *name, UINT name_size, UINT *bytes_copied); - -/* Determine if a C++ compiler is being used. If so, complete the standard - C conditional started above. */ -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip.h deleted file mode 100644 index bedc1a77..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip.h +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ip.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IP_H -#define NX_IP_H - - -/* Define IP constants. */ - -#define NX_IP_ID ((ULONG)0x49502020) - - - -/* Define the mask for the IP header length field. */ - -#define NX_IP_LENGTH_MASK ((ULONG)0x0F000000) /* Mask for length bit */ - - - -/* Define IP event flags. These events are processed by the IP thread. */ - -#define NX_IP_ALL_EVENTS ((ULONG)0xFFFFFFFF) /* All event flags */ -#define NX_IP_PERIODIC_EVENT ((ULONG)0x00000001) /* Periodic event */ -#define NX_IP_UNFRAG_EVENT ((ULONG)0x00000002) /* Unfragment event */ -#define NX_IP_ICMP_EVENT ((ULONG)0x00000004) /* ICMP message event */ -#define NX_IP_RECEIVE_EVENT ((ULONG)0x00000008) /* IP receive packet event */ -#define NX_IP_ARP_REC_EVENT ((ULONG)0x00000010) /* ARP deferred receive event */ -#define NX_IP_RARP_REC_EVENT ((ULONG)0x00000020) /* RARP deferred receive event */ -#define NX_IP_IGMP_EVENT ((ULONG)0x00000040) /* IGMP message event */ -#define NX_IP_TCP_EVENT ((ULONG)0x00000080) /* TCP message event */ -#define NX_IP_FAST_EVENT ((ULONG)0x00000100) /* Fast TCP timer event */ -#ifdef NX_DRIVER_DEFERRED_PROCESSING -#define NX_IP_DRIVER_PACKET_EVENT ((ULONG)0x00000200) /* Driver Deferred packet event */ -#endif /* NX_DRIVER_DEFERRED_PROCESSING */ -#define NX_IP_IGMP_ENABLE_EVENT ((ULONG)0x00000400) /* IGMP enable event */ -#define NX_IP_DRIVER_DEFERRED_EVENT ((ULONG)0x00000800) /* Driver deferred processing */ - /* event */ -#define NX_IP_TCP_CLEANUP_DEFERRED ((ULONG)0x00001000) /* Deferred TCP cleanup event */ -#ifdef NX_IPSEC_ENABLE -#define NX_IP_HW_DONE_EVENT ((ULONG)0x00002000) /* HW done event */ -#endif /* NX_IPSEC_ENABLE */ -#define NX_IP_LINK_STATUS_EVENT ((ULONG)0x00004000) /* Link status change event */ - - -#ifndef NX_IP_FAST_TIMER_RATE -#define NX_IP_FAST_TIMER_RATE 10 -#endif - -/* Define the amount of time to sleep in nx_ip_(interface_)status_check */ -#ifndef NX_IP_STATUS_CHECK_WAIT_TIME -#define NX_IP_STATUS_CHECK_WAIT_TIME 1 -#endif /* NX_IP_STATUS_CHECK_WAIT_TIME */ - -#include "nx_ipv4.h" - - - -#if 0 /* Not support for STM32L4XX. */ -/* Define IP function prototypes. */ -UINT _nx_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); -USHORT _nx_ip_checksum_compute(NX_PACKET *packet_ptr, ULONG protocol, UINT data_length, - ULONG *_src_ip_addr, ULONG *_dest_ip_addr); -UINT _nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT _nx_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT _nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT _nx_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, ULONG *ip_address, - ULONG *network_mask, ULONG *mtu_size, ULONG *phsyical_address_msw, - ULONG *physical_address_lsw); -UINT _nx_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT _nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *physical_msw, ULONG *physical_lsw); -UINT _nx_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG physical_msw, ULONG physical_lsw, UINT update_driver); -UINT _nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, ULONG *actual_status, - ULONG wait_option); -#endif - -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority); -UINT _nx_ip_delete(NX_IP *ip_ptr); - -#if 0 /* Not support for STM32L4XX. */ -VOID _nx_ip_delete_queue_clear(NX_PACKET *head_ptr); -VOID _nx_ip_deferred_link_status_process(NX_IP *ip_ptr); -VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index); -VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -VOID _nx_ip_driver_deferred_processing(NX_IP *ip_ptr); -VOID _nx_ip_driver_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT _nx_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); - - -UINT _nx_ip_forwarding_disable(NX_IP *ip_ptr); -UINT _nx_ip_forwarding_enable(NX_IP *ip_ptr); -UINT _nx_ip_fragment_disable(NX_IP *ip_ptr); -UINT _nx_ip_fragment_enable(NX_IP *ip_ptr); -UINT _nx_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT _nx_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT _nx_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT _nx_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT _nx_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT _nx_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT _nx_ip_raw_packet_filter_set(NX_IP *ip_ptr, UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT _nx_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); -UINT _nx_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxd_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, UINT address_index, ULONG protocol, UINT ttl, ULONG tos); -#endif - -VOID _nx_ip_initialize(VOID); - -#if 0 /* Not support for STM32L4XX. */ -VOID _nx_ip_periodic_timer_entry(ULONG ip_address); -VOID _nx_ip_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ip_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option); -UINT _nx_ip_link_status_change_notify_set(NX_IP *ip_ptr, VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up)); -VOID _nx_ip_thread_entry(ULONG ip_ptr_value); -VOID _nx_ip_raw_packet_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_ip_raw_packet_processing(NX_IP *ip_ptr, ULONG protocol, NX_PACKET *packet_ptr); -UINT _nxd_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *destination_ip, ULONG protocol, UINT ttl, ULONG tos); -#ifndef NX_DISABLE_FRAGMENTATION -VOID _nx_ip_fragment_timeout_check(NX_IP *ip_ptr); -VOID _nx_ip_fragment_packet(struct NX_IP_DRIVER_STRUCT *driver_req_ptr); -VOID _nx_ip_fragment_assembly(NX_IP *ip_ptr); -#endif /* NX_DISABLE_FRAGMENTATION */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY -VOID _nx_ip_packet_checksum_compute(NX_PACKET *packet_ptr); -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ -#endif - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size); -UINT _nxe_ip_delete(NX_IP *ip_ptr); - -#if 0 /* Not support for STM32L4XX. */ -UINT _nxe_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT _nxe_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); -UINT _nxe_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); - - -UINT _nxe_ip_forwarding_disable(NX_IP *ip_ptr); -UINT _nxe_ip_forwarding_enable(NX_IP *ip_ptr); -UINT _nxe_ip_fragment_disable(NX_IP *ip_ptr); -UINT _nxe_ip_fragment_enable(NX_IP *ip_ptr); -UINT _nxe_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT _nxe_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT _nxe_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT _nxe_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT _nxe_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxde_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, UINT address_index, ULONG protocol, UINT ttl, ULONG tos); -UINT _nxe_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, - ULONG wait_option); - -UINT _nxe_ip_link_status_change_notify_set(NX_IP *ip_ptr, VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up)); -UINT _nxe_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT _nxe_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT _nxe_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT _nxe_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, - ULONG *ip_address, ULONG *network_mask, ULONG *mtu_size, - ULONG *physical_address_msw, ULONG *physical_address_lsw); -UINT _nxe_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT _nxe_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, - ULONG *physical_msw, ULONG *physical_lsw); -UINT _nxe_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, - ULONG physical_msw, ULONG physical_lsw, UINT update_driver); -UINT _nxe_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, - ULONG *actual_status, ULONG wait_option); -UINT _nxe_ip_raw_packet_filter_set(NX_IP *ip_ptr, - UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT _nxe_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); - - -VOID _nx_ip_fast_periodic_timer_create(NX_IP *ip_ptr); - -UINT _nx_ip_dispatch_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr, UINT protocol); -#endif - -/* IP component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_IP_INIT -#define IP_DECLARE -#else -#define IP_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the head pointer of the created IP list. */ - -IP_DECLARE NX_IP *_nx_ip_created_ptr; - - -/* Define the number of created IP instances. */ - -IP_DECLARE ULONG _nx_ip_created_count; - - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_create.c deleted file mode 100644 index 4692b477..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_create.c +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_system.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates an Internet Protocol instance, including */ -/* setting up all appropriate data structures and calling the supplied */ -/* link driver for initialization of the physical interface. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* name Name of this IP instance */ -/* ip_address Internet address for this IP */ -/* network_mask Network mask for IP address */ -/* default_pool Default packet pool */ -/* ip_link_driver User supplied IP link driver */ -/* memory_ptr Pointer memory area for IP */ -/* memory_size Size of IP memory area */ -/* priority Priority of IP helper thread */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_event_flags_create Create IP event flags */ -/* tx_event_flags_delete Delete IP event flags */ -/* tx_mutex_create Create IP protection mutex */ -/* tx_mutex_delete Delete IP protection mutex */ -/* tx_thread_create Create IP helper thread */ -/* tx_timer_create Create IP periodic timer */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *), - VOID *memory_ptr, ULONG memory_size, UINT priority) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *tail_ptr; -UINT i; -UINT old_threshold = 0; -TX_THREAD *current_thread; - -#ifdef NX_DISABLE_IPV4 - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(network_mask); -#endif /* NX_DISABLE_IPV4 */ - - /* Reference the version ID and option words to ensure they are linked in. */ - if (((ULONG)_nx_system_build_options_1 | (ULONG)_nx_system_build_options_2 | (ULONG)_nx_system_build_options_3 | - (ULONG)_nx_system_build_options_4 | (ULONG)_nx_system_build_options_5 | (ULONG)_nx_version_id[0]) == 0) - { - - /* We should never get here! */ - return(NX_NOT_IMPLEMENTED); - } - - /* Initialize the IP control block to zero. */ - memset((void *)ip_ptr, 0, sizeof(NX_IP)); - - /* Configure the primary interface. */ - ip_ptr -> nx_ip_interface[0].nx_interface_valid = 1; - -#ifndef NX_DISABLE_IPV4 - /* Save the IP address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_address = ip_address; - - /* Save the network mask. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_network_mask = network_mask; - - /* Derive the network bits of this IP address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_network = ip_address & network_mask; - - /* Initialize the ARP defend timeout. */ - ip_ptr -> nx_ip_interface[0].nx_interface_arp_defend_timeout = 0; -#endif /* !NX_DISABLE_IPV4 */ - - /* Setup the link driver address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_link_driver_entry = ip_link_driver; - - /* Set the device interface name to "PRI". */ - /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ip_ptr -> nx_ip_interface[0].nx_interface_name = (CHAR *)"PRI"; - - /* Set index of each interface. */ - for (i = 0; i < NX_MAX_IP_INTERFACES; i++) - { - ip_ptr -> nx_ip_interface[i].nx_interface_index = (UCHAR)i; - } - - -#ifndef NX_DISABLE_LOOPBACK_INTERFACE - - /* Set the Loopback interface name. */ - /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_name = (CHAR *)"Internal IP Loopback"; - - - /* Mark the loopback interface as valid. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_valid = 1; - -#ifndef NX_DISABLE_IPV4 - /* Set the loopback interface address. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_address = 0x7F000001; - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_network_mask = 0xFF000000; - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_network = 0x7F000000; -#endif /* !NX_DISABLE_IPV4 */ - - /* Loopback interface is a special case. Therefore no dedicated link driver needed. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_link_driver_entry = NX_NULL; - - /* Loopback interface does not need IP/MAC address mapping. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_address_mapping_needed = 0; - - /* There is actually no MTU limit for the loopback interface. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_mtu_size = 65535; - - /* Mark the loopback interface as LINK UP */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_link_up = 1; - - /* Set all the link capability. */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_capability_flag = (NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM); -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#endif /* !NX_DISABLE_LOOPBACK_INTERFACE */ - - /* Save the supplied IP name. */ - ip_ptr -> nx_ip_name = name; - - /* Set the initial IP packet ID. */ - ip_ptr -> nx_ip_packet_id = NX_INIT_PACKET_ID; - - /* Setup the default packet pool for this IP instance. */ - ip_ptr -> nx_ip_default_packet_pool = default_pool; - -#ifdef NX_ENABLE_DUAL_PACKET_POOL - /* Setup the auxiliary packet pool for this IP instance. By default it pointers to default pool. */ - ip_ptr -> nx_ip_auxiliary_packet_pool = default_pool; -#endif /* NX_ENABLE_DUAL_PACKET_POOL */ - - /* Create the internal IP protection mutex. */ - tx_mutex_create(&(ip_ptr -> nx_ip_protection), name, TX_NO_INHERIT); - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, priority, &old_threshold); - } - - /* Otherwise, the IP initialization was successful. Place the - IP control block on the list of created IP instances. */ - TX_DISABLE - - /* Load the IP ID field in the IP control block. */ - ip_ptr -> nx_ip_id = NX_IP_ID; - - /* Place the new IP control block on the list of created IPs. First, - check for an empty list. */ - if (_nx_ip_created_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = _nx_ip_created_ptr -> nx_ip_created_previous; - - /* Place the new IP control block in the list. */ - _nx_ip_created_ptr -> nx_ip_created_previous = ip_ptr; - tail_ptr -> nx_ip_created_next = ip_ptr; - - /* Setup this IP's created links. */ - ip_ptr -> nx_ip_created_previous = tail_ptr; - ip_ptr -> nx_ip_created_next = _nx_ip_created_ptr; - } - else - { - - /* The created IP list is empty. Add IP control block to empty list. */ - _nx_ip_created_ptr = ip_ptr; - ip_ptr -> nx_ip_created_next = ip_ptr; - ip_ptr -> nx_ip_created_previous = ip_ptr; - } - - /* Increment the created IP counter. */ - _nx_ip_created_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized in previous tx_thread_preemption_change call. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Return success to the caller. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_delete.c deleted file mode 100644 index f2dcaa4e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_delete.c +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes an Internet Protocol instance, including */ -/* calling the associated driver with a link disable request. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_delete_queue_clear Clear a packet queue */ -/* _nx_ip_raw_packet_cleanup Cleanup raw packet suspension */ -/* _nx_icmp_cleanup Cleanup for ICMP packets */ -/* _nx_ip_fragment_disable Disable fragment processing */ -/* tx_mutex_delete Delete IP protection mutex */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* tx_thread_terminate Terminate IP helper thread */ -/* tx_event_flags_delete Delete IP event flags */ -/* tx_thread_delete Delete IP helper thread */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* tx_timer_deactivate Deactivate IP-ARP timer */ -/* tx_timer_delete Delete IP-ARP timer */ -/* (ip_link_driver) User supplied link driver */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_ip_delete(NX_IP *ip_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_IP_DELETE, ip_ptr, 0, 0, 0, NX_TRACE_IP_EVENTS, 0, 0); - - /* Get mutex protection. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the IP instance has any sockets bound to it. */ - if ((ip_ptr -> nx_ip_udp_created_sockets_count) || (ip_ptr -> nx_ip_tcp_created_sockets_count)) - { - - /* Still sockets bound to this IP instance. They must all be deleted prior - to deleting the IP instance. Release the mutex and return - an error code. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - return(NX_SOCKETS_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Remove the IP instance from the created list. */ - - /* See if the IP instance is the only one on the list. */ - if (ip_ptr == ip_ptr -> nx_ip_created_next) - { - - /* Only created IP instance, just set the created list to NULL. */ - _nx_ip_created_ptr = TX_NULL; - } - else - { - - /* Otherwise, not the only created IP, link-up the neighbors. */ - (ip_ptr -> nx_ip_created_next) -> nx_ip_created_previous = - ip_ptr -> nx_ip_created_previous; - (ip_ptr -> nx_ip_created_previous) -> nx_ip_created_next = - ip_ptr -> nx_ip_created_next; - - /* See if we have to update the created list head pointer. */ - if (_nx_ip_created_ptr == ip_ptr) - { - - /* Yes, move the head pointer to the next link. */ - _nx_ip_created_ptr = ip_ptr -> nx_ip_created_next; - } - } - - /* Decrement the IP created counter. */ - _nx_ip_created_count--; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Release mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Delete the internal IP protection mutex. */ - tx_mutex_delete(&(ip_ptr -> nx_ip_protection)); - - /* Clear the IP ID to make it invalid. */ - ip_ptr -> nx_ip_id = 0; - - /* Disable interrupts. */ - TX_DISABLE - - /* Restore preemption. */ - _tx_thread_preempt_disable--; - - /* Restore interrupts. */ - TX_RESTORE - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return success to the caller. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_initialize.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_initialize.c deleted file mode 100644 index b8eb0caa..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ip_initialize.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX IP data in this file. */ - -#define NX_IP_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the Internet Protocol component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_ip_initialize(VOID) -{ - - /* Initialize the created IP instance variables. */ - _nx_ip_created_ptr = NX_NULL; - _nx_ip_created_count = 0; -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv4.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv4.h deleted file mode 100644 index b1bf77da..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv4.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ipv4.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IPV4_H -#define NX_IPV4_H - - -#ifndef NX_DISABLE_IPV4 -#define NX_IP_VERSION 0x45000000UL /* Version 4, Length of 5 */ - -#define NX_IP_NORMAL_LENGTH 5 /* Normal IP header length */ -#define NX_IP_HEADER_LENGTH_ENCODE_6 6 /* IP header length 6. */ - -/* Define IP options. */ - -#define NX_IP_OPTION_COPY_FLAG 0x80000000UL /* All fragments must carry the option. */ -#define NX_IP_OPTION_CLASS 0x00000000UL /* Control. */ -#define NX_IP_OPTION_ROUTER_ALERT_NUMBER 0x14000000UL -#define NX_IP_OPTION_ROUTER_ALERT_LENGTH 0x00040000UL -#define NX_IP_OPTION_ROUTER_ALERT_VALUE 0x00000000UL - - -/* Define IP option type. */ -#define NX_IP_OPTION_END 0 -#define NX_IP_OPTION_NO_OPERATION 1 -#define NX_IP_OPTION_INTERNET_TIMESTAMP 68 - - -/* Define IP fragmenting information. */ - -#ifdef NX_DONT_FRAGMENT -#define NX_IP_DONT_FRAGMENT NX_DONT_FRAGMENT -#else -#define NX_IP_DONT_FRAGMENT 0x00004000UL /* Don't fragment bit */ -#endif /* NX_DONT_FRAGMENT */ -#ifdef NX_MORE_FRAGMENTS -#define NX_IP_MORE_FRAGMENT NX_MORE_FRAGMENTS -#else -#define NX_IP_MORE_FRAGMENT 0x00002000UL /* More fragments */ -#endif /* NX_DONT_FRAGMENT */ -#define NX_IP_FRAGMENT_MASK 0x00003FFFUL /* Mask for fragment bits */ -#ifdef NX_FRAG_OFFSET_MASK -#define NX_IP_OFFSET_MASK NX_FRAG_OFFSET_MASK -#else -#define NX_IP_OFFSET_MASK 0x00001FFFUL /* Mask for fragment offset */ -#endif /* NX_FRAG_OFFSET_MASK */ -#define NX_IP_ALIGN_FRAGS 8 /* Fragment alignment */ - -/* Define basic IP Header constant. */ - -/* Define Basic Internet packet header data type. This will be used to - build new IP packets and to examine incoming packets into NetX. */ - -typedef struct NX_IPV4_HEADER_STRUCT -{ - /* Define the first 32-bit word of the IP header. This word contains - the following information: - - bits 31-28 IP Version = 0x4 (IP Version4) - bits 27-24 IP Header Length of 32-bit words (5 if no options) - bits 23-16 IP Type of Service, where 0x00 -> Normal - 0x10 -> Minimize Delay - 0x08 -> Maximize Throughput - 0x04 -> Maximize Reliability - 0x02 -> Minimize Monetary Cost - bits 15-0 IP Datagram length in bytes - */ - ULONG nx_ip_header_word_0; - - /* Define the second word of the IP header. This word contains - the following information: - - bits 31-16 IP Packet Identification (just an incrementing number) - bits 15-0 IP Flags and Fragment Offset (used for IP fragmenting) - bit 15 Zero - bit 14 Don't Fragment - bit 13 More Fragments - bits 12-0 (Fragment offset)/8 - */ - ULONG nx_ip_header_word_1; - - /* Define the third word of the IP header. This word contains - the following information: - - bits 31-24 IP Time-To-Live (maximum number of routers - packet can traverse before being - thrown away. Default values are typically - 32 or 64) - bits 23-16 IP Protocol, where 0x01 -> ICMP Messages - 0x02 -> IGMP Messages - 0x06 -> TCP Messages - 0x11 -> UDP Messages - bits 15-0 IP Checksum - */ - ULONG nx_ip_header_word_2; - - /* Define the source IP address. */ - ULONG nx_ip_header_source_ip; - - /* Define the destination IP address. */ - ULONG nx_ip_header_destination_ip; -} NX_IPV4_HEADER; - -#if 0 /* Not support for STM32L4XX. */ -/* Define IPv4 internal function prototypes. */ -VOID _nx_ip_forward_packet_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ip_fragment_forward_packet(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG fragment, ULONG next_hop_address); -void _nx_ip_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG type_of_service, ULONG time_to_live, ULONG protocol, ULONG fragment, ULONG next_hop_address); -UINT _nx_ip_header_add(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG type_of_service, ULONG time_to_live, ULONG protocol, ULONG fragment); -VOID _nx_ip_driver_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG fragment, ULONG next_hop_address); -ULONG _nx_ip_route_find(NX_IP *ip_ptr, ULONG destination_address, NX_INTERFACE **nx_ip_interface, ULONG *next_hop_address); -VOID _nx_ipv4_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv4_option_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -#endif /* NX_DISABLE_IPV4 */ - -/* Define IPv4 function prototypes. */ - -UINT _nx_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT _nx_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT _nx_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT _nx_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT _nx_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT _nx_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT _nx_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT _nx_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT _nx_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nx_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, UINT address_index, ULONG type_of_service); -UINT _nx_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, - ULONG net_mask, ULONG next_hop); -UINT _nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT _nx_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT _nx_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT _nxe_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT _nxe_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT _nxe_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT _nxe_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT _nxe_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT _nxe_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT _nxe_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nxe_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -UINT _nxe_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, - ULONG net_mask, ULONG next_hop); -UINT _nxe_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT _nxe_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT _nxe_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -#endif - -#ifndef FEATURE_NX_IPV6 -#ifdef NX_IPSEC_ENABLE -#define AUTHENTICATION_HEADER 5 -#define ENCAP_SECURITY_HEADER 6 -#endif /* NX_IPSEC_ENABLE */ -#endif /* FEATURE_NX_IPV6 */ -#endif /* NX_IPV4_H */ - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv6.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv6.h deleted file mode 100644 index b01f5147..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_ipv6.h +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol version 6 (IPv6) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ipv6.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* This header file is for NetX Duo internal use only. Application */ -/* shall not include this file directly. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IPV6_H -#define NX_IPV6_H - -#include "tx_api.h" -#ifdef FEATURE_NX_IPV6 - -/* Define basic IP Header constant. */ - -/* Define Basic Internet packet header data type. This will be used to - build new IP packets and to examine incoming packets into NetX. */ - -typedef struct NX_IPV6_HEADER_STRUCT -{ - /* - Define the first 32-bit word of the IP header. This word contains - the following information: - - bits 31-28 IP Version = 0x6 (IP Version6) - bits 27-20 Traffic Class - bits 19-00 Flow Lable - */ - ULONG nx_ip_header_word_0; - - /* - Define the second word of the IP header. This word contains - the following information: - - bits 31-16 Payload Length - bits 15-8 Next Header; - bits 7-0 Hop limit - */ - ULONG nx_ip_header_word_1; - - /* Sender IP address. */ - ULONG nx_ip_header_source_ip[4]; - - /* Define the destination IP address. */ - ULONG nx_ip_header_destination_ip[4]; -} NX_IPV6_HEADER; - - -/* Define the data structure of the IPv6 optional field used in - hop-by-hop option and destination option headers. */ -typedef struct NX_IPV6_HEADER_OPTION_STRUCT -{ - - /* A hint to the protocol that follows. */ - UCHAR nx_ipv6_header_option_next_header; - - /* Size of this option field.*/ - UCHAR nx_ipv6_header_option_ext_length; - - /* ICMPv6 Option header type. */ - /*lint -esym(768,NX_IPV6_HEADER_OPTION_STRUCT::nx_ipv6_header_option_type) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_option_type; - - /* ICMPv6 Option-specific area. */ - /*lint -esym(768,NX_IPV6_HEADER_OPTION_STRUCT::nx_ipv6_header_option_data) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_option_data; -} NX_IPV6_HEADER_OPTION; - - -/* Hop by hop header optoin. */ -typedef struct NX_IPV6_HOP_BY_HOP_OPTION_STRUCT -{ - /* Option type. */ - UCHAR nx_ipv6_hop_by_hop_option_type; - - /* Size of this option field.*/ - UCHAR nx_ipv6_hop_by_hop_length; - - /* Start point of the option data. */ - /*lint -esym(768,NX_IPV6_HOP_BY_HOP_OPTION_STRUCT::nx_ipv6_hop_by_hop_data) suppress member not referenced. It is not used as a host. */ - USHORT nx_ipv6_hop_by_hop_data; -} NX_IPV6_HOP_BY_HOP_OPTION; - - -/* Routing header option. */ -typedef struct NX_IPV6_HEADER_ROUTING_OPTION_STRUCT -{ - - /* A hint to the protocol that follows. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_next_header) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_next_header; - - /* Header length. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_hdr_ext_len) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_hdr_ext_len; - - /* Router type. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_routing_type) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_routing_type; - - /* Segments left. */ - UCHAR nx_ipv6_header_routing_option_segments_left; - - /* Data. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_data) suppress member not referenced. It is not used as a host. */ - ULONG *nx_ipv6_header_routing_option_data; -} NX_IPV6_HEADER_ROUTING_OPTION; - -/* Fragment header option. */ -typedef struct NX_IPV6_HEADER_FRAGMENT_OPTION_STRUCT -{ - /* A hint to the protocol that follows. */ - UCHAR nx_ipv6_header_fragment_option_next_header; - - /* Unused field. */ - UCHAR nx_ipv6_header_fragment_option_reserved; - - /* Fragment offset. Last 3 bits are used as flags. */ - USHORT nx_ipv6_header_fragment_option_offset_flag; - - /* ID field. */ - ULONG nx_ipv6_header_fragment_option_packet_id; -} NX_IPV6_HEADER_FRAGMENT_OPTION; - -/* Unicast address type. Note that site local address types have been - deprectated in RFC 4291 and are treated as global address types. */ -#define IPV6_ADDRESS_LINKLOCAL 0x00000001 -/* -#define IPV6_ADDRESS_SITELOCAL 0x00000002 - */ -#define IPV6_ADDRESS_GLOBAL 0x00000004 - -/* Multicast address type */ -#define IPV6_ALL_NODE_MCAST 0x00000010 -#define IPV6_ALL_ROUTER_MCAST 0x00000020 -#define IPV6_SOLICITED_NODE_MCAST 0x00000040 - -#define IPV6_ADDRESS_UNICAST 0x80000000 -#define IPV6_ADDRESS_MULTICAST 0x40000000 -#define IPV6_ADDRESS_UNSPECIFIED 0x20000000 -#define IPV6_ADDRESS_LOOPBACK 0x10000000 - - - -/* - The following symbols define the order of the IPv6 optional - headers. Each value represents a state during the parse of the - optional headers. An error occurs when the parser encounters - an optional header when it is not expecting the header, i.e. - the header is out of order. . - - - IPv6 defines the order of the optional headers: (RFC2460 section 4.1) - * IPv6 Header - * Hop-by-Hop Options header - * Destination Options header - * Routnig header - * Fragment header - * Authentication header - * Encapsulating Security Payload header - * Destination Options header - * Upper-layer header - */ -enum NX_IPV6_OPTION_STATE -{ - IPV6_BASE_HEADER, /* 0 */ - HOP_BY_HOP_HEADER, /* 1 */ - DESTINATION_HEADER_1, /* 2 */ - ROUTING_HEADER, /* 3 */ - FRAGMENT_HEADER, /* 4 */ -#ifdef NX_IPSEC_ENABLE - AUTHENTICATION_HEADER, /* 5 */ - ENCAP_SECURITY_HEADER, /* 6 */ -#endif /* NX_IPSEC_ENABLE */ - DESTINATION_HEADER_2 /* 7 */ -}; - - - -#if 0 /* Not support for STM32L4XX. */ -/* Define IPv6 internal functions. */ - -UINT _nxd_ipv6_default_router_add_internal(NX_IP *ip_ptr, ULONG *router_addr, ULONG router_lifetime, NX_INTERFACE *if_ptr, INT router_type, NX_IPV6_DEFAULT_ROUTER_ENTRY **_new_entry); -VOID _nxd_ipv6_default_router_table_init(NX_IP *ip_ptr); -UINT _nxd_ipv6_find_max_prefix_length(ULONG *addr1, ULONG *addr, UINT max_length); -VOID _nx_ipv6_fragment_process(struct NX_IP_DRIVER_STRUCT *driver_req_ptr, UINT mtu); -UINT _nx_ipv6_header_add(NX_IP *ip_ptr, NX_PACKET **packet_pptr, - ULONG protocol, ULONG payload_size, ULONG hop_limit, - ULONG *src_address, ULONG *dest_address, ULONG *fragment); -UINT _nx_ipv6_packet_copy(NX_PACKET *source_pkt_head, NX_PACKET *dest_pkt_head, UINT size); -UINT _nx_ipv6_multicast_join(NX_IP *, ULONG *, NX_INTERFACE *); -UINT _nx_ipv6_multicast_leave(NX_IP *, ULONG *, NX_INTERFACE *); -UINT _nx_ipv6_option_error(NX_IP *ip_ptr, NX_PACKET *packet_ptr, UCHAR option_type, UINT offset); -VOID _nx_ipv6_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ipv6_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG protocol, ULONG payload_size, ULONG hop_limit, ULONG *src_address, ULONG *dest_address); -UINT _nx_ipv6_prefix_list_add_entry(NX_IP *ip_ptr, ULONG *prefix, ULONG prefix_length, ULONG valid_lifetime); -VOID _nx_ipv6_prefix_list_delete(NX_IP *ip_ptr, ULONG *prefix, INT prefix_length); -VOID _nx_ipv6_prefix_list_delete_entry(NX_IP *ip_ptr, NX_IPV6_PREFIX_ENTRY *entry); -UINT _nx_ipv6_process_hop_by_hop_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv6_process_routing_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv6_process_fragment_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - -UINT _nxd_ipv6_interface_find(NX_IP *ip_ptr, ULONG *dest_address, - NXD_IPV6_ADDRESS **ipv6_addr, NX_INTERFACE *if_ptr); -UINT _nxd_ipv6_router_lookup(NX_IP *ip_ptr, NX_INTERFACE *if_ptr, ULONG *router_address, void **nd_cache_entry); -VOID _nxd_ipv6_router_solicitation_check(NX_IP *ip_ptr); -UINT _nxd_ipv6_raw_packet_send_internal(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, ULONG protocol); -VOID _nxd_ipv6_prefix_router_timer_tick(NX_IP *ip_ptr); -NX_IPV6_DEFAULT_ROUTER_ENTRY* _nxd_ipv6_find_default_router_from_address(NX_IP *ip_ptr, ULONG *ip_addr); -INT _nxd_ipv6_search_onlink(NX_IP *ip_ptr, ULONG *dest_addr); - -#endif /* FEATURE_NX_IPV6 */ - - - -/* - If NX_IPV6_UTIL_INLINE is defined, the functions are compiled as inline functions. - Inline functions improve execution speed. However it also increases code size. - Applications concerning more about code size should have the symbol undefeind - when building NetX Duo library and the application. - */ -#ifndef NX_IPV6_UTIL_INLINE - -#ifdef NX_IPSEC_ENABLE -INT CHECK_IPV6_ADDRESS_RANGE(ULONG *ip_addr_start, ULONG *ip_addr_end, ULONG *ip_addr); -#endif /* NX_IPSEC_ENABLE */ -INT CHECK_IPV6_ADDRESSES_SAME(ULONG *ip_dest, ULONG *myip); -INT CHECK_UNSPECIFIED_ADDRESS(ULONG *ip_addr); -void SET_UNSPECIFIED_ADDRESS(ULONG *ip_addr); -void COPY_IPV6_ADDRESS(ULONG *copy_from, ULONG *copy_to); -void COPY_NXD_ADDRESS(NXD_ADDRESS *copy_from, NXD_ADDRESS *copy_to); -void SET_SOLICITED_NODE_MULTICAST_ADDRESS(ULONG *address, ULONG *unicast_address); -INT CHECK_ALL_ROUTER_MCAST_ADDRESS(ULONG *address); -VOID _nx_ipv6_address_change_endian(ULONG *address); - -#endif /* NX_IPV6_UTIL_INLINE */ -INT CHECK_IP_ADDRESSES_BY_PREFIX(ULONG *ip_addr1, ULONG *ip_addr2, ULONG prefix_len); -INT CHECK_IPV6_SOLICITED_NODE_MCAST_ADDRESS(ULONG *dest_ip, ULONG *myip); -ULONG IPv6_Address_Type(ULONG *ip_address); - -/* Define IPv6 API function prototype. */ -UINT _nxd_ipv6_enable(NX_IP *ip_ptr); -UINT _nxd_ipv6_disable(NX_IP *ip_ptr); -UINT _nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index); -UINT _nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index); -UINT _nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT _nxd_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT _nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index); -UINT _nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address); -UINT _nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length); -UINT _nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method); -UINT _nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT _nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); - -/* Define error checking shells for API services. These are only referenced by the application. */ -UINT _nxde_ipv6_enable(NX_IP *ip_ptr); -UINT _nxde_ipv6_disable(NX_IP *ip_ptr); -UINT _nxde_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxde_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxde_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index); -UINT _nxde_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index); -UINT _nxde_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT _nxde_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT _nxde_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index); -UINT _nxde_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address); -UINT _nxde_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length); -UINT _nxde_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method); -UINT _nxde_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - NXD_ADDRESS *destination_ip, ULONG protocol, UINT ttl, ULONG tos); -UINT _nxde_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxde_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -#endif - -#endif /* NX_IPV6_H */ - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet.h deleted file mode 100644 index ffd4751e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_packet.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX packet memory management component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PAC_H -#define NX_PAC_H - - -#define NX_PACKET_POOL_ID ((ULONG)0x5041434B) - - -/* Define constants for packet free, allocated, enqueued, and driver transmit done. - These will be used in the nx_packet_tcp_queue_next field to indicate the state of - the packet. */ - -#define NX_PACKET_FREE ((ALIGN_TYPE)0xFFFFFFFF) /* Packet is available and in the pool */ -#define NX_PACKET_ALLOCATED ((ALIGN_TYPE)0xAAAAAAAA) /* Packet has been allocated */ -#define NX_PACKET_ENQUEUED ((ALIGN_TYPE)0xEEEEEEEE) /* Packet is the tail of TCP queue. */ - /* A value that is none of the above */ - /* also indicates the packet is in a */ - /* TCP queue */ - -/* Define the constant for driver done and receive packet is available. These will be - used in the nx_packet_queue_next field to indicate the state of a TCP packet. */ - -#define NX_DRIVER_TX_DONE ((ALIGN_TYPE)0xDDDDDDDD) /* Driver has sent the TCP packet */ -#define NX_PACKET_READY ((ALIGN_TYPE)0xBBBBBBBB) /* Packet is ready for retrieval */ - - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/* Define strings for packet debug information. */ -#define NX_PACKET_ARP_WAITING_QUEUE "ARP waiting queue" -#define NX_PACKET_ND_WAITING_QUEUE "ND waiting queue" -#define NX_PACKET_TCP_LISTEN_QUEUE "TCP listen queue" -#define NX_PACKET_TCP_RECEIVE_QUEUE "TCP receive queue" -#define NX_PACKET_UDP_RECEIVE_QUEUE "UDP receive queue" -#define NX_PACKET_IP_FRAGMENT_QUEUE "IP fragment queue" -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - - -/* Define packet pool management function prototypes. */ - -UINT _nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT _nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied); -UINT _nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT _nx_packet_data_adjust(NX_PACKET *packet_ptr, ULONG header_size); -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -UINT _nx_packet_debug_info_get(NX_PACKET_POOL *pool_ptr, UINT packet_index, NX_PACKET **packet_pptr, - ULONG *packet_status, CHAR **thread_info, CHAR **file_info, ULONG *line); -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ -UINT _nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size); -UINT _nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT _nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT _nx_packet_release(NX_PACKET *packet_ptr); -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr); -VOID _nx_packet_pool_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_packet_pool_initialize(VOID); -UINT _nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT _nxe_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nxe_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nxe_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied); -UINT _nxe_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT _nxe_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size, UINT pool_control_block_size); -UINT _nxe_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT _nxe_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark); - - -/* Packet pool management component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_PACKET_POOL_INIT -#define PACKET_POOL_DECLARE -#else -#define PACKET_POOL_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the head pointer of the created packet pool list. */ - -PACKET_POOL_DECLARE NX_PACKET_POOL *_nx_packet_pool_created_ptr; - - -/* Define the variable that holds the number of created packet pools. */ - -PACKET_POOL_DECLARE ULONG _nx_packet_pool_created_count; - - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_allocate.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_allocate.c deleted file mode 100644 index e8614f56..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_allocate.c +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_allocate PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function allocates a packet from the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to allocate packet from */ -/* packet_ptr Pointer to place allocated */ -/* packet pointer */ -/* packet_type Type of packet to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option) -{ -TX_INTERRUPT_SAVE_AREA - -UINT status; /* Return status */ -TX_THREAD *thread_ptr; /* Working thread pointer */ -NX_PACKET *work_ptr; /* Working packet pointer */ - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - /* Make sure the packet_type does not go beyond nx_packet_data_end. */ - if (pool_ptr -> nx_packet_pool_payload_size < packet_type) - { - return(NX_INVALID_PARAMETERS); - } - - /* Set the return pointer to NULL initially. */ - *packet_ptr = NX_NULL; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_ALLOCATE, pool_ptr, 0, packet_type, pool_ptr -> nx_packet_pool_available, NX_TRACE_PACKET_EVENTS, &trace_event, &trace_timestamp); - - /* Disable interrupts to get a packet from the pool. */ - TX_DISABLE - - /* Determine if there is an available packet. */ - if (pool_ptr -> nx_packet_pool_available) - { - - /* Yes, a packet is available. Decrement the available count. */ - pool_ptr -> nx_packet_pool_available--; - - /* Pickup the current packet pointer. */ - work_ptr = pool_ptr -> nx_packet_pool_available_list; - - /* Modify the available list to point at the next packet in the pool. */ - pool_ptr -> nx_packet_pool_available_list = work_ptr -> nx_packet_queue_next; - - /* Setup various fields for this packet. */ - work_ptr -> nx_packet_queue_next = NX_NULL; -#ifndef NX_DISABLE_PACKET_CHAIN - work_ptr -> nx_packet_next = NX_NULL; - work_ptr -> nx_packet_last = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - work_ptr -> nx_packet_length = 0; - work_ptr -> nx_packet_prepend_ptr = work_ptr -> nx_packet_data_start + packet_type; - work_ptr -> nx_packet_append_ptr = work_ptr -> nx_packet_prepend_ptr; - work_ptr -> nx_packet_address.nx_packet_interface_ptr = NX_NULL; -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - work_ptr -> nx_packet_interface_capability_flag = 0; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - /* Set the TCP queue to the value that indicates it has been allocated. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - work_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_ALLOCATED; - -#ifdef FEATURE_NX_IPV6 - - /* Clear the option state. */ - work_ptr -> nx_packet_option_state = 0; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - - /* Clear the ipsec state. */ - work_ptr -> nx_packet_ipsec_state = 0; - work_ptr -> nx_packet_ipsec_sa_ptr = NX_NULL; -#endif /* NX_IPSEC_ENABLE */ - -#ifndef NX_DISABLE_IPV4 - /* Initialize the IP version field */ - work_ptr -> nx_packet_ip_version = NX_IP_VERSION_V4; -#endif /* !NX_DISABLE_IPV4 */ - - /* Initialize the IP identification flag. */ - work_ptr -> nx_packet_identical_copy = NX_FALSE; - - /* Initialize the IP header length. */ - work_ptr -> nx_packet_ip_header_length = 0; - -#ifdef NX_ENABLE_THREAD - work_ptr -> nx_packet_type = 0; -#endif /* NX_ENABLE_THREAD */ - - /* Place the new packet pointer in the return destination. */ - *packet_ptr = work_ptr; - - /* Set status to success. */ - status = NX_SUCCESS; - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - } - else - { - -#ifndef NX_DISABLE_PACKET_INFO - /* Increment the packet pool empty request count. */ - pool_ptr -> nx_packet_pool_empty_requests++; -#endif - - /* Determine if the request specifies suspension. */ - if (wait_option) - { - - /* Prepare for suspension of this thread. */ - -#ifndef NX_DISABLE_PACKET_INFO - /* Increment the packet pool empty request suspension count. */ - pool_ptr -> nx_packet_pool_empty_suspensions++; -#endif - - /* Pickup thread pointer. */ - thread_ptr = _tx_thread_current_ptr; - - /* Setup cleanup routine pointer. */ - thread_ptr -> tx_thread_suspend_cleanup = _nx_packet_pool_cleanup; - - /* Setup cleanup information, i.e. this pool control - block. */ - thread_ptr -> tx_thread_suspend_control_block = (void *)pool_ptr; - - /* Save the return packet pointer address as well. */ - thread_ptr -> tx_thread_additional_suspend_info = (void *)packet_ptr; - - /* Save the packet type (or prepend offset) so this can be added - after a new packet becomes available. */ - thread_ptr -> tx_thread_suspend_info = packet_type; - - /* Setup suspension list. */ - if (pool_ptr -> nx_packet_pool_suspension_list) - { - - /* This list is not NULL, add current thread to the end. */ - thread_ptr -> tx_thread_suspended_next = - pool_ptr -> nx_packet_pool_suspension_list; - thread_ptr -> tx_thread_suspended_previous = - (pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous; - ((pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr; - (pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous = thread_ptr; - } - else - { - - /* No other threads are suspended. Setup the head pointer and - just setup this threads pointers to itself. */ - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr; - thread_ptr -> tx_thread_suspended_next = thread_ptr; - thread_ptr -> tx_thread_suspended_previous = thread_ptr; - } - - /* Increment the suspended thread count. */ - pool_ptr -> nx_packet_pool_suspended_count++; - - /* Set the state to suspended. */ - thread_ptr -> tx_thread_state = TX_TCP_IP; - - /* Set the suspending flag. */ - thread_ptr -> tx_thread_suspending = TX_TRUE; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Save the timeout value. */ - thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = wait_option; - - /* Restore interrupts. */ - TX_RESTORE - - /* Call actual thread suspension routine. */ - _tx_thread_system_suspend(thread_ptr); - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_ALLOCATE, 0, *packet_ptr, 0, 0); - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO - if (thread_ptr -> tx_thread_suspend_status == NX_SUCCESS) - { - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, *packet_ptr); - } -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - - /* Return the completion status. */ - return(thread_ptr -> tx_thread_suspend_status); - } - else - { - - /* Immediate return, return error completion. */ - status = NX_NO_PACKET; - } - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_ALLOCATE, 0, *packet_ptr, 0, 0); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_copy.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_copy.c deleted file mode 100644 index f753c91c..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_copy.c +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_copy PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies the specified packet into one or more packets */ -/* allocated from the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to source packet */ -/* new_packet_ptr Pointer for return packet */ -/* pool_ptr Pointer to packet pool to use */ -/* for new packet(s) */ -/* wait_option Timeout option on packet */ -/* allocate and data append */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_SUCCESS Successful completion status */ -/* NX_INVALID_PACKET If zero packet payload or data*/ -/* to copy */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_data_append Packet data append service */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -NX_PACKET *work_ptr; /* Working packet pointer */ -NX_PACKET *source_ptr; /* Source packet pointer */ -ULONG size; /* Packet data size */ -UINT status; /* Return status */ -UINT first_packet; /* First packet flag */ -UINT data_prepend_offset; /* Data prepend offset */ -UINT ip_header_offset; /* IP header offset */ - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* Default the return packet pointer to NULL. */ - *new_packet_ptr = NX_NULL; - - /* Default the first packet to TRUE. */ - first_packet = NX_TRUE; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_COPY, packet_ptr, 0, pool_ptr, wait_option, NX_TRACE_PACKET_EVENTS, &trace_event, &trace_timestamp); - - /* Determine if there is anything to copy. */ - if (packet_ptr -> nx_packet_length == 0) - { - - /* Empty source packet, return an error. */ - return(NX_INVALID_PACKET); - } - - /* Allocate a new packet from the default packet pool supplied. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - status = _nx_packet_allocate(pool_ptr, &work_ptr, 0, wait_option); - - /* Determine if the packet was not allocated. */ - if (status != NX_SUCCESS) - { - - /* Return the error code from the packet allocate routine. */ - return(status); - } - - /* Copy the packet interface information. */ - /*lint -e{644} suppress variable might not be initialized, since "work_ptr" was initialized by _nx_packet_allocate. */ - work_ptr -> nx_packet_address.nx_packet_interface_ptr = packet_ptr -> nx_packet_address.nx_packet_interface_ptr; - -#ifdef FEATURE_NX_IPV6 - - /* Copy the IP version information. */ - work_ptr -> nx_packet_ip_version = packet_ptr -> nx_packet_ip_version; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - - /* Copy the packet interface capability. */ - work_ptr -> nx_packet_interface_capability_flag = packet_ptr -> nx_packet_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifdef NX_IPSEC_ENABLE - work_ptr -> nx_packet_ipsec_sa_ptr = packet_ptr -> nx_packet_ipsec_sa_ptr; -#endif /* NX_IPSEC_ENABLE */ - - /* Save the source packet pointer. */ - source_ptr = packet_ptr; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy the original packet's data. */ - do - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check if it is the first packet. */ - if (first_packet == NX_TRUE) - { - - /* Yes, it is, copied the data beginning at data starting position. */ - - /* Calculate this packet's data size. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - size = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_data_start); - - /* Copy the data from the source packet into the new packet using - the data append feature. */ - status = _nx_packet_data_append(work_ptr, packet_ptr -> nx_packet_data_start, size, pool_ptr, wait_option); - } - else - { - - /* Calculate this packet's data size. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - size = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); - - /* Copy the data from the source packet into the new packet using - the data append feature. */ - status = _nx_packet_data_append(work_ptr, packet_ptr -> nx_packet_prepend_ptr, size, pool_ptr, wait_option); - } - - /* Determine if there was an error in the data append. */ - if (status != NX_SUCCESS) - { - - /* An error is present, release the new packet. */ - _nx_packet_release(work_ptr); - - /* Return the error code from the packet data append service. */ - return(status); - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to the next packet in the packet chain. */ - packet_ptr = packet_ptr -> nx_packet_next; - - /* Set the first packet to FALSE. */ - first_packet = NX_FALSE; - } while (packet_ptr); -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Adjust the prepend pointer and data length. */ - /*lint --e{946} --e{947} --e{732} suppress pointer subtraction, since it is necessary. */ - data_prepend_offset = (UINT)(source_ptr -> nx_packet_prepend_ptr - source_ptr -> nx_packet_data_start); - work_ptr -> nx_packet_prepend_ptr = work_ptr -> nx_packet_data_start + data_prepend_offset; - work_ptr -> nx_packet_length = work_ptr -> nx_packet_length - data_prepend_offset; - - /* Set the ip_header information. */ - ip_header_offset = (UINT)(source_ptr -> nx_packet_ip_header - source_ptr -> nx_packet_data_start); - work_ptr -> nx_packet_ip_header = work_ptr -> nx_packet_data_start + ip_header_offset; - - /* Determine if the packet copy was successful. */ - if (source_ptr -> nx_packet_length != work_ptr -> nx_packet_length) - { - - /* An error is present, release the new packet. */ - _nx_packet_release(work_ptr); - - /* Return an error code. */ - return(NX_INVALID_PACKET); - } - else - { - - /* Everything is okay, return the new packet pointer. */ - *new_packet_ptr = work_ptr; - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_COPY, 0, work_ptr, 0, 0); - - /* Return success status. */ - return(NX_SUCCESS); - } -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_adjust.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_adjust.c deleted file mode 100644 index 55d44968..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_adjust.c +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_adjust PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function adjusts the packet data to fill the specified header. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* header_size The size of header */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_data_append Packet data append service */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_ip_forward_packet_process Forward IP packet */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_adjust(NX_PACKET *packet_ptr, ULONG header_size) -{ - -ULONG available_size; -ULONG shift_size; -#ifndef NX_DISABLE_PACKET_CHAIN -UINT status; -ULONG append_size; -UCHAR *data_start; -NX_PACKET *work_ptr; -#endif /* !NX_DISABLE_PACKET_CHAIN */ - - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* The header must be filled in one packet. */ - if (((ALIGN_TYPE)packet_ptr -> nx_packet_data_end - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) < header_size) - { - return(NX_UNDERFLOW); - } - - /* 1. Check if there is enough space to add header. */ - if (((ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) >= header_size) - { - - /* Yes. Just return success. */ - return(NX_SUCCESS); - } - - /* Compute the total avilable size in this packet. */ - available_size = (ULONG)(((ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) + - ((ALIGN_TYPE)packet_ptr -> nx_packet_data_end - (ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr)); - - /* 2. Would the header fit into the available space? */ - if (available_size >= header_size) - { - - /* Yes, adjust the data. */ - - /* Calculate the shift data size. */ - shift_size = (ULONG)((ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr); - - /* Move the data, */ - memmove(packet_ptr -> nx_packet_data_start + header_size, packet_ptr -> nx_packet_prepend_ptr, shift_size); /* Use case of memmove is verified. */ - - /* Update the prepend and append pointer. */ - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + header_size; - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + shift_size; - } - else - { - -#ifndef NX_DISABLE_PACKET_CHAIN - - /* 3. Current packet does not have enough space to fill the header. - Allocate a new packet to fill the overflowing data and chain the packet. */ - - /* Odd value of header_size is not supported now. - * In _nx_ip_checksum_compute(), nx_packet_append_ptr must not be odd value. */ - if (header_size & 1) - { - return(NX_NOT_SUPPORTED); - } - - /* Calculate the append data size. */ - append_size = header_size - available_size; - - /* Set the append data pointer. */ - data_start = packet_ptr -> nx_packet_append_ptr - append_size; - - /* Allocate a packet. */ - status = _nx_packet_allocate(packet_ptr -> nx_packet_pool_owner, &work_ptr, 0, NX_NO_WAIT); - - /* Check status. */ - if (status) - { - return(status); - } - - /* Firstly, append the overflowing data to the new packet.. */ - memcpy(work_ptr -> nx_packet_prepend_ptr, data_start, append_size); /* Use case of memcpy is verified. */ - work_ptr -> nx_packet_append_ptr = (UCHAR *)((ALIGN_TYPE)work_ptr -> nx_packet_prepend_ptr + append_size); /* Use case of memcpy is verified. */ - - /* Secondly, calculate the shift data size. */ - shift_size = (ULONG)(((ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr) - append_size); - - /* Move the data. */ - memmove(packet_ptr -> nx_packet_data_start + header_size, packet_ptr -> nx_packet_prepend_ptr, shift_size); /* Use case of memmove is verified. */ - - /* Update the prepend and append pointer. */ - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + header_size; - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + shift_size; - - /* At this point, all the necessary packets have been allocated. - We need to link this new packet to the next of the supplied packet. */ - work_ptr -> nx_packet_next = packet_ptr -> nx_packet_next; - packet_ptr -> nx_packet_next = work_ptr; - - /* Update the last packet pointer. */ - if (packet_ptr -> nx_packet_last == NX_NULL) - { - packet_ptr -> nx_packet_last = work_ptr; - } -#else /* NX_DISABLE_PACKET_CHAIN */ - - /* Return error code. */ - return(NX_UNDERFLOW); -#endif /* !NX_DISABLE_PACKET_CHAIN */ - } - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_append.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_append.c deleted file mode 100644 index 4ac42f42..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_append.c +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_append PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies the specified data to the end of the specified */ -/* packet. Additional packets are allocated from the specified pool */ -/* if needed. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to packet to append to*/ -/* data_start Pointer to start of the data */ -/* data_size Number of bytes to append */ -/* pool_ptr Pool to allocate packet from */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -#ifndef NX_DISABLE_PACKET_CHAIN -UINT status; /* Return status */ -NX_PACKET *new_list_ptr; /* Head of new list pointer */ -NX_PACKET *last_packet = NX_NULL; /* Last supplied packet */ -#endif /* NX_DISABLE_PACKET_CHAIN */ -ULONG available_bytes; /* Number of available bytes */ -ULONG copy_size; /* Size for each memory copy */ -UCHAR *source_ptr; /* Buffer source pointer */ -NX_PACKET *work_ptr; /* Working packet pointer */ - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_APPEND, packet_ptr, data_start, data_size, pool_ptr, NX_TRACE_PACKET_EVENTS, 0, 0); - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Calculate the number of bytes available at the end of the supplied packet. */ - if (packet_ptr -> nx_packet_last) - { - - /* More than one packet. Walk the packet chain starting at the last packet - to calculate the remaining bytes. */ - available_bytes = 0; - work_ptr = packet_ptr -> nx_packet_last; - do - { - - /* Calculate the available bytes in this packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - /*lint -e{737} suppress loss of sign, since nx_packet_data_end is assumed to be larger than nx_packet_append_ptr. */ - available_bytes = available_bytes + - (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - - /* Remember the last packet. */ - last_packet = work_ptr; - - /* Move to the next packet. There typically won't be another packet, but just in - case the logic is here for it! */ - work_ptr = work_ptr -> nx_packet_next; - } while (work_ptr); - } - else -#endif /* NX_DISABLE_PACKET_CHAIN */ - { - - /* Just calculate the number of bytes available in the first packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - available_bytes = (ULONG)(packet_ptr -> nx_packet_data_end - packet_ptr -> nx_packet_append_ptr); - } - - /* Determine if any new packets are required to satisfy this request. */ - if (available_bytes < data_size) - { - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Setup a temporary head pointer. */ - new_list_ptr = NX_NULL; - - /* Loop to pickup enough packets to complete the append request. */ - while (available_bytes < data_size) - { - - /* Allocate a new packet. */ - status = _nx_packet_allocate(pool_ptr, &work_ptr, 0, wait_option); - - /* Determine if an error is present. */ - if (status) - { - - /* Yes, an error is present. */ - - /* First release any packets that have been allocated so far. */ - if (new_list_ptr) - { - _nx_packet_release(new_list_ptr); - } - - /* Return the error status to the caller of this service. */ - return(status); - } - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - - /* No error is present. Link the new packet to the temporary list being built. */ - if (new_list_ptr) - { - - /* Determine if there is already more than one packet on the list. */ - if (new_list_ptr -> nx_packet_last) - { - - /* Yes, link up the last packet to the new packet and update the - last pointer. */ - /*lint -e{644} suppress variable might not be initialized, since "work_ptr" was initialized in _nx_packet_allocate. */ - (new_list_ptr -> nx_packet_last) -> nx_packet_next = work_ptr; - new_list_ptr -> nx_packet_last = work_ptr; - } - else - { - - /* Second packet allocated. Just setup the last and next in the - head pointer. */ - new_list_ptr -> nx_packet_last = work_ptr; - new_list_ptr -> nx_packet_next = work_ptr; - } - } - else - { - - /* Just setup the temporary list head. */ - new_list_ptr = work_ptr; - } - - /* Adjust the number of available bytes according to how much space - is in the new packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - /*lint -e{737} suppress loss of sign, since nx_packet_data_end is assumed to be larger than nx_packet_append_ptr. */ - /*lint -e{613} suppress possible use of null pointer, since "work_ptr" was set in _nx_packet_allocate. */ - available_bytes = available_bytes + - (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - } - - /* At this point, all the necessary packets have been allocated and are present - on the temporary list. We need to link this new list to the end of the supplied - packet. */ - if (last_packet) - { - - /* Already more than one packet. Add the new packet list to the end. */ - last_packet -> nx_packet_next = new_list_ptr; - } - else - { - - /* Link the new packet list to the head packet. */ - packet_ptr -> nx_packet_next = new_list_ptr; - } - - /* Clear the last packet that was used to maintain the new list. */ - /*lint -e{613} suppress possible use of null pointer, since "new_list_ptr" was set in previous loop. */ - new_list_ptr -> nx_packet_last = NX_NULL; -#else - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_SIZE_ERROR); -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Setup the new data length in the packet. */ - packet_ptr -> nx_packet_length = packet_ptr -> nx_packet_length + data_size; - - /* Now copy the supplied data buffer at the end of the packet. */ - source_ptr = (UCHAR *)data_start; -#ifndef NX_DISABLE_PACKET_CHAIN - if (packet_ptr -> nx_packet_last) - { - work_ptr = packet_ptr -> nx_packet_last; - } - else - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - work_ptr = packet_ptr; -#ifndef NX_DISABLE_PACKET_CHAIN - } - while (data_size) - { - - /* Determine the amount of memory to copy. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if (data_size < (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr)) - { - copy_size = data_size; - } - else - { - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - copy_size = (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - } -#else - copy_size = data_size; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Copy the data into the current packet buffer. */ - memcpy(work_ptr -> nx_packet_append_ptr, source_ptr, copy_size); /* Use case of memcpy is verified. */ - - /* Adjust the remaining data size. */ - data_size = data_size - copy_size; - - /* Update this packets append pointer. */ - work_ptr -> nx_packet_append_ptr = work_ptr -> nx_packet_append_ptr + copy_size; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Any more data left to append? */ - if (data_size) - { - - /* Yes, there is more to move. Update the source pointer, move the work pointer - to the next packet in the chain and update the last packet pointer. */ - source_ptr = source_ptr + copy_size; - work_ptr = work_ptr -> nx_packet_next; - packet_ptr -> nx_packet_last = work_ptr; - } - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Return successful status. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_extract_offset.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_extract_offset.c deleted file mode 100644 index 26e0d54a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_extract_offset.c +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_extract_offset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies data from a NetX packet (or packet chain) into */ -/* the supplied user buffer. If an empty packet (no data) is */ -/* received, zero bytes are copied, and the function returns without */ -/* errors. */ -/* */ -/* Note that this function extracts data from a packet into user */ -/* supplied buffer. It does not modify packet internal state */ -/* information. The data being extracted is still available in the */ -/* original packet for consumption again. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* offset Offset from start of data */ -/* buffer_start Pointer to destination data area */ -/* buffer_length Size in bytes */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied) -{ - -ULONG remaining_bytes; -UCHAR *source_ptr; -UCHAR *destination_ptr; -ULONG offset_bytes; -#ifndef NX_DISABLE_PACKET_CHAIN -ULONG packet_fragment_length; -#endif /* NX_DISABLE_PACKET_CHAIN */ -ULONG bytes_to_copy; -NX_PACKET *working_packet_ptr; - - - working_packet_ptr = packet_ptr; - - /* Check for an invalid offset or packet length. */ - if (offset >= working_packet_ptr -> nx_packet_length) - { - - /* Note: A zero offset with a packet of zero length is ok. */ - if (offset == 0) - { - - *bytes_copied = 0; - return(NX_SUCCESS); - } - - /* Otherwise, this is an invalid offset or packet length. */ - return(NX_PACKET_OFFSET_ERROR); - } - - - /* Initialize the source pointer to NULL. */ - source_ptr = NX_NULL; - - /* Traverse packet chain to offset. */ - offset_bytes = offset; -#ifndef NX_DISABLE_PACKET_CHAIN - while (working_packet_ptr) - { - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - packet_fragment_length = (ULONG)((working_packet_ptr -> nx_packet_append_ptr - working_packet_ptr -> nx_packet_prepend_ptr)); - - /* Determine if we are at the offset location fragment in the packet chain */ - if (packet_fragment_length > offset_bytes) - { - - /* Setup loop to copy from this packet. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr + offset_bytes; - - /* Yes, get out of this loop. */ - break; - } - - - /* Decrement the remaining offset bytes*/ - offset_bytes = offset_bytes - packet_fragment_length; - - /* Move to next packet. */ - working_packet_ptr = working_packet_ptr -> nx_packet_next; - } -#else /* NX_DISABLE_PACKET_CHAIN */ - /* Setup loop to copy from this packet. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr + offset_bytes; - -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check for a valid source pointer. */ - if (source_ptr == NX_NULL) - { - return(NX_PACKET_OFFSET_ERROR); - } - - /* Setup the destination pointer. */ - destination_ptr = buffer_start; - bytes_to_copy = (packet_ptr -> nx_packet_length - offset); - - /* Pickup the amount of bytes to copy. */ - if (bytes_to_copy < buffer_length) - { - *bytes_copied = bytes_to_copy; /* the amount of bytes returned to the caller */ - remaining_bytes = bytes_to_copy; /* for use in the copy loop */ - } - else - { - *bytes_copied = buffer_length; - remaining_bytes = buffer_length; - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy bytes from packet(s). */ - while (working_packet_ptr && remaining_bytes) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Calculate bytes to copy. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - bytes_to_copy = (ULONG)(working_packet_ptr -> nx_packet_append_ptr - source_ptr); - if (remaining_bytes < bytes_to_copy) - { - bytes_to_copy = remaining_bytes; - } - - /* Copy data from this packet. */ - memcpy(destination_ptr, source_ptr, bytes_to_copy); /* Use case of memcpy is verified. */ - - /* Update the pointers. */ - destination_ptr += bytes_to_copy; - remaining_bytes -= bytes_to_copy; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to next packet. */ - working_packet_ptr = working_packet_ptr -> nx_packet_next; - - /* Check for a next packet. */ - if (working_packet_ptr) - { - - /* Setup new source pointer. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr; - } - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_EXTRACT_OFFSET, packet_ptr, buffer_length, *bytes_copied, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_retrieve.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_retrieve.c deleted file mode 100644 index 2647b0ba..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_data_retrieve.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_retrieve PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies data from a NetX packet (or packet chain) into */ -/* the supplied user buffer. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* buffer_start Pointer to destination area */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied) -{ - -ULONG remaining_bytes; -UCHAR *destination_ptr; -ULONG bytes_to_copy; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_RETRIEVE, packet_ptr, buffer_start, bytes_copied, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Setup the destination pointer. */ - destination_ptr = buffer_start; - - /* Pickup the amount of bytes to copy. */ - *bytes_copied = packet_ptr -> nx_packet_length; - - /* Setup the remaining bytes. */ - remaining_bytes = packet_ptr -> nx_packet_length; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy bytes from packet(s). */ - while (packet_ptr) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Calculate the bytes to copy in this packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - bytes_to_copy = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); - - /* Copy data to destination. */ - /* Note: The buffer size must be not less than packet_ptr -> nx_packet_length. */ - memcpy(destination_ptr, packet_ptr -> nx_packet_prepend_ptr, bytes_to_copy); /* Use case of memcpy is verified. The buffer is provided by user. */ - - remaining_bytes -= bytes_to_copy; - destination_ptr += bytes_to_copy; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to next packet. */ - packet_ptr = packet_ptr -> nx_packet_next; - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Determine if the packet chain was valid. */ - if (remaining_bytes) - { - - /* Invalid packet chain. Calculate the actual number of bytes - copied. */ - *bytes_copied = *bytes_copied - remaining_bytes; - - /* Return an error. */ - return(NX_INVALID_PACKET); - } - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_debug_info_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_debug_info_get.c deleted file mode 100644 index 83d5b74e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_debug_info_get.c +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_debug_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function returns status of packet for specified index */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to packet pool */ -/* packet_index Index of packet in pool */ -/* packet_pptr Pointer to packet for output */ -/* packet_status Status of packet for output */ -/* thread_info Thread of packet for output */ -/* file_info File of packet for output */ -/* line Line of packet for output */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_debug_info_get(NX_PACKET_POOL *pool_ptr, UINT packet_index, NX_PACKET **packet_pptr, - ULONG *packet_status, CHAR **thread_info, CHAR **file_info, ULONG *line) -{ -ULONG payload_size; /* Rounded payload size */ -ULONG header_size; /* Rounded header size */ -NX_PACKET *packet_ptr; - - /* Get the first packet. */ - packet_ptr = (NX_PACKET *)(pool_ptr -> nx_packet_pool_start); - - /* Calculate header size. */ - header_size = (ULONG)((ALIGN_TYPE)(packet_ptr -> nx_packet_data_start) - (ALIGN_TYPE)packet_ptr); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - payload_size = (ULONG)(((pool_ptr -> nx_packet_pool_payload_size + header_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Calculate packet pointer. */ - packet_ptr = (NX_PACKET *)(pool_ptr -> nx_packet_pool_start + packet_index * (header_size + payload_size)); - - /* Get packet pointer. */ - if (packet_pptr) - { - *packet_pptr = packet_ptr; - } - - /* Get packet status. */ - if (packet_status) - { - *packet_status = (ULONG)(ALIGN_TYPE)packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next; - } - - /* Get thread info. */ - if (thread_info) - { - *thread_info = packet_ptr -> nx_packet_debug_thread; - } - - /* Get file info. */ - if (file_info) - { - *file_info = packet_ptr -> nx_packet_debug_file; - } - - /* Get line. */ - if (line) - { - *line = packet_ptr -> nx_packet_debug_line; - } - - /* Return success. */ - return(NX_SUCCESS); -} -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_length_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_length_get.c deleted file mode 100644 index d2037636..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_length_get.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_length_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function returns the length of the supplied packet. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet */ -/* length Destination for the length */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length) -{ - - /* Return the length of the packet. */ - *length = packet_ptr -> nx_packet_length; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_LENGTH_GET, packet_ptr, *length, 0, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_cleanup.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_cleanup.c deleted file mode 100644 index 9a24e630..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_cleanup.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_cleanup PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function processes packet allocate timeout and thread terminate*/ -/* actions that require the packet pool data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_packet_pool_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *pool_ptr; /* Working packet pool pointer */ - - NX_CLEANUP_EXTENSION - - /* Setup pointer to packet pool control block. */ - pool_ptr = (NX_PACKET_POOL *)thread_ptr -> tx_thread_suspend_control_block; - - /* Disable interrupts to remove the suspended thread from the packet pool. */ - TX_DISABLE - - /* Determine if the cleanup is still required. */ - if ((thread_ptr -> tx_thread_suspend_cleanup) && (pool_ptr) && - (pool_ptr -> nx_packet_pool_id == NX_PACKET_POOL_ID)) - { - - /* Yes, we still have thread suspension! */ - - /* Clear the suspension cleanup flag. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Remove the suspended thread from the list. */ - - /* See if this is the only suspended thread on the list. */ - if (thread_ptr == thread_ptr -> tx_thread_suspended_next) - { - - /* Yes, the only suspended thread. */ - - /* Update the head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = TX_NULL; - } - else - { - - /* At least one more thread is on the same suspension list. */ - - /* Update the list head pointer if necessary. */ - if (pool_ptr -> nx_packet_pool_suspension_list == thread_ptr) - { - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr -> tx_thread_suspended_next; - } - - /* Update the links of the adjacent threads. */ - (thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous = - thread_ptr -> tx_thread_suspended_previous; - (thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr -> tx_thread_suspended_next; - } - - /* Decrement the suspension count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - - /* Now we need to determine if this cleanup is from a terminate, timeout, - or from a wait abort. */ - if (thread_ptr -> tx_thread_state == TX_TCP_IP) - { - - /* Thread still suspended on the packet pool. Setup return error status and - resume the thread. */ - - /* Setup return status. */ - thread_ptr -> tx_thread_suspend_status = NX_NO_PACKET; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Resume the thread! Check for preemption even though we are executing - from the system timer thread right now which normally executes at the - highest priority. */ - _tx_thread_system_resume(thread_ptr); - - /* Finished, just return. */ - return; - } - } - - /* Restore interrupts. */ - TX_RESTORE -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_create.c deleted file mode 100644 index c3280927..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_create.c +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a pool of fixed-size packets within the */ -/* specified memory area. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* name_ptr Packet Pool string pointer */ -/* payload_size Size of packet payload */ -/* pool_start Starting address of pool */ -/* pool_size Number of bytes in pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name_ptr, ULONG payload_size, - VOID *pool_start, ULONG pool_size) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *tail_ptr; /* Working packet pool pointer */ -ULONG packets; /* Number of packets in pool */ -ULONG original_payload_size; /* Original payload size */ -ULONG header_size; /* Rounded header size */ -CHAR *packet_ptr; /* Working packet pointer */ -CHAR *next_packet_ptr; /* Next packet pointer */ -CHAR *end_of_pool; /* End of pool area */ -CHAR *payload_address; /* Address of the first payload*/ -VOID *rounded_pool_start; /* Rounded stating address */ - - - /* Save the original payload size. */ - original_payload_size = payload_size; - - /* Align the starting address to four bytes. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_start = (VOID *)((((ALIGN_TYPE)pool_start + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Round the pool size down to something that is evenly divisible by alignment. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - pool_size = (ULONG)(((pool_size - ((ALIGN_TYPE)rounded_pool_start - (ALIGN_TYPE)pool_start)) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Set the pool starting address. */ - pool_start = rounded_pool_start; - - /* Calculate the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((ALIGN_TYPE)rounded_pool_start + sizeof(NX_PACKET)); - - /* Align the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((((ALIGN_TYPE)payload_address + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the header size. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - header_size = (ULONG)((ALIGN_TYPE)payload_address - (ALIGN_TYPE)rounded_pool_start); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - payload_size = (ULONG)(((header_size + payload_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Clear pool fields. */ - memset(pool_ptr, 0, sizeof(NX_PACKET_POOL)); - - /* Setup the basic packet pool fields. */ - pool_ptr -> nx_packet_pool_name = name_ptr; - pool_ptr -> nx_packet_pool_suspension_list = TX_NULL; - pool_ptr -> nx_packet_pool_suspended_count = 0; - pool_ptr -> nx_packet_pool_start = (CHAR *)pool_start; - pool_ptr -> nx_packet_pool_size = pool_size; - pool_ptr -> nx_packet_pool_payload_size = original_payload_size; - - /* Calculate the end of the pool's memory area. */ - end_of_pool = ((CHAR *)pool_start) + pool_size; - - /* Walk through the pool area, setting up the available packet list. */ - packets = 0; - packet_ptr = (CHAR *)rounded_pool_start; - next_packet_ptr = packet_ptr + (payload_size + header_size); - - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - while (next_packet_ptr <= end_of_pool) - { - - /* Yes, we have another packet. Increment the packet count. */ - packets++; - - /* Setup the link to the next packet. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_queue_next = (NX_PACKET *)next_packet_ptr; - - /* Remember that this packet pool is the owner. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_pool_owner = pool_ptr; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Clear the next packet pointer. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_next = (NX_PACKET *)NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Mark the packet as free. */ - /*lint -e{929} -e{923} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_FREE; - - /* Setup the packet data pointers. */ - /*lint -e{929} -e{928} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_data_start = (UCHAR *)(packet_ptr + header_size); - - /*lint -e{929} -e{928} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_data_end = (UCHAR *)(packet_ptr + header_size + original_payload_size); - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, (NX_PACKET *)packet_ptr); - - /* Advance to the next packet. */ - packet_ptr = next_packet_ptr; - - /* Update the next packet pointer. */ - next_packet_ptr = packet_ptr + (payload_size + header_size); - } - - /* Backup to the last packet in the pool. */ - packet_ptr = packet_ptr - (payload_size + header_size); - - /* Set the last packet's forward pointer to NULL. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_queue_next = NX_NULL; - - /* Save the remaining information in the pool control packet. */ - pool_ptr -> nx_packet_pool_available = packets; - pool_ptr -> nx_packet_pool_total = packets; - - /* Set the packet pool available list. */ - pool_ptr -> nx_packet_pool_available_list = (NX_PACKET *)pool_start; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_PACKET_POOL, pool_ptr, name_ptr, payload_size, packets); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_CREATE, pool_ptr, payload_size, pool_start, pool_size, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Disable interrupts to place the packet pool on the created list. */ - TX_DISABLE - - /* Setup the packet pool ID to make it valid. */ - pool_ptr -> nx_packet_pool_id = NX_PACKET_POOL_ID; - - /* Place the packet pool on the list of created packet pools. First, - check for an empty list. */ - if (_nx_packet_pool_created_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = _nx_packet_pool_created_ptr -> nx_packet_pool_created_previous; - - /* Place the new packet pool in the list. */ - _nx_packet_pool_created_ptr -> nx_packet_pool_created_previous = pool_ptr; - tail_ptr -> nx_packet_pool_created_next = pool_ptr; - - /* Setup this packet pool's created links. */ - pool_ptr -> nx_packet_pool_created_previous = tail_ptr; - pool_ptr -> nx_packet_pool_created_next = _nx_packet_pool_created_ptr; - } - else - { - - /* The created packet pool list is empty. Add packet pool to empty list. */ - _nx_packet_pool_created_ptr = pool_ptr; - pool_ptr -> nx_packet_pool_created_next = pool_ptr; - pool_ptr -> nx_packet_pool_created_previous = pool_ptr; - } - - /* Increment the number of packet pools created. */ - _nx_packet_pool_created_count++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return NX_SUCCESS. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_delete.c deleted file mode 100644 index b4897d3d..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_delete.c +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet pool control block */ -/* pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume threads suspended */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -TX_THREAD *thread_ptr; /* Working thread pointer */ - - - /* Disable interrupts to remove the packet pool from the created list. */ - TX_DISABLE - - /* Decrement the number of packet pools created. */ - _nx_packet_pool_created_count--; - - /* Clear the packet pool ID to make it invalid. */ - pool_ptr -> nx_packet_pool_id = 0; - - /* See if the packet pool only one on the list. */ - if (pool_ptr == pool_ptr -> nx_packet_pool_created_next) - { - - /* Only created packet pool, just set the created list to NULL. */ - _nx_packet_pool_created_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (pool_ptr -> nx_packet_pool_created_next) -> nx_packet_pool_created_previous = - pool_ptr -> nx_packet_pool_created_previous; - (pool_ptr -> nx_packet_pool_created_previous) -> nx_packet_pool_created_next = - pool_ptr -> nx_packet_pool_created_next; - - /* See if we have to update the created list head pointer. */ - if (_nx_packet_pool_created_ptr == pool_ptr) - { - - /* Yes, move the head pointer to the next link. */ - _nx_packet_pool_created_ptr = pool_ptr -> nx_packet_pool_created_next; - } - } - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Walk through the packet pool suspension list to resume any and all - threads suspended on this packet pool. */ - thread_ptr = pool_ptr -> nx_packet_pool_suspension_list; - while (pool_ptr -> nx_packet_pool_suspended_count) - { - /* Lockout interrupts. */ - TX_DISABLE - - /* Clear the cleanup pointer, this prevents the timeout from doing - anything. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Temporarily disable preemption again. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Set the return status in the thread to NX_POOL_DELETED. */ - thread_ptr -> tx_thread_suspend_status = NX_POOL_DELETED; - - /* Move the thread pointer ahead. */ - thread_ptr = thread_ptr -> tx_thread_suspended_next; - - /* Resume the thread. */ - _tx_thread_system_resume(thread_ptr -> tx_thread_suspended_previous); - - /* Decrease the suspended count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Release previous preempt disable. */ - _tx_thread_preempt_disable--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_DELETE, pool_ptr, 0, 0, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(pool_ptr); - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return NX_SUCCESS. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_info_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_info_get.c deleted file mode 100644 index 2b03e804..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_info_get.c +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function retrieves information about the specified packet */ -/* pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to get information from */ -/* total_packets Destination for total packets */ -/* free_packets Destination for free packets */ -/* empty_pool_requests Destination for empty requests*/ -/* empty_pool_suspensions Destination for empty */ -/* suspensions */ -/* invalid_packet_releases Destination for invalid packet*/ -/* release requests */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases) -{ -TX_INTERRUPT_SAVE_AREA - - - /* Disable interrupts to get packet pool information. */ - TX_DISABLE - - /* Determine if pool total packets is wanted. */ - if (total_packets) - { - - /* Return the number of total packets in this pool. */ - *total_packets = pool_ptr -> nx_packet_pool_total; - } - - /* Determine if pool free packets is wanted. */ - if (free_packets) - { - - /* Return the number of free packets in this pool. */ - *free_packets = pool_ptr -> nx_packet_pool_available; - } - - /* Determine if empty pool requests is wanted. */ - if (empty_pool_requests) - { - - /* Return the number of empty pool requests made in this pool. */ - *empty_pool_requests = pool_ptr -> nx_packet_pool_empty_requests; - } - - /* Determine if empty pool suspensions is wanted. */ - if (empty_pool_suspensions) - { - - /* Return the number of empty pool suspensions made in this pool. */ - *empty_pool_suspensions = pool_ptr -> nx_packet_pool_empty_suspensions; - } - - /* Determine if invalid packet releases is wanted. */ - if (invalid_packet_releases) - { - - /* Return the number of invalid packet releases made in this pool. */ - *invalid_packet_releases = pool_ptr -> nx_packet_pool_invalid_releases; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_INFO_GET, pool_ptr, pool_ptr -> nx_packet_pool_total, pool_ptr -> nx_packet_pool_available, pool_ptr -> nx_packet_pool_empty_requests, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_initialize.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_initialize.c deleted file mode 100644 index b7bda185..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_initialize.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX global Packet Pool Component data in this file. */ - -#define NX_PACKET_POOL_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the packet pool management component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_packet_pool_initialize(VOID) -{ - - /* Initialize the head pointer of the created packet pools list and the - number of packet pools created. */ - _nx_packet_pool_created_ptr = NX_NULL; - _nx_packet_pool_created_count = 0; -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_low_watermark_set.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_low_watermark_set.c deleted file mode 100644 index 7a69f64a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_pool_low_watermark_set.c +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_low_watermark_set PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the low watermark for the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to packet pool */ -/* low_watermark Low watermark of packet pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark) -{ -#ifdef NX_ENABLE_LOW_WATERMARK - -TX_INTERRUPT_SAVE_AREA - - /* Disable interrupts to get a packet from the pool. */ - TX_DISABLE - - /* Set low watermark to packet pool. */ - pool_ptr -> nx_packet_pool_low_watermark = low_watermark; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return completion status. */ - return(NX_SUCCESS); - -#else /* !NX_ENABLE_LOW_WATERMARK */ - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(low_watermark); - - return(NX_NOT_SUPPORTED); - -#endif /* NX_ENABLE_LOW_WATERMARK */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_release.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_release.c deleted file mode 100644 index fc1323d2..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_release.c +++ /dev/null @@ -1,256 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function releases the packet chain back to the appropriate */ -/* packet pools. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume suspended thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_release(NX_PACKET *packet_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *pool_ptr; /* Pool pointer */ -TX_THREAD *thread_ptr; /* Working thread pointer */ -#ifndef NX_DISABLE_PACKET_CHAIN -NX_PACKET *next_packet; /* Working block pointer */ -#endif /* NX_DISABLE_PACKET_CHAIN */ - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_RELEASE, packet_ptr, packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next, (packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_available, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to free all packets chained together, not assuming they are - from the same pool. */ - while (packet_ptr) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check to see if the packet is releasable. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED)) - { - -#ifndef NX_DISABLE_PACKET_INFO - /* Pickup the pool pointer. */ - pool_ptr = packet_ptr -> nx_packet_pool_owner; - - /* Check for a good pool pointer... error must be the packet! */ - if ((pool_ptr) && (pool_ptr -> nx_packet_pool_id == NX_PACKET_POOL_ID)) - { - - /* Increment the packet pool invalid release error count. */ - pool_ptr -> nx_packet_pool_invalid_releases++; - } -#endif - - /* Return an error indicating the packet could not be released. */ - return(NX_PTR_ERROR); - } - /* End of packet check. */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Pickup the next packet. */ - next_packet = packet_ptr -> nx_packet_next; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Disable interrupts to put this packet back in the packet pool. */ - TX_DISABLE - - /* Pickup the pool pointer. */ - pool_ptr = packet_ptr -> nx_packet_pool_owner; - - /* Determine if there are any threads suspended on the block pool. */ - thread_ptr = pool_ptr -> nx_packet_pool_suspension_list; - if (thread_ptr) - { - - /* Remove the suspended thread from the list. */ - - /* See if this is the only suspended thread on the list. */ - if (thread_ptr == thread_ptr -> tx_thread_suspended_next) - { - - /* Yes, the only suspended thread. */ - - /* Update the head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = NX_NULL; - } - else - { - - /* At least one more thread is on the same expiration list. */ - - /* Update the list head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr -> tx_thread_suspended_next; - - /* Update the links of the adjacent threads. */ - (thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous = - thread_ptr -> tx_thread_suspended_previous; - (thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr -> tx_thread_suspended_next; - } - - /* Decrement the suspension count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - - /* Prepare for resumption of the first thread. */ - - /* Clear cleanup routine to avoid timeout. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Adjust this packet to look just like a new packet. */ - packet_ptr -> nx_packet_queue_next = NX_NULL; -#ifndef NX_DISABLE_PACKET_CHAIN - packet_ptr -> nx_packet_next = NX_NULL; - packet_ptr -> nx_packet_last = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - packet_ptr -> nx_packet_length = 0; - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + (thread_ptr -> tx_thread_suspend_info); - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr; - packet_ptr -> nx_packet_address.nx_packet_interface_ptr = NX_NULL; -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - packet_ptr -> nx_packet_interface_capability_flag = 0; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - /* Set the TCP queue to the value that indicates it has been allocated. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_ALLOCATED; - -#ifdef FEATURE_NX_IPV6 - - /* Clear the option state. */ - packet_ptr -> nx_packet_option_state = 0; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - - /* Clear the ipsec state. */ - packet_ptr -> nx_packet_ipsec_state = 0; -#endif /* NX_IPSEC_ENABLE */ - - /* Clear the IP version. */ - packet_ptr -> nx_packet_ip_version = 0; - - /* Clear the IP identification flag. */ - packet_ptr -> nx_packet_identical_copy = NX_FALSE; - - /* Initialize the IP header length. */ - packet_ptr -> nx_packet_ip_header_length = 0; - - /* Return this block pointer to the suspended thread waiting for - a block. */ - *((NX_PACKET **)thread_ptr -> tx_thread_additional_suspend_info) = packet_ptr; - - /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = NX_SUCCESS; - - /* Resume thread. */ - _tx_thread_system_resume(thread_ptr); - } - else - { - - /* No thread is suspended for a memory block. */ - - /* Mark the packet as free. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_FREE; - - /* Put the packet back in the available list. */ - packet_ptr -> nx_packet_queue_next = pool_ptr -> nx_packet_pool_available_list; - - /* Adjust the head pointer. */ - pool_ptr -> nx_packet_pool_available_list = packet_ptr; - - /* Increment the count of available blocks. */ - pool_ptr -> nx_packet_pool_available++; - - /* Restore interrupts. */ - TX_RESTORE - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to the next packet in the list. */ - packet_ptr = next_packet; - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_transmit_release.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_transmit_release.c deleted file mode 100644 index 1bb299eb..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_packet_transmit_release.c +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_transmit_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function releases a transmitted packet chain back to the */ -/* appropriate packet pool. If the packet is a TCP packet, it is */ -/* simply marked as completed. The actual release is deferred to */ -/* the TCP component. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release packet back to pool */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -UINT status; - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_TRANSMIT_RELEASE, packet_ptr, packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next, (packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_available, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Disable interrupts temporarily. */ - TX_DISABLE - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Determine if the packet is a queued TCP data packet. Such packets cannot be released - immediately, since they may need to be resent. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED)) && - (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_FREE))) - { - - /* Yes, this is indeed a TCP packet. Just mark this with the NX_DRIVER_TX_DONE - value to let the TCP layer know it is no longer queued up. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_queue_next = (NX_PACKET *)NX_DRIVER_TX_DONE; - - /* Remove the IP header and adjust the length. */ - packet_ptr -> nx_packet_prepend_ptr += packet_ptr -> nx_packet_ip_header_length; - packet_ptr -> nx_packet_length -= packet_ptr -> nx_packet_ip_header_length; - - /* Reset the IP header length. */ - packet_ptr -> nx_packet_ip_header_length = 0; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return success. */ - status = NX_SUCCESS; - } - else - { - - /* Restore interrupts. */ - TX_RESTORE - - /* Call the actual packet release function. */ - status = _nx_packet_release(packet_ptr); - } - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system.h deleted file mode 100644 index d997e426..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system.h +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** System Management (System) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_system.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX system management component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_SYS_H -#define NX_SYS_H - - - -/* Define system management function prototypes. */ - -VOID _nx_system_initialize(VOID); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -/* System management component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_SYSTEM_INIT -#define SYSTEM_DECLARE -#else -#define SYSTEM_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the global NetX build options variables. These variables contain a bit - map representing how the NetX library was built. The following are the bit - field definitions: - - _nx_system_build_options_1: - - Bit(s) Meaning - - 31 NX_LITTLE_ENDIAN - 30 NX_DISABLE_ARP_AUTO_ENTRY - 29 NX_ENABLE_TCP_KEEPALIVE - 28 NX_TCP_IMMEDIATE_ACK - 27 NX_DRIVER_DEFERRED_PROCESSING - 26 NX_DISABLE_FRAGMENTATION - 25 NX_DISABLE_IP_RX_CHECKSUM - 24 NX_DISABLE_IP_TX_CHECKSUM - 23 NX_DISABLE_TCP_RX_CHECKSUM - 22 NX_DISABLE_TCP_TX_CHECKSUM - 21 NX_DISABLE_RESET_DISCONNECT - 20 NX_DISABLE_RX_SIZE_CHECKING - 19 NX_DISABLE_ARP_INFO - 18 NX_DISABLE_IP_INFO - 17 NX_DISABLE_ICMP_INFO - 16 NX_DISABLE_IGMP_INFO - 15 NX_DISABLE_PACKET_INFO - 14 NX_DISABLE_RARP_INFO - 13 NX_DISABLE_TCP_INFO - 12 NX_DISABLE_UDP_INFO - 3-0 NX_TCP_RETRY_SHIFT - - _nx_system_build_options_2: - - Bit(s) Meaning - - 31-16 NX_IP_PERIODIC_RATE - 15-8 NX_ARP_EXPIRATION_RATE - 7-0 NX_ARP_UPDATE_RATE - - _nx_system_build_options_3: - - Bit(s) Meaning - - 31-24 NX_TCP_ACK_TIMER_RATE - 23-16 NX_TCP_FAST_TIMER_RATE - 15-8 NX_TCP_TRANSMIT_TIMER_RATE - 7-0 NX_TCP_KEEPALIVE_RETRY - - _nx_system_build_options_4: - - Bit(s) Meaning - - 31-16 NX_TCP_KEEPALIVE_INITIAL - 15-8 NX_ARP_MAXIMUM_RETRIES - 7-4 NX_ARP_MAX_QUEUE_DEPTH - 3-0 NX_TCP_KEEPALIVE_RETRIES - - _nx_system_build_options_5: - - Bit(s) Meaning - - 31-24 NX_MAX_MULTICAST_GROUPS - 23-16 NX_MAX_LISTEN_REQUESTS - 15-8 NX_TCP_MAXIMUM_RETRIES - 7-0 NX_TCP_MAXIMUM_TX_QUEUE - - Note that values greater than the value that can be represented in the build options - bit field are represented as all ones in the bit field. For example, if NX_TCP_ACK_TIMER_RATE - is 256, the value in the bits 31-24 of _nx_system_build_options_3 is 0xFF, which is 255 - decimal. */ - -SYSTEM_DECLARE ULONG _nx_system_build_options_1; -SYSTEM_DECLARE ULONG _nx_system_build_options_2; -SYSTEM_DECLARE ULONG _nx_system_build_options_3; -SYSTEM_DECLARE ULONG _nx_system_build_options_4; -SYSTEM_DECLARE ULONG _nx_system_build_options_5; - - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system_initialize.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system_initialize.c deleted file mode 100644 index 8aeb125a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_system_initialize.c +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** System Management (System) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX system data in this file. */ - -#define NX_SYSTEM_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_system.h" -#include "nx_packet.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_tcp.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_system_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the various components and system data */ -/* structures. */ -/* */ -/* INPUT */ -/* */ -/* pool_start Packet pool starting address */ -/* pool_size Packet pool size in bytes */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_initialize Initialize Packet Pool */ -/* component */ -/* _nx_ip_initialize Initialize IP component */ -/* _nx_tcp_initialize Initialize TCP component */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_system_initialize(VOID) -{ - - /* Check whether or not system has been initialized? */ - if (_nx_system_build_options_1 | _nx_system_build_options_2 | - _nx_system_build_options_3 | _nx_system_build_options_4 | _nx_system_build_options_5) - { - - /* Yes it is. Just return. */ - return; - } - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_SYSTEM_INITIALIZE, 0, 0, 0, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Call the packet pool initialization component for NetX. */ - _nx_packet_pool_initialize(); - - /* Call the IP component initialization. */ - _nx_ip_initialize(); - - /* Call the TCP component initialization. */ - /*lint -e{522} suppress lack of side-effects. */ - _nx_tcp_initialize(); - - /* Setup the build options variables. */ - _nx_system_build_options_1 = 0 -#ifdef NX_LITTLE_ENDIAN - | (((ULONG)1) << 31) -#endif -#ifdef NX_DISABLE_ARP_AUTO_ENTRY - | (((ULONG)1) << 30) -#endif -#ifdef NX_ENABLE_TCP_KEEPALIVE - | (((ULONG)1) << 29) -#endif -#ifdef NX_TCP_IMMEDIATE_ACK - | (((ULONG)1) << 28) -#endif -#ifdef NX_DRIVER_DEFERRED_PROCESSING - | (((ULONG)1) << 27) -#endif -#ifdef NX_DISABLE_FRAGMENTATION - | (((ULONG)1) << 26) -#endif -#ifdef NX_DISABLE_IP_RX_CHECKSUM - | (((ULONG)1) << 25) -#endif -#ifdef NX_DISABLE_IP_TX_CHECKSUM - | (((ULONG)1) << 24) -#endif -#ifdef NX_DISABLE_TCP_RX_CHECKSUM - | (((ULONG)1) << 23) -#endif -#ifdef NX_DISABLE_TCP_TX_CHECKSUM - | (((ULONG)1) << 22) -#endif -#ifdef NX_DISABLE_RESET_DISCONNECT - | (((ULONG)1) << 21) -#endif -#ifdef NX_DISABLE_RX_SIZE_CHECKING - | (((ULONG)1) << 20) -#endif -#ifdef NX_DISABLE_ARP_INFO - | (((ULONG)1) << 19) -#endif -#ifdef NX_DISABLE_IP_INFO - | (((ULONG)1) << 18) -#endif -#ifdef NX_DISABLE_ICMP_INFO - | (((ULONG)1) << 17) -#endif -#ifdef NX_DISABLE_IGMP_INFO - | (((ULONG)1) << 16) -#endif -#ifdef NX_DISABLE_PACKET_INFO - | (((ULONG)1) << 15) -#endif -#ifdef NX_DISABLE_RARP_INFO - | (((ULONG)1) << 14) -#endif -#ifdef NX_DISABLE_TCP_INFO - | (((ULONG)1) << 13) -#endif -#ifdef NX_DISABLE_UDP_INFO - | (((ULONG)1) << 12) -#endif - ; - - - /* Add the retry shift value to the options. */ -#if (NX_TCP_RETRY_SHIFT > 0xF) - _nx_system_build_options_1 |= 0xF; -#else - _nx_system_build_options_1 |= NX_TCP_RETRY_SHIFT; -#endif - -#if (NX_IP_PERIODIC_RATE > 0xFFFFUL) - _nx_system_build_options_2 = ((ULONG)0xFFFF0000); -#else - _nx_system_build_options_2 = ((ULONG)NX_IP_PERIODIC_RATE) << 16; -#endif - -#if (NX_ARP_EXPIRATION_RATE > 0xFF) - _nx_system_build_options_2 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_2 |= ((ULONG)NX_ARP_EXPIRATION_RATE) << 8; -#endif -#if (NX_ARP_UPDATE_RATE > 0xFF) - _nx_system_build_options_2 |= ((ULONG)0xFF); -#else - _nx_system_build_options_2 |= ((ULONG)NX_ARP_UPDATE_RATE); -#endif - - /* Setup third option word. */ -#if (NX_TCP_ACK_TIMER_RATE > 0xFF) - _nx_system_build_options_3 = ((ULONG)0xFF000000); -#else - _nx_system_build_options_3 = ((ULONG)NX_TCP_ACK_TIMER_RATE) << 24; -#endif -#if (NX_TCP_FAST_TIMER_RATE > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF) << 16; -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_FAST_TIMER_RATE) << 16; -#endif -#if (NX_TCP_TRANSMIT_TIMER_RATE > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_TRANSMIT_TIMER_RATE) << 8; -#endif -#if (NX_TCP_KEEPALIVE_RETRY > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF); -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_KEEPALIVE_RETRY); -#endif - - /* Setup the fourth option word. */ -#if (NX_TCP_KEEPALIVE_INITIAL > 0xFFFFUL) - _nx_system_build_options_4 = ((ULONG)0xFFFF0000); -#else - _nx_system_build_options_4 = ((ULONG)NX_TCP_KEEPALIVE_INITIAL) << 16; -#endif -#if (NX_ARP_MAXIMUM_RETRIES > 0xFF) - _nx_system_build_options_4 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_4 |= ((ULONG)NX_ARP_MAXIMUM_RETRIES) << 8; -#endif -#if (NX_ARP_MAX_QUEUE_DEPTH > 0xF) - _nx_system_build_options_4 |= ((ULONG)0xF) << 4; -#else - _nx_system_build_options_4 |= ((ULONG)NX_ARP_MAX_QUEUE_DEPTH) << 4; -#endif -#if (NX_TCP_KEEPALIVE_RETRIES > 0xF) - _nx_system_build_options_4 |= ((ULONG)0xF); -#else - _nx_system_build_options_4 |= ((ULONG)NX_TCP_KEEPALIVE_RETRIES); -#endif - - /* Setup the fifth option word. */ -#if (NX_MAX_MULTICAST_GROUPS > 0xFF) - _nx_system_build_options_5 = ((ULONG)0xFF000000); -#else - _nx_system_build_options_5 = ((ULONG)NX_MAX_MULTICAST_GROUPS) << 24; -#endif -#if (NX_MAX_LISTEN_REQUESTS > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF) << 16; -#else - _nx_system_build_options_5 |= ((ULONG)NX_MAX_LISTEN_REQUESTS) << 16; -#endif -#if (NX_TCP_MAXIMUM_RETRIES > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_5 |= ((ULONG)NX_TCP_MAXIMUM_RETRIES) << 8; -#endif -#if (NX_TCP_MAXIMUM_TX_QUEUE > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF); -#else - _nx_system_build_options_5 |= ((ULONG)NX_TCP_MAXIMUM_TX_QUEUE); -#endif -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp.h deleted file mode 100644 index e3616a99..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp.h +++ /dev/null @@ -1,424 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_tcp.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Transmission Control Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_TCP_H -#define NX_TCP_H - - -/* Define TCP constants. */ - -#define NX_TCP_ID ((ULONG)0x54435020) - - -/* Define the TCP header typical size. */ - -#define NX_TCP_HEADER_SIZE ((ULONG)0x50000000) /* Typical 5 word TCP header */ -#define NX_TCP_SYN_HEADER ((ULONG)0x70000000) /* SYN header with MSS option */ -#define NX_TCP_HEADER_SHIFT 28 /* Shift down to pickup length */ -#define NX_TCP_SYN_OPTION_SIZE 8 /* 8 bytes of TCP SYN option */ -#define NX_TCP_SYN_SIZE (NX_TCP_SYN_OPTION_SIZE + sizeof(NX_TCP_HEADER)) - - -/* Define the TCP header control fields. */ - -#define NX_TCP_CONTROL_MASK ((ULONG)0x00170000) /* ACK, RST, SYN, and FIN bits */ -#define NX_TCP_URG_BIT ((ULONG)0x00200000) /* Urgent data bit */ -#define NX_TCP_ACK_BIT ((ULONG)0x00100000) /* Acknowledgement bit */ -#define NX_TCP_PSH_BIT ((ULONG)0x00080000) /* Push bit */ -#define NX_TCP_RST_BIT ((ULONG)0x00040000) /* Reset bit */ -#define NX_TCP_SYN_BIT ((ULONG)0x00020000) /* Sequence bit */ -#define NX_TCP_FIN_BIT ((ULONG)0x00010000) /* Finish bit */ - - -/* Define the MSS option for the TCP header. */ - -#define NX_TCP_MSS_OPTION ((ULONG)0x02040000) /* Maximum Segment Size option */ -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_TCP_RWIN_OPTION ((ULONG)0x03030000) /* 24 bits, so NOP, 0x3, 0x3, scale value */ -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -#define NX_TCP_MSS_SIZE 1460 /* Maximum Segment Size */ -#define NX_TCP_OPTION_END ((ULONG)0x01010100) /* NOPs and end of TCP options */ -#define NX_TCP_EOL_KIND 0x00 /* EOL option kind */ -#define NX_TCP_NOP_KIND 0x01 /* NOP option kind */ -#define NX_TCP_MSS_KIND 0x02 /* MSS option kind */ -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_TCP_RWIN_KIND 0x03 /* RWIN option kind */ -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - -/* Define constants for the optional TCP keepalive Timer. To enable this - feature, the TCP source must be compiled with NX_ENABLE_TCP_KEEPALIVE - defined. */ - -#ifndef NX_TCP_KEEPALIVE_INITIAL -#define NX_TCP_KEEPALIVE_INITIAL 7200 /* Number of seconds for initial */ -#endif /* keepalive expiration, the */ - /* default is 2 hours (120 min)*/ -#ifndef NX_TCP_KEEPALIVE_RETRY -#define NX_TCP_KEEPALIVE_RETRY 75 /* After initial expiration, */ -#endif /* retry every 75 seconds */ - -#ifndef NX_TCP_KEEPALIVE_RETRIES -#define NX_TCP_KEEPALIVE_RETRIES 10 /* Retry a maximum of 10 times */ -#endif - -#ifndef NX_TCP_MAXIMUM_TX_QUEUE -#define NX_TCP_MAXIMUM_TX_QUEUE 20 /* Maximum number of transmit */ -#endif /* packets queued */ - -#ifndef NX_TCP_MAXIMUM_RETRIES -#define NX_TCP_MAXIMUM_RETRIES 10 /* Maximum number of transmit */ -#endif /* retries allowed */ - -#ifndef NX_TCP_RETRY_SHIFT -#define NX_TCP_RETRY_SHIFT 0 /* Shift that is applied to */ -#endif /* last timeout for back off, */ - /* i.e. a value of zero means */ - /* constant timeouts, a value */ - /* of 1 causes each successive */ - /* be multiplied by two, etc. */ - -#ifndef NX_TCP_MAXIMUM_SEGMENT_LIFETIME -#define NX_TCP_MAXIMUM_SEGMENT_LIFETIME 120 /* Number of seconds for maximum */ -#endif /* segment lifetime, the */ - /* default is 2 minutes (120s) */ - - -/* Define the maximum receive queue depth for TCP socket. */ -#ifdef NX_ENABLE_LOW_WATERMARK -#ifndef NX_TCP_MAXIMUM_RX_QUEUE -#define NX_TCP_MAXIMUM_RX_QUEUE 20 -#endif /* NX_TCP_MAXIMUM_RX_QUEUE */ -#endif /* NX_ENABLE_LOW_WATERMARK */ - -/* Define the rate for the TCP fast periodic timer. This timer is used to process - delayed ACKs and packet re-transmission. Hence, it must have greater resolution - than the 200ms delayed ACK requirement. By default, the fast periodic timer is - setup on a 100ms periodic. The number supplied is used to divide the - NX_IP_PERIODIC_RATE value to actually derive the ticks. Dividing - by 10 yields a 100ms base periodic. */ - -#ifndef NX_TCP_FAST_TIMER_RATE -#define NX_TCP_FAST_TIMER_RATE 10 -#endif - - -/* Define the rate for the TCP delayed ACK timer, which by default is 200ms. The - number supplied is used to divide the NX_IP_PERIODIC_RATE value to - actually derive the ticks. Dividing by 5 yields a 200ms periodic. */ - -#ifndef NX_TCP_ACK_TIMER_RATE -#define NX_TCP_ACK_TIMER_RATE 5 -#endif - -/* Define the rate for the TCP retransmit timer, which by default is set to - one second. The number supplied is used to divide the NX_IP_PERIODIC_RATE - value to actually derive the ticks. Dividing by 1 yields a 1 second periodic. */ - -#ifndef NX_TCP_TRANSMIT_TIMER_RATE -#define NX_TCP_TRANSMIT_TIMER_RATE 1 -#endif - -/* Define the value of the TCP minimum acceptable MSS for the host to accept the connection, - which by default is 128. */ - -#ifndef NX_TCP_MSS_MINIMUM -#define NX_TCP_MSS_MINIMUM 128 -#endif - - -/* Define Basic TCP packet header data type. This will be used to - build new TCP packets and to examine incoming packets into NetX. */ - -typedef struct NX_TCP_HEADER_STRUCT -{ - - /* Define the first 32-bit word of the TCP header. This word contains - the following information: - - bits 31-16 TCP 16-bit source port number - bits 15-0 TCP 16-bit destination port number - */ - ULONG nx_tcp_header_word_0; - - /* Define the second word of the TCP header. This word contains - the following information: - - bits 31-0 TCP 32-bit sequence number - */ - ULONG nx_tcp_sequence_number; - - /* Define the third word of the TCP header. This word contains - the following information: - - bits 31-0 TCP 32-bit acknowledgment number - */ - ULONG nx_tcp_acknowledgment_number; - - /* Define the fourth 32-bit word of the TCP header. This word contains - the following information: - - bits 31-28 TCP 4-bit header length - bits 27-22 TCP 6-bit reserved field - bit 21 TCP Urgent bit (URG) - bit 20 TCP Acknowledgement bit (ACK) - bit 19 TCP Push bit (PSH) - bit 18 TCP Reset connection bit (RST) - bit 17 TCP Synchronize sequence numbers bit (SYN) - bit 16 TCP Sender has reached the end of its byte stream (FIN) - bits 15-0 TCP 16-bit window size - */ - ULONG nx_tcp_header_word_3; - - /* Define the fifth 32-bit word of the TCP header. This word contains - the following information: - - bits 31-16 TCP 16-bit TCP checksum - bits 15-0 TCP 16-bit TCP urgent pointer - */ - ULONG nx_tcp_header_word_4; -} NX_TCP_HEADER; - - -/* Define TCP component API function prototypes. */ - -UINT _nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); -UINT _nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); -UINT _nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); -UINT _nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_enable(NX_IP *ip_ptr); -UINT _nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT _nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT _nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT _nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT _nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT _nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT _nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_windows_update_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_send_internal(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT _nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT _nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); - -/* Define TCP component internal function prototypes. */ -VOID _nx_tcp_cleanup_deferred(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_client_bind_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_deferred_cleanup_check(NX_IP *ip_ptr); -VOID _nx_tcp_fast_periodic_processing(NX_IP *ip_ptr); -VOID _nx_tcp_socket_retransmit(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, UINT need_fast_retransmit); -VOID _nx_tcp_connect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_disconnect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_initialize(VOID); -UINT _nx_tcp_mss_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *mss); -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -UINT _nx_tcp_window_scaling_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *window_scale); -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -VOID _nx_tcp_no_connection_reset(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_packet_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_packet_send_ack(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_fin(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_rst(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *header_ptr); -VOID _nx_tcp_packet_send_syn(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_probe(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence, UCHAR data); -VOID _nx_tcp_packet_send_control(NX_TCP_SOCKET *socket_ptr, ULONG control_bits, ULONG tx_sequence, - ULONG ack_number, ULONG option_word_1, ULONG option_word_2, UCHAR *data); -VOID _nx_tcp_periodic_processing(NX_IP *ip_ptr); -VOID _nx_tcp_queue_process(NX_IP *ip_ptr); -VOID _nx_tcp_receive_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -VOID _nx_tcp_socket_connection_reset(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_packet_process(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); -UINT _nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); - -VOID _nx_tcp_socket_receive_queue_flush(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_socket_state_ack_check(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_closing(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -UINT _nx_tcp_socket_state_data_check(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_socket_state_data_trim_front(NX_PACKET *packet_ptr, ULONG amount); -VOID _nx_tcp_socket_state_data_trim(NX_PACKET *packet_ptr, ULONG amount); -VOID _nx_tcp_socket_state_established(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_fin_wait1(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_fin_wait2(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_last_ack(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_syn_sent(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_socket_state_syn_received(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_transmit_check(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_thread_resume(TX_THREAD **suspension_list_head, UINT status); -VOID _nx_tcp_socket_thread_suspend(TX_THREAD **suspension_list_head, VOID (*suspend_cleanup)(TX_THREAD * NX_CLEANUP_PARAMETER), NX_TCP_SOCKET *socket_ptr, TX_MUTEX *mutex_ptr, ULONG wait_option); -VOID _nx_tcp_socket_transmit_queue_flush(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_block_cleanup(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_transmit_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); - - -/* Define error checking shells for TCP API services. These are only referenced by the - application. */ - -UINT _nxde_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); -UINT _nxde_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); -UINT _nxe_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nxe_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); -UINT _nxe_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nxe_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_enable(NX_IP *ip_ptr); -UINT _nxe_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nxe_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT _nxe_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nxe_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT _nxe_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT _nxe_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size); -UINT _nxe_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT _nxe_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT _nxe_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT _nxe_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT _nxe_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); -UINT _nxe_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT _nxe_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT _nxe_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_socket_window_update_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); -UINT _nxe_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); - - -/* TCP component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_TCP_INIT -#define TCP_DECLARE -#else -#define TCP_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - -/* Define global data for the TCP component. */ - -/* Define the actual number of ticks for the fast periodic timer. */ - -TCP_DECLARE ULONG _nx_tcp_fast_timer_rate; - -/* Define the actual number of ticks for the delayed ACK timer. */ - -TCP_DECLARE ULONG _nx_tcp_ack_timer_rate; - -/* Define the actual number of ticks for the retransmit timer. */ - -TCP_DECLARE ULONG _nx_tcp_transmit_timer_rate; - -/* Define the actual number of ticks for the 2MSL(Maximum Segment Lifetime) timer. */ - -TCP_DECLARE ULONG _nx_tcp_2MSL_timer_rate; - - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_bind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_bind.c deleted file mode 100644 index 088740dc..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_bind.c +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds the TCP socket structure to a specific TCP */ -/* port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* port 16-bit TCP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_free_port_find Find free TCP port */ -/* _nx_tcp_socket_thread_suspend Suspend thread */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ -TX_INTERRUPT_SAVE_AREA - -UINT index; -#ifdef NX_NAT_ENABLE -UINT bound; -#endif /* NX_NAT_ENABLE */ -NX_IP *ip_ptr; -NX_TCP_SOCKET *search_ptr; -NX_TCP_SOCKET *end_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_CLIENT_SOCKET_BIND, ip_ptr, socket_ptr, port, wait_option, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has already been bound to port or if a socket bind is - already pending from another thread. */ - if ((socket_ptr -> nx_tcp_socket_bound_next) || - (socket_ptr -> nx_tcp_socket_bind_in_progress)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an already bound error code. */ - return(NX_ALREADY_BOUND); - } - - /* Determine if the port needs to be allocated. */ - if (port == NX_ANY_PORT) - { - - /* Call the find routine to allocate a TCP port. */ - port = NX_SEARCH_PORT_START + (UINT)(NX_RAND() % ((NX_MAX_PORT + 1) - NX_SEARCH_PORT_START)); - if (_nx_tcp_free_port_find(ip_ptr, port, &port) != NX_SUCCESS) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* There was no free port, return an error code. */ - return(NX_NO_FREE_PORTS); - } - } -#ifdef NX_NAT_ENABLE - else - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_TCP, port); - - /* Check to see if the port has been used by NAT. */ - if (bound == NX_TRUE) - { - - /* Release the protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } - } - } -#endif - - /* Save the port number in the TCP socket structure. */ - socket_ptr -> nx_tcp_socket_port = port; - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Pickup the head of the TCP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_tcp_port_table[index]; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of TCP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_tcp_socket_port == port) - { - - /* Yes, the port has already been allocated. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_tcp_socket_bound_next; - } while (search_ptr != end_ptr); - } - - /* Now determine if the port is available. */ - if ((search_ptr == NX_NULL) || (search_ptr -> nx_tcp_socket_port != port)) - { - - /* Place this TCP socket structure on the list of bound ports. */ - - /* Disable interrupts. */ - TX_DISABLE - - /* Determine if the list is NULL. */ - if (search_ptr) - { - - /* There are already sockets on this list... just add this one - to the end. */ - socket_ptr -> nx_tcp_socket_bound_next = - ip_ptr -> nx_ip_tcp_port_table[index]; - socket_ptr -> nx_tcp_socket_bound_previous = - (ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous; - ((ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous) -> nx_tcp_socket_bound_next = - socket_ptr; - (ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous = socket_ptr; - } - else - { - - /* Nothing is on the TCP port list. Add this TCP socket to an - empty list. */ - socket_ptr -> nx_tcp_socket_bound_next = socket_ptr; - socket_ptr -> nx_tcp_socket_bound_previous = socket_ptr; - ip_ptr -> nx_ip_tcp_port_table[index] = socket_ptr; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success to the caller. */ - return(NX_SUCCESS); - } - else - { - - /* Release the IP protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_connect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_connect.c deleted file mode 100644 index 048c6ba5..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_connect.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the connect request for the supplied socket. */ -/* If bound and not connected, this function will send the first SYN */ -/* message to the specified server to initiate the connection process. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_client_socket_connect Actual TCP client connect */ -/* call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - ULONG server_ip, - UINT server_port, - ULONG wait_option) -{ - -#ifndef NX_DISABLE_IPV4 -NXD_ADDRESS server_ip_addr; - - /* Construct an IP address structure, and fill in IPv4 address information. */ - server_ip_addr.nxd_ip_version = NX_IP_VERSION_V4; - server_ip_addr.nxd_ip_address.v4 = server_ip; - - /* Invoke the real connection call. */ - return(_nxd_tcp_client_socket_connect(socket_ptr, &server_ip_addr, server_port, wait_option)); -#else /* NX_DISABLE_IPV4 */ - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(server_ip); - NX_PARAMETER_NOT_USED(server_port); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_unbind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_unbind.c deleted file mode 100644 index d3d64b9e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_client_socket_unbind.c +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds the TCP client socket structure from the */ -/* previously bound TCP port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_bind_cleanup Remove and cleanup bind req */ -/* _nx_tcp_socket_thread_resume Resume thread suspended on */ -/* port */ -/* _nx_tcp_socket_block_cleanup Cleanup the socket block */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -UINT index; -UINT port; -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_CLIENT_SOCKET_UNBIND, ip_ptr, socket_ptr, 0, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Cleanup the transmission control block. */ - _nx_tcp_socket_block_cleanup(socket_ptr); - - /* Determine if the socket is still in the closed state. */ - if (socket_ptr -> nx_tcp_socket_state != NX_TCP_CLOSED) - { - - /* No, release the IP protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an error code. */ - return(NX_NOT_CLOSED); - } - - /* Determine if the socket is bound to port. */ - if (!socket_ptr -> nx_tcp_socket_bound_next) - { - - /* Determine if there is a special condition for the socket not being in - a bound condition... i.e. the socket is in a pending-to-be-bound condition - in a call from a different thread. */ - if (socket_ptr -> nx_tcp_socket_bind_in_progress) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); - } - else - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not bound error code. */ - return(NX_NOT_BOUND); - } - } - - /* Otherwise, the socket is bound. We need to remove this socket from the - port and check for any other TCP socket bind requests that are queued. */ - - /* Pickup the port number in the TCP socket structure. */ - port = socket_ptr -> nx_tcp_socket_port; - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Disable interrupts while we unlink the current socket. */ - TX_DISABLE - - /* Determine if this is the only socket bound on this port list. */ - if (socket_ptr -> nx_tcp_socket_bound_next == socket_ptr) - { - - /* Yes, this is the only socket on the port list. */ - - /* Clear the list head pointer and the next pointer in the socket. */ - ip_ptr -> nx_ip_tcp_port_table[index] = NX_NULL; - socket_ptr -> nx_tcp_socket_bound_next = NX_NULL; - } - else - { - - /* Relink the neighbors of this TCP socket. */ - - /* Update the links of the adjacent sockets. */ - (socket_ptr -> nx_tcp_socket_bound_next) -> nx_tcp_socket_bound_previous = - socket_ptr -> nx_tcp_socket_bound_previous; - (socket_ptr -> nx_tcp_socket_bound_previous) -> nx_tcp_socket_bound_next = - socket_ptr -> nx_tcp_socket_bound_next; - - /* Determine if the head of the port list points to the socket being removed. - If so, we need to move the head pointer. */ - if (ip_ptr -> nx_ip_tcp_port_table[index] == socket_ptr) - { - - /* Yes, we need to move the port list head pointer. */ - ip_ptr -> nx_ip_tcp_port_table[index] = socket_ptr -> nx_tcp_socket_bound_next; - } - - /* Clear the next pointer in the socket to indicate it is no longer bound. */ - socket_ptr -> nx_tcp_socket_bound_next = NX_NULL; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_enable.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_enable.c deleted file mode 100644 index df6f2c75..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_enable.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "nx_ip.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function enables the TCP management component for the */ -/* specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_timer_create Create fast TCP timer */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_enable(NX_IP *ip_ptr) -{ - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_free_port_find.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_free_port_find.c deleted file mode 100644 index 058c8c54..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_free_port_find.c +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_free_port_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds the first available TCP port, starting from the */ -/* supplied port. If no available ports are found, an error is */ -/* returned. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* port Starting port */ -/* free_port_ptr Pointer to return free port */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr) -{ - -UINT index; -UINT bound; -UINT starting_port; -NX_TCP_SOCKET *search_ptr; -NX_TCP_SOCKET *end_ptr; - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_FREE_PORT_FIND, ip_ptr, port, 0, 0, NX_TRACE_TCP_EVENTS, &trace_event, &trace_timestamp); - - /* Save the original port. */ - starting_port = port; - - /* Loop through the TCP ports until a free entry is found. */ - do - { - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup the head of the TCP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_tcp_port_table[index]; - - /* Set the bound flag to false. */ - bound = NX_FALSE; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of TCP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_tcp_socket_port == port) - { - - /* Set the bound flag. */ - bound = NX_TRUE; - - /* Get out of the loop. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_tcp_socket_bound_next; - } while (search_ptr != end_ptr); - } - -#ifdef NX_NAT_ENABLE - if (bound == NX_FALSE) - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_TCP, port); - } - } -#endif - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Determine if the port is available. */ - if (!bound) - { - - /* Setup the return port number. */ - *free_port_ptr = port; - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_TCP_FREE_PORT_FIND, 0, 0, port, 0); - - /* Return success. */ - return(NX_SUCCESS); - } - - /* Move to the next port. */ - port++; - - /* Determine if we need to wrap. */ - if (port > NX_MAX_PORT) - { - - /* Yes, we need to wrap around. */ - port = NX_SEARCH_PORT_START; - } - } while (starting_port != port); - - /* A free port was not found, return an error. */ - return(NX_NO_FREE_PORTS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_initialize.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_initialize.c deleted file mode 100644 index d95c2c94..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_initialize.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX global TCP Component data in this file. */ - -#define NX_TCP_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the TCP management component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_tcp_initialize(VOID) -{ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_block_cleanup.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_block_cleanup.c deleted file mode 100644 index 47b9f46c..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_block_cleanup.c +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "nx_ipv6.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_block_cleanup PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function cleans up the transmission control block. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to owning socket */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_tcp_fast_periodic_processing Process TCP packet for socket */ -/* _nx_tcp_socket_connection_reset Reset TCP connection */ -/* _nx_tcp_socket_disconnect Close TCP conenction */ -/* _nx_tcp_socket_state_last_ack Process data on LAST ACK state*/ -/* _nx_tcp_client_socket_unbind Ubind the TCP client socket */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_tcp_socket_block_cleanup(NX_TCP_SOCKET *socket_ptr) -{ - - /* Clean up the connect IP address. */ - - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_version = 0; - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4 = 0; - - /* Clean up the connect port. */ - socket_ptr -> nx_tcp_socket_connect_port = 0; - - /* Reset zero window probe flag. */ - socket_ptr -> nx_tcp_socket_zero_window_probe_has_data = NX_FALSE; - - /* Simply clear the timeout. */ - socket_ptr -> nx_tcp_socket_timeout = 0; - - /* Reset duplicated ack received. */ - socket_ptr -> nx_tcp_socket_duplicated_ack_received = 0; - - /* Reset fast recovery stage. */ - socket_ptr -> nx_tcp_socket_fast_recovery = NX_FALSE; - - /* Connection needs to be closed down immediately. */ - if (socket_ptr -> nx_tcp_socket_client_type) - { - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_CLOSED, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Client socket, return to a CLOSED state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - } - else - { - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_LISTEN_STATE, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Server socket, return to LISTEN state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_LISTEN_STATE; - } -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_create.c deleted file mode 100644 index f6cf855b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_create.c +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a TCP socket for the specified IP instance. */ -/* Both client and server sockets are created by this service. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new TCP socket */ -/* name Name of new TCP socket */ -/* type_of_service Type of service for this TCP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* window_size Size of socket's receive */ -/* window */ -/* tcp_urgent_data_callback Routine to call when urgent */ -/* data is received */ -/* tcp_disconnect_callback Routine to call when a */ -/* disconnect occurs */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - -NX_TCP_SOCKET *tail_ptr; - - - /* Initialize the TCP control block to zero. */ - memset((void *)socket_ptr, 0, sizeof(NX_TCP_SOCKET)); - - /* Fill in the basic information in the new TCP socket structure. */ - - /* Remember the associated IP structure. */ - socket_ptr -> nx_tcp_socket_ip_ptr = ip_ptr; - - /* By default, indicate the socket is a client socket. */ - socket_ptr -> nx_tcp_socket_client_type = NX_TRUE; - - /* Save the TCP socket's name. */ - socket_ptr -> nx_tcp_socket_name = name; - - /* Setup the counter for duplicated ACK packet. */ - socket_ptr -> nx_tcp_socket_duplicated_ack_received = 0; - - /* Setup this socket's maximum segment size (mss). */ - socket_ptr -> nx_tcp_socket_mss = 0; - - /* Setup the default receiver's maximum segment size. */ - socket_ptr -> nx_tcp_socket_connect_mss = NX_TCP_MSS_SIZE; - - /* Save the type of service input parameter. */ - socket_ptr -> nx_tcp_socket_type_of_service = type_of_service; - - /* Save the fragment input parameter. */ - socket_ptr -> nx_tcp_socket_fragment_enable = fragment & NX_DONT_FRAGMENT; - - /* Save the time-to-live input parameter. */ - socket_ptr -> nx_tcp_socket_time_to_live = time_to_live; - - /* Clear the socket bind in progress flag. */ - socket_ptr -> nx_tcp_socket_bind_in_progress = NX_FALSE; - - /* Setup the delayed ACK timeout periodic rate. */ - socket_ptr -> nx_tcp_socket_delayed_ack_timeout = _nx_tcp_ack_timer_rate; - - /* Setup the default transmit timeout. */ - socket_ptr -> nx_tcp_socket_timeout_rate = _nx_tcp_transmit_timer_rate; - socket_ptr -> nx_tcp_socket_timeout_max_retries = NX_TCP_MAXIMUM_RETRIES; - socket_ptr -> nx_tcp_socket_timeout_shift = NX_TCP_RETRY_SHIFT; - - /* Setup the default maximum transmit queue depth. */ - socket_ptr -> nx_tcp_socket_transmit_queue_maximum_default = NX_TCP_MAXIMUM_TX_QUEUE; - socket_ptr -> nx_tcp_socket_transmit_queue_maximum = NX_TCP_MAXIMUM_TX_QUEUE; - -#ifdef NX_ENABLE_LOW_WATERMARK - /* Setup the default maximum receive queue depth. */ - socket_ptr -> nx_tcp_socket_receive_queue_maximum = NX_TCP_MAXIMUM_RX_QUEUE; -#endif /* NX_ENABLE_LOW_WATERMARK */ - -#ifdef NX_ENABLE_TCP_WINDOW_SCALING - - /* Window scaling feature is enabled. Record this user-specified window size. */ - socket_ptr -> nx_tcp_socket_rx_window_maximum = window_size; -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Setup the sliding window information. */ - socket_ptr -> nx_tcp_socket_rx_window_default = window_size; - socket_ptr -> nx_tcp_socket_rx_window_current = window_size; - socket_ptr -> nx_tcp_socket_tx_outstanding_bytes = 0; - socket_ptr -> nx_tcp_socket_tx_window_advertised = 0; - socket_ptr -> nx_tcp_socket_tx_window_congestion = 0; - - - /* Initialize the ack_n_packet counter. */ - socket_ptr -> nx_tcp_socket_ack_n_packet_counter = 1; - - /* Save the application callback routines. */ - socket_ptr -> nx_tcp_urgent_data_callback = tcp_urgent_data_callback; - socket_ptr -> nx_tcp_disconnect_callback = tcp_disconnect_callback; - - /* Clear the receive notify function pointer. */ - socket_ptr -> nx_tcp_receive_callback = NX_NULL; - -#ifdef NX_ENABLE_TCP_KEEPALIVE - /* If the Keep alive feature is enabled in NetX, enable it - on all TCP sockets. */ - socket_ptr -> nx_tcp_socket_keepalive_enabled = NX_TRUE; - -#endif - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_CLOSED, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Setup the initial TCP socket state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_TCP_SOCKET, socket_ptr, name, type_of_service, window_size); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_CREATE, ip_ptr, socket_ptr, type_of_service, window_size, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Get protection while we insert the TCP socket into the created list. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts while we link the new TCP socket to the IP structure. */ - TX_DISABLE - - /* Load the TCP ID field in the TCP control block. */ - socket_ptr -> nx_tcp_socket_id = NX_TCP_ID; - - /* Place the new TCP control block on the list of created TCP sockets for this IP. First, - check for an empty list. */ - if (ip_ptr -> nx_ip_tcp_created_sockets_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = (ip_ptr -> nx_ip_tcp_created_sockets_ptr) -> nx_tcp_socket_created_previous; - - /* Place the new TCP socket control block in the list. */ - (ip_ptr -> nx_ip_tcp_created_sockets_ptr) -> nx_tcp_socket_created_previous = socket_ptr; - tail_ptr -> nx_tcp_socket_created_next = socket_ptr; - - /* Setup this TCP socket's created links. */ - socket_ptr -> nx_tcp_socket_created_previous = tail_ptr; - socket_ptr -> nx_tcp_socket_created_next = ip_ptr -> nx_ip_tcp_created_sockets_ptr; - } - else - { - - /* The created TCP socket list is empty. Add TCP socket control block to empty list. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = socket_ptr; - socket_ptr -> nx_tcp_socket_created_previous = socket_ptr; - socket_ptr -> nx_tcp_socket_created_next = socket_ptr; - } - - /* Increment the created TCP socket counter. */ - ip_ptr -> nx_ip_tcp_created_sockets_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_delete.c deleted file mode 100644 index 9c6848eb..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_delete.c +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created socket and unbound */ -/* socket. If the socket is still bound, an error is returned. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_DELETE, ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can process the socket delete request. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has been created. */ - if (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not created error code. */ - return(NX_NOT_CREATED); - } - - /* Determine if the socket is still bound to port. */ - if ((socket_ptr -> nx_tcp_socket_bound_next) || - (socket_ptr -> nx_tcp_socket_bind_in_progress) || - (socket_ptr -> nx_tcp_socket_state != NX_TCP_CLOSED)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a still bound error code. */ - return(NX_STILL_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Now, remove the TCP socket from the created socket list. */ - - /* Clear the socket ID to make it invalid. */ - socket_ptr -> nx_tcp_socket_id = 0; - - /* See if the socket is the only one on the list. */ - if (socket_ptr == socket_ptr -> nx_tcp_socket_created_next) - { - - /* Only created socket, just set the created list to NULL. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (socket_ptr -> nx_tcp_socket_created_next) -> nx_tcp_socket_created_previous = - socket_ptr -> nx_tcp_socket_created_previous; - (socket_ptr -> nx_tcp_socket_created_previous) -> nx_tcp_socket_created_next = - socket_ptr -> nx_tcp_socket_created_next; - - /* See if we have to update the created list head pointer. */ - if (ip_ptr -> nx_ip_tcp_created_sockets_ptr == socket_ptr) - { - - /* Yes, move the head pointer to the next link. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = socket_ptr -> nx_tcp_socket_created_next; - } - } - - /* Decrease the created sockets count. */ - ip_ptr -> nx_ip_tcp_created_sockets_count--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(ip_ptr); - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_disconnect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_disconnect.c deleted file mode 100644 index 9fef34b8..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_disconnect.c +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the disconnect request for both active and */ -/* passive calls. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_connect_cleanup Clear connect suspension */ -/* _nx_tcp_disconnect_cleanup Clear disconnect suspension */ -/* _nx_tcp_packet_send_fin Send FIN message */ -/* _nx_tcp_packet_send_rst Send RST on no timeout */ -/* _nx_tcp_receive_cleanup Clear receive suspension */ -/* _nx_tcp_transmit_cleanup Clear transmit suspension */ -/* _nx_tcp_socket_thread_suspend Suspend calling thread */ -/* _nx_tcp_socket_transmit_queue_flush Release all transmit packets */ -/* _nx_tcp_socket_block_cleanup Cleanup the socket block */ -/* tx_mutex_get Get protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - - /* Call wifi disconnect. */ - return(nx_wifi_tcp_socket_disconnect(socket_ptr, wait_option)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_establish_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_establish_notify.c deleted file mode 100644 index ea412f99..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_establish_notify.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_establish_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the establish notify function pointer to the */ -/* function specified by the application, which is called when the */ -/* handshake connection with the remote TCP host is complete. If a */ -/* NULL pointer is supplied, the establish notify function is disabled.*/ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_establish_notify Routine to call when the */ -/* connection handshake is */ -/* complete socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - - return(NX_NOT_SUPPORTED); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive.c deleted file mode 100644 index 23efa9aa..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive.c +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function attempts to receive one or more TCP packets from the */ -/* specified socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_packet_send_ack Send ACK message */ -/* _nx_tcp_socket_thread_suspend Suspend calling thread */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - - /* Call wifi receive. */ - return(nx_wifi_tcp_socket_receive(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive_notify.c deleted file mode 100644 index 0bf3b4da..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_receive_notify.c +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the receive notify function pointer to the */ -/* function specified by the application, which is called whenever */ -/* one or more receive packets is available for the socket. If a */ -/* NULL pointer is supplied, the receive notify function is disabled. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_RECEIVE_NOTIFY, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, tcp_receive_notify, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Get mutex protection. */ - tx_mutex_get(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts. */ - TX_DISABLE - - /* Setup the receive notify function pointer. */ - socket_ptr -> nx_tcp_receive_callback = tcp_receive_notify; - - /* Restore interrupts. */ - TX_RESTORE - - /* Release protection. */ - tx_mutex_put(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_send.c deleted file mode 100644 index 7a033810..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_send.c +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" -#include "nx_tcp.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a TCP packet through the specified socket. */ -/* If payload size exceeds MSS, this service fragments the payload */ -/* to fit into MSS. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* NX_INVALID_PARAMETERS Unknown packet IP version */ -/* NX_INVALID_PACKET Source packet chain missing */ -/* packet data */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_send_internal Transmit TCP payload */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option) -{ - - /* Call wifi send. */ - return(nx_wifi_tcp_socket_send(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_state_wait.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_state_wait.c deleted file mode 100644 index 5a2b601b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_tcp_socket_state_wait.c +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_state_wait PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function waits for the specified socket to reach the specified */ -/* TCP state. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* desired_state Desired TCP state */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_thread_sleep Sleep to wait for state change*/ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option) -{ - - - /* Loop to wait for the desired socket state. */ - for (;;) - { - - /* Determine if the socket pointer is still valid. */ - if (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) - { - - /* Not still valid, return an error. */ - return(NX_PTR_ERROR); - } - - /* Determine if the desired state is present. */ - if (socket_ptr -> nx_tcp_socket_state == desired_state) - { - - /* The desired state is present, return success! */ - return(NX_SUCCESS); - } - - /* Check to see if there is more time to wait. */ - if (wait_option) - { - - /* Yes, there is more time... sleep for a tick. */ - tx_thread_sleep(1); - - /* Decrease the wait time. */ - wait_option--; - } - else - { - - /* Timeout, just return an error. */ - return(NX_NOT_SUCCESSFUL); - } - } -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp.h deleted file mode 100644 index 3eff269a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp.h +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_udp.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX User Datagram Protocol (UDP) component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_UDP_H -#define NX_UDP_H - - -/* Define UDP constants. */ - -#define NX_UDP_ID ((ULONG)0x55445020) - - -/* Define Basic UDP packet header data type. This will be used to - build new UDP packets and to examine incoming packets into NetX. */ - -typedef struct NX_UDP_HEADER_STRUCT -{ - - /* Define the first 32-bit word of the UDP header. This word contains - the following information: - - bits 31-16 UDP 16-bit source port number - bits 15-0 UDP 16-bit destination port number - */ - ULONG nx_udp_header_word_0; - - /* Define the second and final word of the UDP header. This word contains - the following information: - - bits 31-16 UDP 16-bit UDP length (including 8 header bytes) - bits 15-0 UDP 16-bit checksum (including header and pseudo IP header) - */ - ULONG nx_udp_header_word_1; -} NX_UDP_HEADER; - - -/* Define UDP component function prototypes. */ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port); - -VOID _nx_udp_bind_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_udp_enable(NX_IP *ip_ptr); -UINT _nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nx_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -VOID _nx_udp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_udp_receive_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nx_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nx_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum); -UINT _nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT _nxd_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port, UINT address_index); -UINT _nxde_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port, UINT address_index); -UINT _nx_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG wait_option); -UINT _nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)); - -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port); -UINT _nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT _nx_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxd_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_udp_enable(NX_IP *ip_ptr); -UINT _nxe_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nxe_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -UINT _nxe_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nxe_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nxe_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT _nxe_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum, UINT udp_socket_size); -UINT _nxe_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); - -UINT _nxe_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT _nxde_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); -UINT _nxe_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT _nxe_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nxe_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG wait_option); -UINT _nxe_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)); -UINT _nx_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port, UINT address_index); -UINT _nxe_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG ip_address, UINT port, UINT source_index); -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port); -UINT _nxe_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); - - - -UINT _nxd_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxde_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxe_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, NXD_ADDRESS *ip_address, UINT port); - -/* UDP component data declarations follow. */ - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_enable.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_enable.c deleted file mode 100644 index efdbce4c..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_enable.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function enables the UDP management component for the */ -/* specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_enable(NX_IP *ip_ptr) -{ - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_free_port_find.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_free_port_find.c deleted file mode 100644 index cd3a6143..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_free_port_find.c +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_free_port_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds the first available UDP port, starting from the */ -/* supplied port. If no available ports are found, an error is */ -/* returned. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* port Starting port */ -/* free_port_ptr Pointer to return free port */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr) -{ - -UINT index; -UINT bound; -UINT starting_port; -NX_UDP_SOCKET *search_ptr; -NX_UDP_SOCKET *end_ptr; - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_FREE_PORT_FIND, ip_ptr, port, 0, 0, NX_TRACE_UDP_EVENTS, &trace_event, &trace_timestamp); - - /* Save the original port. */ - starting_port = port; - - /* Loop through the UDP ports until a free entry is found. */ - do - { - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup the head of the UDP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_udp_port_table[index]; - - /* Set the bound flag to false. */ - bound = NX_FALSE; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of UDP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_udp_socket_port == port) - { - - /* Set the bound flag. */ - bound = NX_TRUE; - - /* Get out of the loop. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_udp_socket_bound_next; - } while (search_ptr != end_ptr); - } - -#ifdef NX_NAT_ENABLE - if (bound == NX_FALSE) - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_UDP, port); - } - } -#endif - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Determine if the port is available. */ - if (!bound) - { - - /* Setup the return port number. */ - *free_port_ptr = port; - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_UDP_FREE_PORT_FIND, 0, 0, port, 0); - - /* Return success. */ - return(NX_SUCCESS); - } - - /* Move to the next port. */ - port++; - - /* Determine if we need to wrap. */ - if (port > NX_MAX_PORT) - { - - /* Yes, we need to wrap around. */ - port = NX_SEARCH_PORT_START; - } - } while (starting_port != port); - - /* A free port was not found, return an error. */ - return(NX_NO_FREE_PORTS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_bind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_bind.c deleted file mode 100644 index c97e1f58..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_bind.c +++ /dev/null @@ -1,215 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds the UDP socket a specific UDP port. If the */ -/* requested port number is currently bound to another socket, */ -/* this function waits for specified period of time (wait_option) */ -/* for the other socket to unbind the port number. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_free_port_find Find a free UDP port */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -TX_INTERRUPT_SAVE_AREA -UINT index; -UINT status; -NX_IP *ip_ptr; -NX_UDP_SOCKET *search_ptr; -NX_UDP_SOCKET *end_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_BIND, ip_ptr, socket_ptr, port, wait_option, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has already been bound to port or if a socket bind is - already pending from another thread. */ - if ((socket_ptr -> nx_udp_socket_bound_next) || - (socket_ptr -> nx_udp_socket_bind_in_progress)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an already bound error code. */ - return(NX_ALREADY_BOUND); - } - - /* Determine if the port needs to be allocated. */ - if (port == NX_ANY_PORT) - { - - /* Call the find routine to allocate a UDP port. */ - port = NX_SEARCH_PORT_START + (UINT)(NX_RAND() % ((NX_MAX_PORT + 1) - NX_SEARCH_PORT_START)); - if (_nx_udp_free_port_find(ip_ptr, port, &port) != NX_SUCCESS) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* There was no free port, return an error code. */ - return(NX_NO_FREE_PORTS); - } - } - - /* Save the port number in the UDP socket structure. */ - socket_ptr -> nx_udp_socket_port = port; - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Pickup the head of the UDP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_udp_port_table[index]; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of UDP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_udp_socket_port == port) - { - - /* Yes, the port has already been allocated. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_udp_socket_bound_next; - } while (search_ptr != end_ptr); - } - - /* Now determine if the port is available. */ - if ((search_ptr == NX_NULL) || (search_ptr -> nx_udp_socket_port != port)) - { - - /* Place this UDP socket structure on the list of bound ports. */ - - /* Disable interrupts. */ - TX_DISABLE - - /* Determine if the list is NULL. */ - if (search_ptr) - { - - /* There are already sockets on this list... just add this one - to the end. */ - socket_ptr -> nx_udp_socket_bound_next = ip_ptr -> nx_ip_udp_port_table[index]; - socket_ptr -> nx_udp_socket_bound_previous = (ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous; - ((ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous) -> nx_udp_socket_bound_next = socket_ptr; - (ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous = socket_ptr; - } - else - { - - /* Nothing is on the UDP port list. Add this UDP socket to an - empty list. */ - socket_ptr -> nx_udp_socket_bound_next = socket_ptr; - socket_ptr -> nx_udp_socket_bound_previous = socket_ptr; - ip_ptr -> nx_ip_udp_port_table[index] = socket_ptr; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Call wifi bind. */ - status = nx_wifi_udp_socket_bind(socket_ptr, port, wait_option); - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return status. */ - return(status); - } - else - { - - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_create.c deleted file mode 100644 index fcd2e19a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_create.c +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a UDP socket for the specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new UDP socket */ -/* name Name of new UDP socket */ -/* type_of_service Type of service for this UDP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* queue_maximum Maximum depth of receive queue*/ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum) -{ -TX_INTERRUPT_SAVE_AREA - -NX_UDP_SOCKET *tail_ptr; - - - /* Initialize the TCP control block to zero. */ - memset((void *)socket_ptr, 0, sizeof(NX_UDP_SOCKET)); - - /* Fill in the basic information in the new UDP socket structure. */ - - /* Remember the associated IP structure. */ - socket_ptr -> nx_udp_socket_ip_ptr = ip_ptr; - - /* Save the UDP socket's name. */ - socket_ptr -> nx_udp_socket_name = name; - - /* Save the type of service input parameter. */ - socket_ptr -> nx_udp_socket_type_of_service = type_of_service; - - /* Save the fragment input parameter. */ - socket_ptr -> nx_udp_socket_fragment_enable = fragment & NX_DONT_FRAGMENT; - - /* Save the time-to-live input parameter. */ - socket_ptr -> nx_udp_socket_time_to_live = time_to_live; - - /* By default, have UDP checksum logic enabled. To disable checksum logic, the - application must call the nx_udp_checksum disable function for this UDP socket. */ - socket_ptr -> nx_udp_socket_disable_checksum = NX_FALSE; - - /* Clear the socket bind in progress flag. */ - socket_ptr -> nx_udp_socket_bind_in_progress = NX_FALSE; - - /* Set various list pointers to NULL. */ - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - socket_ptr -> nx_udp_socket_bound_previous = NX_NULL; - socket_ptr -> nx_udp_socket_bind_suspension_list = NX_NULL; - socket_ptr -> nx_udp_socket_bind_suspended_count = 0; - - /* Initialize the receive queue parameters. */ - socket_ptr -> nx_udp_socket_receive_count = 0; - socket_ptr -> nx_udp_socket_queue_maximum = queue_maximum; - socket_ptr -> nx_udp_socket_receive_head = NX_NULL; - socket_ptr -> nx_udp_socket_receive_tail = NX_NULL; - - /* Clear the receive notify function pointer. */ - socket_ptr -> nx_udp_receive_callback = NX_NULL; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_UDP_SOCKET, socket_ptr, name, type_of_service, queue_maximum); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_CREATE, ip_ptr, socket_ptr, type_of_service, queue_maximum, NX_TRACE_IP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can add socket to IP structure. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts while we link the new UDP socket to the IP structure. */ - TX_DISABLE - - /* Load the UDP ID field in the UDP control block. */ - socket_ptr -> nx_udp_socket_id = NX_UDP_ID; - - /* Place the new UDP control block on the list of created UDP sockets for this IP. First, - check for an empty list. */ - if (ip_ptr -> nx_ip_udp_created_sockets_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = (ip_ptr -> nx_ip_udp_created_sockets_ptr) -> nx_udp_socket_created_previous; - - /* Place the new UDP socket control block in the list. */ - (ip_ptr -> nx_ip_udp_created_sockets_ptr) -> nx_udp_socket_created_previous = socket_ptr; - tail_ptr -> nx_udp_socket_created_next = socket_ptr; - - /* Setup this UDP socket's created links. */ - socket_ptr -> nx_udp_socket_created_previous = tail_ptr; - socket_ptr -> nx_udp_socket_created_next = ip_ptr -> nx_ip_udp_created_sockets_ptr; - } - else - { - - /* The created UDP socket list is empty. Add UDP socket control block to empty list. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = socket_ptr; - socket_ptr -> nx_udp_socket_created_previous = socket_ptr; - socket_ptr -> nx_udp_socket_created_next = socket_ptr; - } - - /* Increment the created UDP socket counter. */ - ip_ptr -> nx_ip_udp_created_sockets_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_delete.c deleted file mode 100644 index 1f4224e4..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_delete.c +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created socket and unbound */ -/* socket. If the socket is still bound, an error is returned. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_DELETE, ip_ptr, socket_ptr, 0, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can process the socket delete request. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket is still bound to port. */ - if (socket_ptr -> nx_udp_socket_bound_next) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a still bound error code. */ - return(NX_STILL_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Now, remove the UDP socket from the created socket list. */ - - /* Clear the socket ID to make it invalid. */ - socket_ptr -> nx_udp_socket_id = 0; - - /* See if the socket is the only one on the list. */ - if (socket_ptr == socket_ptr -> nx_udp_socket_created_next) - { - - /* Only created socket, just set the created list to NULL. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (socket_ptr -> nx_udp_socket_created_next) -> nx_udp_socket_created_previous = - socket_ptr -> nx_udp_socket_created_previous; - (socket_ptr -> nx_udp_socket_created_previous) -> nx_udp_socket_created_next = - socket_ptr -> nx_udp_socket_created_next; - - /* See if we have to update the created list head pointer. */ - if (ip_ptr -> nx_ip_udp_created_sockets_ptr == socket_ptr) - { - - /* Yes, move the head pointer to the next link. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = socket_ptr -> nx_udp_socket_created_next; - } - } - - /* Decrease the created sockets count. */ - ip_ptr -> nx_ip_udp_created_sockets_count--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(socket_ptr); - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive.c deleted file mode 100644 index 79c2aaad..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "tx_thread.h" -#include "nx_packet.h" -#include "nx_udp.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for a received UDP packet on the specified */ -/* socket and if no packets are on the receive queue, suspends for the */ -/* wait option duration. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release data packet */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - - - /* Call wifi receive. */ - return(nx_wifi_udp_socket_receive(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive_notify.c deleted file mode 100644 index 20ba9571..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_receive_notify.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the receive notify function pointer to the */ -/* function specified by the application, which is called whenever */ -/* a packet is received on the socket. If a NULL pointer is supplied, */ -/* the receive notify function is disabled. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* udp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - - - /* Disable interrupts. */ - TX_DISABLE - - /* Setup the receive notify function pointer. */ - socket_ptr -> nx_udp_receive_callback = udp_receive_notify; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_RECEIVE_NOTIFY, socket_ptr -> nx_udp_socket_ip_ptr, socket_ptr, udp_receive_notify, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_send.c deleted file mode 100644 index bffc539f..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_send.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends the supplied UDP packet through the supplied */ -/* socket to the supplied IP address and port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nxd_udp_socket_send Send the UDP packet over IP */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port) -{ -#ifndef NX_DISABLE_IPV4 -UINT status; - -NXD_ADDRESS dual_ip_address; - - /* build up the IP Address structure. */ - dual_ip_address.nxd_ip_version = NX_IP_VERSION_V4; - dual_ip_address.nxd_ip_address.v4 = ip_address; - - /* Call the actual udp socket send routine. */ - status = _nxd_udp_socket_send(socket_ptr, packet_ptr, &dual_ip_address, port); - - return(status); -#else - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(packet_ptr); - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(port); - - return(NX_NOT_SUPPORTED); -#endif /* NX_DISABLE_IPV4 */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_unbind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_unbind.c deleted file mode 100644 index 31220e3f..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_udp_socket_unbind.c +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_packet.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds the UDP socket structure from the previously */ -/* bound UDP port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release data packet */ -/* _nx_udp_bind_cleanup Remove and cleanup bind req */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_resume Resume suspended thread */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ - -UINT index; -UINT port; -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_UNBIND, ip_ptr, socket_ptr, socket_ptr -> nx_udp_socket_port, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket is bound to port. */ - if (!socket_ptr -> nx_udp_socket_bound_next) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not bound error code. */ - return(NX_NOT_BOUND); - } - - /* Otherwise, the socket is bound. We need to remove this socket from the - port and check for any other UDP socket bind requests that are queued. */ - - /* Pickup the port number in the UDP socket structure. */ - port = socket_ptr -> nx_udp_socket_port; - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Determine if this is the only socket bound on this port list. */ - if (socket_ptr -> nx_udp_socket_bound_next == socket_ptr) - { - - /* Yes, this is the only socket on the port list. */ - - /* Clear the list head pointer and the next pointer in the socket. */ - ip_ptr -> nx_ip_udp_port_table[index] = NX_NULL; - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - } - else - { - - /* Relink the neighbors of this UDP socket. */ - - /* Update the links of the adjacent sockets. */ - (socket_ptr -> nx_udp_socket_bound_next) -> nx_udp_socket_bound_previous = - socket_ptr -> nx_udp_socket_bound_previous; - (socket_ptr -> nx_udp_socket_bound_previous) -> nx_udp_socket_bound_next = - socket_ptr -> nx_udp_socket_bound_next; - - /* Determine if the head of the port list points to the socket being removed. - If so, we need to move the head pointer. */ - if (ip_ptr -> nx_ip_udp_port_table[index] == socket_ptr) - { - - /* Yes, we need to move the port list head pointer. */ - ip_ptr -> nx_ip_udp_port_table[index] = socket_ptr -> nx_udp_socket_bound_next; - } - - /* Clear the next pointer in the socket to indicate it is no longer bound. */ - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - } - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Call wifi unbind. */ - nx_wifi_udp_socket_unbind(socket_ptr); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_tcp_client_socket_connect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_tcp_client_socket_connect.c deleted file mode 100644 index 26ac99e9..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_tcp_client_socket_connect.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_ip.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxd_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the connect request for the supplied socket. */ -/* If bound and not connected, this function will send the first SYN */ -/* message to the specified server to initiate the connection process. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_thread_suspend Suspend thread for connection */ -/* _nx_tcp_packet_send_syn Send SYN packet */ -/* _nx_ip_route_find Find a suitable outgoing */ -/* interface. */ -/* tx_mutex_get Obtain protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option) -{ - - /* Call wifi connect. */ - return(nx_wifi_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_udp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_udp_socket_send.c deleted file mode 100644 index cb0732c7..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxd_udp_socket_send.c +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_ip.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxd_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a UDP packet through the specified socket */ -/* with the input IP address and port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* NX_IPSEC_REJECTED Failed IPSec check */ -/* NX_NOT_BOUND Socket not bound to a port */ -/* NX_NO_INTERFACE_ADDRESS Socket interface not marked */ -/* valid */ -/* CALLS */ -/* */ -/* _nx_ip_packet_send Send UDP packet over IPv4 */ -/* _nx_ipv6_packet_send Send UDP packet over IPv6 */ -/* nx_ip_checksum_compute Compute UDP header checksum */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* _nxd_ipv6_interface_find Find interface for input */ -/* address in IP address table*/ -/* [_nx_packet_egress_sa_lookup] IPsec process */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, - NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, - UINT port) -{ - - /* Call wifi send. */ - return(nx_wifi_udp_socket_send(socket_ptr, packet_ptr, ip_address, port)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_client_socket_connect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_client_socket_connect.c deleted file mode 100644 index 4ba0eb22..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_client_socket_connect.c +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP client socket connect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Acctual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED TCP not enabled */ -/* NX_IP_ADDRESS_ERROR Invalid TCP server IP address */ -/* NX_INVALID_PORT Invalid TCP server port */ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_client_socket_connect Actual client socket connect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for valid TCP server address. */ - if (server_ip == NX_NULL) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check that the server IP address version is either IPv4 or IPv6. */ - if ((server_ip -> nxd_ip_version != NX_IP_VERSION_V4) && - (server_ip -> nxd_ip_version != NX_IP_VERSION_V6)) - { - - return(NX_IP_ADDRESS_ERROR); - } - -#ifndef NX_DISABLE_IPV4 - /* Check for a valid server IP address if the server_ip is version IPv4. */ - if (server_ip -> nxd_ip_version == NX_IP_VERSION_V4) - { - if (((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_A_MASK) != NX_IP_CLASS_A_TYPE) && - ((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_B_MASK) != NX_IP_CLASS_B_TYPE) && - ((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_C_MASK) != NX_IP_CLASS_C_TYPE)) - { - return(NX_IP_ADDRESS_ERROR); - } - } -#endif /* !NX_DISABLE_IPV4 */ - - /* Check for an invalid port. */ - if (((ULONG)server_port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket connect function. */ - status = _nxd_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c deleted file mode 100644 index b59268f8..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_tcp_socket_peer_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function performs error checking on the TCP socket peer info */ -/* get service. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to the TCP socket */ -/* peer_ip_address Pointer to the IP address */ -/* of the peer. */ -/* peer_port Pointer to the port number */ -/* of the peer. */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED TCP not enabled on IP instance*/ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_socket_peer_info_get Actual TCP socket peer info */ -/* get function */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *peer_ip_address, - ULONG *peer_port) -{ - -UINT status = NX_SUCCESS; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - if ((peer_ip_address == NX_NULL) || (peer_port == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket MSS get function. */ - //status = _nxd_tcp_socket_peer_info_get(socket_ptr, peer_ip_address, peer_port); - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_udp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_udp_socket_send.c deleted file mode 100644 index ab4455c4..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxde_udp_socket_send.c +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_packet.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* NX_PTR_ERROR Invalid pointer input or */ -/* invalid packet input */ -/* NX_NOT_ENABLED UDP not enabled on IP instance*/ -/* NX_IP_ADDRESS_ERROR Invalid IP address input */ -/* NX_INVALID_PORT Invalid UDP destination port */ -/* NX_UNDERFLOW Check for invalid packet */ -/* prepend pointer */ -/* NX_OVERFLOW Check for invalid packet */ -/* prepend pointer */ -/* */ -/* CALLS */ -/* */ -/* _nxd_udp_socket_send Actual UDP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, NXD_ADDRESS *ip_address, UINT port) -{ - -NX_PACKET *packet_ptr; -UINT status; -UINT ip_header_size = 0; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || (ip_address == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid packet pointers and packets not marked for allocation. */ - /* Cast the ULONG into a packet pointer. Since this is exactly what we wish to do, disable the lint warning with the following comment: */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr == NX_NULL) || - (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - - return(NX_PTR_ERROR); - } - - if ((ip_address -> nxd_ip_version != NX_IP_VERSION_V4) && - (ip_address -> nxd_ip_version != NX_IP_VERSION_V6)) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if ((INT)(packet_ptr -> nx_packet_prepend_ptr - packet_ptr -> nx_packet_data_start) < (INT)(ip_header_size + sizeof(NX_UDP_HEADER))) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket send function. */ - status = _nxd_udp_socket_send(socket_ptr, packet_ptr, ip_address, port); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_create.c deleted file mode 100644 index e5b41a3e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_create.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_ip_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the IP instance create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* name Name of this IP instance */ -/* ip_address Internet address for this IP */ -/* network_mask Network mask for IP address */ -/* default_pool Default packet pool */ -/* ip_link_driver User supplied IP link driver */ -/* memory_ptr Pointer memory area for IP */ -/* memory_size Size of IP memory area */ -/* priority Priority of IP helper thread */ -/* ip_control_block_size Size of NX_IP structure */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_create Actual IP instance create */ -/* function */ -/* tx_thread_identify Get current thread pointer */ -/* tx_thread_preemption_change Change preemption for thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size) -{ - -UINT status; -UINT old_threshold; -NX_IP *created_ip; -ULONG created_count; -TX_THREAD *current_thread; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (default_pool == NX_NULL) || - (default_pool -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (ip_control_block_size != (UINT)sizeof(NX_IP))) - { - return(NX_PTR_ERROR); - } - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, 0, &old_threshold); - } - - /* Loop to check for the IP instance already created. */ - created_ip = _nx_ip_created_ptr; - created_count = _nx_ip_created_count; - while (created_count--) - { - - /* Is the new ip already created? */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (ip_ptr == created_ip) - { - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Duplicate ip created, return an error! */ - return(NX_PTR_ERROR); - } - - /* Move to next entry. */ - created_ip = created_ip -> nx_ip_created_next; - } - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Call actual IP instance create function. */ - status = _nx_ip_create(ip_ptr, name, ip_address, network_mask, default_pool, ip_link_driver, - memory_ptr, memory_size, priority); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_delete.c deleted file mode 100644 index 1a06e2bb..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_ip_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_ip_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the IP instance delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_delete Actual IP instance delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_ip_delete(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual IP instance delete function. */ - status = _nx_ip_delete(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_allocate.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_allocate.c deleted file mode 100644 index ba24b1d6..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_allocate.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_allocate PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet allocate function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to allocate the packet */ -/* packet_ptr Pointer to place allocated */ -/* packet pointer */ -/* packet_type Type of packet to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Actual packet allocate service*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet type - for alignment purposes, it must be evenly divisible by the size - of a ULONG. */ - if (packet_type % sizeof(ULONG)) - { - return(NX_OPTION_ERROR); - } - - /* Check for a thread caller if the wait option specifies suspension. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet allocate function. */ - status = _nx_packet_allocate(pool_ptr, packet_ptr, packet_type, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_copy.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_copy.c deleted file mode 100644 index 7ea086c2..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_copy.c +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_copy PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet copy */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to source packet */ -/* new_packet_ptr Pointer to return packet */ -/* pool_ptr Pointer to packet pool to use */ -/* for new packet(s) */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_copy Actual packet copy function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (packet_ptr == NX_NULL) || (new_packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet copy function. */ - status = _nx_packet_copy(packet_ptr, new_packet_ptr, pool_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_append.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_append.c deleted file mode 100644 index 97ea5d65..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_append.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_append PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data append */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to packet to append */ -/* data_start Pointer to start of the data */ -/* data_size Number of bytes to append */ -/* pool_ptr Pool to allocate the packet */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_append Actual packet data append */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (packet_ptr == NX_NULL) || (data_start == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid size of data to append. */ - if (!data_size) - { - return(NX_SIZE_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet data append function. */ - status = _nx_packet_data_append(packet_ptr, data_start, data_size, pool_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_extract_offset.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_extract_offset.c deleted file mode 100644 index cf1d9d2b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_extract_offset.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_extract_offset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data extract */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* buffer_start Pointer to destination data area */ -/* buffer_length Size in bytes */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_extract_offset Acutal packet data extract offset */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied) -{ - - if (packet_ptr == NX_NULL) - { - return(NX_PTR_ERROR); - } - - if (buffer_start == NX_NULL) - { - return(NX_PTR_ERROR); - } - - if (bytes_copied == NX_NULL) - { - return(NX_PTR_ERROR); - } - - - return(_nx_packet_data_extract_offset(packet_ptr, offset, buffer_start, buffer_length, bytes_copied)); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_retrieve.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_retrieve.c deleted file mode 100644 index 9777f180..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_data_retrieve.c +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_retrieve PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data retrieve */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Packet to retrieve from */ -/* buffer_start Pointer to start of the buffer*/ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_retrieve Actual packet data retrieve */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((packet_ptr == NX_NULL) || (buffer_start == NX_NULL) || (bytes_copied == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Call actual packet data retrieve function. */ - status = _nx_packet_data_retrieve(packet_ptr, buffer_start, bytes_copied); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_length_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_length_get.c deleted file mode 100644 index fa82679b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_length_get.c +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_length_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet length get */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet */ -/* length Destination for the length */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_length_get Actual packet length get */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_length_get(NX_PACKET *packet_ptr, ULONG *length) -{ - -UINT status; - - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (length == NX_NULL)) - { - - /* Return an error! */ - return(NX_PTR_ERROR); - } - - /* Call actual packet length get function. */ - status = _nx_packet_length_get(packet_ptr, length); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_create.c deleted file mode 100644 index bd20a815..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_create.c +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* name_ptr Packet Pool string pointer */ -/* payload_size Size of packet payload */ -/* pool_start Starting address of pool */ -/* pool_size Number of bytes in pool */ -/* pool_control_block_size Size of packet pool control */ -/* block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_create Actual packet pool create */ -/* function */ -/* tx_thread_identify Get current thread pointer */ -/* tx_thread_preemption_change Change preemption for thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name_ptr, ULONG payload_size, - VOID *pool_start, ULONG pool_size, UINT pool_control_block_size) -{ - -UINT status; -ULONG rounded_payload_size; -ULONG rounded_pool_size; -ULONG header_size; -UINT old_threshold; -NX_PACKET_POOL *created_pool; -ULONG created_count; -CHAR *end_memory; -CHAR *created_end; -CHAR *payload_address; -VOID *rounded_pool_start; -TX_THREAD *current_thread; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_start == NX_NULL) || (pool_control_block_size != (UINT)sizeof(NX_PACKET_POOL))) - { - return(NX_PTR_ERROR); - } - - /* Align the starting address to four bytes. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_start = (VOID *)((((ALIGN_TYPE)pool_start + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Round the pool size down to something that is evenly divisible by alignment. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_size = (ULONG)(((pool_size - ((ALIGN_TYPE)rounded_pool_start - (ALIGN_TYPE)pool_start)) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((ALIGN_TYPE)rounded_pool_start + sizeof(NX_PACKET)); - - /* Align the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((((ALIGN_TYPE)payload_address + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the header size. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - header_size = (ULONG)((ALIGN_TYPE)payload_address - (ALIGN_TYPE)rounded_pool_start); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - rounded_payload_size = (ULONG)(((header_size + payload_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Check for an invalid pool and payload size. */ - if ((pool_size <= NX_PACKET_ALIGNMENT) || (!payload_size) || - ((rounded_payload_size + header_size) > rounded_pool_size)) - { - return(NX_SIZE_ERROR); - } - - /* Calculate the end of the pool memory area. */ - end_memory = ((CHAR *)pool_start) + (pool_size - 1); - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, 0, &old_threshold); - } - - /* Loop to check for the pool instance already created. */ - created_pool = _nx_packet_pool_created_ptr; - created_count = _nx_packet_pool_created_count; - while (created_count--) - { - - /* Calculate the created pool's end of memory. */ - created_end = created_pool -> nx_packet_pool_start + (created_pool -> nx_packet_pool_size - 1); - - /* Is the new pool already created? */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if ((pool_ptr == created_pool) || - ((pool_start >= (VOID *)created_pool -> nx_packet_pool_start) && (pool_start < (VOID *)created_end)) || - ((end_memory >= created_pool -> nx_packet_pool_start) && (end_memory < created_end))) - { - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Duplicate packet pool created, return an error! */ - return(NX_PTR_ERROR); - } - - /* Move to next entry. */ - created_pool = created_pool -> nx_packet_pool_created_next; - } - - /* Restore preemption. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Call actual packet pool create function. */ - status = _nx_packet_pool_create(pool_ptr, name_ptr, payload_size, pool_start, pool_size); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_delete.c deleted file mode 100644 index 8c9ceb59..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_delete.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_delete Actual packet pool delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_delete(NX_PACKET_POOL *pool_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual packet pool delete function. */ - status = _nx_packet_pool_delete(pool_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_info_get.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_info_get.c deleted file mode 100644 index ab98c3a6..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_info_get.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool information get */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to get information from */ -/* total_packets Destination for total packets */ -/* free_packets Destination for free packets */ -/* empty_pool_requests Destination for empty requests*/ -/* empty_pool_suspensions Destination for empty */ -/* suspensions */ -/* invalid_packet_releases Destination for invalid packet*/ -/* release requests */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_info_get Actual packet pool info get */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual packet pool information get function. */ - status = _nx_packet_pool_info_get(pool_ptr, total_packets, free_packets, empty_pool_requests, - empty_pool_suspensions, invalid_packet_releases); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c deleted file mode 100644 index 2cfa7f7a..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -#ifdef NX_ENABLE_LOW_WATERMARK -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS -#endif /* NX_ENABLE_LOW_WATERMARK */ - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_low_watermark_set PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool low watermark set*/ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to packet pool */ -/* low_watermark Low watermark of packet pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_low_watermark_set Actual packet pool low */ -/* watermark set function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark) -{ -#ifdef NX_ENABLE_LOW_WATERMARK - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual packet pool low watermark set function. */ - status = _nx_packet_pool_low_watermark_set(pool_ptr, low_watermark); - - /* Return completion status. */ - return(status); - -#else /* !NX_ENABLE_LOW_WATERMARK */ - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(low_watermark); - - return(NX_NOT_SUPPORTED); - -#endif /* NX_ENABLE_LOW_WATERMARK */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_release.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_release.c deleted file mode 100644 index 20af3f03..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_release.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet release */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Actual packet release */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr) -{ - -UINT status; -NX_PACKET *packet_ptr; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Call actual packet release function. */ - status = _nx_packet_release(packet_ptr); - - /* Determine if the packet release was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_transmit_release.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_transmit_release.c deleted file mode 100644 index 5d1a8f0e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_packet_transmit_release.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_transmit_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet transmit release */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_transmit_release Actual packet transmit release*/ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr) -{ - -UINT status; -NX_PACKET *packet_ptr; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Call actual packet transmit release function. */ - status = _nx_packet_transmit_release(packet_ptr); - - /* Determine if the packet release was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_bind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_bind.c deleted file mode 100644 index 0d8642d5..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_bind.c +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket bind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* port 16-bit TCP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_bind Actual TCP client socket bind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket bind function. */ - status = _nx_tcp_client_socket_bind(socket_ptr, port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_connect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_connect.c deleted file mode 100644 index 67d06848..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_connect.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP client socket connect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_connect Actual client socket connect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option) -{ - -#ifndef NX_DISABLE_IPV4 - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid IP address. */ - if (!server_ip) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for invalid IP address. */ - if (((server_ip & NX_IP_CLASS_A_MASK) != NX_IP_CLASS_A_TYPE) && - ((server_ip & NX_IP_CLASS_B_MASK) != NX_IP_CLASS_B_TYPE) && - ((server_ip & NX_IP_CLASS_C_MASK) != NX_IP_CLASS_C_TYPE)) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)server_port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket connect function. */ - status = _nx_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option); - - /* Return completion status. */ - return(status); -#else /* NX_DISABLE_IPV4 */ - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(server_ip); - NX_PARAMETER_NOT_USED(server_port); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_unbind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_unbind.c deleted file mode 100644 index 91d0393e..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_client_socket_unbind.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the client socket unbind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_unbind Actual client socket unbind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket unbind function. */ - status = _nx_tcp_client_socket_unbind(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_enable.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_enable.c deleted file mode 100644 index 505fa34f..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_enable.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP enable function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_enable Actual TCP enable function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_enable(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual TCP enable function. */ - status = _nx_tcp_enable(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_create.c deleted file mode 100644 index 636289d5..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_create.c +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new TCP socket */ -/* name Name of new TCP socket */ -/* type_of_service Type of service for this TCP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* window_size Size of socket's receive */ -/* window */ -/* tcp_urgent_data_callback Routine to call when urgent */ -/* data is received */ -/* tcp_disconnect_callback Routine to call when a */ -/* disconnect occurs */ -/* tcp_socket_size Size of TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_create Actual TCP socket create */ -/* function */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size) -{ - -UINT status; -NX_TCP_SOCKET *created_socket; -ULONG created_count; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (socket_ptr == NX_NULL) || - (tcp_socket_size != (UINT)sizeof(NX_TCP_SOCKET))) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Get protection mutex. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup created count and created socket pointer. */ - created_count = ip_ptr -> nx_ip_tcp_created_sockets_count; - created_socket = ip_ptr -> nx_ip_tcp_created_sockets_ptr; - - /* Loop to look for socket already created. */ - while (created_count--) - { - - /* Compare the new socket with the already created socket. */ - if (socket_ptr == created_socket) - { - - /* Error, socket already created! */ - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return error. */ - return(NX_PTR_ERROR); - } - - /* Move to next created socket. */ - created_socket = created_socket -> nx_tcp_socket_created_next; - } - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for valid type of service. */ - if (type_of_service & ~(NX_IP_TOS_MASK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid fragment option. */ - if ((fragment != NX_FRAGMENT_OKAY) && - (fragment != NX_DONT_FRAGMENT)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid time to live option. */ - if (((ULONG)time_to_live) > NX_IP_TIME_TO_LIVE_MASK) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid window size. */ - if (!window_size) - { - return(NX_OPTION_ERROR); - } - -#ifndef NX_ENABLE_TCP_WINDOW_SCALING - if (window_size > NX_LOWER_16_MASK) - { - return(NX_OPTION_ERROR); - } -#else - /* The maximum scale exponent is limited to 14. Section 2.2, RFC 7323. */ - if (window_size > ((1 << 30) - 1)) - { - return(NX_OPTION_ERROR); - } -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Call actual TCP socket create function. */ - status = _nx_tcp_socket_create(ip_ptr, socket_ptr, name, type_of_service, fragment, time_to_live, - window_size, tcp_urgent_data_callback, tcp_disconnect_callback); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_delete.c deleted file mode 100644 index 1d6563a3..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_delete Actual TCP socket delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket delete function. */ - status = _nx_tcp_socket_delete(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_disconnect.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_disconnect.c deleted file mode 100644 index ce85c635..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_disconnect.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the socket disconnect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_disconnect Actual TCP socket disconnect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket disconnect function. */ - status = _nx_tcp_socket_disconnect(socket_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_establish_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_establish_notify.c deleted file mode 100644 index 465a3ac2..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_establish_notify.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS -#endif /* NX_DISABLE_EXTENDED_NOTIFY_SUPPORT */ - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_establishe_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket establish notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_establish_notify Routine to call when the */ -/* connection handshake is */ -/* completed */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_establish_notify Actual socket establish notify*/ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - return(NX_NOT_SUPPORTED); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive.c deleted file mode 100644 index 2e680bff..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket receive */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_receive Actual TCP socket receive */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket receive function. */ - status = _nx_tcp_socket_receive(socket_ptr, packet_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive_notify.c deleted file mode 100644 index 0a8442a5..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_receive_notify.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket receive notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_receive_notify Actual socket receive notify */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - -UINT status; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid input pointers. */ - if (tcp_receive_notify == NX_NULL) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - - /* Call actual socket receive notify function. */ - status = _nx_tcp_socket_receive_notify(socket_ptr, tcp_receive_notify); - - /* Return to caller. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_send.c deleted file mode 100644 index 0795698b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_send.c +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_send Actual TCP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option) -{ - -NX_PACKET *packet_ptr; -UINT status; - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet pointer. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - return(NX_INVALID_PACKET); - } - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - -#ifndef NX_DISABLE_TCP_INFO - - /* Increment the TCP invalid packet count. */ - (socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_TCP_INFO - - /* Increment the TCP invalid packet count. */ - (socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket send function. */ - status = _nx_tcp_socket_send(socket_ptr, packet_ptr, wait_option); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_state_wait.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_state_wait.c deleted file mode 100644 index 794384c6..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_tcp_socket_state_wait.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_state_wait PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the socket state wait */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* desired_state Desired TCP state */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_state_wait Actual socket state wait */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check to see if TCP is enabled. */ - if (!(socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_packet_receive) - { - return(NX_NOT_ENABLED); - } - - /* Check for an invalid state request. */ - if ((desired_state < NX_TCP_CLOSED) || (desired_state > NX_TCP_LAST_ACK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket state wait function. */ - status = _nx_tcp_socket_state_wait(socket_ptr, desired_state, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_enable.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_enable.c deleted file mode 100644 index fe053e17..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_enable.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP enable function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_enable Actual UDP enable function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_enable(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual UDP enable function. */ - status = _nx_udp_enable(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_bind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_bind.c deleted file mode 100644 index 920a7c9c..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_bind.c +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket bind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_bind Actual UDP socket bind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket bind function. */ - status = _nx_udp_socket_bind(socket_ptr, port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_create.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_create.c deleted file mode 100644 index c3ac25d5..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_create.c +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new UDP socket */ -/* name Name of new UDP socket */ -/* type_of_service Type of service for this UDP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* queue_maximum Maximum depth of receive queue*/ -/* udp_socket_size Size of UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_create Actual UDP socket create */ -/* function */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum, UINT udp_socket_size) -{ - -UINT status; -NX_UDP_SOCKET *created_socket; -ULONG created_count; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || - (socket_ptr == NX_NULL) || (udp_socket_size != (UINT)sizeof(NX_UDP_SOCKET))) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Get protection mutex. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup created count and created socket pointer. */ - created_count = ip_ptr -> nx_ip_udp_created_sockets_count; - created_socket = ip_ptr -> nx_ip_udp_created_sockets_ptr; - - /* Loop to look for socket already created. */ - while (created_count--) - { - - /* Compare the new socket with the already created socket. */ - if (socket_ptr == created_socket) - { - - /* Error, socket already created! */ - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return error. */ - return(NX_PTR_ERROR); - } - - /* Move to next created socket. */ - created_socket = created_socket -> nx_udp_socket_created_next; - } - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for valid type of service. */ - if (type_of_service & ~(NX_IP_TOS_MASK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid fragment option. */ - if ((fragment != NX_FRAGMENT_OKAY) && - (fragment != NX_DONT_FRAGMENT)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid time to live option. */ - if (((ULONG)time_to_live) > NX_IP_TIME_TO_LIVE_MASK) - { - return(NX_OPTION_ERROR); - } - - /* Call actual UDP socket create function. */ - status = _nx_udp_socket_create(ip_ptr, socket_ptr, name, type_of_service, - fragment, time_to_live, queue_maximum); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_delete.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_delete.c deleted file mode 100644 index ec3a9200..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_delete Actual UDP socket delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_delete(NX_UDP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket delete function. */ - status = _nx_udp_socket_delete(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive.c deleted file mode 100644 index c87acbd4..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket receive */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_receive Actual UDP socket receive */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket receive function. */ - status = _nx_udp_socket_receive(socket_ptr, packet_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive_notify.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive_notify.c deleted file mode 100644 index 4566d27b..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_receive_notify.c +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket receive notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* udp_receive_notify Routine to call when one or */ -/* more received packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_receive_notify Actual socket receive notify */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)) -{ - -UINT status; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Call actual socket receive notify function. */ - status = _nx_udp_socket_receive_notify(socket_ptr, udp_receive_notify); - - /* Return to caller. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_send.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_send.c deleted file mode 100644 index 16d95fb0..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_send.c +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED UDP not enabled */ -/* NX_IP_ADDRESS_ERROR NULL address input */ -/* NX_INVALID_PORT Invalid UDP socket port */ -/* NX_UNDERFLOW Invalid pointer to packet data*/ -/* NX_OVERFLOW Invalid pointer to packet data*/ -/* NX_CALLER_ERROR Invalid (non thread) caller */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_send Actual UDP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port) -{ - -#ifndef NX_DISABLE_IPV4 -NX_PACKET *packet_ptr; -UINT status; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || - (packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - - return(NX_PTR_ERROR); - } - - /* Check for invalid IP address. */ - if (ip_address == NX_NULL) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket send function. */ - status = _nx_udp_socket_send(socket_ptr, packet_ptr, ip_address, port); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -#else - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(packet_ptr_ptr); - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(port); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_unbind.c b/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_unbind.c deleted file mode 100644 index f27852a3..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nxe_udp_socket_unbind.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket unbind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_unbind Actual UDP socket unbind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket unbind function. */ - status = _nx_udp_socket_unbind(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_port.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_port.h deleted file mode 100644 index beaddb61..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_port.h +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Port Specific */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* nx_port.h Cortex-M3/GNU */ -/* 6.1 */ -/* */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the NetX */ -/* real-time TCP/IP function identically on a variety of different */ -/* processor architectures. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* corrected the code of */ -/* getting system state, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PORT_H -#define NX_PORT_H - -/* Determine if the optional NetX user define file should be used. */ - -#ifdef NX_INCLUDE_USER_DEFINE_FILE - - -/* Yes, include the user defines in nx_user.h. The defines in this file may - alternately be defined on the command line. */ - -#include "nx_user.h" -#endif - - -/* Default to little endian, since this is what most ARM targets are. */ - -#define NX_LITTLE_ENDIAN 1 - - -/* By default IPv6 is enabled. */ - -#ifndef FEATURE_NX_IPV6 -#define FEATURE_NX_IPV6 -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_DISABLE_IPV6 -#undef FEATURE_NX_IPV6 -#endif /* !NX_DISABLE_IPV6 */ - -#include -#include -#include - - -/* Define various constants for the port. */ - -#ifndef NX_IP_PERIODIC_RATE -#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for - ports with 10ms timer interrupts. This - value may be defined instead at the - command line and this value will not be - used. */ -#endif - - -/* Define macros that swap the endian for little endian ports. */ -#ifdef NX_LITTLE_ENDIAN -#define NX_CHANGE_ULONG_ENDIAN(arg) \ - { \ - ULONG i; \ - ULONG tmp; \ - i = (UINT)arg; \ - /* i = A, B, C, D */ \ - tmp = i ^ (((i) >> 16) | (i << 16)); \ - /* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \ - tmp &= 0xff00ffff; \ - /* tmp = A^C, 0, C^A, D^B */ \ - i = ((i) >> 8) | (i<<24); \ - /* i = D, A, B, C */ \ - i = i ^ ((tmp) >> 8); \ - /* i = D, C, B, A */ \ - arg = i; \ - } -#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF) - - -#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \ - | (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24)) - -#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8)) - - -#ifndef htonl -#define htonl(val) __SWAP32__(val) -#endif /* htonl */ -#ifndef ntohl -#define ntohl(val) __SWAP32__(val) -#endif /* htonl */ - -#ifndef htons -#define htons(val) __SWAP16__(val) -#endif /*htons */ - -#ifndef ntohs -#define ntohs(val) __SWAP16__(val) -#endif /*htons */ - - -#else -#define NX_CHANGE_ULONG_ENDIAN(a) -#define NX_CHANGE_USHORT_ENDIAN(a) - -#ifndef htons -#define htons(val) (val) -#endif /* htons */ - -#ifndef ntohs -#define ntohs(val) (val) -#endif /* ntohs */ - -#ifndef ntohl -#define ntohl(val) (val) -#endif - -#ifndef htonl -#define htonl(val) (val) -#endif /* htonl */ -#endif - - - -/* Define several macros for the error checking shell in NetX. */ - -#ifndef TX_TIMER_PROCESS_IN_ISR - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern TX_THREAD _tx_timer_thread; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \ - return(NX_CALLER_ERROR); - - -#else - - - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \ - return(NX_CALLER_ERROR); - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \ - return(NX_CALLER_ERROR); - -#endif - - -/* Define the version ID of NetX. This may be utilized by the application. */ - -#ifdef NX_SYSTEM_INIT -CHAR _nx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * NetX Duo Cortex-M3/GNU Version 6.1 *"; -#else -extern CHAR _nx_version_id[]; -#endif - -#endif - diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_user.h b/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_user.h index a4b6798e..5f62fab5 100644 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_user.h +++ b/Renesas/RX65N_Cloud_Kit/lib/netxduo/nx_user.h @@ -9,60 +9,29 @@ /* */ /**************************************************************************/ - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Specific */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* nx_user.h PORTABLE C */ -/* 6.1 */ -/* */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file contains user defines for configuring NetX in specific */ -/* ways. This file will have an effect only if the application and */ -/* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */ -/* Note that all the defines in this file may also be made on the */ -/* command line when building NetX library and application objects. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - #ifndef NX_USER_H #define NX_USER_H +#define NX_ENABLE_TCPIP_OFFLOAD +#define NX_ENABLE_INTERFACE_CAPABILITY +#define NX_DISABLE_IPV6 + +/* Secure */ #define NX_SECURE_ENABLE -#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT -#define NX_ENABLE_IP_PACKET_FILTER -#define NX_SNTP_CLIENT_MIN_SERVER_STRATUM 3 -#define NX_SNTP_CLIENT_MESSAGE_CHECK_DISABLE +/* MQTT */ +#define NXD_MQTT_PING_TIMEOUT_DELAY 500 +#define NXD_MQTT_SOCKET_TIMEOUT 0 +/* Azure IoT Security Module */ +#define NX_ENABLE_IP_PACKET_FILTER + +/* Enable MQTT Cloud */ #define NXD_MQTT_CLOUD_ENABLE +#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT -#define NX_AZURE_IOT_PROVISIONING_CLIENT_CONNECT_WAIT_OPTION (40 * NX_IP_PERIODIC_RATE) +/* SNTP */ +#define NX_SNTP_CLIENT_MIN_SERVER_STRATUM 3 /* NetX */ #define NX_DNS_CLIENT_USER_CREATE_PACKET_POOL diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/readme.md b/Renesas/RX65N_Cloud_Kit/lib/netxduo/readme.md deleted file mode 100644 index cdbca135..00000000 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -# NetXDuo -This folder contains a fork of NetXDuo that has been modified to utilize the [Inventek ISM43362](https://www.inventeksys.com/ism4336-m3g-l44-e-embedded-serial-to-wifi-module) WiFi module. The Inventek WiFi module has an integrated TCP/IP stack and communication with the device is through an AT command set. - -Due to the integrated TCP/IP stack on the Inventek module, the TCP/IP stack has been removed from the NetXDuo layer and replaced with a redirection to the underlying AT command set. - -This is a demonstration of how the NetXDuo networking stack can be modified to work with radically different networking modules, while still providing a standardized interface layer. diff --git a/Renesas/RX65N_Cloud_Kit/lib/rx_driver_package/src/r_wifi_sx_ulpgn/r_wifi_sx_ulpgn_api.c b/Renesas/RX65N_Cloud_Kit/lib/rx_driver_package/src/r_wifi_sx_ulpgn/r_wifi_sx_ulpgn_api.c index 11bf34fb..ae28e471 100644 --- a/Renesas/RX65N_Cloud_Kit/lib/rx_driver_package/src/r_wifi_sx_ulpgn/r_wifi_sx_ulpgn_api.c +++ b/Renesas/RX65N_Cloud_Kit/lib/rx_driver_package/src/r_wifi_sx_ulpgn/r_wifi_sx_ulpgn_api.c @@ -1688,10 +1688,13 @@ int32_t R_WIFI_SX_ULPGN_SendSocket (int32_t socket_number, uint8_t *data, int32_ } sended_length += current_send_length; - if(-1 == socket_check_timeout(socket_number, 0)) - { - break; - } + if(0 != timeout_ms) + { + if(-1 == socket_check_timeout(socket_number, 0)) + { + break; + } + } } api_ret = sended_length; @@ -3133,7 +3136,7 @@ static int32_t socket_check_timeout(uint8_t socket_number, uint8_t flag) { if(*thistime >= *endtime || *thistime < *starttime) { - return -1; + return -1; } } else diff --git a/STMicroelectronics/STM32L4_L4+/CMakeLists.txt b/STMicroelectronics/STM32L4_L4+/CMakeLists.txt index cd8e5fe1..5f29565e 100644 --- a/STMicroelectronics/STM32L4_L4+/CMakeLists.txt +++ b/STMicroelectronics/STM32L4_L4+/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -26,6 +26,6 @@ project(stm32l4_azure_iot C ASM) # Disable common networking component, STM has it's own set(DISABLE_COMMON_NETWORK true) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/STMicroelectronics/STM32L4_L4+/app/nx_client.c b/STMicroelectronics/STM32L4_L4+/app/nx_client.c index 2b59eb63..fb9ba011 100644 --- a/STMicroelectronics/STM32L4_L4+/app/nx_client.c +++ b/STMicroelectronics/STM32L4_L4+/app/nx_client.c @@ -14,12 +14,14 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" #include "azure_pnp_info.h" +#define TELEMETRY_SCRATCH_BUFFER_SIZE 128 +#define CALLBACK_SCRATCH_BUFFER_SIZE 128 + #define IOT_MODEL_ID "dtmi:azurertos:devkit:gsg;2" #define TELEMETRY_TEMPERATURE "temperature" @@ -34,7 +36,7 @@ static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -83,7 +85,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { float temperature = BSP_TSENSOR_ReadTemp(); @@ -100,69 +102,72 @@ static void set_led_state(bool level) { if (level) { - printf("LED is turned ON\r\n"); + printf("\tLED is turned ON\r\n"); BSP_LED_On(LED_GREEN); } else { - printf("LED is turned OFF\r\n"); + printf("\tLED is turned OFF\r\n"); BSP_LED_Off(LED_GREEN); } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); set_led_state(arg); - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -171,17 +176,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -232,9 +243,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -242,15 +253,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -263,7 +274,8 @@ UINT azure_iot_nx_client_entry( tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry( + &azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/STMicroelectronics/STM32L4_L4+/app/stm_networking.c b/STMicroelectronics/STM32L4_L4+/app/stm_networking.c index d4709a6f..f0c4da49 100644 --- a/STMicroelectronics/STM32L4_L4+/app/stm_networking.c +++ b/STMicroelectronics/STM32L4_L4+/app/stm_networking.c @@ -4,16 +4,18 @@ #include "stm_networking.h" #include "nx_api.h" +#include "nx_driver_stm32l4.h" #include "nx_secure_tls_api.h" -#include "nx_wifi.h" #include "nxd_dns.h" #include "wifi.h" -#define THREADX_PACKET_COUNT 20 -#define THREADX_PACKET_SIZE 1200 // Set the default value to 1200 since WIFI payload size (ES_WIFI_PAYLOAD_SIZE) is 1200 -#define THREADX_POOL_SIZE ((THREADX_PACKET_SIZE + sizeof(NX_PACKET)) * THREADX_PACKET_COUNT) +#define THREADX_IP_STACK_SIZE 2048 +#define THREADX_PACKET_COUNT 20 +#define THREADX_PACKET_SIZE 1200 // Set the default value to 1200 since WIFI payload size (ES_WIFI_PAYLOAD_SIZE) is 1200 +#define THREADX_POOL_SIZE ((THREADX_PACKET_SIZE + sizeof(NX_PACKET)) * THREADX_PACKET_COUNT) +static UCHAR threadx_ip_stack[THREADX_IP_STACK_SIZE]; static UCHAR threadx_ip_pool[THREADX_POOL_SIZE]; NX_IP nx_ip; @@ -115,26 +117,6 @@ static bool wifi_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) printf("SUCCESS: WiFi connected to %s\r\n\r\n", ssid); - printf("Initializing DHCP\r\n"); - - uint8_t ip_address[4]; - if (WIFI_GetIP_Address(ip_address) != WIFI_STATUS_OK) - { - return false; - } - - uint8_t gateway_address[4]; - if (WIFI_GetGateway_Address(gateway_address) != WIFI_STATUS_OK) - { - return false; - } - - // Output IP address and gateway address - print_address("IP address", ip_address); - print_address("Gateway", gateway_address); - - printf("SUCCESS: DHCP initialized\r\n\r\n"); - return true; } @@ -149,7 +131,7 @@ static UINT dns_create() status = nx_dns_create(&nx_dns_client, &nx_ip, (UCHAR*)"DNS Client"); if (status != NX_SUCCESS) { - printf("ERROR: Failed to create DNS (%0x02)\r\n", status); + printf("ERROR: Failed to create DNS (0x%04x)\r\n", status); return status; } @@ -171,27 +153,30 @@ static UINT dns_create() return NX_NOT_SUCCESSFUL; } + // Output DNS Server address + print_address("DNS address", dns_address_1); + // Add an IPv4 server address to the Client list. status = nx_dns_server_add( &nx_dns_client, IP_ADDRESS(dns_address_1[0], dns_address_1[1], dns_address_1[2], dns_address_1[3])); if (status != NX_SUCCESS) { - printf("ERROR: Failed to add dns server (%0x02)\r\n", status); + printf("ERROR: Failed to add DNS server (0x%04x)\r\n", status); nx_dns_delete(&nx_dns_client); return status; } - // Output DNS Server address - print_address("DNS address", dns_address_1); - printf("SUCCESS: DNS client initialized\r\n\r\n"); return NX_SUCCESS; } -int stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) +UINT stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) { UINT status; + UCHAR ip_address[4]; + UCHAR ip_mask[4]; + UCHAR gateway_address[4]; // Intialize Wifi if (!wifi_init(ssid, password, mode)) @@ -199,6 +184,19 @@ int stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) return NX_NOT_SUCCESSFUL; } + printf("Initializing DHCP\r\n"); + + // Get WIFI information + WIFI_GetIP_Address(ip_address); + WIFI_GetIP_Mask(ip_mask); + WIFI_GetGateway_Address(gateway_address); + + // Output IP address and gateway address + print_address("IP address", ip_address); + print_address("Gateway", gateway_address); + + printf("SUCCESS: DHCP initialized\r\n\r\n"); + // Initialize the NetX system nx_system_initialize(); @@ -212,7 +210,15 @@ int stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) } // Create an IP instance - status = nx_ip_create(&nx_ip, "NetX IP Instance 0", 0, 0, &nx_pool, NULL, NULL, 0, 0); + status = nx_ip_create(&nx_ip, + "NetX IP Instance 0", + IP_ADDRESS(ip_address[0], ip_address[1], ip_address[2], ip_address[3]), + IP_ADDRESS(ip_mask[0], ip_mask[1], ip_mask[2], ip_mask[3]), + &nx_pool, + nx_driver_stm32l4, + (UCHAR*)threadx_ip_stack, + THREADX_IP_STACK_SIZE, + 1); if (status != NX_SUCCESS) { nx_packet_pool_delete(&nx_pool); @@ -220,14 +226,35 @@ int stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode) return status; } - // Initialize NetX WiFi - status = nx_wifi_initialize(&nx_ip, &nx_pool); + // Set gateway address + status = nx_ip_gateway_address_set( + &nx_ip, IP_ADDRESS(gateway_address[0], gateway_address[1], gateway_address[2], gateway_address[3])); if (status != NX_SUCCESS) { nx_ip_delete(&nx_ip); nx_packet_pool_delete(&nx_pool); - printf("ERROR: WiFi initialize fail.\r\n"); - return status; + printf("THREADX platform initialize fail: Gateway set FAIL.\r\n"); + return false; + } + + // Enable TCP traffic + status = nx_tcp_enable(&nx_ip); + if (status != NX_SUCCESS) + { + nx_ip_delete(&nx_ip); + nx_packet_pool_delete(&nx_pool); + printf("THREADX platform initialize fail: TCP ENABLE FAIL.\r\n"); + return false; + } + + // Enable UDP traffic + status = nx_udp_enable(&nx_ip); + if (status != NX_SUCCESS) + { + nx_ip_delete(&nx_ip); + nx_packet_pool_delete(&nx_pool); + printf("THREADX platform initialize fail: UDP ENABLE FAIL.\r\n"); + return false; } // Initialize TLS diff --git a/STMicroelectronics/STM32L4_L4+/app/stm_networking.h b/STMicroelectronics/STM32L4_L4+/app/stm_networking.h index 3f55d430..3624728a 100644 --- a/STMicroelectronics/STM32L4_L4+/app/stm_networking.h +++ b/STMicroelectronics/STM32L4_L4+/app/stm_networking.h @@ -9,10 +9,10 @@ #include "azure_config.h" -extern NX_IP nx_ip; +extern NX_IP nx_ip; extern NX_PACKET_POOL nx_pool; -extern NX_DNS nx_dns_client; +extern NX_DNS nx_dns_client; -int stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode); +UINT stm32_network_init(CHAR* ssid, CHAR* password, WiFi_Mode mode); #endif // _NETWORKING_H \ No newline at end of file diff --git a/STMicroelectronics/STM32L4_L4+/azure-pipelines-l4s5.yml b/STMicroelectronics/STM32L4_L4+/azure-pipelines-l4s5.yml index 4e3f6347..1882d091 100644 --- a/STMicroelectronics/STM32L4_L4+/azure-pipelines-l4s5.yml +++ b/STMicroelectronics/STM32L4_L4+/azure-pipelines-l4s5.yml @@ -36,7 +36,7 @@ jobs: scriptType: 'ps' scriptLocation: 'scriptPath' scriptPath: '$(Build.SourcesDirectory)\Device-Lab\generate_creds.ps1' - arguments: '$(Build.SourcesDirectory)\getting-started\core\model' + arguments: '$(Build.SourcesDirectory)\getting-started\shared\model' useGlobalConfig: true displayName: "Start Certification" diff --git a/STMicroelectronics/STM32L4_L4+/azure-pipelines.yml b/STMicroelectronics/STM32L4_L4+/azure-pipelines.yml index 5bcdf4a5..e8b35de2 100644 --- a/STMicroelectronics/STM32L4_L4+/azure-pipelines.yml +++ b/STMicroelectronics/STM32L4_L4+/azure-pipelines.yml @@ -36,7 +36,7 @@ jobs: scriptType: 'ps' scriptLocation: 'scriptPath' scriptPath: '$(Build.SourcesDirectory)\Device-Lab\generate_creds.ps1' - arguments: '$(Build.SourcesDirectory)\getting-started\core\model' + arguments: '$(Build.SourcesDirectory)\getting-started\shared\model' useGlobalConfig: true displayName: "Start Certification" diff --git a/STMicroelectronics/STM32L4_L4+/lib/CMakeLists.txt b/STMicroelectronics/STM32L4_L4+/lib/CMakeLists.txt index 84b3231f..82e9b327 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/CMakeLists.txt +++ b/STMicroelectronics/STM32L4_L4+/lib/CMakeLists.txt @@ -10,14 +10,12 @@ set(NXD_ENABLE_AZURE_IOT ON CACHE BOOL "Enable Azure IoT") set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo") # Azure Security Center -set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE OFF CACHE BOOL "Security Center") +set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE ON CACHE BOOL "Security Center") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) - -# Using a local copy of NetXDuo that has been customized for this boards WiFi module -add_subdirectory(netxduo) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) add_subdirectory(stm32cubel4) add_subdirectory(netx_driver) diff --git a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/CMakeLists.txt b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/CMakeLists.txt index 37916c67..1949c153 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/CMakeLists.txt +++ b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES inventek/es_wifi_io.c inventek/wifi.c - nx_wifi.c + nx_driver_stm32l4.c ) set(PROJECT netx_driver) @@ -24,5 +24,6 @@ target_link_libraries(${PROJECT} target_include_directories(${PROJECT} PUBLIC + . inventek ) diff --git a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.c b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.c index 99df1b97..9f85e751 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.c +++ b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.c @@ -138,6 +138,22 @@ WIFI_Status_t WIFI_GetIP_Address (uint8_t *ipaddr) return ret; } +/** + * @brief This function retrieves the WiFi interface's IP mask. + * @retval Operation Status. + */ +WIFI_Status_t WIFI_GetIP_Mask (uint8_t *mask) +{ + WIFI_Status_t ret = WIFI_STATUS_ERROR; + + if (ES_WIFI_IsConnected(&EsWifiObj) == 1) + { + memcpy(mask, EsWifiObj.NetSettings.IP_Mask, 4); + ret = WIFI_STATUS_OK; + } + return ret; +} + /** * @brief This function retrieves the WiFi interface's Gateway address. * @retval Operation Status. diff --git a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.h b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.h index 25dd0970..25c6c1f6 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.h +++ b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/inventek/wifi.h @@ -124,6 +124,7 @@ WIFI_Status_t WIFI_Connect( const char* Password, WIFI_Ecn_t ecn); WIFI_Status_t WIFI_GetIP_Address(uint8_t *ipaddr); +WIFI_Status_t WIFI_GetIP_Mask(uint8_t *mask); WIFI_Status_t WIFI_GetDNS_Address (uint8_t *DNS1addr,uint8_t *DNS2addr); WIFI_Status_t WIFI_GetGateway_Address (uint8_t *Gateway_addr); WIFI_Status_t WIFI_GetMAC_Address(uint8_t *mac); diff --git a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.c b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.c new file mode 100644 index 00000000..9661b676 --- /dev/null +++ b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.c @@ -0,0 +1,1846 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) Microsoft Corporation. All rights reserved. */ +/* */ +/* This software is licensed under the Microsoft Software License */ +/* Terms for Microsoft Azure RTOS. Full text of the license can be */ +/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ +/* and in the root directory of this software. */ +/* */ +/**************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** NetX Component */ +/** */ +/** Ethernet driver for STM32L4 family of microprocessors */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Indicate that driver source is being compiled. */ + +#include "nx_driver_stm32l4.h" + +#ifndef NX_ENABLE_TCPIP_OFFLOAD +#error "NX_ENABLE_TCPIP_OFFLOAD must be defined to use this driver" +#endif /* NX_ENABLE_TCPIP_OFFLOAD */ + +#ifndef NX_DRIVER_IP_MTU +#define NX_DRIVER_IP_MTU 1200 +#endif /* NX_DRIVER_IP_MTU */ + +#ifndef NX_DRIVER_RECEIVE_QUEUE_SIZE +#define NX_DRIVER_RECEIVE_QUEUE_SIZE 10 +#endif /* NX_DRIVER_RECEIVE_QUEUE_SIZE */ + +#ifndef NX_DRIVER_STACK_SIZE +#define NX_DRIVER_STACK_SIZE 1024 +#endif /* NX_DRIVER_STACK_SIZE */ + +/* Interval to receive packets when there is no packet. The default value is 100 ticks which is 1s. */ +#ifndef NX_DRIVER_THREAD_INTERVAL +#define NX_DRIVER_THREAD_INTERVAL NX_IP_PERIODIC_RATE +#endif /* NX_DRIVER_THREAD_INTERVAL */ + +/* Define the maximum sockets at the same time. This is limited by hardware TCP/IP on STM32L4. */ +#define NX_DRIVER_SOCKETS_MAXIMUM 4 + +/* Define maximum server pending connections. */ +#ifndef NX_DRIVER_SERVER_LISTEN_COUNT +#define NX_DRIVER_SERVER_LISTEN_COUNT 1 +#endif + +/* Define the maximum wait timeout in ms for socket send. This is limited by hardware TCP/IP on STM32L4. */ +#define NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM 3000 + +#define NX_DRIVER_CAPABILITY (NX_INTERFACE_CAPABILITY_TCPIP_OFFLOAD) + + +/* Define basic netword driver information typedef. */ + +typedef struct NX_DRIVER_INFORMATION_STRUCT +{ + + /* NetX IP instance that this driver is attached to. */ + NX_IP *nx_driver_information_ip_ptr; + + /* Driver's current states. */ + ULONG nx_driver_information_states; + + /* Packet pool used for receiving packets. */ + NX_PACKET_POOL *nx_driver_information_packet_pool_ptr; + + /* Define the driver interface association. */ + NX_INTERFACE *nx_driver_information_interface; +} NX_DRIVER_INFORMATION; + + +/* Define socket structure for hardware TCP/IP. */ + +typedef struct NX_DRIVER_SOCKET_STRUCT +{ + VOID *socket_ptr; + UINT protocol; + ULONG local_ip; + ULONG remote_ip; + USHORT local_port; + USHORT remote_port; + UCHAR tcp_connected; + UCHAR is_client; + USHORT reseverd; +} NX_DRIVER_SOCKET; + +static NX_DRIVER_INFORMATION nx_driver_information; +static NX_DRIVER_SOCKET nx_driver_sockets[NX_DRIVER_SOCKETS_MAXIMUM]; +static TX_THREAD nx_driver_thread; +static UCHAR nx_driver_thread_stack[NX_DRIVER_STACK_SIZE]; + +/* Define the routines for processing each driver entry request. The contents of these routines will change with + each driver. However, the main driver entry function will not change, except for the entry function name. */ + +static VOID _nx_driver_interface_attach(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_initialize(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_enable(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_disable(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_multicast_join(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_multicast_leave(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_get_status(NX_IP_DRIVER *driver_req_ptr); +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +static VOID _nx_driver_capability_get(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_capability_set(NX_IP_DRIVER *driver_req_ptr); +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ +static VOID _nx_driver_deferred_processing(NX_IP_DRIVER *driver_req_ptr); +static VOID _nx_driver_thread_entry(ULONG thread_input); +static UINT _nx_driver_tcpip_handler(struct NX_IP_STRUCT *ip_ptr, + struct NX_INTERFACE_STRUCT *interface_ptr, + VOID *socket_ptr, UINT operation, NX_PACKET *packet_ptr, + NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip, + UINT local_port, UINT *remote_port, UINT wait_option); + +/* Define the prototypes for the hardware implementation of this driver. The contents of these routines are + driver-specific. */ + +static UINT _nx_driver_hardware_initialize(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_enable(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_disable(NX_IP_DRIVER *driver_req_ptr); +static UINT _nx_driver_hardware_get_status(NX_IP_DRIVER *driver_req_ptr); +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +static UINT _nx_driver_hardware_capability_set(NX_IP_DRIVER *driver_req_ptr); +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* nx_driver_stm32l4 PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This is the entry point of the NetX Driver. This driver */ +/* function is responsible for initializing the network controller, */ +/* enabling or disabling the controller as need, preparing */ +/* a packet for transmission, and getting status information. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr The driver request from the */ +/* IP layer. */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_interface_attach Process attach request */ +/* _nx_driver_initialize Process initialize request */ +/* _nx_driver_enable Process link enable request */ +/* _nx_driver_disable Process link disable request */ +/* _nx_driver_multicast_join Process multicast join request*/ +/* _nx_driver_multicast_leave Process multicast leave req */ +/* _nx_driver_get_status Process get status request */ +/* _nx_driver_deferred_processing Drive deferred processing */ +/* _nx_driver_capability_get Get interface capability */ +/* _nx_driver_capability_set Set interface capability */ +/* */ +/* CALLED BY */ +/* */ +/* IP layer */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +VOID nx_driver_stm32l4(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Process according to the driver request type in the IP control + block. */ + switch (driver_req_ptr -> nx_ip_driver_command) + { + + case NX_LINK_INTERFACE_ATTACH: + { + /* Process link interface attach requests. */ + _nx_driver_interface_attach(driver_req_ptr); + break; + } + + case NX_LINK_INITIALIZE: + { + + /* Process link initialize requests. */ + _nx_driver_initialize(driver_req_ptr); + break; + } + + case NX_LINK_ENABLE: + { + + /* Process link enable requests. */ + _nx_driver_enable(driver_req_ptr); + break; + } + + case NX_LINK_DISABLE: + { + + /* Process link disable requests. */ + _nx_driver_disable(driver_req_ptr); + break; + } + + + case NX_LINK_ARP_SEND: + case NX_LINK_ARP_RESPONSE_SEND: + case NX_LINK_PACKET_BROADCAST: + case NX_LINK_RARP_SEND: + case NX_LINK_PACKET_SEND: + { + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + nx_packet_transmit_release(driver_req_ptr -> nx_ip_driver_packet); + break; + } + + + case NX_LINK_MULTICAST_JOIN: + { + + /* Process multicast join requests. */ + _nx_driver_multicast_join(driver_req_ptr); + break; + } + + + case NX_LINK_MULTICAST_LEAVE: + { + + /* Process multicast leave requests. */ + _nx_driver_multicast_leave(driver_req_ptr); + break; + } + + case NX_LINK_GET_STATUS: + { + + /* Process get status requests. */ + _nx_driver_get_status(driver_req_ptr); + break; + } + + case NX_LINK_DEFERRED_PROCESSING: + { + + /* Process driver deferred requests. */ + + /* Process a device driver function on behave of the IP thread. */ + _nx_driver_deferred_processing(driver_req_ptr); + + break; + } + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY + case NX_INTERFACE_CAPABILITY_GET: + { + + /* Process get capability requests. */ + _nx_driver_capability_get(driver_req_ptr); + break; + } + + case NX_INTERFACE_CAPABILITY_SET: + { + + /* Process set capability requests. */ + _nx_driver_capability_set(driver_req_ptr); + break; + } +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + default: + + + /* Invalid driver request. */ + + /* Return the unhandled command status. */ + driver_req_ptr -> nx_ip_driver_status = NX_UNHANDLED_COMMAND; + + /* Default to successful return. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_interface_attach PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the interface attach request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_interface_attach(NX_IP_DRIVER *driver_req_ptr) +{ +#ifdef NX_ENABLE_INTERFACE_CAPABILITY + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_capability_flag = NX_DRIVER_CAPABILITY; +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + /* Return successful status. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_initialize PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the initialize request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_initialize. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_initialize Process initialize request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_initialize(NX_IP_DRIVER *driver_req_ptr) +{ + +NX_IP *ip_ptr; +NX_INTERFACE *interface_ptr; +UINT status; + + /* Setup the driver state to not initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_NOT_INITIALIZED; + + /* Setup the IP pointer from the driver request. */ + ip_ptr = driver_req_ptr -> nx_ip_driver_ptr; + + /* Setup interface pointer. */ + interface_ptr = driver_req_ptr -> nx_ip_driver_interface; + + /* Initialize the driver's information structure. */ + + /* Default IP pointer to NULL. */ + nx_driver_information.nx_driver_information_ip_ptr = NX_NULL; + + /* Setup the default packet pool for the driver's received packets. */ + nx_driver_information.nx_driver_information_packet_pool_ptr = ip_ptr -> nx_ip_default_packet_pool; + + /* Call the hardware-specific ethernet controller initialization. */ + status = _nx_driver_hardware_initialize(driver_req_ptr); + + /* Determine if the request was successful. */ + if (status == NX_SUCCESS) + { + + /* Successful hardware initialization. */ + + /* Setup driver information to point to IP pointer. */ + nx_driver_information.nx_driver_information_ip_ptr = ip_ptr; + nx_driver_information.nx_driver_information_interface = interface_ptr; + + /* Setup the link maximum transfer unit. */ + interface_ptr -> nx_interface_ip_mtu_size = NX_DRIVER_IP_MTU; + + /* Setup the physical address of this IP instance. */ + /* TODO: Use WIFI_GetMAC_Address() to set the real value. */ + interface_ptr -> nx_interface_physical_address_msw = 0; + interface_ptr -> nx_interface_physical_address_lsw = 0; + + /* Indicate to the IP software that IP to physical mapping + is required. */ + interface_ptr -> nx_interface_address_mapping_needed = NX_FALSE; + + /* Move the driver's state to initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_INITIALIZED; + + /* Indicate successful initialize. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } + else + { + + /* Initialization failed. Indicate that the request failed. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_enable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the initialize request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_enable. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_enable Process enable request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_enable(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + /* See if we can honor the NX_LINK_ENABLE request. */ + if (nx_driver_information.nx_driver_information_states < NX_DRIVER_STATE_INITIALIZED) + { + + /* Mark the request as not successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + return; + } + + /* Check if it is enabled by someone already */ + if (nx_driver_information.nx_driver_information_states >= NX_DRIVER_STATE_LINK_ENABLED) + { + + /* Yes, the request has already been made. */ + driver_req_ptr -> nx_ip_driver_status = NX_ALREADY_ENABLED; + return; + } + + /* Call hardware specific enable. */ + status = _nx_driver_hardware_enable(driver_req_ptr); + + /* Was the hardware enable successful? */ + if (status == NX_SUCCESS) + { + + /* Update the driver state to link enabled. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_LINK_ENABLED; + + /* Mark request as successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Mark the IP interface as link up. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_link_up = NX_TRUE; + + /* Set TCP/IP callback function. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_tcpip_offload_handler = _nx_driver_tcpip_handler; + } + else + { + + /* Enable failed. Indicate that the request failed. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_disable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the disable request. The processing */ +/* in this function is generic. All ethernet controller logic is to */ +/* be placed in _nx_driver_hardware_disable. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_disable Process disable request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_disable(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + /* Check if the link is enabled. */ + if (nx_driver_information.nx_driver_information_states != NX_DRIVER_STATE_LINK_ENABLED) + { + + /* The link is not enabled, so just return an error. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + return; + } + + /* Call hardware specific disable. */ + status = _nx_driver_hardware_disable(driver_req_ptr); + + /* Was the hardware disable successful? */ + if (status == NX_SUCCESS) + { + + /* Mark the IP interface as link down. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_link_up = NX_FALSE; + + /* Update the driver state back to initialized. */ + nx_driver_information.nx_driver_information_states = NX_DRIVER_STATE_INITIALIZED; + + /* Mark request as successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + + /* Clear the TCP/IP callback function. */ + driver_req_ptr -> nx_ip_driver_interface -> nx_interface_tcpip_offload_handler = NX_NULL; + } + else + { + + /* Disable failed, return an error. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_multicast_join PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the multicast join request. The processing */ +/* in this function is generic. All ethernet controller multicast join */ +/* logic is to be placed in _nx_driver_hardware_multicast_join. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_multicast_join(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Not supported. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_multicast_leave PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the multicast leave request. The */ +/* processing in this function is generic. All ethernet controller */ +/* multicast leave logic is to be placed in */ +/* _nx_driver_hardware_multicast_leave. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_multicast_leave(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Not supported. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_get_status PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the get status request. The processing */ +/* in this function is generic. All ethernet controller get status */ +/* logic is to be placed in _nx_driver_hardware_get_status. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _nx_driver_hardware_get_status Process get status request */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_get_status(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + + /* Call hardware specific get status function. */ + status = _nx_driver_hardware_get_status(driver_req_ptr); + + /* Determine if there was an error. */ + if (status != NX_SUCCESS) + { + + /* Indicate an unsuccessful request. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } + else + { + + /* Indicate the request was successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } +} + + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_capability_get PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the get capability request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_capability_get(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Return the capability of the Ethernet controller. */ + *(driver_req_ptr -> nx_ip_driver_return_ptr) = NX_DRIVER_CAPABILITY; + + /* Return the success status. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_capability_set PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the set capability request. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_capability_set(NX_IP_DRIVER *driver_req_ptr) +{ + +UINT status; + + + /* Call hardware specific get status function. */ + status = _nx_driver_hardware_capability_set(driver_req_ptr); + + /* Determine if there was an error. */ + if (status != NX_SUCCESS) + { + + /* Indicate an unsuccessful request. */ + driver_req_ptr -> nx_ip_driver_status = NX_DRIVER_ERROR; + } + else + { + + /* Indicate the request was successful. */ + driver_req_ptr -> nx_ip_driver_status = NX_SUCCESS; + } +} +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_deferred_processing PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the deferred ISR action within the context */ +/* of the IP thread. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver command from the IP */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_deferred_processing(NX_IP_DRIVER *driver_req_ptr) +{ +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_thread_entry PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function is the driver thread entry. In this thread, it */ +/* performs checking for incoming TCP and UDP packets. On new packet, */ +/* it will be passed to NetX. */ +/* */ +/* INPUT */ +/* */ +/* thread_input Thread input */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* tx_mutex_get Obtain protection mutex */ +/* tx_mutex_put Release protection mutex */ +/* tx_thread_sleep Sleep driver thread */ +/* nx_packet_allocate Allocate a packet for incoming*/ +/* TCP and UDP data */ +/* _nx_tcp_socket_driver_packet_receive Receive TCP packet */ +/* _nx_tcp_socket_driver_establish Establish TCP connection */ +/* _nx_udp_socket_driver_packet_receive Receive UDP packet */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static VOID _nx_driver_thread_entry(ULONG thread_input) +{ +UINT i; +NX_PACKET *packet_ptr; +UINT packet_type; +UINT status; +NXD_ADDRESS local_ip; +NXD_ADDRESS remote_ip; +uint16_t data_length; +NX_IP *ip_ptr = nx_driver_information.nx_driver_information_ip_ptr; +NX_INTERFACE *interface_ptr = nx_driver_information.nx_driver_information_interface; +NX_PACKET_POOL *pool_ptr = nx_driver_information.nx_driver_information_packet_pool_ptr; + + NX_PARAMETER_NOT_USED(thread_input); + + for (;;) + { + + /* Obtain the IP internal mutex before processing the IP event. */ + tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); + + /* Loop through TCP socket. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if (nx_driver_sockets[i].socket_ptr == NX_NULL) + { + + /* Skip sockets not used. */ + continue; + } + + if ((nx_driver_sockets[i].local_port == 0) && + (nx_driver_sockets[i].remote_port == 0)) + { + + /* Skip sockets not listening. */ + continue; + } + + /* Set packet type. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + packet_type = NX_TCP_PACKET; + if ((nx_driver_sockets[i].tcp_connected == NX_FALSE) && + (nx_driver_sockets[i].is_client == NX_FALSE)) + { + + /* TCP server. Try accept. */ + if (_nx_tcp_socket_driver_establish(nx_driver_sockets[i].socket_ptr, interface_ptr, 0)) + { + + /* NetX TCP socket is not ready to accept. Just sleep to avoid starving. */ + tx_thread_sleep(NX_DRIVER_THREAD_INTERVAL); + continue; + } + } + } + else + { + packet_type = NX_UDP_PACKET; + } + + /* Loop to receive all data on current socket. */ + for (;;) + { + if (nx_packet_allocate(pool_ptr, &packet_ptr, packet_type, NX_NO_WAIT)) + { + + /* Packet not available. */ + break; + } + + /* Get available size of packet. */ + data_length = (uint16_t)(packet_ptr -> nx_packet_data_end - packet_ptr -> nx_packet_prepend_ptr); + + /* Limit the data length to ES_WIFI_PAYLOAD_SIZE due to underlayer limitation. */ + if (data_length > ES_WIFI_PAYLOAD_SIZE) + { + data_length = ES_WIFI_PAYLOAD_SIZE; + } + + /* Receive data without suspending. */ + status = WIFI_ReceiveData(i, (uint8_t*)(packet_ptr -> nx_packet_prepend_ptr), + data_length, &data_length, NX_NO_WAIT); + + if (status != WIFI_STATUS_OK) + { + + /* Connection error. Notify upper layer with Null packet. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + _nx_tcp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, NX_NULL); + nx_driver_sockets[i].tcp_connected = NX_FALSE; + } + else + { + _nx_udp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, NX_NULL, + NX_NULL, NX_NULL, 0); + } + nx_packet_release(packet_ptr); + break; + } + + if (data_length == 0) + { + + /* No incoming data. */ + nx_packet_release(packet_ptr); + break; + } + + /* Set packet length. */ + packet_ptr -> nx_packet_length = (ULONG)data_length; + packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + data_length; + packet_ptr -> nx_packet_ip_interface = interface_ptr; + + /* Pass it to NetXDuo. */ + if (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP) + { + _nx_tcp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, packet_ptr); + } + else + { + + /* Convert IP version. */ + remote_ip.nxd_ip_version = NX_IP_VERSION_V4; + remote_ip.nxd_ip_address.v4 = nx_driver_sockets[i].remote_ip; + local_ip.nxd_ip_version = NX_IP_VERSION_V4; + local_ip.nxd_ip_address.v4 = nx_driver_sockets[i].local_ip; + + _nx_udp_socket_driver_packet_receive(nx_driver_sockets[i].socket_ptr, + packet_ptr, &local_ip, &remote_ip, + nx_driver_sockets[i].remote_port); + } + } + } + + /* Release the IP internal mutex before processing the IP event. */ + tx_mutex_put(&(ip_ptr -> nx_ip_protection)); + + /* Sleep some ticks to next loop. */ + tx_thread_sleep(NX_DRIVER_THREAD_INTERVAL); + } +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_tcpip_handler PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processing the TCP/IP request. */ +/* */ +/* INPUT */ +/* */ +/* ip_ptr Pointer to IP */ +/* interface_ptr Pointer to interface */ +/* socket_ptr Pointer to TCP or UDP socket */ +/* operation Operation of TCP/IP request */ +/* packet_ptr Pointer to packet */ +/* local_ip Pointer to local IP address */ +/* remote_ip Pointer to remote IP address */ +/* local_port Local socket port */ +/* remote_port Remote socket port */ +/* wait_option Wait option in ticks */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* nx_packet_transmit_release Release transmittion packet */ +/* */ +/* CALLED BY */ +/* */ +/* Driver entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_tcpip_handler(struct NX_IP_STRUCT *ip_ptr, + struct NX_INTERFACE_STRUCT *interface_ptr, + VOID *socket_ptr, UINT operation, NX_PACKET *packet_ptr, + NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip, + UINT local_port, UINT *remote_port, UINT wait_option) +{ +UINT status = NX_NOT_SUCCESSFUL; +UCHAR remote_ip_bytes[4]; +NX_PACKET *current_packet; +ULONG packet_size; +ULONG offset; +uint16_t sent_size; +UINT i; + + if (operation == NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_LISTEN) + { + + /* For TCP server socket, find duplicate listen requrest first. + Only one socket can listen to each TCP port. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if ((nx_driver_sockets[i].local_port == local_port) && + (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP)) + { + if (nx_driver_sockets[i].tcp_connected == NX_TRUE) + { + + /* Previous connection not closed. Multiple connection is not supported. */ + return(NX_NOT_SUPPORTED); + } + + /* Find a duplicate listen. Just overwrite it. */ + ((NX_TCP_SOCKET*)socket_ptr) -> nx_tcp_socket_tcpip_offload_context = (VOID*)i; + nx_driver_sockets[i].socket_ptr = socket_ptr; + return(NX_SUCCESS); + } + } + } + + if ((operation == NX_TCPIP_OFFLOAD_TCP_CLIENT_SOCKET_CONNECT) || + (operation == NX_TCPIP_OFFLOAD_UDP_SOCKET_BIND) || + (operation == NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_LISTEN)) + { + + /* Find a socket that is not used. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if (nx_driver_sockets[i].socket_ptr == NX_NULL) + { + + /* Find an empty entry. */ + nx_driver_sockets[i].socket_ptr = socket_ptr; + break; + } + } + + if (i == NX_DRIVER_SOCKETS_MAXIMUM) + { + + /* No more entries. */ + return(NX_NO_MORE_ENTRIES); + } + } + + switch (operation) + { + case NX_TCPIP_OFFLOAD_TCP_CLIENT_SOCKET_CONNECT: + + /* Store the index of driver socket. */ + ((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context = (VOID *)i; + + /* Convert remote IP to byte array. */ + remote_ip_bytes[0] = (remote_ip -> nxd_ip_address.v4 >> 24) & 0xFF; + remote_ip_bytes[1] = (remote_ip -> nxd_ip_address.v4 >> 16) & 0xFF; + remote_ip_bytes[2] = (remote_ip -> nxd_ip_address.v4 >> 8) & 0xFF; + remote_ip_bytes[3] = (remote_ip -> nxd_ip_address.v4) & 0xFF; + + /* Connect. */ + status = WIFI_OpenClientConnection(i, WIFI_TCP_PROTOCOL, "", + remote_ip_bytes, *remote_port, local_port); + + if (status) + { + return(NX_NOT_SUCCESSFUL); + } + +#ifdef NX_DEBUG + printf("TCP client socket %u connect to: %u.%u.%u.%u:%u\r\n", + i, remote_ip_bytes[0], remote_ip_bytes[1], + remote_ip_bytes[2], remote_ip_bytes[3], *remote_port); +#endif + + /* Store address and port. */ + nx_driver_sockets[i].remote_ip = remote_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].local_port = local_port; + nx_driver_sockets[i].remote_port = *remote_port; + nx_driver_sockets[i].protocol = NX_PROTOCOL_TCP; + nx_driver_sockets[i].is_client = NX_TRUE; + break; + + case NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_LISTEN: + + /* Store the index of driver socket. */ + ((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context = (VOID *)i; + + /* Start TCP server. */ + status = WIFI_StartServer(i, WIFI_TCP_PROTOCOL, NX_DRIVER_SERVER_LISTEN_COUNT, "", local_port); + if (status) + { + return(NX_NOT_SUCCESSFUL); + } + +#ifdef NX_DEBUG + printf("TCP server socket %u listen to port: %u\r\n", i, local_port); +#endif + + /* Store address and port. */ + nx_driver_sockets[i].local_port = local_port; + nx_driver_sockets[i].remote_port = 0; + nx_driver_sockets[i].protocol = NX_PROTOCOL_TCP; + nx_driver_sockets[i].tcp_connected = NX_FALSE; + nx_driver_sockets[i].is_client = NX_FALSE; + break; + + case NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_ACCEPT: + i = (UINT)(((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context); + + /* Accept connection. */ + status = WIFI_WaitServerConnection(i, 1, remote_ip_bytes, &nx_driver_sockets[i].remote_port); + + if (status) + { + return(NX_NOT_SUCCESSFUL); + } + +#ifdef NX_DEBUG + printf("TCP server socket %u accept from: %u.%u.%u.%u:%u\r\n", + i, remote_ip_bytes[0], remote_ip_bytes[1], + remote_ip_bytes[2], remote_ip_bytes[3], nx_driver_sockets[i].remote_port); +#endif + + /* Store address and port. */ + remote_ip -> nxd_ip_version = NX_IP_VERSION_V4; + remote_ip -> nxd_ip_address.v4 = IP_ADDRESS(remote_ip_bytes[0], + remote_ip_bytes[1], + remote_ip_bytes[2], + remote_ip_bytes[3]); + nx_driver_sockets[i].remote_ip = remote_ip -> nxd_ip_address.v4; + *remote_port = (UINT)nx_driver_sockets[i].remote_port; + nx_driver_sockets[i].tcp_connected = NX_TRUE; + break; + + case NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_UNLISTEN: + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if ((nx_driver_sockets[i].local_port == local_port) && + (nx_driver_sockets[i].protocol == NX_PROTOCOL_TCP)) + { + +#ifdef NX_DEBUG + printf("TCP server socket %u unlisten port: %u\r\n", + i, local_port); +#endif + nx_driver_sockets[i].socket_ptr = NX_NULL; + nx_driver_sockets[i].local_port = 0; + WIFI_StopServer(i); + return(NX_SUCCESS); + } + } + break; + + case NX_TCPIP_OFFLOAD_TCP_SOCKET_DISCONNECT: + i = (UINT)(((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context); + if (nx_driver_sockets[i].remote_port) + { + + if (nx_driver_sockets[i].is_client) + { +#ifdef NX_DEBUG + printf("TCP client socket %u disconnect\r\n", i); +#endif + + /* Disconnect. */ + status = WIFI_CloseClientConnection(i); + } + else + { +#ifdef NX_DEBUG + printf("TCP server socket %u disconnect\r\n", i); +#endif + + /* Close server connection. */ + status = WIFI_CloseServerConnection(i); + nx_driver_sockets[i].tcp_connected = NX_FALSE; + + /* No need to free this entry as TCP server still needs to listening to port. */ + break; + } + } + + /* Reset socket to free this entry. */ + nx_driver_sockets[i].socket_ptr = NX_NULL; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_BIND: + /* Note, send data from one port to multiple remotes are not supported. */ + /* Store the index of driver socket. */ + ((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context = (VOID *)i; + + /* Reset the remote port to indicate the socket is not connected yet. */ + nx_driver_sockets[i].remote_port = 0; + +#ifdef NX_DEBUG + printf("UDP socket %u bind to port: %u\r\n", i, local_port); +#endif + + status = NX_SUCCESS; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_UNBIND: + i = (UINT)(((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context); + + if (nx_driver_sockets[i].remote_port) + { + + /* Disconnect. */ + status = WIFI_CloseClientConnection(i); + +#ifdef NX_DEBUG + printf("UDP socket %u unbind port: %u\r\n", i, local_port); +#endif + } + + /* Reset socket to free this entry. */ + nx_driver_sockets[i].socket_ptr = NX_NULL; + break; + + case NX_TCPIP_OFFLOAD_UDP_SOCKET_SEND: + i = (UINT)(((NX_UDP_SOCKET *)socket_ptr) -> nx_udp_socket_tcpip_offload_context); + if (nx_driver_sockets[i].remote_port == 0) + { + + /* Do connection once. */ + /* Convert remote IP to byte array. */ + remote_ip_bytes[0] = (remote_ip -> nxd_ip_address.v4 >> 24) & 0xFF; + remote_ip_bytes[1] = (remote_ip -> nxd_ip_address.v4 >> 16) & 0xFF; + remote_ip_bytes[2] = (remote_ip -> nxd_ip_address.v4 >> 8) & 0xFF; + remote_ip_bytes[3] = (remote_ip -> nxd_ip_address.v4) & 0xFF; + + /* Connect. */ + status = WIFI_OpenClientConnection((uint8_t)i, WIFI_UDP_PROTOCOL, "", + remote_ip_bytes, *remote_port, local_port); + if (status) + { + return(NX_NOT_SUCCESSFUL); + } + +#ifdef NX_DEBUG + printf("UDP socket %u connect to: %u.%u.%u.%u:%u\r\n", + i, remote_ip_bytes[0], remote_ip_bytes[1], + remote_ip_bytes[2], remote_ip_bytes[3], *remote_port); +#endif + + /* Store address and port. */ + nx_driver_sockets[i].local_ip = local_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].remote_ip = remote_ip -> nxd_ip_address.v4; + nx_driver_sockets[i].local_port = local_port; + nx_driver_sockets[i].remote_port = *remote_port; + nx_driver_sockets[i].protocol = NX_PROTOCOL_UDP; + nx_driver_sockets[i].is_client = NX_TRUE; + } + + if ((packet_ptr -> nx_packet_length > ES_WIFI_PAYLOAD_SIZE) +#ifndef NX_DISABLE_PACKET_CHAIN + || (packet_ptr -> nx_packet_next) +#endif /* NX_DISABLE_PACKET_CHAIN */ + ) + { + + /* Limitation in this driver. UDP packet must be in one packet. */ + return (NX_NOT_SUCCESSFUL); + } + + /* Convert wait option from ticks to ms. */ + if (wait_option > (NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM / 1000 * NX_IP_PERIODIC_RATE)) + { + wait_option = NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM; + } + else + { + wait_option = wait_option / NX_IP_PERIODIC_RATE * 1000; + } + + /* Send data. */ + status = WIFI_SendData((uint8_t)i, + packet_ptr -> nx_packet_prepend_ptr, + (uint16_t)(packet_ptr -> nx_packet_length), &sent_size, + wait_option); + + /* Check status. */ + if ((status != WIFI_STATUS_OK) || (sent_size != packet_ptr -> nx_packet_length)) + { + return (NX_NOT_SUCCESSFUL); + } + + /* Release the packet. */ + nx_packet_transmit_release(packet_ptr); + break; + + case NX_TCPIP_OFFLOAD_TCP_SOCKET_SEND: + i = (UINT)(((NX_TCP_SOCKET *)socket_ptr) -> nx_tcp_socket_tcpip_offload_context); + + /* Initialize the current packet to the input packet pointer. */ + current_packet = packet_ptr; + offset = 0; + + /* Convert wait option from ticks to ms. */ + if (wait_option > (NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM / 1000 * NX_IP_PERIODIC_RATE)) + { + wait_option = NX_DRIVER_SOCKET_SEND_TIMEOUT_MAXIMUM; + } + else + { + wait_option = wait_option / NX_IP_PERIODIC_RATE * 1000; + } + + /* Loop to send the packet. */ + while(current_packet) + { + + /* Calculate current packet size. */ + packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); + packet_size -= offset; + + /* Limit the data size to ES_WIFI_PAYLOAD_SIZE due to underlayer limitation. */ + if (packet_size > ES_WIFI_PAYLOAD_SIZE) + { + packet_size = ES_WIFI_PAYLOAD_SIZE; + } + + /* Send data. */ + status = WIFI_SendData((uint8_t)i, + current_packet -> nx_packet_prepend_ptr + offset, + (uint16_t)packet_size, &sent_size, + wait_option); + + /* Check status. */ + if ((status != WIFI_STATUS_OK) || (sent_size != packet_size)) + { + return (NX_NOT_SUCCESSFUL); + } + + /* Calculate current packet size. */ + packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); + + if ((sent_size + offset) < packet_size) + { + + /* Partial data sent. Increase the offset. */ + offset += sent_size; + } + else + { + + /* Data in current packet are all sent. */ + offset = 0; + +#ifndef NX_DISABLE_PACKET_CHAIN + /* We have crossed the packet boundary. Move to the next packet structure. */ + current_packet = current_packet -> nx_packet_next; +#else + /* End of the loop. */ + current_packet = NX_NULL; +#endif /* NX_DISABLE_PACKET_CHAIN */ + } + } + + /* Release the packet. */ + nx_packet_transmit_release(packet_ptr); + break; + + default: + break; + } + + return(status); +} + + +/****** DRIVER SPECIFIC ****** Start of part/vendor specific internal driver functions. */ + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_initialize PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific initialization. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_info_get Get thread information */ +/* tx_thread_create Create driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_initialize Driver initialize processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_initialize(NX_IP_DRIVER *driver_req_ptr) +{ +UINT status; +UINT priority = 0; + + /* Get priority of IP thread. */ + tx_thread_info_get(tx_thread_identify(), NX_NULL, NX_NULL, NX_NULL, &priority, + NX_NULL, NX_NULL, NX_NULL, NX_NULL); + + /* Create the driver thread. */ + /* The priority of network thread is lower than IP thread. */ + status = tx_thread_create(&nx_driver_thread, "Driver Thread", _nx_driver_thread_entry, 0, + nx_driver_thread_stack, NX_DRIVER_STACK_SIZE, + priority + 1, priority + 1, + TX_NO_TIME_SLICE, TX_DONT_START); + + /* Return success! */ + return(status); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_enable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific link enable requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_reset Reset driver thread */ +/* tx_thread_resume Resume driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_enable Driver link enable processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_enable(NX_IP_DRIVER *driver_req_ptr) +{ + tx_thread_reset(&nx_driver_thread); + tx_thread_resume(&nx_driver_thread); + + /* Return success! */ + return(NX_SUCCESS); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_disable PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific link disable requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* tx_thread_suspend Suspend driver thread */ +/* tx_thread_terminate Terminate driver thread */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_disable Driver link disable processing*/ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_disable(NX_IP_DRIVER *driver_req_ptr) +{ +UINT i; + + /* Reset all sockets. */ + for (i = 0; i < NX_DRIVER_SOCKETS_MAXIMUM; i++) + { + if (nx_driver_sockets[i].socket_ptr) + { + + /* Disconnect. */ + WIFI_CloseClientConnection(i); + nx_driver_sockets[i].socket_ptr = NX_NULL; + } + } + + tx_thread_suspend(&nx_driver_thread); + tx_thread_terminate(&nx_driver_thread); + + /* Return success! */ + return(NX_SUCCESS); +} + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_get_status PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific get status requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR]*/ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_get_status Driver get status processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_get_status(NX_IP_DRIVER *driver_req_ptr) +{ + + /* Return success. */ + return(NX_SUCCESS); +} + + +#ifdef NX_ENABLE_INTERFACE_CAPABILITY +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _nx_driver_hardware_capability_set PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function processes hardware-specific capability set requests. */ +/* */ +/* INPUT */ +/* */ +/* driver_req_ptr Driver request pointer */ +/* */ +/* OUTPUT */ +/* */ +/* status [NX_SUCCESS|NX_DRIVER_ERROR] */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _nx_driver_capability_set Capability set processing */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Yuxin Zhou Initial Version 6.x */ +/* */ +/**************************************************************************/ +static UINT _nx_driver_hardware_capability_set(NX_IP_DRIVER *driver_req_ptr) +{ + + return NX_SUCCESS; +} +#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ + +/****** DRIVER SPECIFIC ****** Start of part/vendor specific internal driver functions. */ + diff --git a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_wifi.h b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.h similarity index 54% rename from Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_wifi.h rename to STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.h index 1eef7359..cb240666 100644 --- a/Renesas/RX65N_Cloud_Kit/lib/netxduo/common/nx_wifi.h +++ b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_driver_stm32l4.h @@ -15,39 +15,39 @@ /** */ /** NetX Component */ /** */ -/** NetX Porting layer for RX65N Cloud Kit */ +/** Ethernet driver for STM32L4 family of microprocessors */ /** */ /**************************************************************************/ /**************************************************************************/ -#ifndef _NX_WIFI_H_ -#define _NX_WIFI_H_ -#ifdef __cplusplus - extern "C" { +#ifndef NX_DRIVER_STM32L4_H +#define NX_DRIVER_STM32L4_H + + +#ifdef __cplusplus + +/* Yes, C++ compiler is present. Use standard C. */ +extern "C" { #endif +#include "wifi.h" #include "nx_api.h" -#define WIFI_RECEIVE_QUEUE_SIZE 10 - -UINT nx_wifi_initialize(NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool); -UINT nx_wifi_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option); -UINT nx_wifi_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_wifi_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT nx_wifi_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_wifi_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_wifi_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT nx_wifi_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT nx_wifi_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); - -#ifdef __cplusplus -} -#endif -#endif /* _WIFI_H_ */ +#define NX_DRIVER_STATE_NOT_INITIALIZED 1 +#define NX_DRIVER_STATE_INITIALIZE_FAILED 2 +#define NX_DRIVER_STATE_INITIALIZED 3 +#define NX_DRIVER_STATE_LINK_ENABLED 4 +#define NX_DRIVER_ERROR 90 + +/* Define global driver entry function. */ + +VOID nx_driver_stm32l4(NX_IP_DRIVER *driver_req_ptr); + +#ifdef __cplusplus +/* Yes, C++ compiler is present. Use standard C. */ + } +#endif +#endif diff --git a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_wifi.c b/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_wifi.c deleted file mode 100644 index 4460ee16..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netx_driver/nx_wifi.c +++ /dev/null @@ -1,1663 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** NetX Porting layer for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#include "tx_api.h" -#include "nx_api.h" -#include "wifi.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - -#define WIFI_WRITE_TIMEOUT 100 -#define WIFI_READ_TIMEOUT 100 - -#ifndef WIFI_THREAD_PERIOD -#define WIFI_THREAD_PERIOD 100 -#endif /* WIFI_THREAD_PERIOD */ - -/* Define the default thread priority, stack size, etc. The user can override this - via -D command line option or via project settings. */ - -#ifndef NX_WIFI_STACK_SIZE -#define NX_WIFI_STACK_SIZE (1024) -#endif /* NX_WIFI_STACK_SIZE */ - -#ifndef NX_WIFI_THREAD_PRIORITY -#define NX_WIFI_THREAD_PRIORITY (1) -#endif /* NX_WIFI_THREAD_PRIORITY */ - -/* Define the stack for X-WARE WIFI. */ -static UCHAR nx_wifi_thread_stack[NX_WIFI_STACK_SIZE]; - -/* Define the prototypes for X-WARE. */ -static TX_THREAD nx_wifi_thread; -static NX_PACKET_POOL *nx_wifi_pool; -static NX_IP *nx_wifi_ip; - -/* Define the socket type, TCP socket or UDP socket. */ -#define NX_WIFI_TCP_SOCKET 0 -#define NX_WIFI_UDP_SOCKET 1 - -/* Reserve some packets for applications, such as HTTP, etc. */ -#ifndef NX_WIFI_PACKET_RESERVED -#define NX_WIFI_PACKET_RESERVED 1 -#endif /* NX_WIFI_PACKET_RESERVED */ - -/* Define the WIFI socket structure. */ -typedef struct NX_WIFI_SOCKET_STRUCT -{ - - /* Define socket pointer. */ - VOID *nx_wifi_socket_ptr; - - /* Define socket flag. */ - CHAR nx_wifi_socket_valid; - - /* Define socket type. TCP or UDP. */ - CHAR nx_wifi_socket_type; - - /* Define the connected flag. */ - CHAR nx_wifi_socket_connected; - - /* Reserved. */ - CHAR reserved; - - /* Define the deferred packet processing queue. */ - NX_PACKET *nx_wifi_received_packet_head, - *nx_wifi_received_packet_tail; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Define the UDP connected IP and port. */ - ULONG nx_wifi_udp_socket_connect_ip; - UINT nx_wifi_udp_socket_connect_port; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -}NX_WIFI_SOCKET; - -#ifndef NX_WIFI_SOCKET_COUNTER -#define NX_WIFI_SOCKET_COUNTER 8 -#endif /* NX_WIFI_SOCKET_COUNTER */ - -/* Define the TCP socket and UDP socket. */ -static NX_WIFI_SOCKET nx_wifi_socket[NX_WIFI_SOCKET_COUNTER]; - -/* Define the SOCKET ID. */ -static CHAR nx_wifi_socket_counter; - -/* Define the buffer to receive data from wifi. */ -static CHAR nx_wifi_buffer[ES_WIFI_PAYLOAD_SIZE]; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - -/* Define the wifi IP address. */ -static ULONG nx_wifi_ip_address = 0; - -/* Define the buffer to build fake IP header and TCP/UDP header. - IP Header: 20 bytes, TCP header: 20 bytes. */ -static CHAR nx_wifi_ip_buffer[40]; - -/* Define the ip packet filter. */ -static UINT nx_wifi_ip_packet_filter(ULONG source_ip, ULONG destination_ip, - ULONG source_port, ULONG destination_port, - ULONG protocol, ULONG packet_length, UINT direction); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -/* Define the wifi thread. */ -static void nx_wifi_thread_entry(ULONG thread_input); - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the NetX Wifi. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* packet_pool Packet pool pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_initialize(NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool) -{ - -UINT status; - - - /* Set the IP. */ - nx_wifi_ip = ip_ptr; - - /* Set the pool. */ - nx_wifi_pool = packet_pool; - - /* Initialize the wifi. */ - memset(nx_wifi_socket, 0, (NX_WIFI_SOCKET_COUNTER * sizeof(NX_WIFI_SOCKET))); - - /* Initialize the socket id. */ - nx_wifi_socket_counter = 0; - - /* Create the wifi thread. */ - status = tx_thread_create(&nx_wifi_thread, "Wifi Thread", nx_wifi_thread_entry, 0, - nx_wifi_thread_stack, NX_WIFI_STACK_SIZE, - NX_WIFI_THREAD_PRIORITY, NX_WIFI_THREAD_PRIORITY, TX_NO_TIME_SLICE, TX_AUTO_START); - - /* Check for thread create errors. */ - if (status) - return(status); - - return(NX_SUCCESS); -} - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_thread_entry PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function is the entry point for NetX Wifi helper thread. The */ -/* Wifi helper thread is responsible for receiving packet. */ -/* */ -/* INPUT */ -/* */ -/* thread_input Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* optimized internal code, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -void nx_wifi_thread_entry(ULONG thread_input) -{ - -UINT i; -UINT socket_counter; -USHORT size; -UINT status; -NX_PACKET *packet_ptr; -NX_TCP_SOCKET *tcp_socket; -NX_UDP_SOCKET *udp_socket; -#ifdef NX_ENABLE_IP_PACKET_FILTER -uint8_t ip_address[4]; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - -#ifdef NX_ENABLE_IP_PACKET_FILTER - if (WIFI_GetIP_Address(ip_address) == WIFI_STATUS_OK) - { - nx_wifi_ip_address = IP_ADDRESS(ip_address[0], ip_address[1], ip_address[2], ip_address[3]); - } -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - while(1) - { - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - socket_counter = 0; - - /* Check if have socket. */ - if (nx_wifi_socket_counter != 0) - { - - /* Loop to receive the data from */ - for (i = 0; (i < NX_WIFI_SOCKET_COUNTER) && (socket_counter < nx_wifi_socket_counter); i++) - { - - /* Check if the socket is valid and connected. */ - if ((nx_wifi_socket[i].nx_wifi_socket_valid == 0) || (nx_wifi_socket[i].nx_wifi_socket_connected == 0)) - continue; - - /* Update the socket counter. */ - socket_counter++; - - /* Loop to receive the data from wifi for current socket. */ - status = WIFI_STATUS_OK; - do - { - - /* Make sure there is enought space to store the data before receiving data from WIFI. */ - if ((nx_wifi_pool -> nx_packet_pool_available * nx_wifi_pool -> nx_packet_pool_payload_size) < - (ES_WIFI_PAYLOAD_SIZE + (NX_WIFI_PACKET_RESERVED * nx_wifi_pool -> nx_packet_pool_payload_size))) - break; - - /* Receive the data in WIFI_READ_TIMEOUT ms. */ - status = WIFI_ReceiveData(i, (uint8_t*)nx_wifi_buffer, ES_WIFI_PAYLOAD_SIZE, &size, WIFI_READ_TIMEOUT); - - /* Check status. */ - if ((status != WIFI_STATUS_OK) || (size == 0)) - break; - - /* Allocate one packet to store the data. */ - if (nx_packet_allocate(nx_wifi_pool, &packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT)) - break; - - /* Set the data. */ - if (nx_packet_data_append(packet_ptr, nx_wifi_buffer, size, nx_wifi_pool, NX_NO_WAIT)) - { - nx_packet_release(packet_ptr); - break; - } - - /* Check to see if the deferred processing queue is empty. */ - if (nx_wifi_socket[i].nx_wifi_received_packet_head) - { - - /* Not empty, just place the packet at the end of the queue. */ - (nx_wifi_socket[i].nx_wifi_received_packet_tail) -> nx_packet_queue_next = packet_ptr; - packet_ptr -> nx_packet_queue_next = NX_NULL; - nx_wifi_socket[i].nx_wifi_received_packet_tail = packet_ptr; - - } - else - { - - /* Empty deferred receive processing queue. Just setup the head pointers and - set the event flags to ensure the IP helper thread looks at the deferred processing - queue. */ - nx_wifi_socket[i].nx_wifi_received_packet_head = packet_ptr; - nx_wifi_socket[i].nx_wifi_received_packet_tail = packet_ptr; - packet_ptr -> nx_packet_queue_next = NX_NULL; - - /* Check the socket type. */ - if (nx_wifi_socket[i].nx_wifi_socket_type == NX_WIFI_TCP_SOCKET) - { - - /* Get the tcp socket. */ - tcp_socket = (NX_TCP_SOCKET *)nx_wifi_socket[i].nx_wifi_socket_ptr; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - nx_wifi_ip_packet_filter(tcp_socket -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - nx_wifi_ip_address, - tcp_socket -> nx_tcp_socket_connect_port, - tcp_socket -> nx_tcp_socket_port, - NX_IP_TCP, size, NX_IP_PACKET_IN); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Determine if there is a socket receive notification function specified. */ - if (tcp_socket -> nx_tcp_receive_callback) - { - - /* Yes, notification is requested. Call the application's receive notification - function for this socket. */ - (tcp_socket -> nx_tcp_receive_callback)(tcp_socket); - } - } - else - { - - /* Get the udp socket. */ - udp_socket = (NX_UDP_SOCKET *)nx_wifi_socket[i].nx_wifi_socket_ptr; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_socket[i].nx_wifi_udp_socket_connect_ip, - nx_wifi_ip_address, - nx_wifi_socket[i].nx_wifi_udp_socket_connect_port, - udp_socket -> nx_udp_socket_port, - NX_IP_UDP, size, NX_IP_PACKET_IN); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Determine if there is a socket receive notification function specified. */ - if (udp_socket -> nx_udp_receive_callback) - { - - /* Yes, notification is requested. Call the application's receive notification - function for this socket. */ - (udp_socket -> nx_udp_receive_callback)(udp_socket); - } - } - } - - /* Queue the packet. */ - }while (status == WIFI_STATUS_OK); - } - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - /* Sleep some ticks to next loop. */ - tx_thread_sleep(WIFI_THREAD_PERIOD); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tick_convert_ms PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function converts the ticks to milliseconds. */ -/* */ -/* INPUT */ -/* */ -/* tick Tick value */ -/* millisecond Destination to millisecond */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static VOID nx_wifi_tick_convert_ms(ULONG tick, ULONG *millisecond) -{ - -UINT factor = 1000/NX_IP_PERIODIC_RATE; - - - /* Check the wait_option. */ - if (tick) - { - - /* Change ticks to milliseconds to ticks. */ - if (tick >= NX_WAIT_FOREVER/factor) - *millisecond = NX_WAIT_FOREVER; - else - *millisecond = (tick * factor); - } - else - { - *millisecond = 0; - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_entry_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds an available entry. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* entry_index Destination to entry */ -/* entry_find Find flag */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_socket_entry_find(void *socket_ptr, UCHAR *entry_index, UCHAR entry_find) -{ - -UINT i; -UCHAR empty_index = NX_WIFI_SOCKET_COUNTER; - - /* Loop to find an empty entry. */ - for (i = 0; i < NX_WIFI_SOCKET_COUNTER; i++) - { - - /* Check the valid flag. */ - if (nx_wifi_socket[i].nx_wifi_socket_valid) - { - - /* Check if the entry already exist. */ - if (nx_wifi_socket[i].nx_wifi_socket_ptr == socket_ptr) - { - - /* Check if find the entry. */ - if (entry_find) - { - *entry_index = i; - return(NX_SUCCESS); - } - else - { - return(NX_NOT_SUCCESSFUL); - } - } - } - else - { - - /* Set the empty index. */ - if (empty_index > i) - empty_index = i; - } - } - - /* Check if have empty entry. */ - if (empty_index >= NX_WIFI_SOCKET_COUNTER) - return (NX_NOT_SUCCESSFUL); - - (*entry_index) = empty_index; - return(NX_SUCCESS); -} - - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_reset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function resets the entry and release the packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* entry_index Destination to entry */ -/* entry_find Find flag */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static void nx_wifi_socket_reset(UCHAR entry_index) -{ - -NX_PACKET *next_packet; -NX_PACKET *current_packet; - - /* Check if this is an valid entry. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_valid == 0) - return; - - /* Setup next packet to queue head. */ - next_packet = nx_wifi_socket[entry_index].nx_wifi_received_packet_head; - - /* Release any packets queued up. */ - while (next_packet) - { - - /* Setup the current packet pointer. */ - current_packet = next_packet; - - /* Move to the next packet. */ - next_packet = next_packet -> nx_packet_queue_next; - - /* Release the current packet. */ - nx_packet_release(current_packet); - } - - /* Reset the entry. */ - memset(&nx_wifi_socket[entry_index], 0, sizeof(NX_WIFI_SOCKET)); - nx_wifi_socket_counter--; -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives packet for wifi socket */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* packet_ptr Pointer to received packet */ -/* wait_option Suspension option */ -/* socket_type Socket type */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* optimized internal code, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_socket_receive(VOID *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option, UINT socket_type) -{ - -UINT status; -UCHAR entry_index; -ULONG total_millisecond; -ULONG wait_millisecond; -UINT start_time; -ULONG millisecond; -USHORT size; -UINT received_packet = NX_FALSE; -#ifdef NX_ENABLE_IP_PACKET_FILTER -NX_TCP_SOCKET *tcp_socket; -NX_UDP_SOCKET *udp_socket; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Convert the tick to millisecond. */ - nx_wifi_tick_convert_ms(wait_option, &total_millisecond); - - /* Receive the packet from queue. */ - if (nx_wifi_socket[entry_index].nx_wifi_received_packet_head) - { - - /* Remove the first packet and process it! */ - - /* Pickup the first packet. */ - *packet_ptr = nx_wifi_socket[entry_index].nx_wifi_received_packet_head; - - /* Move the head pointer to the next packet. */ - nx_wifi_socket[entry_index].nx_wifi_received_packet_head = (*packet_ptr) -> nx_packet_queue_next; - - /* Check for end of deferred processing queue. */ - if (nx_wifi_socket[entry_index].nx_wifi_received_packet_head == NX_NULL) - { - - /* Yes, the queue is empty. Set the tail pointer to NULL. */ - nx_wifi_socket[entry_index].nx_wifi_received_packet_tail = NX_NULL; - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } - else - { - - /* Get the start time. */ - start_time = tx_time_get(); - - /* Loop to receive a packet. */ - while(total_millisecond) - { - - /* Check if exceed the max value of ES_WIFI_TIMEOUT. */ - if (total_millisecond > ES_WIFI_TIMEOUT) - wait_millisecond = ES_WIFI_TIMEOUT; - else - wait_millisecond = total_millisecond; - - /* Check if exceed the max value of ES_WIFI_TRANSPORT_TIMEOUT. */ - if (wait_millisecond > ES_WIFI_TRANSPORT_TIMEOUT) - wait_millisecond = ES_WIFI_TRANSPORT_TIMEOUT; - - /* Receive the data within a specified time. */ - status = WIFI_ReceiveData(entry_index, (uint8_t*)nx_wifi_buffer, ES_WIFI_PAYLOAD_SIZE, &size, wait_millisecond); - - /* Check status. */ - if ((status != WIFI_STATUS_OK) || (size == 0)) - { - - /* Convert the tick to millisecond. */ - nx_wifi_tick_convert_ms((tx_time_get() - start_time), &millisecond); - - /* Update the remaining millisecond. */ - if (millisecond >= total_millisecond) - total_millisecond = 0; - else - total_millisecond -=millisecond; - - continue; - } - else - { - received_packet = NX_TRUE; - break; - } - } - - /* Check if receive a packet. */ - if (received_packet != NX_TRUE) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NO_PACKET); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Check the socket type. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_type == NX_WIFI_TCP_SOCKET) - { - - /* Get the tcp socket. */ - tcp_socket = (NX_TCP_SOCKET *)nx_wifi_socket[entry_index].nx_wifi_socket_ptr; - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(tcp_socket -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - nx_wifi_ip_address, - tcp_socket -> nx_tcp_socket_connect_port, - tcp_socket -> nx_tcp_socket_port, - NX_IP_TCP, size, NX_IP_PACKET_IN); - } - else - { - - /* Get the udp socket. */ - udp_socket = (NX_UDP_SOCKET *)nx_wifi_socket[entry_index].nx_wifi_socket_ptr; - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip, - nx_wifi_ip_address, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port, - udp_socket -> nx_udp_socket_port, - NX_IP_UDP, size, NX_IP_PACKET_IN); - } -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Allocate one packet to store the data. */ - if (nx_packet_allocate(nx_wifi_pool, packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the data. */ - if (nx_packet_data_append(*packet_ptr, nx_wifi_buffer, size, nx_wifi_pool, NX_NO_WAIT)) - { - - /* Release the packet. */ - nx_packet_release(*packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends wifi connection command */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Socket pointer */ -/* packet_ptr Pointer to received packet */ -/* wait_option Suspension option */ -/* socket_type Socket type */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option) -{ - -UINT status ; -UCHAR entry_index; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 0)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the entry info. */ - nx_wifi_socket[entry_index].nx_wifi_socket_ptr = (void *)socket_ptr; - nx_wifi_socket[entry_index].nx_wifi_socket_valid = 1; - nx_wifi_socket[entry_index].nx_wifi_socket_type = NX_WIFI_TCP_SOCKET; - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 0; - nx_wifi_socket_counter++; - - /* Swap the address. */ - NX_CHANGE_ULONG_ENDIAN(server_ip -> nxd_ip_address.v4); - - /* Wifi connect. */ - status= WIFI_OpenClientConnection(entry_index , WIFI_TCP_PROTOCOL, "", (unsigned char* )(&(server_ip -> nxd_ip_address.v4)), server_port, socket_ptr -> nx_tcp_socket_port) ; - - /* Swap the address. */ - NX_CHANGE_ULONG_ENDIAN(server_ip -> nxd_ip_address.v4); - - if(status == WIFI_STATUS_OK) - { - - /* Update the connect flag. */ - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 1; - - /* Update the address and port. */ - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_version = NX_IP_VERSION_V4; - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4 = server_ip -> nxd_ip_address.v4; - socket_ptr -> nx_tcp_socket_connect_port = server_port; - socket_ptr -> nx_tcp_socket_state = NX_TCP_ESTABLISHED; - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); - } - else - { - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends wifi disconnect command */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - -UCHAR entry_index; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Check if the entry already exist. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Close connection. */ - WIFI_CloseClientConnection(entry_index); - - /* Reset the entry. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a TCP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option) -{ - -UINT status ; -UCHAR entry_index; -USHORT send_data_length; -ULONG packet_size; -NX_PACKET *current_packet; - - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Initialize the current packet to the input packet pointer. */ - current_packet = packet_ptr; - - /* Loop to send the packet. */ - while(current_packet) - { - - /* Calculate current packet size. */ - packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); - - /* Send data. */ - status = WIFI_SendData(entry_index, current_packet -> nx_packet_prepend_ptr, packet_size, &send_data_length, WIFI_WRITE_TIMEOUT); - - /* Check status. */ - if ((status != WIFI_STATUS_OK) || (send_data_length != packet_size)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return (NX_NOT_SUCCESSFUL); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_ip_address, - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4, - socket_ptr -> nx_tcp_socket_port, - socket_ptr -> nx_tcp_socket_connect_port, - NX_IP_TCP, packet_size, NX_IP_PACKET_OUT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* We have crossed the packet boundary. Move to the next packet - structure. */ - current_packet = current_packet -> nx_packet_next; -#else - - /* End the loop. */ - current_packet = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Release the packet. */ - nx_packet_release(packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - return (NX_SUCCESS); -} - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives a TCP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - return(nx_wifi_socket_receive((VOID*)socket_ptr, packet_ptr, wait_option, NX_WIFI_TCP_SOCKET)); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds UDP socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UCHAR entry_index; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 0)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Set the entry info. */ - nx_wifi_socket[entry_index].nx_wifi_socket_ptr = (void *)socket_ptr; - nx_wifi_socket[entry_index].nx_wifi_socket_valid = 1; - nx_wifi_socket[entry_index].nx_wifi_socket_type = NX_WIFI_UDP_SOCKET; - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 0; - nx_wifi_socket_counter++; - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds UDP socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ - -UCHAR entry_index; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Check if the entry already exist. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if the socket is connected. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Close connection. */ - WIFI_CloseClientConnection(entry_index); - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends UDP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port) -{ - -UINT status ; -UCHAR entry_index; -USHORT send_data_length; -ULONG packet_size; -NX_PACKET *current_packet; - - /* Obtain the IP internal mutex before processing the IP event. */ - tx_mutex_get(&(nx_wifi_ip -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Find an avaiable entry. */ - if (nx_wifi_socket_entry_find((void *)socket_ptr, &entry_index, 1)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Check if already open the connection. */ - if (nx_wifi_socket[entry_index].nx_wifi_socket_connected == 0) - { - - /* Swap the address. */ - NX_CHANGE_ULONG_ENDIAN(ip_address -> nxd_ip_address.v4); - - /* Open connection. */ - status= WIFI_OpenClientConnection(entry_index , WIFI_UDP_PROTOCOL, "", (unsigned char* )(&(ip_address -> nxd_ip_address.v4)), port, socket_ptr -> nx_udp_socket_port) ; - - /* Swap the address. */ - NX_CHANGE_ULONG_ENDIAN(ip_address -> nxd_ip_address.v4); - - /* Check status. */ - if(status) - { - - /* Reset the entry. */ - nx_wifi_socket_reset(entry_index); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - - /* Update the connect flag. */ - nx_wifi_socket[entry_index].nx_wifi_socket_connected = 1; - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Set IP and port. */ - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip = ip_address -> nxd_ip_address.v4; - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port = port; -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - } - - /* Initialize the current packet to the input packet pointer. */ - current_packet = packet_ptr; - - /* Loop to send the packet. */ - while(current_packet) - { - - /* Calculate current packet size. */ - packet_size = (ULONG)(current_packet -> nx_packet_append_ptr - current_packet -> nx_packet_prepend_ptr); - - /* Loop to send data. */ - status = WIFI_SendData(entry_index, (uint8_t *)current_packet-> nx_packet_prepend_ptr, packet_size, &send_data_length, WIFI_WRITE_TIMEOUT); - - /* Check status. */ - if ((status != WIFI_STATUS_OK) || (send_data_length != packet_size)) - { - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_NOT_SUCCESSFUL); - } - -#ifdef NX_ENABLE_IP_PACKET_FILTER - - /* Process packet filter. */ - nx_wifi_ip_packet_filter(nx_wifi_ip_address, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_ip, - socket_ptr -> nx_udp_socket_port, - nx_wifi_socket[entry_index].nx_wifi_udp_socket_connect_port, - NX_IP_UDP, packet_size, NX_IP_PACKET_OUT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* We have crossed the packet boundary. Move to the next packet - structure. */ - current_packet = current_packet -> nx_packet_next; -#else - - /* End the loop. */ - current_packet = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Release the packet. */ - nx_packet_release(packet_ptr); - - /* Release the IP internal mutex before processing the IP event. */ - tx_mutex_put(&(nx_wifi_ip -> nx_ip_protection)); - return(NX_SUCCESS); -} - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function receives UDP packet. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT nx_wifi_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - return(nx_wifi_socket_receive((VOID*)socket_ptr, packet_ptr, wait_option, NX_WIFI_UDP_SOCKET)); -} - - -#ifdef NX_ENABLE_IP_PACKET_FILTER -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* nx_wifi_ip_packet_filter PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function builds fake IP header and TCP/UDP header to filter. */ -/* */ -/* Note: Only fill source IP, destination IP and Protocol in IP header */ -/* and fill source port and destination port in TCP/UDP header. */ -/* */ -/* INPUT */ -/* */ -/* source_ip Source IP address */ -/* destination_ip Destination IP address */ -/* source_port Source port */ -/* destination_port Destination port */ -/* protocol Protocol: TCP/UDP */ -/* packet_length Lenght of packet */ -/* direction Direction: IN/OUT */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 09-30-2020 Yuxin Zhou Initial Version 6.1 */ -/* */ -/**************************************************************************/ -static UINT nx_wifi_ip_packet_filter(ULONG source_ip, ULONG destination_ip, - ULONG source_port, ULONG destination_port, - ULONG protocol, ULONG packet_length, UINT direction) -{ - -NX_IPV4_HEADER *ip_header_ptr; -ULONG port; -UINT status; - - /* Check if the IP packet filter is set. */ - if (nx_wifi_ip -> nx_ip_packet_filter) - { - - /* Initialize the buffer. */ - memset(nx_wifi_ip_buffer, 0, 40); - - /* Update packet length. */ - if (protocol == NX_IP_TCP) - { - packet_length += 40; - } - else - { - packet_length += 28; - } - - /* Fill IP header. */ - ip_header_ptr = (NX_IPV4_HEADER *) nx_wifi_ip_buffer; - - /* Build the first 32-bit word of the IP header. */ - ip_header_ptr -> nx_ip_header_word_0 = (NX_IP_VERSION | (0xFFFF & packet_length)); - - /* Build the third 32-bit word of the IP header. */ - ip_header_ptr -> nx_ip_header_word_2 = protocol; - - /* Place the source IP address in the IP header. */ - ip_header_ptr -> nx_ip_header_source_ip = source_ip; - - /* Place the destination IP address in the IP header. */ - ip_header_ptr -> nx_ip_header_destination_ip = destination_ip; - - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_word_0); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_word_2); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_source_ip); - NX_CHANGE_ULONG_ENDIAN(ip_header_ptr -> nx_ip_header_destination_ip); - - /* Fill the TCP/UDP ports. */ - port = (source_port << NX_SHIFT_BY_16) | (destination_port); - NX_CHANGE_ULONG_ENDIAN(port); - memcpy(&nx_wifi_ip_buffer[20], &port, 4); /* Use case of memcpy is verified. */ - - /* Yes, call the IP packet filter routine. */ - status = nx_wifi_ip -> nx_ip_packet_filter(nx_wifi_ip_buffer, direction); - - if (status) - { - return (status); - } - } - - return(NX_SUCCESS); -} -#endif /* NX_ENABLE_IP_PACKET_FILTER */ diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/CMakeLists.txt b/STMicroelectronics/STM32L4_L4+/lib/netxduo/CMakeLists.txt deleted file mode 100644 index 39942a20..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/CMakeLists.txt +++ /dev/null @@ -1,497 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -set(SOURCES - common/nx_ip_create.c - common/nx_ip_delete.c - common/nx_ip_initialize.c - common/nx_packet_allocate.c - common/nx_packet_copy.c - common/nx_packet_data_adjust.c - common/nx_packet_data_append.c - common/nx_packet_data_extract_offset.c - common/nx_packet_data_retrieve.c - common/nx_packet_debug_info_get.c - common/nx_packet_length_get.c - common/nx_packet_pool_cleanup.c - common/nx_packet_pool_create.c - common/nx_packet_pool_delete.c - common/nx_packet_pool_info_get.c - common/nx_packet_pool_initialize.c - common/nx_packet_pool_low_watermark_set.c - common/nx_packet_release.c - common/nx_packet_transmit_release.c - common/nx_system_initialize.c - common/nx_tcp_client_socket_bind.c - common/nx_tcp_client_socket_connect.c - common/nx_tcp_client_socket_unbind.c - common/nx_tcp_enable.c - common/nx_tcp_free_port_find.c - common/nx_tcp_initialize.c - common/nx_tcp_socket_block_cleanup.c - common/nx_tcp_socket_create.c - common/nx_tcp_socket_delete.c - common/nx_tcp_socket_disconnect.c - common/nx_tcp_socket_establish_notify.c - common/nx_tcp_socket_receive.c - common/nx_tcp_socket_receive_notify.c - common/nx_tcp_socket_send.c - common/nx_tcp_socket_state_wait.c - common/nx_udp_enable.c - common/nx_udp_free_port_find.c - common/nx_udp_socket_bind.c - common/nx_udp_socket_create.c - common/nx_udp_socket_delete.c - common/nx_udp_socket_receive.c - common/nx_udp_socket_receive_notify.c - common/nx_udp_socket_send.c - common/nx_udp_socket_unbind.c - common/nxde_tcp_client_socket_connect.c - common/nxde_tcp_socket_peer_info_get.c - common/nxde_udp_socket_send.c - common/nxd_tcp_client_socket_connect.c - common/nxd_udp_socket_send.c - common/nxe_ip_create.c - common/nxe_ip_delete.c - common/nxe_packet_allocate.c - common/nxe_packet_copy.c - common/nxe_packet_data_append.c - common/nxe_packet_data_extract_offset.c - common/nxe_packet_data_retrieve.c - common/nxe_packet_length_get.c - common/nxe_packet_pool_create.c - common/nxe_packet_pool_delete.c - common/nxe_packet_pool_info_get.c - common/nxe_packet_pool_low_watermark_set.c - common/nxe_packet_release.c - common/nxe_packet_transmit_release.c - common/nxe_tcp_client_socket_bind.c - common/nxe_tcp_client_socket_connect.c - common/nxe_tcp_client_socket_unbind.c - common/nxe_tcp_enable.c - common/nxe_tcp_socket_create.c - common/nxe_tcp_socket_delete.c - common/nxe_tcp_socket_disconnect.c - common/nxe_tcp_socket_establish_notify.c - common/nxe_tcp_socket_receive.c - common/nxe_tcp_socket_receive_notify.c - common/nxe_tcp_socket_send.c - common/nxe_tcp_socket_state_wait.c - common/nxe_udp_enable.c - common/nxe_udp_socket_bind.c - common/nxe_udp_socket_create.c - common/nxe_udp_socket_delete.c - common/nxe_udp_socket_receive.c - common/nxe_udp_socket_receive_notify.c - common/nxe_udp_socket_send.c - common/nxe_udp_socket_unbind.c - - ${CORE_LIB_DIR}/netxduo/common/src/nx_utility.c - - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_3des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_aes.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_cbc.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ccm.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ctr.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_dh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_drbg.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecdh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecdsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ecjpake.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp192r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp224r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp256r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp384r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_ec_secp521r1_fixed_points.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_gcm.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_generic_ciphersuites.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hkdf.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha2.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_hmac_sha5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_huge_number.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_huge_number_extended.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_initialize.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_methods.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_3des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_aes.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_des.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_drbg.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_ecdh.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_ecdsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_hmac_sha.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_md5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_pkcs1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_prf.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_rsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_method_self_test_sha.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_module_start.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_null_cipher.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_phash.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_pkcs1_v1.5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_rsa.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha2.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_sha5.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_1.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha256.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha384.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_tls_prf_sha512.c - ${CORE_LIB_DIR}/netxduo/crypto_libraries/src/nx_crypto_xcbc_mac.c - - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_client_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_client_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_notify_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_stop.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_server_x509_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_client_info_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_dtls_session_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_active_certificate_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_client_psk_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_metadata_size_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_buffer_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_remote_certificate_free_all.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_server_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_alert_value_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_certificate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_client_verify_enable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_packet_buffer_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_renegotiate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_renegotiate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_server_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_sni_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_sni_extension_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_time_function_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_session_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_tls_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_certificate_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_common_name_dns_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_crl_revocation_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_dns_name_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_extended_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_extension_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nxe_secure_x509_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_3des.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_aes.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_des.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_hmac_md5.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_hmac_sha.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_md5.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_prf.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_rsa.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_method_self_test_sha.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_rng_self_test.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_crypto_table_self_test.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_allocate_handshake_packet.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_client_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_hash_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_handshake_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_helloverifyrequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_process_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_receive_callback.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_retransmit.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_retransmit_queue_flush.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_handshake_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_helloverifyrequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_send_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_notify_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_stop.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_server_x509_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_cache.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_client_info_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_session_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_dtls_verify_mac.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_module_hash_compute.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_crypto_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_finished_hash_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_session_keys_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_1_3_transcript_hash_save.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_active_certificate_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_allocate_handshake_packet.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_check_protocol_version.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ciphersuite_lookup.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_client_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_client_psk_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ecc_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_ecc_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_find_curve_method.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_finished_hash_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_generate_keys.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_generate_premaster_secret.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_hash_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_hash_update.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_handshake_process.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_hash_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_key_material_init.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_local_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_map_error_to_alert.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_metadata_size_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_newest_supported_version.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_packet_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_certificate_request.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_changecipherspec.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_clienthello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_client_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_encrypted_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_finished.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_handshake_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_header.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_newsessionticket.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_remote_certificate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_serverhello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_process_server_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_protocol_version_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_binder_generate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_psk_identity_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_calculate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_hash_update.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_payload_decrypt.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_record_payload_encrypt.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_buffer_allocate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_free.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_free_all.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_remote_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_alert.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate_request.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_changecipherspec.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_clienthello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_clienthello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_client_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_encrypted_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_finished.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_handshake_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_hellorequest.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_newsessionticket.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_record.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_serverhello.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_serverhello_extensions.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_send_server_key_exchange.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_server_handshake.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_alert_value_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_certificate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_verify_disable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_client_verify_enable.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_create.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_create_ext.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_delete.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_end.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_iv_size_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_keys_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_packet_buffer_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_protocol_version_override.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_receive.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_receive_records.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_renegotiate.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_renegotiate_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_reset.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_send.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_server_callback_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_sni_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_sni_extension_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_start.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_time_function_set.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_session_x509_client_verify_configure.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_shutdown.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_trusted_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_trusted_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_tls_verify_mac.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_asn1_tlv_block_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_chain_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_list_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_revocation_list_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_certificate_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_common_name_dns_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_crl_revocation_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_crl_verify.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_distinguished_name_compare.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_distinguished_name_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_dns_name_initialize.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_ec_private_key_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_expiration_check.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_extended_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_extension_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_find_certificate_methods.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_find_curve_method.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_free_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_key_usage_extension_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_local_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_local_device_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_oid_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_pkcs1_rsa_private_key_parse.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_pkcs7_decode.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_remote_endpoint_certificate_get.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_add.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_store_certificate_remove.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_subject_alt_names_find.c - ${CORE_LIB_DIR}/netxduo/nx_secure/src/nx_secure_x509_wildcard_compare.c - - ${CORE_LIB_DIR}/netxduo/addons/dns/nxd_dns.c - ${CORE_LIB_DIR}/netxduo/addons/sntp/nxd_sntp_client.c - ${CORE_LIB_DIR}/netxduo/addons/mqtt/nxd_mqtt_client.c - ${CORE_LIB_DIR}/netxduo/addons/cloud/nx_cloud.c -) - -set(TARGET netxduo) - -add_library(${TARGET} OBJECT) -add_library("azrtos::${TARGET}" ALIAS ${TARGET}) - -# Append Azure IoT file if the user wants it -if(NXD_ENABLE_AZURE_IOT) - list(APPEND SOURCES - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_hub_client.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_json_reader.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_json_writer.c - ${CORE_LIB_DIR}/netxduo/addons/azure_iot/nx_azure_iot_provisioning_client.c - ) - - set(ENV{AZ_SDK_C_NO_SAMPLES} TRUE) - add_subdirectory(${CORE_LIB_DIR}/netxduo/addons/azure_iot/azure-sdk-for-c azure_sdk_for_c) - target_link_libraries(${TARGET} - PUBLIC - az::iot::hub - az::iot::provisioning) -endif() - -target_sources(${TARGET} - PRIVATE - ${SOURCES} -) - -target_compile_definitions(${TARGET} - PUBLIC - NX_INCLUDE_USER_DEFINE_FILE - NX_AZURE_DISABLE_IOT_SECURITY_MODULE -) - -target_include_directories(${TARGET} - PUBLIC - . - ports/cortex_m4/${THREADX_TOOLCHAIN}/inc - common - ${CORE_LIB_DIR}/netxduo/crypto_libraries/inc - ${CORE_LIB_DIR}/netxduo/nx_secure/inc - ${CORE_LIB_DIR}/netxduo/nx_secure/ports - ${CORE_LIB_DIR}/netxduo/addons/azure_iot - ${CORE_LIB_DIR}/netxduo/addons/cloud - ${CORE_LIB_DIR}/netxduo/addons/dns - ${CORE_LIB_DIR}/netxduo/addons/mqtt - ${CORE_LIB_DIR}/netxduo/addons/sntp -) - -target_link_libraries(${TARGET} - PUBLIC - azrtos::threadx -) diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSE.txt b/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSE.txt deleted file mode 100644 index 76974a36..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSE.txt +++ /dev/null @@ -1,246 +0,0 @@ -MICROSOFT SOFTWARE LICENSE TERMS - -MICROSOFT AZURE RTOS - -Shape - -These license terms are an agreement between you and Microsoft Corporation (or -one of its affiliates). They apply to the software named above and any Microsoft -services or software updates (except to the extent such services or updates are -accompanied by new or additional terms, in which case those different terms -apply prospectively and do not alter your or Microsoft’s rights relating to -pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU -HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. - -INSTALLATION AND USE RIGHTS. - -General. You may install and use the software and the included Microsoft -applications solely for internal development, testing and evaluation purposes. -Any distribution or production use requires a separate license as set forth in -Section 2. - -Contributions. Microsoft welcomes contributions to this software. In the event -that you make a contribution to this software you will be required to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and -actually do, grant Microsoft the rights to use your contribution. For details, -visit https://cla.microsoft.com. - -Included Microsoft Applications. The software includes other Microsoft -applications which are governed by the licenses embedded in or made available -with those applications. - -Third Party Components. The software may include third party components with -separate legal notices or governed by other agreements, as may be described -within the software or in the ThirdPartyNotices file(s) accompanying the -software. - -Competitive Benchmarking. If you are a direct competitor, and you access or use -the software for purposes of competitive benchmarking, analysis, or intelligence -gathering, you waive as against Microsoft, its subsidiaries, and its affiliated -companies (including prospectively) any competitive use, access, and -benchmarking test restrictions in the terms governing your software to the -extent your terms of use are, or purport to be, more restrictive than -Microsoft’s terms. If you do not waive any such purported restrictions in the -terms governing your software, you are not allowed to access or use this -software, and will not do so. - -DISTRIBUTION AND PRODUCTION USE. If you have obtained and/or are developing on -microprocessor(s) and/or microcontroller(s) (“hardware”) listed in the file -named “LICENSED-HARDWARE.txt” included in the repository and/or distributed with -the software you have the following rights in and to the software solely when -used in combination with the hardware. In the event hardware is not listed in -the LICENSED-HARDWARE.txt file, you do not have the rights in this Section 2. - -Distribution and Production Use Rights. - -You may use the software in production (e.g. program the modified or unmodified -software to devices you own or control) and distribute (i.e. make available to -third parties) the modified or unmodified binary image produced from this code. - - -You may permit your device distributors or developers to copy and distribute the -binary image as programmed or to be programmed to your devices. - -You may redistribute the unmodified or modified source to your device -distributors or developers. Modifications must be clearly marked. Any -redistribution in source code form must contain this license and any other -licenses that accompany the software. - -Requirements. For any code you distribute, you must: - -when distributed in binary form, except as embedded in a device, include with -such distribution the terms of this agreement; - -when distributed in source code form to distributors or developers of your -devices, include with such distribution the terms of this agreement; and - -indemnify, defend and hold harmless Microsoft from any claims, including -attorneys’ fees, related to the distribution or use of your devices, except to -the extent that any claim is based solely on the unmodified software. - -Restrictions. You may not: - -use or modify the software to create a competing real time operating system -software; - -remove any copyright notices or licenses contained in the software; - -use Microsoft’s trademarks or trade dress in your application in any way that -suggests your device or application comes from or is endorsed by Microsoft; - -transfer individual components, specific libraries, classes, functions or code -fragments of the software separately for purposes unrelated to the software; or - -use or distribute the software in any way that would subject the software or -Microsoft’s intellectual property or technology to any other license terms. - -SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all -other rights. Unless applicable law gives you more rights despite this -limitation, you will not (and have no right to): - -remove, minimize, block, or modify any notices of Microsoft or its suppliers in -the software; - -use the software in any way that is against the law or to create or propagate -malware; or - -share, publish, distribute, or lease the software (except as permitted in -Section 2 above), or provide the software as a stand-alone offering for others -to use. - -DATA. This software may interact with other Microsoft products that collect data -that is transmitted to Microsoft. To learn more about how Microsoft processes -personal data we collect, please see the Microsoft Privacy Statement at -https://go.microsoft.com/fwlink/?LinkId=248681. - -EXPORT RESTRICTIONS. You must comply with all domestic and international export -laws and regulations that apply to the software, which include restrictions on -destinations, end users, and end use. For further information on export -restrictions, visit https://aka.ms/exporting. - -SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any -support services for the software. Any support provided is “as is”, “with all -faults”, and without warranty of any kind. - -UPDATES. Microsoft may periodically update the software. You may obtain updates -only from Microsoft or Microsoft-authorized sources. Updates may not include or -support all existing software features, services, or peripheral devices. - -TERMINATION. Without prejudice to any other rights, Microsoft may terminate this -agreement if you fail to comply with any of its terms or conditions. In such -event, you must destroy all copies of the software and all of its component -parts. - -ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for -supplements, updates, or third-party applications, is the entire agreement for -the software. To the extent you have entered into a separate agreement with -Microsoft relating specifically to the software, the terms in such agreement -shall control. - -APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in -the United States or Canada, the laws of the state or province where you live -(or, if a business, where your principal place of business is located) govern -the interpretation of this agreement, claims for its breach, and all other -claims (including consumer protection, unfair competition, and tort claims), -regardless of conflict of laws principles. If you acquired the software in any -other country, its laws apply. If U.S. federal jurisdiction exists, you and -Microsoft consent to exclusive jurisdiction and venue in the federal court in -King County, Washington for all disputes heard in court. If not, you and -Microsoft consent to exclusive jurisdiction and venue in the Superior Court of -King County, Washington for all disputes heard in court. - -CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal -rights. You may have other rights, including consumer rights, under the laws of -your state or country. Separate and apart from your relationship with Microsoft, -you may also have rights with respect to the party from which you acquired the -software. This agreement does not change those other rights if the laws of your -state or country do not permit it to do so. For example, if you acquired the -software in one of the below regions, or mandatory country law applies, then the -following provisions apply to you: - -Australia. You have statutory guarantees under the Australian Consumer Law and -nothing in this agreement is intended to affect those rights. - -Germany and Austria. - -i.Warranty. The properly licensed software will perform substantially as -described in any Microsoft materials that accompany the software. However, -Microsoft gives no contractual guarantee in relation to the licensed software. - -ii.Limitation of Liability. In case of intentional conduct, gross negligence, -claims based on the Product Liability Act, as well as, in case of death or -personal or physical injury, Microsoft is liable according to the statutory law. - - -Subject to the foregoing clause ii., Microsoft will only be liable for slight -negligence if Microsoft is in breach of such material contractual obligations, -the fulfillment of which facilitate the due performance of this agreement, the -breach of which would endanger the purpose of this agreement and the compliance -with which a party may constantly trust in (so-called "cardinal obligations"). -In other cases of slight negligence, Microsoft will not be liable for slight -negligence. - -DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF -USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO -THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED -WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND -NON-INFRINGEMENT. - -LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING -DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM -MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT -RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, -INDIRECT, OR INCIDENTAL DAMAGES. - -This limitation applies to (a) anything related to the software, services, -content (including code) on third party Internet sites, or third party -applications; and (b) claims for breach of contract, warranty, guarantee, or -condition; strict liability, negligence, or other tort; or any other claim; in -each case to the extent permitted by applicable law. - -It also applies even if Microsoft knew or should have known about the -possibility of the damages. The above limitation or exclusion may not apply to -you because your state, province, or country may not allow the exclusion or -limitation of incidental, consequential, or other damages. - - - -Please note: As this software is distributed in Canada, some of the clauses in -this agreement are provided below in French. - -Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce -contrat sont fournies ci-dessous en français. - -EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel -». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft -n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits -additionnels en vertu du droit local sur la protection des consommateurs, que ce -contrat ne peut modifier. La ou elles sont permises par le droit locale, les -garanties implicites de qualité marchande, d’adéquation à un usage particulier -et d’absence de contrefaçon sont exclues. - -LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES -DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une -indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous -ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris -les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. - -Cette limitation concerne: - -•tout ce qui est relié au logiciel, aux services ou au contenu (y compris le -code) figurant sur des sites Internet tiers ou dans des programmes tiers; et - -•les réclamations au titre de violation de contrat ou de garantie, ou au titre -de responsabilité stricte, de négligence ou d’une autre faute dans la limite -autorisée par la loi en vigueur. - -Elle s’applique également, même si Microsoft connaissait ou devrait connaître -l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la -limitation de responsabilité pour les dommages indirects, accessoires ou de -quelque nature que ce soit, il se peut que la limitation ou l’exclusion -ci-dessus ne s’appliquera pas à votre égard. - -EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous -pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent -contrat ne modifie pas les droits que vous confèrent les lois de votre pays si -celles-ci ne le permettent pas. \ No newline at end of file diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSED-HARDWARE.txt b/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSED-HARDWARE.txt deleted file mode 100644 index 77dd1abf..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/LICENSED-HARDWARE.txt +++ /dev/null @@ -1,16 +0,0 @@ -LICENSED HARDWARE LIST - -Last Updated: 2020-05-08 - -Microsoft has entered into OEM Agreements with manufacturers of the following -microprocessors and microcontrollers (the “hardware”) to enable those -manufacturers to include and distribute Azure RTOS in certain hardware. If you -have obtained and/or are developing on microprocessor(s) and/or -microcontroller(s) (“hardware”) listed below you inherit the “Distribution and -Production Use” rights in Section 2 of the Microsoft Software License Terms for -Microsoft Azure RTOS. If hardware is not listed below, you do not have those -rights. - --------------------------------------------------------------------------------- - -More coming soon. Please check back frequently for updates. \ No newline at end of file diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_api.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_api.h deleted file mode 100644 index 71d1e352..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_api.h +++ /dev/null @@ -1,3850 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Application Interface (API) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* APPLICATION INTERFACE DEFINITION RELEASE */ -/* */ -/* nx_api.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the basic Application Interface (API) to the */ -/* high-performance NetX TCP/IP implementation for the ThreadX */ -/* real-time kernel. All service prototypes and data structure */ -/* definitions are defined in this file. Please note that basic data */ -/* type definitions and other architecture-specific information is */ -/* contained in the file nx_port.h. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), fixed */ -/* ThreadX version check, */ -/* updated product constants, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_API_H -#define NX_API_H - -/* Determine if a C++ compiler is being used. If so, ensure that standard - C is used to process the API information. */ - -#ifdef __cplusplus - -/* Yes, C++ compiler is present. Use standard C. */ -extern "C" { - -#endif - - -/* Disable warning of parameter not used. */ -#ifndef NX_PARAMETER_NOT_USED -#define NX_PARAMETER_NOT_USED(p) ((void)(p)) -#endif /* NX_PARAMETER_NOT_USED */ - - -/* Bypass ThreadX API error checking for internal NetX calls. */ - -#ifdef NX_SOURCE_CODE -#ifndef TX_DISABLE_ERROR_CHECKING -#define TX_DISABLE_ERROR_CHECKING -#endif -#endif - - - -/* Include the ThreadX and port-specific data type file. */ - -#include "tx_api.h" -#include "nx_port.h" - -#ifdef NX_IPSEC_ENABLE -#include "nx_crypto_const.h" -#endif /* NX_IPSEC_ENABLE */ -/* Include the ThreadX trace information. */ - -#include "tx_trace.h" - -/* Define symbols for compatibility before and after ThreadX 5.8. */ -#if (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508) -#define NX_CLEANUP_PARAMETER , ULONG suspension_sequence -#define NX_CLEANUP_ARGUMENT , 0 -#define NX_CLEANUP_EXTENSION NX_PARAMETER_NOT_USED(suspension_sequence); -#else -#define NX_CLEANUP_PARAMETER -#define NX_CLEANUP_ARGUMENT -#define NX_CLEANUP_EXTENSION -#endif /* (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508) */ - -/* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */ -#ifndef TX_THREAD_GET_SYSTEM_STATE -#define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state -#endif - -/* Define basic alignment type used in block and byte pool operations. This data type must - be at least 32-bits in size and also be large enough to hold a pointer type. */ - -#ifndef ALIGN_TYPE_DEFINED -#define ALIGN_TYPE ULONG -#endif - - -/* Define the extension to hold the control block. */ -#ifndef NX_THREAD_EXTENSION_PTR_SET -#define NX_THREAD_EXTENSION_PTR_SET(a, b) -#endif /* NX_THREAD_EXTENSION_PTR_SET */ - -#ifndef NX_THREAD_EXTENSION_PTR_GET -#define NX_THREAD_EXTENSION_PTR_GET(a, b, c) { \ - (a) = (b *)(c); \ - } -#endif /* NX_THREAD_EXTENSION_PTR_GET */ - -#ifndef NX_TIMER_EXTENSION_PTR_SET -#define NX_TIMER_EXTENSION_PTR_SET(a, b) -#endif /* NX_TIMER_EXTENSION_PTR_SET */ - -#ifndef NX_TIMER_EXTENSION_PTR_GET -#define NX_TIMER_EXTENSION_PTR_GET(a, b, c) { \ - (a) = (b *)(c); \ - } -#endif /* NX_TIMER_EXTENSION_PTR_GET */ - - -#ifdef TX_UCHAR_POINTER_ADD -#define NX_UCHAR_POINTER_ADD(a,b) TX_UCHAR_POINTER_ADD(a,b) -#else -#define NX_UCHAR_POINTER_ADD(a,b) (((UCHAR *) (a)) + ((UINT) (b))) -#endif - - -/* The symbol "NX_IP_PERIODIC_RATE" specifies the number of ThreadX timer ticks in one second. - The value should be derived from TX_TIMER_TICKS_PER_SECOND, which is defined in ThreadX port. - If TX_TIMER_TICKS_PER_SECOND is not defined, NX_IP_PERIODIC_RATE defaults to 100 ticks per second. */ - -#ifndef NX_IP_PERIODIC_RATE -#ifdef TX_TIMER_TICKS_PER_SECOND -#define NX_IP_PERIODIC_RATE TX_TIMER_TICKS_PER_SECOND -#else -#define NX_IP_PERIODIC_RATE 100 -#endif -#endif - - -/* This defines the ASSET and process on ASSET fail. */ -#ifndef NX_DISABLE_ASSERT -#ifndef NX_ASSERT_FAIL -#define NX_ASSERT_FAIL for (;;) {tx_thread_sleep(NX_WAIT_FOREVER); } -#endif /* NX_ASSERT_FAIL */ -#define NX_ASSERT(s) if (!(s)) {NX_ASSERT_FAIL} -#else -#define NX_ASSERT(s) -#endif /* NX_DISABLE_ASSERT */ - - -#ifndef NX_RAND -#ifdef NX_HIGH_SECURITY -#error "The symbol NX_RAND must be defined to use a qualified random number generator." -#else -#define NX_RAND rand -#endif -#endif - -#ifndef NX_SRAND -#ifdef NX_HIGH_SECURITY -#error "The symbol NX_SRAND must be defined to use a qualified random number seed." -#else -#define NX_SRAND srand -#endif -#endif - - -/* Define the max string length. */ -#ifndef NX_MAX_STRING_LENGTH -#define NX_MAX_STRING_LENGTH 1024 -#endif /* NX_MAX_STRING_LENGTH */ - - -/* Determine if tracing is enabled. */ - -#ifdef TX_ENABLE_EVENT_TRACE - -/* Define the object types in NetX, if not defined. */ - -#ifndef NX_TRACE_OBJECT_TYPE_IP -#define NX_TRACE_OBJECT_TYPE_IP 11 /* P1 = stack start address, P2 = stack size */ -#define NX_TRACE_OBJECT_TYPE_PACKET_POOL 12 /* P1 = packet size, P2 = number of packets */ -#define NX_TRACE_OBJECT_TYPE_TCP_SOCKET 13 /* P1 = IP address, P2 = window size */ -#define NX_TRACE_OBJECT_TYPE_UDP_SOCKET 14 /* P1 = IP address, P2 = receive queue maximum */ -#endif - - -/* Define event filters that can be used to selectively disable certain events or groups of events. */ - -#define NX_TRACE_ALL_EVENTS 0x00FF8000 /* All NetX events */ -#define NX_TRACE_INTERNAL_EVENTS 0x00008000 /* NetX internal events */ -#define NX_TRACE_ARP_EVENTS 0x00010000 /* NetX ARP events */ -#define NX_TRACE_ICMP_EVENTS 0x00020000 /* NetX ICMP events */ -#define NX_TRACE_IGMP_EVENTS 0x00040000 /* NetX IGMP events */ -#define NX_TRACE_IP_EVENTS 0x00080000 /* NetX IP events */ -#define NX_TRACE_PACKET_EVENTS 0x00100000 /* NetX Packet events */ -#define NX_TRACE_RARP_EVENTS 0x00200000 /* NetX RARP events */ -#define NX_TRACE_TCP_EVENTS 0x00400000 /* NetX TCP events */ -#define NX_TRACE_UDP_EVENTS 0x00800000 /* NetX UDP events */ - - -/* Define the trace events in NetX, if not defined. */ - -/* Define NetX Trace Events, along with a brief description of the additional information fields, - where I1 -> Information Field 1, I2 -> Information Field 2, etc. */ - -/* Define the NetX internal events first. */ - -#ifndef NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE -#define NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE 300 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_REQUEST_SEND 301 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_RESPONSE_RECEIVE 302 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ARP_RESPONSE_SEND 303 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr */ -#define NX_TRACE_INTERNAL_ICMP_RECEIVE 304 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */ -#define NX_TRACE_INTERNAL_ICMP_SEND 305 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = header 0 */ -#define NX_TRACE_INTERNAL_IGMP_RECEIVE 306 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */ - -#define NX_TRACE_INTERNAL_IP_RECEIVE 308 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = packet length */ -#define NX_TRACE_INTERNAL_IP_SEND 309 /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = length */ -#define NX_TRACE_INTERNAL_TCP_DATA_RECEIVE 310 /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_DATA_SEND 311 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_FIN_RECEIVE 312 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_FIN_SEND 313 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_RESET_RECEIVE 314 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_RESET_SEND 315 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_SYN_RECEIVE 316 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_TCP_SYN_SEND 317 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence */ -#define NX_TRACE_INTERNAL_UDP_RECEIVE 318 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = header word 0 */ -#define NX_TRACE_INTERNAL_UDP_SEND 319 /* I1 = ip ptr, I2 = socket_ptr, I3 = packet ptr, I4 = header 0 */ -#define NX_TRACE_INTERNAL_RARP_RECEIVE 320 /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */ -#define NX_TRACE_INTERNAL_RARP_SEND 321 /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */ -#define NX_TRACE_INTERNAL_TCP_RETRY 322 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = number of retries */ -#define NX_TRACE_INTERNAL_TCP_STATE_CHANGE 323 /* I1 = ip ptr, I2 = socket ptr, I3 = previous state, I4 = new state */ -#define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_SEND 324 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_INITIALIZE 325 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_LINK_ENABLE 326 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_LINK_DISABLE 327 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_BROADCAST 328 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_ARP_SEND 329 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_ARP_RESPONSE_SEND 330 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_RARP_SEND 331 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ -#define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_JOIN 332 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_LEAVE 333 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_STATUS 334 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_SPEED 335 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_DUPLEX_TYPE 336 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_ERROR_COUNT 337 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_RX_COUNT 338 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_TX_COUNT 339 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_GET_ALLOC_ERRORS 340 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_UNINITIALIZE 341 /* I1 = ip ptr */ -#define NX_TRACE_INTERNAL_IO_DRIVER_DEFERRED_PROCESSING 342 /* I1 = ip ptr, I2 = packet ptr, I3 = packet size */ - -#define NX_TRACE_ARP_DYNAMIC_ENTRIES_INVALIDATE 350 /* I1 = ip ptr, I2 = entries invalidated */ -#define NX_TRACE_ARP_DYNAMIC_ENTRY_SET 351 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_ENABLE 352 /* I1 = ip ptr, I2 = arp cache memory, I3 = arp cache size */ -#define NX_TRACE_ARP_GRATUITOUS_SEND 353 /* I1 = ip ptr */ -#define NX_TRACE_ARP_HARDWARE_ADDRESS_FIND 354 /* I1 = ip ptr, I2 = ip_address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_INFO_GET 355 /* I1 = ip ptr, I2 = arps sent, I3 = arp responses, I3 = arps received */ -#define NX_TRACE_ARP_IP_ADDRESS_FIND 356 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw */ -#define NX_TRACE_ARP_STATIC_ENTRIES_DELETE 357 /* I1 = ip ptr, I2 = entries deleted */ -#define NX_TRACE_ARP_STATIC_ENTRY_CREATE 358 /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical_lsw */ -#define NX_TRACE_ARP_STATIC_ENTRY_DELETE 359 /* I1 = ip ptr, I2 = ip address, I3 = physical_msw, I4 = physical_lsw */ -#define NX_TRACE_ICMP_ENABLE 360 /* I1 = ip ptr */ -#define NX_TRACE_ICMP_INFO_GET 361 /* I1 = ip ptr, I2 = pings sent, I3 = ping responses, I4 = pings received */ -#define NX_TRACE_ICMP_PING 362 /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size */ -#define NX_TRACE_IGMP_ENABLE 363 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_INFO_GET 364 /* I1 = ip ptr, I2 = reports sent, I3 = queries received, I4 = groups joined*/ -#define NX_TRACE_IGMP_LOOPBACK_DISABLE 365 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_LOOPBACK_ENABLE 366 /* I1 = ip ptr */ -#define NX_TRACE_IGMP_MULTICAST_JOIN 367 /* I1 = ip ptr, I2 = group address */ -#define NX_TRACE_IGMP_MULTICAST_LEAVE 368 /* I1 = ip ptr, I2 = group_address */ -#define NX_TRACE_IP_ADDRESS_CHANGE_NOTIFY 369 /* I1 = ip ptr, I2 = ip address change notify, I3 = additional info */ -#define NX_TRACE_IP_ADDRESS_GET 370 /* I1 = ip ptr, I2 = ip address, I3 = network_mask */ -#define NX_TRACE_IP_ADDRESS_SET 371 /* I1 = ip ptr, I2 = ip address, I3 = network_mask */ -#define NX_TRACE_IP_CREATE 372 /* I1 = ip ptr, I2 = ip address, I3 = network mask, I4 = default_pool */ -#define NX_TRACE_IP_DELETE 373 /* I1 = ip ptr */ -#define NX_TRACE_IP_DRIVER_DIRECT_COMMAND 374 /* I1 = ip ptr, I2 = command, I3 = return value */ -#define NX_TRACE_IP_FORWARDING_DISABLE 375 /* I1 = ip ptr */ -#define NX_TRACE_IP_FORWARDING_ENABLE 376 /* I1 = ip ptr */ -#define NX_TRACE_IP_FRAGMENT_DISABLE 377 /* I1 = ip ptr */ -#define NX_TRACE_IP_FRAGMENT_ENABLE 378 /* I1 = ip ptr */ -#define NX_TRACE_IP_GATEWAY_ADDRESS_SET 379 /* I1 = ip ptr, I2 = gateway address */ -#define NX_TRACE_IP_INFO_GET 380 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = packets dropped */ -#define NX_TRACE_IP_RAW_PACKET_DISABLE 381 /* I1 = ip ptr */ -#define NX_TRACE_IP_RAW_PACKET_ENABLE 382 /* I1 = ip ptr */ -#define NX_TRACE_IP_RAW_PACKET_RECEIVE 383 /* I1 = ip ptr, I2 = packet ptr, I3 = wait option */ -#define NX_TRACE_IP_RAW_PACKET_SEND 384 /* I1 = ip ptr, I2 = packet ptr, I3 = destination ip, I4 = type of service */ -#define NX_TRACE_IP_STATUS_CHECK 385 /* I1 = ip ptr, I2 = needed status, I3 = actual status, I4 = wait option */ -#define NX_TRACE_PACKET_ALLOCATE 386 /* I1 = pool ptr, I2 = packet ptr, I3 = packet type, I4 = available packets */ -#define NX_TRACE_PACKET_COPY 387 /* I1 = packet ptr, I2 = new packet ptr, I3 = pool ptr, I4 = wait option */ -#define NX_TRACE_PACKET_DATA_APPEND 388 /* I1 = packet ptr, I2 = data start, I3 = data size, I4 = pool ptr */ -#define NX_TRACE_PACKET_DATA_RETRIEVE 389 /* I1 = packet ptr, I2 = buffer start, I3 = bytes copied */ -#define NX_TRACE_PACKET_LENGTH_GET 390 /* I1 = packet ptr, I2 = length */ -#define NX_TRACE_PACKET_POOL_CREATE 391 /* I1 = pool ptr, I2 = payload size, I3 = memory ptr, I4 = memory_size */ -#define NX_TRACE_PACKET_POOL_DELETE 392 /* I1 = pool ptr */ -#define NX_TRACE_PACKET_POOL_INFO_GET 393 /* I1 = pool ptr, I2 = total_packets, I3 = free packets, I4 = empty requests*/ -#define NX_TRACE_PACKET_RELEASE 394 /* I1 = packet ptr, I2 = packet status, I3 = available packets */ -#define NX_TRACE_PACKET_TRANSMIT_RELEASE 395 /* I1 = packet ptr, I2 = packet status, I3 = available packets */ -#define NX_TRACE_RARP_DISABLE 396 /* I1 = ip ptr */ -#define NX_TRACE_RARP_ENABLE 397 /* I1 = ip ptr */ -#define NX_TRACE_RARP_INFO_GET 398 /* I1 = ip ptr, I2 = requests sent, I3 = responses received, I4 = invalids */ -#define NX_TRACE_SYSTEM_INITIALIZE 399 /* none */ -#define NX_TRACE_TCP_CLIENT_SOCKET_BIND 400 /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option */ -#define NX_TRACE_TCP_CLIENT_SOCKET_CONNECT 401 /* I1 = ip ptr, I2 = socket ptr, I3 = server ip, I4 = server port */ -#define NX_TRACE_TCP_CLIENT_SOCKET_PORT_GET 402 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_TCP_CLIENT_SOCKET_UNBIND 403 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_TCP_ENABLE 404 /* I1 = ip ptr */ -#define NX_TRACE_TCP_FREE_PORT_FIND 405 /* I1 = ip ptr, I2 = port, I3 = free port */ -#define NX_TRACE_TCP_INFO_GET 406 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets */ -#define NX_TRACE_TCP_SERVER_SOCKET_ACCEPT 407 /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_LISTEN 408 /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = listen queue size */ -#define NX_TRACE_TCP_SERVER_SOCKET_RELISTEN 409 /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_UNACCEPT 410 /* I1 = ip ptr, I2 = socket ptr, I3 = socket state */ -#define NX_TRACE_TCP_SERVER_SOCKET_UNLISTEN 411 /* I1 = ip ptr, I2 = port */ -#define NX_TRACE_TCP_SOCKET_CREATE 412 /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = window size */ -#define NX_TRACE_TCP_SOCKET_DELETE 413 /* I1 = ip ptr, I2 = socket ptr, I3 = socket state */ -#define NX_TRACE_TCP_SOCKET_DISCONNECT 414 /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_INFO_GET 415 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received */ -#define NX_TRACE_TCP_SOCKET_MSS_GET 416 /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_MSS_PEER_GET 417 /* I1 = ip ptr, I2 = socket ptr, I3 = peer_mss, I4 = socket state */ -#define NX_TRACE_TCP_SOCKET_MSS_SET 418 /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 socket state */ -#define NX_TRACE_TCP_SOCKET_RECEIVE 419 /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = rx sequence */ -#define NX_TRACE_TCP_SOCKET_RECEIVE_NOTIFY 420 /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify */ -#define NX_TRACE_TCP_SOCKET_SEND 421 /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = tx sequence */ -#define NX_TRACE_TCP_SOCKET_STATE_WAIT 422 /* I1 = ip ptr, I2 = socket ptr, I3 = desired state, I4 = previous state */ -#define NX_TRACE_TCP_SOCKET_TRANSMIT_CONFIGURE 423 /* I1 = ip ptr, I2 = socket ptr, I3 = queue depth, I4 = timeout */ -#define NX_TRACE_UDP_ENABLE 424 /* I1 = ip ptr */ -#define NX_TRACE_UDP_FREE_PORT_FIND 425 /* I1 = ip ptr, I2 = port, I3 = free port */ -#define NX_TRACE_UDP_INFO_GET 426 /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets */ -#define NX_TRACE_UDP_SOCKET_BIND 427 /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option */ -#define NX_TRACE_UDP_SOCKET_CHECKSUM_DISABLE 428 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_CHECKSUM_ENABLE 429 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_CREATE 430 /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = queue maximum */ -#define NX_TRACE_UDP_SOCKET_DELETE 431 /* I1 = ip ptr, I2 = socket ptr */ -#define NX_TRACE_UDP_SOCKET_INFO_GET 432 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received */ -#define NX_TRACE_UDP_SOCKET_PORT_GET 433 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_UDP_SOCKET_RECEIVE 434 /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = packet size */ -#define NX_TRACE_UDP_SOCKET_RECEIVE_NOTIFY 435 /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify */ -#define NX_TRACE_UDP_SOCKET_SEND 436 /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address */ -#define NX_TRACE_UDP_SOCKET_UNBIND 437 /* I1 = ip ptr, I2 = socket ptr, I3 = port */ -#define NX_TRACE_UDP_SOURCE_EXTRACT 438 /* I1 = packet ptr, I2 = ip address, I3 = port */ -#define NX_TRACE_IP_INTERFACE_ATTACH 439 /* I1 = ip ptr, I2 = ip address, I3 = interface index */ -#define NX_TRACE_UDP_SOCKET_BYTES_AVAILABLE 440 /* I1 = ip ptr, I2 = socket ptr, I3 = bytes available */ -#define NX_TRACE_IP_STATIC_ROUTE_ENABLE 441 /* I1 = ip_ptr, */ -#define NX_TRACE_IP_STATIC_ROUTE_DISABLE 442 /* I1 = ip_ptr, */ -#define NX_TRACE_IP_STATIC_ROUTE_ADD 443 /* I1 = ip_ptr, I2 = network_address, I3 = net_mask, I4 = next_hop */ -#define NX_TRACE_IP_STATIC_ROUTE_DELETE 444 /* I1 = ip_ptr, I2 = network_address, I3 = net_mask */ -#define NX_TRACE_TCP_SOCKET_PEER_INFO_GET 445 /* I1 = socket ptr, I2 = network_address, I3 = port */ -#define NX_TRACE_TCP_SOCKET_WINDOW_UPDATE_NOTIFY_SET 446 /* I1 = socket ptr, */ -#define NX_TRACE_UDP_SOCKET_INTERFACE_SET 447 /* I1 = socket_ptr, I2 = interface_index, */ -#define NX_TRACE_UDP_SOCKET_INTERFACE_CLEAR 448 /* I1 = socket_ptr, */ -#define NX_TRACE_IP_INTERFACE_INFO_GET 449 /* I1 = ip_ptr, I2 = ip_address, I3 = mtu_size, I4 = interface_index */ -#define NX_TRACE_PACKET_DATA_EXTRACT_OFFSET 450 /* I1 = packet_ptr, I2 = buffer_length, I3 = bytes_copied, */ - - -#endif - - -#ifndef NXD_TRACE_ICMP_ENABLE -#define NXD_TRACE_ICMP_ENABLE 470 /* I1 = ip ptr */ -#define NX_TRACE_ICMP_PING6 471 /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size */ -#define NXD_TRACE_UDP_SOURCE_EXTRACT 472 /* I1 = packet ptr, I2 = IP Version (4 or 6), I3 = ip address, I4 = port */ -#define NXD_TRACE_UDP_SOCKET_SET_INTERFACE 473 /* I1 = udp_socket_ptr, I2 = interface_id */ -#define NXD_TRACE_TCP_SOCKET_SET_INTERFACE 474 /* I1 = tcp_socket_ptr, I2 = interface_id */ -#define NXD_TRACE_UDP_SOCKET_SEND 475 /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address */ -#define NXD_TRACE_ND_CACHE_DELETE 476 /* I1 = dest_ip */ -#define NXD_TRACE_ND_CACHE_ENTRY_SET 477 /* I1 = IP address, I2 = physical msw, I3 = physical lsw */ -#define NX_TRACE_ND_CACHE_IP_ADDRESS_FIND 478 /* I1 = ip_ptr, I2 = IP address, I3 = physical msw, I4 = physical lsw */ -#define NXD_TRACE_ND_CACHE_INVALIDATE 479 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_GLOBAL_ADDRESS_GET 480 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NXD_TRACE_IPV6_GLOBAL_ADDRESS_SET 481 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NX_TRACE_IPSTATIC_ROUTE_ADD 482 /* I1 = ip_ptr, I2 = network address, I3 = net_mask, I4 = next hop address */ -#define NX_TRACE_IP_STATIC_ROUTING_ENABLE 483 /* I1 = ip_ptr */ -#define NX_TRACE_IP_STATIC_ROUTING_DISABLE 484 /* I1 = ip_ptr */ -#define NX_TRACE_IPV6_ENABLE 485 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_RAW_PACKET_SEND 486 /* I1 = ip_ptr, I2 = ip address lsw, I3 = protocol, I4 = packet_ptr */ -#define NXD_TRACE_IP_RAW_PACKET_SEND 487 /* I1 = ip_ptr, I2 = ip address lsw, I3 = type of serveice, I4 = packet_ptr */ -#define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_GET 488 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw */ -#define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_SET 489 /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length */ -#define NXD_TRACE_IPV6_INITIATE_DAD_PROCESS 490 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_DEFAULT_ROUTER_ADD 491 /* I1 = ip_ptr, I2 = router addr lsw, I3 = router lifetime */ -#define NXD_TRACE_IPV6_DEFAULT_ROUTER_DELETE 492 /* I1 = ip_ptr, I2 = router addr lsw, */ -#define NXD_TRACE_IPV6_INTERFACE_ADDRESS_GET 493 /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */ -#define NXD_TRACE_IPV6_INTERFACE_ADDRESS_SET 494 /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */ -#define NXD_TRACE_TCP_SOCKET_PEER_INFO_GET 495 /* I1 = socket_ptr, I2 = Peer IP address, I3 = peer_port */ -#define NXD_TRACE_IP_MAX_PAYLOAD_SIZE_FIND 496 /* I1 = src address, I2 = dst address,I3 = payload length,I4 = start offset */ -#define NX_TRACE_IPV6_DISABLE 497 /* I1 = ip_ptr */ -#define NXD_TRACE_IPV6_ADDRESS_CHANGE_NOTIFY 498 /* I1 = ip_ptr, I2 = notify_callback */ -#define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_ENABLE 499 /* I1 = ip_ptr, I2 = interface_index */ -#define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_DISABLE 500 /* I1 = ip_ptr, I2 = interface_index */ -#define NXD_TRACE_IP_RAW_PACKET_FILTER_SET 501 /* I1 = ip_ptr, I2 = raw_pcket_filter */ -#endif - -/* Map the trace macros to internal NetX versions so we can get interrupt protection. */ - -#ifdef NX_SOURCE_CODE - -#define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b) _nx_trace_object_register(t, (VOID *)p, (CHAR *)n, (ULONG)a, (ULONG)b) -#define NX_TRACE_OBJECT_UNREGISTER(o) _nx_trace_object_unregister((VOID *)o) -#define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h) _nx_trace_event_insert((ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d, (ULONG)f, g, h) -#define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d) _nx_trace_event_update((TX_TRACE_BUFFER_ENTRY *)e, (ULONG)t, (ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d) -#endif -/* Define NetX trace prototypes. */ - -VOID _nx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2); -VOID _nx_trace_object_unregister(VOID *object_ptr); -VOID _nx_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp); -VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4); - -#else -#define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b) -#define NX_TRACE_OBJECT_UNREGISTER(o) -#define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h) -#define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d) -#endif - -/* If NX_PACKET_HEADER_PAD is defined, make sure NX_PACKET_HEADER_PAD_SIZE is also defined. The default is 1, for backward compatibility. */ -#ifdef NX_PACKET_HEADER_PAD -#ifndef NX_PACKET_HEADER_PAD_SIZE -#define NX_PACKET_HEADER_PAD_SIZE 1 -#endif /* NX_PACKET_HEADER_PAD_SIZE */ -#endif /* NX_PACKET_HEADER_PAD */ - -/* If NX_PACKET_ALIGNMENT is defined, packet header and payload are aligned automatically to the value specified - in the symbol. The default is to align packet payload area to ULONG. */ -#ifndef NX_PACKET_ALIGNMENT -#define NX_PACKET_ALIGNMENT sizeof(ULONG) -#endif /* NX_PACKET_ALIGNMENT */ - - -/* Define basic constants for the NetX TCP/IP Stack. */ -#define AZURE_RTOS_NETXDUO -#define NETXDUO_MAJOR_VERSION 6 -#define NETXDUO_MINOR_VERSION 1 -#define NETXDUO_PATCH_VERSION 8 - -/* Define the following symbols for backward compatibility */ -#define EL_PRODUCT_NETXDUO -#define __PRODUCT_NETXDUO__ -#define __NETXDUO_MAJOR_VERSION__ NETXDUO_MAJOR_VERSION -#define __NETXDUO_MINOR_VERSION__ NETXDUO_MINOR_VERSION - -/* API input parameters and general constants. */ -#define NX_NO_WAIT 0 -#define NX_WAIT_FOREVER ((ULONG)0xFFFFFFFF) -#define NX_TRUE 1 -#define NX_FALSE 0 -#define NX_NULL 0 -#define NX_FOREVER 1 -#define NX_INIT_PACKET_ID 1 -#ifndef NX_MAX_PORT -#define NX_MAX_PORT 0xFFFF -#endif /* NX_MAX_PORT */ -#define NX_LOWER_16_MASK ((ULONG)0x0000FFFF) -#define NX_CARRY_BIT ((ULONG)0x10000) -#define NX_SHIFT_BY_16 16 -#define NX_TCP_CLIENT 1 -#define NX_TCP_SERVER 2 -#define NX_ANY_PORT 0 -#ifndef NX_SEARCH_PORT_START -#define NX_SEARCH_PORT_START 0xC000 /* Free port search start UDP/TCP */ -#endif /* NX_SEARCH_PORT_START */ - -#ifndef NX_PHYSICAL_HEADER -#define NX_PHYSICAL_HEADER 16 /* Maximum physical header */ -#endif - -#ifndef NX_PHYSICAL_TRAILER -#define NX_PHYSICAL_TRAILER 4 /* Maximum physical trailer */ -#endif - -/* Specify th wait interval, in seconds. */ -#ifndef NX_PATH_MTU_INCREASE_WAIT_INTERVAL -#define NX_PATH_MTU_INCREASE_WAIT_INTERVAL 600 -#endif - -#define NX_PATH_MTU_INCREASE_WAIT_INTERVAL_TICKS (NX_PATH_MTU_INCREASE_WAIT_INTERVAL * NX_IP_PERIODIC_RATE) - -/* Force to disable IPv6 on STM32L4XX. */ -#ifndef NX_DISABLE_IPV6 -#define NX_DISABLE_IPV6 -#endif /* NX_DISABLE_IPV6 */ - -/* Remove the IPv6 component if NX_DISABLE_IPV6 is defined. */ -#ifdef NX_DISABLE_IPV6 -#ifdef FEATURE_NX_IPV6 -#undef FEATURE_NX_IPV6 -#endif /* FEATURE_NX_IPV6 */ -#endif /* NX_DISABLE_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - -/* Define the IPsec header size. The space reserved here is good for ESP/AH header and possiblly IPv4/v6 header in tunnel mode. */ -#ifdef FEATURE_NX_IPV6 -#define NX_IPSEC_MAX_HEADER_SIZE (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 16 + 40) -#else /* !FEATURE_NX_IPV6 */ -#define NX_IPSEC_MAX_HEADER_SIZE (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 12 + 20) -#endif /* FEATURE_NX_IPV6 */ - -#else /* !NX_IPSEC_ENABLE */ -#define NX_IPSEC_MAX_HEADER_SIZE 0 -#endif /* NX_IPSEC_ENABLE */ - -#ifndef NX_IPV6_HOST_ID_LENGTH -#define NX_IPV6_HOST_ID_LENGTH 64 -#endif /* NX_IPV6_HOST_ID_LENGTH */ - -#define NX_IPv4_PACKET (NX_PHYSICAL_HEADER + 20) /* 20 bytes of IP header */ -#define NX_IPv4_TCP_PACKET (NX_IPv4_PACKET + 20) /* IP header plus 20 bytes */ -#define NX_IPv4_UDP_PACKET (NX_IPv4_PACKET + 8) /* IP header plus 8 bytes */ -#define NX_IPv4_ICMP_PACKET (NX_IPv4_PACKET) -#define NX_IPv4_IGMP_PACKET (NX_IPv4_PACKET) - -#define NX_IPv6_PACKET (NX_PHYSICAL_HEADER + 40) /* 40 bytes of basic IPv6 Header */ -#define NX_IPv6_UDP_PACKET (NX_IPv6_PACKET + 8) /* IPv6 header plus 8 bytes */ -#define NX_IPv6_TCP_PACKET (NX_IPv6_PACKET + 20) /* IPv6 header plus 20 bytes */ -#define NX_IPv6_ICMP_PACKET (NX_IPv6_PACKET) -#define NX_RECEIVE_PACKET 0 /* This is for driver receive */ - - -#ifdef FEATURE_NX_IPV6 -/* For systems with IPv6 enabled, the payload offset defaults to IPv6 header size. */ -#define NX_IP_PACKET NX_IPv6_PACKET -#define NX_TCP_PACKET (NX_IPv6_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_UDP_PACKET (NX_IPv6_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_ICMP_PACKET (NX_IPv6_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#else -/* Define payload offset to IPv4 header size if IPv6 is not defined. */ -#define NX_IP_PACKET NX_IPv4_PACKET -#define NX_TCP_PACKET (NX_IPv4_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_UDP_PACKET (NX_IPv4_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#define NX_ICMP_PACKET (NX_IPv4_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE) -#endif /* FEATURE_NX_IPV6 */ -#define NX_IGMP_PACKET NX_IPv4_IGMP_PACKET - - -/* Define the ARP update rate, in terms of IP periodic intervals. This can be defined on the - command line as well. */ - -#ifndef NX_ARP_UPDATE_RATE -#define NX_ARP_UPDATE_RATE 10 -#endif - - -/* Define the ARP entry expiration rate, in terms of IP periodic intervals. This can be defined on the - command line as well. A value of 0 disables ARP entry expiration, and is the default. */ - -#ifndef NX_ARP_EXPIRATION_RATE -#define NX_ARP_EXPIRATION_RATE 0 -#endif - - -/* Define the ARP maximum retry constant that specifies the maximum number of ARP requests that will be sent - without receiving an ARP response. Once this limit is reached, the ARP attempt is abandoned and - any queued packet is released. */ - -#ifndef NX_ARP_MAXIMUM_RETRIES -#define NX_ARP_MAXIMUM_RETRIES 18 -#endif - - -/* Define the maximum number of packets that can be queued while waiting for ARP resolution of an - IP address. */ - -#ifndef NX_ARP_MAX_QUEUE_DEPTH -#define NX_ARP_MAX_QUEUE_DEPTH 4 -#endif - - -/* Define the maximum time of IP reassembly. */ -#ifndef NX_IP_MAX_REASSEMBLY_TIME - -/* Define the maximum time of IPv4 reassembly. RFC791, Section3.2, page27. */ -#ifndef NX_IPV4_MAX_REASSEMBLY_TIME -#define NX_IPV4_MAX_REASSEMBLY_TIME 15 -#endif - -/* Define the maximum time of IPv6 reassembly. RFC2460, Section4.5, page22. */ -#ifndef NX_IPV6_MAX_REASSEMBLY_TIME -#define NX_IPV6_MAX_REASSEMBLY_TIME 60 -#endif - -#else /* NX_IP_MAX_REASSEMBLY_TIME */ - -/* Define the maximum time of IP reassembly. */ -#define NX_IPV4_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME -#define NX_IPV6_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME - -#endif /* NX_IP_MAX_REASSEMBLY_TIME */ - - -/* Define the maximum number of the packets that can be queued for raw receive. */ -#ifndef NX_IP_RAW_MAX_QUEUE_DEPTH -#define NX_IP_RAW_MAX_QUEUE_DEPTH 20 -#endif - -#ifndef NX_IP_ROUTING_TABLE_SIZE -#define NX_IP_ROUTING_TABLE_SIZE 8 -#endif /* NX_IP_ROUTING_TABLE_SIZE */ - -/* For backward compatibility, map the smbol NX_RAW_PACKET_FILTER_ENABLE to - NX_ENABLE_IP_RAW_PACKET_FILTER. */ -#ifdef NX_RAW_PACKET_FILTER_ENABLE -#ifndef NX_ENABLE_IP_RAW_PACKET_FILTER -#define NX_ENABLE_IP_RAW_PACKET_FILTER -#endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */ -#endif /* NX_RAW_PACKET_FILTER_ENABLE */ - -/* For backward compatibility, map the symbol NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS - to NX_DISABLE_ICMPV6_REDIRECT_PROCESS. */ -#ifdef NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS -#ifndef NX_DISABLE_ICMPV6_REDIRECT_PROCESS -#define NX_DISABLE_ICMPV6_REDIRECT_PROCESS -#endif /* NX_DISABLE_ICMPV6_REDIRECT_PROCESS */ -#endif /* NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS to NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ -#ifdef NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#ifndef NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#define NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS -#endif /* NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ -#endif /* NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION to NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ -#ifdef NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION -#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION -#define NX_DISABLE_ICMPV6_ROUTER_SOLICITATION -#endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ -#endif /* NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION */ - -/* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE to NX_DISABLE_ICMPV6_ERROR_MESSAGE */ -#ifdef NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE -#ifndef NX_DISABLE_ICMPV6_ERROR_MESSAGE -#define NX_DISABLE_ICMPV6_ERROR_MESSAGE -#endif /* NX_DISABLE_ICMPV6_ERROR_MESSAGE */ -#endif /* NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE */ - -/* For backward compatibility, convert map NXDUO_DISABLE_DAD to NX_DISABLE_IPV6_DAD */ -#ifdef NXDUO_DISABLE_DAD -#ifndef NX_DISABLE_IPV6_DAD -#define NX_DISABLE_IPV6_DAD -#endif /* NX_DISABLE_IPV6_DAD */ -#endif /* NXDUO_DISABLE_DAD */ - -/* For backward compatibility, convert map NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE to NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#ifdef NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE -#ifndef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#endif /* NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE */ - -/* For backward compatibility, convert map NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES to NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */ -#ifdef NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES -#ifndef NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES -#define NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES -#endif /* NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */ -#endif /* NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES */ - -/* For backward compatibility, convert map NX_IPV6_MULTICAST_ENABLE to NX_ENABLE_IPV6_MULTICAST */ -#ifdef NX_IPV6_MULTICAST_ENABLE -#ifndef NX_ENABLE_IPV6_MULTICAST -#define NX_ENABLE_IPV6_MULTICAST -#endif /* NX_ENABLE_IPV6_MULTICAST */ -#endif /* NX_IPV6_MULTICAST_ENABLE */ - -/* Define the size of the IPv6 destination table. */ -/* For backward compatibility, convert map NX_DESTINATION_TABLE_SIZE and NXDUO_DESTINATION_TABLE_SIZE to NX_IPV6_DESTINATION_TABLE_SIZE */ -#ifdef NX_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE NX_DESTINATION_TABLE_SIZE -#endif /* NX_DESTINATION_TABLE_SIZE */ - -#ifdef NXDUO_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE NXDUO_DESTINATION_TABLE_SIZE -#endif /* NXDUO_DESTINATION_TABLE_SIZE */ - -#ifndef NX_IPV6_DESTINATION_TABLE_SIZE -#define NX_IPV6_DESTINATION_TABLE_SIZE 8 -#ifndef NX_DESTINATION_TABLE_SIZE -#define NX_DESTINATION_TABLE_SIZE NX_IPV6_DESTINATION_TABLE_SIZE -#endif /* NX_DESTINATION_TABLE_SIZE */ -#ifndef NXDUO_DESTINATION_TABLE_SIZE -#define NXDUO_DESTINATION_TABLE_SIZE NX_IPV6_DESTINATION_TABLE_SIZE -#endif /* NXDUO_DESTINATION_TABLE_SIZE */ -#endif /* NX_IPV6_DESTINATION_TABLE_SIZE */ - -/* Define the size of the IPv6 ND cache table. */ -#ifndef NX_IPV6_NEIGHBOR_CACHE_SIZE -#define NX_IPV6_NEIGHBOR_CACHE_SIZE 16 -#endif /* NX_IPV6_NEIGHBOR_CACHE_SIZE */ - -/* Define the maximum ICMPv6 Duplicate Address Detect Transmit . */ -/* For backward compatibility, convert map NX_DUP_ADDR_DETECT_TRANSMITS and NXDUO_DUP_ADDR_DETECT_TRANSMITS to NX_IPV6_DAD_TRANSMITS */ -#ifdef NX_DUP_ADDR_DETECT_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS NX_DUP_ADDR_DETECT_TRANSMITS -#endif /* NX_DUP_ADDR_DETECT_TRANSMITS */ - -#ifdef NXDUO_DUP_ADDR_DETECT_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS NXDUO_DUP_ADDR_DETECT_TRANSMITS -#endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */ - -#ifndef NX_IPV6_DAD_TRANSMITS -#define NX_IPV6_DAD_TRANSMITS 3 -#ifndef NX_DUP_ADDR_DETECT_TRANSMITS -#define NX_DUP_ADDR_DETECT_TRANSMITS NX_IPV6_DAD_TRANSMITS -#endif /* NX_DUP_ADDR_DETECT_TRANSMITS */ -#ifndef NXDUO_DUP_ADDR_DETECT_TRANSMITS -#define NXDUO_DUP_ADDR_DETECT_TRANSMITS NX_IPV6_DAD_TRANSMITS -#endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */ -#endif /* NX_IPV6_DAD_TRANSMITS */ - -/* For backward compatibility, convert map NX_ARP_DISABLE_AUTO_ARP_ENTRY to NX_DISABLE_ARP_AUTO_ENTRY. */ -#ifdef NX_ARP_DISABLE_AUTO_ARP_ENTRY -#ifndef NX_DISABLE_ARP_AUTO_ENTRY -#define NX_DISABLE_ARP_AUTO_ENTRY -#endif /* NX_DISABLE_ARP_AUTO_ENTRY */ -#endif /* NX_ARP_DISABLE_AUTO_ARP_ENTRY */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_KEEPALIVE to NX_ENABLE_TCP_KEEPALIVE. */ -#ifdef NX_TCP_ENABLE_KEEPALIVE -#ifndef NX_ENABLE_TCP_KEEPALIVE -#define NX_ENABLE_TCP_KEEPALIVE -#endif /* NX_ENABLE_TCP_KEEPALIVE */ -#endif /* NX_TCP_ENABLE_KEEPALIVE */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_WINDOW_SCALING to NX_ENABLE_TCP_WINDOW_SCALING. */ -#ifdef NX_TCP_ENABLE_WINDOW_SCALING -#ifndef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_ENABLE_TCP_WINDOW_SCALING -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -#endif /* NX_TCP_ENABLE_WINDOW_SCALING */ - -/* For backward compatibility, convert map NX_TCP_ENABLE_MSS_CHECK to NX_ENABLE_TCP_MSS_CHECK. */ -#ifdef NX_TCP_ENABLE_MSS_CHECK -#ifndef NX_ENABLE_TCP_MSS_CHECK -#define NX_ENABLE_TCP_MSS_CHECK -#endif /* NX_ENABLE_TCP_MSS_CHECK */ -#endif /* NX_TCP_ENABLE_MSS_CHECK */ - -/* For backward compatibility, convert map NX_DUAL_PACKET_POOL_ENABLE to NX_ENABLE_DUAL_PACKET_POOL. */ -#ifdef NX_DUAL_PACKET_POOL_ENABLE -#ifndef NX_ENABLE_DUAL_PACKET_POOL -#define NX_ENABLE_DUAL_PACKET_POOL -#endif /* NX_ENABLE_DUAL_PACKET_POOL. */ -#endif /* NX_DUAL_PACKET_POOL_ENABLE */ - -/* For backward compatibility, convert map NX_ENABLE_FEATURE_LOW_WATERMARK to NX_ENABLE_LOW_WATERMARK. */ -#ifdef NX_ENABLE_FEATURE_LOW_WATERMARK -#ifndef NX_ENABLE_LOW_WATERMARK -#define NX_ENABLE_LOW_WATERMARK -#endif /* NX_ENABLE_LOW_WATERMARK */ -#endif /* NX_ENABLE_FEATURE_LOW_WATERMARK */ - -#ifdef NX_DISABLE_ICMP_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM -#define NX_DISABLE_ICMPV4_RX_CHECKSUM -#endif -#ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM -#define NX_DISABLE_ICMPV6_RX_CHECKSUM -#endif -#endif /* NX_DISABLE_ICMP_RX_CHECKSUM */ - -#ifdef NX_DISABLE_ICMP_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM -#define NX_DISABLE_ICMPV4_TX_CHECKSUM -#endif -#ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM -#define NX_DISABLE_ICMPV6_TX_CHECKSUM -#endif -#endif /* NX_DISABLE_ICMP_TX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv4_RX_CHECKSUM to NX_DISABLE_ICMPV4_RX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv4_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM -#define NX_DISABLE_ICMPV4_RX_CHECKSUM -#endif /* NX_DISABLE_ICMPV4_RX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv4_RX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv4_TX_CHECKSUM to NX_DISABLE_ICMPV4_TX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv4_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM -#define NX_DISABLE_ICMPV4_TX_CHECKSUM -#endif /* NX_DISABLE_ICMPV4_TX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv4_TX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv6_RX_CHECKSUM to NX_DISABLE_ICMPV6_RX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv6_RX_CHECKSUM -#ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM -#define NX_DISABLE_ICMPV6_RX_CHECKSUM -#endif /* NX_DISABLE_ICMPV6_RX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv6_RX_CHECKSUM */ - -/* For backward compatibility, convert map NX_DISABLE_ICMPv6_TX_CHECKSUM to NX_DISABLE_ICMPV6_TX_CHECKSUM. */ -#ifdef NX_DISABLE_ICMPv6_TX_CHECKSUM -#ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM -#define NX_DISABLE_ICMPV6_TX_CHECKSUM -#endif /* NX_DISABLE_ICMPV6_TX_CHECKSUM */ -#endif /* NX_DISABLE_ICMPv6_TX_CHECKSUM */ - - - -#ifdef NX_ENABLE_EXTENDED_NOTIFY_SUPPORT -#ifdef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#undef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#endif /* NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */ -#else -#define NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -#endif /* !NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */ - -/* Define the IPv4 fragment options. */ - -#define NX_FRAGMENT_OKAY ((ULONG)0x00000000) -#define NX_DONT_FRAGMENT ((ULONG)0x00004000) -#define NX_MORE_FRAGMENTS ((ULONG)0x00002000) -#define NX_FRAG_OFFSET_MASK ((ULONG)0x00001FFF) - - -/* Define the IPv4 Type Of Service constants. These will be supplied to the - IPv4 output packet routine. */ - -#define NX_IP_NORMAL ((ULONG)0x00000000) /* Normal IP delivery */ -#define NX_IP_MIN_DELAY ((ULONG)0x00100000) /* Minimum Delay delivery */ -#define NX_IP_MAX_DATA ((ULONG)0x00080000) /* Maximum Throughput delivery */ -#define NX_IP_MAX_RELIABLE ((ULONG)0x00040000) /* Maximum Reliable delivery */ -#define NX_IP_MIN_COST ((ULONG)0x00020000) /* Minimum Cost deliver */ -#define NX_IP_TOS_MASK ((ULONG)0x00FF0000) /* Type of Service Mask */ - - -/* Define the IPv4 length mask. */ - -#define NX_IP_PACKET_SIZE_MASK ((ULONG)0x0000FFFF) /* Mask for isolating the IP packet length */ - - -/* Define the IPv4 default time to live. */ - -#define NX_IP_TIME_TO_LIVE ((ULONG)0x00000080) /* Default packet time to live */ -#define NX_IP_TIME_TO_LIVE_MASK ((ULONG)0xFF000000) /* Mask for isolating the time to live */ -#define NX_IP_TIME_TO_LIVE_SHIFT 24 /* Number of bits to shift left */ - - - - -/* Define IPv6 protocol types. These types are used in the - "next header" field in IPv6 header and optional headers. */ -#define NX_PROTOCOL_NEXT_HEADER_HOP_BY_HOP 0 -#define NX_PROTOCOL_ICMP 1 -#define NX_PROTOCOL_IGMP 2 -#define NX_PROTOCOL_IPV4 4 /* IP-in-IP encapsulation */ -#define NX_PROTOCOL_TCP 6 -#define NX_PROTOCOL_UDP 17 -#define NX_PROTOCOL_IPV6 41 /* IP-in-IP encapsulation */ -#define NX_PROTOCOL_NEXT_HEADER_ROUTING 43 -#define NX_PROTOCOL_NEXT_HEADER_FRAGMENT 44 -#define NX_PROTOCOL_NEXT_HEADER_ENCAP_SECURITY 50 -#define NX_PROTOCOL_NEXT_HEADER_AUTHENTICATION 51 -#define NX_PROTOCOL_ICMPV6 58 -#define NX_PROTOCOL_NO_NEXT_HEADER 59 -#define NX_PROTOCOL_NEXT_HEADER_DESTINATION 60 -#define NX_PROTOCOL_NEXT_HEADER_MOBILE 135 - -/* Define the type of Protocol in this IPv6 packet. */ -/* Note that these values can be directly mapped to the protocol field in an IPv4 header. */ -#define NX_IP_ICMP ((ULONG)0x00010000) /* ICMP Protocol Type */ -#define NX_IP_IGMP ((ULONG)0x00020000) /* IGMP Protocol Type */ -#define NX_IP_TCP ((ULONG)0x00060000) /* TCP Protocol Type */ -#define NX_IP_UDP ((ULONG)0x00110000) /* UDP Protocol Type */ -#define NX_IP_ESP ((ULONG)0x00320000) /* ESP Protocol Type */ -#define NX_IP_AH ((ULONG)0x00330000) /* UDP Protocol Type */ -#define NX_IP_PROTOCOL_MASK ((ULONG)0x00FF0000) /* Protocol Type mask */ - - -/* Define IPv4 address type masks and values. These will determine the net id and - host id fields of the supplied IPv4 address. */ - -#define NX_IP_CLASS_A_MASK ((ULONG)0x80000000) /* Define mask for class A IP addresses */ -#define NX_IP_CLASS_A_TYPE ((ULONG)0x00000000) /* Define class A address type */ -#define NX_IP_CLASS_A_NETID ((ULONG)0x7F000000) /* Define class A network ID mask */ -#define NX_IP_CLASS_A_HOSTID ((ULONG)0x00FFFFFF) /* Define class A host ID mask */ - -#define NX_IP_CLASS_B_MASK ((ULONG)0xC0000000) /* Define mask for class B IP addresses */ -#define NX_IP_CLASS_B_TYPE ((ULONG)0x80000000) /* Define class B address type */ -#define NX_IP_CLASS_B_NETID ((ULONG)0x3FFF0000) /* Define class B network ID mask */ -#define NX_IP_CLASS_B_HOSTID ((ULONG)0x0000FFFF) /* Define class B host ID mask */ - -#define NX_IP_CLASS_C_MASK ((ULONG)0xE0000000) /* Define mask for class C IP addresses */ -#define NX_IP_CLASS_C_TYPE ((ULONG)0xC0000000) /* Define class C address type */ -#define NX_IP_CLASS_C_NETID ((ULONG)0x1FFFFF00) /* Define class C network ID mask */ -#define NX_IP_CLASS_C_HOSTID ((ULONG)0x000000FF) /* Define class C host ID mask */ - -#define NX_IP_CLASS_D_MASK ((ULONG)0xF0000000) /* Define mask for class D IP addresses */ -#define NX_IP_CLASS_D_TYPE ((ULONG)0xE0000000) /* Define class D address type */ -#define NX_IP_CLASS_D_GROUP ((ULONG)0x0FFFFFFF) /* Define class D group ID mask */ -#define NX_IP_CLASS_D_HOSTID ((ULONG)0x00000000) /* Define class D host ID mask N/A */ - -#define NX_IP_LIMITED_BROADCAST ((ULONG)0xFFFFFFFF) /* Limited broadcast address (local net) */ -#define NX_IP_LOOPBACK_FIRST ((ULONG)0x7F000000) /* First loopback address 127.0.0.0 */ -#define NX_IP_LOOPBACK_LAST ((ULONG)0x7FFFFFFF) /* Last loopback address 127.255.255.255 */ - -#define NX_IP_MULTICAST_UPPER ((ULONG)0x00000100) /* Upper two bytes of multicast Ethernet */ -#define NX_IP_MULTICAST_LOWER ((ULONG)0x5E000000) /* Lower 23 bits of address are from IP */ -#define NX_IP_MULTICAST_MASK ((ULONG)0x007FFFFF) /* Mask to pickup the lower 23 bits of IP */ - - -/* Define the constants that determine how big the hash table is for destination IP - addresses. The value must be a power of two, so subtracting one gives us - the mask. */ - -#define NX_ROUTE_TABLE_SIZE 32 -#define NX_ROUTE_TABLE_MASK (NX_ROUTE_TABLE_SIZE - 1) - -/* By default use 0xFF when sending raw packet. */ -#ifndef NX_IP_RAW -#define NX_IP_RAW 0x00FF0000 -#endif /* NX_IP_RAW */ - -/* - * NX_ROUTE_TABLE_SIZE|MASK are used for ARP table. So we define NX_ARP_TABLE_SIZE|MASK so the - * macro names are more descriptive. - * - * NX_ROUTE_TABLE_SIZE and NX_ROUTE_TABLE_MASK will be deprecated in future releases. - */ -#define NX_ARP_TABLE_SIZE NX_ROUTE_TABLE_SIZE -#define NX_ARP_TABLE_MASK (NX_ARP_TABLE_SIZE - 1) - - - -#ifdef FEATURE_NX_IPV6 -/* Define IPv6 address state. These states are defined in RFC 2462. */ - -#define NX_IPV6_ADDR_STATE_UNKNOWN 0x00 -#define NX_IPV6_ADDR_STATE_TENTATIVE 0x01 -#define NX_IPV6_ADDR_STATE_PREFERRED 0x02 -#define NX_IPV6_ADDR_STATE_DEPRECATED 0x03 -#define NX_IPV6_ADDR_STATE_VALID 0x04 - - - -/* Define the size of the IPv6 Default Router Table. */ -#ifndef NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE -#define NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE 8 -#endif /* NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE */ - -/* Define the size of the IPv6 prefix table. */ -#ifndef NX_IPV6_PREFIX_LIST_TABLE_SIZE -#define NX_IPV6_PREFIX_LIST_TABLE_SIZE 8 -#endif /* NX_IPV6_PREFIX_LIST_TABLE_SIZE */ - -/* Flags for the IPv6 default router table status field. */ -#define NX_IPV6_ROUTE_TYPE_NOT_ROUTER 0x00 -#define NX_IPV6_ROUTE_TYPE_SOLICITATED 0x01 -#define NX_IPV6_ROUTE_TYPE_UNSOLICITATED 0x02 -#define NX_IPV6_ROUTE_TYPE_STATIC 0x04 -#define NX_IPV6_ROUTE_TYPE_DEFAULT 0x40 -#define NX_IPV6_ROUTE_TYPE_VALID 0x80 - -#define NX_IPV6_ADDRESS_NOT_CONFIGURED 0 -#define NX_IPV6_ADDRESS_MANUAL_CONFIG 1 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_IPV6_ADDRESS_STATELESS_AUTO_CONFIG 2 -#define NX_IPV6_ADDRESS_STATEFUL_AUTO_CONFIG 3 -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#define NX_IPV6_ADDRESS_BASED_ON_INTERFACE 4 -#define NX_IPV6_ADDRESS_MANUAL_DELETE 5 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY -#define NX_IPV6_ADDRESS_LIFETIME_EXPIRED 6 -#define NX_IPV6_ADDRESS_DAD_SUCCESSFUL 7 -#define NX_IPV6_ADDRESS_DAD_FAILURE 8 -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ - - - -/* Define the maximum number of packets that can be queued while waiting for Neighbor Discovery - to resolution of an IPv6 address. */ -#ifndef NX_ND_MAX_QUEUE_DEPTH -#define NX_ND_MAX_QUEUE_DEPTH 4 -#endif - -/* Define the ND cache entry structure. */ -typedef struct ND_CACHE_ENTRY_STRUCT -{ - - /* Neighbor IP address. */ - ULONG nx_nd_cache_dest_ip[4]; - - /* Corresponding LLA. */ - UCHAR nx_nd_cache_mac_addr[6]; - - /* Padding. Reserved for future use. */ - /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved1) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_nd_cache_reserved1; - - /* Padding. Reserved for future use. */ - /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved2) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_nd_cache_reserved2; - - /* Number of Solicitation it needs to send before timing out. */ - UCHAR nx_nd_cache_num_solicit; - - /* Entry Status, such as INCOMPLETE, REACHABLE, and so on. */ - UCHAR nx_nd_cache_nd_status; - - /* Number of out going packets waiting for this entry to be resolved. */ - UCHAR nx_nd_cache_packet_waiting_queue_length; - - /* Whether or not this entry is statically configured. */ - UCHAR nx_nd_cache_is_static; - - /* Timeout value. */ - ULONG nx_nd_cache_timer_tick; - - /* Interface through which the destination can be reached. */ - struct NX_INTERFACE_STRUCT *nx_nd_cache_interface_ptr; - - /* Link to the default router table, if this neighbor is a router. */ - struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT *nx_nd_cache_is_router; - - /* - * Queue head and queue tail of the out going packets. - * This queue is used for keeping outgoing packets while the stack is - * resolving the target link layer address. - */ - struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_head; - struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_tail; - - /* - * Local interface associated with this neighbor entry. If outoing_address is known - * outgoing packets shall be sent using this address. - */ - struct NXD_IPV6_ADDRESS_STRUCT *nx_nd_cache_outgoing_address; -} ND_CACHE_ENTRY; - -/* Define the destination table entry type. */ -typedef struct NX_IPV6_DESTINATION_ENTRY_STRUCT -{ - /* Flag indicates whether or not the entry is valid. */ - ULONG nx_ipv6_destination_entry_valid; - - /* Destination IP address. */ - ULONG nx_ipv6_destination_entry_destination_address[4]; - - /* Next hop address. Next hop could be the host, if it - is on the local network, or a router. */ - ULONG nx_ipv6_destination_entry_next_hop[4]; - - /* Cross link to the next hop entry in the ND cache. */ - ND_CACHE_ENTRY *nx_ipv6_destination_entry_nd_entry; - -#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY - - /* Maximum transmission size for this destination. */ - ULONG nx_ipv6_destination_entry_path_mtu; - - /* MTU Timeout value. */ - ULONG nx_ipv6_destination_entry_MTU_timer_tick; -#endif -} NX_IPV6_DESTINATION_ENTRY; - -/* Define data structure for IPv6 prefix table. */ -typedef struct NX_IPV6_PREFIX_ENTRY_STRUCT -{ - /* Network IPv6 prefix address, in host byte order. */ - ULONG nx_ipv6_prefix_entry_network_address[4]; - - /* Number of valid bits in the prefix. */ - ULONG nx_ipv6_prefix_entry_prefix_length; - - /* Valid life time, in seconds. */ - ULONG nx_ipv6_prefix_entry_valid_lifetime; - - /* Pointer to the previous entry. */ - struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_prev; - - /* Pointer to the next entry. */ - struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_next; -} NX_IPV6_PREFIX_ENTRY; - - -/* Define data structure for IPv6 default router table. */ -typedef struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT -{ - /* route type */ - UCHAR nx_ipv6_default_router_entry_flag; - - /* Reserved for future expansion. */ - /*lint -esym(768,NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT::nx_ipv6_default_router_entry_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_ipv6_default_router_entry_reserved; - - /* Router Life Time, in seconds, host-byte order. */ - USHORT nx_ipv6_default_router_entry_life_time; - - /* Router interface address. */ - ULONG nx_ipv6_default_router_entry_router_address[4]; - - /* Router interface index. */ - struct NX_INTERFACE_STRUCT *nx_ipv6_default_router_entry_interface_ptr; - - /* Point to the corresonding neighbor cache entry. */ - ND_CACHE_ENTRY *nx_ipv6_default_router_entry_neighbor_cache_ptr; -} NX_IPV6_DEFAULT_ROUTER_ENTRY; - -#endif /* FEATURE_NX_IPV6 */ -/* Define the constants that determine how big the hash table is for UDP ports. The - value must be a power of two, so subtracting one gives us the mask. */ - -#define NX_UDP_PORT_TABLE_SIZE 32 -#define NX_UDP_PORT_TABLE_MASK (NX_UDP_PORT_TABLE_SIZE - 1) - - -/* Define the constants that determine how big the hash table is for TCP ports. The - value must be a power of two, so subtracting one gives us the mask. */ - -#define NX_TCP_PORT_TABLE_SIZE 32 -#define NX_TCP_PORT_TABLE_MASK (NX_TCP_PORT_TABLE_SIZE - 1) - - -/* Define the maximum number of multicast groups the system can support. This might - be further limited by the underlying physical hardware. */ - -#ifndef NX_MAX_MULTICAST_GROUPS -#define NX_MAX_MULTICAST_GROUPS 7 -#endif - -/* The following symbol defines the number of IPv6 addresses in the system. - A typical system shall have 2 IPv6 addresses: one linklocal address and one global address. */ - - -/* Define the maximum number of internal server resources for TCP connections. Server - connections require a listen control structure. */ - -#ifndef NX_MAX_LISTEN_REQUESTS -#define NX_MAX_LISTEN_REQUESTS 10 -#endif - - -/* Define the IP status checking/return bits. */ - -#define NX_IP_INITIALIZE_DONE ((ULONG)0x0001) -#define NX_IP_ADDRESS_RESOLVED ((ULONG)0x0002) -#define NX_IP_LINK_ENABLED ((ULONG)0x0004) -#define NX_IP_ARP_ENABLED ((ULONG)0x0008) -#define NX_IP_UDP_ENABLED ((ULONG)0x0010) -#define NX_IP_TCP_ENABLED ((ULONG)0x0020) -#define NX_IP_IGMP_ENABLED ((ULONG)0x0040) -#define NX_IP_RARP_COMPLETE ((ULONG)0x0080) -#define NX_IP_INTERFACE_LINK_ENABLED ((ULONG)0x0100) - -/* Define various states in the TCP connection state machine. */ - -#define NX_TCP_CLOSED 1 /* Connection is closed state */ -#define NX_TCP_LISTEN_STATE 2 /* Server listen state */ -#define NX_TCP_SYN_SENT 3 /* SYN sent state */ -#define NX_TCP_SYN_RECEIVED 4 /* SYN received state */ -#define NX_TCP_ESTABLISHED 5 /* Connection established state */ -#define NX_TCP_CLOSE_WAIT 6 /* Close Wait state */ -#define NX_TCP_FIN_WAIT_1 7 /* Finished Wait 1 state */ -#define NX_TCP_FIN_WAIT_2 8 /* Finished Wait 2 state */ -#define NX_TCP_CLOSING 9 /* Closing state */ -#define NX_TCP_TIMED_WAIT 10 /* Timed wait state */ -#define NX_TCP_LAST_ACK 11 /* Last ACK state */ - - -/* API return values. */ - -#define NX_SUCCESS 0x00 -#define NX_NO_PACKET 0x01 -#define NX_UNDERFLOW 0x02 -#define NX_OVERFLOW 0x03 -#define NX_NO_MAPPING 0x04 -#define NX_DELETED 0x05 -#define NX_POOL_ERROR 0x06 -#define NX_PTR_ERROR 0x07 -#define NX_WAIT_ERROR 0x08 -#define NX_SIZE_ERROR 0x09 -#define NX_OPTION_ERROR 0x0a -#define NX_DELETE_ERROR 0x10 -#define NX_CALLER_ERROR 0x11 -#define NX_INVALID_PACKET 0x12 -#define NX_INVALID_SOCKET 0x13 -#define NX_NOT_ENABLED 0x14 -#define NX_ALREADY_ENABLED 0x15 -#define NX_ENTRY_NOT_FOUND 0x16 -#define NX_NO_MORE_ENTRIES 0x17 -#define NX_ARP_TIMER_ERROR 0x18 -#define NX_RESERVED_CODE0 0x19 -#define NX_WAIT_ABORTED 0x1A -#define NX_IP_INTERNAL_ERROR 0x20 -#define NX_IP_ADDRESS_ERROR 0x21 -#define NX_ALREADY_BOUND 0x22 -#define NX_PORT_UNAVAILABLE 0x23 -#define NX_NOT_BOUND 0x24 -#define NX_RESERVED_CODE1 0x25 -#define NX_SOCKET_UNBOUND 0x26 -#define NX_NOT_CREATED 0x27 -#define NX_SOCKETS_BOUND 0x28 -#define NX_NO_RESPONSE 0x29 -#define NX_POOL_DELETED 0x30 -#define NX_ALREADY_RELEASED 0x31 -#define NX_RESERVED_CODE2 0x32 -#define NX_MAX_LISTEN 0x33 -#define NX_DUPLICATE_LISTEN 0x34 -#define NX_NOT_CLOSED 0x35 -#define NX_NOT_LISTEN_STATE 0x36 -#define NX_IN_PROGRESS 0x37 -#define NX_NOT_CONNECTED 0x38 -#define NX_WINDOW_OVERFLOW 0x39 -#define NX_ALREADY_SUSPENDED 0x40 -#define NX_DISCONNECT_FAILED 0x41 -#define NX_STILL_BOUND 0x42 -#define NX_NOT_SUCCESSFUL 0x43 -#define NX_UNHANDLED_COMMAND 0x44 -#define NX_NO_FREE_PORTS 0x45 -#define NX_INVALID_PORT 0x46 -#define NX_INVALID_RELISTEN 0x47 -#define NX_CONNECTION_PENDING 0x48 -#define NX_TX_QUEUE_DEPTH 0x49 -#define NX_NOT_IMPLEMENTED 0x4A -#define NX_NOT_SUPPORTED 0x4B -#define NX_INVALID_INTERFACE 0x4C -#define NX_INVALID_PARAMETERS 0x4D -#define NX_NOT_FOUND 0x4E -#define NX_CANNOT_START 0x4F -#define NX_NO_INTERFACE_ADDRESS 0x50 -#define NX_INVALID_MTU_DATA 0x51 -#define NX_DUPLICATED_ENTRY 0x52 -#define NX_PACKET_OFFSET_ERROR 0x53 -#define NX_OPTION_HEADER_ERROR 0x54 -#define NX_CONTINUE 0x55 - -/* Define Link Driver constants. */ - -#define NX_LINK_PACKET_SEND 0 -#define NX_LINK_INITIALIZE 1 -#define NX_LINK_ENABLE 2 -#define NX_LINK_DISABLE 3 -#define NX_LINK_PACKET_BROADCAST 4 -#define NX_LINK_ARP_SEND 5 -#define NX_LINK_ARP_RESPONSE_SEND 6 -#define NX_LINK_RARP_SEND 7 -#define NX_LINK_MULTICAST_JOIN 8 -#define NX_LINK_MULTICAST_LEAVE 9 -#define NX_LINK_GET_STATUS 10 -#define NX_LINK_GET_SPEED 11 -#define NX_LINK_GET_DUPLEX_TYPE 12 -#define NX_LINK_GET_ERROR_COUNT 13 -#define NX_LINK_GET_RX_COUNT 14 -#define NX_LINK_GET_TX_COUNT 15 -#define NX_LINK_GET_ALLOC_ERRORS 16 -#define NX_LINK_UNINITIALIZE 17 -#define NX_LINK_DEFERRED_PROCESSING 18 -#define NX_LINK_INTERFACE_ATTACH 19 -#define NX_LINK_SET_PHYSICAL_ADDRESS 20 -#define NX_INTERFACE_CAPABILITY_GET 21 -#define NX_INTERFACE_CAPABILITY_SET 22 -#define NX_LINK_INTERFACE_DETACH 23 -#define NX_LINK_FACTORY_ADDRESS_GET 24 -#define NX_LINK_RX_ENABLE 25 -#define NX_LINK_RX_DISABLE 26 -#define NX_LINK_6LOWPAN_COMMAND 27 /* 6LowPAN driver command, the sub command see nx_6lowpan.h. */ - -#define NX_LINK_USER_COMMAND 50 /* Values after this value are reserved for application. */ - -/* Define Link Driver Capability Flags. */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY -#define NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM 0x00000001 -#define NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM 0x00000002 -#define NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM 0x00000004 -#define NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM 0x00000008 -#define NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM 0x00000010 -#define NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM 0x00000020 -#define NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM 0x00000040 -#define NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM 0x00000080 -#define NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM 0x00000100 -#define NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM 0x00000200 -#define NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM 0x00000400 -#define NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM 0x00000800 -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#define NX_IP_VERSION_V4 0x4 -#define NX_IP_VERSION_V6 0x6 - -#if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) -#define NX_STATELESS_ADDRESS_AUTOCONFIG_ENABLED 0 -#define NX_STATELESS_ADDRESS_AUTOCONFIG_DISABLED 1 -#endif /* defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) */ - -/* Define the macro for building IPv4 addresses. */ -#define IP_ADDRESS(a, b, c, d) ((((ULONG)a) << 24) | (((ULONG)b) << 16) | (((ULONG)c) << 8) | ((ULONG)d)) - -/* Define the direction of IP packet. */ -#ifdef NX_ENABLE_IP_PACKET_FILTER -#define NX_IP_PACKET_IN 0 -#define NX_IP_PACKET_OUT 1 -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - -#ifdef NX_ENABLE_THREAD -/* Define the packet type for Thread MLE. */ -#define NX_PACKET_TYPE_THREAD_MLE 0x01 -#endif /* NX_ENABLE_THREAD */ - - -/* Define IPv4/v6 Address structure */ -typedef struct NXD_ADDRESS_STRUCT -{ - /* Flag indicating IP address format. Valid values are: - NX_IP_VERSION_V4 and NX_IP_VERSION_V6. - */ - ULONG nxd_ip_version; - - /* Union that holds either IPv4 or IPv6 address. */ - union - { - -#ifndef NX_DISABLE_IPV4 - ULONG v4; -#endif /* NX_DISABLE_IPV4 */ -#ifdef FEATURE_NX_IPV6 - ULONG v6[4]; -#endif /* FEATURE_NX_IPV6 */ - } nxd_ip_address; -} NXD_ADDRESS; - - -#ifdef NX_IPSEC_ENABLE -/* Define the selector for IPSEC or TUNNEL. */ -typedef struct NX_ADDRESS_SELECTOR_STRUCT -{ - /* Define selector source, destination address. */ - NXD_ADDRESS nx_selector_src_address_start; - NXD_ADDRESS nx_selector_src_address_end; - NXD_ADDRESS nx_selector_dst_address_start; - NXD_ADDRESS nx_selector_dst_address_end; -} NX_ADDRESS_SELECTOR; - -#endif /* NX_IPSEC_ENABLE */ - - -/* Define the control block definitions for all system objects. */ - - -/* Define the basic memory management packet structure. This structure is - used to hold application data as well as internal control data. */ -struct NX_PACKET_POOL_STRUCT; - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/* Define macro to record packet debug information. */ -#define NX_PACKET_DEBUG(f,l,p) {\ - (p) -> nx_packet_debug_file=f;\ - (p) -> nx_packet_debug_line=l;\ - if (tx_thread_identify()) \ - (p) -> nx_packet_debug_thread = tx_thread_identify() -> tx_thread_name; \ - else \ - (p) -> nx_packet_debug_thread = "ISR"; \ - } -#else -#define NX_PACKET_DEBUG(f, l, p) -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - -typedef struct NX_PACKET_STRUCT -{ - - /* Define the pool this packet is associated with. */ - struct NX_PACKET_POOL_STRUCT - *nx_packet_pool_owner; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Define the link to the chain (one or more) of packet extensions. If this is NULL, there - are no packet extensions for this packet. */ - struct NX_PACKET_STRUCT - *nx_packet_next; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Define the pointer to the first byte written closest to the beginning of the - buffer. This is used to prepend information in front of the packet. */ - UCHAR *nx_packet_prepend_ptr; - - /* Define the pointer to the byte after the last character written in the buffer. */ - UCHAR *nx_packet_append_ptr; - - /* Define the packet data area start and end pointer. These will be used to - mark the physical boundaries of the packet. */ - UCHAR *nx_packet_data_start; - UCHAR *nx_packet_data_end; - - /* The above data are required by all packets. */ - /* The following data are required by header packet when optimized packet is not disabled. */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Define the link to the last packet (if any) in the chain. This is used to append - information to the end without having to traverse the entire chain. */ - struct NX_PACKET_STRUCT - *nx_packet_last; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Define the link that will be used to queue the packet. */ - struct NX_PACKET_STRUCT - *nx_packet_queue_next; - - /* Union that holds either tcp_queue_next or fragment_next. */ - union - { - - /* Define the link that will be used to keep outgoing TCP packets queued - so they can be ACKed or re-sent. */ - struct NX_PACKET_STRUCT - *nx_packet_tcp_queue_next; - -#ifndef NX_DISABLE_FRAGMENTATION - /* Define the link to the next fragment. This is only used in IP fragmentation - re-assembly. */ - struct NX_PACKET_STRUCT - *nx_packet_fragment_next; -#endif /* NX_DISABLE_FRAGMENTATION */ - } nx_packet_union_next; - - /* Define the total packet length. */ - ULONG nx_packet_length; - -#ifndef NX_DISABLE_FRAGMENTATION - ULONG nx_packet_reassembly_time; /* Time stamp for measuring the number of seconds a - packet is in the reassebmly logic. Once a time - out value is reached packets of the same FRAG ID - are released. */ -#endif /* NX_DISABLE_FRAGMENTATION */ - -#ifdef FEATURE_NX_IPV6 - UCHAR nx_packet_option_state; /* Used by IPv6, indicating the current option - being processed. */ - UCHAR nx_packet_destination_header; - USHORT nx_packet_option_offset; -#endif /* FEATURE_NX_IPV6 */ - - - /* - Tag the packet type. Valid values are either - NX_IP_VERSION_V4 or NX_IP_VERSION_V6. - */ - UCHAR nx_packet_ip_version; - - /* RFC1122, Section3.2.1.5, Page32-33. RFC1122, Section4.2.2.15, Page90-91. */ - /* nx_packet_identical_copy is to track the IP ID field in the IP header - for the retransmitted TCP packet. The IP ID value should not change - if the TCP header for a retransmitted packet is not changed. - - On retransmission, if the flag nx_packet_identical_copy is set, the same IP ID value is used for the retransmitted packet. - Otherwise the value in the IP ID field is updated with the latest ID value in the IP instance. - */ - UCHAR nx_packet_identical_copy; - - /* Length of IP header including options. It is set for outgoing packet only. */ - UCHAR nx_packet_ip_header_length; - - /*lint -esym(768,NX_PACKET_STRUCT::nx_packet_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_packet_reserved; - - /* Union that holds either IPv4 interface or IPv6 address. */ - union - { - - /* Define the interface from which the packet was received, or the interface to transmit to. */ - struct NX_INTERFACE_STRUCT - *nx_packet_interface_ptr; - - /* Point to the interface IPv6 address structure. On transmit or receive path. */ - struct NXD_IPV6_ADDRESS_STRUCT - *nx_packet_ipv6_address_ptr; - } nx_packet_address; - -#define nx_packet_ip_interface nx_packet_address.nx_packet_interface_ptr - - /* Points to the beginning of IPv4/6 header. This field is used for */ - /* quick refernece to the IP header, in case there are optional headers. */ - UCHAR *nx_packet_ip_header; - -#ifdef NX_ENABLE_THREAD - /* Define the packet type for MLE. */ - UCHAR nx_packet_type; - - /* Define the received signal strength. */ - UCHAR nx_packet_signal_strength; - - /* It is reserved for future use. */ - UCHAR nx_packet_thread_reserved[2]; -#endif /* NX_ENABLE_THREAD */ - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - /* Define the capability flag of hardware to be used by the packet. */ - ULONG nx_packet_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifdef NX_IPSEC_ENABLE - VOID *nx_packet_ipsec_sa_ptr; - - /* Used in HW engine non-block mode. */ - USHORT nx_packet_ipsec_op; - - /* Indicate the current protocol being processed. */ - USHORT nx_packet_ipsec_state; -#endif /* NX_IPSEC_ENABLE */ - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO - /* Indicate the current thread that owns the packet. */ - CHAR *nx_packet_debug_thread; - - /* Indicate the current file that is processing the packet. */ - CHAR *nx_packet_debug_file; - - /* Indicate the current function that is processing the packet. */ - ULONG nx_packet_debug_line; -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - -#ifdef NX_PACKET_HEADER_PAD - - /* Define a pad word for 16-byte alignment, if necessary. */ - ULONG nx_packet_packet_pad[NX_PACKET_HEADER_PAD_SIZE]; -#endif -} NX_PACKET; - - -/* Define the Packet Pool control block that will be used to manage each individual - packet pool. */ - -typedef struct NX_PACKET_POOL_STRUCT -{ - - /* Define the block pool ID used for error checking. */ - ULONG nx_packet_pool_id; - - /* Define the packet pool's name. */ - CHAR *nx_packet_pool_name; - - /* Define the number of available memory packets in the pool. */ - ULONG nx_packet_pool_available; - - /* Save the initial number of blocks. */ - ULONG nx_packet_pool_total; - - /* Define statistics and error counters for this packet pool. */ - ULONG nx_packet_pool_empty_requests; - ULONG nx_packet_pool_empty_suspensions; - ULONG nx_packet_pool_invalid_releases; - - /* Define the head pointer of the available packet pool. */ - struct NX_PACKET_STRUCT *nx_packet_pool_available_list; - - /* Save the start address of the packet pool's memory area. */ - CHAR *nx_packet_pool_start; - - /* Save the packet pool's size in bytes. */ - ULONG nx_packet_pool_size; - - /* Save the individual packet payload size - rounded for alignment. */ - ULONG nx_packet_pool_payload_size; - - /* Define the packet pool suspension list head along with a count of - how many threads are suspended. */ - TX_THREAD *nx_packet_pool_suspension_list; - ULONG nx_packet_pool_suspended_count; - - /* Define the created list next and previous pointers. */ - struct NX_PACKET_POOL_STRUCT - *nx_packet_pool_created_next, - *nx_packet_pool_created_previous; - -#ifdef NX_ENABLE_LOW_WATERMARK - /* Low watermark. */ - UINT nx_packet_pool_low_watermark; -#endif /* NX_ENABLE_LOW_WATERMARK */ -} NX_PACKET_POOL; - - -#ifndef NX_DISABLE_IPV4 -/* Define the Address Resolution Protocol (ARP) structure that makes up the - route table in each IP instance. This is how IP addresses are translated - to physical addresses in the system. */ - -typedef struct NX_ARP_STRUCT -{ - - /* Define a flag that indicates whether or not the mapping in this ARP - entry is static. */ - UINT nx_arp_route_static; - - /* Define the counter that indicates when the next ARP update request is - sent. This is always zero for static entries and initialized to the maximum - value for new entries. */ - UINT nx_arp_entry_next_update; - - /* Define the ARP retry counter that is incremented each time the ARP request - is sent. */ - UINT nx_arp_retries; - - /* Define the links for the IP ARP dynamic structures in the system. This list - is maintained in a most recently used fashion. */ - struct NX_ARP_STRUCT - *nx_arp_pool_next, - *nx_arp_pool_previous; - - /* Define the links for the active ARP entry that is part of route - information inside of an IP instance. */ - struct NX_ARP_STRUCT - *nx_arp_active_next, - *nx_arp_active_previous, - **nx_arp_active_list_head; - - /* Define the IP address that this entry is setup for. */ - ULONG nx_arp_ip_address; - - /* Define the physical address that maps to this IP address. */ - ULONG nx_arp_physical_address_msw; - ULONG nx_arp_physical_address_lsw; - - /* Define the physical interface attached to this IP address. */ - struct NX_INTERFACE_STRUCT *nx_arp_ip_interface; - - /* Define a pointer to the queue holding one or more packets while address - resolution is pending. The maximum number of packets that can be queued - is defined by NX_APR_MAX_QUEUE_DEPTH. If ARP packet queue is exceeded, - the oldest packet is discarded in favor of keeping the newer packet. */ - struct NX_PACKET_STRUCT - *nx_arp_packets_waiting; -} NX_ARP; -#endif /* NX_DISABLE_IPV4 */ - - -/* Determine if the UDP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_UDP_SOCKET_MODULE_EXTENSION -#define NX_UDP_SOCKET_MODULE_EXTENSION -#endif - - -/* Define the basic UDP socket structure. This structure is used to manage all information - necessary to manage UDP transmission and reception. */ - -typedef struct NX_UDP_SOCKET_STRUCT -{ - - /* Define the UDP identification that is used to determine if the UDP socket has - been created. */ - ULONG nx_udp_socket_id; - - /* Define the Application defined name for this UDP socket instance. */ - CHAR *nx_udp_socket_name; - - /* Define the UDP port that was bound to. */ - UINT nx_udp_socket_port; - - /* Define the entry that this UDP socket belongs to. */ - struct NX_IP_STRUCT - *nx_udp_socket_ip_ptr; - - /* Define the statistic and error counters for this UDP socket. */ - ULONG nx_udp_socket_packets_sent; - ULONG nx_udp_socket_bytes_sent; - ULONG nx_udp_socket_packets_received; - ULONG nx_udp_socket_bytes_received; - ULONG nx_udp_socket_invalid_packets; - ULONG nx_udp_socket_packets_dropped; - ULONG nx_udp_socket_checksum_errors; - - /* Define the type of service for this UDP instance. */ - ULONG nx_udp_socket_type_of_service; - - /* Define the time-to-live for this UDP instance. */ - UINT nx_udp_socket_time_to_live; - - /* Define the fragment enable bit for this UDP instance. */ - ULONG nx_udp_socket_fragment_enable; - - /* Define the UDP checksum disable flag for this UDP socket. */ - UINT nx_udp_socket_disable_checksum; - - /* Define the UDP receive packet queue pointers, queue counter, and - the maximum queue depth. */ - ULONG nx_udp_socket_receive_count; - ULONG nx_udp_socket_queue_maximum; - NX_PACKET *nx_udp_socket_receive_head, - *nx_udp_socket_receive_tail; - - /* Define the UDP socket bound list. These pointers are used to manage the list - of UDP sockets on a particular hashed port index. */ - struct NX_UDP_SOCKET_STRUCT - *nx_udp_socket_bound_next, - *nx_udp_socket_bound_previous; - - /* Define the UDP socket bind suspension thread pointer. This pointer points - to the thread that that is suspended attempting to bind to a port that is - already bound to another socket. */ - TX_THREAD *nx_udp_socket_bind_in_progress; - - /* Define the UDP receive suspension list head associated with a count of - how many threads are suspended attempting to receive from the same UDP port. */ - TX_THREAD *nx_udp_socket_receive_suspension_list; - ULONG nx_udp_socket_receive_suspended_count; - - /* Define the UDP bind suspension list head associated with a count of - how many threads are suspended attempting to bind to the same UDP port. The - currently bound socket will maintain the head pointer. When a socket unbinds, - the head of the suspension list is given the port and the remaining entries - of the suspension list are transferred to its suspension list head pointer. */ - TX_THREAD *nx_udp_socket_bind_suspension_list; - ULONG nx_udp_socket_bind_suspended_count; - - /* Define the link between other UDP structures created by the application. This - is linked to the IP instance the socket was created on. */ - struct NX_UDP_SOCKET_STRUCT - *nx_udp_socket_created_next, - *nx_udp_socket_created_previous; - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_udp_receive_callback)(struct NX_UDP_SOCKET_STRUCT *socket_ptr); - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_UDP_SOCKET_STRUCT::nx_udp_socket_reserved_ptr) suppress member not referenced. It is reserved for future use. */ - void *nx_udp_socket_reserved_ptr; - - /* Define the port extension in the UDP socket control block. This - is typically defined to whitespace in nx_port.h. */ - NX_UDP_SOCKET_MODULE_EXTENSION - -} NX_UDP_SOCKET; - - -/* Determine if the TCP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_TCP_SOCKET_MODULE_EXTENSION -#define NX_TCP_SOCKET_MODULE_EXTENSION -#endif - - -/* Define the basic TCP socket structure. This structure is used to manage all information - necessary to manage TCP transmission and reception. */ - -typedef struct NX_TCP_SOCKET_STRUCT -{ - - /* Define the TCP identification that is used to determine if the TCP socket has - been created. */ - ULONG nx_tcp_socket_id; - - /* Define the Application defined name for this TCP socket instance. */ - CHAR *nx_tcp_socket_name; - - /* Define the socket type flag. If true, this socket is a client socket. */ - UINT nx_tcp_socket_client_type; - - /* Define the TCP port that was bound to. */ - UINT nx_tcp_socket_port; - - /* Define the TCP socket's maximum segment size (mss). By default, this is setup to the - IP's MTU less the size of the IP and TCP headers. */ - ULONG nx_tcp_socket_mss; - - /* Define the connected IP and port information. */ - NXD_ADDRESS nx_tcp_socket_connect_ip; - UINT nx_tcp_socket_connect_port; - ULONG nx_tcp_socket_connect_mss; - ULONG nx_tcp_socket_peer_mss; - struct NX_INTERFACE_STRUCT - *nx_tcp_socket_connect_interface; - ULONG nx_tcp_socket_next_hop_address; - - /* mss2 is the holding place for the smss * smss value. - It is computed and stored here once for later use. */ - ULONG nx_tcp_socket_connect_mss2; - - ULONG nx_tcp_socket_tx_slow_start_threshold; - - /* Define the state of the TCP connection. */ - UINT nx_tcp_socket_state; - - /* Define the receive and transmit sequence numbers. */ - ULONG nx_tcp_socket_tx_sequence; - ULONG nx_tcp_socket_rx_sequence; - ULONG nx_tcp_socket_rx_sequence_acked; - ULONG nx_tcp_socket_delayed_ack_timeout; - ULONG nx_tcp_socket_fin_sequence; - USHORT nx_tcp_socket_fin_received; - USHORT nx_tcp_socket_fin_acked; - - /* Track the advertised window size */ - ULONG nx_tcp_socket_tx_window_advertised; - ULONG nx_tcp_socket_tx_window_congestion; - ULONG nx_tcp_socket_tx_outstanding_bytes; /* Data transmitted but not acked. */ - - /* Define the transmit sequence that enters fast transmit. */ - ULONG nx_tcp_socket_tx_sequence_recover; - - /* Define the previous cumulative acknowledgment. */ - ULONG nx_tcp_socket_previous_highest_ack; - - /* Counter for "ack-N-packet" */ - ULONG nx_tcp_socket_ack_n_packet_counter; - - /* Counter for duplicated ACK */ - UINT nx_tcp_socket_duplicated_ack_received; - - /* Define the window size fields of the TCP socket structure. */ - ULONG nx_tcp_socket_rx_window_default; - ULONG nx_tcp_socket_rx_window_current; - ULONG nx_tcp_socket_rx_window_last_sent; - - /* Define the statistic and error counters for this TCP socket. */ - ULONG nx_tcp_socket_packets_sent; - ULONG nx_tcp_socket_bytes_sent; - ULONG nx_tcp_socket_packets_received; - ULONG nx_tcp_socket_bytes_received; - ULONG nx_tcp_socket_retransmit_packets; - ULONG nx_tcp_socket_checksum_errors; - - /* Define data for zero window probe. */ - ULONG nx_tcp_socket_zero_window_probe_failure; - ULONG nx_tcp_socket_zero_window_probe_sequence; - UCHAR nx_tcp_socket_zero_window_probe_has_data; - UCHAR nx_tcp_socket_zero_window_probe_data; - - /* Define whether or not TCP socket is in fast recovery procedure. */ - UCHAR nx_tcp_socket_fast_recovery; - - /* Reserved to four bytes alignment. */ - /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_tcp_socket_reserved; - - /* Define the entry that this TCP socket belongs to. */ - struct NX_IP_STRUCT - *nx_tcp_socket_ip_ptr; - - /* Define the type of service for this TCP instance. */ - ULONG nx_tcp_socket_type_of_service; - - /* Define the time-to-live for this TCP instance. */ - UINT nx_tcp_socket_time_to_live; - - /* Define the fragment enable bit for this TCP instance. */ - ULONG nx_tcp_socket_fragment_enable; - - /* Define the TCP receive packet queue pointers, queue counter, and - the maximum queue depth. */ - ULONG nx_tcp_socket_receive_queue_count; - NX_PACKET *nx_tcp_socket_receive_queue_head, - *nx_tcp_socket_receive_queue_tail; - - /* Define the TCP packet sent queue. This queue is used to keep track of the - transmit packets already send. Before they can be released we need to receive - an ACK back from the other end of the connection. If no ACK is received, the - packet(s) need to be re-transmitted. */ - ULONG nx_tcp_socket_transmit_queue_maximum; - ULONG nx_tcp_socket_transmit_sent_count; - NX_PACKET *nx_tcp_socket_transmit_sent_head, - *nx_tcp_socket_transmit_sent_tail; - - /* Define the maximum TCP packet receive queue. */ -#ifdef NX_ENABLE_LOW_WATERMARK - ULONG nx_tcp_socket_receive_queue_maximum; -#endif /* NX_ENABLE_LOW_WATERMARK */ - - /* Define the TCP transmit timeout parameters. If the socket timeout is non-zero, - there is an active timeout on the TCP socket. Subsequent timeouts are derived - from the timeout rate, which is adjusted higher as timeouts occur. */ - ULONG nx_tcp_socket_timeout; - ULONG nx_tcp_socket_timeout_rate; - ULONG nx_tcp_socket_timeout_retries; - ULONG nx_tcp_socket_timeout_max_retries; - ULONG nx_tcp_socket_timeout_shift; - -#ifdef NX_ENABLE_TCP_WINDOW_SCALING - /* Local receive window size, when user creates the TCP socket. */ - ULONG nx_tcp_socket_rx_window_maximum; - - /* Window scale this side needs to offer to the peer. */ - ULONG nx_tcp_rcv_win_scale_value; - - /* Window scale offered by the peer. 0xFF indicates the peer does not support window scaling. */ - ULONG nx_tcp_snd_win_scale_value; -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Define the TCP keepalive timer parameters. If enabled with NX_ENABLE_TCP_KEEPALIVE, - these parameters are used to implement the keepalive timer. */ -#ifdef NX_ENABLE_TCP_KEEPALIVE - ULONG nx_tcp_socket_keepalive_timeout; - ULONG nx_tcp_socket_keepalive_retries; -#endif /* NX_ENABLE_TCP_KEEPALIVE */ - - /* Define the TCP socket bound list. These pointers are used to manage the list - of TCP sockets on a particular hashed port index. */ - struct NX_TCP_SOCKET_STRUCT - *nx_tcp_socket_bound_next, - *nx_tcp_socket_bound_previous; - - /* Define the TCP socket bind suspension thread pointer. This pointer points - to the thread that that is suspended attempting to bind to a port that is - already bound to another socket. */ - TX_THREAD *nx_tcp_socket_bind_in_progress; - - /* Define the TCP receive suspension list head associated with a count of - how many threads are suspended attempting to receive from the same TCP port. */ - TX_THREAD *nx_tcp_socket_receive_suspension_list; - ULONG nx_tcp_socket_receive_suspended_count; - - /* Define the TCP transmit suspension list head associated with a count of - how many threads are suspended attempting to transmit from the same TCP port. */ - TX_THREAD *nx_tcp_socket_transmit_suspension_list; - ULONG nx_tcp_socket_transmit_suspended_count; - - /* Define the TCP connect suspension pointer that contains the pointer to the - thread suspended attempting to establish a TCP connection. */ - TX_THREAD *nx_tcp_socket_connect_suspended_thread; - - /* Define the TCP disconnect suspension pointer that contains the pointer to the - thread suspended attempting to break a TCP connection. */ - TX_THREAD *nx_tcp_socket_disconnect_suspended_thread; - - /* Define the TCP bind suspension list head associated with a count of - how many threads are suspended attempting to bind to the same TCP port. The - currently bound socket will maintain the head pointer. When a socket unbinds, - the head of the suspension list is given the port and the remaining entries - of the suspension list are transferred to its suspension list head pointer. */ - TX_THREAD *nx_tcp_socket_bind_suspension_list; - ULONG nx_tcp_socket_bind_suspended_count; - - /* Define the link between other TCP structures created by the application. This - is linked to the IP instance the socket was created on. */ - struct NX_TCP_SOCKET_STRUCT - *nx_tcp_socket_created_next, - *nx_tcp_socket_created_previous; - - /* Define the callback function for urgent data reception. This is for future use. */ - VOID (*nx_tcp_urgent_data_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - -#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT - /* Define the callback function for notifying an incoming SYN request. */ - UINT (*nx_tcp_socket_syn_received_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr, NX_PACKET *packet_ptr); - - /* Define the callback function for notifying the host application of a connection handshake completion - with a remote host. */ - VOID (*nx_tcp_establish_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for notifying the host application of disconnection completion - with a remote host. */ - VOID (*nx_tcp_disconnect_complete_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for notifying the host application to set the socket - state in the timed wait state. */ - VOID (*nx_tcp_timed_wait_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); -#endif - - /* Define the callback function for disconnect detection from the other side of - the connection. */ - VOID (*nx_tcp_disconnect_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_tcp_receive_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - - /* Define the callback function for receive packet notification. If specified - by the application, this function is called whenever a receive packet is - available on for the socket. */ - VOID (*nx_tcp_socket_window_update_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); - -#ifdef NX_ENABLE_TCP_QUEUE_DEPTH_UPDATE_NOTIFY - VOID (*nx_tcp_socket_queue_depth_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr); -#endif - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved_ptr) suppress member not referenced. It is reserved for application specific use. */ - void *nx_tcp_socket_reserved_ptr; - - /* Define the default maximum queue size. This is necessary to dynamically - change the maximum queue size dynamically. */ - ULONG nx_tcp_socket_transmit_queue_maximum_default; - - /* Define a flag for enabling the keepalive feature per TCP socket. */ -#ifdef NX_ENABLE_TCP_KEEPALIVE - UINT nx_tcp_socket_keepalive_enabled; -#endif /* NX_ENABLE_TCP_KEEPALIVE */ - -#ifdef FEATURE_NX_IPV6 - struct NXD_IPV6_ADDRESS_STRUCT *nx_tcp_socket_ipv6_addr; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - /* Stores a pointer to the SA, if the traffic needs to be protected. */ - VOID *nx_tcp_socket_egress_sa; - - /* Number of bytes to offset from IP header. This offset is needed to accommondate security header. */ - UINT nx_tcp_socket_egress_sa_data_offset; - -#endif /* NX_IPSEC_ENABLE */ - - /* Define the port extension in the TCP socket control block. This - is typically defined to whitespace in nx_port.h. */ - NX_TCP_SOCKET_MODULE_EXTENSION - -} NX_TCP_SOCKET; - - -/* Define the basic TCP listen request structure. This structure is used to indicate - which, if any, TCP ports are allowing a client connection. */ - -typedef struct NX_TCP_LISTEN_STRUCT -{ - - /* Define the port number that we are allowing a connection on. */ - UINT nx_tcp_listen_port; - - /* Define the listen callback routine that will be called when a connection - request is received. */ - VOID (*nx_tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port); - - /* Define the previously created socket for this listen request. */ - NX_TCP_SOCKET - *nx_tcp_listen_socket_ptr; - - /* Define the listen queue for connect requests that come in when the previous socket - given for a listen or relisten has been used. */ - ULONG nx_tcp_listen_queue_maximum; - ULONG nx_tcp_listen_queue_current; - NX_PACKET *nx_tcp_listen_queue_head, - *nx_tcp_listen_queue_tail; - - /* Define the link between other TCP listen structures created by the application. */ - struct NX_TCP_LISTEN_STRUCT - *nx_tcp_listen_next, - *nx_tcp_listen_previous; -} NX_TCP_LISTEN; - -/* There should be at least one physical interface. */ -#ifndef NX_MAX_PHYSICAL_INTERFACES -#define NX_MAX_PHYSICAL_INTERFACES 1 -#endif /* NX_MAX_PHYSICAL_INTERFACES */ - -#ifndef NX_MAX_IPV6_ADDRESSES -#define NX_MAX_IPV6_ADDRESSES (NX_MAX_PHYSICAL_INTERFACES * 3) -#endif /* NX_MAX_IPV6_ADDRESSES */ - -#if (NX_MAX_IPV6_ADDRESSES < 2) -#error "NetX Duo needs at least 2 IPv6 interface addresses. " -#endif - -#ifndef NX_DISABLE_LOOPBACK_INTERFACE -/* Inside interface array, entries 0 up to NX_MAX_PHYSICAL_INTERFACES are assigned to the - physical interfaces. Entry NX_MAX_PHYSICAL_INTERFACES is assigned to the loopback interface. */ -#define NX_LOOPBACK_INTERFACE NX_MAX_PHYSICAL_INTERFACES -#define NX_LOOPBACK_IPV6_SOURCE_INDEX NX_MAX_IPV6_ADDRESSES -#define NX_LOOPBACK_IPV6_ENABLED 1 -#else -#define NX_LOOPBACK_INTERFACE 0 -#define NX_LOOPBACK_IPV6_ENABLED 0 -#endif /* NX_DISALBE_LOOPBACK_INTERFACE */ - -#if (defined(NX_DISABLE_LOOPBACK_INTERFACE) && (NX_MAX_PHYSICAL_INTERFACES == 0)) -#error "NetX is built without either physical interfaces or loopback interfaces." -#endif - -#if defined(NX_DISABLE_LOOPBACK_INTERFACE) -#define NX_MAX_IP_INTERFACES NX_MAX_PHYSICAL_INTERFACES -#else -#define NX_MAX_IP_INTERFACES (NX_MAX_PHYSICAL_INTERFACES + 1) -#endif /* NX_DISABLE_LOOPBACK_INTERFACE */ - -#ifdef NX_DISABLE_PACKET_CHAIN -#ifndef NX_DISABLE_FRAGMENTATION -#error "IP fragmentation is not supported if packet chain is disabled." -#endif /* NX_DISABLE_FRAGMENTATION */ -#endif /* NX_DISABLE_PACKET_CHAIN */ - -struct NX_IP_DRIVER_STRUCT; - -typedef struct NXD_IPV6_ADDRESS_STRUCT -{ - UCHAR nxd_ipv6_address_valid; - - UCHAR nxd_ipv6_address_type; /* IPv6 = 6 */ - - /* Current state:Invalid,Tentative...*/ - UCHAR nxd_ipv6_address_state; - - /* Prefix length */ - UCHAR nxd_ipv6_address_prefix_length; - - /* Pointer to the physical interface where this address is attached to.*/ - struct NX_INTERFACE_STRUCT *nxd_ipv6_address_attached; - - /* Interface address,in host byte order */ - ULONG nxd_ipv6_address[4]; - - /* Pointer to the next address, or NX_NULL */ - struct NXD_IPV6_ADDRESS_STRUCT *nxd_ipv6_address_next; - - /* Number of DAD packets to be transmitted. */ - /* This entry is used only if DAD is enabled. */ - UCHAR nxd_ipv6_address_DupAddrDetectTransmit; - - /* Describe how the interface is configured. */ - UCHAR nxd_ipv6_address_ConfigurationMethod; - - /* Define the index in array. */ - UCHAR nxd_ipv6_address_index; - - /* Reserved. */ - /*lint -esym(768,NXD_IPV6_ADDRESS_STRUCT::reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR reserved; -} NXD_IPV6_ADDRESS; - -/* Define the address interface structure. */ -typedef struct NX_INTERFACE_STRUCT -{ - - /* Flag indicating whether or not the interface entry is valid. */ - CHAR *nx_interface_name; - UCHAR nx_interface_valid; - UCHAR nx_interface_address_mapping_needed; - - /* Define the Link Up field that is manipulated by the associated link driver. */ - UCHAR nx_interface_link_up; - - /* Define the index in array. */ - UCHAR nx_interface_index; - - /* Define a flag to check if link status change. */ - UCHAR nx_interface_link_status_change; - - /*lint -esym(768,NX_INTERFACE_STRUCT::nx_interface_reserved) suppress member not referenced. It is reserved for future use. */ - UCHAR nx_interface_reserved[3]; - - /* Define the physical address of this IP instance. These field are - setup by the link driver during initialization. */ - ULONG nx_interface_physical_address_msw; - ULONG nx_interface_physical_address_lsw; - -#ifndef NX_DISABLE_IPV4 - /* Define the IP address of this IP instance. Loopback can be done by - either using the same address or by using 127.*.*.*. */ - ULONG nx_interface_ip_address; - - /* Define the network portion of the IP address. */ - ULONG nx_interface_ip_network_mask; - - /* Define the network only bits of the IP address. */ - ULONG nx_interface_ip_network; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the head of the interface IPv6 address list. - Typically the 1st entry on the list is the link local address, - followed by one or more global IPv6 addresses. - */ - struct NXD_IPV6_ADDRESS_STRUCT *nxd_interface_ipv6_address_list_head; - - /* Define information setup by the Link Driver. */ - ULONG nx_interface_ip_mtu_size; - -#ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION - - /* Maximum number of router solicitation messages to send. */ - ULONG nx_ipv6_rtr_solicitation_max; - - /* Number of router solicitation messages to be sent. */ - ULONG nx_ipv6_rtr_solicitation_count; - - /* Time (in seconds) before sending out another Router Solicitation message. */ - ULONG nx_ipv6_rtr_solicitation_interval; - - /* Count down timer for sending out router solicitation message. */ - ULONG nx_ipv6_rtr_solicitation_timer; -#endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */ - -#ifdef NX_IPV6_STATELESS_AUTOCONFIG_CONTROL - ULONG nx_ipv6_stateless_address_autoconfig_status; -#endif /* NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */ - /* Define a pointer for use by the applicaiton. Typically this is going to be - used by the link drvier. */ - VOID *nx_interface_additional_link_info; - - /* Define the Link Driver entry point. */ - VOID (*nx_interface_link_driver_entry)(struct NX_IP_DRIVER_STRUCT *); - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - /* Define the capability flag of hardware for the interface. */ - ULONG nx_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifndef NX_DISABLE_IPV4 - /* Define the ARP defend timeout. */ - ULONG nx_interface_arp_defend_timeout; - - /* Define the IP probe address. */ - ULONG nx_interface_ip_probe_address; - - /* Define the IP conflict notify handler. A non-null value for this function - pointer results in NetX calling it when an IP address is found in an incoming - ARP packet that matches that of nx_interface_ip_probe_address. */ - VOID (*nx_interface_ip_conflict_notify_handler)(struct NX_IP_STRUCT *, UINT, ULONG, ULONG, ULONG); -#endif /* !NX_DISABLE_IPV4 */ -} NX_INTERFACE; - -/* Define the static IPv4 routing table entry structure. */ -#if defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4) -typedef struct NX_IP_ROUTING_ENTRY_STRUCT -{ - /* Destination IP address, in host byte order */ - ULONG nx_ip_routing_dest_ip; - - /* Net mask, in host byte order */ - ULONG nx_ip_routing_net_mask; - - /* Next hop address, in host byte order. */ - ULONG nx_ip_routing_next_hop_address; - - struct NX_INTERFACE_STRUCT - *nx_ip_routing_entry_ip_interface; -} NX_IP_ROUTING_ENTRY; -#endif /* defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4) */ - -#ifndef NX_DISABLE_IPV4 -typedef struct NX_IPV4_MULTICAST_STRUCT -{ - - /* Define the multicast registered group list. */ - ULONG nx_ipv4_multicast_join_list; - - /* Define the multicast regstiered group interface list. */ - NX_INTERFACE *nx_ipv4_multicast_join_interface_list; - - /* Define the multicast registration count. */ - ULONG nx_ipv4_multicast_join_count; - - /* Define the multicast random time list. */ - ULONG nx_ipv4_multicast_update_time; - - /* Define the multicast loopback flag list. This flag is set based on the global - loopback enable at the time the group was joined. */ - UINT nx_ipv4_multicast_loopback_enable; -} NX_IPV4_MULTICAST_ENTRY; -#endif /* NX_DISABLE_IPV4 */ - -#ifdef NX_ENABLE_IPV6_MULTICAST -typedef struct NX_IPV6_MULTICAST_STRUCT -{ - - /* Define the MLD registered group list. */ - ULONG nx_ip_mld_join_list[4]; - - /* Define the MLD regstiered group interface list. */ - NX_INTERFACE *nx_ip_mld_join_interface_list; - - /* Define the MLD registration count. */ - ULONG nx_ip_mld_join_count; -} NX_IPV6_MULTICAST_ENTRY; - -#endif /* NX_ENABLE_IPV6_MULTICAST */ - - -/* Determine if the IP control block has an extension defined. If not, - define the extension to whitespace. */ - -#ifndef NX_IP_MODULE_EXTENSION -#define NX_IP_MODULE_EXTENSION -#endif - - -/* Define the Internet Protocol (IP) structure. Any number of IP instances - may be used by the application. */ - -typedef struct NX_IP_STRUCT -{ - - /* Define the IP identification that is used to determine if the IP has - been created. */ - ULONG nx_ip_id; - - /* Define the Application defined name for this IP instance. */ - CHAR *nx_ip_name; - - /* Define the IP address of this IP instance. Loopback can be done by - either using the same address or by using 127.*.*.*. */ -#if 1 -#define nx_ip_address nx_ip_interface[0].nx_interface_ip_address -#define nx_ip_driver_mtu nx_ip_interface[0].nx_interface_ip_mtu_size -#define nx_ip_driver_mapping_needed nx_ip_interface[0].nx_interface_address_mapping_needed -#define nx_ip_network_mask nx_ip_interface[0].nx_interface_ip_network_mask -#define nx_ip_network nx_ip_interface[0].nx_interface_ip_network -#define nx_ip_arp_physical_address_msw nx_ip_interface[0].nx_interface_physical_address_msw -#define nx_ip_arp_physical_address_lsw nx_ip_interface[0].nx_interface_physical_address_lsw -#define nx_ip_driver_link_up nx_ip_interface[0].nx_interface_link_up -#define nx_ip_link_driver_entry nx_ip_interface[0].nx_interface_link_driver_entry -#define nx_ip_additional_link_info nx_ip_interface[0].nx_interface_additional_link_info -#endif - -#ifndef NX_DISABLE_IPV4 - /* Define the gateway IP address. */ - ULONG nx_ip_gateway_address; /* In host byte order */ - - struct NX_INTERFACE_STRUCT - *nx_ip_gateway_interface; -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - /* Define IPv6 addresses. NetX6 allows user to specify Global address - in addition to the link-local address generated automatically. */ - /* IPv6 address takes 16 bytes. These addresses are 4-byte aligned */ - struct NXD_IPV6_ADDRESS_STRUCT nx_ipv6_address[NX_MAX_IPV6_ADDRESSES + NX_LOOPBACK_IPV6_ENABLED]; - - /* Define the destination table. */ - NX_IPV6_DESTINATION_ENTRY - nx_ipv6_destination_table[NX_IPV6_DESTINATION_TABLE_SIZE]; - - /* Define the ND cache table. */ - ND_CACHE_ENTRY - nx_ipv6_nd_cache[NX_IPV6_NEIGHBOR_CACHE_SIZE]; - - /* Define the destination table size. */ - UINT nx_ipv6_destination_table_size; -#endif /* FEATURE_NX_IPV6 */ - - /* Define the statistic and error counters for this IP instance. */ - ULONG nx_ip_total_packet_send_requests; - ULONG nx_ip_total_packets_sent; - ULONG nx_ip_total_bytes_sent; - ULONG nx_ip_total_packets_received; - ULONG nx_ip_total_packets_delivered; - ULONG nx_ip_total_bytes_received; - ULONG nx_ip_packets_forwarded; - ULONG nx_ip_packets_reassembled; - ULONG nx_ip_reassembly_failures; - ULONG nx_ip_invalid_packets; - ULONG nx_ip_invalid_transmit_packets; - ULONG nx_ip_invalid_receive_address; - ULONG nx_ip_unknown_protocols_received; - - /*lint -esym(768,NX_IP_STRUCT::nx_ip_transmit_no_route_errors) suppress member not referenced. It is reserved for application specific use. */ - ULONG nx_ip_transmit_resource_errors; - ULONG nx_ip_transmit_no_route_errors; - ULONG nx_ip_receive_packets_dropped; - ULONG nx_ip_receive_checksum_errors; - ULONG nx_ip_send_packets_dropped; - ULONG nx_ip_total_fragment_requests; - ULONG nx_ip_successful_fragment_requests; - ULONG nx_ip_fragment_failures; - ULONG nx_ip_total_fragments_sent; - ULONG nx_ip_total_fragments_received; - ULONG nx_ip_arp_requests_sent; - ULONG nx_ip_arp_requests_received; - ULONG nx_ip_arp_responses_sent; - ULONG nx_ip_arp_responses_received; - ULONG nx_ip_arp_aged_entries; - ULONG nx_ip_arp_invalid_messages; - ULONG nx_ip_arp_static_entries; - ULONG nx_ip_udp_packets_sent; - ULONG nx_ip_udp_bytes_sent; - ULONG nx_ip_udp_packets_received; - ULONG nx_ip_udp_bytes_received; - ULONG nx_ip_udp_invalid_packets; - ULONG nx_ip_udp_no_port_for_delivery; - ULONG nx_ip_udp_receive_packets_dropped; - ULONG nx_ip_udp_checksum_errors; - ULONG nx_ip_tcp_packets_sent; - ULONG nx_ip_tcp_bytes_sent; - ULONG nx_ip_tcp_packets_received; - ULONG nx_ip_tcp_bytes_received; - ULONG nx_ip_tcp_invalid_packets; - ULONG nx_ip_tcp_receive_packets_dropped; - ULONG nx_ip_tcp_checksum_errors; - ULONG nx_ip_tcp_connections; - ULONG nx_ip_tcp_passive_connections; - ULONG nx_ip_tcp_active_connections; - ULONG nx_ip_tcp_disconnections; - ULONG nx_ip_tcp_connections_dropped; - ULONG nx_ip_tcp_retransmit_packets; - ULONG nx_ip_tcp_resets_received; - ULONG nx_ip_tcp_resets_sent; - ULONG nx_ip_icmp_total_messages_received; - ULONG nx_ip_icmp_checksum_errors; - ULONG nx_ip_icmp_invalid_packets; - ULONG nx_ip_icmp_unhandled_messages; - ULONG nx_ip_pings_sent; - ULONG nx_ip_ping_timeouts; - ULONG nx_ip_ping_threads_suspended; - ULONG nx_ip_ping_responses_received; - ULONG nx_ip_pings_received; - ULONG nx_ip_pings_responded_to; - ULONG nx_ip_igmp_invalid_packets; - ULONG nx_ip_igmp_reports_sent; - ULONG nx_ip_igmp_queries_received; - ULONG nx_ip_igmp_checksum_errors; - ULONG nx_ip_igmp_groups_joined; -#ifndef NX_DISABLE_IGMPV2 - ULONG nx_ip_igmp_router_version; -#endif - ULONG nx_ip_rarp_requests_sent; - ULONG nx_ip_rarp_responses_received; - ULONG nx_ip_rarp_invalid_messages; - - - /* Define the IP forwarding flag. This is by default set to NX_NULL. - If forwarding is desired, the nx_ip_forward_packet_process service - pointed to by this member should be called. */ -#ifndef NX_DISABLE_IPV4 - VOID (*nx_ip_forward_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); - -#ifdef NX_NAT_ENABLE - /* Define the NAT forwarded packet handler. This is by default set to NX_NULL. */ - UINT (*nx_ip_nat_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *, UINT packet_process); - - /* Define the NAT port verify handler. This is by default set to NX_NULL. */ - UINT (*nx_ip_nat_port_verify)(struct NX_IP_STRUCT *, UINT protocol, UINT port); -#endif -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the packet ID. */ - ULONG nx_ip_packet_id; - - /* Define the default packet pool. */ - struct NX_PACKET_POOL_STRUCT - *nx_ip_default_packet_pool; - -#ifdef NX_ENABLE_DUAL_PACKET_POOL - /* Define the auxiliary packet pool for internal usage. */ - struct NX_PACKET_POOL_STRUCT - *nx_ip_auxiliary_packet_pool; -#endif /* NX_ENABLE_DUAL_PACKET_POOL */ - - /* Define the internal mutex used for protection inside the NetX - data structures. */ - TX_MUTEX nx_ip_protection; - - /* Define the initialize done flag. */ - UINT nx_ip_initialize_done; - -#ifdef NX_DRIVER_DEFERRED_PROCESSING - /* Define the Link Driver hardware deferred packet queue. */ - NX_PACKET *nx_ip_driver_deferred_packet_head, - *nx_ip_driver_deferred_packet_tail; - - /* Define the Link Driver hardware deferred packet processing routine. If the driver - deferred processing is enabled, this routine is called from the IP helper thread. */ - VOID (*nx_ip_driver_deferred_packet_handler)(struct NX_IP_STRUCT *, NX_PACKET *); -#endif /* NX_DRIVER_DEFERRED_PROCESSING */ - - /* Define the deferred packet processing queue. This is used to - process packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_deferred_received_packet_head, - *nx_ip_deferred_received_packet_tail; - - /* Define the raw IP function pointer that also indicates whether or - not raw IP packet sending and receiving is enabled. */ - UINT (*nx_ip_raw_ip_processing)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *); - -#ifdef NX_ENABLE_IP_RAW_PACKET_FILTER - /* Define the raw packet filter function pointer. */ - UINT (*nx_ip_raw_packet_filter)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *); -#endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */ - - /* Define the pointer to the raw IP packet queue. */ - NX_PACKET *nx_ip_raw_received_packet_head, - *nx_ip_raw_received_packet_tail; - - /* Define the count of raw IP packets on the queue. */ - ULONG nx_ip_raw_received_packet_count; - - /* Define the maximum number of packets queued for receive. */ - ULONG nx_ip_raw_received_packet_max; - - /* Define the raw packet suspension list head along with a count of - how many threads are suspended. */ - TX_THREAD *nx_ip_raw_packet_suspension_list; - ULONG nx_ip_raw_packet_suspended_count; - - /* Define the IP helper thread that processes periodic ARP requests, - reassembles IP messages, and helps handle TCP/IP packets. */ - TX_THREAD nx_ip_thread; - - /* Define the IP event flags that are used to stimulate the IP helper - thread. */ - TX_EVENT_FLAGS_GROUP - nx_ip_events; - - /* Define the IP periodic timer for this IP instance. */ - TX_TIMER nx_ip_periodic_timer; - - /* Define the IP fragment function pointer that also indicates whether or - IP fragmenting is enabled. */ - VOID (*nx_ip_fragment_processing)(struct NX_IP_DRIVER_STRUCT *); - - /* Define the IP unfragment function pointer. */ - VOID (*nx_ip_fragment_assembly)(struct NX_IP_STRUCT *); - - /* Define the IP unfragment timeout checking function pointer. */ - VOID (*nx_ip_fragment_timeout_check)(struct NX_IP_STRUCT *); - - /* Define the fragment pointer to the oldest fragment re-assembly. If this is - the same between any periodic the fragment re-assembly is too old and - will be deleted. */ - NX_PACKET *nx_ip_timeout_fragment; - - /* Define the pointer to the fragmented IP packet queue. This queue is - appended when a fragmented packet is received and is drained inside - the IP. */ - NX_PACKET *nx_ip_received_fragment_head, - *nx_ip_received_fragment_tail; - - /* Define the pointer to the fragment re-assembly queue. */ - NX_PACKET *nx_ip_fragment_assembly_head, - *nx_ip_fragment_assembly_tail; - -#ifdef NX_ENABLE_6LOWPAN - /* Define the created 6LoWPAN list. */ - VOID *nx_ip_6lowpan_created_ptr; - -#ifdef NX_ENABLE_THREAD - /* Define the created Thread list. */ - VOID *nx_ip_thread_created_ptr; -#endif /* NX_ENABLE_THREAD */ -#endif /* NX_ENABLE_6LOWPAN */ - -#ifndef NX_DISABLE_IPV4 - /* Define the IP address change notification callback routine pointer. */ - VOID (*nx_ip_address_change_notify)(struct NX_IP_STRUCT *, VOID *); - VOID *nx_ip_address_change_notify_additional_info; -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 -#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY - VOID (*nx_ipv6_address_change_notify)(struct NX_IP_STRUCT *ip_ptr, UINT status, UINT interface_index, UINT addres_index, ULONG *ip_address); -#endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */ -#endif /* FEATURE_NX_IPV6 */ - -#ifndef NX_DISABLE_IPV4 - /* Define the multicast entry. */ - NX_IPV4_MULTICAST_ENTRY nx_ipv4_multicast_entry[NX_MAX_MULTICAST_GROUPS]; - - /* Define global IGMP loopback enable/disable flag. By default, IGMP loopback is - disabled. */ - UINT nx_ip_igmp_global_loopback_enable; - - /* Define the IGMP receive packet processing routine. This is setup when IGMP - is enabled. */ - void (*nx_ip_igmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the IGMP periodic processing routine. This is also setup when IGMP - is enabled. */ - void (*nx_ip_igmp_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the IGMP packet queue processing routine. This is setup when IGMP is - enabled. */ - void (*nx_ip_igmp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the IGMP message queue. */ - NX_PACKET *nx_ip_igmp_queue_head; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the ICMP sequence number. This is used in ICMP messages that - require a sequence number. */ - ULONG nx_ip_icmp_sequence; - -#ifdef NX_ENABLE_IPV6_MULTICAST - - /* Define the IPv6 Multicast Group structure. */ - NX_IPV6_MULTICAST_ENTRY nx_ipv6_multicast_entry[NX_MAX_MULTICAST_GROUPS]; - - /* Define the MLD join count. */ - ULONG nx_ipv6_multicast_groups_joined; - -#endif /* NX_ENABLE_IPV6_MULTICAST */ - - /* Define the ICMP packet receive routine. This also doubles as a - mechanism to make sure ICMP is enabled. If this function is NULL, ICMP - is not enabled. */ - void (*nx_ip_icmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - -#ifndef NX_DISABLE_IPV4 - /* Define the ICMP packet queue processing routine. This is setup when ICMP is - enabled. */ - void (*nx_ip_icmp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the ICMP packet process routine */ - void (*nx_ip_icmpv4_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - /* Define the ICMPv6 packet process routine. */ - void (*nx_ip_icmpv6_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Define the Neighbor Discovery cache fast (10ms) periodic update routine. */ - void (*nx_nd_cache_fast_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the Neighbor Discovery cache slow (1000 ms) periodic update routine. */ - void (*nx_nd_cache_slow_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the ICMPv6 router advertisement flag callback. */ - void (*nx_icmpv6_ra_flag_callback)(struct NX_IP_STRUCT *, UINT); - -#ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY - /* Define the MTU path discovery periodic update. */ - void (*nx_destination_table_periodic_update)(struct NX_IP_STRUCT *); -#endif - -#endif /* FEATURE_NX_IPV6 */ - - - /* Define the ICMP message queue. */ - NX_PACKET *nx_ip_icmp_queue_head; - - /* Define the ICMP ping suspension list head associated with a count of - how many threads are suspended attempting to ping. */ - TX_THREAD *nx_ip_icmp_ping_suspension_list; - ULONG nx_ip_icmp_ping_suspended_count; - - /* Define the UDP port information structure associated with this IP instance. */ - struct NX_UDP_SOCKET_STRUCT - *nx_ip_udp_port_table[NX_UDP_PORT_TABLE_SIZE]; - - /* Define the head pointer of the created UDP socket list. */ - struct NX_UDP_SOCKET_STRUCT - *nx_ip_udp_created_sockets_ptr; - - /* Define the number of created UDP socket instances. */ - ULONG nx_ip_udp_created_sockets_count; - - /* Define the UDP packet receive routine. This also doubles as a - mechanism to make sure UDP is enabled. If this function is NULL, UDP - is not enabled. */ - void (*nx_ip_udp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the TCP port information structure associated with this IP instance. */ - struct NX_TCP_SOCKET_STRUCT - *nx_ip_tcp_port_table[NX_TCP_PORT_TABLE_SIZE]; - - /* Define the head pointer of the created TCP socket list. */ - struct NX_TCP_SOCKET_STRUCT - *nx_ip_tcp_created_sockets_ptr; - - /* Define the number of created TCP socket instances. */ - ULONG nx_ip_tcp_created_sockets_count; - - /* Define the TCP packet receive routine. This also doubles as a - mechanism to make sure TCP is enabled. If this function is NULL, TCP - is not enabled. */ - void (*nx_ip_tcp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *); - - /* Define the TCP periodic processing routine for transmit timeout logic. */ - void (*nx_ip_tcp_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the TCP fast periodic processing routine for transmit timeout logic. */ - void (*nx_ip_tcp_fast_periodic_processing)(struct NX_IP_STRUCT *); - - /* Define the TCP packet queue processing routine. This is setup when TCP is - enabled. */ - void (*nx_ip_tcp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the pointer to the incoming TCP packet queue. */ - NX_PACKET *nx_ip_tcp_queue_head, - *nx_ip_tcp_queue_tail; - - /* Define the count of incoming TCP packets on the queue. */ - ULONG nx_ip_tcp_received_packet_count; - - /* Define the TCP listen request structure that contains the maximum number of - listen requests allowed for this IP instance. */ - NX_TCP_LISTEN - nx_ip_tcp_server_listen_reqs[NX_MAX_LISTEN_REQUESTS]; - - /* Define the head pointer of the available listen request structures. */ - NX_TCP_LISTEN - *nx_ip_tcp_available_listen_requests; - - /* Define the head pointer of the active listen requests. These are made - by issuing the nx_tcp_server_socket_listen service. */ - NX_TCP_LISTEN - *nx_ip_tcp_active_listen_requests; - - /* Define a flag indicating the IP fast timer has been created */ - UINT nx_ip_fast_periodic_timer_created; - - /* Define the fast IP periodic timer used for high resolution events for - this IP instance. */ - TX_TIMER nx_ip_fast_periodic_timer; - -#ifndef NX_DISABLE_IPV4 - /* Define the destination routing information associated with this IP - instance. */ - struct NX_ARP_STRUCT - *nx_ip_arp_table[NX_ARP_TABLE_SIZE]; - - /* Define the head pointer of the static ARP list. */ - struct NX_ARP_STRUCT - *nx_ip_arp_static_list; - - /* Define the head pointer of the dynamic ARP list. */ - struct NX_ARP_STRUCT - *nx_ip_arp_dynamic_list; - - /* Define the number of dynamic entries that are active. */ - ULONG nx_ip_arp_dynamic_active_count; - - /* Define the ARP deferred packet processing queue. This is used to - process ARP packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_arp_deferred_received_packet_head, - *nx_ip_arp_deferred_received_packet_tail; - - /* Define the ARP entry allocate routine. This also doubles as a - mechanism to make sure ARP is enabled. If this function is NULL, ARP - is not enabled. */ - UINT (*nx_ip_arp_allocate)(struct NX_IP_STRUCT *, struct NX_ARP_STRUCT **, UINT); - - /* Define the ARP periodic processing routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the ARP receive queue processing routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the ARP send packet routine. This is setup when ARP is - enabled. */ - void (*nx_ip_arp_packet_send)(struct NX_IP_STRUCT *, ULONG destination_ip, NX_INTERFACE *nx_interface); - - /* Define the ARP gratuitous response handler. This routine is setup in the - nx_arp_gratuitous_send function. */ - void (*nx_ip_arp_gratuitous_response_handler)(struct NX_IP_STRUCT *, NX_PACKET *); - -#ifdef NX_ENABLE_ARP_MAC_CHANGE_NOTIFICATION - /* Define the ARP collision notify handler. A non-null value for this function - pointer results in NetX calling it whenever an IP address is found in an incoming - ARP packet that matches that of the IP address in our ARP table. */ - void (*nx_ip_arp_collision_notify_response_handler)(void *); -#endif - - /* Define the ARP cache memory area. This memory is supplied - by the ARP enable function and is carved up by that function into as - many ARP entries that will fit. */ - struct NX_ARP_STRUCT - *nx_ip_arp_cache_memory; - - /* Define the number of ARP entries that will fit in the ARP cache. */ - ULONG nx_ip_arp_total_entries; - - /* Define the RARP periodic processing routine. This is setup when RARP is - enabled. It is also used to indicate RARP is enabled. */ - void (*nx_ip_rarp_periodic_update)(struct NX_IP_STRUCT *); - - /* Define the RARP receive queue processing routine. This is setup when RARP is - enabled. */ - void (*nx_ip_rarp_queue_process)(struct NX_IP_STRUCT *); - - /* Define the RARP deferred packet processing queue. This is used to - process RARP packets not initially processed in the receive ISR. */ - NX_PACKET *nx_ip_rarp_deferred_received_packet_head, - *nx_ip_rarp_deferred_received_packet_tail; -#endif /* !NX_DISABLE_IPV4 */ - - /* Define the link between other IP structures created by the application. */ - struct NX_IP_STRUCT - *nx_ip_created_next, - *nx_ip_created_previous; - - /* This pointer is reserved for application specific use. */ - /*lint -esym(768,NX_IP_STRUCT::nx_ip_reserved_ptr) suppress member not referenced. */ - void *nx_ip_reserved_ptr; - - /* Define the TCP devered cleanup processing routine. */ - void (*nx_tcp_deferred_cleanup_check)(struct NX_IP_STRUCT *); - - /* Define the interfaces attached to this IP instance. */ - NX_INTERFACE nx_ip_interface[NX_MAX_IP_INTERFACES]; - -#ifndef NX_DISABLE_IPV4 - /* Define the IPv4 packet receive processing routine */ - void (*nx_ipv4_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Define the static routing table, if the feature is enabled. */ -#ifdef NX_ENABLE_IP_STATIC_ROUTING - - /* IPv4 static routing table. */ - NX_IP_ROUTING_ENTRY - nx_ip_routing_table[NX_IP_ROUTING_TABLE_SIZE]; - - /* Number of entries in the IPv4 static routing table. */ - ULONG nx_ip_routing_table_entry_count; - -#endif /* NX_ENABLE_IP_STATIC_ROUTING */ -#endif /* !NX_DISABLE_IPV4 */ - -#ifdef FEATURE_NX_IPV6 - - /* Number of valid entries in the IPv6 default router table. */ - USHORT nx_ipv6_default_router_table_size; - - /* IPv6 default router table. */ - NX_IPV6_DEFAULT_ROUTER_ENTRY nx_ipv6_default_router_table[NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE]; - - /* Create an index for round robin router selection. */ - UINT nx_ipv6_default_router_table_round_robin_index; - - /* - * IPv6 prefix table. Entries in the prefix table are put into two lists: - * the prefix list, and the free list. The prefix list keeps track of a list - * of valid prefix entries. The free list points to the unused entries. - */ - NX_IPV6_PREFIX_ENTRY nx_ipv6_prefix_list_table[NX_IPV6_PREFIX_LIST_TABLE_SIZE]; - - /* Point to the 1st element of the prefix list. */ - NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_list_ptr; - - /* Pointer to the 1st element of the prefix free list entry. */ - NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_entry_free_list; - - /* Define the IPv6 packet receive processing routine */ - void (*nx_ipv6_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *); - - /* Variable tracks the Neighbor Solicitation retransmission timer. */ - ULONG nx_ipv6_retrans_timer_ticks; - - /* Variable tracks the Neighbor reachable timer. */ - ULONG nx_ipv6_reachable_timer; - - /* Variable tracks the current hop_limit. Hop limit is assigned by - routers through the router advertisement message. */ - ULONG nx_ipv6_hop_limit; - -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - /* Define the IPsec Authentication Header process function, for the received packet. */ - UINT (*nx_ip_ipsec_authentication_header_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **); - - /* Define the IPsec Authentication Header process function, for the transmit packet. */ - UINT (*nx_ip_ipsec_authentication_header_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT, UINT); - - /* Define the IPsec Encapsulating Security Payload header process function, for the received packet. */ - UINT (*nx_ip_ipsec_encapsulating_security_payload_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **); - - /* Define the IPsec Encapsulating Security Payload header insert function, for the transmit packet. */ - UINT (*nx_ip_ipsec_encapsulating_security_payload_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT); - - /* Define the IPsec egress SA lookup routine. This is called by TCP/UDP/ICMP/RAW packet send. */ - UINT (*nx_ip_packet_egress_sa_lookup)(struct NX_IP_STRUCT *ip_ptr, NXD_ADDRESS *src_address, - NXD_ADDRESS *dst_address, UCHAR protocol, ULONG src_port, ULONG dest_port, - ULONG *data_offset, VOID **sa_ptr, UINT option); - - /* Define the head pointer of the ingress SA list. */ - VOID *nx_ip_ipsec_ingress_sa_ptr; - - /* Define the head pointer of the egress SA list. */ - VOID *nx_ip_ipsec_egress_sa_ptr; - - /* Define the reference to IKEv2. */ - VOID *nx_ip_ipsec_ikev2_ptr; - - /* Define the packet queue header in which packet is processed by hardware engine. */ - NX_PACKET *nx_ip_hw_done_packet_header_ptr; - - /* Define the packet queue tail in which packet is processed by hardware engine. */ - NX_PACKET *nx_ip_hw_done_packet_tail_ptr; - -#endif /* NX_IPSEC_ENABLE */ - - /* Define the link status change notify routine. */ - VOID (*nx_ip_link_status_change_callback)(struct NX_IP_STRUCT *, UINT, UINT); - -#ifdef NX_ENABLE_IP_PACKET_FILTER - /* Define the IP packet filter routine. */ - UINT (*nx_ip_packet_filter)(VOID *, UINT); -#endif /* NX_ENABLE_IP_PACKET_FILTER */ - - /* Define the port extension in the IP control block. This - is typically defined to whitespace in nx_port.h. */ - NX_IP_MODULE_EXTENSION - -} NX_IP; - - -/* Define the Driver interface structure that is typically allocated off of the - local stack and passed to the IP Link Driver. */ - -typedef struct NX_IP_DRIVER_STRUCT -{ - - /* Define the driver command. */ - UINT nx_ip_driver_command; - - /* Define the driver return status. */ - UINT nx_ip_driver_status; - - /* Define the physical address that maps to the destination IP address. */ - ULONG nx_ip_driver_physical_address_msw; - ULONG nx_ip_driver_physical_address_lsw; - -#ifdef NX_ENABLE_6LOWPAN - /* Define the length of physical address. Used by 6LoWPAN driver. */ - USHORT nx_ip_driver_physical_address_length; - - /* Define the 6LoWPAN sub driver command, see nx_6lowpan.h. Used by 6LoWPAN driver. */ - USHORT nx_ip_driver_sub_command; -#endif /* NX_ENABLE_6LOWPAN */ - - /* Define the datagram packet (if any) for the driver to send. */ - NX_PACKET *nx_ip_driver_packet; - - /* Define the return pointer for raw driver command requests. */ - ULONG *nx_ip_driver_return_ptr; - - /* Define the IP pointer associated with the request. */ - struct NX_IP_STRUCT - *nx_ip_driver_ptr; - - NX_INTERFACE *nx_ip_driver_interface; -} NX_IP_DRIVER; - - -/* Define the system API mappings based on the error checking - selected by the user. Note: this section is only applicable to - application source code, hence the conditional that turns off this - stuff when the include file is processed by the ThreadX source. */ - -#ifndef NX_SOURCE_CODE - -/* Map old APIs to new APIs. */ -#define nx_ip_raw_packet_interface_send nx_ip_raw_packet_source_send -#define nx_udp_socket_interface_send nx_udp_socket_source_send -#define nxd_icmp_interface_ping nxd_icmp_source_ping -#define nxd_ip_raw_packet_interface_send nxd_ip_raw_packet_source_send -#define nxd_ipv6_global_address_set(i, a, p) nxd_ipv6_address_set(i, 0, a, p, NX_NULL) -#define nxd_ipv6_linklocal_address_set(i, a) nxd_ipv6_address_set(i, 0, a, 10, NX_NULL) -#define nxd_udp_socket_interface_send nxd_udp_socket_source_send - - -/* Determine if error checking is desired. If so, map API functions - to the appropriate error checking front-ends. Otherwise, map API - functions to the core functions that actually perform the work. - Note: error checking is enabled by default. */ - -#ifdef NX_DISABLE_ERROR_CHECKING - -#if 0 /* Not support for STM32L4XX. */ -/* Services without error checking. */ -/* APIs for ARP. */ -#define nx_arp_dynamic_entries_invalidate _nx_arp_dynamic_entries_invalidate -#define nx_arp_dynamic_entry_set _nx_arp_dynamic_entry_set -#define nx_arp_enable _nx_arp_enable -#define nx_arp_entry_delete _nx_arp_entry_delete -#define nx_arp_gratuitous_send _nx_arp_gratuitous_send -#define nx_arp_hardware_address_find _nx_arp_hardware_address_find -#define nx_arp_info_get _nx_arp_info_get -#define nx_arp_ip_address_find _nx_arp_ip_address_find -#define nx_arp_static_entries_delete _nx_arp_static_entries_delete -#define nx_arp_static_entry_create _nx_arp_static_entry_create -#define nx_arp_static_entry_delete _nx_arp_static_entry_delete -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ICMP. */ -#define nx_icmp_enable _nx_icmp_enable -#define nx_icmp_info_get _nx_icmp_info_get -#define nx_icmp_ping _nx_icmp_ping -#define nxd_icmp_enable _nxd_icmp_enable -#define nxd_icmp_ping _nxd_icmp_ping -#define nxd_icmp_source_ping _nxd_icmp_source_ping -#define nxd_icmpv6_ra_flag_callback_set _nxd_icmpv6_ra_flag_callback_set -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IGMP. */ -#define nx_igmp_enable _nx_igmp_enable -#define nx_igmp_info_get _nx_igmp_info_get -#define nx_igmp_loopback_disable _nx_igmp_loopback_disable -#define nx_igmp_multicast_leave _nx_igmp_multicast_leave -#define nx_igmp_multicast_interface_join _nx_igmp_multicast_interface_join -#define nx_igmp_multicast_interface_leave _nx_igmp_multicast_interface_leave -#define nx_igmp_loopback_enable _nx_igmp_loopback_enable -#define nx_igmp_multicast_join _nx_igmp_multicast_join -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IP. */ -#define nx_ip_address_change_notify _nx_ip_address_change_notify -#define nx_ip_address_get _nx_ip_address_get -#define nx_ip_address_set _nx_ip_address_set -#define nx_ip_auxiliary_packet_pool_set _nx_ip_auxiliary_packet_pool_set -#endif - -#define nx_ip_create _nx_ip_create -#define nx_ip_delete _nx_ip_delete - -#if 0 /* Not support for STM32L4XX. */ -#define nx_ip_driver_direct_command _nx_ip_driver_direct_command -#define nx_ip_driver_interface_direct_command _nx_ip_driver_interface_direct_command -#define nx_ip_forwarding_disable _nx_ip_forwarding_disable -#define nx_ip_forwarding_enable _nx_ip_forwarding_enable -#define nx_ip_fragment_disable _nx_ip_fragment_disable -#define nx_ip_fragment_enable _nx_ip_fragment_enable -#define nx_ip_gateway_address_clear _nx_ip_gateway_address_clear -#define nx_ip_gateway_address_get _nx_ip_gateway_address_get -#define nx_ip_gateway_address_set _nx_ip_gateway_address_set -#define nx_ip_info_get _nx_ip_info_get -#define nx_ip_interface_address_get _nx_ip_interface_address_get -#define nx_ip_interface_address_mapping_configure _nx_ip_interface_address_mapping_configure -#define nx_ip_interface_address_set _nx_ip_interface_address_set -#define nx_ip_interface_attach _nx_ip_interface_attach -#define nx_ip_interface_capability_get _nx_ip_interface_capability_get -#define nx_ip_interface_capability_set _nx_ip_interface_capability_set -#define nx_ip_interface_detach _nx_ip_interface_detach -#define nx_ip_interface_info_get _nx_ip_interface_info_get -#define nx_ip_interface_mtu_set _nx_ip_interface_mtu_set -#define nx_ip_interface_physical_address_get _nx_ip_interface_physical_address_get -#define nx_ip_interface_physical_address_set _nx_ip_interface_physical_address_set -#define nx_ip_interface_status_check _nx_ip_interface_status_check -#define nx_ip_link_status_change_notify_set _nx_ip_link_status_change_notify_set -#define nx_ip_max_payload_size_find _nx_ip_max_payload_size_find -#define nx_ip_status_check _nx_ip_status_check -#define nx_ip_static_route_add _nx_ip_static_route_add -#define nx_ip_static_route_delete _nx_ip_static_route_delete -#define nx_ipv4_multicast_interface_join _nx_ipv4_multicast_interface_join -#define nx_ipv4_multicast_interface_leave _nx_ipv4_multicast_interface_leave -#define nxd_ipv6_address_change_notify _nxd_ipv6_address_change_notify -#define nxd_ipv6_address_delete _nxd_ipv6_address_delete -#define nxd_ipv6_address_get _nxd_ipv6_address_get -#define nxd_ipv6_address_set _nxd_ipv6_address_set -#define nxd_ipv6_default_router_add _nxd_ipv6_default_router_add -#define nxd_ipv6_default_router_delete _nxd_ipv6_default_router_delete -#define nxd_ipv6_default_router_entry_get _nxd_ipv6_default_router_entry_get -#define nxd_ipv6_default_router_get _nxd_ipv6_default_router_get -#define nxd_ipv6_default_router_number_of_entries_get _nxd_ipv6_default_router_number_of_entries_get -#define nxd_ipv6_disable _nxd_ipv6_disable -#define nxd_ipv6_enable _nxd_ipv6_enable -#define nxd_ipv6_multicast_interface_join _nxd_ipv6_multicast_interface_join -#define nxd_ipv6_multicast_interface_leave _nxd_ipv6_multicast_interface_leave -#define nxd_ipv6_stateless_address_autoconfig_disable _nxd_ipv6_stateless_address_autoconfig_disable -#define nxd_ipv6_stateless_address_autoconfig_enable _nxd_ipv6_stateless_address_autoconfig_enable -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RAW service. */ -#define nx_ip_raw_packet_disable _nx_ip_raw_packet_disable -#define nx_ip_raw_packet_enable _nx_ip_raw_packet_enable -#define nx_ip_raw_packet_filter_set _nx_ip_raw_packet_filter_set -#define nx_ip_raw_packet_receive _nx_ip_raw_packet_receive -#define nx_ip_raw_packet_send _nx_ip_raw_packet_send -#define nx_ip_raw_packet_source_send _nx_ip_raw_packet_source_send -#define nx_ip_raw_receive_queue_max_set _nx_ip_raw_receive_queue_max_set -#define nxd_ip_raw_packet_send _nxd_ip_raw_packet_send -#define nxd_ip_raw_packet_source_send _nxd_ip_raw_packet_source_send -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ND cache. */ -#define nxd_nd_cache_entry_set _nxd_nd_cache_entry_set -#define nxd_nd_cache_entry_delete _nxd_nd_cache_entry_delete -#define nxd_nd_cache_hardware_address_find _nxd_nd_cache_hardware_address_find -#define nxd_nd_cache_invalidate _nxd_nd_cache_invalidate -#define nxd_nd_cache_ip_address_find _nxd_nd_cache_ip_address_find -#endif - -/* APIs for packet pool. */ -#define nx_packet_allocate _nx_packet_allocate -#define nx_packet_copy _nx_packet_copy -#define nx_packet_data_append _nx_packet_data_append -#define nx_packet_data_extract_offset _nx_packet_data_extract_offset -#define nx_packet_data_retrieve _nx_packet_data_retrieve -#define nx_packet_length_get _nx_packet_length_get -#define nx_packet_pool_create _nx_packet_pool_create -#define nx_packet_pool_delete _nx_packet_pool_delete -#define nx_packet_pool_info_get _nx_packet_pool_info_get -#define nx_packet_pool_low_watermark_set _nx_packet_pool_low_watermark_set -#define nx_packet_release _nx_packet_release -#define nx_packet_transmit_release _nx_packet_transmit_release - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RARP. */ -#define nx_rarp_disable _nx_rarp_disable -#define nx_rarp_enable _nx_rarp_enable -#define nx_rarp_info_get _nx_rarp_info_get -#endif - -/* APIs for TCP. */ -#define nx_tcp_client_socket_bind _nx_tcp_client_socket_bind -#define nx_tcp_client_socket_connect _nx_tcp_client_socket_connect -#define nx_tcp_client_socket_port_get _nx_tcp_client_socket_port_get -#define nx_tcp_client_socket_unbind _nx_tcp_client_socket_unbind -#define nx_tcp_enable _nx_tcp_enable -#define nx_tcp_free_port_find _nx_tcp_free_port_find -#define nx_tcp_info_get _nx_tcp_info_get -#define nx_tcp_server_socket_accept _nx_tcp_server_socket_accept -#define nx_tcp_server_socket_listen _nx_tcp_server_socket_listen -#define nx_tcp_server_socket_relisten _nx_tcp_server_socket_relisten -#define nx_tcp_server_socket_unaccept _nx_tcp_server_socket_unaccept -#define nx_tcp_server_socket_unlisten _nx_tcp_server_socket_unlisten -#define nx_tcp_socket_bytes_available _nx_tcp_socket_bytes_available -#define nx_tcp_socket_create _nx_tcp_socket_create -#define nx_tcp_socket_delete _nx_tcp_socket_delete -#define nx_tcp_socket_disconnect _nx_tcp_socket_disconnect -#define nx_tcp_socket_disconnect_complete_notify _nx_tcp_socket_disconnect_complete_notify -#define nx_tcp_socket_establish_notify _nx_tcp_socket_establish_notify -#define nx_tcp_socket_info_get _nx_tcp_socket_info_get -#define nx_tcp_socket_mss_get _nx_tcp_socket_mss_get -#define nx_tcp_socket_mss_peer_get _nx_tcp_socket_mss_peer_get -#define nx_tcp_socket_mss_set _nx_tcp_socket_mss_set -#define nx_tcp_socket_peer_info_get _nx_tcp_socket_peer_info_get -#define nx_tcp_socket_queue_depth_notify_set _nx_tcp_socket_queue_depth_notify_set -#define nx_tcp_socket_receive _nx_tcp_socket_receive -#define nx_tcp_socket_receive_notify _nx_tcp_socket_receive_notify -#define nx_tcp_socket_receive_queue_max_set _nx_tcp_socket_receive_queue_max_set -#define nx_tcp_socket_send _nx_tcp_socket_send -#define nx_tcp_socket_state_wait _nx_tcp_socket_state_wait -#define nx_tcp_socket_timed_wait_callback _nx_tcp_socket_timed_wait_callback -#define nx_tcp_socket_transmit_configure _nx_tcp_socket_transmit_configure -#define nx_tcp_socket_window_update_notify_set _nx_tcp_socket_window_update_notify_set -#define nxd_tcp_client_socket_connect _nxd_tcp_client_socket_connect -#define nxd_tcp_socket_peer_info_get _nxd_tcp_socket_peer_info_get - -/* APIs for UDP. */ - -#define nx_udp_enable _nx_udp_enable -#define nx_udp_free_port_find _nx_udp_free_port_find -#define nx_udp_info_get _nx_udp_info_get -#define nx_udp_packet_info_extract _nx_udp_packet_info_extract -#define nx_udp_socket_bind _nx_udp_socket_bind -#define nx_udp_socket_bytes_available _nx_udp_socket_bytes_available -#define nx_udp_socket_checksum_disable _nx_udp_socket_checksum_disable -#define nx_udp_socket_checksum_enable _nx_udp_socket_checksum_enable -#define nx_udp_socket_create _nx_udp_socket_create -#define nx_udp_socket_delete _nx_udp_socket_delete -#define nx_udp_socket_info_get _nx_udp_socket_info_get -#define nx_udp_socket_port_get _nx_udp_socket_port_get -#define nx_udp_socket_receive _nx_udp_socket_receive -#define nx_udp_socket_receive_notify _nx_udp_socket_receive_notify -#define nx_udp_socket_send _nx_udp_socket_send -#define nx_udp_socket_source_send _nx_udp_socket_source_send -#define nx_udp_socket_unbind _nx_udp_socket_unbind -#define nx_udp_source_extract _nx_udp_source_extract -#define nxd_udp_packet_info_extract _nxd_udp_packet_info_extract -#define nxd_udp_socket_send _nxd_udp_socket_send -#define nxd_udp_socket_source_send _nxd_udp_socket_source_send -#define nxd_udp_source_extract _nxd_udp_source_extract - -/* APIs for others. */ -#define nx_system_initialize _nx_system_initialize - -#else - -#if 0 /* Not support for STM32L4XX. */ -/* Services with error checking. */ -/* APIs for ARP. */ -#define nx_arp_dynamic_entries_invalidate _nxe_arp_dynamic_entries_invalidate -#define nx_arp_dynamic_entry_set _nxe_arp_dynamic_entry_set -#define nx_arp_enable _nxe_arp_enable -#define nx_arp_entry_delete _nxe_arp_entry_delete -#define nx_arp_gratuitous_send _nxe_arp_gratuitous_send -#define nx_arp_hardware_address_find _nxe_arp_hardware_address_find -#define nx_arp_info_get _nxe_arp_info_get -#define nx_arp_ip_address_find _nxe_arp_ip_address_find -#define nx_arp_static_entries_delete _nxe_arp_static_entries_delete -#define nx_arp_static_entry_create _nxe_arp_static_entry_create -#define nx_arp_static_entry_delete _nxe_arp_static_entry_delete -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ICMP. */ -#define nx_icmp_enable _nxe_icmp_enable -#define nx_icmp_info_get _nxe_icmp_info_get -#define nx_icmp_ping _nxe_icmp_ping -#define nxd_icmp_enable _nxde_icmp_enable -#define nxd_icmp_ping _nxde_icmp_ping -#define nxd_icmp_source_ping _nxde_icmp_source_ping -#define nxd_icmpv6_ra_flag_callback_set _nxde_icmpv6_ra_flag_callback_set -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IGMP. */ -#define nx_igmp_enable _nxe_igmp_enable -#define nx_igmp_info_get _nxe_igmp_info_get -#define nx_igmp_loopback_disable _nxe_igmp_loopback_disable -#define nx_igmp_loopback_enable _nxe_igmp_loopback_enable -#define nx_igmp_multicast_interface_join _nxe_igmp_multicast_interface_join -#define nx_igmp_multicast_interface_leave _nxe_igmp_multicast_interface_leave -#define nx_igmp_multicast_join _nxe_igmp_multicast_join -#define nx_igmp_multicast_leave _nxe_igmp_multicast_leave -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for IP. */ -#define nx_ip_address_change_notify _nxe_ip_address_change_notify -#define nx_ip_address_get _nxe_ip_address_get -#define nx_ip_address_set _nxe_ip_address_set -#define nx_ip_auxiliary_packet_pool_set _nxe_ip_auxiliary_packet_pool_set -#endif - -#define nx_ip_create(i, n, a, m, d, l, p, s, y) _nxe_ip_create(i, n, a, m, d, l, p, s, y, sizeof(NX_IP)) -#define nx_ip_delete _nxe_ip_delete - -#if 0 /* Not support for STM32L4XX. */ -#define nx_ip_driver_direct_command _nxe_ip_driver_direct_command -#define nx_ip_driver_interface_direct_command _nxe_ip_driver_interface_direct_command -#define nx_ip_forwarding_disable _nxe_ip_forwarding_disable -#define nx_ip_forwarding_enable _nxe_ip_forwarding_enable -#define nx_ip_fragment_disable _nxe_ip_fragment_disable -#define nx_ip_fragment_enable _nxe_ip_fragment_enable -#define nx_ip_gateway_address_clear _nxe_ip_gateway_address_clear -#define nx_ip_gateway_address_get _nxe_ip_gateway_address_get -#define nx_ip_gateway_address_set _nxe_ip_gateway_address_set -#define nx_ip_info_get _nxe_ip_info_get -#define nx_ip_interface_address_get _nxe_ip_interface_address_get -#define nx_ip_interface_address_mapping_configure _nxe_ip_interface_address_mapping_configure -#define nx_ip_interface_address_set _nxe_ip_interface_address_set -#define nx_ip_interface_attach _nxe_ip_interface_attach -#define nx_ip_interface_capability_get _nxe_ip_interface_capability_get -#define nx_ip_interface_capability_set _nxe_ip_interface_capability_set -#define nx_ip_interface_detach _nxe_ip_interface_detach -#define nx_ip_interface_info_get _nxe_ip_interface_info_get -#define nx_ip_interface_mtu_set _nxe_ip_interface_mtu_set -#define nx_ip_interface_physical_address_get _nxe_ip_interface_physical_address_get -#define nx_ip_interface_physical_address_set _nxe_ip_interface_physical_address_set -#define nx_ip_interface_status_check _nxe_ip_interface_status_check -#define nx_ip_link_status_change_notify_set _nxe_ip_link_status_change_notify_set -#define nx_ip_max_payload_size_find _nxe_ip_max_payload_size_find -#define nx_ip_status_check _nxe_ip_status_check -#define nx_ip_static_route_add _nxe_ip_static_route_add -#define nx_ip_static_route_delete _nxe_ip_static_route_delete -#define nx_ipv4_multicast_interface_join _nxe_ipv4_multicast_interface_join -#define nx_ipv4_multicast_interface_leave _nxe_ipv4_multicast_interface_leave -#define nxd_ipv6_address_change_notify _nxde_ipv6_address_change_notify -#define nxd_ipv6_address_delete _nxde_ipv6_address_delete -#define nxd_ipv6_address_get _nxde_ipv6_address_get -#define nxd_ipv6_address_set _nxde_ipv6_address_set -#define nxd_ipv6_default_router_add _nxde_ipv6_default_router_add -#define nxd_ipv6_default_router_delete _nxde_ipv6_default_router_delete -#define nxd_ipv6_default_router_entry_get _nxde_ipv6_default_router_entry_get -#define nxd_ipv6_default_router_get _nxde_ipv6_default_router_get -#define nxd_ipv6_default_router_number_of_entries_get _nxde_ipv6_default_router_number_of_entries_get -#define nxd_ipv6_disable _nxde_ipv6_disable -#define nxd_ipv6_enable _nxde_ipv6_enable -#define nxd_ipv6_multicast_interface_join _nxde_ipv6_multicast_interface_join -#define nxd_ipv6_multicast_interface_leave _nxde_ipv6_multicast_interface_leave -#define nxd_ipv6_stateless_address_autoconfig_disable _nxde_ipv6_stateless_address_autoconfig_disable -#define nxd_ipv6_stateless_address_autoconfig_enable _nxde_ipv6_stateless_address_autoconfig_enable -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RAW service. */ -#define nx_ip_raw_packet_disable _nxe_ip_raw_packet_disable -#define nx_ip_raw_packet_enable _nxe_ip_raw_packet_enable -#define nx_ip_raw_packet_filter_set _nxe_ip_raw_packet_filter_set -#define nx_ip_raw_packet_receive _nxe_ip_raw_packet_receive -#define nx_ip_raw_packet_send(i, p, d, t) _nxe_ip_raw_packet_send(i, &p, d, t) -#define nx_ip_raw_packet_source_send(i, p, d, a, t) _nxe_ip_raw_packet_source_send(i, &p, d, a, t) -#define nx_ip_raw_receive_queue_max_set _nxe_ip_raw_receive_queue_max_set -#define nxd_ip_raw_packet_send(i, p, d, t, l, s) _nxde_ip_raw_packet_send(i, &p, d, t, l, s) -#define nxd_ip_raw_packet_source_send _nxde_ip_raw_packet_source_send -#endif - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for ND cache. */ -#define nxd_nd_cache_entry_set _nxde_nd_cache_entry_set -#define nxd_nd_cache_entry_delete _nxde_nd_cache_entry_delete -#define nxd_nd_cache_hardware_address_find _nxde_nd_cache_hardware_address_find -#define nxd_nd_cache_invalidate _nxde_nd_cache_invalidate -#define nxd_nd_cache_ip_address_find _nxde_nd_cache_ip_address_find -#endif - -/* APIs for packet pool. */ -#define nx_packet_allocate _nxe_packet_allocate -#define nx_packet_copy _nxe_packet_copy -#define nx_packet_data_append _nxe_packet_data_append -#define nx_packet_data_extract_offset _nxe_packet_data_extract_offset -#define nx_packet_data_retrieve _nxe_packet_data_retrieve -#define nx_packet_length_get _nxe_packet_length_get -#define nx_packet_pool_create(p, n, l, m, s) _nxe_packet_pool_create(p, n, l, m, s, sizeof(NX_PACKET_POOL)) -#define nx_packet_pool_delete _nxe_packet_pool_delete -#define nx_packet_pool_info_get _nxe_packet_pool_info_get -#define nx_packet_pool_low_watermark_set _nxe_packet_pool_low_watermark_set -#define nx_packet_release(p) _nxe_packet_release(&p) -#define nx_packet_transmit_release(p) _nxe_packet_transmit_release(&p) - -#if 0 /* Not support for STM32L4XX. */ -/* APIs for RARP. */ -#define nx_rarp_disable _nxe_rarp_disable -#define nx_rarp_enable _nxe_rarp_enable -#define nx_rarp_info_get _nxe_rarp_info_get -#endif - -/* APIs for TCP. */ -#define nx_tcp_client_socket_bind _nxe_tcp_client_socket_bind -#define nx_tcp_client_socket_connect _nxe_tcp_client_socket_connect -#define nx_tcp_client_socket_port_get _nxe_tcp_client_socket_port_get -#define nx_tcp_client_socket_unbind _nxe_tcp_client_socket_unbind -#define nx_tcp_enable _nxe_tcp_enable -#define nx_tcp_free_port_find _nxe_tcp_free_port_find -#define nx_tcp_info_get _nxe_tcp_info_get -#define nx_tcp_server_socket_accept _nxe_tcp_server_socket_accept -#define nx_tcp_server_socket_listen _nxe_tcp_server_socket_listen -#define nx_tcp_server_socket_relisten _nxe_tcp_server_socket_relisten -#define nx_tcp_server_socket_unaccept _nxe_tcp_server_socket_unaccept -#define nx_tcp_server_socket_unlisten _nxe_tcp_server_socket_unlisten -#define nx_tcp_socket_bytes_available _nxe_tcp_socket_bytes_available -#define nx_tcp_socket_create(i, s, n, t, f, l, w, u, d) _nxe_tcp_socket_create(i, s, n, t, f, l, w, u, d, sizeof(NX_TCP_SOCKET)) -#define nx_tcp_socket_delete _nxe_tcp_socket_delete -#define nx_tcp_socket_disconnect _nxe_tcp_socket_disconnect -#define nx_tcp_socket_disconnect_complete_notify _nxe_tcp_socket_disconnect_complete_notify -#define nx_tcp_socket_establish_notify _nxe_tcp_socket_establish_notify -#define nx_tcp_socket_info_get _nxe_tcp_socket_info_get -#define nx_tcp_socket_mss_get _nxe_tcp_socket_mss_get -#define nx_tcp_socket_mss_peer_get _nxe_tcp_socket_mss_peer_get -#define nx_tcp_socket_mss_set _nxe_tcp_socket_mss_set -#define nx_tcp_socket_peer_info_get _nxe_tcp_socket_peer_info_get -#define nx_tcp_socket_queue_depth_notify_set _nxe_tcp_socket_queue_depth_notify_set -#define nx_tcp_socket_receive _nxe_tcp_socket_receive -#define nx_tcp_socket_receive_notify _nxe_tcp_socket_receive_notify -#define nx_tcp_socket_receive_queue_max_set _nxe_tcp_socket_receive_queue_max_set -#define nx_tcp_socket_send(s, p, t) _nxe_tcp_socket_send(s, &p, t) -#define nx_tcp_socket_state_wait _nxe_tcp_socket_state_wait -#define nx_tcp_socket_timed_wait_callback _nxe_tcp_socket_timed_wait_callback -#define nx_tcp_socket_transmit_configure _nxe_tcp_socket_transmit_configure -#define nx_tcp_socket_window_update_notify_set _nxe_tcp_socket_window_update_notify_set -#define nxd_tcp_client_socket_connect _nxde_tcp_client_socket_connect -#define nxd_tcp_socket_peer_info_get _nxde_tcp_socket_peer_info_get - -/* APIs for UDP. */ -#define nx_udp_enable _nxe_udp_enable -#define nx_udp_free_port_find _nxe_udp_free_port_find -#define nx_udp_info_get _nxe_udp_info_get -#define nx_udp_packet_info_extract _nxe_udp_packet_info_extract -#define nx_udp_socket_bind _nxe_udp_socket_bind -#define nx_udp_socket_bytes_available _nxe_udp_socket_bytes_available -#define nx_udp_socket_checksum_disable _nxe_udp_socket_checksum_disable -#define nx_udp_socket_checksum_enable _nxe_udp_socket_checksum_enable -#define nx_udp_socket_create(i, s, n, t, f, l, q) _nxe_udp_socket_create(i, s, n, t, f, l, q, sizeof(NX_UDP_SOCKET)) -#define nx_udp_socket_delete _nxe_udp_socket_delete -#define nx_udp_socket_info_get _nxe_udp_socket_info_get -#define nx_udp_socket_port_get _nxe_udp_socket_port_get -#define nx_udp_socket_receive _nxe_udp_socket_receive -#define nx_udp_socket_receive_notify _nxe_udp_socket_receive_notify -#define nx_udp_socket_send(s, p, i, t) _nxe_udp_socket_send(s, &p, i, t) -#define nx_udp_socket_source_send(s, p, i, t, a) _nxe_udp_socket_source_send(s, &p, i, t, a) -#define nx_udp_socket_unbind _nxe_udp_socket_unbind -#define nx_udp_source_extract _nxe_udp_source_extract -#define nxd_udp_packet_info_extract _nxde_udp_packet_info_extract -#define nxd_udp_socket_send(s, p, i, t) _nxde_udp_socket_send(s, &p, i, t) -#define nxd_udp_socket_source_send _nxde_udp_socket_source_send -#define nxd_udp_source_extract _nxde_udp_source_extract - -/* APIs for others. */ -#define nx_system_initialize _nx_system_initialize -#endif - - -/* Define the function prototypes of the NetX Duo API. */ - -/* APIs for ARP. */ -UINT nx_arp_dynamic_entries_invalidate(NX_IP *ip_ptr); -UINT nx_arp_dynamic_entry_set(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_enable(NX_IP *ip_ptr, VOID *arp_cache_memory, ULONG arp_cache_size); -UINT nx_arp_entry_delete(NX_IP *ip_ptr, ULONG ip_address); -UINT nx_arp_gratuitous_send(NX_IP *ip_ptr, VOID (*response_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -UINT nx_arp_hardware_address_find(NX_IP *ip_ptr, ULONG ip_address, ULONG *physical_msw, ULONG *physical_lsw); -UINT nx_arp_info_get(NX_IP *ip_ptr, ULONG *arp_requests_sent, ULONG *arp_requests_received, - ULONG *arp_responses_sent, ULONG *arp_responses_received, - ULONG *arp_dynamic_entries, ULONG *arp_static_entries, - ULONG *arp_aged_entries, ULONG *arp_invalid_messages); -UINT nx_arp_ip_address_find(NX_IP *ip_ptr, ULONG *ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_static_entries_delete(NX_IP *ip_ptr); -UINT nx_arp_static_entry_create(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); -UINT nx_arp_static_entry_delete(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw); - -/* APIs for ICMP. */ -UINT nx_icmp_enable(NX_IP *ip_ptr); -UINT nx_icmp_info_get(NX_IP *ip_ptr, ULONG *pings_sent, ULONG *ping_timeouts, - ULONG *ping_threads_suspended, ULONG *ping_responses_received, - ULONG *icmp_checksum_errors, ULONG *icmp_unhandled_messages); -UINT nx_icmp_ping(NX_IP *ip_ptr, ULONG ip_address, CHAR *data, ULONG data_size, - NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmp_enable(NX_IP *ip_ptr); -UINT nxd_icmp_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, CHAR *data_ptr, ULONG data_size, - NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmp_source_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, UINT address_index, CHAR *data_ptr, - ULONG data_size, NX_PACKET **response_ptr, ULONG wait_option); -UINT nxd_icmpv6_ra_flag_callback_set(NX_IP *ip_ptr, - VOID (*icmpv6_ra_flag_callback)(NX_IP *ip_ptr, UINT ra_flag)); - -/* APIs for IGMP. */ -UINT nx_igmp_enable(NX_IP *ip_ptr); -UINT nx_igmp_info_get(NX_IP *ip_ptr, ULONG *igmp_reports_sent, ULONG *igmp_queries_received, - ULONG *igmp_checksum_errors, ULONG *current_groups_joined); -UINT nx_igmp_loopback_disable(NX_IP *ip_ptr); -UINT nx_igmp_loopback_enable(NX_IP *ip_ptr); -UINT nx_igmp_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_igmp_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_igmp_multicast_join(NX_IP *ip_ptr, ULONG group_address); -UINT nx_igmp_multicast_leave(NX_IP *ip_ptr, ULONG group_address); - -/* APIs for IP. */ -UINT nx_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT nx_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT nx_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT nx_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size); -#else -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority); -#endif -UINT nx_ip_delete(NX_IP *ip_ptr); -UINT nx_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT nx_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); -UINT nx_ip_forwarding_disable(NX_IP *ip_ptr); -UINT nx_ip_forwarding_enable(NX_IP *ip_ptr); -UINT nx_ip_fragment_disable(NX_IP *ip_ptr); -UINT nx_ip_fragment_enable(NX_IP *ip_ptr); -UINT nx_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT nx_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT nx_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT nx_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT nx_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT nx_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT nx_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, - VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT nx_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT nx_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT nx_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, ULONG *ip_address, - ULONG *network_mask, ULONG *mtu_size, ULONG *physical_address_msw, - ULONG *physical_address_lsw); -UINT nx_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *physical_msw, - ULONG *physical_lsw); -UINT nx_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG physical_msw, - ULONG physical_lsw, UINT update_driver); -UINT nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, - ULONG *actual_status, ULONG wait_option); -UINT nx_ip_link_status_change_notify_set(NX_IP *ip_ptr, - VOID (*link_status_change_notify)(NX_IP *ip_ptr, - UINT interface_index, - UINT link_up)); -UINT nx_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT nx_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option); -UINT nx_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask, ULONG next_hop); -UINT nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT nx_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nx_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT nxd_ipv6_address_change_notify(NX_IP *ip_ptr, - VOID (*ip_address_change_notify)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, - ULONG *prefix_length, UINT *interface_index); -UINT nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, - ULONG prefix_length, UINT *address_index); -UINT nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, - ULONG router_lifetime, UINT interface_index); -UINT nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_addr); -UINT nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, - NXD_ADDRESS *router_addr, ULONG *router_lifetime, - ULONG *prefix_length, ULONG *configuration_method); -UINT nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, - ULONG *router_lifetime, ULONG *prefix_length); -UINT nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT nxd_ipv6_disable(NX_IP *ip_ptr); -UINT nxd_ipv6_enable(NX_IP *ip_ptr); -UINT nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); - -/* APIs for RAW service. */ -UINT nx_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT nx_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT nx_ip_raw_packet_filter_set(NX_IP *ip_ptr, UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT nx_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nxe_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -#else -UINT _nx_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nx_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nx_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, NXD_ADDRESS *destination_ip, - ULONG protocol, UINT ttl, ULONG tos); -#else /* NX_DISABLE_ERROR_CHECKING */ -UINT _nxd_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, - ULONG protocol, UINT ttl, ULONG tos); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nxd_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, - UINT address_index, ULONG protocol, UINT ttl, ULONG tos); - -/* APIs for ND cache. */ -UINT nxd_nd_cache_entry_set(NX_IP *ip_ptr, ULONG *dest_ip, UINT interface_index, CHAR *mac); -UINT nxd_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip); -UINT nxd_nd_cache_hardware_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, - ULONG *physical_msw, ULONG *physical_lsw, UINT *interface_index); -UINT nxd_nd_cache_invalidate(NX_IP *ip_ptr); -UINT nxd_nd_cache_ip_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, - ULONG physical_msw, ULONG physical_lsw, UINT *interface_index); - -/* APIs for packet pool. */ -UINT nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, - ULONG buffer_length, ULONG *bytes_copied); -UINT nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size, UINT pool_control_block_size); -#else -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size); -#endif -UINT nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_water_mark); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr); -#else -UINT _nx_packet_release(NX_PACKET *packet_ptr); -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr); -#endif - -/* APIs for RARP. */ -UINT nx_rarp_disable(NX_IP *ip_ptr); -UINT nx_rarp_enable(NX_IP *ip_ptr); -UINT nx_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received, - ULONG *rarp_invalid_messages); - -/* APIs for TCP. */ -UINT nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, - UINT server_port, ULONG wait_option); -UINT nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_enable(NX_IP *ip_ptr); -UINT nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size); -#else -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)); -#endif -UINT nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_establish_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); -UINT nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option); -#else -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -#endif -UINT nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *)); -UINT nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_window_update_notify)(NX_TCP_SOCKET *)); -UINT nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, - UINT server_port, ULONG wait_option); -UINT nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); - -/* APIs for UDP. */ -UINT nx_udp_enable(NX_IP *ip_ptr); -UINT nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT nx_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -UINT nx_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT nx_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT nx_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum, UINT udp_socket_size); -#else - -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum); -#endif -UINT nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT nx_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *)); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT _nxde_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port, UINT address_index); - -#else /* NX_DISABLE_ERROR_CHECKING */ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port); -UINT _nxd_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, UINT port, UINT address_index); -#endif /* NX_DISABLE_ERROR_CHECKING */ -UINT nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT nx_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT nxd_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); -#ifndef NX_DISABLE_ERROR_CHECKING -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port); -UINT _nxe_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG ip_address, UINT port, UINT address_index); -#else -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port); -UINT _nx_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port, UINT address_index); - -#endif -UINT nxd_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); - -/* APIs for others. */ -VOID nx_system_initialize(VOID); - -/* Define several function prototypes for exclusive use by NetX I/O drivers. These routines - are used by NetX drivers to report received packets to NetX. */ - -/* Define the driver deferred packet routines. Using these routines results in the lowest - possible ISR processing time. However, it does require slightly more overhead than the - other NetX receive processing routines. The _nx_ip_driver_deferred_enable routine - should be called from the driver's initialization routine, with the driver's deferred - packet processing routine provided. Each packet the driver receives should be - delivered to NetX via the _nx_ip_driver_deferred_receive function. This function - queues the packet for the NetX IP thread. The NetX IP thread will then call the driver's - deferred packet processing routine, which can then process the packet at a thread level - of execution. The deferred packet processing routine should use the _nx_ip_packet_receive, - _nx_arp_packet_deferred_receive, and _nx_rarp_packet_deferred_receive to dispatch the - appropriate packets to NetX. In order to use the deferred packet processing, NetX - must be built with NX_DRIVER_DEFERRED_PROCESSING defined. */ - -VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -VOID _nx_ip_driver_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - - -/* Define the driver deferred processing notification routine. Calling this routine from - the driver will cause the driver to be called with the NX_LINK_DEFERRED_PROCESSING - value specified in the nx_ip_driver_command field of the NX_IP_DRIVER request - structure. This is useful in situations where the driver wishes to process activities - like transmit complete interrupts at the thread level rather than in the ISR. Note - that the driver must set its own internal variables in order to know what processing - needs to be done when subsequently called from the IP helper thread. */ - -VOID _nx_ip_driver_deferred_processing(NX_IP *ip_ptr); - - -/* Define the deferred NetX receive processing routines. These routines depend on the - NetX I/O drive to perform enough processing in the ISR to strip the link protocol - header and dispatch to the appropriate NetX receive processing. These routines - can also be called from the previously mentioned driver deferred processing. */ - -VOID _nx_ip_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_arp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_rarp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - - -/* Define the direct IP packet receive processing. This is the lowest overhead way - to notify NetX of a received IP packet, however, it results in the most amount of - processing in the driver's receive ISR. If the driver deferred packet processing - is used, this routine should be used to notify NetX of the newly received IP packet. */ - -VOID _nx_ip_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - -/* Define the direct link status event. This is the lowest overhead way - to notify NetX of link status event, however, it results in the most amount of - processing in the driver's receive ISR. */ -VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index); - -#endif - -#ifdef FEATURE_NX_IPV6 - -#ifdef NX_LITTLE_ENDIAN -#define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr) _nx_ipv6_address_change_endian(addr) -#else /* BIG ENDIAN */ -#define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr) -#endif /* NX_LITTLE_ENDIAN */ - -#endif /* FEATURE_NX_IPV6 */ - - -#ifdef NX_IPV6_UTIL_INLINE -/* Return 1 if IPv6 address is unspecified (::) */ -#define CHECK_UNSPECIFIED_ADDRESS(ip_addr) \ - (!((ip_addr)[0] || (ip_addr)[1] || (ip_addr)[2] || (ip_addr)[3])) - - -/* Set IPv6 address to unspecified (::) */ -#define SET_UNSPECIFIED_ADDRESS(ip_addr) \ - do { \ - (ip_addr)[0] = 0; \ - (ip_addr)[1] = 0; \ - (ip_addr)[2] = 0; \ - (ip_addr)[3] = 0; \ - } while (0) - - -/* Copy IPv6 address. */ -#define COPY_IPV6_ADDRESS(copy_from, copy_to) \ - do { \ - (copy_to)[0] = (copy_from)[0]; \ - (copy_to)[1] = (copy_from)[1]; \ - (copy_to)[2] = (copy_from)[2]; \ - (copy_to)[3] = (copy_from)[3]; \ - } while (0) - -/* Copy NXD IP address structure */ -#define COPY_NXD_ADDRESS(copy_from, copy_to) \ - do { \ - (copy_to) -> nxd_ip_version = (copy_from) -> nxd_ip_version; \ - (copy_to) -> nxd_ip_address.v6[0] = (copy_from) -> nxd_ip_address.v6[0]; \ - (copy_to) -> nxd_ip_address.v6[1] = (copy_from) -> nxd_ip_address.v6[1]; \ - (copy_to) -> nxd_ip_address.v6[2] = (copy_from) -> nxd_ip_address.v6[2]; \ - (copy_to) -> nxd_ip_address.v6[3] = (copy_from) -> nxd_ip_address.v6[3]; \ - } while (0) - - -#define SET_SOLICITED_NODE_MULTICAST_ADDRESS(address, unicast) \ - do { \ - (address)[0] = 0xFF020000; \ - (address)[1] = 0; \ - (address)[2] = 1; \ - (address)[3] = 0xFF000000 | (unicast)[3]; \ - } while (0) - - -#define CHECK_ALL_ROUTER_MCAST_ADDRESS(addr) \ - (((addr)[0] == 0xFF020000) && \ - ((addr)[1] == 0) && \ - ((addr)[2] == 0) && \ - ((addr)[3] == 2)) - -/* Check whether or not two IPv6 addresses are the same. */ -#define CHECK_IPV6_ADDRESSES_SAME(addr1, addr2) \ - (((addr1)[0] == (addr2)[0]) && \ - ((addr1)[1] == (addr2)[1]) && \ - ((addr1)[2] == (addr2)[2]) && \ - ((addr1)[3] == (addr2)[3])) - - -#endif /* NX_IPV6_UTIL_INLINE */ - -/* Utility functions. */ -UINT _nx_utility_string_length_check(CHAR *input_string, UINT *string_length, UINT max_string_length); -UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number); -UINT _nx_utility_uint_to_string(UINT number, UINT base, CHAR *string_buffer, UINT string_buffer_size); -UINT _nx_utility_base64_encode(UCHAR *name, UINT name_size, UCHAR *base64name, UINT base64name_size, UINT *bytes_copied); -UINT _nx_utility_base64_decode(UCHAR *base64name, UINT base64name_size, UCHAR *name, UINT name_size, UINT *bytes_copied); - -/* Determine if a C++ compiler is being used. If so, complete the standard - C conditional started above. */ -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip.h deleted file mode 100644 index bedc1a77..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip.h +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ip.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IP_H -#define NX_IP_H - - -/* Define IP constants. */ - -#define NX_IP_ID ((ULONG)0x49502020) - - - -/* Define the mask for the IP header length field. */ - -#define NX_IP_LENGTH_MASK ((ULONG)0x0F000000) /* Mask for length bit */ - - - -/* Define IP event flags. These events are processed by the IP thread. */ - -#define NX_IP_ALL_EVENTS ((ULONG)0xFFFFFFFF) /* All event flags */ -#define NX_IP_PERIODIC_EVENT ((ULONG)0x00000001) /* Periodic event */ -#define NX_IP_UNFRAG_EVENT ((ULONG)0x00000002) /* Unfragment event */ -#define NX_IP_ICMP_EVENT ((ULONG)0x00000004) /* ICMP message event */ -#define NX_IP_RECEIVE_EVENT ((ULONG)0x00000008) /* IP receive packet event */ -#define NX_IP_ARP_REC_EVENT ((ULONG)0x00000010) /* ARP deferred receive event */ -#define NX_IP_RARP_REC_EVENT ((ULONG)0x00000020) /* RARP deferred receive event */ -#define NX_IP_IGMP_EVENT ((ULONG)0x00000040) /* IGMP message event */ -#define NX_IP_TCP_EVENT ((ULONG)0x00000080) /* TCP message event */ -#define NX_IP_FAST_EVENT ((ULONG)0x00000100) /* Fast TCP timer event */ -#ifdef NX_DRIVER_DEFERRED_PROCESSING -#define NX_IP_DRIVER_PACKET_EVENT ((ULONG)0x00000200) /* Driver Deferred packet event */ -#endif /* NX_DRIVER_DEFERRED_PROCESSING */ -#define NX_IP_IGMP_ENABLE_EVENT ((ULONG)0x00000400) /* IGMP enable event */ -#define NX_IP_DRIVER_DEFERRED_EVENT ((ULONG)0x00000800) /* Driver deferred processing */ - /* event */ -#define NX_IP_TCP_CLEANUP_DEFERRED ((ULONG)0x00001000) /* Deferred TCP cleanup event */ -#ifdef NX_IPSEC_ENABLE -#define NX_IP_HW_DONE_EVENT ((ULONG)0x00002000) /* HW done event */ -#endif /* NX_IPSEC_ENABLE */ -#define NX_IP_LINK_STATUS_EVENT ((ULONG)0x00004000) /* Link status change event */ - - -#ifndef NX_IP_FAST_TIMER_RATE -#define NX_IP_FAST_TIMER_RATE 10 -#endif - -/* Define the amount of time to sleep in nx_ip_(interface_)status_check */ -#ifndef NX_IP_STATUS_CHECK_WAIT_TIME -#define NX_IP_STATUS_CHECK_WAIT_TIME 1 -#endif /* NX_IP_STATUS_CHECK_WAIT_TIME */ - -#include "nx_ipv4.h" - - - -#if 0 /* Not support for STM32L4XX. */ -/* Define IP function prototypes. */ -UINT _nx_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); -USHORT _nx_ip_checksum_compute(NX_PACKET *packet_ptr, ULONG protocol, UINT data_length, - ULONG *_src_ip_addr, ULONG *_dest_ip_addr); -UINT _nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT _nx_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT _nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT _nx_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, ULONG *ip_address, - ULONG *network_mask, ULONG *mtu_size, ULONG *phsyical_address_msw, - ULONG *physical_address_lsw); -UINT _nx_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT _nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *physical_msw, ULONG *physical_lsw); -UINT _nx_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG physical_msw, ULONG physical_lsw, UINT update_driver); -UINT _nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, ULONG *actual_status, - ULONG wait_option); -#endif - -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority); -UINT _nx_ip_delete(NX_IP *ip_ptr); - -#if 0 /* Not support for STM32L4XX. */ -VOID _nx_ip_delete_queue_clear(NX_PACKET *head_ptr); -VOID _nx_ip_deferred_link_status_process(NX_IP *ip_ptr); -VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index); -VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)); -VOID _nx_ip_driver_deferred_processing(NX_IP *ip_ptr); -VOID _nx_ip_driver_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT _nx_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); - - -UINT _nx_ip_forwarding_disable(NX_IP *ip_ptr); -UINT _nx_ip_forwarding_enable(NX_IP *ip_ptr); -UINT _nx_ip_fragment_disable(NX_IP *ip_ptr); -UINT _nx_ip_fragment_enable(NX_IP *ip_ptr); -UINT _nx_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT _nx_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT _nx_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT _nx_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT _nx_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT _nx_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT _nx_ip_raw_packet_filter_set(NX_IP *ip_ptr, UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT _nx_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); -UINT _nx_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxd_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, UINT address_index, ULONG protocol, UINT ttl, ULONG tos); -#endif - -VOID _nx_ip_initialize(VOID); - -#if 0 /* Not support for STM32L4XX. */ -VOID _nx_ip_periodic_timer_entry(ULONG ip_address); -VOID _nx_ip_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ip_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option); -UINT _nx_ip_link_status_change_notify_set(NX_IP *ip_ptr, VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up)); -VOID _nx_ip_thread_entry(ULONG ip_ptr_value); -VOID _nx_ip_raw_packet_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_ip_raw_packet_processing(NX_IP *ip_ptr, ULONG protocol, NX_PACKET *packet_ptr); -UINT _nxd_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - NXD_ADDRESS *destination_ip, ULONG protocol, UINT ttl, ULONG tos); -#ifndef NX_DISABLE_FRAGMENTATION -VOID _nx_ip_fragment_timeout_check(NX_IP *ip_ptr); -VOID _nx_ip_fragment_packet(struct NX_IP_DRIVER_STRUCT *driver_req_ptr); -VOID _nx_ip_fragment_assembly(NX_IP *ip_ptr); -#endif /* NX_DISABLE_FRAGMENTATION */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY -VOID _nx_ip_packet_checksum_compute(NX_PACKET *packet_ptr); -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ -#endif - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, - VOID (*ip_link_driver)(NX_IP_DRIVER *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size); -UINT _nxe_ip_delete(NX_IP *ip_ptr); - -#if 0 /* Not support for STM32L4XX. */ -UINT _nxe_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr); -UINT _nxe_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr); -UINT _nxe_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool); - - -UINT _nxe_ip_forwarding_disable(NX_IP *ip_ptr); -UINT _nxe_ip_forwarding_enable(NX_IP *ip_ptr); -UINT _nxe_ip_fragment_disable(NX_IP *ip_ptr); -UINT _nxe_ip_fragment_enable(NX_IP *ip_ptr); -UINT _nxe_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent, - ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received, - ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped, - ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped, - ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received); -UINT _nxe_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *)); -UINT _nxe_ip_interface_detach(NX_IP *ip_ptr, UINT index); -UINT _nxe_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index, - UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr, - ULONG *payload_length_ptr); -UINT _nxe_ip_raw_packet_disable(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_enable(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxde_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, UINT address_index, ULONG protocol, UINT ttl, ULONG tos); -UINT _nxe_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, - ULONG wait_option); - -UINT _nxe_ip_link_status_change_notify_set(NX_IP *ip_ptr, VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up)); -UINT _nxe_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed); -UINT _nxe_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag); -UINT _nxe_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag); -UINT _nxe_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, - ULONG *ip_address, ULONG *network_mask, ULONG *mtu_size, - ULONG *physical_address_msw, ULONG *physical_address_lsw); -UINT _nxe_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size); -UINT _nxe_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, - ULONG *physical_msw, ULONG *physical_lsw); -UINT _nxe_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, - ULONG physical_msw, ULONG physical_lsw, UINT update_driver); -UINT _nxe_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status, - ULONG *actual_status, ULONG wait_option); -UINT _nxe_ip_raw_packet_filter_set(NX_IP *ip_ptr, - UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *)); -UINT _nxe_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max); - - -VOID _nx_ip_fast_periodic_timer_create(NX_IP *ip_ptr); - -UINT _nx_ip_dispatch_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr, UINT protocol); -#endif - -/* IP component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_IP_INIT -#define IP_DECLARE -#else -#define IP_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the head pointer of the created IP list. */ - -IP_DECLARE NX_IP *_nx_ip_created_ptr; - - -/* Define the number of created IP instances. */ - -IP_DECLARE ULONG _nx_ip_created_count; - - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_create.c deleted file mode 100644 index 4692b477..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_create.c +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_system.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates an Internet Protocol instance, including */ -/* setting up all appropriate data structures and calling the supplied */ -/* link driver for initialization of the physical interface. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* name Name of this IP instance */ -/* ip_address Internet address for this IP */ -/* network_mask Network mask for IP address */ -/* default_pool Default packet pool */ -/* ip_link_driver User supplied IP link driver */ -/* memory_ptr Pointer memory area for IP */ -/* memory_size Size of IP memory area */ -/* priority Priority of IP helper thread */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_event_flags_create Create IP event flags */ -/* tx_event_flags_delete Delete IP event flags */ -/* tx_mutex_create Create IP protection mutex */ -/* tx_mutex_delete Delete IP protection mutex */ -/* tx_thread_create Create IP helper thread */ -/* tx_timer_create Create IP periodic timer */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *), - VOID *memory_ptr, ULONG memory_size, UINT priority) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *tail_ptr; -UINT i; -UINT old_threshold = 0; -TX_THREAD *current_thread; - -#ifdef NX_DISABLE_IPV4 - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(network_mask); -#endif /* NX_DISABLE_IPV4 */ - - /* Reference the version ID and option words to ensure they are linked in. */ - if (((ULONG)_nx_system_build_options_1 | (ULONG)_nx_system_build_options_2 | (ULONG)_nx_system_build_options_3 | - (ULONG)_nx_system_build_options_4 | (ULONG)_nx_system_build_options_5 | (ULONG)_nx_version_id[0]) == 0) - { - - /* We should never get here! */ - return(NX_NOT_IMPLEMENTED); - } - - /* Initialize the IP control block to zero. */ - memset((void *)ip_ptr, 0, sizeof(NX_IP)); - - /* Configure the primary interface. */ - ip_ptr -> nx_ip_interface[0].nx_interface_valid = 1; - -#ifndef NX_DISABLE_IPV4 - /* Save the IP address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_address = ip_address; - - /* Save the network mask. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_network_mask = network_mask; - - /* Derive the network bits of this IP address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_ip_network = ip_address & network_mask; - - /* Initialize the ARP defend timeout. */ - ip_ptr -> nx_ip_interface[0].nx_interface_arp_defend_timeout = 0; -#endif /* !NX_DISABLE_IPV4 */ - - /* Setup the link driver address. */ - ip_ptr -> nx_ip_interface[0].nx_interface_link_driver_entry = ip_link_driver; - - /* Set the device interface name to "PRI". */ - /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ip_ptr -> nx_ip_interface[0].nx_interface_name = (CHAR *)"PRI"; - - /* Set index of each interface. */ - for (i = 0; i < NX_MAX_IP_INTERFACES; i++) - { - ip_ptr -> nx_ip_interface[i].nx_interface_index = (UCHAR)i; - } - - -#ifndef NX_DISABLE_LOOPBACK_INTERFACE - - /* Set the Loopback interface name. */ - /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_name = (CHAR *)"Internal IP Loopback"; - - - /* Mark the loopback interface as valid. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_valid = 1; - -#ifndef NX_DISABLE_IPV4 - /* Set the loopback interface address. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_address = 0x7F000001; - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_network_mask = 0xFF000000; - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_network = 0x7F000000; -#endif /* !NX_DISABLE_IPV4 */ - - /* Loopback interface is a special case. Therefore no dedicated link driver needed. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_link_driver_entry = NX_NULL; - - /* Loopback interface does not need IP/MAC address mapping. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_address_mapping_needed = 0; - - /* There is actually no MTU limit for the loopback interface. */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_ip_mtu_size = 65535; - - /* Mark the loopback interface as LINK UP */ - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_link_up = 1; - - /* Set all the link capability. */ -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - ip_ptr -> nx_ip_interface[NX_LOOPBACK_INTERFACE].nx_interface_capability_flag = (NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM | - NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM | - NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM); -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#endif /* !NX_DISABLE_LOOPBACK_INTERFACE */ - - /* Save the supplied IP name. */ - ip_ptr -> nx_ip_name = name; - - /* Set the initial IP packet ID. */ - ip_ptr -> nx_ip_packet_id = NX_INIT_PACKET_ID; - - /* Setup the default packet pool for this IP instance. */ - ip_ptr -> nx_ip_default_packet_pool = default_pool; - -#ifdef NX_ENABLE_DUAL_PACKET_POOL - /* Setup the auxiliary packet pool for this IP instance. By default it pointers to default pool. */ - ip_ptr -> nx_ip_auxiliary_packet_pool = default_pool; -#endif /* NX_ENABLE_DUAL_PACKET_POOL */ - - /* Create the internal IP protection mutex. */ - tx_mutex_create(&(ip_ptr -> nx_ip_protection), name, TX_NO_INHERIT); - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, priority, &old_threshold); - } - - /* Otherwise, the IP initialization was successful. Place the - IP control block on the list of created IP instances. */ - TX_DISABLE - - /* Load the IP ID field in the IP control block. */ - ip_ptr -> nx_ip_id = NX_IP_ID; - - /* Place the new IP control block on the list of created IPs. First, - check for an empty list. */ - if (_nx_ip_created_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = _nx_ip_created_ptr -> nx_ip_created_previous; - - /* Place the new IP control block in the list. */ - _nx_ip_created_ptr -> nx_ip_created_previous = ip_ptr; - tail_ptr -> nx_ip_created_next = ip_ptr; - - /* Setup this IP's created links. */ - ip_ptr -> nx_ip_created_previous = tail_ptr; - ip_ptr -> nx_ip_created_next = _nx_ip_created_ptr; - } - else - { - - /* The created IP list is empty. Add IP control block to empty list. */ - _nx_ip_created_ptr = ip_ptr; - ip_ptr -> nx_ip_created_next = ip_ptr; - ip_ptr -> nx_ip_created_previous = ip_ptr; - } - - /* Increment the created IP counter. */ - _nx_ip_created_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized in previous tx_thread_preemption_change call. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Return success to the caller. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_delete.c deleted file mode 100644 index f2dcaa4e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_delete.c +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes an Internet Protocol instance, including */ -/* calling the associated driver with a link disable request. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_delete_queue_clear Clear a packet queue */ -/* _nx_ip_raw_packet_cleanup Cleanup raw packet suspension */ -/* _nx_icmp_cleanup Cleanup for ICMP packets */ -/* _nx_ip_fragment_disable Disable fragment processing */ -/* tx_mutex_delete Delete IP protection mutex */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* tx_thread_terminate Terminate IP helper thread */ -/* tx_event_flags_delete Delete IP event flags */ -/* tx_thread_delete Delete IP helper thread */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* tx_timer_deactivate Deactivate IP-ARP timer */ -/* tx_timer_delete Delete IP-ARP timer */ -/* (ip_link_driver) User supplied link driver */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_ip_delete(NX_IP *ip_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_IP_DELETE, ip_ptr, 0, 0, 0, NX_TRACE_IP_EVENTS, 0, 0); - - /* Get mutex protection. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the IP instance has any sockets bound to it. */ - if ((ip_ptr -> nx_ip_udp_created_sockets_count) || (ip_ptr -> nx_ip_tcp_created_sockets_count)) - { - - /* Still sockets bound to this IP instance. They must all be deleted prior - to deleting the IP instance. Release the mutex and return - an error code. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - return(NX_SOCKETS_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Remove the IP instance from the created list. */ - - /* See if the IP instance is the only one on the list. */ - if (ip_ptr == ip_ptr -> nx_ip_created_next) - { - - /* Only created IP instance, just set the created list to NULL. */ - _nx_ip_created_ptr = TX_NULL; - } - else - { - - /* Otherwise, not the only created IP, link-up the neighbors. */ - (ip_ptr -> nx_ip_created_next) -> nx_ip_created_previous = - ip_ptr -> nx_ip_created_previous; - (ip_ptr -> nx_ip_created_previous) -> nx_ip_created_next = - ip_ptr -> nx_ip_created_next; - - /* See if we have to update the created list head pointer. */ - if (_nx_ip_created_ptr == ip_ptr) - { - - /* Yes, move the head pointer to the next link. */ - _nx_ip_created_ptr = ip_ptr -> nx_ip_created_next; - } - } - - /* Decrement the IP created counter. */ - _nx_ip_created_count--; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Release mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Delete the internal IP protection mutex. */ - tx_mutex_delete(&(ip_ptr -> nx_ip_protection)); - - /* Clear the IP ID to make it invalid. */ - ip_ptr -> nx_ip_id = 0; - - /* Disable interrupts. */ - TX_DISABLE - - /* Restore preemption. */ - _tx_thread_preempt_disable--; - - /* Restore interrupts. */ - TX_RESTORE - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return success to the caller. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_initialize.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_initialize.c deleted file mode 100644 index b8eb0caa..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ip_initialize.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX IP data in this file. */ - -#define NX_IP_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_ip_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the Internet Protocol component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_ip_initialize(VOID) -{ - - /* Initialize the created IP instance variables. */ - _nx_ip_created_ptr = NX_NULL; - _nx_ip_created_count = 0; -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv4.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv4.h deleted file mode 100644 index b1bf77da..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv4.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ipv4.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IPV4_H -#define NX_IPV4_H - - -#ifndef NX_DISABLE_IPV4 -#define NX_IP_VERSION 0x45000000UL /* Version 4, Length of 5 */ - -#define NX_IP_NORMAL_LENGTH 5 /* Normal IP header length */ -#define NX_IP_HEADER_LENGTH_ENCODE_6 6 /* IP header length 6. */ - -/* Define IP options. */ - -#define NX_IP_OPTION_COPY_FLAG 0x80000000UL /* All fragments must carry the option. */ -#define NX_IP_OPTION_CLASS 0x00000000UL /* Control. */ -#define NX_IP_OPTION_ROUTER_ALERT_NUMBER 0x14000000UL -#define NX_IP_OPTION_ROUTER_ALERT_LENGTH 0x00040000UL -#define NX_IP_OPTION_ROUTER_ALERT_VALUE 0x00000000UL - - -/* Define IP option type. */ -#define NX_IP_OPTION_END 0 -#define NX_IP_OPTION_NO_OPERATION 1 -#define NX_IP_OPTION_INTERNET_TIMESTAMP 68 - - -/* Define IP fragmenting information. */ - -#ifdef NX_DONT_FRAGMENT -#define NX_IP_DONT_FRAGMENT NX_DONT_FRAGMENT -#else -#define NX_IP_DONT_FRAGMENT 0x00004000UL /* Don't fragment bit */ -#endif /* NX_DONT_FRAGMENT */ -#ifdef NX_MORE_FRAGMENTS -#define NX_IP_MORE_FRAGMENT NX_MORE_FRAGMENTS -#else -#define NX_IP_MORE_FRAGMENT 0x00002000UL /* More fragments */ -#endif /* NX_DONT_FRAGMENT */ -#define NX_IP_FRAGMENT_MASK 0x00003FFFUL /* Mask for fragment bits */ -#ifdef NX_FRAG_OFFSET_MASK -#define NX_IP_OFFSET_MASK NX_FRAG_OFFSET_MASK -#else -#define NX_IP_OFFSET_MASK 0x00001FFFUL /* Mask for fragment offset */ -#endif /* NX_FRAG_OFFSET_MASK */ -#define NX_IP_ALIGN_FRAGS 8 /* Fragment alignment */ - -/* Define basic IP Header constant. */ - -/* Define Basic Internet packet header data type. This will be used to - build new IP packets and to examine incoming packets into NetX. */ - -typedef struct NX_IPV4_HEADER_STRUCT -{ - /* Define the first 32-bit word of the IP header. This word contains - the following information: - - bits 31-28 IP Version = 0x4 (IP Version4) - bits 27-24 IP Header Length of 32-bit words (5 if no options) - bits 23-16 IP Type of Service, where 0x00 -> Normal - 0x10 -> Minimize Delay - 0x08 -> Maximize Throughput - 0x04 -> Maximize Reliability - 0x02 -> Minimize Monetary Cost - bits 15-0 IP Datagram length in bytes - */ - ULONG nx_ip_header_word_0; - - /* Define the second word of the IP header. This word contains - the following information: - - bits 31-16 IP Packet Identification (just an incrementing number) - bits 15-0 IP Flags and Fragment Offset (used for IP fragmenting) - bit 15 Zero - bit 14 Don't Fragment - bit 13 More Fragments - bits 12-0 (Fragment offset)/8 - */ - ULONG nx_ip_header_word_1; - - /* Define the third word of the IP header. This word contains - the following information: - - bits 31-24 IP Time-To-Live (maximum number of routers - packet can traverse before being - thrown away. Default values are typically - 32 or 64) - bits 23-16 IP Protocol, where 0x01 -> ICMP Messages - 0x02 -> IGMP Messages - 0x06 -> TCP Messages - 0x11 -> UDP Messages - bits 15-0 IP Checksum - */ - ULONG nx_ip_header_word_2; - - /* Define the source IP address. */ - ULONG nx_ip_header_source_ip; - - /* Define the destination IP address. */ - ULONG nx_ip_header_destination_ip; -} NX_IPV4_HEADER; - -#if 0 /* Not support for STM32L4XX. */ -/* Define IPv4 internal function prototypes. */ -VOID _nx_ip_forward_packet_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ip_fragment_forward_packet(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG fragment, ULONG next_hop_address); -void _nx_ip_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG type_of_service, ULONG time_to_live, ULONG protocol, ULONG fragment, ULONG next_hop_address); -UINT _nx_ip_header_add(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG type_of_service, ULONG time_to_live, ULONG protocol, ULONG fragment); -VOID _nx_ip_driver_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, ULONG fragment, ULONG next_hop_address); -ULONG _nx_ip_route_find(NX_IP *ip_ptr, ULONG destination_address, NX_INTERFACE **nx_ip_interface, ULONG *next_hop_address); -VOID _nx_ipv4_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv4_option_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -#endif /* NX_DISABLE_IPV4 */ - -/* Define IPv4 function prototypes. */ - -UINT _nx_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT _nx_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT _nx_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT _nx_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT _nx_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT _nx_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT _nx_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT _nx_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT _nx_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nx_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG destination_ip, UINT address_index, ULONG type_of_service); -UINT _nx_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, - ULONG net_mask, ULONG next_hop); -UINT _nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT _nx_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT _nx_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info); -UINT _nxe_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask); -UINT _nxe_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask); -UINT _nxe_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask); -UINT _nxe_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask); -UINT _nxe_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address); -UINT _nxe_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address); -UINT _nxe_ip_gateway_address_clear(NX_IP *ip_ptr); -UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, ULONG type_of_service); -UINT _nxe_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - ULONG destination_ip, UINT address_index, ULONG type_of_service); -UINT _nxe_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, - ULONG net_mask, ULONG next_hop); -UINT _nxe_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask); -UINT _nxe_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -UINT _nxe_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index); -#endif - -#ifndef FEATURE_NX_IPV6 -#ifdef NX_IPSEC_ENABLE -#define AUTHENTICATION_HEADER 5 -#define ENCAP_SECURITY_HEADER 6 -#endif /* NX_IPSEC_ENABLE */ -#endif /* FEATURE_NX_IPV6 */ -#endif /* NX_IPV4_H */ - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv6.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv6.h deleted file mode 100644 index b01f5147..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_ipv6.h +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol version 6 (IPv6) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_ipv6.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Internet Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* This header file is for NetX Duo internal use only. Application */ -/* shall not include this file directly. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_IPV6_H -#define NX_IPV6_H - -#include "tx_api.h" -#ifdef FEATURE_NX_IPV6 - -/* Define basic IP Header constant. */ - -/* Define Basic Internet packet header data type. This will be used to - build new IP packets and to examine incoming packets into NetX. */ - -typedef struct NX_IPV6_HEADER_STRUCT -{ - /* - Define the first 32-bit word of the IP header. This word contains - the following information: - - bits 31-28 IP Version = 0x6 (IP Version6) - bits 27-20 Traffic Class - bits 19-00 Flow Lable - */ - ULONG nx_ip_header_word_0; - - /* - Define the second word of the IP header. This word contains - the following information: - - bits 31-16 Payload Length - bits 15-8 Next Header; - bits 7-0 Hop limit - */ - ULONG nx_ip_header_word_1; - - /* Sender IP address. */ - ULONG nx_ip_header_source_ip[4]; - - /* Define the destination IP address. */ - ULONG nx_ip_header_destination_ip[4]; -} NX_IPV6_HEADER; - - -/* Define the data structure of the IPv6 optional field used in - hop-by-hop option and destination option headers. */ -typedef struct NX_IPV6_HEADER_OPTION_STRUCT -{ - - /* A hint to the protocol that follows. */ - UCHAR nx_ipv6_header_option_next_header; - - /* Size of this option field.*/ - UCHAR nx_ipv6_header_option_ext_length; - - /* ICMPv6 Option header type. */ - /*lint -esym(768,NX_IPV6_HEADER_OPTION_STRUCT::nx_ipv6_header_option_type) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_option_type; - - /* ICMPv6 Option-specific area. */ - /*lint -esym(768,NX_IPV6_HEADER_OPTION_STRUCT::nx_ipv6_header_option_data) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_option_data; -} NX_IPV6_HEADER_OPTION; - - -/* Hop by hop header optoin. */ -typedef struct NX_IPV6_HOP_BY_HOP_OPTION_STRUCT -{ - /* Option type. */ - UCHAR nx_ipv6_hop_by_hop_option_type; - - /* Size of this option field.*/ - UCHAR nx_ipv6_hop_by_hop_length; - - /* Start point of the option data. */ - /*lint -esym(768,NX_IPV6_HOP_BY_HOP_OPTION_STRUCT::nx_ipv6_hop_by_hop_data) suppress member not referenced. It is not used as a host. */ - USHORT nx_ipv6_hop_by_hop_data; -} NX_IPV6_HOP_BY_HOP_OPTION; - - -/* Routing header option. */ -typedef struct NX_IPV6_HEADER_ROUTING_OPTION_STRUCT -{ - - /* A hint to the protocol that follows. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_next_header) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_next_header; - - /* Header length. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_hdr_ext_len) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_hdr_ext_len; - - /* Router type. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_routing_type) suppress member not referenced. It is not used as a host. */ - UCHAR nx_ipv6_header_routing_option_routing_type; - - /* Segments left. */ - UCHAR nx_ipv6_header_routing_option_segments_left; - - /* Data. */ - /*lint -esym(768,NX_IPV6_HEADER_ROUTING_OPTION_STRUCT::nx_ipv6_header_routing_option_data) suppress member not referenced. It is not used as a host. */ - ULONG *nx_ipv6_header_routing_option_data; -} NX_IPV6_HEADER_ROUTING_OPTION; - -/* Fragment header option. */ -typedef struct NX_IPV6_HEADER_FRAGMENT_OPTION_STRUCT -{ - /* A hint to the protocol that follows. */ - UCHAR nx_ipv6_header_fragment_option_next_header; - - /* Unused field. */ - UCHAR nx_ipv6_header_fragment_option_reserved; - - /* Fragment offset. Last 3 bits are used as flags. */ - USHORT nx_ipv6_header_fragment_option_offset_flag; - - /* ID field. */ - ULONG nx_ipv6_header_fragment_option_packet_id; -} NX_IPV6_HEADER_FRAGMENT_OPTION; - -/* Unicast address type. Note that site local address types have been - deprectated in RFC 4291 and are treated as global address types. */ -#define IPV6_ADDRESS_LINKLOCAL 0x00000001 -/* -#define IPV6_ADDRESS_SITELOCAL 0x00000002 - */ -#define IPV6_ADDRESS_GLOBAL 0x00000004 - -/* Multicast address type */ -#define IPV6_ALL_NODE_MCAST 0x00000010 -#define IPV6_ALL_ROUTER_MCAST 0x00000020 -#define IPV6_SOLICITED_NODE_MCAST 0x00000040 - -#define IPV6_ADDRESS_UNICAST 0x80000000 -#define IPV6_ADDRESS_MULTICAST 0x40000000 -#define IPV6_ADDRESS_UNSPECIFIED 0x20000000 -#define IPV6_ADDRESS_LOOPBACK 0x10000000 - - - -/* - The following symbols define the order of the IPv6 optional - headers. Each value represents a state during the parse of the - optional headers. An error occurs when the parser encounters - an optional header when it is not expecting the header, i.e. - the header is out of order. . - - - IPv6 defines the order of the optional headers: (RFC2460 section 4.1) - * IPv6 Header - * Hop-by-Hop Options header - * Destination Options header - * Routnig header - * Fragment header - * Authentication header - * Encapsulating Security Payload header - * Destination Options header - * Upper-layer header - */ -enum NX_IPV6_OPTION_STATE -{ - IPV6_BASE_HEADER, /* 0 */ - HOP_BY_HOP_HEADER, /* 1 */ - DESTINATION_HEADER_1, /* 2 */ - ROUTING_HEADER, /* 3 */ - FRAGMENT_HEADER, /* 4 */ -#ifdef NX_IPSEC_ENABLE - AUTHENTICATION_HEADER, /* 5 */ - ENCAP_SECURITY_HEADER, /* 6 */ -#endif /* NX_IPSEC_ENABLE */ - DESTINATION_HEADER_2 /* 7 */ -}; - - - -#if 0 /* Not support for STM32L4XX. */ -/* Define IPv6 internal functions. */ - -UINT _nxd_ipv6_default_router_add_internal(NX_IP *ip_ptr, ULONG *router_addr, ULONG router_lifetime, NX_INTERFACE *if_ptr, INT router_type, NX_IPV6_DEFAULT_ROUTER_ENTRY **_new_entry); -VOID _nxd_ipv6_default_router_table_init(NX_IP *ip_ptr); -UINT _nxd_ipv6_find_max_prefix_length(ULONG *addr1, ULONG *addr, UINT max_length); -VOID _nx_ipv6_fragment_process(struct NX_IP_DRIVER_STRUCT *driver_req_ptr, UINT mtu); -UINT _nx_ipv6_header_add(NX_IP *ip_ptr, NX_PACKET **packet_pptr, - ULONG protocol, ULONG payload_size, ULONG hop_limit, - ULONG *src_address, ULONG *dest_address, ULONG *fragment); -UINT _nx_ipv6_packet_copy(NX_PACKET *source_pkt_head, NX_PACKET *dest_pkt_head, UINT size); -UINT _nx_ipv6_multicast_join(NX_IP *, ULONG *, NX_INTERFACE *); -UINT _nx_ipv6_multicast_leave(NX_IP *, ULONG *, NX_INTERFACE *); -UINT _nx_ipv6_option_error(NX_IP *ip_ptr, NX_PACKET *packet_ptr, UCHAR option_type, UINT offset); -VOID _nx_ipv6_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_ipv6_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG protocol, ULONG payload_size, ULONG hop_limit, ULONG *src_address, ULONG *dest_address); -UINT _nx_ipv6_prefix_list_add_entry(NX_IP *ip_ptr, ULONG *prefix, ULONG prefix_length, ULONG valid_lifetime); -VOID _nx_ipv6_prefix_list_delete(NX_IP *ip_ptr, ULONG *prefix, INT prefix_length); -VOID _nx_ipv6_prefix_list_delete_entry(NX_IP *ip_ptr, NX_IPV6_PREFIX_ENTRY *entry); -UINT _nx_ipv6_process_hop_by_hop_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv6_process_routing_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -UINT _nx_ipv6_process_fragment_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr); - -UINT _nxd_ipv6_interface_find(NX_IP *ip_ptr, ULONG *dest_address, - NXD_IPV6_ADDRESS **ipv6_addr, NX_INTERFACE *if_ptr); -UINT _nxd_ipv6_router_lookup(NX_IP *ip_ptr, NX_INTERFACE *if_ptr, ULONG *router_address, void **nd_cache_entry); -VOID _nxd_ipv6_router_solicitation_check(NX_IP *ip_ptr); -UINT _nxd_ipv6_raw_packet_send_internal(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, ULONG protocol); -VOID _nxd_ipv6_prefix_router_timer_tick(NX_IP *ip_ptr); -NX_IPV6_DEFAULT_ROUTER_ENTRY* _nxd_ipv6_find_default_router_from_address(NX_IP *ip_ptr, ULONG *ip_addr); -INT _nxd_ipv6_search_onlink(NX_IP *ip_ptr, ULONG *dest_addr); - -#endif /* FEATURE_NX_IPV6 */ - - - -/* - If NX_IPV6_UTIL_INLINE is defined, the functions are compiled as inline functions. - Inline functions improve execution speed. However it also increases code size. - Applications concerning more about code size should have the symbol undefeind - when building NetX Duo library and the application. - */ -#ifndef NX_IPV6_UTIL_INLINE - -#ifdef NX_IPSEC_ENABLE -INT CHECK_IPV6_ADDRESS_RANGE(ULONG *ip_addr_start, ULONG *ip_addr_end, ULONG *ip_addr); -#endif /* NX_IPSEC_ENABLE */ -INT CHECK_IPV6_ADDRESSES_SAME(ULONG *ip_dest, ULONG *myip); -INT CHECK_UNSPECIFIED_ADDRESS(ULONG *ip_addr); -void SET_UNSPECIFIED_ADDRESS(ULONG *ip_addr); -void COPY_IPV6_ADDRESS(ULONG *copy_from, ULONG *copy_to); -void COPY_NXD_ADDRESS(NXD_ADDRESS *copy_from, NXD_ADDRESS *copy_to); -void SET_SOLICITED_NODE_MULTICAST_ADDRESS(ULONG *address, ULONG *unicast_address); -INT CHECK_ALL_ROUTER_MCAST_ADDRESS(ULONG *address); -VOID _nx_ipv6_address_change_endian(ULONG *address); - -#endif /* NX_IPV6_UTIL_INLINE */ -INT CHECK_IP_ADDRESSES_BY_PREFIX(ULONG *ip_addr1, ULONG *ip_addr2, ULONG prefix_len); -INT CHECK_IPV6_SOLICITED_NODE_MCAST_ADDRESS(ULONG *dest_ip, ULONG *myip); -ULONG IPv6_Address_Type(ULONG *ip_address); - -/* Define IPv6 API function prototype. */ -UINT _nxd_ipv6_enable(NX_IP *ip_ptr); -UINT _nxd_ipv6_disable(NX_IP *ip_ptr); -UINT _nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index); -UINT _nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index); -UINT _nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT _nxd_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT _nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index); -UINT _nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address); -UINT _nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length); -UINT _nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method); -UINT _nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT _nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); - -/* Define error checking shells for API services. These are only referenced by the application. */ -UINT _nxde_ipv6_enable(NX_IP *ip_ptr); -UINT _nxde_ipv6_disable(NX_IP *ip_ptr); -UINT _nxde_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxde_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index); -UINT _nxde_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index); -UINT _nxde_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index); -UINT _nxde_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index); -UINT _nxde_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address)); -UINT _nxde_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index); -UINT _nxde_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address); -UINT _nxde_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length); -UINT _nxde_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method); -UINT _nxde_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries); -UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, - NXD_ADDRESS *destination_ip, ULONG protocol, UINT ttl, ULONG tos); -UINT _nxde_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -UINT _nxde_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index); -#endif - -#endif /* NX_IPV6_H */ - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet.h deleted file mode 100644 index ffd4751e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_packet.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX packet memory management component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PAC_H -#define NX_PAC_H - - -#define NX_PACKET_POOL_ID ((ULONG)0x5041434B) - - -/* Define constants for packet free, allocated, enqueued, and driver transmit done. - These will be used in the nx_packet_tcp_queue_next field to indicate the state of - the packet. */ - -#define NX_PACKET_FREE ((ALIGN_TYPE)0xFFFFFFFF) /* Packet is available and in the pool */ -#define NX_PACKET_ALLOCATED ((ALIGN_TYPE)0xAAAAAAAA) /* Packet has been allocated */ -#define NX_PACKET_ENQUEUED ((ALIGN_TYPE)0xEEEEEEEE) /* Packet is the tail of TCP queue. */ - /* A value that is none of the above */ - /* also indicates the packet is in a */ - /* TCP queue */ - -/* Define the constant for driver done and receive packet is available. These will be - used in the nx_packet_queue_next field to indicate the state of a TCP packet. */ - -#define NX_DRIVER_TX_DONE ((ALIGN_TYPE)0xDDDDDDDD) /* Driver has sent the TCP packet */ -#define NX_PACKET_READY ((ALIGN_TYPE)0xBBBBBBBB) /* Packet is ready for retrieval */ - - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/* Define strings for packet debug information. */ -#define NX_PACKET_ARP_WAITING_QUEUE "ARP waiting queue" -#define NX_PACKET_ND_WAITING_QUEUE "ND waiting queue" -#define NX_PACKET_TCP_LISTEN_QUEUE "TCP listen queue" -#define NX_PACKET_TCP_RECEIVE_QUEUE "TCP receive queue" -#define NX_PACKET_UDP_RECEIVE_QUEUE "UDP receive queue" -#define NX_PACKET_IP_FRAGMENT_QUEUE "IP fragment queue" -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - - -/* Define packet pool management function prototypes. */ - -UINT _nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT _nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied); -UINT _nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT _nx_packet_data_adjust(NX_PACKET *packet_ptr, ULONG header_size); -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -UINT _nx_packet_debug_info_get(NX_PACKET_POOL *pool_ptr, UINT packet_index, NX_PACKET **packet_pptr, - ULONG *packet_status, CHAR **thread_info, CHAR **file_info, ULONG *line); -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ -UINT _nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size); -UINT _nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT _nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT _nx_packet_release(NX_PACKET *packet_ptr); -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr); -VOID _nx_packet_pool_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_packet_pool_initialize(VOID); -UINT _nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option); -UINT _nxe_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nxe_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option); -UINT _nxe_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied); -UINT _nxe_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied); -UINT _nxe_packet_length_get(NX_PACKET *packet_ptr, ULONG *length); -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size, - VOID *memory_ptr, ULONG memory_size, UINT pool_control_block_size); -UINT _nxe_packet_pool_delete(NX_PACKET_POOL *pool_ptr); -UINT _nxe_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases); -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr); -UINT _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark); - - -/* Packet pool management component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_PACKET_POOL_INIT -#define PACKET_POOL_DECLARE -#else -#define PACKET_POOL_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the head pointer of the created packet pool list. */ - -PACKET_POOL_DECLARE NX_PACKET_POOL *_nx_packet_pool_created_ptr; - - -/* Define the variable that holds the number of created packet pools. */ - -PACKET_POOL_DECLARE ULONG _nx_packet_pool_created_count; - - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_allocate.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_allocate.c deleted file mode 100644 index e8614f56..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_allocate.c +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_allocate PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function allocates a packet from the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to allocate packet from */ -/* packet_ptr Pointer to place allocated */ -/* packet pointer */ -/* packet_type Type of packet to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option) -{ -TX_INTERRUPT_SAVE_AREA - -UINT status; /* Return status */ -TX_THREAD *thread_ptr; /* Working thread pointer */ -NX_PACKET *work_ptr; /* Working packet pointer */ - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - /* Make sure the packet_type does not go beyond nx_packet_data_end. */ - if (pool_ptr -> nx_packet_pool_payload_size < packet_type) - { - return(NX_INVALID_PARAMETERS); - } - - /* Set the return pointer to NULL initially. */ - *packet_ptr = NX_NULL; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_ALLOCATE, pool_ptr, 0, packet_type, pool_ptr -> nx_packet_pool_available, NX_TRACE_PACKET_EVENTS, &trace_event, &trace_timestamp); - - /* Disable interrupts to get a packet from the pool. */ - TX_DISABLE - - /* Determine if there is an available packet. */ - if (pool_ptr -> nx_packet_pool_available) - { - - /* Yes, a packet is available. Decrement the available count. */ - pool_ptr -> nx_packet_pool_available--; - - /* Pickup the current packet pointer. */ - work_ptr = pool_ptr -> nx_packet_pool_available_list; - - /* Modify the available list to point at the next packet in the pool. */ - pool_ptr -> nx_packet_pool_available_list = work_ptr -> nx_packet_queue_next; - - /* Setup various fields for this packet. */ - work_ptr -> nx_packet_queue_next = NX_NULL; -#ifndef NX_DISABLE_PACKET_CHAIN - work_ptr -> nx_packet_next = NX_NULL; - work_ptr -> nx_packet_last = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - work_ptr -> nx_packet_length = 0; - work_ptr -> nx_packet_prepend_ptr = work_ptr -> nx_packet_data_start + packet_type; - work_ptr -> nx_packet_append_ptr = work_ptr -> nx_packet_prepend_ptr; - work_ptr -> nx_packet_address.nx_packet_interface_ptr = NX_NULL; -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - work_ptr -> nx_packet_interface_capability_flag = 0; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - /* Set the TCP queue to the value that indicates it has been allocated. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - work_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_ALLOCATED; - -#ifdef FEATURE_NX_IPV6 - - /* Clear the option state. */ - work_ptr -> nx_packet_option_state = 0; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - - /* Clear the ipsec state. */ - work_ptr -> nx_packet_ipsec_state = 0; - work_ptr -> nx_packet_ipsec_sa_ptr = NX_NULL; -#endif /* NX_IPSEC_ENABLE */ - -#ifndef NX_DISABLE_IPV4 - /* Initialize the IP version field */ - work_ptr -> nx_packet_ip_version = NX_IP_VERSION_V4; -#endif /* !NX_DISABLE_IPV4 */ - - /* Initialize the IP identification flag. */ - work_ptr -> nx_packet_identical_copy = NX_FALSE; - - /* Initialize the IP header length. */ - work_ptr -> nx_packet_ip_header_length = 0; - -#ifdef NX_ENABLE_THREAD - work_ptr -> nx_packet_type = 0; -#endif /* NX_ENABLE_THREAD */ - - /* Place the new packet pointer in the return destination. */ - *packet_ptr = work_ptr; - - /* Set status to success. */ - status = NX_SUCCESS; - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - } - else - { - -#ifndef NX_DISABLE_PACKET_INFO - /* Increment the packet pool empty request count. */ - pool_ptr -> nx_packet_pool_empty_requests++; -#endif - - /* Determine if the request specifies suspension. */ - if (wait_option) - { - - /* Prepare for suspension of this thread. */ - -#ifndef NX_DISABLE_PACKET_INFO - /* Increment the packet pool empty request suspension count. */ - pool_ptr -> nx_packet_pool_empty_suspensions++; -#endif - - /* Pickup thread pointer. */ - thread_ptr = _tx_thread_current_ptr; - - /* Setup cleanup routine pointer. */ - thread_ptr -> tx_thread_suspend_cleanup = _nx_packet_pool_cleanup; - - /* Setup cleanup information, i.e. this pool control - block. */ - thread_ptr -> tx_thread_suspend_control_block = (void *)pool_ptr; - - /* Save the return packet pointer address as well. */ - thread_ptr -> tx_thread_additional_suspend_info = (void *)packet_ptr; - - /* Save the packet type (or prepend offset) so this can be added - after a new packet becomes available. */ - thread_ptr -> tx_thread_suspend_info = packet_type; - - /* Setup suspension list. */ - if (pool_ptr -> nx_packet_pool_suspension_list) - { - - /* This list is not NULL, add current thread to the end. */ - thread_ptr -> tx_thread_suspended_next = - pool_ptr -> nx_packet_pool_suspension_list; - thread_ptr -> tx_thread_suspended_previous = - (pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous; - ((pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr; - (pool_ptr -> nx_packet_pool_suspension_list) -> tx_thread_suspended_previous = thread_ptr; - } - else - { - - /* No other threads are suspended. Setup the head pointer and - just setup this threads pointers to itself. */ - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr; - thread_ptr -> tx_thread_suspended_next = thread_ptr; - thread_ptr -> tx_thread_suspended_previous = thread_ptr; - } - - /* Increment the suspended thread count. */ - pool_ptr -> nx_packet_pool_suspended_count++; - - /* Set the state to suspended. */ - thread_ptr -> tx_thread_state = TX_TCP_IP; - - /* Set the suspending flag. */ - thread_ptr -> tx_thread_suspending = TX_TRUE; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Save the timeout value. */ - thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = wait_option; - - /* Restore interrupts. */ - TX_RESTORE - - /* Call actual thread suspension routine. */ - _tx_thread_system_suspend(thread_ptr); - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_ALLOCATE, 0, *packet_ptr, 0, 0); - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO - if (thread_ptr -> tx_thread_suspend_status == NX_SUCCESS) - { - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, *packet_ptr); - } -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - - /* Return the completion status. */ - return(thread_ptr -> tx_thread_suspend_status); - } - else - { - - /* Immediate return, return error completion. */ - status = NX_NO_PACKET; - } - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_ALLOCATE, 0, *packet_ptr, 0, 0); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_copy.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_copy.c deleted file mode 100644 index f753c91c..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_copy.c +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_copy PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies the specified packet into one or more packets */ -/* allocated from the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to source packet */ -/* new_packet_ptr Pointer for return packet */ -/* pool_ptr Pointer to packet pool to use */ -/* for new packet(s) */ -/* wait_option Timeout option on packet */ -/* allocate and data append */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_SUCCESS Successful completion status */ -/* NX_INVALID_PACKET If zero packet payload or data*/ -/* to copy */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_data_append Packet data append service */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -NX_PACKET *work_ptr; /* Working packet pointer */ -NX_PACKET *source_ptr; /* Source packet pointer */ -ULONG size; /* Packet data size */ -UINT status; /* Return status */ -UINT first_packet; /* First packet flag */ -UINT data_prepend_offset; /* Data prepend offset */ -UINT ip_header_offset; /* IP header offset */ - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* Default the return packet pointer to NULL. */ - *new_packet_ptr = NX_NULL; - - /* Default the first packet to TRUE. */ - first_packet = NX_TRUE; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_COPY, packet_ptr, 0, pool_ptr, wait_option, NX_TRACE_PACKET_EVENTS, &trace_event, &trace_timestamp); - - /* Determine if there is anything to copy. */ - if (packet_ptr -> nx_packet_length == 0) - { - - /* Empty source packet, return an error. */ - return(NX_INVALID_PACKET); - } - - /* Allocate a new packet from the default packet pool supplied. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - status = _nx_packet_allocate(pool_ptr, &work_ptr, 0, wait_option); - - /* Determine if the packet was not allocated. */ - if (status != NX_SUCCESS) - { - - /* Return the error code from the packet allocate routine. */ - return(status); - } - - /* Copy the packet interface information. */ - /*lint -e{644} suppress variable might not be initialized, since "work_ptr" was initialized by _nx_packet_allocate. */ - work_ptr -> nx_packet_address.nx_packet_interface_ptr = packet_ptr -> nx_packet_address.nx_packet_interface_ptr; - -#ifdef FEATURE_NX_IPV6 - - /* Copy the IP version information. */ - work_ptr -> nx_packet_ip_version = packet_ptr -> nx_packet_ip_version; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - - /* Copy the packet interface capability. */ - work_ptr -> nx_packet_interface_capability_flag = packet_ptr -> nx_packet_interface_capability_flag; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - -#ifdef NX_IPSEC_ENABLE - work_ptr -> nx_packet_ipsec_sa_ptr = packet_ptr -> nx_packet_ipsec_sa_ptr; -#endif /* NX_IPSEC_ENABLE */ - - /* Save the source packet pointer. */ - source_ptr = packet_ptr; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy the original packet's data. */ - do - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check if it is the first packet. */ - if (first_packet == NX_TRUE) - { - - /* Yes, it is, copied the data beginning at data starting position. */ - - /* Calculate this packet's data size. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - size = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_data_start); - - /* Copy the data from the source packet into the new packet using - the data append feature. */ - status = _nx_packet_data_append(work_ptr, packet_ptr -> nx_packet_data_start, size, pool_ptr, wait_option); - } - else - { - - /* Calculate this packet's data size. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - size = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); - - /* Copy the data from the source packet into the new packet using - the data append feature. */ - status = _nx_packet_data_append(work_ptr, packet_ptr -> nx_packet_prepend_ptr, size, pool_ptr, wait_option); - } - - /* Determine if there was an error in the data append. */ - if (status != NX_SUCCESS) - { - - /* An error is present, release the new packet. */ - _nx_packet_release(work_ptr); - - /* Return the error code from the packet data append service. */ - return(status); - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to the next packet in the packet chain. */ - packet_ptr = packet_ptr -> nx_packet_next; - - /* Set the first packet to FALSE. */ - first_packet = NX_FALSE; - } while (packet_ptr); -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Adjust the prepend pointer and data length. */ - /*lint --e{946} --e{947} --e{732} suppress pointer subtraction, since it is necessary. */ - data_prepend_offset = (UINT)(source_ptr -> nx_packet_prepend_ptr - source_ptr -> nx_packet_data_start); - work_ptr -> nx_packet_prepend_ptr = work_ptr -> nx_packet_data_start + data_prepend_offset; - work_ptr -> nx_packet_length = work_ptr -> nx_packet_length - data_prepend_offset; - - /* Set the ip_header information. */ - ip_header_offset = (UINT)(source_ptr -> nx_packet_ip_header - source_ptr -> nx_packet_data_start); - work_ptr -> nx_packet_ip_header = work_ptr -> nx_packet_data_start + ip_header_offset; - - /* Determine if the packet copy was successful. */ - if (source_ptr -> nx_packet_length != work_ptr -> nx_packet_length) - { - - /* An error is present, release the new packet. */ - _nx_packet_release(work_ptr); - - /* Return an error code. */ - return(NX_INVALID_PACKET); - } - else - { - - /* Everything is okay, return the new packet pointer. */ - *new_packet_ptr = work_ptr; - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_PACKET_COPY, 0, work_ptr, 0, 0); - - /* Return success status. */ - return(NX_SUCCESS); - } -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_adjust.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_adjust.c deleted file mode 100644 index 55d44968..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_adjust.c +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_adjust PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function adjusts the packet data to fill the specified header. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* header_size The size of header */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_data_append Packet data append service */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_ip_forward_packet_process Forward IP packet */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_adjust(NX_PACKET *packet_ptr, ULONG header_size) -{ - -ULONG available_size; -ULONG shift_size; -#ifndef NX_DISABLE_PACKET_CHAIN -UINT status; -ULONG append_size; -UCHAR *data_start; -NX_PACKET *work_ptr; -#endif /* !NX_DISABLE_PACKET_CHAIN */ - - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* The header must be filled in one packet. */ - if (((ALIGN_TYPE)packet_ptr -> nx_packet_data_end - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) < header_size) - { - return(NX_UNDERFLOW); - } - - /* 1. Check if there is enough space to add header. */ - if (((ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) >= header_size) - { - - /* Yes. Just return success. */ - return(NX_SUCCESS); - } - - /* Compute the total avilable size in this packet. */ - available_size = (ULONG)(((ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_data_start) + - ((ALIGN_TYPE)packet_ptr -> nx_packet_data_end - (ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr)); - - /* 2. Would the header fit into the available space? */ - if (available_size >= header_size) - { - - /* Yes, adjust the data. */ - - /* Calculate the shift data size. */ - shift_size = (ULONG)((ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr); - - /* Move the data, */ - memmove(packet_ptr -> nx_packet_data_start + header_size, packet_ptr -> nx_packet_prepend_ptr, shift_size); /* Use case of memmove is verified. */ - - /* Update the prepend and append pointer. */ - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + header_size; - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + shift_size; - } - else - { - -#ifndef NX_DISABLE_PACKET_CHAIN - - /* 3. Current packet does not have enough space to fill the header. - Allocate a new packet to fill the overflowing data and chain the packet. */ - - /* Odd value of header_size is not supported now. - * In _nx_ip_checksum_compute(), nx_packet_append_ptr must not be odd value. */ - if (header_size & 1) - { - return(NX_NOT_SUPPORTED); - } - - /* Calculate the append data size. */ - append_size = header_size - available_size; - - /* Set the append data pointer. */ - data_start = packet_ptr -> nx_packet_append_ptr - append_size; - - /* Allocate a packet. */ - status = _nx_packet_allocate(packet_ptr -> nx_packet_pool_owner, &work_ptr, 0, NX_NO_WAIT); - - /* Check status. */ - if (status) - { - return(status); - } - - /* Firstly, append the overflowing data to the new packet.. */ - memcpy(work_ptr -> nx_packet_prepend_ptr, data_start, append_size); /* Use case of memcpy is verified. */ - work_ptr -> nx_packet_append_ptr = (UCHAR *)((ALIGN_TYPE)work_ptr -> nx_packet_prepend_ptr + append_size); /* Use case of memcpy is verified. */ - - /* Secondly, calculate the shift data size. */ - shift_size = (ULONG)(((ALIGN_TYPE)packet_ptr -> nx_packet_append_ptr - (ALIGN_TYPE)packet_ptr -> nx_packet_prepend_ptr) - append_size); - - /* Move the data. */ - memmove(packet_ptr -> nx_packet_data_start + header_size, packet_ptr -> nx_packet_prepend_ptr, shift_size); /* Use case of memmove is verified. */ - - /* Update the prepend and append pointer. */ - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + header_size; - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr + shift_size; - - /* At this point, all the necessary packets have been allocated. - We need to link this new packet to the next of the supplied packet. */ - work_ptr -> nx_packet_next = packet_ptr -> nx_packet_next; - packet_ptr -> nx_packet_next = work_ptr; - - /* Update the last packet pointer. */ - if (packet_ptr -> nx_packet_last == NX_NULL) - { - packet_ptr -> nx_packet_last = work_ptr; - } -#else /* NX_DISABLE_PACKET_CHAIN */ - - /* Return error code. */ - return(NX_UNDERFLOW); -#endif /* !NX_DISABLE_PACKET_CHAIN */ - } - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_append.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_append.c deleted file mode 100644 index 4ac42f42..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_append.c +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_append PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies the specified data to the end of the specified */ -/* packet. Additional packets are allocated from the specified pool */ -/* if needed. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to packet to append to*/ -/* data_start Pointer to start of the data */ -/* data_size Number of bytes to append */ -/* pool_ptr Pool to allocate packet from */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Allocate data packet */ -/* _nx_packet_release Release data packet */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -#ifndef NX_DISABLE_PACKET_CHAIN -UINT status; /* Return status */ -NX_PACKET *new_list_ptr; /* Head of new list pointer */ -NX_PACKET *last_packet = NX_NULL; /* Last supplied packet */ -#endif /* NX_DISABLE_PACKET_CHAIN */ -ULONG available_bytes; /* Number of available bytes */ -ULONG copy_size; /* Size for each memory copy */ -UCHAR *source_ptr; /* Buffer source pointer */ -NX_PACKET *work_ptr; /* Working packet pointer */ - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_APPEND, packet_ptr, data_start, data_size, pool_ptr, NX_TRACE_PACKET_EVENTS, 0, 0); - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Calculate the number of bytes available at the end of the supplied packet. */ - if (packet_ptr -> nx_packet_last) - { - - /* More than one packet. Walk the packet chain starting at the last packet - to calculate the remaining bytes. */ - available_bytes = 0; - work_ptr = packet_ptr -> nx_packet_last; - do - { - - /* Calculate the available bytes in this packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - /*lint -e{737} suppress loss of sign, since nx_packet_data_end is assumed to be larger than nx_packet_append_ptr. */ - available_bytes = available_bytes + - (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - - /* Remember the last packet. */ - last_packet = work_ptr; - - /* Move to the next packet. There typically won't be another packet, but just in - case the logic is here for it! */ - work_ptr = work_ptr -> nx_packet_next; - } while (work_ptr); - } - else -#endif /* NX_DISABLE_PACKET_CHAIN */ - { - - /* Just calculate the number of bytes available in the first packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - available_bytes = (ULONG)(packet_ptr -> nx_packet_data_end - packet_ptr -> nx_packet_append_ptr); - } - - /* Determine if any new packets are required to satisfy this request. */ - if (available_bytes < data_size) - { - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Setup a temporary head pointer. */ - new_list_ptr = NX_NULL; - - /* Loop to pickup enough packets to complete the append request. */ - while (available_bytes < data_size) - { - - /* Allocate a new packet. */ - status = _nx_packet_allocate(pool_ptr, &work_ptr, 0, wait_option); - - /* Determine if an error is present. */ - if (status) - { - - /* Yes, an error is present. */ - - /* First release any packets that have been allocated so far. */ - if (new_list_ptr) - { - _nx_packet_release(new_list_ptr); - } - - /* Return the error status to the caller of this service. */ - return(status); - } - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, work_ptr); - - /* No error is present. Link the new packet to the temporary list being built. */ - if (new_list_ptr) - { - - /* Determine if there is already more than one packet on the list. */ - if (new_list_ptr -> nx_packet_last) - { - - /* Yes, link up the last packet to the new packet and update the - last pointer. */ - /*lint -e{644} suppress variable might not be initialized, since "work_ptr" was initialized in _nx_packet_allocate. */ - (new_list_ptr -> nx_packet_last) -> nx_packet_next = work_ptr; - new_list_ptr -> nx_packet_last = work_ptr; - } - else - { - - /* Second packet allocated. Just setup the last and next in the - head pointer. */ - new_list_ptr -> nx_packet_last = work_ptr; - new_list_ptr -> nx_packet_next = work_ptr; - } - } - else - { - - /* Just setup the temporary list head. */ - new_list_ptr = work_ptr; - } - - /* Adjust the number of available bytes according to how much space - is in the new packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - /*lint -e{737} suppress loss of sign, since nx_packet_data_end is assumed to be larger than nx_packet_append_ptr. */ - /*lint -e{613} suppress possible use of null pointer, since "work_ptr" was set in _nx_packet_allocate. */ - available_bytes = available_bytes + - (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - } - - /* At this point, all the necessary packets have been allocated and are present - on the temporary list. We need to link this new list to the end of the supplied - packet. */ - if (last_packet) - { - - /* Already more than one packet. Add the new packet list to the end. */ - last_packet -> nx_packet_next = new_list_ptr; - } - else - { - - /* Link the new packet list to the head packet. */ - packet_ptr -> nx_packet_next = new_list_ptr; - } - - /* Clear the last packet that was used to maintain the new list. */ - /*lint -e{613} suppress possible use of null pointer, since "new_list_ptr" was set in previous loop. */ - new_list_ptr -> nx_packet_last = NX_NULL; -#else - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_SIZE_ERROR); -#endif /* NX_DISABLE_PACKET_CHAIN */ - } - - /* Setup the new data length in the packet. */ - packet_ptr -> nx_packet_length = packet_ptr -> nx_packet_length + data_size; - - /* Now copy the supplied data buffer at the end of the packet. */ - source_ptr = (UCHAR *)data_start; -#ifndef NX_DISABLE_PACKET_CHAIN - if (packet_ptr -> nx_packet_last) - { - work_ptr = packet_ptr -> nx_packet_last; - } - else - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - work_ptr = packet_ptr; -#ifndef NX_DISABLE_PACKET_CHAIN - } - while (data_size) - { - - /* Determine the amount of memory to copy. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if (data_size < (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr)) - { - copy_size = data_size; - } - else - { - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - copy_size = (ULONG)(work_ptr -> nx_packet_data_end - work_ptr -> nx_packet_append_ptr); - } -#else - copy_size = data_size; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Copy the data into the current packet buffer. */ - memcpy(work_ptr -> nx_packet_append_ptr, source_ptr, copy_size); /* Use case of memcpy is verified. */ - - /* Adjust the remaining data size. */ - data_size = data_size - copy_size; - - /* Update this packets append pointer. */ - work_ptr -> nx_packet_append_ptr = work_ptr -> nx_packet_append_ptr + copy_size; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Any more data left to append? */ - if (data_size) - { - - /* Yes, there is more to move. Update the source pointer, move the work pointer - to the next packet in the chain and update the last packet pointer. */ - source_ptr = source_ptr + copy_size; - work_ptr = work_ptr -> nx_packet_next; - packet_ptr -> nx_packet_last = work_ptr; - } - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Return successful status. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_extract_offset.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_extract_offset.c deleted file mode 100644 index 26e0d54a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_extract_offset.c +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_extract_offset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies data from a NetX packet (or packet chain) into */ -/* the supplied user buffer. If an empty packet (no data) is */ -/* received, zero bytes are copied, and the function returns without */ -/* errors. */ -/* */ -/* Note that this function extracts data from a packet into user */ -/* supplied buffer. It does not modify packet internal state */ -/* information. The data being extracted is still available in the */ -/* original packet for consumption again. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* offset Offset from start of data */ -/* buffer_start Pointer to destination data area */ -/* buffer_length Size in bytes */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied) -{ - -ULONG remaining_bytes; -UCHAR *source_ptr; -UCHAR *destination_ptr; -ULONG offset_bytes; -#ifndef NX_DISABLE_PACKET_CHAIN -ULONG packet_fragment_length; -#endif /* NX_DISABLE_PACKET_CHAIN */ -ULONG bytes_to_copy; -NX_PACKET *working_packet_ptr; - - - working_packet_ptr = packet_ptr; - - /* Check for an invalid offset or packet length. */ - if (offset >= working_packet_ptr -> nx_packet_length) - { - - /* Note: A zero offset with a packet of zero length is ok. */ - if (offset == 0) - { - - *bytes_copied = 0; - return(NX_SUCCESS); - } - - /* Otherwise, this is an invalid offset or packet length. */ - return(NX_PACKET_OFFSET_ERROR); - } - - - /* Initialize the source pointer to NULL. */ - source_ptr = NX_NULL; - - /* Traverse packet chain to offset. */ - offset_bytes = offset; -#ifndef NX_DISABLE_PACKET_CHAIN - while (working_packet_ptr) - { - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - packet_fragment_length = (ULONG)((working_packet_ptr -> nx_packet_append_ptr - working_packet_ptr -> nx_packet_prepend_ptr)); - - /* Determine if we are at the offset location fragment in the packet chain */ - if (packet_fragment_length > offset_bytes) - { - - /* Setup loop to copy from this packet. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr + offset_bytes; - - /* Yes, get out of this loop. */ - break; - } - - - /* Decrement the remaining offset bytes*/ - offset_bytes = offset_bytes - packet_fragment_length; - - /* Move to next packet. */ - working_packet_ptr = working_packet_ptr -> nx_packet_next; - } -#else /* NX_DISABLE_PACKET_CHAIN */ - /* Setup loop to copy from this packet. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr + offset_bytes; - -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check for a valid source pointer. */ - if (source_ptr == NX_NULL) - { - return(NX_PACKET_OFFSET_ERROR); - } - - /* Setup the destination pointer. */ - destination_ptr = buffer_start; - bytes_to_copy = (packet_ptr -> nx_packet_length - offset); - - /* Pickup the amount of bytes to copy. */ - if (bytes_to_copy < buffer_length) - { - *bytes_copied = bytes_to_copy; /* the amount of bytes returned to the caller */ - remaining_bytes = bytes_to_copy; /* for use in the copy loop */ - } - else - { - *bytes_copied = buffer_length; - remaining_bytes = buffer_length; - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy bytes from packet(s). */ - while (working_packet_ptr && remaining_bytes) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Calculate bytes to copy. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - bytes_to_copy = (ULONG)(working_packet_ptr -> nx_packet_append_ptr - source_ptr); - if (remaining_bytes < bytes_to_copy) - { - bytes_to_copy = remaining_bytes; - } - - /* Copy data from this packet. */ - memcpy(destination_ptr, source_ptr, bytes_to_copy); /* Use case of memcpy is verified. */ - - /* Update the pointers. */ - destination_ptr += bytes_to_copy; - remaining_bytes -= bytes_to_copy; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to next packet. */ - working_packet_ptr = working_packet_ptr -> nx_packet_next; - - /* Check for a next packet. */ - if (working_packet_ptr) - { - - /* Setup new source pointer. */ - source_ptr = working_packet_ptr -> nx_packet_prepend_ptr; - } - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_EXTRACT_OFFSET, packet_ptr, buffer_length, *bytes_copied, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_retrieve.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_retrieve.c deleted file mode 100644 index 2647b0ba..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_data_retrieve.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_data_retrieve PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function copies data from a NetX packet (or packet chain) into */ -/* the supplied user buffer. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* buffer_start Pointer to destination area */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), and */ -/* verified memcpy use cases, */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied) -{ - -ULONG remaining_bytes; -UCHAR *destination_ptr; -ULONG bytes_to_copy; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_RETRIEVE, packet_ptr, buffer_start, bytes_copied, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Setup the destination pointer. */ - destination_ptr = buffer_start; - - /* Pickup the amount of bytes to copy. */ - *bytes_copied = packet_ptr -> nx_packet_length; - - /* Setup the remaining bytes. */ - remaining_bytes = packet_ptr -> nx_packet_length; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to copy bytes from packet(s). */ - while (packet_ptr) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Calculate the bytes to copy in this packet. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - bytes_to_copy = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); - - /* Copy data to destination. */ - /* Note: The buffer size must be not less than packet_ptr -> nx_packet_length. */ - memcpy(destination_ptr, packet_ptr -> nx_packet_prepend_ptr, bytes_to_copy); /* Use case of memcpy is verified. The buffer is provided by user. */ - - remaining_bytes -= bytes_to_copy; - destination_ptr += bytes_to_copy; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to next packet. */ - packet_ptr = packet_ptr -> nx_packet_next; - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Determine if the packet chain was valid. */ - if (remaining_bytes) - { - - /* Invalid packet chain. Calculate the actual number of bytes - copied. */ - *bytes_copied = *bytes_copied - remaining_bytes; - - /* Return an error. */ - return(NX_INVALID_PACKET); - } - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_debug_info_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_debug_info_get.c deleted file mode 100644 index 83d5b74e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_debug_info_get.c +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -#ifdef NX_ENABLE_PACKET_DEBUG_INFO -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_debug_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function returns status of packet for specified index */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to packet pool */ -/* packet_index Index of packet in pool */ -/* packet_pptr Pointer to packet for output */ -/* packet_status Status of packet for output */ -/* thread_info Thread of packet for output */ -/* file_info File of packet for output */ -/* line Line of packet for output */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_debug_info_get(NX_PACKET_POOL *pool_ptr, UINT packet_index, NX_PACKET **packet_pptr, - ULONG *packet_status, CHAR **thread_info, CHAR **file_info, ULONG *line) -{ -ULONG payload_size; /* Rounded payload size */ -ULONG header_size; /* Rounded header size */ -NX_PACKET *packet_ptr; - - /* Get the first packet. */ - packet_ptr = (NX_PACKET *)(pool_ptr -> nx_packet_pool_start); - - /* Calculate header size. */ - header_size = (ULONG)((ALIGN_TYPE)(packet_ptr -> nx_packet_data_start) - (ALIGN_TYPE)packet_ptr); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - payload_size = (ULONG)(((pool_ptr -> nx_packet_pool_payload_size + header_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Calculate packet pointer. */ - packet_ptr = (NX_PACKET *)(pool_ptr -> nx_packet_pool_start + packet_index * (header_size + payload_size)); - - /* Get packet pointer. */ - if (packet_pptr) - { - *packet_pptr = packet_ptr; - } - - /* Get packet status. */ - if (packet_status) - { - *packet_status = (ULONG)(ALIGN_TYPE)packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next; - } - - /* Get thread info. */ - if (thread_info) - { - *thread_info = packet_ptr -> nx_packet_debug_thread; - } - - /* Get file info. */ - if (file_info) - { - *file_info = packet_ptr -> nx_packet_debug_file; - } - - /* Get line. */ - if (line) - { - *line = packet_ptr -> nx_packet_debug_line; - } - - /* Return success. */ - return(NX_SUCCESS); -} -#endif /* NX_ENABLE_PACKET_DEBUG_INFO */ - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_length_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_length_get.c deleted file mode 100644 index d2037636..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_length_get.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_length_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function returns the length of the supplied packet. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet */ -/* length Destination for the length */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length) -{ - - /* Return the length of the packet. */ - *length = packet_ptr -> nx_packet_length; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_LENGTH_GET, packet_ptr, *length, 0, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_cleanup.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_cleanup.c deleted file mode 100644 index 9a24e630..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_cleanup.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_cleanup PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function processes packet allocate timeout and thread terminate*/ -/* actions that require the packet pool data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_packet_pool_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *pool_ptr; /* Working packet pool pointer */ - - NX_CLEANUP_EXTENSION - - /* Setup pointer to packet pool control block. */ - pool_ptr = (NX_PACKET_POOL *)thread_ptr -> tx_thread_suspend_control_block; - - /* Disable interrupts to remove the suspended thread from the packet pool. */ - TX_DISABLE - - /* Determine if the cleanup is still required. */ - if ((thread_ptr -> tx_thread_suspend_cleanup) && (pool_ptr) && - (pool_ptr -> nx_packet_pool_id == NX_PACKET_POOL_ID)) - { - - /* Yes, we still have thread suspension! */ - - /* Clear the suspension cleanup flag. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Remove the suspended thread from the list. */ - - /* See if this is the only suspended thread on the list. */ - if (thread_ptr == thread_ptr -> tx_thread_suspended_next) - { - - /* Yes, the only suspended thread. */ - - /* Update the head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = TX_NULL; - } - else - { - - /* At least one more thread is on the same suspension list. */ - - /* Update the list head pointer if necessary. */ - if (pool_ptr -> nx_packet_pool_suspension_list == thread_ptr) - { - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr -> tx_thread_suspended_next; - } - - /* Update the links of the adjacent threads. */ - (thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous = - thread_ptr -> tx_thread_suspended_previous; - (thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr -> tx_thread_suspended_next; - } - - /* Decrement the suspension count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - - /* Now we need to determine if this cleanup is from a terminate, timeout, - or from a wait abort. */ - if (thread_ptr -> tx_thread_state == TX_TCP_IP) - { - - /* Thread still suspended on the packet pool. Setup return error status and - resume the thread. */ - - /* Setup return status. */ - thread_ptr -> tx_thread_suspend_status = NX_NO_PACKET; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Resume the thread! Check for preemption even though we are executing - from the system timer thread right now which normally executes at the - highest priority. */ - _tx_thread_system_resume(thread_ptr); - - /* Finished, just return. */ - return; - } - } - - /* Restore interrupts. */ - TX_RESTORE -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_create.c deleted file mode 100644 index c3280927..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_create.c +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a pool of fixed-size packets within the */ -/* specified memory area. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* name_ptr Packet Pool string pointer */ -/* payload_size Size of packet payload */ -/* pool_start Starting address of pool */ -/* pool_size Number of bytes in pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name_ptr, ULONG payload_size, - VOID *pool_start, ULONG pool_size) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *tail_ptr; /* Working packet pool pointer */ -ULONG packets; /* Number of packets in pool */ -ULONG original_payload_size; /* Original payload size */ -ULONG header_size; /* Rounded header size */ -CHAR *packet_ptr; /* Working packet pointer */ -CHAR *next_packet_ptr; /* Next packet pointer */ -CHAR *end_of_pool; /* End of pool area */ -CHAR *payload_address; /* Address of the first payload*/ -VOID *rounded_pool_start; /* Rounded stating address */ - - - /* Save the original payload size. */ - original_payload_size = payload_size; - - /* Align the starting address to four bytes. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_start = (VOID *)((((ALIGN_TYPE)pool_start + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Round the pool size down to something that is evenly divisible by alignment. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - pool_size = (ULONG)(((pool_size - ((ALIGN_TYPE)rounded_pool_start - (ALIGN_TYPE)pool_start)) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Set the pool starting address. */ - pool_start = rounded_pool_start; - - /* Calculate the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((ALIGN_TYPE)rounded_pool_start + sizeof(NX_PACKET)); - - /* Align the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((((ALIGN_TYPE)payload_address + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the header size. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - header_size = (ULONG)((ALIGN_TYPE)payload_address - (ALIGN_TYPE)rounded_pool_start); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - payload_size = (ULONG)(((header_size + payload_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Clear pool fields. */ - memset(pool_ptr, 0, sizeof(NX_PACKET_POOL)); - - /* Setup the basic packet pool fields. */ - pool_ptr -> nx_packet_pool_name = name_ptr; - pool_ptr -> nx_packet_pool_suspension_list = TX_NULL; - pool_ptr -> nx_packet_pool_suspended_count = 0; - pool_ptr -> nx_packet_pool_start = (CHAR *)pool_start; - pool_ptr -> nx_packet_pool_size = pool_size; - pool_ptr -> nx_packet_pool_payload_size = original_payload_size; - - /* Calculate the end of the pool's memory area. */ - end_of_pool = ((CHAR *)pool_start) + pool_size; - - /* Walk through the pool area, setting up the available packet list. */ - packets = 0; - packet_ptr = (CHAR *)rounded_pool_start; - next_packet_ptr = packet_ptr + (payload_size + header_size); - - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - while (next_packet_ptr <= end_of_pool) - { - - /* Yes, we have another packet. Increment the packet count. */ - packets++; - - /* Setup the link to the next packet. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_queue_next = (NX_PACKET *)next_packet_ptr; - - /* Remember that this packet pool is the owner. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_pool_owner = pool_ptr; - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Clear the next packet pointer. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_next = (NX_PACKET *)NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Mark the packet as free. */ - /*lint -e{929} -e{923} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_FREE; - - /* Setup the packet data pointers. */ - /*lint -e{929} -e{928} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_data_start = (UCHAR *)(packet_ptr + header_size); - - /*lint -e{929} -e{928} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_data_end = (UCHAR *)(packet_ptr + header_size + original_payload_size); - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, (NX_PACKET *)packet_ptr); - - /* Advance to the next packet. */ - packet_ptr = next_packet_ptr; - - /* Update the next packet pointer. */ - next_packet_ptr = packet_ptr + (payload_size + header_size); - } - - /* Backup to the last packet in the pool. */ - packet_ptr = packet_ptr - (payload_size + header_size); - - /* Set the last packet's forward pointer to NULL. */ - /*lint -e{929} -e{740} -e{826} suppress cast of pointer to pointer, since it is necessary */ - ((NX_PACKET *)packet_ptr) -> nx_packet_queue_next = NX_NULL; - - /* Save the remaining information in the pool control packet. */ - pool_ptr -> nx_packet_pool_available = packets; - pool_ptr -> nx_packet_pool_total = packets; - - /* Set the packet pool available list. */ - pool_ptr -> nx_packet_pool_available_list = (NX_PACKET *)pool_start; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_PACKET_POOL, pool_ptr, name_ptr, payload_size, packets); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_CREATE, pool_ptr, payload_size, pool_start, pool_size, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Disable interrupts to place the packet pool on the created list. */ - TX_DISABLE - - /* Setup the packet pool ID to make it valid. */ - pool_ptr -> nx_packet_pool_id = NX_PACKET_POOL_ID; - - /* Place the packet pool on the list of created packet pools. First, - check for an empty list. */ - if (_nx_packet_pool_created_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = _nx_packet_pool_created_ptr -> nx_packet_pool_created_previous; - - /* Place the new packet pool in the list. */ - _nx_packet_pool_created_ptr -> nx_packet_pool_created_previous = pool_ptr; - tail_ptr -> nx_packet_pool_created_next = pool_ptr; - - /* Setup this packet pool's created links. */ - pool_ptr -> nx_packet_pool_created_previous = tail_ptr; - pool_ptr -> nx_packet_pool_created_next = _nx_packet_pool_created_ptr; - } - else - { - - /* The created packet pool list is empty. Add packet pool to empty list. */ - _nx_packet_pool_created_ptr = pool_ptr; - pool_ptr -> nx_packet_pool_created_next = pool_ptr; - pool_ptr -> nx_packet_pool_created_previous = pool_ptr; - } - - /* Increment the number of packet pools created. */ - _nx_packet_pool_created_count++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return NX_SUCCESS. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_delete.c deleted file mode 100644 index b4897d3d..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_delete.c +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet pool control block */ -/* pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume threads suspended */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -TX_THREAD *thread_ptr; /* Working thread pointer */ - - - /* Disable interrupts to remove the packet pool from the created list. */ - TX_DISABLE - - /* Decrement the number of packet pools created. */ - _nx_packet_pool_created_count--; - - /* Clear the packet pool ID to make it invalid. */ - pool_ptr -> nx_packet_pool_id = 0; - - /* See if the packet pool only one on the list. */ - if (pool_ptr == pool_ptr -> nx_packet_pool_created_next) - { - - /* Only created packet pool, just set the created list to NULL. */ - _nx_packet_pool_created_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (pool_ptr -> nx_packet_pool_created_next) -> nx_packet_pool_created_previous = - pool_ptr -> nx_packet_pool_created_previous; - (pool_ptr -> nx_packet_pool_created_previous) -> nx_packet_pool_created_next = - pool_ptr -> nx_packet_pool_created_next; - - /* See if we have to update the created list head pointer. */ - if (_nx_packet_pool_created_ptr == pool_ptr) - { - - /* Yes, move the head pointer to the next link. */ - _nx_packet_pool_created_ptr = pool_ptr -> nx_packet_pool_created_next; - } - } - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Walk through the packet pool suspension list to resume any and all - threads suspended on this packet pool. */ - thread_ptr = pool_ptr -> nx_packet_pool_suspension_list; - while (pool_ptr -> nx_packet_pool_suspended_count) - { - /* Lockout interrupts. */ - TX_DISABLE - - /* Clear the cleanup pointer, this prevents the timeout from doing - anything. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Temporarily disable preemption again. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Set the return status in the thread to NX_POOL_DELETED. */ - thread_ptr -> tx_thread_suspend_status = NX_POOL_DELETED; - - /* Move the thread pointer ahead. */ - thread_ptr = thread_ptr -> tx_thread_suspended_next; - - /* Resume the thread. */ - _tx_thread_system_resume(thread_ptr -> tx_thread_suspended_previous); - - /* Decrease the suspended count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Release previous preempt disable. */ - _tx_thread_preempt_disable--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_DELETE, pool_ptr, 0, 0, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(pool_ptr); - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return NX_SUCCESS. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_info_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_info_get.c deleted file mode 100644 index 2b03e804..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_info_get.c +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function retrieves information about the specified packet */ -/* pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to get information from */ -/* total_packets Destination for total packets */ -/* free_packets Destination for free packets */ -/* empty_pool_requests Destination for empty requests*/ -/* empty_pool_suspensions Destination for empty */ -/* suspensions */ -/* invalid_packet_releases Destination for invalid packet*/ -/* release requests */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases) -{ -TX_INTERRUPT_SAVE_AREA - - - /* Disable interrupts to get packet pool information. */ - TX_DISABLE - - /* Determine if pool total packets is wanted. */ - if (total_packets) - { - - /* Return the number of total packets in this pool. */ - *total_packets = pool_ptr -> nx_packet_pool_total; - } - - /* Determine if pool free packets is wanted. */ - if (free_packets) - { - - /* Return the number of free packets in this pool. */ - *free_packets = pool_ptr -> nx_packet_pool_available; - } - - /* Determine if empty pool requests is wanted. */ - if (empty_pool_requests) - { - - /* Return the number of empty pool requests made in this pool. */ - *empty_pool_requests = pool_ptr -> nx_packet_pool_empty_requests; - } - - /* Determine if empty pool suspensions is wanted. */ - if (empty_pool_suspensions) - { - - /* Return the number of empty pool suspensions made in this pool. */ - *empty_pool_suspensions = pool_ptr -> nx_packet_pool_empty_suspensions; - } - - /* Determine if invalid packet releases is wanted. */ - if (invalid_packet_releases) - { - - /* Return the number of invalid packet releases made in this pool. */ - *invalid_packet_releases = pool_ptr -> nx_packet_pool_invalid_releases; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_POOL_INFO_GET, pool_ptr, pool_ptr -> nx_packet_pool_total, pool_ptr -> nx_packet_pool_available, pool_ptr -> nx_packet_pool_empty_requests, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_initialize.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_initialize.c deleted file mode 100644 index b7bda185..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_initialize.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX global Packet Pool Component data in this file. */ - -#define NX_PACKET_POOL_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the packet pool management component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_packet_pool_initialize(VOID) -{ - - /* Initialize the head pointer of the created packet pools list and the - number of packet pools created. */ - _nx_packet_pool_created_ptr = NX_NULL; - _nx_packet_pool_created_count = 0; -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_low_watermark_set.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_low_watermark_set.c deleted file mode 100644 index 7a69f64a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_pool_low_watermark_set.c +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_pool_low_watermark_set PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the low watermark for the specified packet pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to packet pool */ -/* low_watermark Low watermark of packet pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark) -{ -#ifdef NX_ENABLE_LOW_WATERMARK - -TX_INTERRUPT_SAVE_AREA - - /* Disable interrupts to get a packet from the pool. */ - TX_DISABLE - - /* Set low watermark to packet pool. */ - pool_ptr -> nx_packet_pool_low_watermark = low_watermark; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return completion status. */ - return(NX_SUCCESS); - -#else /* !NX_ENABLE_LOW_WATERMARK */ - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(low_watermark); - - return(NX_NOT_SUPPORTED); - -#endif /* NX_ENABLE_LOW_WATERMARK */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_release.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_release.c deleted file mode 100644 index fc1323d2..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_release.c +++ /dev/null @@ -1,256 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "tx_thread.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function releases the packet chain back to the appropriate */ -/* packet pools. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume suspended thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_release(NX_PACKET *packet_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_PACKET_POOL *pool_ptr; /* Pool pointer */ -TX_THREAD *thread_ptr; /* Working thread pointer */ -#ifndef NX_DISABLE_PACKET_CHAIN -NX_PACKET *next_packet; /* Working block pointer */ -#endif /* NX_DISABLE_PACKET_CHAIN */ - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_RELEASE, packet_ptr, packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next, (packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_available, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Loop to free all packets chained together, not assuming they are - from the same pool. */ - while (packet_ptr) - { -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Check to see if the packet is releasable. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED)) - { - -#ifndef NX_DISABLE_PACKET_INFO - /* Pickup the pool pointer. */ - pool_ptr = packet_ptr -> nx_packet_pool_owner; - - /* Check for a good pool pointer... error must be the packet! */ - if ((pool_ptr) && (pool_ptr -> nx_packet_pool_id == NX_PACKET_POOL_ID)) - { - - /* Increment the packet pool invalid release error count. */ - pool_ptr -> nx_packet_pool_invalid_releases++; - } -#endif - - /* Return an error indicating the packet could not be released. */ - return(NX_PTR_ERROR); - } - /* End of packet check. */ - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Pickup the next packet. */ - next_packet = packet_ptr -> nx_packet_next; -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Disable interrupts to put this packet back in the packet pool. */ - TX_DISABLE - - /* Pickup the pool pointer. */ - pool_ptr = packet_ptr -> nx_packet_pool_owner; - - /* Determine if there are any threads suspended on the block pool. */ - thread_ptr = pool_ptr -> nx_packet_pool_suspension_list; - if (thread_ptr) - { - - /* Remove the suspended thread from the list. */ - - /* See if this is the only suspended thread on the list. */ - if (thread_ptr == thread_ptr -> tx_thread_suspended_next) - { - - /* Yes, the only suspended thread. */ - - /* Update the head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = NX_NULL; - } - else - { - - /* At least one more thread is on the same expiration list. */ - - /* Update the list head pointer. */ - pool_ptr -> nx_packet_pool_suspension_list = thread_ptr -> tx_thread_suspended_next; - - /* Update the links of the adjacent threads. */ - (thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous = - thread_ptr -> tx_thread_suspended_previous; - (thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next = - thread_ptr -> tx_thread_suspended_next; - } - - /* Decrement the suspension count. */ - pool_ptr -> nx_packet_pool_suspended_count--; - - /* Prepare for resumption of the first thread. */ - - /* Clear cleanup routine to avoid timeout. */ - thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; - - /* Temporarily disable preemption. */ - _tx_thread_preempt_disable++; - - /* Restore interrupts. */ - TX_RESTORE - - /* Adjust this packet to look just like a new packet. */ - packet_ptr -> nx_packet_queue_next = NX_NULL; -#ifndef NX_DISABLE_PACKET_CHAIN - packet_ptr -> nx_packet_next = NX_NULL; - packet_ptr -> nx_packet_last = NX_NULL; -#endif /* NX_DISABLE_PACKET_CHAIN */ - packet_ptr -> nx_packet_length = 0; - packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_data_start + (thread_ptr -> tx_thread_suspend_info); - packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr; - packet_ptr -> nx_packet_address.nx_packet_interface_ptr = NX_NULL; -#ifdef NX_ENABLE_INTERFACE_CAPABILITY - packet_ptr -> nx_packet_interface_capability_flag = 0; -#endif /* NX_ENABLE_INTERFACE_CAPABILITY */ - /* Set the TCP queue to the value that indicates it has been allocated. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_ALLOCATED; - -#ifdef FEATURE_NX_IPV6 - - /* Clear the option state. */ - packet_ptr -> nx_packet_option_state = 0; -#endif /* FEATURE_NX_IPV6 */ - -#ifdef NX_IPSEC_ENABLE - - /* Clear the ipsec state. */ - packet_ptr -> nx_packet_ipsec_state = 0; -#endif /* NX_IPSEC_ENABLE */ - - /* Clear the IP version. */ - packet_ptr -> nx_packet_ip_version = 0; - - /* Clear the IP identification flag. */ - packet_ptr -> nx_packet_identical_copy = NX_FALSE; - - /* Initialize the IP header length. */ - packet_ptr -> nx_packet_ip_header_length = 0; - - /* Return this block pointer to the suspended thread waiting for - a block. */ - *((NX_PACKET **)thread_ptr -> tx_thread_additional_suspend_info) = packet_ptr; - - /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = NX_SUCCESS; - - /* Resume thread. */ - _tx_thread_system_resume(thread_ptr); - } - else - { - - /* No thread is suspended for a memory block. */ - - /* Mark the packet as free. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next = (NX_PACKET *)NX_PACKET_FREE; - - /* Put the packet back in the available list. */ - packet_ptr -> nx_packet_queue_next = pool_ptr -> nx_packet_pool_available_list; - - /* Adjust the head pointer. */ - pool_ptr -> nx_packet_pool_available_list = packet_ptr; - - /* Increment the count of available blocks. */ - pool_ptr -> nx_packet_pool_available++; - - /* Restore interrupts. */ - TX_RESTORE - } - -#ifndef NX_DISABLE_PACKET_CHAIN - /* Move to the next packet in the list. */ - packet_ptr = next_packet; - } -#endif /* NX_DISABLE_PACKET_CHAIN */ - - /* Return completion status. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_transmit_release.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_transmit_release.c deleted file mode 100644 index 1bb299eb..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_packet_transmit_release.c +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_packet_transmit_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function releases a transmitted packet chain back to the */ -/* appropriate packet pool. If the packet is a TCP packet, it is */ -/* simply marked as completed. The actual release is deferred to */ -/* the TCP component. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release packet back to pool */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -UINT status; - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_TRANSMIT_RELEASE, packet_ptr, packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next, (packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_available, 0, NX_TRACE_PACKET_EVENTS, 0, 0); - - /* Disable interrupts temporarily. */ - TX_DISABLE - - /* Add debug information. */ - NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr); - - /* Determine if the packet is a queued TCP data packet. Such packets cannot be released - immediately, since they may need to be resent. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED)) && - (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_FREE))) - { - - /* Yes, this is indeed a TCP packet. Just mark this with the NX_DRIVER_TX_DONE - value to let the TCP layer know it is no longer queued up. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - packet_ptr -> nx_packet_queue_next = (NX_PACKET *)NX_DRIVER_TX_DONE; - - /* Remove the IP header and adjust the length. */ - packet_ptr -> nx_packet_prepend_ptr += packet_ptr -> nx_packet_ip_header_length; - packet_ptr -> nx_packet_length -= packet_ptr -> nx_packet_ip_header_length; - - /* Reset the IP header length. */ - packet_ptr -> nx_packet_ip_header_length = 0; - - /* Restore interrupts. */ - TX_RESTORE - - /* Return success. */ - status = NX_SUCCESS; - } - else - { - - /* Restore interrupts. */ - TX_RESTORE - - /* Call the actual packet release function. */ - status = _nx_packet_release(packet_ptr); - } - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system.h deleted file mode 100644 index d997e426..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system.h +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** System Management (System) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_system.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX system management component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_SYS_H -#define NX_SYS_H - - - -/* Define system management function prototypes. */ - -VOID _nx_system_initialize(VOID); - - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -/* System management component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_SYSTEM_INIT -#define SYSTEM_DECLARE -#else -#define SYSTEM_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - - -/* Define the global NetX build options variables. These variables contain a bit - map representing how the NetX library was built. The following are the bit - field definitions: - - _nx_system_build_options_1: - - Bit(s) Meaning - - 31 NX_LITTLE_ENDIAN - 30 NX_DISABLE_ARP_AUTO_ENTRY - 29 NX_ENABLE_TCP_KEEPALIVE - 28 NX_TCP_IMMEDIATE_ACK - 27 NX_DRIVER_DEFERRED_PROCESSING - 26 NX_DISABLE_FRAGMENTATION - 25 NX_DISABLE_IP_RX_CHECKSUM - 24 NX_DISABLE_IP_TX_CHECKSUM - 23 NX_DISABLE_TCP_RX_CHECKSUM - 22 NX_DISABLE_TCP_TX_CHECKSUM - 21 NX_DISABLE_RESET_DISCONNECT - 20 NX_DISABLE_RX_SIZE_CHECKING - 19 NX_DISABLE_ARP_INFO - 18 NX_DISABLE_IP_INFO - 17 NX_DISABLE_ICMP_INFO - 16 NX_DISABLE_IGMP_INFO - 15 NX_DISABLE_PACKET_INFO - 14 NX_DISABLE_RARP_INFO - 13 NX_DISABLE_TCP_INFO - 12 NX_DISABLE_UDP_INFO - 3-0 NX_TCP_RETRY_SHIFT - - _nx_system_build_options_2: - - Bit(s) Meaning - - 31-16 NX_IP_PERIODIC_RATE - 15-8 NX_ARP_EXPIRATION_RATE - 7-0 NX_ARP_UPDATE_RATE - - _nx_system_build_options_3: - - Bit(s) Meaning - - 31-24 NX_TCP_ACK_TIMER_RATE - 23-16 NX_TCP_FAST_TIMER_RATE - 15-8 NX_TCP_TRANSMIT_TIMER_RATE - 7-0 NX_TCP_KEEPALIVE_RETRY - - _nx_system_build_options_4: - - Bit(s) Meaning - - 31-16 NX_TCP_KEEPALIVE_INITIAL - 15-8 NX_ARP_MAXIMUM_RETRIES - 7-4 NX_ARP_MAX_QUEUE_DEPTH - 3-0 NX_TCP_KEEPALIVE_RETRIES - - _nx_system_build_options_5: - - Bit(s) Meaning - - 31-24 NX_MAX_MULTICAST_GROUPS - 23-16 NX_MAX_LISTEN_REQUESTS - 15-8 NX_TCP_MAXIMUM_RETRIES - 7-0 NX_TCP_MAXIMUM_TX_QUEUE - - Note that values greater than the value that can be represented in the build options - bit field are represented as all ones in the bit field. For example, if NX_TCP_ACK_TIMER_RATE - is 256, the value in the bits 31-24 of _nx_system_build_options_3 is 0xFF, which is 255 - decimal. */ - -SYSTEM_DECLARE ULONG _nx_system_build_options_1; -SYSTEM_DECLARE ULONG _nx_system_build_options_2; -SYSTEM_DECLARE ULONG _nx_system_build_options_3; -SYSTEM_DECLARE ULONG _nx_system_build_options_4; -SYSTEM_DECLARE ULONG _nx_system_build_options_5; - - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system_initialize.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system_initialize.c deleted file mode 100644 index 8aeb125a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_system_initialize.c +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** System Management (System) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX system data in this file. */ - -#define NX_SYSTEM_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_system.h" -#include "nx_packet.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_tcp.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_system_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the various components and system data */ -/* structures. */ -/* */ -/* INPUT */ -/* */ -/* pool_start Packet pool starting address */ -/* pool_size Packet pool size in bytes */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_initialize Initialize Packet Pool */ -/* component */ -/* _nx_ip_initialize Initialize IP component */ -/* _nx_tcp_initialize Initialize TCP component */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_system_initialize(VOID) -{ - - /* Check whether or not system has been initialized? */ - if (_nx_system_build_options_1 | _nx_system_build_options_2 | - _nx_system_build_options_3 | _nx_system_build_options_4 | _nx_system_build_options_5) - { - - /* Yes it is. Just return. */ - return; - } - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_SYSTEM_INITIALIZE, 0, 0, 0, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Call the packet pool initialization component for NetX. */ - _nx_packet_pool_initialize(); - - /* Call the IP component initialization. */ - _nx_ip_initialize(); - - /* Call the TCP component initialization. */ - /*lint -e{522} suppress lack of side-effects. */ - _nx_tcp_initialize(); - - /* Setup the build options variables. */ - _nx_system_build_options_1 = 0 -#ifdef NX_LITTLE_ENDIAN - | (((ULONG)1) << 31) -#endif -#ifdef NX_DISABLE_ARP_AUTO_ENTRY - | (((ULONG)1) << 30) -#endif -#ifdef NX_ENABLE_TCP_KEEPALIVE - | (((ULONG)1) << 29) -#endif -#ifdef NX_TCP_IMMEDIATE_ACK - | (((ULONG)1) << 28) -#endif -#ifdef NX_DRIVER_DEFERRED_PROCESSING - | (((ULONG)1) << 27) -#endif -#ifdef NX_DISABLE_FRAGMENTATION - | (((ULONG)1) << 26) -#endif -#ifdef NX_DISABLE_IP_RX_CHECKSUM - | (((ULONG)1) << 25) -#endif -#ifdef NX_DISABLE_IP_TX_CHECKSUM - | (((ULONG)1) << 24) -#endif -#ifdef NX_DISABLE_TCP_RX_CHECKSUM - | (((ULONG)1) << 23) -#endif -#ifdef NX_DISABLE_TCP_TX_CHECKSUM - | (((ULONG)1) << 22) -#endif -#ifdef NX_DISABLE_RESET_DISCONNECT - | (((ULONG)1) << 21) -#endif -#ifdef NX_DISABLE_RX_SIZE_CHECKING - | (((ULONG)1) << 20) -#endif -#ifdef NX_DISABLE_ARP_INFO - | (((ULONG)1) << 19) -#endif -#ifdef NX_DISABLE_IP_INFO - | (((ULONG)1) << 18) -#endif -#ifdef NX_DISABLE_ICMP_INFO - | (((ULONG)1) << 17) -#endif -#ifdef NX_DISABLE_IGMP_INFO - | (((ULONG)1) << 16) -#endif -#ifdef NX_DISABLE_PACKET_INFO - | (((ULONG)1) << 15) -#endif -#ifdef NX_DISABLE_RARP_INFO - | (((ULONG)1) << 14) -#endif -#ifdef NX_DISABLE_TCP_INFO - | (((ULONG)1) << 13) -#endif -#ifdef NX_DISABLE_UDP_INFO - | (((ULONG)1) << 12) -#endif - ; - - - /* Add the retry shift value to the options. */ -#if (NX_TCP_RETRY_SHIFT > 0xF) - _nx_system_build_options_1 |= 0xF; -#else - _nx_system_build_options_1 |= NX_TCP_RETRY_SHIFT; -#endif - -#if (NX_IP_PERIODIC_RATE > 0xFFFFUL) - _nx_system_build_options_2 = ((ULONG)0xFFFF0000); -#else - _nx_system_build_options_2 = ((ULONG)NX_IP_PERIODIC_RATE) << 16; -#endif - -#if (NX_ARP_EXPIRATION_RATE > 0xFF) - _nx_system_build_options_2 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_2 |= ((ULONG)NX_ARP_EXPIRATION_RATE) << 8; -#endif -#if (NX_ARP_UPDATE_RATE > 0xFF) - _nx_system_build_options_2 |= ((ULONG)0xFF); -#else - _nx_system_build_options_2 |= ((ULONG)NX_ARP_UPDATE_RATE); -#endif - - /* Setup third option word. */ -#if (NX_TCP_ACK_TIMER_RATE > 0xFF) - _nx_system_build_options_3 = ((ULONG)0xFF000000); -#else - _nx_system_build_options_3 = ((ULONG)NX_TCP_ACK_TIMER_RATE) << 24; -#endif -#if (NX_TCP_FAST_TIMER_RATE > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF) << 16; -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_FAST_TIMER_RATE) << 16; -#endif -#if (NX_TCP_TRANSMIT_TIMER_RATE > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_TRANSMIT_TIMER_RATE) << 8; -#endif -#if (NX_TCP_KEEPALIVE_RETRY > 0xFF) - _nx_system_build_options_3 |= ((ULONG)0xFF); -#else - _nx_system_build_options_3 |= ((ULONG)NX_TCP_KEEPALIVE_RETRY); -#endif - - /* Setup the fourth option word. */ -#if (NX_TCP_KEEPALIVE_INITIAL > 0xFFFFUL) - _nx_system_build_options_4 = ((ULONG)0xFFFF0000); -#else - _nx_system_build_options_4 = ((ULONG)NX_TCP_KEEPALIVE_INITIAL) << 16; -#endif -#if (NX_ARP_MAXIMUM_RETRIES > 0xFF) - _nx_system_build_options_4 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_4 |= ((ULONG)NX_ARP_MAXIMUM_RETRIES) << 8; -#endif -#if (NX_ARP_MAX_QUEUE_DEPTH > 0xF) - _nx_system_build_options_4 |= ((ULONG)0xF) << 4; -#else - _nx_system_build_options_4 |= ((ULONG)NX_ARP_MAX_QUEUE_DEPTH) << 4; -#endif -#if (NX_TCP_KEEPALIVE_RETRIES > 0xF) - _nx_system_build_options_4 |= ((ULONG)0xF); -#else - _nx_system_build_options_4 |= ((ULONG)NX_TCP_KEEPALIVE_RETRIES); -#endif - - /* Setup the fifth option word. */ -#if (NX_MAX_MULTICAST_GROUPS > 0xFF) - _nx_system_build_options_5 = ((ULONG)0xFF000000); -#else - _nx_system_build_options_5 = ((ULONG)NX_MAX_MULTICAST_GROUPS) << 24; -#endif -#if (NX_MAX_LISTEN_REQUESTS > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF) << 16; -#else - _nx_system_build_options_5 |= ((ULONG)NX_MAX_LISTEN_REQUESTS) << 16; -#endif -#if (NX_TCP_MAXIMUM_RETRIES > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF) << 8; -#else - _nx_system_build_options_5 |= ((ULONG)NX_TCP_MAXIMUM_RETRIES) << 8; -#endif -#if (NX_TCP_MAXIMUM_TX_QUEUE > 0xFF) - _nx_system_build_options_5 |= ((ULONG)0xFF); -#else - _nx_system_build_options_5 |= ((ULONG)NX_TCP_MAXIMUM_TX_QUEUE); -#endif -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp.h deleted file mode 100644 index e3616a99..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp.h +++ /dev/null @@ -1,424 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_tcp.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX Transmission Control Protocol component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_TCP_H -#define NX_TCP_H - - -/* Define TCP constants. */ - -#define NX_TCP_ID ((ULONG)0x54435020) - - -/* Define the TCP header typical size. */ - -#define NX_TCP_HEADER_SIZE ((ULONG)0x50000000) /* Typical 5 word TCP header */ -#define NX_TCP_SYN_HEADER ((ULONG)0x70000000) /* SYN header with MSS option */ -#define NX_TCP_HEADER_SHIFT 28 /* Shift down to pickup length */ -#define NX_TCP_SYN_OPTION_SIZE 8 /* 8 bytes of TCP SYN option */ -#define NX_TCP_SYN_SIZE (NX_TCP_SYN_OPTION_SIZE + sizeof(NX_TCP_HEADER)) - - -/* Define the TCP header control fields. */ - -#define NX_TCP_CONTROL_MASK ((ULONG)0x00170000) /* ACK, RST, SYN, and FIN bits */ -#define NX_TCP_URG_BIT ((ULONG)0x00200000) /* Urgent data bit */ -#define NX_TCP_ACK_BIT ((ULONG)0x00100000) /* Acknowledgement bit */ -#define NX_TCP_PSH_BIT ((ULONG)0x00080000) /* Push bit */ -#define NX_TCP_RST_BIT ((ULONG)0x00040000) /* Reset bit */ -#define NX_TCP_SYN_BIT ((ULONG)0x00020000) /* Sequence bit */ -#define NX_TCP_FIN_BIT ((ULONG)0x00010000) /* Finish bit */ - - -/* Define the MSS option for the TCP header. */ - -#define NX_TCP_MSS_OPTION ((ULONG)0x02040000) /* Maximum Segment Size option */ -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_TCP_RWIN_OPTION ((ULONG)0x03030000) /* 24 bits, so NOP, 0x3, 0x3, scale value */ -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -#define NX_TCP_MSS_SIZE 1460 /* Maximum Segment Size */ -#define NX_TCP_OPTION_END ((ULONG)0x01010100) /* NOPs and end of TCP options */ -#define NX_TCP_EOL_KIND 0x00 /* EOL option kind */ -#define NX_TCP_NOP_KIND 0x01 /* NOP option kind */ -#define NX_TCP_MSS_KIND 0x02 /* MSS option kind */ -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -#define NX_TCP_RWIN_KIND 0x03 /* RWIN option kind */ -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - -/* Define constants for the optional TCP keepalive Timer. To enable this - feature, the TCP source must be compiled with NX_ENABLE_TCP_KEEPALIVE - defined. */ - -#ifndef NX_TCP_KEEPALIVE_INITIAL -#define NX_TCP_KEEPALIVE_INITIAL 7200 /* Number of seconds for initial */ -#endif /* keepalive expiration, the */ - /* default is 2 hours (120 min)*/ -#ifndef NX_TCP_KEEPALIVE_RETRY -#define NX_TCP_KEEPALIVE_RETRY 75 /* After initial expiration, */ -#endif /* retry every 75 seconds */ - -#ifndef NX_TCP_KEEPALIVE_RETRIES -#define NX_TCP_KEEPALIVE_RETRIES 10 /* Retry a maximum of 10 times */ -#endif - -#ifndef NX_TCP_MAXIMUM_TX_QUEUE -#define NX_TCP_MAXIMUM_TX_QUEUE 20 /* Maximum number of transmit */ -#endif /* packets queued */ - -#ifndef NX_TCP_MAXIMUM_RETRIES -#define NX_TCP_MAXIMUM_RETRIES 10 /* Maximum number of transmit */ -#endif /* retries allowed */ - -#ifndef NX_TCP_RETRY_SHIFT -#define NX_TCP_RETRY_SHIFT 0 /* Shift that is applied to */ -#endif /* last timeout for back off, */ - /* i.e. a value of zero means */ - /* constant timeouts, a value */ - /* of 1 causes each successive */ - /* be multiplied by two, etc. */ - -#ifndef NX_TCP_MAXIMUM_SEGMENT_LIFETIME -#define NX_TCP_MAXIMUM_SEGMENT_LIFETIME 120 /* Number of seconds for maximum */ -#endif /* segment lifetime, the */ - /* default is 2 minutes (120s) */ - - -/* Define the maximum receive queue depth for TCP socket. */ -#ifdef NX_ENABLE_LOW_WATERMARK -#ifndef NX_TCP_MAXIMUM_RX_QUEUE -#define NX_TCP_MAXIMUM_RX_QUEUE 20 -#endif /* NX_TCP_MAXIMUM_RX_QUEUE */ -#endif /* NX_ENABLE_LOW_WATERMARK */ - -/* Define the rate for the TCP fast periodic timer. This timer is used to process - delayed ACKs and packet re-transmission. Hence, it must have greater resolution - than the 200ms delayed ACK requirement. By default, the fast periodic timer is - setup on a 100ms periodic. The number supplied is used to divide the - NX_IP_PERIODIC_RATE value to actually derive the ticks. Dividing - by 10 yields a 100ms base periodic. */ - -#ifndef NX_TCP_FAST_TIMER_RATE -#define NX_TCP_FAST_TIMER_RATE 10 -#endif - - -/* Define the rate for the TCP delayed ACK timer, which by default is 200ms. The - number supplied is used to divide the NX_IP_PERIODIC_RATE value to - actually derive the ticks. Dividing by 5 yields a 200ms periodic. */ - -#ifndef NX_TCP_ACK_TIMER_RATE -#define NX_TCP_ACK_TIMER_RATE 5 -#endif - -/* Define the rate for the TCP retransmit timer, which by default is set to - one second. The number supplied is used to divide the NX_IP_PERIODIC_RATE - value to actually derive the ticks. Dividing by 1 yields a 1 second periodic. */ - -#ifndef NX_TCP_TRANSMIT_TIMER_RATE -#define NX_TCP_TRANSMIT_TIMER_RATE 1 -#endif - -/* Define the value of the TCP minimum acceptable MSS for the host to accept the connection, - which by default is 128. */ - -#ifndef NX_TCP_MSS_MINIMUM -#define NX_TCP_MSS_MINIMUM 128 -#endif - - -/* Define Basic TCP packet header data type. This will be used to - build new TCP packets and to examine incoming packets into NetX. */ - -typedef struct NX_TCP_HEADER_STRUCT -{ - - /* Define the first 32-bit word of the TCP header. This word contains - the following information: - - bits 31-16 TCP 16-bit source port number - bits 15-0 TCP 16-bit destination port number - */ - ULONG nx_tcp_header_word_0; - - /* Define the second word of the TCP header. This word contains - the following information: - - bits 31-0 TCP 32-bit sequence number - */ - ULONG nx_tcp_sequence_number; - - /* Define the third word of the TCP header. This word contains - the following information: - - bits 31-0 TCP 32-bit acknowledgment number - */ - ULONG nx_tcp_acknowledgment_number; - - /* Define the fourth 32-bit word of the TCP header. This word contains - the following information: - - bits 31-28 TCP 4-bit header length - bits 27-22 TCP 6-bit reserved field - bit 21 TCP Urgent bit (URG) - bit 20 TCP Acknowledgement bit (ACK) - bit 19 TCP Push bit (PSH) - bit 18 TCP Reset connection bit (RST) - bit 17 TCP Synchronize sequence numbers bit (SYN) - bit 16 TCP Sender has reached the end of its byte stream (FIN) - bits 15-0 TCP 16-bit window size - */ - ULONG nx_tcp_header_word_3; - - /* Define the fifth 32-bit word of the TCP header. This word contains - the following information: - - bits 31-16 TCP 16-bit TCP checksum - bits 15-0 TCP 16-bit TCP urgent pointer - */ - ULONG nx_tcp_header_word_4; -} NX_TCP_HEADER; - - -/* Define TCP component API function prototypes. */ - -UINT _nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); -UINT _nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); -UINT _nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); -UINT _nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_enable(NX_IP *ip_ptr); -UINT _nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT _nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT _nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT _nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT _nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT _nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT _nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_windows_update_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_send_internal(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); -UINT _nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT _nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT _nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); -UINT _nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); - -/* Define TCP component internal function prototypes. */ -VOID _nx_tcp_cleanup_deferred(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_client_bind_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_deferred_cleanup_check(NX_IP *ip_ptr); -VOID _nx_tcp_fast_periodic_processing(NX_IP *ip_ptr); -VOID _nx_tcp_socket_retransmit(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, UINT need_fast_retransmit); -VOID _nx_tcp_connect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_disconnect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -VOID _nx_tcp_initialize(VOID); -UINT _nx_tcp_mss_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *mss); -#ifdef NX_ENABLE_TCP_WINDOW_SCALING -UINT _nx_tcp_window_scaling_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *window_scale); -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ -VOID _nx_tcp_no_connection_reset(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_packet_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_packet_send_ack(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_fin(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_rst(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *header_ptr); -VOID _nx_tcp_packet_send_syn(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); -VOID _nx_tcp_packet_send_probe(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence, UCHAR data); -VOID _nx_tcp_packet_send_control(NX_TCP_SOCKET *socket_ptr, ULONG control_bits, ULONG tx_sequence, - ULONG ack_number, ULONG option_word_1, ULONG option_word_2, UCHAR *data); -VOID _nx_tcp_periodic_processing(NX_IP *ip_ptr); -VOID _nx_tcp_queue_process(NX_IP *ip_ptr); -VOID _nx_tcp_receive_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -VOID _nx_tcp_socket_connection_reset(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_packet_process(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); -UINT _nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); - -VOID _nx_tcp_socket_receive_queue_flush(NX_TCP_SOCKET *socket_ptr); -UINT _nx_tcp_socket_state_ack_check(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_closing(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -UINT _nx_tcp_socket_state_data_check(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_socket_state_data_trim_front(NX_PACKET *packet_ptr, ULONG amount); -VOID _nx_tcp_socket_state_data_trim(NX_PACKET *packet_ptr, ULONG amount); -VOID _nx_tcp_socket_state_established(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_fin_wait1(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_fin_wait2(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_state_last_ack(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_syn_sent(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr, NX_PACKET *packet_ptr); -VOID _nx_tcp_socket_state_syn_received(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); -VOID _nx_tcp_socket_state_transmit_check(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_thread_resume(TX_THREAD **suspension_list_head, UINT status); -VOID _nx_tcp_socket_thread_suspend(TX_THREAD **suspension_list_head, VOID (*suspend_cleanup)(TX_THREAD * NX_CLEANUP_PARAMETER), NX_TCP_SOCKET *socket_ptr, TX_MUTEX *mutex_ptr, ULONG wait_option); -VOID _nx_tcp_socket_transmit_queue_flush(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_socket_block_cleanup(NX_TCP_SOCKET *socket_ptr); -VOID _nx_tcp_transmit_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); - - -/* Define error checking shells for TCP API services. These are only referenced by the - application. */ - -UINT _nxde_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); -UINT _nxde_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); -UINT _nxe_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nxe_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); -UINT _nxe_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nxe_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_enable(NX_IP *ip_ptr); -UINT _nxe_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nxe_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, - ULONG *tcp_checksum_errors, ULONG *tcp_connections, - ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, - ULONG *tcp_retransmit_packets); -UINT _nxe_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nxe_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, - VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); -UINT _nxe_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); -UINT _nxe_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size); -UINT _nxe_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); -UINT _nxe_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, - ULONG *tcp_packets_received, ULONG *tcp_bytes_received, - ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, - ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, - ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, - ULONG *tcp_receive_window); -UINT _nxe_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); -UINT _nxe_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); -UINT _nxe_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); -UINT _nxe_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); -UINT _nxe_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option); -UINT _nxe_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); -UINT _nxe_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, - ULONG max_retries, ULONG timeout_shift); -UINT _nxe_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_socket_window_update_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); -UINT _nxe_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); -UINT _nxe_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); - - -/* TCP component data declarations follow. */ - -/* Determine if the initialization function of this component is including - this file. If so, make the data definitions really happen. Otherwise, - make them extern so other functions in the component can access them. */ - -/*lint -e767 suppress different definitions. */ -#ifdef NX_TCP_INIT -#define TCP_DECLARE -#else -#define TCP_DECLARE extern -#endif -/*lint +e767 enable checking for different definitions. */ - -/* Define global data for the TCP component. */ - -/* Define the actual number of ticks for the fast periodic timer. */ - -TCP_DECLARE ULONG _nx_tcp_fast_timer_rate; - -/* Define the actual number of ticks for the delayed ACK timer. */ - -TCP_DECLARE ULONG _nx_tcp_ack_timer_rate; - -/* Define the actual number of ticks for the retransmit timer. */ - -TCP_DECLARE ULONG _nx_tcp_transmit_timer_rate; - -/* Define the actual number of ticks for the 2MSL(Maximum Segment Lifetime) timer. */ - -TCP_DECLARE ULONG _nx_tcp_2MSL_timer_rate; - - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_bind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_bind.c deleted file mode 100644 index 088740dc..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_bind.c +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds the TCP socket structure to a specific TCP */ -/* port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* port 16-bit TCP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_free_port_find Find free TCP port */ -/* _nx_tcp_socket_thread_suspend Suspend thread */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ -TX_INTERRUPT_SAVE_AREA - -UINT index; -#ifdef NX_NAT_ENABLE -UINT bound; -#endif /* NX_NAT_ENABLE */ -NX_IP *ip_ptr; -NX_TCP_SOCKET *search_ptr; -NX_TCP_SOCKET *end_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_CLIENT_SOCKET_BIND, ip_ptr, socket_ptr, port, wait_option, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has already been bound to port or if a socket bind is - already pending from another thread. */ - if ((socket_ptr -> nx_tcp_socket_bound_next) || - (socket_ptr -> nx_tcp_socket_bind_in_progress)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an already bound error code. */ - return(NX_ALREADY_BOUND); - } - - /* Determine if the port needs to be allocated. */ - if (port == NX_ANY_PORT) - { - - /* Call the find routine to allocate a TCP port. */ - port = NX_SEARCH_PORT_START + (UINT)(NX_RAND() % ((NX_MAX_PORT + 1) - NX_SEARCH_PORT_START)); - if (_nx_tcp_free_port_find(ip_ptr, port, &port) != NX_SUCCESS) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* There was no free port, return an error code. */ - return(NX_NO_FREE_PORTS); - } - } -#ifdef NX_NAT_ENABLE - else - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_TCP, port); - - /* Check to see if the port has been used by NAT. */ - if (bound == NX_TRUE) - { - - /* Release the protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } - } - } -#endif - - /* Save the port number in the TCP socket structure. */ - socket_ptr -> nx_tcp_socket_port = port; - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Pickup the head of the TCP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_tcp_port_table[index]; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of TCP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_tcp_socket_port == port) - { - - /* Yes, the port has already been allocated. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_tcp_socket_bound_next; - } while (search_ptr != end_ptr); - } - - /* Now determine if the port is available. */ - if ((search_ptr == NX_NULL) || (search_ptr -> nx_tcp_socket_port != port)) - { - - /* Place this TCP socket structure on the list of bound ports. */ - - /* Disable interrupts. */ - TX_DISABLE - - /* Determine if the list is NULL. */ - if (search_ptr) - { - - /* There are already sockets on this list... just add this one - to the end. */ - socket_ptr -> nx_tcp_socket_bound_next = - ip_ptr -> nx_ip_tcp_port_table[index]; - socket_ptr -> nx_tcp_socket_bound_previous = - (ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous; - ((ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous) -> nx_tcp_socket_bound_next = - socket_ptr; - (ip_ptr -> nx_ip_tcp_port_table[index]) -> nx_tcp_socket_bound_previous = socket_ptr; - } - else - { - - /* Nothing is on the TCP port list. Add this TCP socket to an - empty list. */ - socket_ptr -> nx_tcp_socket_bound_next = socket_ptr; - socket_ptr -> nx_tcp_socket_bound_previous = socket_ptr; - ip_ptr -> nx_ip_tcp_port_table[index] = socket_ptr; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success to the caller. */ - return(NX_SUCCESS); - } - else - { - - /* Release the IP protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_connect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_connect.c deleted file mode 100644 index 048c6ba5..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_connect.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the connect request for the supplied socket. */ -/* If bound and not connected, this function will send the first SYN */ -/* message to the specified server to initiate the connection process. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_client_socket_connect Actual TCP client connect */ -/* call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - ULONG server_ip, - UINT server_port, - ULONG wait_option) -{ - -#ifndef NX_DISABLE_IPV4 -NXD_ADDRESS server_ip_addr; - - /* Construct an IP address structure, and fill in IPv4 address information. */ - server_ip_addr.nxd_ip_version = NX_IP_VERSION_V4; - server_ip_addr.nxd_ip_address.v4 = server_ip; - - /* Invoke the real connection call. */ - return(_nxd_tcp_client_socket_connect(socket_ptr, &server_ip_addr, server_port, wait_option)); -#else /* NX_DISABLE_IPV4 */ - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(server_ip); - NX_PARAMETER_NOT_USED(server_port); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_unbind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_unbind.c deleted file mode 100644 index d3d64b9e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_client_socket_unbind.c +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_client_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds the TCP client socket structure from the */ -/* previously bound TCP port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_bind_cleanup Remove and cleanup bind req */ -/* _nx_tcp_socket_thread_resume Resume thread suspended on */ -/* port */ -/* _nx_tcp_socket_block_cleanup Cleanup the socket block */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -UINT index; -UINT port; -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_CLIENT_SOCKET_UNBIND, ip_ptr, socket_ptr, 0, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Cleanup the transmission control block. */ - _nx_tcp_socket_block_cleanup(socket_ptr); - - /* Determine if the socket is still in the closed state. */ - if (socket_ptr -> nx_tcp_socket_state != NX_TCP_CLOSED) - { - - /* No, release the IP protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an error code. */ - return(NX_NOT_CLOSED); - } - - /* Determine if the socket is bound to port. */ - if (!socket_ptr -> nx_tcp_socket_bound_next) - { - - /* Determine if there is a special condition for the socket not being in - a bound condition... i.e. the socket is in a pending-to-be-bound condition - in a call from a different thread. */ - if (socket_ptr -> nx_tcp_socket_bind_in_progress) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); - } - else - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not bound error code. */ - return(NX_NOT_BOUND); - } - } - - /* Otherwise, the socket is bound. We need to remove this socket from the - port and check for any other TCP socket bind requests that are queued. */ - - /* Pickup the port number in the TCP socket structure. */ - port = socket_ptr -> nx_tcp_socket_port; - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Disable interrupts while we unlink the current socket. */ - TX_DISABLE - - /* Determine if this is the only socket bound on this port list. */ - if (socket_ptr -> nx_tcp_socket_bound_next == socket_ptr) - { - - /* Yes, this is the only socket on the port list. */ - - /* Clear the list head pointer and the next pointer in the socket. */ - ip_ptr -> nx_ip_tcp_port_table[index] = NX_NULL; - socket_ptr -> nx_tcp_socket_bound_next = NX_NULL; - } - else - { - - /* Relink the neighbors of this TCP socket. */ - - /* Update the links of the adjacent sockets. */ - (socket_ptr -> nx_tcp_socket_bound_next) -> nx_tcp_socket_bound_previous = - socket_ptr -> nx_tcp_socket_bound_previous; - (socket_ptr -> nx_tcp_socket_bound_previous) -> nx_tcp_socket_bound_next = - socket_ptr -> nx_tcp_socket_bound_next; - - /* Determine if the head of the port list points to the socket being removed. - If so, we need to move the head pointer. */ - if (ip_ptr -> nx_ip_tcp_port_table[index] == socket_ptr) - { - - /* Yes, we need to move the port list head pointer. */ - ip_ptr -> nx_ip_tcp_port_table[index] = socket_ptr -> nx_tcp_socket_bound_next; - } - - /* Clear the next pointer in the socket to indicate it is no longer bound. */ - socket_ptr -> nx_tcp_socket_bound_next = NX_NULL; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_enable.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_enable.c deleted file mode 100644 index df6f2c75..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_enable.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "nx_ip.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function enables the TCP management component for the */ -/* specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_timer_create Create fast TCP timer */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_enable(NX_IP *ip_ptr) -{ - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_free_port_find.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_free_port_find.c deleted file mode 100644 index 058c8c54..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_free_port_find.c +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_free_port_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds the first available TCP port, starting from the */ -/* supplied port. If no available ports are found, an error is */ -/* returned. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* port Starting port */ -/* free_port_ptr Pointer to return free port */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr) -{ - -UINT index; -UINT bound; -UINT starting_port; -NX_TCP_SOCKET *search_ptr; -NX_TCP_SOCKET *end_ptr; - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_FREE_PORT_FIND, ip_ptr, port, 0, 0, NX_TRACE_TCP_EVENTS, &trace_event, &trace_timestamp); - - /* Save the original port. */ - starting_port = port; - - /* Loop through the TCP ports until a free entry is found. */ - do - { - - /* Calculate the hash index in the TCP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_TCP_PORT_TABLE_MASK); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup the head of the TCP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_tcp_port_table[index]; - - /* Set the bound flag to false. */ - bound = NX_FALSE; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of TCP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_tcp_socket_port == port) - { - - /* Set the bound flag. */ - bound = NX_TRUE; - - /* Get out of the loop. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_tcp_socket_bound_next; - } while (search_ptr != end_ptr); - } - -#ifdef NX_NAT_ENABLE - if (bound == NX_FALSE) - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_TCP, port); - } - } -#endif - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Determine if the port is available. */ - if (!bound) - { - - /* Setup the return port number. */ - *free_port_ptr = port; - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_TCP_FREE_PORT_FIND, 0, 0, port, 0); - - /* Return success. */ - return(NX_SUCCESS); - } - - /* Move to the next port. */ - port++; - - /* Determine if we need to wrap. */ - if (port > NX_MAX_PORT) - { - - /* Yes, we need to wrap around. */ - port = NX_SEARCH_PORT_START; - } - } while (starting_port != port); - - /* A free port was not found, return an error. */ - return(NX_NO_FREE_PORTS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_initialize.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_initialize.c deleted file mode 100644 index d95c2c94..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_initialize.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Locate NetX global TCP Component data in this file. */ - -#define NX_TCP_INIT - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_initialize PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function initializes the TCP management component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_system_initialize System initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_tcp_initialize(VOID) -{ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_block_cleanup.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_block_cleanup.c deleted file mode 100644 index 47b9f46c..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_block_cleanup.c +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "nx_ipv6.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_block_cleanup PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function cleans up the transmission control block. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to owning socket */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _nx_tcp_fast_periodic_processing Process TCP packet for socket */ -/* _nx_tcp_socket_connection_reset Reset TCP connection */ -/* _nx_tcp_socket_disconnect Close TCP conenction */ -/* _nx_tcp_socket_state_last_ack Process data on LAST ACK state*/ -/* _nx_tcp_client_socket_unbind Ubind the TCP client socket */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -VOID _nx_tcp_socket_block_cleanup(NX_TCP_SOCKET *socket_ptr) -{ - - /* Clean up the connect IP address. */ - - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_version = 0; - socket_ptr -> nx_tcp_socket_connect_ip.nxd_ip_address.v4 = 0; - - /* Clean up the connect port. */ - socket_ptr -> nx_tcp_socket_connect_port = 0; - - /* Reset zero window probe flag. */ - socket_ptr -> nx_tcp_socket_zero_window_probe_has_data = NX_FALSE; - - /* Simply clear the timeout. */ - socket_ptr -> nx_tcp_socket_timeout = 0; - - /* Reset duplicated ack received. */ - socket_ptr -> nx_tcp_socket_duplicated_ack_received = 0; - - /* Reset fast recovery stage. */ - socket_ptr -> nx_tcp_socket_fast_recovery = NX_FALSE; - - /* Connection needs to be closed down immediately. */ - if (socket_ptr -> nx_tcp_socket_client_type) - { - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_CLOSED, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Client socket, return to a CLOSED state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - } - else - { - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_LISTEN_STATE, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Server socket, return to LISTEN state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_LISTEN_STATE; - } -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_create.c deleted file mode 100644 index f6cf855b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_create.c +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a TCP socket for the specified IP instance. */ -/* Both client and server sockets are created by this service. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new TCP socket */ -/* name Name of new TCP socket */ -/* type_of_service Type of service for this TCP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* window_size Size of socket's receive */ -/* window */ -/* tcp_urgent_data_callback Routine to call when urgent */ -/* data is received */ -/* tcp_disconnect_callback Routine to call when a */ -/* disconnect occurs */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - -NX_TCP_SOCKET *tail_ptr; - - - /* Initialize the TCP control block to zero. */ - memset((void *)socket_ptr, 0, sizeof(NX_TCP_SOCKET)); - - /* Fill in the basic information in the new TCP socket structure. */ - - /* Remember the associated IP structure. */ - socket_ptr -> nx_tcp_socket_ip_ptr = ip_ptr; - - /* By default, indicate the socket is a client socket. */ - socket_ptr -> nx_tcp_socket_client_type = NX_TRUE; - - /* Save the TCP socket's name. */ - socket_ptr -> nx_tcp_socket_name = name; - - /* Setup the counter for duplicated ACK packet. */ - socket_ptr -> nx_tcp_socket_duplicated_ack_received = 0; - - /* Setup this socket's maximum segment size (mss). */ - socket_ptr -> nx_tcp_socket_mss = 0; - - /* Setup the default receiver's maximum segment size. */ - socket_ptr -> nx_tcp_socket_connect_mss = NX_TCP_MSS_SIZE; - - /* Save the type of service input parameter. */ - socket_ptr -> nx_tcp_socket_type_of_service = type_of_service; - - /* Save the fragment input parameter. */ - socket_ptr -> nx_tcp_socket_fragment_enable = fragment & NX_DONT_FRAGMENT; - - /* Save the time-to-live input parameter. */ - socket_ptr -> nx_tcp_socket_time_to_live = time_to_live; - - /* Clear the socket bind in progress flag. */ - socket_ptr -> nx_tcp_socket_bind_in_progress = NX_FALSE; - - /* Setup the delayed ACK timeout periodic rate. */ - socket_ptr -> nx_tcp_socket_delayed_ack_timeout = _nx_tcp_ack_timer_rate; - - /* Setup the default transmit timeout. */ - socket_ptr -> nx_tcp_socket_timeout_rate = _nx_tcp_transmit_timer_rate; - socket_ptr -> nx_tcp_socket_timeout_max_retries = NX_TCP_MAXIMUM_RETRIES; - socket_ptr -> nx_tcp_socket_timeout_shift = NX_TCP_RETRY_SHIFT; - - /* Setup the default maximum transmit queue depth. */ - socket_ptr -> nx_tcp_socket_transmit_queue_maximum_default = NX_TCP_MAXIMUM_TX_QUEUE; - socket_ptr -> nx_tcp_socket_transmit_queue_maximum = NX_TCP_MAXIMUM_TX_QUEUE; - -#ifdef NX_ENABLE_LOW_WATERMARK - /* Setup the default maximum receive queue depth. */ - socket_ptr -> nx_tcp_socket_receive_queue_maximum = NX_TCP_MAXIMUM_RX_QUEUE; -#endif /* NX_ENABLE_LOW_WATERMARK */ - -#ifdef NX_ENABLE_TCP_WINDOW_SCALING - - /* Window scaling feature is enabled. Record this user-specified window size. */ - socket_ptr -> nx_tcp_socket_rx_window_maximum = window_size; -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Setup the sliding window information. */ - socket_ptr -> nx_tcp_socket_rx_window_default = window_size; - socket_ptr -> nx_tcp_socket_rx_window_current = window_size; - socket_ptr -> nx_tcp_socket_tx_outstanding_bytes = 0; - socket_ptr -> nx_tcp_socket_tx_window_advertised = 0; - socket_ptr -> nx_tcp_socket_tx_window_congestion = 0; - - - /* Initialize the ack_n_packet counter. */ - socket_ptr -> nx_tcp_socket_ack_n_packet_counter = 1; - - /* Save the application callback routines. */ - socket_ptr -> nx_tcp_urgent_data_callback = tcp_urgent_data_callback; - socket_ptr -> nx_tcp_disconnect_callback = tcp_disconnect_callback; - - /* Clear the receive notify function pointer. */ - socket_ptr -> nx_tcp_receive_callback = NX_NULL; - -#ifdef NX_ENABLE_TCP_KEEPALIVE - /* If the Keep alive feature is enabled in NetX, enable it - on all TCP sockets. */ - socket_ptr -> nx_tcp_socket_keepalive_enabled = NX_TRUE; - -#endif - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_TCP_STATE_CHANGE, ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, NX_TCP_CLOSED, NX_TRACE_INTERNAL_EVENTS, 0, 0); - - /* Setup the initial TCP socket state. */ - socket_ptr -> nx_tcp_socket_state = NX_TCP_CLOSED; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_TCP_SOCKET, socket_ptr, name, type_of_service, window_size); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_CREATE, ip_ptr, socket_ptr, type_of_service, window_size, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Get protection while we insert the TCP socket into the created list. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts while we link the new TCP socket to the IP structure. */ - TX_DISABLE - - /* Load the TCP ID field in the TCP control block. */ - socket_ptr -> nx_tcp_socket_id = NX_TCP_ID; - - /* Place the new TCP control block on the list of created TCP sockets for this IP. First, - check for an empty list. */ - if (ip_ptr -> nx_ip_tcp_created_sockets_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = (ip_ptr -> nx_ip_tcp_created_sockets_ptr) -> nx_tcp_socket_created_previous; - - /* Place the new TCP socket control block in the list. */ - (ip_ptr -> nx_ip_tcp_created_sockets_ptr) -> nx_tcp_socket_created_previous = socket_ptr; - tail_ptr -> nx_tcp_socket_created_next = socket_ptr; - - /* Setup this TCP socket's created links. */ - socket_ptr -> nx_tcp_socket_created_previous = tail_ptr; - socket_ptr -> nx_tcp_socket_created_next = ip_ptr -> nx_ip_tcp_created_sockets_ptr; - } - else - { - - /* The created TCP socket list is empty. Add TCP socket control block to empty list. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = socket_ptr; - socket_ptr -> nx_tcp_socket_created_previous = socket_ptr; - socket_ptr -> nx_tcp_socket_created_next = socket_ptr; - } - - /* Increment the created TCP socket counter. */ - ip_ptr -> nx_ip_tcp_created_sockets_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_delete.c deleted file mode 100644 index 9c6848eb..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_delete.c +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created socket and unbound */ -/* socket. If the socket is still bound, an error is returned. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_DELETE, ip_ptr, socket_ptr, socket_ptr -> nx_tcp_socket_state, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can process the socket delete request. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has been created. */ - if (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not created error code. */ - return(NX_NOT_CREATED); - } - - /* Determine if the socket is still bound to port. */ - if ((socket_ptr -> nx_tcp_socket_bound_next) || - (socket_ptr -> nx_tcp_socket_bind_in_progress) || - (socket_ptr -> nx_tcp_socket_state != NX_TCP_CLOSED)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a still bound error code. */ - return(NX_STILL_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Now, remove the TCP socket from the created socket list. */ - - /* Clear the socket ID to make it invalid. */ - socket_ptr -> nx_tcp_socket_id = 0; - - /* See if the socket is the only one on the list. */ - if (socket_ptr == socket_ptr -> nx_tcp_socket_created_next) - { - - /* Only created socket, just set the created list to NULL. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (socket_ptr -> nx_tcp_socket_created_next) -> nx_tcp_socket_created_previous = - socket_ptr -> nx_tcp_socket_created_previous; - (socket_ptr -> nx_tcp_socket_created_previous) -> nx_tcp_socket_created_next = - socket_ptr -> nx_tcp_socket_created_next; - - /* See if we have to update the created list head pointer. */ - if (ip_ptr -> nx_ip_tcp_created_sockets_ptr == socket_ptr) - { - - /* Yes, move the head pointer to the next link. */ - ip_ptr -> nx_ip_tcp_created_sockets_ptr = socket_ptr -> nx_tcp_socket_created_next; - } - } - - /* Decrease the created sockets count. */ - ip_ptr -> nx_ip_tcp_created_sockets_count--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(ip_ptr); - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_disconnect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_disconnect.c deleted file mode 100644 index 9fef34b8..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_disconnect.c +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the disconnect request for both active and */ -/* passive calls. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_connect_cleanup Clear connect suspension */ -/* _nx_tcp_disconnect_cleanup Clear disconnect suspension */ -/* _nx_tcp_packet_send_fin Send FIN message */ -/* _nx_tcp_packet_send_rst Send RST on no timeout */ -/* _nx_tcp_receive_cleanup Clear receive suspension */ -/* _nx_tcp_transmit_cleanup Clear transmit suspension */ -/* _nx_tcp_socket_thread_suspend Suspend calling thread */ -/* _nx_tcp_socket_transmit_queue_flush Release all transmit packets */ -/* _nx_tcp_socket_block_cleanup Cleanup the socket block */ -/* tx_mutex_get Get protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - - /* Call wifi disconnect. */ - return(nx_wifi_tcp_socket_disconnect(socket_ptr, wait_option)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_establish_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_establish_notify.c deleted file mode 100644 index ea412f99..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_establish_notify.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_establish_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the establish notify function pointer to the */ -/* function specified by the application, which is called when the */ -/* handshake connection with the remote TCP host is complete. If a */ -/* NULL pointer is supplied, the establish notify function is disabled.*/ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_establish_notify Routine to call when the */ -/* connection handshake is */ -/* complete socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - - return(NX_NOT_SUPPORTED); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive.c deleted file mode 100644 index 23efa9aa..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive.c +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function attempts to receive one or more TCP packets from the */ -/* specified socket. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_packet_send_ack Send ACK message */ -/* _nx_tcp_socket_thread_suspend Suspend calling thread */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - - /* Call wifi receive. */ - return(nx_wifi_tcp_socket_receive(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive_notify.c deleted file mode 100644 index 0bf3b4da..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_receive_notify.c +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the receive notify function pointer to the */ -/* function specified by the application, which is called whenever */ -/* one or more receive packets is available for the socket. If a */ -/* NULL pointer is supplied, the receive notify function is disabled. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_RECEIVE_NOTIFY, socket_ptr -> nx_tcp_socket_ip_ptr, socket_ptr, tcp_receive_notify, 0, NX_TRACE_TCP_EVENTS, 0, 0); - - /* Get mutex protection. */ - tx_mutex_get(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts. */ - TX_DISABLE - - /* Setup the receive notify function pointer. */ - socket_ptr -> nx_tcp_receive_callback = tcp_receive_notify; - - /* Restore interrupts. */ - TX_RESTORE - - /* Release protection. */ - tx_mutex_put(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_send.c deleted file mode 100644 index 7a033810..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_send.c +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" -#include "nx_tcp.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a TCP packet through the specified socket. */ -/* If payload size exceeds MSS, this service fragments the payload */ -/* to fit into MSS. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* NX_INVALID_PARAMETERS Unknown packet IP version */ -/* NX_INVALID_PACKET Source packet chain missing */ -/* packet data */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_send_internal Transmit TCP payload */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option) -{ - - /* Call wifi send. */ - return(nx_wifi_tcp_socket_send(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_state_wait.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_state_wait.c deleted file mode 100644 index 5a2b601b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_tcp_socket_state_wait.c +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_tcp_socket_state_wait PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function waits for the specified socket to reach the specified */ -/* TCP state. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* desired_state Desired TCP state */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_thread_sleep Sleep to wait for state change*/ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option) -{ - - - /* Loop to wait for the desired socket state. */ - for (;;) - { - - /* Determine if the socket pointer is still valid. */ - if (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) - { - - /* Not still valid, return an error. */ - return(NX_PTR_ERROR); - } - - /* Determine if the desired state is present. */ - if (socket_ptr -> nx_tcp_socket_state == desired_state) - { - - /* The desired state is present, return success! */ - return(NX_SUCCESS); - } - - /* Check to see if there is more time to wait. */ - if (wait_option) - { - - /* Yes, there is more time... sleep for a tick. */ - tx_thread_sleep(1); - - /* Decrease the wait time. */ - wait_option--; - } - else - { - - /* Timeout, just return an error. */ - return(NX_NOT_SUCCESSFUL); - } - } -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp.h deleted file mode 100644 index 3eff269a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp.h +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* nx_udp.h PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the NetX User Datagram Protocol (UDP) component, */ -/* including all data types and external references. It is assumed */ -/* that nx_api.h and nx_port.h have already been included. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_UDP_H -#define NX_UDP_H - - -/* Define UDP constants. */ - -#define NX_UDP_ID ((ULONG)0x55445020) - - -/* Define Basic UDP packet header data type. This will be used to - build new UDP packets and to examine incoming packets into NetX. */ - -typedef struct NX_UDP_HEADER_STRUCT -{ - - /* Define the first 32-bit word of the UDP header. This word contains - the following information: - - bits 31-16 UDP 16-bit source port number - bits 15-0 UDP 16-bit destination port number - */ - ULONG nx_udp_header_word_0; - - /* Define the second and final word of the UDP header. This word contains - the following information: - - bits 31-16 UDP 16-bit UDP length (including 8 header bytes) - bits 15-0 UDP 16-bit checksum (including header and pseudo IP header) - */ - ULONG nx_udp_header_word_1; -} NX_UDP_HEADER; - - -/* Define UDP component function prototypes. */ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port); - -VOID _nx_udp_bind_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_udp_enable(NX_IP *ip_ptr); -UINT _nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nx_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -VOID _nx_udp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); -VOID _nx_udp_receive_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); -UINT _nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nx_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nx_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum); -UINT _nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT _nxd_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port, UINT address_index); -UINT _nxde_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT port, UINT address_index); -UINT _nx_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG wait_option); -UINT _nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)); - -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port); -UINT _nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); -UINT _nx_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT _nx_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxd_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); - -/* Define error checking shells for API services. These are only referenced by the - application. */ - -UINT _nxe_udp_enable(NX_IP *ip_ptr); -UINT _nxe_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); -UINT _nxe_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, - ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped, - ULONG *udp_checksum_errors); -UINT _nxe_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option); -UINT _nxe_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available); -UINT _nxe_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr); -UINT _nxe_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr); -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum, UINT udp_socket_size); -UINT _nxe_udp_socket_delete(NX_UDP_SOCKET *socket_ptr); - -UINT _nxe_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port); -UINT _nxde_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port); -UINT _nxe_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent, - ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued, - ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors); -UINT _nxe_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr); -UINT _nxe_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG wait_option); -UINT _nxe_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)); -UINT _nx_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port, UINT address_index); -UINT _nxe_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, - ULONG ip_address, UINT port, UINT source_index); -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port); -UINT _nxe_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr); - - - -UINT _nxd_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxde_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, - UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxe_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index); -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, NXD_ADDRESS *ip_address, UINT port); - -/* UDP component data declarations follow. */ - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_enable.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_enable.c deleted file mode 100644 index efdbce4c..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_enable.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function enables the UDP management component for the */ -/* specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_enable(NX_IP *ip_ptr) -{ - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_free_port_find.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_free_port_find.c deleted file mode 100644 index cd3a6143..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_free_port_find.c +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_free_port_find PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function finds the first available UDP port, starting from the */ -/* supplied port. If no available ports are found, an error is */ -/* returned. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* port Starting port */ -/* free_port_ptr Pointer to return free port */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr) -{ - -UINT index; -UINT bound; -UINT starting_port; -NX_UDP_SOCKET *search_ptr; -NX_UDP_SOCKET *end_ptr; - -#ifdef TX_ENABLE_EVENT_TRACE -TX_TRACE_BUFFER_ENTRY *trace_event; -ULONG trace_timestamp; -#endif - - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_FREE_PORT_FIND, ip_ptr, port, 0, 0, NX_TRACE_UDP_EVENTS, &trace_event, &trace_timestamp); - - /* Save the original port. */ - starting_port = port; - - /* Loop through the UDP ports until a free entry is found. */ - do - { - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup the head of the UDP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_udp_port_table[index]; - - /* Set the bound flag to false. */ - bound = NX_FALSE; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of UDP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_udp_socket_port == port) - { - - /* Set the bound flag. */ - bound = NX_TRUE; - - /* Get out of the loop. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_udp_socket_bound_next; - } while (search_ptr != end_ptr); - } - -#ifdef NX_NAT_ENABLE - if (bound == NX_FALSE) - { - - /* Check if this IP interface has a NAT service. */ - if (ip_ptr -> nx_ip_nat_port_verify) - { - - /* Yes, so check the port by NAT handler. If NAT does not use this port, allow NetX to use it. */ - bound = (ip_ptr -> nx_ip_nat_port_verify)(ip_ptr, NX_PROTOCOL_UDP, port); - } - } -#endif - - /* Release protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Determine if the port is available. */ - if (!bound) - { - - /* Setup the return port number. */ - *free_port_ptr = port; - - /* Update the trace event with the status. */ - NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_UDP_FREE_PORT_FIND, 0, 0, port, 0); - - /* Return success. */ - return(NX_SUCCESS); - } - - /* Move to the next port. */ - port++; - - /* Determine if we need to wrap. */ - if (port > NX_MAX_PORT) - { - - /* Yes, we need to wrap around. */ - port = NX_SEARCH_PORT_START; - } - } while (starting_port != port); - - /* A free port was not found, return an error. */ - return(NX_NO_FREE_PORTS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_bind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_bind.c deleted file mode 100644 index c97e1f58..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_bind.c +++ /dev/null @@ -1,215 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function binds the UDP socket a specific UDP port. If the */ -/* requested port number is currently bound to another socket, */ -/* this function waits for specified period of time (wait_option) */ -/* for the other socket to unbind the port number. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_free_port_find Find a free UDP port */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -TX_INTERRUPT_SAVE_AREA -UINT index; -UINT status; -NX_IP *ip_ptr; -NX_UDP_SOCKET *search_ptr; -NX_UDP_SOCKET *end_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_BIND, ip_ptr, socket_ptr, port, wait_option, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket has already been bound to port or if a socket bind is - already pending from another thread. */ - if ((socket_ptr -> nx_udp_socket_bound_next) || - (socket_ptr -> nx_udp_socket_bind_in_progress)) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return an already bound error code. */ - return(NX_ALREADY_BOUND); - } - - /* Determine if the port needs to be allocated. */ - if (port == NX_ANY_PORT) - { - - /* Call the find routine to allocate a UDP port. */ - port = NX_SEARCH_PORT_START + (UINT)(NX_RAND() % ((NX_MAX_PORT + 1) - NX_SEARCH_PORT_START)); - if (_nx_udp_free_port_find(ip_ptr, port, &port) != NX_SUCCESS) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* There was no free port, return an error code. */ - return(NX_NO_FREE_PORTS); - } - } - - /* Save the port number in the UDP socket structure. */ - socket_ptr -> nx_udp_socket_port = port; - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Pickup the head of the UDP ports bound list. */ - search_ptr = ip_ptr -> nx_ip_udp_port_table[index]; - - /* Determine if we need to perform a list search. */ - if (search_ptr) - { - - /* Walk through the circular list of UDP sockets that are already - bound. */ - end_ptr = search_ptr; - do - { - - /* Determine if this entry is the same as the requested port. */ - if (search_ptr -> nx_udp_socket_port == port) - { - - /* Yes, the port has already been allocated. */ - break; - } - - /* Move to the next entry in the list. */ - search_ptr = search_ptr -> nx_udp_socket_bound_next; - } while (search_ptr != end_ptr); - } - - /* Now determine if the port is available. */ - if ((search_ptr == NX_NULL) || (search_ptr -> nx_udp_socket_port != port)) - { - - /* Place this UDP socket structure on the list of bound ports. */ - - /* Disable interrupts. */ - TX_DISABLE - - /* Determine if the list is NULL. */ - if (search_ptr) - { - - /* There are already sockets on this list... just add this one - to the end. */ - socket_ptr -> nx_udp_socket_bound_next = ip_ptr -> nx_ip_udp_port_table[index]; - socket_ptr -> nx_udp_socket_bound_previous = (ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous; - ((ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous) -> nx_udp_socket_bound_next = socket_ptr; - (ip_ptr -> nx_ip_udp_port_table[index]) -> nx_udp_socket_bound_previous = socket_ptr; - } - else - { - - /* Nothing is on the UDP port list. Add this UDP socket to an - empty list. */ - socket_ptr -> nx_udp_socket_bound_next = socket_ptr; - socket_ptr -> nx_udp_socket_bound_previous = socket_ptr; - ip_ptr -> nx_ip_udp_port_table[index] = socket_ptr; - } - - /* Restore interrupts. */ - TX_RESTORE - - /* Call wifi bind. */ - status = nx_wifi_udp_socket_bind(socket_ptr, port, wait_option); - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return status. */ - return(status); - } - else - { - - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return the port unavailable error. */ - return(NX_PORT_UNAVAILABLE); - } -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_create.c deleted file mode 100644 index fcd2e19a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_create.c +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function creates a UDP socket for the specified IP instance. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new UDP socket */ -/* name Name of new UDP socket */ -/* type_of_service Type of service for this UDP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* queue_maximum Maximum depth of receive queue*/ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG queue_maximum) -{ -TX_INTERRUPT_SAVE_AREA - -NX_UDP_SOCKET *tail_ptr; - - - /* Initialize the TCP control block to zero. */ - memset((void *)socket_ptr, 0, sizeof(NX_UDP_SOCKET)); - - /* Fill in the basic information in the new UDP socket structure. */ - - /* Remember the associated IP structure. */ - socket_ptr -> nx_udp_socket_ip_ptr = ip_ptr; - - /* Save the UDP socket's name. */ - socket_ptr -> nx_udp_socket_name = name; - - /* Save the type of service input parameter. */ - socket_ptr -> nx_udp_socket_type_of_service = type_of_service; - - /* Save the fragment input parameter. */ - socket_ptr -> nx_udp_socket_fragment_enable = fragment & NX_DONT_FRAGMENT; - - /* Save the time-to-live input parameter. */ - socket_ptr -> nx_udp_socket_time_to_live = time_to_live; - - /* By default, have UDP checksum logic enabled. To disable checksum logic, the - application must call the nx_udp_checksum disable function for this UDP socket. */ - socket_ptr -> nx_udp_socket_disable_checksum = NX_FALSE; - - /* Clear the socket bind in progress flag. */ - socket_ptr -> nx_udp_socket_bind_in_progress = NX_FALSE; - - /* Set various list pointers to NULL. */ - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - socket_ptr -> nx_udp_socket_bound_previous = NX_NULL; - socket_ptr -> nx_udp_socket_bind_suspension_list = NX_NULL; - socket_ptr -> nx_udp_socket_bind_suspended_count = 0; - - /* Initialize the receive queue parameters. */ - socket_ptr -> nx_udp_socket_receive_count = 0; - socket_ptr -> nx_udp_socket_queue_maximum = queue_maximum; - socket_ptr -> nx_udp_socket_receive_head = NX_NULL; - socket_ptr -> nx_udp_socket_receive_tail = NX_NULL; - - /* Clear the receive notify function pointer. */ - socket_ptr -> nx_udp_receive_callback = NX_NULL; - - /* If trace is enabled, register this object. */ - NX_TRACE_OBJECT_REGISTER(NX_TRACE_OBJECT_TYPE_UDP_SOCKET, socket_ptr, name, type_of_service, queue_maximum); - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_CREATE, ip_ptr, socket_ptr, type_of_service, queue_maximum, NX_TRACE_IP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can add socket to IP structure. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Disable interrupts while we link the new UDP socket to the IP structure. */ - TX_DISABLE - - /* Load the UDP ID field in the UDP control block. */ - socket_ptr -> nx_udp_socket_id = NX_UDP_ID; - - /* Place the new UDP control block on the list of created UDP sockets for this IP. First, - check for an empty list. */ - if (ip_ptr -> nx_ip_udp_created_sockets_ptr) - { - - /* Pickup tail pointer. */ - tail_ptr = (ip_ptr -> nx_ip_udp_created_sockets_ptr) -> nx_udp_socket_created_previous; - - /* Place the new UDP socket control block in the list. */ - (ip_ptr -> nx_ip_udp_created_sockets_ptr) -> nx_udp_socket_created_previous = socket_ptr; - tail_ptr -> nx_udp_socket_created_next = socket_ptr; - - /* Setup this UDP socket's created links. */ - socket_ptr -> nx_udp_socket_created_previous = tail_ptr; - socket_ptr -> nx_udp_socket_created_next = ip_ptr -> nx_ip_udp_created_sockets_ptr; - } - else - { - - /* The created UDP socket list is empty. Add UDP socket control block to empty list. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = socket_ptr; - socket_ptr -> nx_udp_socket_created_previous = socket_ptr; - socket_ptr -> nx_udp_socket_created_next = socket_ptr; - } - - /* Increment the created UDP socket counter. */ - ip_ptr -> nx_ip_udp_created_sockets_count++; - - /* Restore previous interrupt posture. */ - TX_RESTORE - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_delete.c deleted file mode 100644 index 1f4224e4..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_delete.c +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "tx_thread.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function deletes a previously created socket and unbound */ -/* socket. If the socket is still bound, an error is returned. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr) -{ - -TX_INTERRUPT_SAVE_AREA - -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_DELETE, ip_ptr, socket_ptr, 0, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can process the socket delete request. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket is still bound to port. */ - if (socket_ptr -> nx_udp_socket_bound_next) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a still bound error code. */ - return(NX_STILL_BOUND); - } - - /* Disable interrupts. */ - TX_DISABLE - - /* Now, remove the UDP socket from the created socket list. */ - - /* Clear the socket ID to make it invalid. */ - socket_ptr -> nx_udp_socket_id = 0; - - /* See if the socket is the only one on the list. */ - if (socket_ptr == socket_ptr -> nx_udp_socket_created_next) - { - - /* Only created socket, just set the created list to NULL. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = NX_NULL; - } - else - { - - /* Link-up the neighbors. */ - (socket_ptr -> nx_udp_socket_created_next) -> nx_udp_socket_created_previous = - socket_ptr -> nx_udp_socket_created_previous; - (socket_ptr -> nx_udp_socket_created_previous) -> nx_udp_socket_created_next = - socket_ptr -> nx_udp_socket_created_next; - - /* See if we have to update the created list head pointer. */ - if (ip_ptr -> nx_ip_udp_created_sockets_ptr == socket_ptr) - { - - /* Yes, move the head pointer to the next link. */ - ip_ptr -> nx_ip_udp_created_sockets_ptr = socket_ptr -> nx_udp_socket_created_next; - } - } - - /* Decrease the created sockets count. */ - ip_ptr -> nx_ip_udp_created_sockets_count--; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, unregister this object. */ - NX_TRACE_OBJECT_UNREGISTER(socket_ptr); - - /* Release the IP protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for preemption. */ - _tx_thread_system_preempt_check(); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive.c deleted file mode 100644 index 79c2aaad..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "tx_thread.h" -#include "nx_packet.h" -#include "nx_udp.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for a received UDP packet on the specified */ -/* socket and if no packets are on the receive queue, suspends for the */ -/* wait option duration. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release data packet */ -/* _tx_thread_system_suspend Suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - - - /* Call wifi receive. */ - return(nx_wifi_udp_socket_receive(socket_ptr, packet_ptr, wait_option)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive_notify.c deleted file mode 100644 index 20ba9571..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_receive_notify.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sets the receive notify function pointer to the */ -/* function specified by the application, which is called whenever */ -/* a packet is received on the socket. If a NULL pointer is supplied, */ -/* the receive notify function is disabled. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* udp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)) -{ -TX_INTERRUPT_SAVE_AREA - - - /* Disable interrupts. */ - TX_DISABLE - - /* Setup the receive notify function pointer. */ - socket_ptr -> nx_udp_receive_callback = udp_receive_notify; - - /* Restore interrupts. */ - TX_RESTORE - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_RECEIVE_NOTIFY, socket_ptr -> nx_udp_socket_ip_ptr, socket_ptr, udp_receive_notify, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Return successful completion. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_send.c deleted file mode 100644 index bffc539f..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_send.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_ip.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends the supplied UDP packet through the supplied */ -/* socket to the supplied IP address and port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nxd_udp_socket_send Send the UDP packet over IP */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, - ULONG ip_address, UINT port) -{ -#ifndef NX_DISABLE_IPV4 -UINT status; - -NXD_ADDRESS dual_ip_address; - - /* build up the IP Address structure. */ - dual_ip_address.nxd_ip_version = NX_IP_VERSION_V4; - dual_ip_address.nxd_ip_address.v4 = ip_address; - - /* Call the actual udp socket send routine. */ - status = _nxd_udp_socket_send(socket_ptr, packet_ptr, &dual_ip_address, port); - - return(status); -#else - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(packet_ptr); - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(port); - - return(NX_NOT_SUPPORTED); -#endif /* NX_DISABLE_IPV4 */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_unbind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_unbind.c deleted file mode 100644 index 31220e3f..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nx_udp_socket_unbind.c +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_packet.h" -#include "tx_thread.h" -#include "nx_wifi.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nx_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function unbinds the UDP socket structure from the previously */ -/* bound UDP port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Release data packet */ -/* _nx_udp_bind_cleanup Remove and cleanup bind req */ -/* tx_mutex_get Obtain protection mutex */ -/* tx_mutex_put Release protection mutex */ -/* _tx_thread_system_resume Resume suspended thread */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ - -UINT index; -UINT port; -NX_IP *ip_ptr; - - - /* Setup the pointer to the associated IP instance. */ - ip_ptr = socket_ptr -> nx_udp_socket_ip_ptr; - - /* If trace is enabled, insert this event into the trace buffer. */ - NX_TRACE_IN_LINE_INSERT(NX_TRACE_UDP_SOCKET_UNBIND, ip_ptr, socket_ptr, socket_ptr -> nx_udp_socket_port, 0, NX_TRACE_UDP_EVENTS, 0, 0); - - /* Obtain the IP mutex so we can figure out whether or not the port has already - been bound to. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Determine if the socket is bound to port. */ - if (!socket_ptr -> nx_udp_socket_bound_next) - { - - /* Release the protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return a not bound error code. */ - return(NX_NOT_BOUND); - } - - /* Otherwise, the socket is bound. We need to remove this socket from the - port and check for any other UDP socket bind requests that are queued. */ - - /* Pickup the port number in the UDP socket structure. */ - port = socket_ptr -> nx_udp_socket_port; - - /* Calculate the hash index in the UDP port array of the associated IP instance. */ - index = (UINT)((port + (port >> 8)) & NX_UDP_PORT_TABLE_MASK); - - /* Determine if this is the only socket bound on this port list. */ - if (socket_ptr -> nx_udp_socket_bound_next == socket_ptr) - { - - /* Yes, this is the only socket on the port list. */ - - /* Clear the list head pointer and the next pointer in the socket. */ - ip_ptr -> nx_ip_udp_port_table[index] = NX_NULL; - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - } - else - { - - /* Relink the neighbors of this UDP socket. */ - - /* Update the links of the adjacent sockets. */ - (socket_ptr -> nx_udp_socket_bound_next) -> nx_udp_socket_bound_previous = - socket_ptr -> nx_udp_socket_bound_previous; - (socket_ptr -> nx_udp_socket_bound_previous) -> nx_udp_socket_bound_next = - socket_ptr -> nx_udp_socket_bound_next; - - /* Determine if the head of the port list points to the socket being removed. - If so, we need to move the head pointer. */ - if (ip_ptr -> nx_ip_udp_port_table[index] == socket_ptr) - { - - /* Yes, we need to move the port list head pointer. */ - ip_ptr -> nx_ip_udp_port_table[index] = socket_ptr -> nx_udp_socket_bound_next; - } - - /* Clear the next pointer in the socket to indicate it is no longer bound. */ - socket_ptr -> nx_udp_socket_bound_next = NX_NULL; - } - - /* Release the mutex protection. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Call wifi unbind. */ - nx_wifi_udp_socket_unbind(socket_ptr); - - /* Return success. */ - return(NX_SUCCESS); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_tcp_client_socket_connect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_tcp_client_socket_connect.c deleted file mode 100644 index 26ac99e9..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_tcp_client_socket_connect.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" -#include "tx_thread.h" -#include "nx_ip.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxd_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function handles the connect request for the supplied socket. */ -/* If bound and not connected, this function will send the first SYN */ -/* message to the specified server to initiate the connection process. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_thread_suspend Suspend thread for connection */ -/* _nx_tcp_packet_send_syn Send SYN packet */ -/* _nx_ip_route_find Find a suitable outgoing */ -/* interface. */ -/* tx_mutex_get Obtain protection */ -/* tx_mutex_put Release protection */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, - ULONG wait_option) -{ - - /* Call wifi connect. */ - return(nx_wifi_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_udp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_udp_socket_send.c deleted file mode 100644 index cb0732c7..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxd_udp_socket_send.c +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" -#include "nx_ip.h" -#include "nx_wifi.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxd_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function sends a UDP packet through the specified socket */ -/* with the input IP address and port. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* NX_IPSEC_REJECTED Failed IPSec check */ -/* NX_NOT_BOUND Socket not bound to a port */ -/* NX_NO_INTERFACE_ADDRESS Socket interface not marked */ -/* valid */ -/* CALLS */ -/* */ -/* _nx_ip_packet_send Send UDP packet over IPv4 */ -/* _nx_ipv6_packet_send Send UDP packet over IPv6 */ -/* nx_ip_checksum_compute Compute UDP header checksum */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* _nxd_ipv6_interface_find Find interface for input */ -/* address in IP address table*/ -/* [_nx_packet_egress_sa_lookup] IPsec process */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, - NX_PACKET *packet_ptr, - NXD_ADDRESS *ip_address, - UINT port) -{ - - /* Call wifi send. */ - return(nx_wifi_udp_socket_send(socket_ptr, packet_ptr, ip_address, port)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_client_socket_connect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_client_socket_connect.c deleted file mode 100644 index 4ba0eb22..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_client_socket_connect.c +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP client socket connect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Acctual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED TCP not enabled */ -/* NX_IP_ADDRESS_ERROR Invalid TCP server IP address */ -/* NX_INVALID_PORT Invalid TCP server port */ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_client_socket_connect Actual client socket connect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *server_ip, - UINT server_port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for valid TCP server address. */ - if (server_ip == NX_NULL) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check that the server IP address version is either IPv4 or IPv6. */ - if ((server_ip -> nxd_ip_version != NX_IP_VERSION_V4) && - (server_ip -> nxd_ip_version != NX_IP_VERSION_V6)) - { - - return(NX_IP_ADDRESS_ERROR); - } - -#ifndef NX_DISABLE_IPV4 - /* Check for a valid server IP address if the server_ip is version IPv4. */ - if (server_ip -> nxd_ip_version == NX_IP_VERSION_V4) - { - if (((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_A_MASK) != NX_IP_CLASS_A_TYPE) && - ((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_B_MASK) != NX_IP_CLASS_B_TYPE) && - ((server_ip -> nxd_ip_address.v4 & NX_IP_CLASS_C_MASK) != NX_IP_CLASS_C_TYPE)) - { - return(NX_IP_ADDRESS_ERROR); - } - } -#endif /* !NX_DISABLE_IPV4 */ - - /* Check for an invalid port. */ - if (((ULONG)server_port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket connect function. */ - status = _nxd_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c deleted file mode 100644 index aa286bb0..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_tcp_socket_peer_info_get.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_tcp_socket_peer_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function performs error checking on the TCP socket peer info */ -/* get service. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to the TCP socket */ -/* peer_ip_address Pointer to the IP address */ -/* of the peer. */ -/* peer_port Pointer to the port number */ -/* of the peer. */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED TCP not enabled on IP instance*/ -/* */ -/* CALLS */ -/* */ -/* _nxd_tcp_socket_peer_info_get Actual TCP socket peer info */ -/* get function */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, - NXD_ADDRESS *peer_ip_address, - ULONG *peer_port) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - if ((peer_ip_address == NX_NULL) || (peer_port == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket MSS get function. */ - status = _nxd_tcp_socket_peer_info_get(socket_ptr, peer_ip_address, peer_port); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_udp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_udp_socket_send.c deleted file mode 100644 index ab4455c4..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxde_udp_socket_send.c +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_packet.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxde_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* NX_PTR_ERROR Invalid pointer input or */ -/* invalid packet input */ -/* NX_NOT_ENABLED UDP not enabled on IP instance*/ -/* NX_IP_ADDRESS_ERROR Invalid IP address input */ -/* NX_INVALID_PORT Invalid UDP destination port */ -/* NX_UNDERFLOW Check for invalid packet */ -/* prepend pointer */ -/* NX_OVERFLOW Check for invalid packet */ -/* prepend pointer */ -/* */ -/* CALLS */ -/* */ -/* _nxd_udp_socket_send Actual UDP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, NXD_ADDRESS *ip_address, UINT port) -{ - -NX_PACKET *packet_ptr; -UINT status; -UINT ip_header_size = 0; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || (ip_address == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid packet pointers and packets not marked for allocation. */ - /* Cast the ULONG into a packet pointer. Since this is exactly what we wish to do, disable the lint warning with the following comment: */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr == NX_NULL) || - (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - - return(NX_PTR_ERROR); - } - - if ((ip_address -> nxd_ip_version != NX_IP_VERSION_V4) && - (ip_address -> nxd_ip_version != NX_IP_VERSION_V6)) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if ((INT)(packet_ptr -> nx_packet_prepend_ptr - packet_ptr -> nx_packet_data_start) < (INT)(ip_header_size + sizeof(NX_UDP_HEADER))) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket send function. */ - status = _nxd_udp_socket_send(socket_ptr, packet_ptr, ip_address, port); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_create.c deleted file mode 100644 index e5b41a3e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_create.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_ip_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the IP instance create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* name Name of this IP instance */ -/* ip_address Internet address for this IP */ -/* network_mask Network mask for IP address */ -/* default_pool Default packet pool */ -/* ip_link_driver User supplied IP link driver */ -/* memory_ptr Pointer memory area for IP */ -/* memory_size Size of IP memory area */ -/* priority Priority of IP helper thread */ -/* ip_control_block_size Size of NX_IP structure */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_create Actual IP instance create */ -/* function */ -/* tx_thread_identify Get current thread pointer */ -/* tx_thread_preemption_change Change preemption for thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask, - NX_PACKET_POOL *default_pool, VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *), - VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size) -{ - -UINT status; -UINT old_threshold; -NX_IP *created_ip; -ULONG created_count; -TX_THREAD *current_thread; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (default_pool == NX_NULL) || - (default_pool -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (ip_control_block_size != (UINT)sizeof(NX_IP))) - { - return(NX_PTR_ERROR); - } - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, 0, &old_threshold); - } - - /* Loop to check for the IP instance already created. */ - created_ip = _nx_ip_created_ptr; - created_count = _nx_ip_created_count; - while (created_count--) - { - - /* Is the new ip already created? */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (ip_ptr == created_ip) - { - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Duplicate ip created, return an error! */ - return(NX_PTR_ERROR); - } - - /* Move to next entry. */ - created_ip = created_ip -> nx_ip_created_next; - } - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Call actual IP instance create function. */ - status = _nx_ip_create(ip_ptr, name, ip_address, network_mask, default_pool, ip_link_driver, - memory_ptr, memory_size, priority); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_delete.c deleted file mode 100644 index 1a06e2bb..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_ip_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Internet Protocol (IP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_ip_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the IP instance delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr Pointer to IP control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_ip_delete Actual IP instance delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_ip_delete(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual IP instance delete function. */ - status = _nx_ip_delete(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_allocate.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_allocate.c deleted file mode 100644 index ba24b1d6..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_allocate.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_allocate PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet allocate function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to allocate the packet */ -/* packet_ptr Pointer to place allocated */ -/* packet pointer */ -/* packet_type Type of packet to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_allocate Actual packet allocate service*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_allocate(NX_PACKET_POOL *pool_ptr, NX_PACKET **packet_ptr, - ULONG packet_type, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet type - for alignment purposes, it must be evenly divisible by the size - of a ULONG. */ - if (packet_type % sizeof(ULONG)) - { - return(NX_OPTION_ERROR); - } - - /* Check for a thread caller if the wait option specifies suspension. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet allocate function. */ - status = _nx_packet_allocate(pool_ptr, packet_ptr, packet_type, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_copy.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_copy.c deleted file mode 100644 index 7ea086c2..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_copy.c +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_copy PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet copy */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to source packet */ -/* new_packet_ptr Pointer to return packet */ -/* pool_ptr Pointer to packet pool to use */ -/* for new packet(s) */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_copy Actual packet copy function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (packet_ptr == NX_NULL) || (new_packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet copy function. */ - status = _nx_packet_copy(packet_ptr, new_packet_ptr, pool_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_append.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_append.c deleted file mode 100644 index 97ea5d65..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_append.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_append PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data append */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to packet to append */ -/* data_start Pointer to start of the data */ -/* data_size Number of bytes to append */ -/* pool_ptr Pool to allocate the packet */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_append Actual packet data append */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size, - NX_PACKET_POOL *pool_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (packet_ptr == NX_NULL) || (data_start == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid size of data to append. */ - if (!data_size) - { - return(NX_SIZE_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREAD_WAIT_CALLER_CHECKING - - /* Call actual packet data append function. */ - status = _nx_packet_data_append(packet_ptr, data_start, data_size, pool_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_extract_offset.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_extract_offset.c deleted file mode 100644 index cf1d9d2b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_extract_offset.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_extract_offset PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data extract */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer to the source packet */ -/* buffer_start Pointer to destination data area */ -/* buffer_length Size in bytes */ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_extract_offset Acutal packet data extract offset */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start, ULONG buffer_length, ULONG *bytes_copied) -{ - - if (packet_ptr == NX_NULL) - { - return(NX_PTR_ERROR); - } - - if (buffer_start == NX_NULL) - { - return(NX_PTR_ERROR); - } - - if (bytes_copied == NX_NULL) - { - return(NX_PTR_ERROR); - } - - - return(_nx_packet_data_extract_offset(packet_ptr, offset, buffer_start, buffer_length, bytes_copied)); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_retrieve.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_retrieve.c deleted file mode 100644 index 9777f180..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_data_retrieve.c +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_data_retrieve PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet data retrieve */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Packet to retrieve from */ -/* buffer_start Pointer to start of the buffer*/ -/* bytes_copied Number of bytes copied */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_data_retrieve Actual packet data retrieve */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((packet_ptr == NX_NULL) || (buffer_start == NX_NULL) || (bytes_copied == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Call actual packet data retrieve function. */ - status = _nx_packet_data_retrieve(packet_ptr, buffer_start, bytes_copied); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_length_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_length_get.c deleted file mode 100644 index fa82679b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_length_get.c +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_length_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet length get */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet */ -/* length Destination for the length */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_length_get Actual packet length get */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_length_get(NX_PACKET *packet_ptr, ULONG *length) -{ - -UINT status; - - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID) || - (length == NX_NULL)) - { - - /* Return an error! */ - return(NX_PTR_ERROR); - } - - /* Call actual packet length get function. */ - status = _nx_packet_length_get(packet_ptr, length); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_create.c deleted file mode 100644 index bd20a815..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_create.c +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* name_ptr Packet Pool string pointer */ -/* payload_size Size of packet payload */ -/* pool_start Starting address of pool */ -/* pool_size Number of bytes in pool */ -/* pool_control_block_size Size of packet pool control */ -/* block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_create Actual packet pool create */ -/* function */ -/* tx_thread_identify Get current thread pointer */ -/* tx_thread_preemption_change Change preemption for thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name_ptr, ULONG payload_size, - VOID *pool_start, ULONG pool_size, UINT pool_control_block_size) -{ - -UINT status; -ULONG rounded_payload_size; -ULONG rounded_pool_size; -ULONG header_size; -UINT old_threshold; -NX_PACKET_POOL *created_pool; -ULONG created_count; -CHAR *end_memory; -CHAR *created_end; -CHAR *payload_address; -VOID *rounded_pool_start; -TX_THREAD *current_thread; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_start == NX_NULL) || (pool_control_block_size != (UINT)sizeof(NX_PACKET_POOL))) - { - return(NX_PTR_ERROR); - } - - /* Align the starting address to four bytes. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_start = (VOID *)((((ALIGN_TYPE)pool_start + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Round the pool size down to something that is evenly divisible by alignment. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - rounded_pool_size = (ULONG)(((pool_size - ((ALIGN_TYPE)rounded_pool_start - (ALIGN_TYPE)pool_start)) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((ALIGN_TYPE)rounded_pool_start + sizeof(NX_PACKET)); - - /* Align the address of payload. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - payload_address = (CHAR *)((((ALIGN_TYPE)payload_address + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT); - - /* Calculate the header size. */ - /*lint -e{923} suppress cast between ULONG and pointer. */ - header_size = (ULONG)((ALIGN_TYPE)payload_address - (ALIGN_TYPE)rounded_pool_start); - - /* Round the packet size up to something that helps guarantee proper alignment for header and payload. */ - rounded_payload_size = (ULONG)(((header_size + payload_size + NX_PACKET_ALIGNMENT - 1) / NX_PACKET_ALIGNMENT) * NX_PACKET_ALIGNMENT - header_size); - - /* Check for an invalid pool and payload size. */ - if ((pool_size <= NX_PACKET_ALIGNMENT) || (!payload_size) || - ((rounded_payload_size + header_size) > rounded_pool_size)) - { - return(NX_SIZE_ERROR); - } - - /* Calculate the end of the pool memory area. */ - end_memory = ((CHAR *)pool_start) + (pool_size - 1); - - /* Pickup current thread pointer. */ - current_thread = tx_thread_identify(); - - /* Disable preemption temporarily. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, 0, &old_threshold); - } - - /* Loop to check for the pool instance already created. */ - created_pool = _nx_packet_pool_created_ptr; - created_count = _nx_packet_pool_created_count; - while (created_count--) - { - - /* Calculate the created pool's end of memory. */ - created_end = created_pool -> nx_packet_pool_start + (created_pool -> nx_packet_pool_size - 1); - - /* Is the new pool already created? */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if ((pool_ptr == created_pool) || - ((pool_start >= (VOID *)created_pool -> nx_packet_pool_start) && (pool_start < (VOID *)created_end)) || - ((end_memory >= created_pool -> nx_packet_pool_start) && (end_memory < created_end))) - { - - /* Restore preemption. */ - if (current_thread) - { - - /*lint -e{644} suppress variable might not be initialized, since "old_threshold" was initialized by previous tx_thread_preemption_change. */ - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Duplicate packet pool created, return an error! */ - return(NX_PTR_ERROR); - } - - /* Move to next entry. */ - created_pool = created_pool -> nx_packet_pool_created_next; - } - - /* Restore preemption. */ - if (current_thread) - { - tx_thread_preemption_change(current_thread, old_threshold, &old_threshold); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Call actual packet pool create function. */ - status = _nx_packet_pool_create(pool_ptr, name_ptr, payload_size, pool_start, pool_size); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_delete.c deleted file mode 100644 index 8c9ceb59..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_delete.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Packet Pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_delete Actual packet pool delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_delete(NX_PACKET_POOL *pool_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual packet pool delete function. */ - status = _nx_packet_pool_delete(pool_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_info_get.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_info_get.c deleted file mode 100644 index ab98c3a6..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_info_get.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_info_get PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool information get */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pool to get information from */ -/* total_packets Destination for total packets */ -/* free_packets Destination for free packets */ -/* empty_pool_requests Destination for empty requests*/ -/* empty_pool_suspensions Destination for empty */ -/* suspensions */ -/* invalid_packet_releases Destination for invalid packet*/ -/* release requests */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_info_get Actual packet pool info get */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets, - ULONG *empty_pool_requests, ULONG *empty_pool_suspensions, - ULONG *invalid_packet_releases) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual packet pool information get function. */ - status = _nx_packet_pool_info_get(pool_ptr, total_packets, free_packets, empty_pool_requests, - empty_pool_suspensions, invalid_packet_releases); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c deleted file mode 100644 index 2cfa7f7a..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_pool_low_watermark_set.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - -#ifdef NX_ENABLE_LOW_WATERMARK -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS -#endif /* NX_ENABLE_LOW_WATERMARK */ - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_pool_low_watermark_set PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet pool low watermark set*/ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to packet pool */ -/* low_watermark Low watermark of packet pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_pool_low_watermark_set Actual packet pool low */ -/* watermark set function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark) -{ -#ifdef NX_ENABLE_LOW_WATERMARK - -UINT status; - - - /* Check for invalid input pointers. */ - if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual packet pool low watermark set function. */ - status = _nx_packet_pool_low_watermark_set(pool_ptr, low_watermark); - - /* Return completion status. */ - return(status); - -#else /* !NX_ENABLE_LOW_WATERMARK */ - NX_PARAMETER_NOT_USED(pool_ptr); - NX_PARAMETER_NOT_USED(low_watermark); - - return(NX_NOT_SUPPORTED); - -#endif /* NX_ENABLE_LOW_WATERMARK */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_release.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_release.c deleted file mode 100644 index 20af3f03..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_release.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet release */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_release Actual packet release */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr) -{ - -UINT status; -NX_PACKET *packet_ptr; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Call actual packet release function. */ - status = _nx_packet_release(packet_ptr); - - /* Determine if the packet release was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_transmit_release.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_transmit_release.c deleted file mode 100644 index 5d1a8f0e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_packet_transmit_release.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Packet Pool Management (Packet) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_packet.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_packet_transmit_release PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the packet transmit release */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* packet_ptr Pointer of packet to release */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_packet_transmit_release Actual packet transmit release*/ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr) -{ - -UINT status; -NX_PACKET *packet_ptr; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Simple integrity check on the packet. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_pool_owner == NX_NULL) || - ((packet_ptr -> nx_packet_pool_owner) -> nx_packet_pool_id != NX_PACKET_POOL_ID)) - { - - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet prepend pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - return(NX_OVERFLOW); - } - - /* Call actual packet transmit release function. */ - status = _nx_packet_transmit_release(packet_ptr); - - /* Determine if the packet release was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_bind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_bind.c deleted file mode 100644 index 0d8642d5..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_bind.c +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket bind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* port 16-bit TCP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_bind Actual TCP client socket bind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket bind function. */ - status = _nx_tcp_client_socket_bind(socket_ptr, port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_connect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_connect.c deleted file mode 100644 index 67d06848..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_connect.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_connect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP client socket connect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* server_ip IP address of server */ -/* server_port Port number of server */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_connect Actual client socket connect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option) -{ - -#ifndef NX_DISABLE_IPV4 - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid IP address. */ - if (!server_ip) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for invalid IP address. */ - if (((server_ip & NX_IP_CLASS_A_MASK) != NX_IP_CLASS_A_TYPE) && - ((server_ip & NX_IP_CLASS_B_MASK) != NX_IP_CLASS_B_TYPE) && - ((server_ip & NX_IP_CLASS_C_MASK) != NX_IP_CLASS_C_TYPE)) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)server_port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket connect function. */ - status = _nx_tcp_client_socket_connect(socket_ptr, server_ip, server_port, wait_option); - - /* Return completion status. */ - return(status); -#else /* NX_DISABLE_IPV4 */ - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(server_ip); - NX_PARAMETER_NOT_USED(server_port); - NX_PARAMETER_NOT_USED(wait_option); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_unbind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_unbind.c deleted file mode 100644 index 91d0393e..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_client_socket_unbind.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_client_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the client socket unbind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_client_socket_unbind Actual client socket unbind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP client socket unbind function. */ - status = _nx_tcp_client_socket_unbind(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_enable.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_enable.c deleted file mode 100644 index 505fa34f..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_enable.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP enable function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_enable Actual TCP enable function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_enable(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual TCP enable function. */ - status = _nx_tcp_enable(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_create.c deleted file mode 100644 index 636289d5..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_create.c +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new TCP socket */ -/* name Name of new TCP socket */ -/* type_of_service Type of service for this TCP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* window_size Size of socket's receive */ -/* window */ -/* tcp_urgent_data_callback Routine to call when urgent */ -/* data is received */ -/* tcp_disconnect_callback Routine to call when a */ -/* disconnect occurs */ -/* tcp_socket_size Size of TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_create Actual TCP socket create */ -/* function */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, - VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), - VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), - UINT tcp_socket_size) -{ - -UINT status; -NX_TCP_SOCKET *created_socket; -ULONG created_count; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (socket_ptr == NX_NULL) || - (tcp_socket_size != (UINT)sizeof(NX_TCP_SOCKET))) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Get protection mutex. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup created count and created socket pointer. */ - created_count = ip_ptr -> nx_ip_tcp_created_sockets_count; - created_socket = ip_ptr -> nx_ip_tcp_created_sockets_ptr; - - /* Loop to look for socket already created. */ - while (created_count--) - { - - /* Compare the new socket with the already created socket. */ - if (socket_ptr == created_socket) - { - - /* Error, socket already created! */ - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return error. */ - return(NX_PTR_ERROR); - } - - /* Move to next created socket. */ - created_socket = created_socket -> nx_tcp_socket_created_next; - } - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for valid type of service. */ - if (type_of_service & ~(NX_IP_TOS_MASK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid fragment option. */ - if ((fragment != NX_FRAGMENT_OKAY) && - (fragment != NX_DONT_FRAGMENT)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid time to live option. */ - if (((ULONG)time_to_live) > NX_IP_TIME_TO_LIVE_MASK) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid window size. */ - if (!window_size) - { - return(NX_OPTION_ERROR); - } - -#ifndef NX_ENABLE_TCP_WINDOW_SCALING - if (window_size > NX_LOWER_16_MASK) - { - return(NX_OPTION_ERROR); - } -#else - /* The maximum scale exponent is limited to 14. Section 2.2, RFC 7323. */ - if (window_size > ((1 << 30) - 1)) - { - return(NX_OPTION_ERROR); - } -#endif /* NX_ENABLE_TCP_WINDOW_SCALING */ - - /* Call actual TCP socket create function. */ - status = _nx_tcp_socket_create(ip_ptr, socket_ptr, name, type_of_service, fragment, time_to_live, - window_size, tcp_urgent_data_callback, tcp_disconnect_callback); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_delete.c deleted file mode 100644 index 1d6563a3..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_delete Actual TCP socket delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket delete function. */ - status = _nx_tcp_socket_delete(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_disconnect.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_disconnect.c deleted file mode 100644 index ce85c635..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_disconnect.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_disconnect PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the socket disconnect */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP client socket */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_disconnect Actual TCP socket disconnect */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket disconnect function. */ - status = _nx_tcp_socket_disconnect(socket_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_establish_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_establish_notify.c deleted file mode 100644 index 465a3ac2..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_establish_notify.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS -#endif /* NX_DISABLE_EXTENDED_NOTIFY_SUPPORT */ - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_establishe_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket establish notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_establish_notify Routine to call when the */ -/* connection handshake is */ -/* completed */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_establish_notify Actual socket establish notify*/ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - return(NX_NOT_SUPPORTED); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive.c deleted file mode 100644 index 2e680bff..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket receive */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_receive Actual TCP socket receive */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket receive function. */ - status = _nx_tcp_socket_receive(socket_ptr, packet_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive_notify.c deleted file mode 100644 index 0a8442a5..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_receive_notify.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket receive notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to TCP socket */ -/* tcp_receive_notify Routine to call when one or */ -/* receive packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_receive_notify Actual socket receive notify */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, - VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)) -{ - -UINT status; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for invalid input pointers. */ - if (tcp_receive_notify == NX_NULL) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - - /* Call actual socket receive notify function. */ - status = _nx_tcp_socket_receive_notify(socket_ptr, tcp_receive_notify); - - /* Return to caller. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_send.c deleted file mode 100644 index 0795698b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_send.c +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_tcp.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the TCP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* packet_ptr Pointer to packet to send */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_send Actual TCP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option) -{ - -NX_PACKET *packet_ptr; -UINT status; - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid packet pointer. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - return(NX_INVALID_PACKET); - } - - /*lint -e{946} -e{947} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_prepend_ptr < packet_ptr -> nx_packet_data_start) - { - -#ifndef NX_DISABLE_TCP_INFO - - /* Increment the TCP invalid packet count. */ - (socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_UNDERFLOW); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_TCP_INFO - - /* Increment the TCP invalid packet count. */ - (socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket send function. */ - status = _nx_tcp_socket_send(socket_ptr, packet_ptr, wait_option); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_state_wait.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_state_wait.c deleted file mode 100644 index 794384c6..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_tcp_socket_state_wait.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Transmission Control Protocol (TCP) */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_tcp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_tcp_socket_state_wait PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the socket state wait */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to socket */ -/* desired_state Desired TCP state */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_tcp_socket_state_wait Actual socket state wait */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check to see if TCP is enabled. */ - if (!(socket_ptr -> nx_tcp_socket_ip_ptr) -> nx_ip_tcp_packet_receive) - { - return(NX_NOT_ENABLED); - } - - /* Check for an invalid state request. */ - if ((desired_state < NX_TCP_CLOSED) || (desired_state > NX_TCP_LAST_ACK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual TCP socket state wait function. */ - status = _nx_tcp_socket_state_wait(socket_ptr, desired_state, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_enable.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_enable.c deleted file mode 100644 index fe053e17..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_enable.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_enable PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP enable function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_enable Actual UDP enable function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_enable(NX_IP *ip_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_NOT_ISR_CALLER_CHECKING - - /* Call actual UDP enable function. */ - status = _nx_udp_enable(ip_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_bind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_bind.c deleted file mode 100644 index 920a7c9c..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_bind.c +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_bind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket bind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* port 16-bit UDP port number */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_bind Actual UDP socket bind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT port, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket bind function. */ - status = _nx_udp_socket_bind(socket_ptr, port, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_create.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_create.c deleted file mode 100644 index c3ac25d5..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_create.c +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_create PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket create */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* ip_ptr IP instance pointer */ -/* socket_ptr Pointer to new UDP socket */ -/* name Name of new UDP socket */ -/* type_of_service Type of service for this UDP */ -/* socket */ -/* fragment Flag to enable IP fragmenting */ -/* time_to_live Time to live value for socket */ -/* queue_maximum Maximum depth of receive queue*/ -/* udp_socket_size Size of UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_create Actual UDP socket create */ -/* function */ -/* tx_mutex_get Get protection mutex */ -/* tx_mutex_put Put protection mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name, - ULONG type_of_service, ULONG fragment, UINT time_to_live, - ULONG queue_maximum, UINT udp_socket_size) -{ - -UINT status; -NX_UDP_SOCKET *created_socket; -ULONG created_count; - - - /* Check for invalid input pointers. */ - if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || - (socket_ptr == NX_NULL) || (udp_socket_size != (UINT)sizeof(NX_UDP_SOCKET))) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_INIT_AND_THREADS_CALLER_CHECKING - - /* Get protection mutex. */ - tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); - - /* Pickup created count and created socket pointer. */ - created_count = ip_ptr -> nx_ip_udp_created_sockets_count; - created_socket = ip_ptr -> nx_ip_udp_created_sockets_ptr; - - /* Loop to look for socket already created. */ - while (created_count--) - { - - /* Compare the new socket with the already created socket. */ - if (socket_ptr == created_socket) - { - - /* Error, socket already created! */ - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Return error. */ - return(NX_PTR_ERROR); - } - - /* Move to next created socket. */ - created_socket = created_socket -> nx_udp_socket_created_next; - } - - /* Release protection mutex. */ - tx_mutex_put(&(ip_ptr -> nx_ip_protection)); - - /* Check for valid type of service. */ - if (type_of_service & ~(NX_IP_TOS_MASK)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid fragment option. */ - if ((fragment != NX_FRAGMENT_OKAY) && - (fragment != NX_DONT_FRAGMENT)) - { - return(NX_OPTION_ERROR); - } - - /* Check for valid time to live option. */ - if (((ULONG)time_to_live) > NX_IP_TIME_TO_LIVE_MASK) - { - return(NX_OPTION_ERROR); - } - - /* Call actual UDP socket create function. */ - status = _nx_udp_socket_create(ip_ptr, socket_ptr, name, type_of_service, - fragment, time_to_live, queue_maximum); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_delete.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_delete.c deleted file mode 100644 index ec3a9200..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_delete.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_delete PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket delete */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_delete Actual UDP socket delete */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_delete(NX_UDP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket delete function. */ - status = _nx_udp_socket_delete(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive.c deleted file mode 100644 index c87acbd4..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_receive PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket receive */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_receive Actual UDP socket receive */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || (packet_ptr == NX_NULL)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket receive function. */ - status = _nx_udp_socket_receive(socket_ptr, packet_ptr, wait_option); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive_notify.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive_notify.c deleted file mode 100644 index 4566d27b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_receive_notify.c +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_receive_notify PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket receive notify */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* udp_receive_notify Routine to call when one or */ -/* more received packets are */ -/* available for the socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_receive_notify Actual socket receive notify */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr, - VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr)) -{ - -UINT status; - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Call actual socket receive notify function. */ - status = _nx_udp_socket_receive_notify(socket_ptr, udp_receive_notify); - - /* Return to caller. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_send.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_send.c deleted file mode 100644 index 16d95fb0..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_send.c +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_ip.h" -#include "nx_udp.h" -#include "nx_packet.h" - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_send PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket send */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* packet_ptr Pointer to UDP packet */ -/* ip_address IP address */ -/* port 16-bit UDP port number */ -/* */ -/* OUTPUT */ -/* */ -/* status Actual completion status */ -/* NX_PTR_ERROR Invalid pointer input */ -/* NX_NOT_ENABLED UDP not enabled */ -/* NX_IP_ADDRESS_ERROR NULL address input */ -/* NX_INVALID_PORT Invalid UDP socket port */ -/* NX_UNDERFLOW Invalid pointer to packet data*/ -/* NX_OVERFLOW Invalid pointer to packet data*/ -/* NX_CALLER_ERROR Invalid (non thread) caller */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_send Actual UDP socket send */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, - ULONG ip_address, UINT port) -{ - -#ifndef NX_DISABLE_IPV4 -NX_PACKET *packet_ptr; -UINT status; - - - /* Setup packet pointer. */ - packet_ptr = *packet_ptr_ptr; - - /* Check for invalid input pointers. */ - /*lint -e{923} suppress cast of ULONG to pointer. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID) || - (packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) - { - - return(NX_PTR_ERROR); - } - - /* Check for invalid IP address. */ - if (ip_address == NX_NULL) - { - return(NX_IP_ADDRESS_ERROR); - } - - /* Check for an invalid port. */ - if (((ULONG)port) > (ULONG)NX_MAX_PORT) - { - return(NX_INVALID_PORT); - } - - /* Check for an invalid packet append pointer. */ - /*lint -e{946} suppress pointer subtraction, since it is necessary. */ - if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) - { - -#ifndef NX_DISABLE_UDP_INFO - /* Increment the total UDP invalid packet count. */ - (socket_ptr -> nx_udp_socket_ip_ptr) -> nx_ip_udp_invalid_packets++; - - /* Increment the total UDP invalid packet count for this socket. */ - socket_ptr -> nx_udp_socket_invalid_packets++; -#endif - - /* Return error code. */ - return(NX_OVERFLOW); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket send function. */ - status = _nx_udp_socket_send(socket_ptr, packet_ptr, ip_address, port); - - /* Determine if the packet send was successful. */ - if (status == NX_SUCCESS) - { - - /* Yes, now clear the application's packet pointer so it can't be accidentally - used again by the application. This is only done when error checking is - enabled. */ - *packet_ptr_ptr = NX_NULL; - } - - /* Return completion status. */ - return(status); -#else - NX_PARAMETER_NOT_USED(socket_ptr); - NX_PARAMETER_NOT_USED(packet_ptr_ptr); - NX_PARAMETER_NOT_USED(ip_address); - NX_PARAMETER_NOT_USED(port); - - return(NX_NOT_SUPPORTED); -#endif /* !NX_DISABLE_IPV4 */ -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_unbind.c b/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_unbind.c deleted file mode 100644 index f27852a3..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/common/nxe_udp_socket_unbind.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** User Datagram Protocol (UDP) for STM32L4XX */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - -#define NX_SOURCE_CODE - - -/* Include necessary system files. */ - -#include "nx_api.h" -#include "nx_udp.h" - - -/* Bring in externs for caller checking code. */ - -NX_CALLER_CHECKING_EXTERNS - - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _nxe_udp_socket_unbind PORTABLE C */ -/* 6.1 */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This function checks for errors in the UDP socket unbind */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* socket_ptr Pointer to UDP socket */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _nx_udp_socket_unbind Actual UDP socket unbind */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ -/* 09-30-2020 Yuxin Zhou Modified comment(s), */ -/* resulting in version 6.1 */ -/* */ -/**************************************************************************/ -UINT _nxe_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr) -{ - -UINT status; - - - /* Check for invalid input pointers. */ - if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID)) - { - return(NX_PTR_ERROR); - } - - /* Check for appropriate caller. */ - NX_THREADS_ONLY_CALLER_CHECKING - - /* Call actual UDP socket unbind function. */ - status = _nx_udp_socket_unbind(socket_ptr); - - /* Return completion status. */ - return(status); -} - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/nx_user.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/nx_user.h index 2da967a7..f4c1f1c8 100644 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/nx_user.h +++ b/STMicroelectronics/STM32L4_L4+/lib/netxduo/nx_user.h @@ -12,6 +12,10 @@ #ifndef NX_USER_H #define NX_USER_H +#define NX_ENABLE_TCPIP_OFFLOAD +#define NX_ENABLE_INTERFACE_CAPABILITY +#define NX_DISABLE_IPV6 + /* Secure */ #define NX_SECURE_ENABLE @@ -21,7 +25,6 @@ /* SNTP */ #define NX_SNTP_CLIENT_MIN_SERVER_STRATUM 3 -#define NX_SNTP_CLIENT_MESSAGE_CHECK_DISABLE /* Azure IoT Security Module */ #define NX_ENABLE_IP_PACKET_FILTER @@ -30,9 +33,6 @@ #define NXD_MQTT_CLOUD_ENABLE #define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT -/* Override wait option as the L475/L4S5 doesn't support 0 wait time */ -#define NX_AZURE_IOT_PROVISIONING_CLIENT_CONNECT_WAIT_OPTION (40 * NX_IP_PERIODIC_RATE) - /* NetX */ #define NX_DNS_CLIENT_USER_CREATE_PACKET_POOL #define NX_DNS_CLIENT_CLEAR_QUEUE diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/gnu/inc/nx_port.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/gnu/inc/nx_port.h deleted file mode 100644 index 1b67b7bc..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/gnu/inc/nx_port.h +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Port Specific for STM32L475E-IOT01A1 */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* nx_port.h Cortex-M4/GNU */ -/* 6.1 */ -/* */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the NetX */ -/* real-time TCP/IP function identically on a variety of different */ -/* processor architectures. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 09-30-2020 Yuxin Zhou Initial Version 6.1 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PORT_H -#define NX_PORT_H - -/* Determine if the optional NetX user define file should be used. */ - -/* -#define NX_INCLUDE_USER_DEFINE_FILE -*/ -#ifdef NX_INCLUDE_USER_DEFINE_FILE - - -/* Yes, include the user defines in nx_user.h. The defines in this file may - alternately be defined on the command line. */ - -#include "nx_user.h" -#endif - - -/* Default to little endian, since this is what most ARM targets are. */ - -#define NX_LITTLE_ENDIAN 1 - - -#include -#include -#include - - -/* Define various constants for the port. */ - -#ifndef NX_IP_PERIODIC_RATE -#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for - ports with 10ms timer interrupts. This - value may be defined instead at the - command line and this value will not be - used. */ -#endif - - -/* Define macros that swap the endian for little endian ports. */ -#ifdef NX_LITTLE_ENDIAN -#define NX_CHANGE_ULONG_ENDIAN(arg) (arg) = __builtin_bswap32(arg) -#define NX_CHANGE_USHORT_ENDIAN(arg) (arg) = __builtin_bswap16(arg) - - -#ifndef htonl -#define htonl(val) __builtin_bswap32(val) -#endif /* htonl */ -#ifndef ntohl -#define ntohl(val) __builtin_bswap32(val) -#endif /* htonl */ - -#ifndef htons -#define htons(val) __builtin_bswap16(val) -#endif /*htons */ - -#ifndef ntohs -#define ntohs(val) __builtin_bswap16(val) -#endif /*htons */ - - -#else -#define NX_CHANGE_ULONG_ENDIAN(a) -#define NX_CHANGE_USHORT_ENDIAN(a) - -#ifndef htons -#define htons(val) (val) -#endif /* htons */ - -#ifndef ntohs -#define ntohs(val) (val) -#endif /* ntohs */ - -#ifndef ntohl -#define ntohl(val) (val) -#endif - -#ifndef htonl -#define htonl(val) (val) -#endif /* htonl */ -#endif - - -/* Define several macros for the error checking shell in NetX. */ - -#ifndef TX_TIMER_PROCESS_IN_ISR - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern TX_THREAD _tx_timer_thread; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \ - return(NX_CALLER_ERROR); - - -#else - - - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \ - return(NX_CALLER_ERROR); - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \ - return(NX_CALLER_ERROR); - -#endif - - -/* Define the version ID of NetX. This may be utilized by the application. */ - -#ifdef NX_SYSTEM_INIT -CHAR _nx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * NetX Duo Cortex-M4/GNU Version 6.1 *"; -#else -extern CHAR _nx_version_id[]; -#endif - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/iar/inc/nx_port.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/iar/inc/nx_port.h deleted file mode 100644 index 35d7ea85..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/iar/inc/nx_port.h +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Port Specific */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* nx_port.h Cortex-M4/IAR */ -/* 6.0.2 */ -/* */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the NetX */ -/* real-time TCP/IP function identically on a variety of different */ -/* processor architectures. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 06-30-2020 Yuxin Zhou Initial Version 6.0.1 */ -/* 08-14-2020 Yuxin Zhou Modified comment(s), and */ -/* corrected the code of */ -/* getting system state, */ -/* resulting in version 6.0.2 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PORT_H -#define NX_PORT_H - -/* Determine if the optional NetX user define file should be used. */ - -#ifdef NX_INCLUDE_USER_DEFINE_FILE - - -/* Yes, include the user defines in nx_user.h. The defines in this file may - alternately be defined on the command line. */ - -#include "nx_user.h" -#endif - - -/* Default to little endian, since this is what most ARM targets are. */ - -#define NX_LITTLE_ENDIAN 1 - - -#include -#include -#include - - -/* Define various constants for the port. */ - -#ifndef NX_IP_PERIODIC_RATE -#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for - ports with 10ms timer interrupts. This - value may be defined instead at the - command line and this value will not be - used. */ -#endif - - -/* Define macros that swap the endian for little endian ports. */ -#ifdef NX_LITTLE_ENDIAN -#define NX_CHANGE_ULONG_ENDIAN(arg) \ - { \ - ULONG i; \ - ULONG tmp; \ - i = (UINT)arg; \ - /* i = A, B, C, D */ \ - tmp = i ^ (((i) >> 16) | (i << 16)); \ - /* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \ - tmp &= 0xff00ffff; \ - /* tmp = A^C, 0, C^A, D^B */ \ - i = ((i) >> 8) | (i<<24); \ - /* i = D, A, B, C */ \ - i = i ^ ((tmp) >> 8); \ - /* i = D, C, B, A */ \ - arg = i; \ - } -#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF) - - -#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \ - | (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24)) - -#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8)) - - -#ifndef htonl -#define htonl(val) __SWAP32__(val) -#endif /* htonl */ -#ifndef ntohl -#define ntohl(val) __SWAP32__(val) -#endif /* htonl */ - -#ifndef htons -#define htons(val) __SWAP16__(val) -#endif /*htons */ - -#ifndef ntohs -#define ntohs(val) __SWAP16__(val) -#endif /*htons */ - - -#else -#define NX_CHANGE_ULONG_ENDIAN(a) -#define NX_CHANGE_USHORT_ENDIAN(a) - -#ifndef htons -#define htons(val) (val) -#endif /* htons */ - -#ifndef ntohs -#define ntohs(val) (val) -#endif /* ntohs */ - -#ifndef ntohl -#define ntohl(val) (val) -#endif - -#ifndef htonl -#define htonl(val) (val) -#endif /* htonl */ -#endif - - -/* Define several macros for the error checking shell in NetX. */ - -#ifndef TX_TIMER_PROCESS_IN_ISR - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern TX_THREAD _tx_timer_thread; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \ - return(NX_CALLER_ERROR); - - -#else - - - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \ - return(NX_CALLER_ERROR); - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \ - return(NX_CALLER_ERROR); - -#endif - - -/* Define the version ID of NetX. This may be utilized by the application. */ - -#ifdef NX_SYSTEM_INIT -CHAR _nx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * NetX Duo Cortex-M4/IAR Version 6.0.1 *"; -#else -extern CHAR _nx_version_id[]; -#endif - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/keil/inc/nx_port.h b/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/keil/inc/nx_port.h deleted file mode 100644 index 2d01e59b..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/ports/cortex_m4/keil/inc/nx_port.h +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - - -/**************************************************************************/ -/**************************************************************************/ -/** */ -/** NetX Component */ -/** */ -/** Port Specific */ -/** */ -/**************************************************************************/ -/**************************************************************************/ - - -/**************************************************************************/ -/* */ -/* PORT SPECIFIC C INFORMATION RELEASE */ -/* */ -/* nx_port.h Cortex-M4/Keil */ -/* 6.0.2 */ -/* */ -/* AUTHOR */ -/* */ -/* Yuxin Zhou, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file contains data type definitions that make the NetX */ -/* real-time TCP/IP function identically on a variety of different */ -/* processor architectures. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 06-30-2020 Yuxin Zhou Initial Version 6.0.1 */ -/* 08-14-2020 Yuxin Zhou Modified comment(s), and */ -/* corrected the code of */ -/* getting system state, */ -/* resulting in version 6.0.2 */ -/* */ -/**************************************************************************/ - -#ifndef NX_PORT_H -#define NX_PORT_H - -/* Determine if the optional NetX user define file should be used. */ - -#ifdef NX_INCLUDE_USER_DEFINE_FILE - - -/* Yes, include the user defines in nx_user.h. The defines in this file may - alternately be defined on the command line. */ - -#include "nx_user.h" -#endif - - -/* Default to little endian, since this is what most ARM targets are. */ - -#define NX_LITTLE_ENDIAN 1 - - -#include -#include -#include - - -/* Define various constants for the port. */ - -#ifndef NX_IP_PERIODIC_RATE -#define NX_IP_PERIODIC_RATE 100 /* Default IP periodic rate of 1 second for - ports with 10ms timer interrupts. This - value may be defined instead at the - command line and this value will not be - used. */ -#endif - - -/* Define macros that swap the endian for little endian ports. */ -#ifdef NX_LITTLE_ENDIAN -#define NX_CHANGE_ULONG_ENDIAN(arg) \ - { \ - ULONG i; \ - ULONG tmp; \ - i = (UINT)arg; \ - /* i = A, B, C, D */ \ - tmp = i ^ (((i) >> 16) | (i << 16)); \ - /* tmp = i ^ (i ROR 16) = A^C, B^D, C^A, D^B */ \ - tmp &= 0xff00ffff; \ - /* tmp = A^C, 0, C^A, D^B */ \ - i = ((i) >> 8) | (i<<24); \ - /* i = D, A, B, C */ \ - i = i ^ ((tmp) >> 8); \ - /* i = D, C, B, A */ \ - arg = i; \ - } -#define NX_CHANGE_USHORT_ENDIAN(a) a = (((a >> 8) | (a << 8)) & 0xFFFF) - - -#define __SWAP32__(val) ((((val) & 0xFF000000) >> 24 ) | (((val) & 0x00FF0000) >> 8) \ - | (((val) & 0x0000FF00) << 8) | (((val) & 0x000000FF) << 24)) - -#define __SWAP16__(val) ((((val) & 0xFF00) >> 8) | (((val) & 0x00FF) << 8)) - - -#ifndef htonl -#define htonl(val) __SWAP32__(val) -#endif /* htonl */ -#ifndef ntohl -#define ntohl(val) __SWAP32__(val) -#endif /* htonl */ - -#ifndef htons -#define htons(val) __SWAP16__(val) -#endif /*htons */ - -#ifndef ntohs -#define ntohs(val) __SWAP16__(val) -#endif /*htons */ - - -#else -#define NX_CHANGE_ULONG_ENDIAN(a) -#define NX_CHANGE_USHORT_ENDIAN(a) - -#ifndef htons -#define htons(val) (val) -#endif /* htons */ - -#ifndef ntohs -#define ntohs(val) (val) -#endif /* ntohs */ - -#ifndef ntohl -#define ntohl(val) (val) -#endif - -#ifndef htonl -#define htonl(val) (val) -#endif /* htonl */ -#endif - - -/* Define several macros for the error checking shell in NetX. */ - -#ifndef TX_TIMER_PROCESS_IN_ISR - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern TX_THREAD _tx_timer_thread; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) || \ - (_tx_thread_current_ptr == &_tx_timer_thread)) \ - return(NX_CALLER_ERROR); - - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \ - return(NX_CALLER_ERROR); - - -#else - - - -#define NX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ - extern volatile ULONG _tx_thread_system_state; - -#define NX_THREADS_ONLY_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) || \ - (_tx_thread_current_ptr == TX_NULL)) \ - return(NX_CALLER_ERROR); - -#define NX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0)))) \ - return(NX_CALLER_ERROR); - -#define NX_NOT_ISR_CALLER_CHECKING if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG) 0xF0F0F0F0))) \ - return(NX_CALLER_ERROR); - -#define NX_THREAD_WAIT_CALLER_CHECKING if ((wait_option) && \ - ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \ - return(NX_CALLER_ERROR); - -#endif - - -/* Define the version ID of NetX. This may be utilized by the application. */ - -#ifdef NX_SYSTEM_INIT -CHAR _nx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * NetX Duo Cortex-M4/Keil Version 6.0.1 *"; -#else -extern CHAR _nx_version_id[]; -#endif - -#endif - diff --git a/STMicroelectronics/STM32L4_L4+/lib/netxduo/readme.md b/STMicroelectronics/STM32L4_L4+/lib/netxduo/readme.md deleted file mode 100644 index cdbca135..00000000 --- a/STMicroelectronics/STM32L4_L4+/lib/netxduo/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -# NetXDuo -This folder contains a fork of NetXDuo that has been modified to utilize the [Inventek ISM43362](https://www.inventeksys.com/ism4336-m3g-l44-e-embedded-serial-to-wifi-module) WiFi module. The Inventek WiFi module has an integrated TCP/IP stack and communication with the device is through an AT command set. - -Due to the integrated TCP/IP stack on the Inventek module, the TCP/IP stack has been removed from the NetXDuo layer and replaced with a redirection to the underlying AT command set. - -This is a demonstration of how the NetXDuo networking stack can be modified to work with radically different networking modules, while still providing a standardized interface layer. diff --git a/SiliconLabs/EFR32MG12/CMakeLists.txt b/SiliconLabs/EFR32MG12/CMakeLists.txt index 2beca741..4234a138 100644 --- a/SiliconLabs/EFR32MG12/CMakeLists.txt +++ b/SiliconLabs/EFR32MG12/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR) set(CMAKE_C_STANDARD 99) set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..) -set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src) -set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib) +set(SHARED_SRC_DIR ${GSG_BASE_DIR}/shared/src) +set(SHARED_LIB_DIR ${GSG_BASE_DIR}/shared/lib) # use the repo version of ninja on Windows as there is no Ninja installer if(WIN32) @@ -26,6 +26,6 @@ project(efr32mg12_azure_iot C ASM) # Disable common networking component, Silabs has it's own set(DISABLE_COMMON_NETWORK true) -add_subdirectory(${CORE_SRC_DIR} core_src) +add_subdirectory(${SHARED_SRC_DIR} shared_src) add_subdirectory(lib) add_subdirectory(app) diff --git a/SiliconLabs/EFR32MG12/app/nx_client.c b/SiliconLabs/EFR32MG12/app/nx_client.c index 9a9a288c..42e33a8a 100644 --- a/SiliconLabs/EFR32MG12/app/nx_client.c +++ b/SiliconLabs/EFR32MG12/app/nx_client.c @@ -15,7 +15,6 @@ #include "nx_azure_iot_provisioning_client.h" #include "azure_iot_nx_client.h" -#include "nx_azure_iot_pnp_helpers.h" #include "azure_config.h" #include "azure_device_x509_cert_config.h" @@ -38,7 +37,7 @@ static AZURE_IOT_NX_CONTEXT azure_iot_nx_client; static TX_EVENT_FLAGS_GROUP azure_iot_flags; static int32_t telemetry_interval = 10; -static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer) { if (nx_azure_iot_json_writer_append_property_with_string_value(json_writer, (UCHAR*)DEVICE_INFO_MANUFACTURER_PROPERTY_NAME, @@ -87,7 +86,7 @@ static UINT append_device_info_properties(NX_AZURE_IOT_JSON_WRITER* json_writer, return NX_AZURE_IOT_SUCCESS; } -static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer, VOID* context) +static UINT append_device_telemetry(NX_AZURE_IOT_JSON_WRITER* json_writer) { int32_t raw_temp_data; uint32_t raw_rh_data; @@ -125,62 +124,62 @@ static void set_led_state(bool level) } } -static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context, +static void command_received_cb(AZURE_IOT_NX_CONTEXT* nx_context_ptr, const UCHAR* method, USHORT method_length, UCHAR* payload, USHORT payload_length, - VOID* context, + VOID* context_ptr, USHORT context_length) { UINT status; - UINT http_status = 501; - CHAR* http_response = "{}"; if (strncmp((CHAR*)method, SET_LED_STATE_COMMAND, method_length) == 0) { bool arg = (strncmp((CHAR*)payload, "true", payload_length) == 0); - - // Set LED state set_led_state(arg); - // Sync device twin state - azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 200, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } - http_status = 200; + azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, arg); } - - if ((status = nx_azure_iot_hub_client_direct_method_message_response(&nx_context->iothub_client, - http_status, - context, - context_length, - (UCHAR*)http_response, - strlen(http_response), - NX_WAIT_FOREVER))) + else { - printf("Direct method response failed! (0x%08x)\r\n", status); - return; + printf("Direct method is not for this device\r\n"); + + if ((status = nx_azure_iot_hub_client_command_message_response( + &nx_context_ptr->iothub_client, 501, context_ptr, context_length, NULL, 0, NX_WAIT_FOREVER))) + { + printf("Direct method response failed! (0x%08x)\r\n", status); + return; + } } } -static void device_twin_desired_property_cb(UCHAR* component_name, +static void writable_property_received_cb(AZURE_IOT_NX_CONTEXT* nx_context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { UINT status; - AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback; if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); if (status == NX_AZURE_IOT_SUCCESS) { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + // Confirm reception back to hub - azure_nx_client_respond_int_writeable_property( + azure_nx_client_respond_int_writable_property( nx_context, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval, 200, version); // Set a telemetry event so we pick up the change immediately @@ -189,17 +188,23 @@ static void device_twin_desired_property_cb(UCHAR* component_name, } } -static void device_twin_property_cb(UCHAR* component_name, +static void property_received_cb(AZURE_IOT_NX_CONTEXT* context, + const UCHAR* component_name, UINT component_name_len, UCHAR* property_name, UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback) + NX_AZURE_IOT_JSON_READER* json_reader_ptr, + UINT version) { + UINT status; + if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0) { - nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval); + status = nx_azure_iot_json_reader_token_int32_get(json_reader_ptr, &telemetry_interval); + if (status == NX_AZURE_IOT_SUCCESS) + { + printf("\tUpdating %s to %ld\r\n", TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); + } } } @@ -250,9 +255,9 @@ UINT azure_iot_nx_client_entry( } // Register the callbacks - azure_iot_nx_client_register_direct_method(&azure_iot_nx_client, direct_method_cb); - azure_iot_nx_client_register_device_twin_desired_prop(&azure_iot_nx_client, device_twin_desired_property_cb); - azure_iot_nx_client_register_device_twin_prop(&azure_iot_nx_client, device_twin_property_cb); + azure_iot_nx_client_register_command_callback(&azure_iot_nx_client, command_received_cb); + azure_iot_nx_client_register_writable_property_callback(&azure_iot_nx_client, writable_property_received_cb); + azure_iot_nx_client_register_property_callback(&azure_iot_nx_client, property_received_cb); if ((status = azure_iot_nx_client_connect(&azure_iot_nx_client))) { @@ -260,15 +265,15 @@ UINT azure_iot_nx_client_entry( return status; } - // Request the device twin for writeable property update - if ((status = azure_iot_nx_client_device_twin_request_and_wait(&azure_iot_nx_client))) + // Request the device twin for writable property update + if ((status = azure_iot_nx_client_properties_request_and_wait(&azure_iot_nx_client))) { - printf("ERROR: azure_iot_nx_client_device_twin_request_and_wait failed (0x%08x)\r\n", status); + printf("ERROR: azure_iot_nx_client_properties_request_and_wait failed (0x%08x)\r\n", status); return status; } // Send out property updates - azure_iot_nx_client_publish_int_writeable_property( + azure_iot_nx_client_publish_int_writable_property( &azure_iot_nx_client, TELEMETRY_INTERVAL_PROPERTY, telemetry_interval); azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false); azure_iot_nx_client_publish_properties( @@ -281,7 +286,7 @@ UINT azure_iot_nx_client_entry( tx_event_flags_get( &azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR_CLEAR, &events, telemetry_interval * NX_IP_PERIODIC_RATE); - azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, append_device_telemetry); + azure_iot_nx_client_publish_telemetry(&azure_iot_nx_client, NULL, append_device_telemetry); } return NX_SUCCESS; diff --git a/SiliconLabs/EFR32MG12/lib/CMakeLists.txt b/SiliconLabs/EFR32MG12/lib/CMakeLists.txt index 4ca20d91..9ce24187 100644 --- a/SiliconLabs/EFR32MG12/lib/CMakeLists.txt +++ b/SiliconLabs/EFR32MG12/lib/CMakeLists.txt @@ -17,9 +17,9 @@ set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo" set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE ON CACHE BOOL "Disable ASC") # Core libraries -add_subdirectory(${CORE_LIB_DIR}/threadx threadx) -add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo) -add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn) +add_subdirectory(${SHARED_LIB_DIR}/threadx threadx) +add_subdirectory(${SHARED_LIB_DIR}/netxduo netxduo) +add_subdirectory(${SHARED_LIB_DIR}/jsmn jsmn) # Gecko SDK add_subdirectory(gecko_sdk_3.0.0_efr32mg12) diff --git a/cmake/arm-gcc-cortex-toolchain.cmake b/cmake/arm-gcc-cortex-toolchain.cmake index 2f4e5491..39d708b0 100644 --- a/cmake/arm-gcc-cortex-toolchain.cmake +++ b/cmake/arm-gcc-cortex-toolchain.cmake @@ -34,8 +34,8 @@ endif() # Perform compiler test with the static library set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -set(CMAKE_C_COMPILER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}gcc${TOOLCHAIN_EXT} CACHE STRING "") -set(CMAKE_CXX_COMPILER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}g++${TOOLCHAIN_EXT} CACHE STRING "") +set(CMAKE_C_COMPILER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}gcc${TOOLCHAIN_EXT}) +set(CMAKE_CXX_COMPILER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}g++${TOOLCHAIN_EXT}) set(CMAKE_ASM_COMPILER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}gcc${TOOLCHAIN_EXT}) set(CMAKE_LINKER ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}gcc${TOOLCHAIN_EXT}) set(CMAKE_SIZE_UTIL ${ARM_TOOLCHAIN_PATH}/${TARGET_TRIPLET}size${TOOLCHAIN_EXT}) @@ -48,7 +48,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -set(CMAKE_COMMON_FLAGS "--specs=nano.specs -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -Wall -Wextra -Wuninitialized -Wdouble-promotion -Werror -Wno-unused-parameter") +set(CMAKE_COMMON_FLAGS "--specs=nano.specs -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -Wall -Wextra -Wuninitialized -Wshadow -Wdouble-promotion -Werror -Wno-unused-parameter") set(CMAKE_C_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} ${CMAKE_COMMON_FLAGS}") set(CMAKE_CXX_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} ${CMAKE_COMMON_FLAGS}") set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS}") diff --git a/core/lib/netxduo b/core/lib/netxduo deleted file mode 160000 index d9d7fb05..00000000 --- a/core/lib/netxduo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9d7fb05bd6a7a6b50a54c762e1730d8a8054cbb diff --git a/core/lib/threadx b/core/lib/threadx deleted file mode 160000 index d0dab582..00000000 --- a/core/lib/threadx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d0dab582506f132690b35b36ffea129ad51110b0 diff --git a/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.c b/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.c deleted file mode 100644 index e9ee2b69..00000000 --- a/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.c +++ /dev/null @@ -1,450 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - -#include "nx_azure_iot_pnp_helpers.h" - -#include - -#include "azure/core/az_json.h" -#include "nx_api.h" - -/* Telemetry message property used to indicate the message's component. */ -static const CHAR sample_pnp_telemetry_component_property[] = "$.sub"; - -/* Reported property response property keys. */ -static const CHAR sample_pnp_component_type_property_name[] = "__t"; -static const CHAR reported_component_type_value[] = "c"; -static const CHAR reported_value_property_name[] = "value"; -static const CHAR reported_status_property_name[] = "ac"; -static const CHAR reported_version_property_name[] = "av"; -static const CHAR reported_description_property_name[] = "ad"; - -/* PnP command seperator. */ -static const az_span command_separator = AZ_SPAN_LITERAL_FROM_STR("*"); - -/* Device twin keys */ -static const CHAR sample_iot_hub_twin_desired_version[] = "$version"; -static const CHAR sample_iot_hub_twin_desired[] = "desired"; - -/* Move reader to the value of property name. */ -static UINT sample_json_child_token_move( - NX_AZURE_IOT_JSON_READER* json_reader_ptr, UCHAR* property_name_ptr, UINT property_name_len) -{ - while (nx_azure_iot_json_reader_next_token(json_reader_ptr) == NX_AZURE_IOT_SUCCESS) - { - if ((nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_PROPERTY_NAME) && - nx_azure_iot_json_reader_token_is_text_equal(json_reader_ptr, property_name_ptr, property_name_len)) - { - if (nx_azure_iot_json_reader_next_token(json_reader_ptr)) - { - printf("Failed to read next token\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - return (NX_AZURE_IOT_SUCCESS); - } - else if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT) - { - if (nx_azure_iot_json_reader_skip_children(json_reader_ptr)) - { - printf("Failed to skip child of complex object\r\n"); - return (NX_NOT_SUCCESSFUL); - } - } - else if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_END_OBJECT) - { - return (NX_AZURE_IOT_NOT_FOUND); - } - } - - return (NX_AZURE_IOT_NOT_FOUND); -} - -/* Visit component property Object and call callback on each property of that component. */ -static UINT visit_component_properties(UCHAR* component_name_ptr, - UINT component_name_len, - NX_AZURE_IOT_JSON_READER* json_reader_ptr, - UINT version, - UCHAR* scratch_buf, - UINT scratch_buf_len, - VOID (*sample_desired_property_callback)(UCHAR* component_name_ptr, - UINT component_name_len, - UCHAR* property_name_ptr, - UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback), - VOID* context_ptr) -{ - UINT len; - - while (nx_azure_iot_json_reader_next_token(json_reader_ptr) == NX_AZURE_IOT_SUCCESS) - { - if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_PROPERTY_NAME) - { - if (nx_azure_iot_json_reader_token_string_get(json_reader_ptr, scratch_buf, scratch_buf_len, &len)) - { - printf("Failed to get string property value\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if (nx_azure_iot_json_reader_next_token(json_reader_ptr)) - { - printf("Failed to get next token\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if ((len == sizeof(sample_pnp_component_type_property_name) - 1) && - (memcmp((VOID*)scratch_buf, (VOID*)sample_pnp_component_type_property_name, len) == 0)) - { - continue; - } - - if ((len == sizeof(sample_iot_hub_twin_desired_version) - 1) && - (memcmp((VOID*)scratch_buf, (VOID*)sample_iot_hub_twin_desired_version, len) == 0)) - { - continue; - } - - sample_desired_property_callback( - component_name_ptr, component_name_len, scratch_buf, len, *json_reader_ptr, version, context_ptr); - } - - if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT) - { - if (nx_azure_iot_json_reader_skip_children(json_reader_ptr)) - { - printf("Failed to skip children of object\r\n"); - return (NX_NOT_SUCCESSFUL); - } - } - else if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_END_OBJECT) - { - break; - } - } - - return (NX_AZURE_IOT_SUCCESS); -} - -/* Check if component is part of component list. */ -static UINT is_component_in_model(UCHAR* component_name_ptr, - UINT component_name_len, - CHAR** sample_components_ptr, - UINT sample_components_num, - UINT* out_index) -{ - UINT index = 0; - - if (component_name_ptr == NX_NULL || component_name_len == 0) - { - return (NX_NOT_SUCCESSFUL); - } - - while (index < sample_components_num) - { - if ((component_name_len == strlen(sample_components_ptr[index])) && - (memcmp((VOID*)component_name_ptr, (VOID*)sample_components_ptr[index], component_name_len) == 0)) - { - *out_index = index; - return (NX_AZURE_IOT_SUCCESS); - } - - index++; - } - - return (NX_AZURE_IOT_NOT_FOUND); -} - -/* Parse PnP command names. */ -UINT nx_azure_iot_pnp_helper_command_name_parse(const UCHAR* method_name_ptr, - UINT method_name_length, - const UCHAR** component_name_pptr, - UINT* component_name_length_ptr, - const UCHAR** pnp_command_name_pptr, - UINT* pnp_command_name_length_ptr) -{ - INT index; - az_span method_name = az_span_create((UCHAR*)method_name_ptr, (INT)method_name_length); - - if ((index = az_span_find(method_name, command_separator)) != -1) - { - /* If a separator character is present in the device method name, then a command on a subcomponent of - the model is being targeted (e.g. thermostat1*getMaxMinReport). */ - *component_name_pptr = method_name_ptr; - *component_name_length_ptr = (UINT)index; - *pnp_command_name_pptr = method_name_ptr + index + 1; - *pnp_command_name_length_ptr = method_name_length - (UINT)index - 1; - } - else - { - /* The separator character is optional. If it is not present, it indicates a command of the root - component and not a subcomponent (e.g. "reboot"). */ - *component_name_pptr = NULL; - *component_name_length_ptr = 0; - *pnp_command_name_pptr = method_name_ptr; - *pnp_command_name_length_ptr = method_name_length; - } - - return (NX_AZURE_IOT_SUCCESS); -} - -/* Parse twin data and call callback on each desired property. */ -UINT nx_azure_iot_pnp_helper_twin_data_parse(NX_AZURE_IOT_JSON_READER* json_reader_ptr, - UINT is_partial, - CHAR** sample_components_ptr, - UINT sample_components_num, - UCHAR* scratch_buf, - UINT scratch_buf_len, - VOID (*sample_desired_property_callback)(UCHAR* component_name_ptr, - UINT component_name_len, - UCHAR* property_name_ptr, - UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback), - VOID* context_ptr) -{ - NX_AZURE_IOT_JSON_READER copy_json_reader; - UINT version; - UINT len; - UINT index; - UINT status; - - if ((status = nx_azure_iot_json_reader_next_token(json_reader_ptr))) - { - printf("Failed to initialize json reader: error %d\r\n", status); - return (status); - } - - if (!is_partial && - sample_json_child_token_move( - json_reader_ptr, (UCHAR*)sample_iot_hub_twin_desired, sizeof(sample_iot_hub_twin_desired) - 1)) - { - printf("Failed to get desired property\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - copy_json_reader = *json_reader_ptr; - if (sample_json_child_token_move(©_json_reader, - (UCHAR*)sample_iot_hub_twin_desired_version, - sizeof(sample_iot_hub_twin_desired_version) - 1) || - nx_azure_iot_json_reader_token_int32_get(©_json_reader, (int32_t*)&version)) - { - printf("Failed to get version\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - while (nx_azure_iot_json_reader_next_token(json_reader_ptr) == NX_AZURE_IOT_SUCCESS) - { - if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_PROPERTY_NAME) - { - if (nx_azure_iot_json_reader_token_string_get(json_reader_ptr, scratch_buf, scratch_buf_len, &len)) - { - printf("Failed to string value for property name\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if (nx_azure_iot_json_reader_next_token(json_reader_ptr)) - { - printf("Failed to next token\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if ((len == sizeof(sample_iot_hub_twin_desired_version) - 1) && - (memcmp((VOID*)sample_iot_hub_twin_desired_version, (VOID*)scratch_buf, len) == 0)) - { - continue; - } - - if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT && - sample_components_ptr != NX_NULL && - (is_component_in_model(scratch_buf, len, sample_components_ptr, sample_components_num, &index) == - NX_AZURE_IOT_SUCCESS)) - { - if (visit_component_properties((UCHAR*)sample_components_ptr[index], - strlen(sample_components_ptr[index]), - json_reader_ptr, - version, - scratch_buf, - scratch_buf_len, - sample_desired_property_callback, - context_ptr)) - { - printf("Failed to visit component properties\r\n"); - return (NX_NOT_SUCCESSFUL); - } - } - else - { - sample_desired_property_callback(NX_NULL, 0, scratch_buf, len, *json_reader_ptr, version, context_ptr); - - if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT) - { - if (nx_azure_iot_json_reader_skip_children(json_reader_ptr)) - { - printf("Failed to skip children of object\r\n"); - return (NX_NOT_SUCCESSFUL); - } - } - } - } - else if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT) - { - if (nx_azure_iot_json_reader_skip_children(json_reader_ptr)) - { - printf("Failed to skip children of object\r\n"); - return (NX_NOT_SUCCESSFUL); - } - } - else if (nx_azure_iot_json_reader_token_type(json_reader_ptr) == NX_AZURE_IOT_READER_TOKEN_END_OBJECT) - { - break; - } - } - - return (NX_AZURE_IOT_SUCCESS); -} - -/* Create PnP telemetry message. */ -UINT nx_azure_iot_pnp_helper_telemetry_message_create(NX_AZURE_IOT_HUB_CLIENT* iothub_client_ptr, - UCHAR* component_name, - UINT component_name_len, - NX_PACKET** packet_pptr, - UINT wait_option) -{ - UINT status; - - /* Create a telemetry message packet. */ - if ((status = nx_azure_iot_hub_client_telemetry_message_create(iothub_client_ptr, packet_pptr, wait_option))) - { - printf("Telemetry message create failed!: error code = 0x%08x\r\n", status); - } - - /* If the component will be used, then specify this as a property of the message. */ - else if ((component_name != NULL) && (status = nx_azure_iot_hub_client_telemetry_property_add(*packet_pptr, - (UCHAR*)sample_pnp_telemetry_component_property, - (USHORT)sizeof(sample_pnp_telemetry_component_property) - 1, - component_name, - (USHORT)component_name_len, - NX_WAIT_FOREVER)) != NX_AZURE_IOT_SUCCESS) - { - printf("nx_azure_iot_hub_client_telemetry_property_add=%s failed, error=%d", - sample_pnp_telemetry_component_property, - status); - nx_azure_iot_hub_client_telemetry_message_delete(*packet_pptr); - } - else - { - status = NX_AZURE_IOT_SUCCESS; - } - - return (status); -} - -/* Build PnP reported property into user provided buffer. */ -UINT nx_azure_iot_pnp_helper_build_reported_property(UCHAR* component_name_ptr, - UINT component_name_len, - UINT (*append_reported_property)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context), - VOID* context, - NX_AZURE_IOT_JSON_WRITER* json_builder_ptr) -{ - UINT status; - - if (nx_azure_iot_json_writer_append_begin_object(json_builder_ptr) || - (component_name_ptr != NX_NULL && - (nx_azure_iot_json_writer_append_property_name(json_builder_ptr, component_name_ptr, component_name_len) || - nx_azure_iot_json_writer_append_begin_object(json_builder_ptr) || - nx_azure_iot_json_writer_append_property_with_string_value(json_builder_ptr, - (UCHAR*)sample_pnp_component_type_property_name, - sizeof(sample_pnp_component_type_property_name) - 1, - (UCHAR*)reported_component_type_value, - sizeof(reported_component_type_value) - 1))) || - (append_reported_property(json_builder_ptr, context) != NX_AZURE_IOT_SUCCESS) || - (component_name_ptr != NX_NULL && nx_azure_iot_json_writer_append_end_object(json_builder_ptr)) || - nx_azure_iot_json_writer_append_end_object(json_builder_ptr)) - { - printf("Failed to build reported property\r\n"); - status = NX_NOT_SUCCESSFUL; - } - else - { - status = NX_AZURE_IOT_SUCCESS; - } - - return (status); -} - -/* Build reported property with status. */ -UINT nx_azure_iot_pnp_helper_build_reported_property_with_status(UCHAR* component_name_ptr, - UINT component_name_len, - UCHAR* property_name_ptr, - UINT property_name_len, - UINT (*append_value)(NX_AZURE_IOT_JSON_WRITER* builder, VOID* context), - VOID* context, - INT result, - UCHAR* description_ptr, - UINT description_len, - UINT ack_version, - NX_AZURE_IOT_JSON_WRITER* json_builder_ptr) -{ - if (nx_azure_iot_json_writer_append_begin_object(json_builder_ptr)) - { - printf("Failed initializing json writer \r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if (component_name_ptr != NX_NULL && - (nx_azure_iot_json_writer_append_property_name(json_builder_ptr, component_name_ptr, component_name_len) || - nx_azure_iot_json_writer_append_begin_object(json_builder_ptr) || - nx_azure_iot_json_writer_append_property_with_string_value(json_builder_ptr, - (UCHAR*)sample_pnp_component_type_property_name, - sizeof(sample_pnp_component_type_property_name) - 1, - (UCHAR*)reported_component_type_value, - sizeof(reported_component_type_value) - 1))) - { - printf("Failed build reported property with status message \r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if (nx_azure_iot_json_writer_append_property_name(json_builder_ptr, property_name_ptr, property_name_len) || - nx_azure_iot_json_writer_append_begin_object(json_builder_ptr) || - nx_azure_iot_json_writer_append_property_name( - json_builder_ptr, (UCHAR*)reported_value_property_name, sizeof(reported_value_property_name) - 1) || - (append_value(json_builder_ptr, context) != NX_AZURE_IOT_SUCCESS) || - nx_azure_iot_json_writer_append_property_with_int32_value(json_builder_ptr, - (UCHAR*)reported_status_property_name, - sizeof(reported_status_property_name) - 1, - result) || - nx_azure_iot_json_writer_append_property_with_string_value(json_builder_ptr, - (UCHAR*)reported_description_property_name, - sizeof(reported_description_property_name) - 1, - description_ptr, - description_len) || - nx_azure_iot_json_writer_append_property_with_int32_value(json_builder_ptr, - (UCHAR*)reported_version_property_name, - sizeof(reported_version_property_name) - 1, - (INT)ack_version) || - nx_azure_iot_json_writer_append_end_object(json_builder_ptr) || - nx_azure_iot_json_writer_append_end_object(json_builder_ptr)) - { - printf("Failed build reported property with status message\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - if (component_name_ptr != NX_NULL && nx_azure_iot_json_writer_append_end_object(json_builder_ptr)) - { - printf("Failed build reported property with status message\r\n"); - return (NX_NOT_SUCCESSFUL); - } - - return (NX_AZURE_IOT_SUCCESS); -} diff --git a/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.h b/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.h deleted file mode 100644 index ca0bcfbc..00000000 --- a/core/src/azure_iot_nx/nx_azure_iot_pnp_helpers.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) Microsoft Corporation. All rights reserved. */ -/* */ -/* This software is licensed under the Microsoft Software License */ -/* Terms for Microsoft Azure RTOS. Full text of the license can be */ -/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ -/* and in the root directory of this software. */ -/* */ -/**************************************************************************/ - -#ifndef NX_AZURE_IOT_PNP_HELPERS_H -#define NX_AZURE_IOT_PNP_HELPERS_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include "nx_api.h" -#include "nx_azure_iot_hub_client.h" -#include "nx_azure_iot_json_reader.h" -#include "nx_azure_iot_json_writer.h" - - /** - * @brief Parse PnP command name - * - * @param[in] method_name_ptr Pointer to method name - * @param[in] method_name_length Length of method name - * @param[out] component_name_pptr Pointer to component pointer - * @param[out] component_name_length_ptr Pointer to length of component name length - * @param[out] pnp_command_name_pptr Pointer to command name pointer - * @param[out] pnp_command_name_length_ptr Pointer to length of command name - * @return A `UINT` with the result of the API. - * @retval #NX_AZURE_IOT_SUCCESS Successful if successful parsed command name. - */ - UINT nx_azure_iot_pnp_helper_command_name_parse(const UCHAR* method_name_ptr, - UINT method_name_length, - const UCHAR** component_name_pptr, - UINT* component_name_length_ptr, - const UCHAR** pnp_command_name_pptr, - UINT* pnp_command_name_length_ptr); - - /** - * @brief Parse twin data and call callback on each desired property - * - * @param[in] json_reader_ptr `NX_AZURE_IOT_JSON_READER` pointer containing the twin data - * @param[in] is_partial 1 if twin data is patch else 0 if full twin document - * @param[in] sample_components_ptr Pointer to list of all components name pointers - * @param[in] sample_components_num Size of component list - * @param[in] scratch_buf Temporary buffer used for staging property names out of the JSON document - * @param[in] scratch_buf_len Temporary buffer length size - * @param[in] sample_desired_property_callback Callback called with each desired property - * @param[in] context_ptr Context passed to the callback - * @return A `UINT` with the result of the API. - * @retval #NX_AZURE_IOT_SUCCESS Successful if successful parsed twin data. - */ - UINT nx_azure_iot_pnp_helper_twin_data_parse(NX_AZURE_IOT_JSON_READER* json_reader_ptr, - UINT is_partial, - CHAR** sample_components_ptr, - UINT sample_components_num, - UCHAR* scratch_buf, - UINT scratch_buf_len, - VOID (*sample_desired_property_callback)(UCHAR* component_name_ptr, - UINT component_name_len, - UCHAR* property_name_ptr, - UINT property_name_len, - NX_AZURE_IOT_JSON_READER property_value_reader, - UINT version, - VOID* userContextCallback), - VOID* context_ptr); - - /** - * @brief Create PnP telemetry message - * - * @param[in] iothub_client_ptr Pointer to `NX_AZURE_IOT_HUB_CLIENT` - * @param[in] component_name Pointer to component name - * @param[in] component_name_len Length of component name - * @param[out] packet_pptr `NX_PACKET` return via the API. - * @param[in] wait_option Ticks to wait if no packet is available. - * @return A `UINT` with the result of the API. - * @retval #NX_AZURE_IOT_SUCCESS Successful if successful created NX_PACKET. - */ - UINT nx_azure_iot_pnp_helper_telemetry_message_create(NX_AZURE_IOT_HUB_CLIENT* iothub_client_ptr, - UCHAR* component_name, - UINT component_name_len, - NX_PACKET** packet_pptr, - UINT wait_option); - - /** - * @brief Build PnP reported property into user provided buffer - * - * @param[in] component_name_ptr Pointer to component name - * @param[in] component_name_len Length of component name - * @param[in] append_reported_property Callback to add reported property - * @param[in] context Context pass to callback - * @param[out] json_builder_ptr Pointer to `NX_AZURE_IOT_JSON_WRITER`, containing the json reported property - * @return A `UINT` with the result of the API. - * @retval #NX_AZURE_IOT_SUCCESS Successful if successful created reported property message. - */ - UINT nx_azure_iot_pnp_helper_build_reported_property(UCHAR* component_name_ptr, - UINT component_name_len, - UINT (*append_reported_property)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context), - VOID* context, - NX_AZURE_IOT_JSON_WRITER* json_builder_ptr); - - /** - * @brief Build reported property with status - * - * @param[in] component_name_ptr Pointer to component name - * @param[in] component_name_len Length of component name - * @param[in] property_name_ptr Pointer to property name - * @param[in] property_name_len Length of property name - * @param[in] append_value Callback to add property value - * @param[in] context Context pass to callback - * @param[in] result Status for reported property - * @param[in] description Pointer to description - * @param[in] description_len Length of description - * @param[in] ack_version ack version - * @param[out] json_builder_ptr Pointer to `NX_AZURE_IOT_JSON_WRITER`, containing the json reported property - * @return A `UINT` with the result of the API. - * @retval #NX_AZURE_IOT_SUCCESS Successful if successful created reported property message. - */ - UINT nx_azure_iot_pnp_helper_build_reported_property_with_status(UCHAR* component_name_ptr, - UINT component_name_len, - UCHAR* property_name_ptr, - UINT property_name_len, - UINT (*append_value)(NX_AZURE_IOT_JSON_WRITER* builder, VOID* context), - VOID* context, - INT result, - UCHAR* description_ptr, - UINT description_len, - UINT ack_version, - NX_AZURE_IOT_JSON_WRITER* json_builder_ptr); - -#ifdef __cplusplus -} -#endif -#endif /* NX_AZURE_IOT_PNP_HELPERS_H */ \ No newline at end of file diff --git a/core/lib/jsmn/CMakeLists.txt b/shared/lib/jsmn/CMakeLists.txt similarity index 100% rename from core/lib/jsmn/CMakeLists.txt rename to shared/lib/jsmn/CMakeLists.txt diff --git a/core/lib/jsmn/jsmn.c b/shared/lib/jsmn/jsmn.c similarity index 100% rename from core/lib/jsmn/jsmn.c rename to shared/lib/jsmn/jsmn.c diff --git a/core/lib/jsmn/src b/shared/lib/jsmn/src similarity index 100% rename from core/lib/jsmn/src rename to shared/lib/jsmn/src diff --git a/shared/lib/netxduo b/shared/lib/netxduo new file mode 160000 index 00000000..185bca73 --- /dev/null +++ b/shared/lib/netxduo @@ -0,0 +1 @@ +Subproject commit 185bca73cc6cafbbc612ed94d5866502a020f29c diff --git a/shared/lib/threadx b/shared/lib/threadx new file mode 160000 index 00000000..b216ceb2 --- /dev/null +++ b/shared/lib/threadx @@ -0,0 +1 @@ +Subproject commit b216ceb25e2b6ae1ea83c1ae91d114a6fc2fc4ec diff --git a/core/model/deviceinformation-1.json b/shared/model/deviceinformation-1.json similarity index 100% rename from core/model/deviceinformation-1.json rename to shared/model/deviceinformation-1.json diff --git a/core/model/gsg-1.json b/shared/model/gsg-1.json similarity index 100% rename from core/model/gsg-1.json rename to shared/model/gsg-1.json diff --git a/core/model/gsg-2.json b/shared/model/gsg-2.json similarity index 100% rename from core/model/gsg-2.json rename to shared/model/gsg-2.json diff --git a/core/model/gsgmqtt-1.json b/shared/model/gsgmqtt-1.json similarity index 100% rename from core/model/gsgmqtt-1.json rename to shared/model/gsgmqtt-1.json diff --git a/core/model/gsgmxchip-1.json b/shared/model/gsgmxchip-1.json similarity index 100% rename from core/model/gsgmxchip-1.json rename to shared/model/gsgmxchip-1.json diff --git a/core/model/gsgmxchip-2.json b/shared/model/gsgmxchip-2.json similarity index 100% rename from core/model/gsgmxchip-2.json rename to shared/model/gsgmxchip-2.json diff --git a/core/model/gsgrx65ncloud-1.json b/shared/model/gsgrx65ncloud-1.json similarity index 100% rename from core/model/gsgrx65ncloud-1.json rename to shared/model/gsgrx65ncloud-1.json diff --git a/core/model/readme.md b/shared/model/readme.md similarity index 55% rename from core/model/readme.md rename to shared/model/readme.md index cdc46824..59685fa6 100644 --- a/core/model/readme.md +++ b/shared/model/readme.md @@ -1,2 +1,6 @@ -The models are registered in the Azure IoT Model repository + +# Azure RTOS Samples Models + +The models are registered in the Azure IoT Model repository: + * [Azure IoT PNP Model Repository](https://github.com/Azure/iot-plugandplay-models/tree/main/dtmi/azurertos/devkit) diff --git a/core/src/CMakeLists.txt b/shared/src/CMakeLists.txt similarity index 87% rename from core/src/CMakeLists.txt rename to shared/src/CMakeLists.txt index 95ad15c9..e881f56b 100644 --- a/core/src/CMakeLists.txt +++ b/shared/src/CMakeLists.txt @@ -9,13 +9,11 @@ set(SOURCES azure_iot_mqtt/hmac_sha256.c azure_iot_mqtt/sas_token.c azure_iot_mqtt/sha256.c + azure_iot_mqtt/json_utils.c - azure_iot_nx/azure_iot_nx_client.c - azure_iot_nx/nx_azure_iot_pnp_helpers.c - + azure_iot_nx_client.c azure_iot_cert.c azure_iot_ciphersuites.c - json_utils.c sntp_client.c ) @@ -41,7 +39,6 @@ target_include_directories(${TARGET} PUBLIC . azure_iot_mqtt - azure_iot_nx ) target_link_libraries(${TARGET} diff --git a/core/src/azure_iot_cert.c b/shared/src/azure_iot_cert.c similarity index 100% rename from core/src/azure_iot_cert.c rename to shared/src/azure_iot_cert.c diff --git a/core/src/azure_iot_cert.h b/shared/src/azure_iot_cert.h similarity index 100% rename from core/src/azure_iot_cert.h rename to shared/src/azure_iot_cert.h diff --git a/core/src/azure_iot_ciphersuites.c b/shared/src/azure_iot_ciphersuites.c similarity index 100% rename from core/src/azure_iot_ciphersuites.c rename to shared/src/azure_iot_ciphersuites.c diff --git a/core/src/azure_iot_ciphersuites.h b/shared/src/azure_iot_ciphersuites.h similarity index 100% rename from core/src/azure_iot_ciphersuites.h rename to shared/src/azure_iot_ciphersuites.h diff --git a/core/src/azure_iot_mqtt/azure_iot_dps_mqtt.c b/shared/src/azure_iot_mqtt/azure_iot_dps_mqtt.c similarity index 100% rename from core/src/azure_iot_mqtt/azure_iot_dps_mqtt.c rename to shared/src/azure_iot_mqtt/azure_iot_dps_mqtt.c diff --git a/core/src/azure_iot_mqtt/azure_iot_dps_mqtt.h b/shared/src/azure_iot_mqtt/azure_iot_dps_mqtt.h similarity index 100% rename from core/src/azure_iot_mqtt/azure_iot_dps_mqtt.h rename to shared/src/azure_iot_mqtt/azure_iot_dps_mqtt.h diff --git a/core/src/azure_iot_mqtt/azure_iot_mqtt.c b/shared/src/azure_iot_mqtt/azure_iot_mqtt.c similarity index 100% rename from core/src/azure_iot_mqtt/azure_iot_mqtt.c rename to shared/src/azure_iot_mqtt/azure_iot_mqtt.c diff --git a/core/src/azure_iot_mqtt/azure_iot_mqtt.h b/shared/src/azure_iot_mqtt/azure_iot_mqtt.h similarity index 100% rename from core/src/azure_iot_mqtt/azure_iot_mqtt.h rename to shared/src/azure_iot_mqtt/azure_iot_mqtt.h diff --git a/core/src/azure_iot_mqtt/hmac_sha256.c b/shared/src/azure_iot_mqtt/hmac_sha256.c similarity index 100% rename from core/src/azure_iot_mqtt/hmac_sha256.c rename to shared/src/azure_iot_mqtt/hmac_sha256.c diff --git a/core/src/azure_iot_mqtt/hmac_sha256.h b/shared/src/azure_iot_mqtt/hmac_sha256.h similarity index 100% rename from core/src/azure_iot_mqtt/hmac_sha256.h rename to shared/src/azure_iot_mqtt/hmac_sha256.h diff --git a/core/src/json_utils.c b/shared/src/azure_iot_mqtt/json_utils.c similarity index 100% rename from core/src/json_utils.c rename to shared/src/azure_iot_mqtt/json_utils.c diff --git a/core/src/json_utils.h b/shared/src/azure_iot_mqtt/json_utils.h similarity index 100% rename from core/src/json_utils.h rename to shared/src/azure_iot_mqtt/json_utils.h diff --git a/core/src/azure_iot_mqtt/sas_token.c b/shared/src/azure_iot_mqtt/sas_token.c similarity index 100% rename from core/src/azure_iot_mqtt/sas_token.c rename to shared/src/azure_iot_mqtt/sas_token.c diff --git a/core/src/azure_iot_mqtt/sas_token.h b/shared/src/azure_iot_mqtt/sas_token.h similarity index 100% rename from core/src/azure_iot_mqtt/sas_token.h rename to shared/src/azure_iot_mqtt/sas_token.h diff --git a/core/src/azure_iot_mqtt/sha256.c b/shared/src/azure_iot_mqtt/sha256.c similarity index 100% rename from core/src/azure_iot_mqtt/sha256.c rename to shared/src/azure_iot_mqtt/sha256.c diff --git a/core/src/azure_iot_mqtt/sha256.h b/shared/src/azure_iot_mqtt/sha256.h similarity index 100% rename from core/src/azure_iot_mqtt/sha256.h rename to shared/src/azure_iot_mqtt/sha256.h diff --git a/core/src/azure_iot_nx/azure_iot_nx_client.c b/shared/src/azure_iot_nx_client.c similarity index 52% rename from core/src/azure_iot_nx/azure_iot_nx_client.c rename to shared/src/azure_iot_nx_client.c index e0a96705..c38a83ff 100644 --- a/core/src/azure_iot_nx/azure_iot_nx_client.c +++ b/shared/src/azure_iot_nx_client.c @@ -5,28 +5,27 @@ #include +#include "nx_azure_iot_hub_client.h" +#include "nx_azure_iot_hub_client_properties.h" + #include "azure_iot_cert.h" #include "azure_iot_ciphersuites.h" -#include "nx_azure_iot_pnp_helpers.h" #define NX_AZURE_IOT_THREAD_PRIORITY 4 #define THREAD_PRIORITY 16 // Incoming events from the middleware -#define ALL_EVENTS 0xFF -#define DIRECT_METHOD_EVENT 0x01 -#define DEVICE_TWIN_GET_EVENT 0x02 -#define DEVICE_TWIN_DESIRED_PROPERTY_EVENT 0x04 -#define DEVICE_TWIN_COMPLETE_EVENT 0x08 +#define ALL_EVENTS 0xFF +#define COMMAND_RECEIVE_EVENT 0x01 +#define PROPERTIES_RECEIVE_EVENT 0x02 +#define WRITABLE_PROPERTIES_RECEIVE_EVENT 0x04 +#define PROPERTIES_COMPLETE_EVENT 0x08 #define AZURE_IOT_DPS_ENDPOINT "global.azure-devices-provisioning.net" #define MODULE_ID "" #define DPS_PAYLOAD "{\"modelId\":\"%s\"}" -#define DPS_PAYLOAD_SIZE 200 -#define PUBLISH_BUFFER_SIZE 512 - #define MAX_EXPONENTIAL_BACKOFF_JITTER_PERCENT 60 #define MAX_EXPONENTIAL_BACKOFF_IN_SEC (10 * 60) #define INITIAL_EXPONENTIAL_BACKOFF_IN_SEC 3 @@ -35,6 +34,26 @@ #define HUB_CONNECT_TIMEOUT_TICKS (10 * TX_TIMER_TICKS_PER_SECOND) #define DPS_REGISTER_TIMEOUT_TICKS (3 * TX_TIMER_TICKS_PER_SECOND) +#define DPS_PAYLOAD_SIZE 200 +#define TELEMETRY_BUFFER_SIZE 256 +#define PROPERTIES_BUFFER_SIZE 128 + +static UCHAR telemetry_buffer[TELEMETRY_BUFFER_SIZE]; +static UCHAR properties_buffer[PROPERTIES_BUFFER_SIZE]; + +static VOID printf_packet(CHAR* prepend, NX_PACKET* packet_ptr) +{ + printf("%s", prepend); + + while (packet_ptr != NX_NULL) + { + printf("%.*s", (INT)(packet_ptr->nx_packet_length), (CHAR*)packet_ptr->nx_packet_prepend_ptr); + packet_ptr = packet_ptr->nx_packet_next; + } + + printf("\r\n"); +} + static UINT exponential_backoff_with_jitter(UINT* exponential_retry_count) { float jitter_percent = (MAX_EXPONENTIAL_BACKOFF_JITTER_PERCENT / 100.0f) * (rand() / ((float)RAND_MAX)); @@ -79,171 +98,223 @@ static VOID connection_status_callback(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, } } -static VOID message_receive_direct_method(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) +static VOID message_receive_command(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) { AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)context; - tx_event_flags_set(&nx_context->events, DIRECT_METHOD_EVENT, TX_OR); + tx_event_flags_set(&nx_context->events, COMMAND_RECEIVE_EVENT, TX_OR); } -static VOID message_receive_callback_twin(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) +static VOID message_receive_callback_properties(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) { AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)context; - tx_event_flags_set(&nx_context->events, DEVICE_TWIN_GET_EVENT, TX_OR); + tx_event_flags_set(&nx_context->events, PROPERTIES_RECEIVE_EVENT, TX_OR); } -static VOID message_receive_callback_desire_property(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) +static VOID message_receive_callback_writable_property(NX_AZURE_IOT_HUB_CLIENT* hub_client_ptr, VOID* context) { AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)context; - tx_event_flags_set(&nx_context->events, DEVICE_TWIN_DESIRED_PROPERTY_EVENT, TX_OR); + tx_event_flags_set(&nx_context->events, WRITABLE_PROPERTIES_RECEIVE_EVENT, TX_OR); } -static VOID process_direct_method(AZURE_IOT_NX_CONTEXT* nx_context) +static VOID process_command(AZURE_IOT_NX_CONTEXT* nx_context) { UINT status; - NX_PACKET* packet; - const UCHAR* method_name; - USHORT method_name_length; - VOID* context; + const UCHAR* component_name_ptr; + USHORT component_name_length; + const UCHAR* command_name_ptr; + USHORT command_name_length; + VOID* context_ptr; USHORT context_length; - UCHAR* payload; + UCHAR* payload_ptr; USHORT payload_length; + NX_PACKET* packet_ptr; - while ((status = nx_azure_iot_hub_client_direct_method_message_receive(&nx_context->iothub_client, - &method_name, - &method_name_length, - &context, + while ((status = nx_azure_iot_hub_client_command_message_receive(&nx_context->iothub_client, + &component_name_ptr, + &component_name_length, + &command_name_ptr, + &command_name_length, + &context_ptr, &context_length, - &packet, + &packet_ptr, NX_NO_WAIT)) == NX_AZURE_IOT_SUCCESS) { - printf("Receive direct method: %.*s\r\n", (INT)method_name_length, (CHAR*)method_name); - printf_packet(packet, "\tPayload: "); + printf("Received command: %.*s\r\n", (INT)command_name_length, (CHAR*)command_name_ptr); + printf_packet("\tPayload: ", packet_ptr); - payload = packet->nx_packet_prepend_ptr; - payload_length = packet->nx_packet_append_ptr - packet->nx_packet_prepend_ptr; + payload_ptr = packet_ptr->nx_packet_prepend_ptr; + payload_length = packet_ptr->nx_packet_append_ptr - packet_ptr->nx_packet_prepend_ptr; - if (nx_context->direct_method_cb) + if (nx_context->command_received_cb) { - nx_context->direct_method_cb( - nx_context, method_name, method_name_length, payload, payload_length, context, context_length); + nx_context->command_received_cb(nx_context, + command_name_ptr, + command_name_length, + payload_ptr, + payload_length, + context_ptr, + context_length); } // Release the received packet, as ownership was passed to the application from the middleware - nx_packet_release(packet); + nx_packet_release(packet_ptr); } // If we failed for anything other than no packet, then report error if (status != NX_AZURE_IOT_NO_PACKET) { - printf("ERROR: direct method receive failed (0x%08x)\r\n", status); + printf("Error: Command receive failed (0x%08x)\r\n", status); return; } } -static VOID process_device_twin_get(AZURE_IOT_NX_CONTEXT* nx_context) +static UINT process_properties_shared(AZURE_IOT_NX_CONTEXT* nx_context, + NX_PACKET* packet_ptr, + UINT message_type, + UINT property_type, + UCHAR* scratch_buffer, + UINT scratch_buffer_len, + func_ptr_property_received property_received_cb) { UINT status; - NX_PACKET* packet_ptr; + const UCHAR* component_name_ptr; + USHORT component_name_length = 0; + UINT property_name_length; + ULONG properties_version; NX_AZURE_IOT_JSON_READER json_reader; - UCHAR buffer[PUBLISH_BUFFER_SIZE]; - if ((status = nx_azure_iot_hub_client_device_twin_properties_receive( - &nx_context->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) + if ((status = nx_azure_iot_json_reader_init(&json_reader, packet_ptr))) { - printf("Error: receive device twin property failed (0x%08x)\r\n", status); - return; + printf("Error: failed to initialize json reader (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); + return status; } - printf_packet(packet_ptr, "Receive twin properties: "); + // Get the version + if ((status = nx_azure_iot_hub_client_properties_version_get( + &nx_context->iothub_client, &json_reader, message_type, &properties_version))) + { + printf("Error: Properties version get failed (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); + return status; + } - if (packet_ptr->nx_packet_length > (ULONG)(packet_ptr->nx_packet_append_ptr - packet_ptr->nx_packet_prepend_ptr)) + if ((status = nx_azure_iot_json_reader_init(&json_reader, packet_ptr))) { - printf("ERROR: json is large than nx_packet\r\n"); + printf("Init json reader failed!: error code = 0x%08x\r\n", status); nx_packet_release(packet_ptr); - return; + return status; } if ((status = nx_azure_iot_json_reader_init(&json_reader, packet_ptr))) { - printf("ERROR: failed to initialize json reader (0x%08x)\r\n", status); + printf("Error: failed to initialize json reader (0x%08x)\r\n", status); nx_packet_release(packet_ptr); - return; + return status; } - if (nx_context->device_twin_get_cb) + while ((status = nx_azure_iot_hub_client_properties_component_property_next_get(&nx_context->iothub_client, + &json_reader, + message_type, + property_type, + &component_name_ptr, + &component_name_length)) == NX_AZURE_IOT_SUCCESS) { - if ((status = nx_azure_iot_pnp_helper_twin_data_parse(&json_reader, - NX_FALSE, - NX_NULL, - 0, - buffer, - PUBLISH_BUFFER_SIZE, - nx_context->device_twin_get_cb, - nx_context))) + if (nx_azure_iot_json_reader_token_string_get( + &json_reader, scratch_buffer, scratch_buffer_len, &property_name_length)) { - printf("ERROR: failed to parse twin data (0x%08x)\r\n", status); + printf("Failed to get string property value\r\n"); + return NX_NOT_SUCCESSFUL; } - } - // Deinit the reader, the reader owns the NX_PACKET at this point, so will release it - nx_azure_iot_json_reader_deinit(&json_reader); + nx_azure_iot_json_reader_next_token(&json_reader); - // Send event to notify device twin received - tx_event_flags_set(&nx_context->events, DEVICE_TWIN_COMPLETE_EVENT, TX_OR); + property_received_cb(nx_context, + component_name_ptr, + component_name_length, + scratch_buffer, + property_name_length, + &json_reader, + properties_version); + + // If we are still looking at the value, then skip over it (including if it has children) + if (nx_azure_iot_json_reader_token_type(&json_reader) == NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT) + { + nx_azure_iot_json_reader_skip_children(&json_reader); + } + + nx_azure_iot_json_reader_next_token(&json_reader); + } + + return NX_AZURE_IOT_SUCCESS; } -static VOID process_device_twin_desired_property(AZURE_IOT_NX_CONTEXT* nx_context) +static VOID process_properties(AZURE_IOT_NX_CONTEXT* nx_context) { UINT status; NX_PACKET* packet_ptr; - NX_AZURE_IOT_JSON_READER json_reader; - UCHAR buffer[128]; - while ((status = nx_azure_iot_hub_client_device_twin_desired_properties_receive( - &nx_context->iothub_client, &packet_ptr, NX_NO_WAIT)) == NX_AZURE_IOT_SUCCESS) + if ((status = nx_azure_iot_hub_client_properties_receive(&nx_context->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf_packet(packet_ptr, "Receive twin writeable property: "); + printf("Error: nx_azure_iot_hub_client_properties_receive failed (0x%08x)\r\n", status); + return; + } - if (packet_ptr->nx_packet_length > - (ULONG)(packet_ptr->nx_packet_append_ptr - packet_ptr->nx_packet_prepend_ptr)) - { - printf("ERROR: json is large than nx_packet\r\n"); - nx_packet_release(packet_ptr); - continue; - } + printf_packet("Receive properties: ", packet_ptr); - if ((status = nx_azure_iot_json_reader_init(&json_reader, packet_ptr))) + if (nx_context->property_received_cb) + { + // Parse the writable properties from the device twin receive receive message + if ((status = process_properties_shared(nx_context, + packet_ptr, + NX_AZURE_IOT_HUB_PROPERTIES, + NX_AZURE_IOT_HUB_CLIENT_PROPERTY_WRITABLE, + properties_buffer, + sizeof(properties_buffer), + nx_context->property_received_cb))) { - printf("ERROR: failed to initialize json reader (0x%08x)\r\n", status); - nx_packet_release(packet_ptr); - continue; + printf("Error: failed to parse properties (0x%08x)\r\n", status); } + } - if (nx_context->device_twin_desired_prop_cb) - { - if ((status = nx_azure_iot_pnp_helper_twin_data_parse(&json_reader, - NX_TRUE, - NX_NULL, - 0, - buffer, - sizeof(buffer), - nx_context->device_twin_desired_prop_cb, - nx_context))) - { - printf("ERROR: failed to parse twin data (0x%08x)\r\n", status); - } - } + // Release the received packet, as ownership was passed to the application from the middleware + nx_packet_release(packet_ptr); - // Deinit the reader, the reader owns the NX_PACKET at this point, so will release it - nx_azure_iot_json_reader_deinit(&json_reader); - } + // Send event to notify device twin received + tx_event_flags_set(&nx_context->events, PROPERTIES_COMPLETE_EVENT, TX_OR); +} - // If we failed for anything other than no packet, then report error - if (status != NX_AZURE_IOT_NO_PACKET) +static VOID process_writable_properties(AZURE_IOT_NX_CONTEXT* nx_context) +{ + UINT status; + NX_PACKET* packet_ptr; + + if ((status = nx_azure_iot_hub_client_writable_properties_receive( + &nx_context->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf("ERROR: device twin writeable property receive failed (0x%08x)\r\n", status); + printf("Error: nx_azure_iot_hub_client_writable_properties_receive failed (0x%08x)\r\n", status); return; } + + printf_packet("Receive properties: ", packet_ptr); + + if (nx_context->property_received_cb) + { + // Parse the writable properties from the writable receive message + if ((status = process_properties_shared(nx_context, + packet_ptr, + NX_AZURE_IOT_HUB_WRITABLE_PROPERTIES, + NX_AZURE_IOT_HUB_CLIENT_PROPERTY_WRITABLE, + properties_buffer, + sizeof(properties_buffer), + nx_context->property_received_cb))) + { + printf("Error: failed to parse properties (0x%08x)\r\n", status); + } + } + + // Release the received packet, as ownership was passed to the application from the middleware + nx_packet_release(packet_ptr); } static VOID event_thread(ULONG parameter) @@ -256,19 +327,19 @@ static VOID event_thread(ULONG parameter) { tx_event_flags_get(&context->events, ALL_EVENTS, TX_OR_CLEAR, &app_events, NX_IP_PERIODIC_RATE); - if (app_events & DIRECT_METHOD_EVENT) + if (app_events & COMMAND_RECEIVE_EVENT) { - process_direct_method(context); + process_command(context); } - if (app_events & DEVICE_TWIN_GET_EVENT) + if (app_events & PROPERTIES_RECEIVE_EVENT) { - process_device_twin_get(context); + process_properties(context); } - if (app_events & DEVICE_TWIN_DESIRED_PROPERTY_EVENT) + if (app_events & WRITABLE_PROPERTIES_RECEIVE_EVENT) { - process_device_twin_desired_property(context); + process_writable_properties(context); } app_events = 0; @@ -301,7 +372,7 @@ static UINT azure_iot_nx_client_hub_create_internal(AZURE_IOT_NX_CONTEXT* contex sizeof(context->nx_azure_iot_tls_metadata_buffer), &context->root_ca_cert))) { - printf("ERROR: on nx_azure_iot_hub_client_initialize (0x%08x)\r\n", status); + printf("Error: on nx_azure_iot_hub_client_initialize (0x%08x)\r\n", status); return status; } @@ -313,7 +384,7 @@ static UINT azure_iot_nx_client_hub_create_internal(AZURE_IOT_NX_CONTEXT* contex (UCHAR*)context->azure_iot_device_sas_key, context->azure_iot_device_sas_key_len))) { - printf("ERROR: failed on nx_azure_iot_hub_client_symmetric_key_set (0x%08x)\r\n", status); + printf("Error: failed on nx_azure_iot_hub_client_symmetric_key_set (0x%08x)\r\n", status); } } else if (context->azure_iot_auth_mode == AZURE_IOT_AUTH_MODE_CERT) @@ -321,7 +392,7 @@ static UINT azure_iot_nx_client_hub_create_internal(AZURE_IOT_NX_CONTEXT* contex // X509 Certificate if ((status = nx_azure_iot_hub_client_device_cert_set(&context->iothub_client, &context->device_certificate))) { - printf("ERROR: failed on nx_azure_iot_hub_client_device_cert_set!: error code = 0x%08x\r\n", status); + printf("Error: failed on nx_azure_iot_hub_client_device_cert_set!: error code = 0x%08x\r\n", status); } } @@ -329,53 +400,51 @@ static UINT azure_iot_nx_client_hub_create_internal(AZURE_IOT_NX_CONTEXT* contex if ((status = nx_azure_iot_hub_client_model_id_set( &context->iothub_client, (UCHAR*)context->azure_iot_model_id, strlen(context->azure_iot_model_id)))) { - printf("ERROR: nx_azure_iot_hub_client_model_id_set (0x%08x)\r\n", status); + printf("Error: nx_azure_iot_hub_client_model_id_set (0x%08x)\r\n", status); } // Set connection status callback else if ((status = nx_azure_iot_hub_client_connection_status_callback_set( &context->iothub_client, connection_status_callback))) { - printf("ERROR: failed on connection_status_callback (0x%08x)\r\n", status); + printf("Error: failed on connection_status_callback (0x%08x)\r\n", status); } - // Enable direct methods - else if ((status = nx_azure_iot_hub_client_direct_method_enable(&context->iothub_client))) + // Enable commands + else if ((status = nx_azure_iot_hub_client_command_enable(&context->iothub_client))) { - printf("ERROR: direct method receive enable failed (0x%08x)\r\n", status); + printf("Error: command receive enable failed (0x%08x)\r\n", status); } - // Enable device twin - else if ((status = nx_azure_iot_hub_client_device_twin_enable(&context->iothub_client))) + // Enable properties + else if ((status = nx_azure_iot_hub_client_properties_enable(&context->iothub_client))) { - printf("ERROR: device twin enabled failed (0x%08x)\r\n", status); + printf("Failed on nx_azure_iot_hub_client_properties_enable!: error code = 0x%08x\r\n", status); } - // Set device twin callback + // Set properties callback else if ((status = nx_azure_iot_hub_client_receive_callback_set(&context->iothub_client, - NX_AZURE_IOT_HUB_DEVICE_TWIN_PROPERTIES, - message_receive_callback_twin, + NX_AZURE_IOT_HUB_PROPERTIES, + message_receive_callback_properties, (VOID*)context))) { - printf("ERROR: device twin callback set (0x%08x)\r\n", status); + printf("Error: device twin callback set (0x%08x)\r\n", status); } - // Set direct method callback - else if ((status = nx_azure_iot_hub_client_receive_callback_set(&context->iothub_client, - NX_AZURE_IOT_HUB_DIRECT_METHOD, - message_receive_direct_method, - (VOID*)context))) + // Set command callback + else if ((status = nx_azure_iot_hub_client_receive_callback_set( + &context->iothub_client, NX_AZURE_IOT_HUB_COMMAND, message_receive_command, (VOID*)context))) { - printf("ERROR: device method callback set (0x%08x)\r\n", status); + printf("Error: device method callback set (0x%08x)\r\n", status); } - // Set the writeable property callback + // Set the writable property callback else if ((status = nx_azure_iot_hub_client_receive_callback_set(&context->iothub_client, - NX_AZURE_IOT_HUB_DEVICE_TWIN_DESIRED_PROPERTIES, - message_receive_callback_desire_property, + NX_AZURE_IOT_HUB_WRITABLE_PROPERTIES, + message_receive_callback_writable_property, (VOID*)context))) { - printf("ERROR: device twin desired property callback set (0x%08x)\r\n", status); + printf("Error: device twin desired property callback set (0x%08x)\r\n", status); } if (status != NX_AZURE_IOT_SUCCESS) @@ -386,37 +455,37 @@ static UINT azure_iot_nx_client_hub_create_internal(AZURE_IOT_NX_CONTEXT* contex return status; } -UINT azure_iot_nx_client_register_direct_method(AZURE_IOT_NX_CONTEXT* context, func_ptr_direct_method callback) +UINT azure_iot_nx_client_register_command_callback(AZURE_IOT_NX_CONTEXT* context, func_ptr_command_received callback) { - if (context == NULL || context->direct_method_cb != NULL) + if (context == NULL || context->command_received_cb != NULL) { return NX_PTR_ERROR; } - context->direct_method_cb = callback; + context->command_received_cb = callback; return NX_SUCCESS; } -UINT azure_iot_nx_client_register_device_twin_desired_prop( - AZURE_IOT_NX_CONTEXT* context, func_ptr_device_twin_desired_prop callback) +UINT azure_iot_nx_client_register_writable_property_callback( + AZURE_IOT_NX_CONTEXT* context, func_ptr_writable_property_received callback) { - if (context == NULL || context->device_twin_desired_prop_cb != NULL) + if (context == NULL || context->writable_property_received_cb != NULL) { return NX_PTR_ERROR; } - context->device_twin_desired_prop_cb = callback; + context->writable_property_received_cb = callback; return NX_SUCCESS; } -UINT azure_iot_nx_client_register_device_twin_prop(AZURE_IOT_NX_CONTEXT* context, func_ptr_device_twin_prop callback) +UINT azure_iot_nx_client_register_property_callback(AZURE_IOT_NX_CONTEXT* context, func_ptr_property_received callback) { - if (context == NULL || context->device_twin_get_cb != NULL) + if (context == NULL || context->property_received_cb != NULL) { return NX_PTR_ERROR; } - context->device_twin_get_cb = callback; + context->property_received_cb = callback; return NX_SUCCESS; } @@ -424,7 +493,7 @@ UINT azure_iot_nx_client_sas_set(AZURE_IOT_NX_CONTEXT* context, CHAR* device_sas { if (device_sas_key[0] == 0) { - printf("ERROR: azure_iot_nx_client_sas_set device_sas_key is null\r\n"); + printf("Error: azure_iot_nx_client_sas_set device_sas_key is null\r\n"); return NX_PTR_ERROR; } @@ -445,7 +514,7 @@ UINT azure_iot_nx_client_cert_set(AZURE_IOT_NX_CONTEXT* context, if (device_x509_cert[0] == 0 || device_x509_cert_len == 0 || device_x509_key[0] == 0 || device_x509_key_len == 0) { - printf("ERROR: azure_iot_nx_client_cert_set cert/key is null\r\n"); + printf("Error: azure_iot_nx_client_cert_set cert/key is null\r\n"); return NX_PTR_ERROR; } @@ -478,7 +547,7 @@ UINT azure_iot_nx_client_create(AZURE_IOT_NX_CONTEXT* context, if (iot_model_id[0] == 0) { - printf("ERROR: UINT azure_iot_nx_client_create_new empty device_id or model_id\r\n"); + printf("Error: UINT azure_iot_nx_client_create_new empty device_id or model_id\r\n"); return NX_PTR_ERROR; } @@ -490,7 +559,7 @@ UINT azure_iot_nx_client_create(AZURE_IOT_NX_CONTEXT* context, if ((status = tx_event_flags_create(&context->events, "nx_client"))) { - printf("ERROR: failed on create nx_client event flags (0x%08x)\r\n", status); + printf("Error: failed on create nx_client event flags (0x%08x)\r\n", status); return status; } @@ -505,7 +574,7 @@ UINT azure_iot_nx_client_create(AZURE_IOT_NX_CONTEXT* context, NX_AZURE_IOT_THREAD_PRIORITY, unix_time_callback))) { - printf("ERROR: failed on nx_azure_iot_create (0x%08x)\r\n", status); + printf("Error: failed on nx_azure_iot_create (0x%08x)\r\n", status); return status; } @@ -531,14 +600,14 @@ UINT azure_iot_nx_client_hub_create(AZURE_IOT_NX_CONTEXT* context, CHAR* iot_hub { if (context == NULL) { - printf("ERROR: context is NULL\r\n"); + printf("Error: context is NULL\r\n"); return NX_PTR_ERROR; } // Return error if empty hostname or device id if (iot_hub_hostname[0] == 0 || iot_device_id[0] == 0) { - printf("ERROR: azure_iot_nx_client_hub_create iot_hub_hostname is null\r\n"); + printf("Error: azure_iot_nx_client_hub_create iot_hub_hostname is null\r\n"); return NX_PTR_ERROR; } @@ -563,20 +632,20 @@ UINT azure_iot_nx_client_dps_create(AZURE_IOT_NX_CONTEXT* context, CHAR* dps_id_ if (context == NULL) { - printf("ERROR: context is NULL\r\n"); + printf("Error: context is NULL\r\n"); return NX_PTR_ERROR; } // Return error if empty credentials if (dps_id_scope[0] == 0 || dps_registration_id[0] == 0) { - printf("ERROR: azure_iot_nx_client_dps_create incorrect parameters\r\n"); + printf("Error: azure_iot_nx_client_dps_create incorrect parameters\r\n"); return NX_PTR_ERROR; } if (snprintf(payload, sizeof(payload), DPS_PAYLOAD, context->azure_iot_model_id) > DPS_PAYLOAD_SIZE - 1) { - printf("ERROR: insufficient buffer size to create DPS payload\r\n"); + printf("Error: insufficient buffer size to create DPS payload\r\n"); return NX_SIZE_ERROR; } @@ -626,7 +695,7 @@ UINT azure_iot_nx_client_dps_create(AZURE_IOT_NX_CONTEXT* context, CHAR* dps_id_ if ((status = nx_azure_iot_provisioning_client_registration_payload_set( &context->dps_client, (UCHAR*)payload, strlen(payload)))) { - printf("ERROR: nx_azure_iot_provisioning_client_registration_payload_set (0x%08x\r\n", status); + printf("Error: nx_azure_iot_provisioning_client_registration_payload_set (0x%08x\r\n", status); } // Register device @@ -658,7 +727,7 @@ UINT azure_iot_nx_client_dps_create(AZURE_IOT_NX_CONTEXT* context, CHAR* dps_id_ (UCHAR*)context->azure_iot_device_id, &iot_device_id_len))) { - printf("ERROR: nx_azure_iot_provisioning_client_iothub_device_info_get (0x%08x)\r\n", status); + printf("Error: nx_azure_iot_provisioning_client_iothub_device_info_get (0x%08x)\r\n", status); } // Destroy Provisioning Client @@ -728,193 +797,179 @@ UINT azure_iot_nx_client_disconnect(AZURE_IOT_NX_CONTEXT* context) return NX_SUCCESS; } -UINT azure_iot_nx_client_device_twin_request_and_wait(AZURE_IOT_NX_CONTEXT* context) +UINT azure_iot_nx_client_properties_request_and_wait(AZURE_IOT_NX_CONTEXT* context) { UINT status; ULONG app_events; - // Request the device twin for writeable property update - if ((status = nx_azure_iot_hub_client_device_twin_properties_request(&context->iothub_client, NX_WAIT_FOREVER))) + // Request the properties + if ((status = nx_azure_iot_hub_client_properties_request(&context->iothub_client, NX_WAIT_FOREVER))) { - printf("ERROR: failed to request device twin (0x%08x)\r\n", status); + printf("Error: failed to request properties (0x%08x)\r\n", status); return status; } // Wait for the device twin to be processed if ((status = tx_event_flags_get( - &context->events, DEVICE_TWIN_COMPLETE_EVENT, TX_OR_CLEAR, &app_events, 10 * NX_IP_PERIODIC_RATE))) + &context->events, PROPERTIES_COMPLETE_EVENT, TX_OR_CLEAR, &app_events, 10 * NX_IP_PERIODIC_RATE))) { - printf("ERROR: failed to execute tx_event_flags_get (0x%08x)\r\n", status); + printf("Error: failed to execute tx_event_flags_get (0x%08x)\r\n", status); return status; } return NX_SUCCESS; } -UINT azure_iot_nx_client_publish_telemetry( - AZURE_IOT_NX_CONTEXT* context, UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context)) +UINT azure_iot_nx_client_publish_telemetry(AZURE_IOT_NX_CONTEXT* context_ptr, + CHAR* component_name_ptr, + UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr)) { UINT status; - NX_PACKET* packet_ptr; - NX_AZURE_IOT_JSON_WRITER json_builder; UINT telemetry_length; - UCHAR buffer[PUBLISH_BUFFER_SIZE]; + NX_PACKET* packet_ptr; + NX_AZURE_IOT_JSON_WRITER json_writer; - if ((status = nx_azure_iot_pnp_helper_telemetry_message_create( - &context->iothub_client, NX_NULL, 0, &packet_ptr, NX_WAIT_FOREVER))) + if ((status = nx_azure_iot_hub_client_telemetry_message_create( + &context_ptr->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf("Telemetry message create failed!: error code = 0x%08x\r\n", status); - return (status); + printf("Error: nx_azure_iot_hub_client_telemetry_message_create failed (0x%08x)\r\n", status); } - if ((status = nx_azure_iot_json_writer_with_buffer_init(&json_builder, buffer, PUBLISH_BUFFER_SIZE))) + if ((status = nx_azure_iot_json_writer_with_buffer_init(&json_writer, telemetry_buffer, sizeof(telemetry_buffer)))) { - printf("Failed to initialize json writer\r\n"); + printf("Error: Failed to initialize json writer (0x%08x)\r\n", status); nx_azure_iot_hub_client_telemetry_message_delete(packet_ptr); - return NX_NOT_SUCCESSFUL; + return status; } - if ((status = nx_azure_iot_pnp_helper_build_reported_property(NULL, 0, append_properties, NX_NULL, &json_builder))) + if ((status = nx_azure_iot_json_writer_append_begin_object(&json_writer)) || + (component_name_ptr != NX_NULL && + (status = nx_azure_iot_hub_client_reported_properties_component_begin( + &context_ptr->iothub_client, &json_writer, (UCHAR*)component_name_ptr, strlen(component_name_ptr)))) || + (status = append_properties(&json_writer)) || + (component_name_ptr != NX_NULL && (status = nx_azure_iot_hub_client_reported_properties_component_end( + &context_ptr->iothub_client, &json_writer))) || + (status = nx_azure_iot_json_writer_append_end_object(&json_writer))) { - printf("Failed to build telemetry!: error code = 0x%08x\r\n", status); - nx_azure_iot_json_writer_deinit(&json_builder); + printf("Error: Failed to build telemetry (0x%08x)\r\n", status); nx_azure_iot_hub_client_telemetry_message_delete(packet_ptr); return status; } - telemetry_length = nx_azure_iot_json_writer_get_bytes_used(&json_builder); + telemetry_length = nx_azure_iot_json_writer_get_bytes_used(&json_writer); if ((status = nx_azure_iot_hub_client_telemetry_send( - &context->iothub_client, packet_ptr, buffer, telemetry_length, NX_WAIT_FOREVER))) + &context_ptr->iothub_client, packet_ptr, telemetry_buffer, telemetry_length, NX_WAIT_FOREVER))) { - printf("Telemetry message send failed (0x%08x)\r\n", status); - nx_azure_iot_json_writer_deinit(&json_builder); + printf("Error: Telemetry message send failed (0x%08x)\r\n", status); nx_azure_iot_hub_client_telemetry_message_delete(packet_ptr); return status; } - printf("Telemetry message sent: %.*s.\r\n", telemetry_length, buffer); - - nx_azure_iot_json_writer_deinit(&json_builder); + printf("Telemetry message sent: %.*s.\r\n", telemetry_length, telemetry_buffer); return status; } -UINT azure_iot_nx_client_publish_properties(AZURE_IOT_NX_CONTEXT* context, - CHAR* component, - UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context)) +UINT azure_iot_nx_client_publish_properties(AZURE_IOT_NX_CONTEXT* context_ptr, + CHAR* component_name_ptr, + UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_writer_ptr)) { - UINT reported_properties_length; UINT status; - UINT response_status; - UINT request_id; - NX_AZURE_IOT_JSON_WRITER json_builder; - ULONG reported_property_version; - UCHAR buffer[PUBLISH_BUFFER_SIZE]; + UINT response_status = 0; + NX_PACKET* packet_ptr; + NX_AZURE_IOT_JSON_WRITER json_writer; - if ((status = nx_azure_iot_json_writer_with_buffer_init(&json_builder, buffer, PUBLISH_BUFFER_SIZE))) + if ((status = nx_azure_iot_hub_client_reported_properties_create( + &context_ptr->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf("Failed to initialize json writer\r\n"); - return NX_NOT_SUCCESSFUL; + printf("Error: Failed create reported properties (0x%08x)\r\n", status); + return status; } - if ((status = nx_azure_iot_pnp_helper_build_reported_property( - (UCHAR*)component, strlen(component), append_properties, NX_NULL, &json_builder))) + if ((status = nx_azure_iot_json_writer_init(&json_writer, packet_ptr, NX_WAIT_FOREVER))) { - printf("Failed to build reported property!: error code = 0x%08x\r\n", status); - nx_azure_iot_json_writer_deinit(&json_builder); + printf("Error: Failed to initialize json writer (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - reported_properties_length = nx_azure_iot_json_writer_get_bytes_used(&json_builder); - if ((status = nx_azure_iot_hub_client_device_twin_reported_properties_send(&context->iothub_client, - buffer, - reported_properties_length, - &request_id, - &response_status, - &reported_property_version, - (5 * NX_IP_PERIODIC_RATE)))) + if ((status = nx_azure_iot_json_writer_append_begin_object(&json_writer)) || + (component_name_ptr != NX_NULL && + (status = nx_azure_iot_hub_client_reported_properties_component_begin( + &context_ptr->iothub_client, &json_writer, (UCHAR*)component_name_ptr, strlen(component_name_ptr)))) || + (status = append_properties(&json_writer)) || + (component_name_ptr != NX_NULL && (status = nx_azure_iot_hub_client_reported_properties_component_end( + &context_ptr->iothub_client, &json_writer))) || + (status = nx_azure_iot_json_writer_append_end_object(&json_writer))) { - printf("Device twin reported properties failed!: error code = 0x%08x\r\n", status); - nx_azure_iot_json_writer_deinit(&json_builder); + printf("Error: Failed to build reported property (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - nx_azure_iot_json_writer_deinit(&json_builder); + printf_packet("Sending property: ", packet_ptr); + + if ((status = nx_azure_iot_hub_client_reported_properties_send( + &context_ptr->iothub_client, packet_ptr, NX_NULL, &response_status, NX_NULL, (5 * NX_IP_PERIODIC_RATE)))) + { + printf("Error: nx_azure_iot_hub_client_reported_properties_send failed (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); + return status; + } if ((response_status < 200) || (response_status >= 300)) { - printf("device twin report properties failed with code : %d\r\n", response_status); + printf("Error: Property sent response status failed (%d)\r\n", response_status); return NX_NOT_SUCCESSFUL; } - printf("Device twin property sent: %.*s.\r\n", reported_properties_length, buffer); - - return status; + return NX_SUCCESS; } -UINT azure_iot_nx_client_publish_float_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, float value) +UINT azure_iot_nx_client_publish_bool_property(AZURE_IOT_NX_CONTEXT* context, CHAR* property, bool value) { UINT status; UINT response_status; UINT request_id; - ULONG version; - CHAR buffer[PUBLISH_BUFFER_SIZE]; - - int intvalue = value; - int fracvalue = abs(100 * (value - (long)value)); + ULONG reported_property_version; + NX_AZURE_IOT_JSON_WRITER json_writer; + NX_PACKET* packet_ptr; - if (snprintf(buffer, PUBLISH_BUFFER_SIZE, "{\"%s\":%d.%2d}", key, intvalue, fracvalue) > PUBLISH_BUFFER_SIZE - 1) + if ((status = nx_azure_iot_hub_client_reported_properties_create( + &context->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf("ERROR: insufficient buffer size to publish float property\r\n"); - return NX_SIZE_ERROR; + printf("Error: Failed create reported properties (0x%08x)\r\n", status); + return status; } - if ((status = nx_azure_iot_hub_client_device_twin_reported_properties_send(&context->iothub_client, - (UCHAR*)buffer, - strlen(buffer), - &request_id, - &response_status, - &version, - NX_WAIT_FOREVER))) + if ((status = nx_azure_iot_json_writer_init(&json_writer, packet_ptr, NX_WAIT_FOREVER))) { - printf("Device twin reported properties failed (0x%08x)\r\n", status); + printf("Error: Failed to initialize json writer (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - if ((response_status < 200) || (response_status >= 300)) + if ((status = nx_azure_iot_json_writer_append_begin_object(&json_writer)) || + (status = nx_azure_iot_json_writer_append_property_with_bool_value( + &json_writer, (const UCHAR*)property, strlen(property), value)) || + (status = nx_azure_iot_json_writer_append_end_object(&json_writer))) { - printf("device twin report properties failed (%d)\r\n", response_status); + printf("Error: Failed to build bool property (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - printf("Device twin property sent: %s\r\n", buffer); - - return NX_SUCCESS; -} - -UINT azure_iot_nx_client_publish_bool_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, bool value) -{ - UINT status; - UINT response_status; - UINT request_id; - ULONG version; - CHAR buffer[PUBLISH_BUFFER_SIZE]; - - if (snprintf(buffer, PUBLISH_BUFFER_SIZE, "{\"%s\":%s}", key, (value ? "true" : "false")) > PUBLISH_BUFFER_SIZE - 1) - { - printf("ERROR: Unsufficient buffer size to publish bool property\r\n"); - return NX_SIZE_ERROR; - } + printf_packet("Sending property: ", packet_ptr); - if ((status = nx_azure_iot_hub_client_device_twin_reported_properties_send(&context->iothub_client, - (UCHAR*)buffer, - strlen(buffer), + if ((status = nx_azure_iot_hub_client_reported_properties_send(&context->iothub_client, + packet_ptr, &request_id, &response_status, - &version, - NX_WAIT_FOREVER))) + &reported_property_version, + 5 * NX_IP_PERIODIC_RATE))) { - printf("Error: device twin reported properties failed (0x%08x)\r\n", status); + printf("Error: nx_azure_iot_hub_client_reported_properties_send failed (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } @@ -924,101 +979,70 @@ UINT azure_iot_nx_client_publish_bool_property(AZURE_IOT_NX_CONTEXT* context, CH return status; } - printf("Device twin property sent: %s\r\n", buffer); - return NX_SUCCESS; } -UINT azure_iot_nx_client_publish_int_writeable_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, UINT value) +UINT azure_nx_client_respond_int_writable_property( + AZURE_IOT_NX_CONTEXT* context, CHAR* property, INT value, INT http_status, INT version) { UINT status; UINT response_status; UINT request_id; - ULONG version; - CHAR buffer[PUBLISH_BUFFER_SIZE]; + NX_AZURE_IOT_JSON_WRITER json_writer; + NX_PACKET* packet_ptr; - if (snprintf(buffer, PUBLISH_BUFFER_SIZE, "{\"%s\":{\"value\":%d,\"ac\":200,\"av\":1}}", key, value) > - PUBLISH_BUFFER_SIZE - 1) + if ((status = nx_azure_iot_hub_client_reported_properties_create( + &context->iothub_client, &packet_ptr, NX_WAIT_FOREVER))) { - printf("ERROR: Unsufficient buffer size to publish int property\r\n"); - return NX_SIZE_ERROR; + printf("Error: Failed create reported properties (0x%08x)\r\n", status); + return status; } - if ((status = nx_azure_iot_hub_client_device_twin_reported_properties_send(&context->iothub_client, - (UCHAR*)buffer, - strlen(buffer), - &request_id, - &response_status, - &version, - NX_WAIT_FOREVER))) + if ((status = nx_azure_iot_json_writer_init(&json_writer, packet_ptr, NX_WAIT_FOREVER))) { - printf("Error: device twin reported properties failed (0x%08x)\r\n", status); + printf("Error: Failed to initialize json writer (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - if ((response_status < 200) || (response_status >= 300)) + if ((status = nx_azure_iot_json_writer_append_begin_object(&json_writer)) || + (status = nx_azure_iot_hub_client_reported_properties_status_begin(&context->iothub_client, + &json_writer, + (const UCHAR*)property, + strlen(property), + http_status, + version, + NULL, + 0)) || + (status = nx_azure_iot_json_writer_append_int32(&json_writer, value)) || + (status = nx_azure_iot_hub_client_reported_properties_status_end(&context->iothub_client, &json_writer)) || + (status = nx_azure_iot_json_writer_append_end_object(&json_writer))) { - printf("Error: device twin report properties failed (%d)\r\n", response_status); + printf("Error: Failed to build uint writable property response (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); return status; } - printf("Device twin writeable property sent: %s\r\n", buffer); - - return NX_SUCCESS; -} + printf_packet("Sending writable property: ", packet_ptr); -UINT azure_nx_client_respond_int_writeable_property( - AZURE_IOT_NX_CONTEXT* context, CHAR* property, int value, int http_status, int version) -{ - UINT status; - UINT response_status; - UINT request_id; - ULONG version_dt; - CHAR buffer[PUBLISH_BUFFER_SIZE]; - - if (snprintf(buffer, - PUBLISH_BUFFER_SIZE, - "{\"%s\":{\"value\":%d,\"ac\":%d,\"av\":%d}}", - property, - value, - http_status, - version) > PUBLISH_BUFFER_SIZE - 1) - { - printf("ERROR: insufficient buffer size to respond to writeable property\r\n"); - return NX_SIZE_ERROR; - } - - if ((status = nx_azure_iot_hub_client_device_twin_reported_properties_send(&context->iothub_client, - (UCHAR*)buffer, - strlen(buffer), - &request_id, - &response_status, - &version_dt, - NX_WAIT_FOREVER))) + if (nx_azure_iot_hub_client_reported_properties_send( + &context->iothub_client, packet_ptr, &request_id, &response_status, NX_NULL, 5 * NX_IP_PERIODIC_RATE)) { - printf("ERROR: device twin reported properties failed (0x%08x)\r\n", status); + printf("Error: nx_azure_iot_hub_client_reported_properties_send failed (0x%08x)\r\n", status); + nx_packet_release(packet_ptr); + return status; } if ((response_status < 200) || (response_status >= 300)) { - printf("ERROR: device twin report properties failed (%d)\r\n", response_status); + printf("Error: device twin report properties failed (%d)\r\n", response_status); return status; } - printf("Device twin writeable property response: %s\r\n", buffer); - - return status; + return NX_SUCCESS; } -VOID printf_packet(NX_PACKET* packet_ptr, CHAR* prepend) +UINT azure_iot_nx_client_publish_int_writable_property(AZURE_IOT_NX_CONTEXT* context, CHAR* property, UINT value) { - printf("%s", prepend); - - while (packet_ptr != NX_NULL) - { - printf("%.*s", (INT)(packet_ptr->nx_packet_length), (CHAR*)packet_ptr->nx_packet_prepend_ptr); - packet_ptr = packet_ptr->nx_packet_next; - } - - printf("\r\n"); + return azure_nx_client_respond_int_writable_property(context, property, value, 200, 1); } diff --git a/core/src/azure_iot_nx/azure_iot_nx_client.h b/shared/src/azure_iot_nx_client.h similarity index 61% rename from core/src/azure_iot_nx/azure_iot_nx_client.h rename to shared/src/azure_iot_nx_client.h index 8d95e327..b6633ffd 100644 --- a/core/src/azure_iot_nx/azure_iot_nx_client.h +++ b/shared/src/azure_iot_nx_client.h @@ -24,10 +24,14 @@ typedef struct AZURE_IOT_NX_CONTEXT_STRUCT AZURE_IOT_NX_CONTEXT; -typedef void (*func_ptr_direct_method)(AZURE_IOT_NX_CONTEXT*, const UCHAR*, USHORT, UCHAR*, USHORT, VOID*, USHORT); -typedef void (*func_ptr_device_twin_desired_prop)(UCHAR*, UINT, UCHAR*, UINT, NX_AZURE_IOT_JSON_READER, UINT, VOID*); -typedef void (*func_ptr_device_twin_prop)(UCHAR*, UINT, UCHAR*, UINT, NX_AZURE_IOT_JSON_READER, UINT, VOID*); -typedef void (*func_ptr_device_twin_received)(AZURE_IOT_NX_CONTEXT*); +typedef void (*func_ptr_command_received)(AZURE_IOT_NX_CONTEXT*, const UCHAR*, USHORT, UCHAR*, USHORT, VOID*, USHORT); + +typedef void (*func_ptr_writable_property_received)( + AZURE_IOT_NX_CONTEXT*, const UCHAR*, UINT, UCHAR*, UINT, NX_AZURE_IOT_JSON_READER*, UINT); + +typedef void (*func_ptr_property_received)( + AZURE_IOT_NX_CONTEXT*, const UCHAR*, UINT, UCHAR*, UINT, NX_AZURE_IOT_JSON_READER*, UINT); + typedef ULONG (*func_ptr_unix_time_get)(VOID); struct AZURE_IOT_NX_CONTEXT_STRUCT @@ -60,15 +64,15 @@ struct AZURE_IOT_NX_CONTEXT_STRUCT #define iothub_client client.iothub #define dps_client client.dps - func_ptr_direct_method direct_method_cb; - func_ptr_device_twin_desired_prop device_twin_desired_prop_cb; - func_ptr_device_twin_prop device_twin_get_cb; + func_ptr_command_received command_received_cb; + func_ptr_writable_property_received writable_property_received_cb; + func_ptr_property_received property_received_cb; }; -UINT azure_iot_nx_client_register_direct_method(AZURE_IOT_NX_CONTEXT* context, func_ptr_direct_method callback); -UINT azure_iot_nx_client_register_device_twin_desired_prop( - AZURE_IOT_NX_CONTEXT* context, func_ptr_device_twin_desired_prop callback); -UINT azure_iot_nx_client_register_device_twin_prop(AZURE_IOT_NX_CONTEXT* context, func_ptr_device_twin_prop callback); +UINT azure_iot_nx_client_register_command_callback(AZURE_IOT_NX_CONTEXT* context, func_ptr_command_received callback); +UINT azure_iot_nx_client_register_writable_property_callback( + AZURE_IOT_NX_CONTEXT* context, func_ptr_writable_property_received callback); +UINT azure_iot_nx_client_register_property_callback(AZURE_IOT_NX_CONTEXT* context, func_ptr_property_received callback); UINT azure_iot_nx_client_sas_set(AZURE_IOT_NX_CONTEXT* context, CHAR* device_sas_key); UINT azure_iot_nx_client_cert_set(AZURE_IOT_NX_CONTEXT* context, @@ -90,21 +94,19 @@ UINT azure_iot_nx_client_dps_create(AZURE_IOT_NX_CONTEXT* context, CHAR* dps_id_ UINT azure_iot_nx_client_delete(AZURE_IOT_NX_CONTEXT* context); UINT azure_iot_nx_client_connect(AZURE_IOT_NX_CONTEXT* context); -UINT azure_iot_nx_client_device_twin_request_and_wait(AZURE_IOT_NX_CONTEXT* context); - -UINT azure_iot_nx_client_publish_telemetry(AZURE_IOT_NX_CONTEXT* context, - UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context)); +UINT azure_iot_nx_client_properties_request_and_wait(AZURE_IOT_NX_CONTEXT* context); -UINT azure_iot_nx_client_publish_properties(AZURE_IOT_NX_CONTEXT* context, - CHAR* component, - UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_builder_ptr, VOID* context)); -UINT azure_iot_nx_client_publish_float_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, float value); -UINT azure_iot_nx_client_publish_bool_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, bool value); +UINT azure_iot_nx_client_publish_telemetry(AZURE_IOT_NX_CONTEXT* context_ptr, + CHAR* component_name_ptr, + UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_writer_ptr)); -UINT azure_iot_nx_client_publish_int_writeable_property(AZURE_IOT_NX_CONTEXT* context, CHAR* key, UINT value); -UINT azure_nx_client_respond_int_writeable_property( - AZURE_IOT_NX_CONTEXT* context, CHAR* property, int value, int http_status, int version); +UINT azure_iot_nx_client_publish_properties(AZURE_IOT_NX_CONTEXT* context_ptr, + CHAR* component_name_ptr, + UINT (*append_properties)(NX_AZURE_IOT_JSON_WRITER* json_writer_ptr)); +UINT azure_iot_nx_client_publish_bool_property(AZURE_IOT_NX_CONTEXT* context, CHAR* property, bool value); -VOID printf_packet(NX_PACKET* packet_ptr, CHAR* prepend); +UINT azure_nx_client_respond_int_writable_property( + AZURE_IOT_NX_CONTEXT* context, CHAR* property, INT value, INT http_status, INT version); +UINT azure_iot_nx_client_publish_int_writable_property(AZURE_IOT_NX_CONTEXT* context, CHAR* property, UINT value); -#endif \ No newline at end of file +#endif diff --git a/core/src/cmsis_utils.h b/shared/src/cmsis_utils.h similarity index 100% rename from core/src/cmsis_utils.h rename to shared/src/cmsis_utils.h diff --git a/core/src/networking.c b/shared/src/networking.c similarity index 100% rename from core/src/networking.c rename to shared/src/networking.c diff --git a/core/src/networking.h b/shared/src/networking.h similarity index 100% rename from core/src/networking.h rename to shared/src/networking.h diff --git a/core/src/newlib_nano.c b/shared/src/newlib_nano.c similarity index 100% rename from core/src/newlib_nano.c rename to shared/src/newlib_nano.c diff --git a/core/src/sntp_client.c b/shared/src/sntp_client.c similarity index 100% rename from core/src/sntp_client.c rename to shared/src/sntp_client.c diff --git a/core/src/sntp_client.h b/shared/src/sntp_client.h similarity index 100% rename from core/src/sntp_client.h rename to shared/src/sntp_client.h