]> Git Repo - esp-hosted.git/commitdiff
hosted - network interface
authorYogesh Mantri <[email protected]>
Fri, 11 Sep 2020 15:26:43 +0000 (20:56 +0530)
committerYogesh Mantri <[email protected]>
Sat, 12 Sep 2020 16:15:34 +0000 (21:45 +0530)
25 files changed:
host/host_common/stm/platform_wrapper.c
host/linux/host_driver/esp32/esp_serial.c
host/stm32/app/app_main.c
host/stm32/app/app_main.h
host/stm32/app/app_main_api.c [new file with mode: 0644]
host/stm32/app/app_main_api.h [new file with mode: 0644]
host/stm32/app/control/control.c
host/stm32/app/control/control.h
host/stm32/app/data/arp_server_stub.c [new file with mode: 0644]
host/stm32/app/data/arp_server_stub.h [new file with mode: 0644]
host/stm32/common/common.c
host/stm32/common/common.h
host/stm32/common/util.c [new file with mode: 0644]
host/stm32/common/util.h [new file with mode: 0644]
host/stm32/driver/netif/netdev_if.h [new file with mode: 0644]
host/stm32/driver/network/netdev_api.c [new file with mode: 0644]
host/stm32/driver/network/netdev_api.h [new file with mode: 0644]
host/stm32/driver/network/netdev_stub.c [new file with mode: 0644]
host/stm32/driver/network/netdev_stub.h [new file with mode: 0644]
host/stm32/driver/serial/serial_drv.h
host/stm32/driver/serial/serial_if.c
host/stm32/driver/spi/spi_drv.c
host/stm32/driver/spi/spi_drv.h
host/stm32/proj/.cproject
host/stm32/proj/.mxproject [deleted file]

index f6455fadc00b002a626455273bfd35c2c213b249..63432ca6d685acb0550c7ebcabfd8959ea73b837 100644 (file)
@@ -92,7 +92,10 @@ void* esp_hosted_calloc(size_t blk_no, size_t size)
 
 void esp_hosted_free(void* ptr)
 {
-       free(ptr);
+       if(ptr) {
+               free(ptr);
+               ptr=NULL;
+       }
 }
 
 struct esp_hosted_driver_handle_t* esp_hosted_driver_open(const char* transport)
index 886d847f402624aa3db99bd4b9d7fe82e81045fd..5e41afd052cbcce263d7721e5e734715e0adf967 100644 (file)
@@ -66,7 +66,7 @@ static int esp_serial_write(struct file *file, const char __user *user_buffer, s
        int ret;
        size_t total_len;
 
-               dev = (struct esp_serial_devs *) file->private_data;
+       dev = (struct esp_serial_devs *) file->private_data;
        total_len = size + sizeof(struct esp_payload_header);
 
        buf = kmalloc(total_len, GFP_KERNEL);
index 26d628bce0bb191ee9bd0f6b4fa3782383fbbb47..a4666b8fb8ecfdb1bb85d6cdccc4c6eb8c50a68f 100644 (file)
 #include "spi_drv.h"
 #include "control.h"
 #include "trace.h"
+#include "app_main.h"
+#include "netdev_api.h"
+#include "arp_server_stub.h"
 
 /** Constants/Macros **/
+#define ARPING_PATH_TASK_STACK_SIZE     4096
+
 #ifdef __GNUC__
 /* With GCC, small printf (option LD Linker->Libraries->Small printf
    set to 'Yes') calls __io_putchar() */
 
 /** Exported variables **/
 
-
 /** Function declaration **/
+static void init_sta(void);
+static void init_ap(void);
 static void reset_slave(void);
+static void arping_task(void const *arg);
 
 /* GetIdleTaskMemory prototype (linked to static allocation support) */
 void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
        StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
 
 
+struct network_handle *sta_handle, *ap_handle;
+static osThreadId arping_task_id = 0;
 
 /** function definition **/
 
@@ -85,7 +94,7 @@ static void control_path_event_handler(uint8_t event)
        {
                case STATION_CONNECTED:
                {
-                       printf("station connected\n\r");
+                       init_sta();
                        break;
                }
                case STATION_DISCONNECTED:
@@ -95,7 +104,7 @@ static void control_path_event_handler(uint8_t event)
                }
                case SOFTAP_STARTED:
                {
-                       printf("softap started\n\r");
+                       init_ap();
                        break;
                }
                case SOFTAP_STOPPED:
@@ -140,8 +149,17 @@ void MX_FREERTOS_Init(void)
 {
        reset_slave();
 
+       /* Init network interface */
+       network_init();
+
        /* init spi driver */
        stm_spi_init(spi_driver_event_handler);
+
+       /* Create thread for arping */
+       osThreadDef(Arping_Thread, arping_task, osPriorityNormal, 0,
+                       ARPING_PATH_TASK_STACK_SIZE);
+       arping_task_id = osThreadCreate(osThread(Arping_Thread), NULL);
+       assert(arping_task_id);
 }
 
 /**
@@ -189,3 +207,149 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
        configMINIMAL_STACK_SIZE is specified in words, not bytes. */
        *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
 }
+
+/**
+  * @brief Station mode rx callback
+  * @param  net_handle - station network handle
+  * @retval None
+  */
+static void sta_rx_callback(struct network_handle *net_handle)
+{
+       struct pbuf *rx_buffer = NULL;
+       struct pbuf *snd_buffer = NULL;
+       uint8_t *arp_resp = NULL;
+       uint16_t arp_resp_len = 0;
+       uint32_t sta_ip = 0;
+       int ret;
+
+       rx_buffer = network_read(net_handle, 0);
+
+       if (get_self_ip_station(&sta_ip)) {
+               printf("Problem getting self station ip\n\r");
+               if(rx_buffer) {
+                       free(rx_buffer->payload);
+                       free(rx_buffer);
+               }
+               return;
+       }
+
+       if (rx_buffer) {
+               arp_resp = arp_req_handler(&sta_ip, get_self_mac_station(), rx_buffer->payload,
+                               rx_buffer->len, &arp_resp_len);
+
+               if (arp_resp) {
+                       snd_buffer = malloc(sizeof(struct pbuf));
+                       assert(snd_buffer);
+
+                       snd_buffer->payload = arp_resp;
+                       snd_buffer->len = arp_resp_len;
+
+                       ret = network_write(net_handle, snd_buffer);
+
+                       if (ret)
+                               printf("%s: Failed to send arp response\n\r", __func__);
+               }
+
+               free(rx_buffer->payload);
+               free(rx_buffer);
+       }
+}
+
+/**
+  * @brief Softap mode rx callback
+  * @param  net_handle - Softap network handle
+  * @retval None
+  */
+static void ap_rx_callback(struct network_handle *net_handle)
+{
+       struct pbuf *rx_buffer = NULL;
+       struct pbuf *snd_buffer = NULL;
+       uint8_t *arp_resp = NULL;
+       uint16_t arp_resp_len = 0;
+       int ret;
+       uint32_t softap_ip = 0;
+
+       rx_buffer = network_read(net_handle, 0);
+
+       if (get_self_ip_softap(&softap_ip)) {
+               printf("Problem getting self softap ip\n\r");
+               if(rx_buffer) {
+                       free(rx_buffer->payload);
+                       free(rx_buffer);
+               }
+               return;
+       }
+
+       if (rx_buffer) {
+               arp_resp = arp_req_handler(&softap_ip, get_self_mac_softap(),
+                               rx_buffer->payload, rx_buffer->len, &arp_resp_len);
+
+               if (arp_resp) {
+                       snd_buffer = malloc(sizeof(struct pbuf));
+                       assert(snd_buffer);
+
+                       snd_buffer->payload = arp_resp;
+                       snd_buffer->len = arp_resp_len;
+
+                       ret = network_write(net_handle, snd_buffer);
+
+                       if (ret)
+                               printf("%s: Failed to send arp response\n\r", __func__);
+               }
+
+               free(rx_buffer->payload);
+               free(rx_buffer);
+       }
+}
+
+
+/**
+  * @brief start station mode network path
+  * @param None
+  * @retval None
+  */
+static void init_sta(void)
+{
+       sta_handle = network_open(STA_INTERFACE, sta_rx_callback);
+       assert(sta_handle);
+}
+
+/**
+  * @brief start softap mode network path
+  * @param None
+  * @retval None
+  */
+static void init_ap(void)
+{
+       ap_handle = network_open(SOFTAP_INTERFACE, ap_rx_callback);
+       assert(ap_handle);
+}
+
+/**
+  * @brief task initiate arping req periodically
+  * @param Not used
+  * @retval None
+  */
+static void arping_task(void const *arg)
+{
+       uint32_t sta_ip, softap_ip;
+       uint32_t sta_dest_ip, softap_dest_ip;
+       uint8_t  dst_mac_bytes[MAC_LEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+       sta_ip = softap_ip = sta_dest_ip = softap_dest_ip = 0;
+
+       get_self_ip_station(&sta_ip);
+       get_self_ip_softap(&softap_ip);
+       get_arp_dst_ip_station(&sta_dest_ip);
+       get_arp_dst_ip_softap(&softap_dest_ip);
+
+       while (1) {
+               if (sta_handle)
+                       send_arp_req(sta_handle, get_self_mac_station(), &sta_ip, dst_mac_bytes, &sta_dest_ip);
+
+               if(ap_handle)
+                       send_arp_req(ap_handle, get_self_mac_softap(), &softap_ip, dst_mac_bytes, &softap_dest_ip);
+
+               osDelay(1000);
+       }
+}
index 15a497487754047b680c109173fe048404358a76..d5754a1ff86d557dc941369e77883ba77dd05c0b 100644 (file)
@@ -22,6 +22,7 @@ extern "C" {
 
 /** Includes **/
 #include "common.h"
+#include "netdev_api.h"
 
 /** Exported macros **/
 
@@ -30,6 +31,8 @@ extern "C" {
 /** Inline functions **/
 
 /** Exported Functions **/
+extern stm_ret_t send_arp_req(struct network_handle *net_handle, uint8_t *src_mac,
+               uint32_t *src_ip, uint8_t *dst_mac, uint32_t *dst_ip);
 
 #ifdef __cplusplus
 }
diff --git a/host/stm32/app/app_main_api.c b/host/stm32/app/app_main_api.c
new file mode 100644 (file)
index 0000000..43ba19a
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** Include **/
+#include "trace.h"
+#include "app_main_api.h"
+
+/** Exported Constants/Macros **/
+
+/** Exported variables **/
+
+/** Function declarations **/
+
+/** Function definitions **/
+
+/** Exported Functions **/
+
+/**
+  * @brief  Print details of arp received
+  * @param  stream - input stream
+  *         len - len of buffer
+  *         custom_str - prepend string with, could be NULL
+  * @retval None
+  */
+void print_stream(uint8_t *stream, int len, char *custom_str)
+{
+#if DEBUG_STREAM_ENABLED
+       uint16_t idx;
+       if(custom_str)
+               printf("%s -> ",custom_str);
+       else
+               printf("stream -> ");
+
+       for (idx=0;idx<200;idx++) {
+               if (idx%16==0)
+                       printf("\n%04x: ",idx);
+               if (idx%8==0)
+                       printf(" ");
+               printf("%02x",stream[idx]);
+       }
+       printf("\n");
+#endif
+}
+
+/**
+  * @brief  set val from stream at offset of len
+  * @param  stream - input stream
+  *         val - buffer to be set
+  *         offset - offset from stream
+  *         len - len of buffer
+  * @retval None
+  */
+void stream_set(uint8_t * stream, const void *val, uint8_t offset, uint16_t len)
+{
+       uint8_t * src = (uint8_t *)val;
+       uint16_t idx;
+
+       for (idx=0;idx<len;idx++) {
+               stream[offset+idx] = src[idx];
+       }
+}
+
+
+/**
+  * @brief  get stream ptr from stream at offset of len
+  * @param  stream - input stream
+  *         offset - offset from stream
+  *         len - len of buffer
+  * @retval value at offset from stream of len
+  */
+uint8_t * stream_get(uint8_t * stream, uint8_t offset, uint16_t len)
+{
+       (void)len;
+       assert(stream);
+
+       return (stream+offset);
+}
+
+
+/** Local functions **/
diff --git a/host/stm32/app/app_main_api.h b/host/stm32/app/app_main_api.h
new file mode 100644 (file)
index 0000000..0885735
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __APP_MAIN_API_H
+#define __APP_MAIN_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Includes **/
+#include "common.h"
+
+/** Exported Structures **/
+
+/** Exported variables **/
+
+/** Inline functions **/
+
+/** Exported Functions **/
+uint8_t * stream_get(uint8_t * stream, uint8_t offset, uint16_t len);
+void stream_set(uint8_t * stream, const void *val,
+               uint8_t offset, uint16_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 57db48612f722762a4563e434d0365883261e467..918b5c1f698cf2897bb420dd759534e27546ab10 100644 (file)
 
 /** Includes **/
 #include "string.h"
+#include "util.h"
 #include "control.h"
 #include "trace.h"
 #include "commands.h"
 #include "platform_wrapper.h"
 
-/* Delay for get connected stations list */
-#define DELAY                                                   300000
-
 /* Maximum retry count*/
 #define RETRY_COUNT                                                    5
 
 /* Constants / macro */
-#define CONTROL_PATH_TASK_STACK_SIZE      4096
+#define CONTROL_PATH_TASK_STACK_SIZE        4096
 
 /* data path opens after control path is set */
 static int mode = WIFI_MODE_NULL;
+static uint8_t self_station_mac[MAC_LEN] = { 0 };
+static uint8_t self_softap_mac[MAC_LEN]  = { 0 };
 
 /** Exported variables **/
 static osThreadId control_path_task_id = 0;
@@ -39,11 +39,86 @@ static void (*control_path_evt_handler_fp) (uint8_t);
 
 /** Function Declarations **/
 static void control_path_task(void const *argument);
-static void control_path_call_event(uint8_t event);
-static int get_application_mode(void);
 
 /** Exported functions **/
 
+/**
+  * @brief  Get self station ip from config param
+  * @param  self_ip - output ip address
+  * @retval STM_FAIL if fail, else STM_OK
+  */
+stm_ret_t get_self_ip_station(uint32_t *self_ip)
+{
+       if (STM_OK != get_ipaddr_from_str(INPUT_STATION_SRC_IP, self_ip)) {
+               printf("invalid src ip addr from INPUT_STATION_SRC_IP %s\n\r", INPUT_STATION_SRC_IP);
+               return STM_FAIL;
+       }
+       return STM_OK;
+}
+
+/**
+  * @brief  Get self softap ip from config param
+  * @param  self_ip - output ip address
+  * @retval STM_FAIL if fail, else STM_OK
+  */
+stm_ret_t get_self_ip_softap(uint32_t *self_ip)
+{
+       if (STM_OK != get_ipaddr_from_str(INPUT_SOFTAP_SRC_IP, self_ip)) {
+               printf("invalid src ip addr from INPUT_SOFTAP_SRC_IP %s\n\r", INPUT_SOFTAP_SRC_IP);
+               return STM_FAIL;
+       }
+       return STM_OK;
+}
+
+/**
+  * @brief  Get self mac for station
+  * @param None
+  * @retval NULL if fail, else mac
+  */
+uint8_t *get_self_mac_station()
+{
+       return self_station_mac;
+}
+
+/**
+  * @brief  Get self mac for softap
+  * @param  None
+  * @retval NULL if fail, else mac
+  */
+uint8_t *get_self_mac_softap()
+{
+       return self_softap_mac;
+}
+
+/**
+  * @brief  Get arp dest ip for station from config param
+  * @param  sta_ip - output ip address
+  * @retval STM_FAIL if fail, else STM_OK
+  */
+stm_ret_t get_arp_dst_ip_station(uint32_t *sta_ip)
+{
+       if (STM_OK != get_ipaddr_from_str(INPUT_STATION_ARP_DEST_IP, sta_ip)) {
+               printf("invalid src ip addr from INPUT_STATION_ARP_DEST_IP %s\n\r", INPUT_STATION_ARP_DEST_IP);
+               return STM_FAIL;
+       }
+       return STM_OK;
+}
+
+/**
+  * @brief  Get arp dest ip for softap from config param
+  * @param  soft_ip - output ip address
+  * @retval STM_FAIL if fail, else STM_OK
+  */
+stm_ret_t get_arp_dst_ip_softap(uint32_t *soft_ip)
+{
+       if (STM_OK != get_ipaddr_from_str(INPUT_SOFTAP_ARP_DEST_IP, soft_ip)) {
+               printf("invalid src ip addr from INPUT_SOFTAP_ARP_DEST_IP %s\n\r", INPUT_SOFTAP_ARP_DEST_IP);
+               return STM_FAIL;
+       }
+       return STM_OK;
+}
+
+
 /**
   * @brief  control path initialize
   * @param  control_path_evt_handler - event handler of type control_path_events_e
@@ -87,6 +162,26 @@ static void control_path_call_event(uint8_t event)
        }
 }
 
+/**
+  * @brief  save softap mac in bytes
+  * @param  mac - mac in string
+  * @retval STM_OK/STM_FAIL
+  */
+static stm_ret_t save_softap_mac(const char *mac)
+{
+       return convert_mac_to_bytes(self_softap_mac, mac);
+}
+
+/**
+  * @brief  save station mac in bytes
+  * @param  mac - mac in string
+  * @retval STM_OK/STM_FAIL
+  */
+static stm_ret_t save_station_mac(const char *mac)
+{
+       return convert_mac_to_bytes(self_station_mac, mac);
+}
+
 /**
   * @brief  connect to wifi(ap) router
   * @param  None
@@ -109,16 +204,16 @@ static int station_connect(void)
 
        memset(mac, '\0', WIFI_MAX_STR_LEN);
        ret = get_mac(wifi_mode, mac);
-       if (ret != STM_OK) {
+       if (ret) {
                printf("Failed to get MAC address, retrying \n\r");
                hard_delay(50000);
                return STM_FAIL;
        } else {
                printf("Station's MAC address is %s \n\r", mac);
-               /* TODO: Save mac for station, will be handled by next patch */
+               save_station_mac(mac);
        }
        ret = wifi_set_ap_config(ap_config);
-       if (ret != STM_OK) {
+       if (ret) {
                printf("Failed to connect with AP \n\r");
                hard_delay(50000);
                return STM_FAIL;
@@ -156,17 +251,17 @@ static int softap_start(void)
        memset(mac, '\0', WIFI_MAX_STR_LEN);
 
        ret = get_mac(wifi_mode, mac);
-       if (ret != STM_OK) {
+       if (ret) {
                printf("Failed to get MAC address \n\r");
                hard_delay(50000);
                return STM_FAIL;
        } else {
                printf("SoftAP's MAC address is %s \n\r", mac);
-               /* TODO: Save mac for softap, will be handled by next patch */
+               save_softap_mac(mac);
        }
 
        ret = wifi_set_softap_config(softap_config);
-       if (ret != STM_OK) {
+       if (ret) {
                printf("Failed to start softAP \n\r");
                hard_delay(50000);
                return STM_FAIL;
@@ -188,7 +283,7 @@ static int get_ap_scan_list(void)
        int ret = 0, count = 0;
        esp_hosted_wifi_scanlist_t* list = NULL;
        ret = wifi_ap_scan_list(&list, &count);
-       if (ret != STM_OK) {
+       if (ret) {
                printf("Failed to get available AP scan list \n\r");
                return STM_FAIL;
        }
@@ -208,40 +303,6 @@ static int get_ap_scan_list(void)
        return STM_OK;
 }
 
-/**
-  * @brief  list of connected stations
-  * @param  mode - output mode
-  * @retval STM_OK/STM_FAIL
-  */
-static int get_connected_stations_list(void)
-{
-       int ret = 0, count = 0;
-    esp_hosted_wifi_connected_stations_list* stations_list = NULL;
-       if (INPUT_GET_CONNECTED_STATIONS_LIST && (mode & MODE_SOFTAP)) {
-               printf("softap connected stations list \n\r");
-               ret = wifi_connected_stations_list(&stations_list,&count);
-               if (ret == STM_OK) {
-                       printf("number of connected stations is %d \n\r", count);
-                       if (count) {
-                               for (int i=0; i<count; i++) {
-                                       printf("%d th stations's bssid \"%s\" rssi \"%d\" \n\r",
-                                                       i, stations_list[i].bssid,
-                                                       stations_list[i].rssi);
-                               }
-                               free(stations_list);
-                               stations_list = NULL;
-                       } else {
-                               printf("No station is connected \n\r");
-                       }
-               } else {
-                       printf("Failed to get connected stations list \n\r");
-                       return STM_FAIL;
-               }
-               osDelay(DELAY);
-       }
-       return STM_OK;
-}
-
 /**
   * @brief  get mode
   * @param  mode - output mode
@@ -292,7 +353,7 @@ static void control_path_task(void const *argument)
                if (!stop) {
                        if (INPUT_GET_AP_SCAN_LIST && !scap_ap_list) {
                                ret = get_ap_scan_list();
-                               if (ret != STM_OK) {
+                               if (ret) {
                                        continue;
                                }
                                scap_ap_list = true;
@@ -302,7 +363,7 @@ static void control_path_task(void const *argument)
                                {
                                        if (station_connect_retry < RETRY_COUNT) {
                                                ret = station_connect();
-                                               if (ret != STM_OK) {
+                                               if (ret) {
                                                        mode &= ~MODE_STATION;
                                                        station_connect_retry++;
                                                        continue;
@@ -320,7 +381,7 @@ static void control_path_task(void const *argument)
                                {
                                        if (softap_start_retry < RETRY_COUNT) {
                                                ret = softap_start();
-                                               if (ret != STM_OK) {
+                                               if (ret) {
                                                        mode &= ~MODE_SOFTAP;
                                                        softap_start_retry++;
                                                        continue;
@@ -338,7 +399,7 @@ static void control_path_task(void const *argument)
                                {
                                        if (!(mode & MODE_STATION) && station_connect_retry < RETRY_COUNT) {
                                                ret = station_connect();
-                                               if (ret != STM_OK) {
+                                               if (ret) {
                                                        mode &= ~MODE_STATION;
                                                        station_connect_retry++;
                                                } else {
@@ -350,7 +411,7 @@ static void control_path_task(void const *argument)
                                        }
                                        if (!(mode & MODE_SOFTAP) && softap_start_retry < RETRY_COUNT) {
                                                ret = softap_start();
-                                               if (ret != STM_OK) {
+                                               if (ret) {
                                                        mode &= ~MODE_SOFTAP;
                                                        softap_start_retry++;
                                                } else {
@@ -380,7 +441,6 @@ static void control_path_task(void const *argument)
 
                } else {
                        osDelay(5000);
-                       get_connected_stations_list();
                }
        }
 }
index a88375ce59e0893c0b9ef8c3fd74b74b7e78b553..b6fcc6b0060c8fdb55117803cae8fe8e9f899fb8 100644 (file)
@@ -26,7 +26,7 @@ extern "C" {
 
 /** constants/macros **/
 typedef enum {
-    MODE_NULL    = 0x1,
+       MODE_NULL    = 0x1,
        MODE_STATION = 0x2,
        MODE_SOFTAP  = 0x4,
        MODE_SOFTAP_STATION = (MODE_STATION|MODE_SOFTAP),
@@ -101,33 +101,29 @@ typedef enum control_path_events_s {
 #define INPUT_GET_AP_SCAN_LIST            1
 #endif
 
-#ifndef INPUT_STATION_ARP_DEST_MAC
-#define INPUT_STATION_ARP_DEST_MAC        "aa:bb:cc:dd:ee:ff"
+/* stm32 station self ip */
+#ifndef INPUT_STATION_SRC_IP
+#define INPUT_STATION_SRC_IP              "192.168.1.233"
 #endif
 
-#ifndef INPUT_GET_CONNECTED_STATIONS_LIST
-#define INPUT_GET_CONNECTED_STATIONS_LIST 1
+/* stm32 station self ip */
+#ifndef INPUT_SOFTAP_SRC_IP
+#define INPUT_SOFTAP_SRC_IP              "192.168.2.1"
 #endif
 
+/* station - ARP destination ip */
 #ifndef INPUT_STATION_ARP_DEST_IP
 #define INPUT_STATION_ARP_DEST_IP         "192.168.1.11"
 #endif
 
-#ifndef INPUT_SRC_IP
-#define INPUT_SRC_IP                      "192.168.1.233"
-#endif
-
+/* softap - ARP destination ip */
 #ifndef INPUT_SOFTAP_ARP_DEST_IP
 #define INPUT_SOFTAP_ARP_DEST_IP          "192.168.2.22"
 #endif
 
-#ifndef INPUT_SOFTAP_ARP_DEST_MAC
-#define INPUT_SOFTAP_ARP_DEST_MAC         "a1:b2:c3:d4:e5:f6"
-#endif
 
 #define WIFI_MAX_STR_LEN                  19
 
-
 /** Exported Structures **/
 
 /** Exported variables **/
@@ -137,6 +133,12 @@ typedef enum control_path_events_s {
 
 /** Exported Functions **/
 void control_path_init(void(*control_path_evt_handler)(uint8_t));
+stm_ret_t get_self_ip_station(uint32_t *self_ip);
+stm_ret_t get_self_ip_softap(uint32_t *self_ip);
+uint8_t *get_self_mac_station();
+uint8_t *get_self_mac_softap();
+stm_ret_t get_arp_dst_ip_station(uint32_t *sta_ip);
+stm_ret_t get_arp_dst_ip_softap(uint32_t *soft_ip);
 
 #ifdef __cplusplus
 }
diff --git a/host/stm32/app/data/arp_server_stub.c b/host/stm32/app/data/arp_server_stub.c
new file mode 100644 (file)
index 0000000..8a0698d
--- /dev/null
@@ -0,0 +1,408 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/** Include **/
+#include "string.h"
+#include "trace.h"
+#include "util.h"
+
+#include "app_main_api.h"
+#include "netdev_api.h"
+#include "arp_server_stub.h"
+
+
+/** constants, macros **/
+#define DEBUG_STREAM_ENABLED             1
+
+#define PROTOCOL_LEN_ARP                 2
+#define PROTOCOL_ARP                     0x0806
+#define ARPING_OFFSET_PROTOCOL           12
+
+#define OPCODE_LEN                       2
+
+#define ARPING_OFFSET_SRC_MAC            6
+#define ARPING_OFFSET_SRC_REPEAT_MAC     22
+#define ARPING_OFFSET_DST_MAC            0
+#define ARPING_OFFSET_DST_REPEAT_MAC     32
+#define ARPING_OFFSET_SRC_IP             28
+#define ARPING_OFFSET_DST_IP             38
+#define ARPING_OFFSET_OPCODE             20
+#define ARPING_MAX_PKT_SIZE              200
+
+enum {
+       ARP_REQ = 1,
+       ARP_REPLY,
+       MAX_MSG_TYPE_ARPING
+};
+
+/** Exported variables **/
+
+static uint8_t arp_req_tx[ARPING_MAX_PKT_SIZE] =
+{
+/* arping */
+       // dst mac (0th byte)   0xa0, 0x88, 0xb4, 0xe5, 0xd5, 0x38 //laptop
+       // src mac (6th byte)   0x3c, 0x71, 0xbf, 0x9a, 0xbc, 0xb8 //stm
+       // src mac (22th byte)  0x3c, 0x71, 0xbf, 0x9a, 0xbc, 0xb8 //stm
+       // src ip  (28th byte)  192.168.1.233                      //stm
+       // dst ip  (38th byte)  192.168.1.206                      //laptop
+/*0000*/   0xa0, 0x88, 0xb4, 0xe5, 0xd5, 0x38, 0x3c, 0x71, 0xbf, 0x9a, 0xbc, 0xb8, 0x08, 0x06, 0x00, 0x01,
+/*0010*/   0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x3c, 0x71, 0xbf, 0x9a, 0xbc, 0xb8,  192,  168,    1,  233,
+/*0020*/   0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  192,  168,    1,  206, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/*0030*/   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+};
+
+
+/** Function Definitions **/
+
+/** Local functions **/
+
+/**
+  * @brief  Set ip address for arping
+  * @param  stream - output buffer
+  *         type - src/dest type of ip addr
+  *         ip   - ip addr to set
+  * @retval None
+  */
+static void arping_set_ipaddr(uint8_t *stream, ie_type_e type, uint32_t ip)
+{
+       uint32_t ip_nw = hton_long(ip);
+       if (type == IP_ADDR_TYPE_SRC ) {
+               stream_set(stream, &ip_nw, ARPING_OFFSET_SRC_IP, IP_ADDR_LEN);
+       } else if (type == IP_ADDR_TYPE_DST ) {
+               stream_set(stream, &ip_nw, ARPING_OFFSET_DST_IP, IP_ADDR_LEN);
+       } else {
+               printf("Address type be either src/dst\n");
+       }
+}
+
+/**
+  * @brief  Get ip address for arping
+  * @param  stream - input buffer
+  *         type - src/dest type of ip addr
+  * @retval ip addr in 32 bits
+  */
+static uint32_t arping_get_ipaddr(uint8_t *stream, ie_type_e type)
+{
+       uint32_t ip_nw;
+       if (type == IP_ADDR_TYPE_SRC ) {
+               ip_nw = *(uint32_t*) stream_get(stream,
+                               ARPING_OFFSET_SRC_IP, IP_ADDR_LEN);
+       } else if (type == IP_ADDR_TYPE_DST ) {
+               ip_nw = *(uint32_t*) stream_get(stream,
+                               ARPING_OFFSET_DST_IP, IP_ADDR_LEN);
+       } else {
+               printf("Address type be either src/dst\n");
+       }
+       return ntoh_long(ip_nw);
+}
+
+/**
+  * @brief  Set mac address
+  * @param  stream - output buffer
+  *         type - src/dest type of ip addr
+  *         mac - input mac addr
+  * @retval None
+  */
+static void arping_set_mac(uint8_t *stream, ie_type_e type, const uint8_t *mac)
+{
+       if (type == MAC_ADDR_TYPE_SRC) {
+               stream_set(stream, mac, ARPING_OFFSET_SRC_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_DST) {
+               stream_set(stream, mac, ARPING_OFFSET_DST_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_SRC_REPEAT) {
+               stream_set(stream, mac, ARPING_OFFSET_SRC_REPEAT_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_DST_REPEAT) {
+               stream_set(stream, mac, ARPING_OFFSET_DST_REPEAT_MAC, MAC_LEN);
+       } else {
+               printf("mac type be either src/dst/repeatSrc\n");
+       }
+}
+
+/**
+  * @brief  Get mac address
+  * @param  stream - input buffer
+  *         type - src/dest type of ip addr
+  * @retval output mac addr ptr
+  */
+static uint8_t * arping_get_mac(uint8_t *stream, ie_type_e type)
+{
+       uint8_t * mac= 0;
+
+       if (type == MAC_ADDR_TYPE_SRC) {
+               mac = stream_get(stream, ARPING_OFFSET_SRC_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_DST) {
+               mac = stream_get(stream, ARPING_OFFSET_DST_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_SRC_REPEAT) {
+               mac = stream_get(stream, ARPING_OFFSET_SRC_REPEAT_MAC, MAC_LEN);
+       } else if (type == MAC_ADDR_TYPE_DST_REPEAT) {
+               mac = stream_get(stream, ARPING_OFFSET_DST_REPEAT_MAC, MAC_LEN);
+       } else {
+               printf("mac type be either src/dst/srcRepeat\n");
+       }
+       return mac;
+}
+
+/**
+  * @brief  Set opcode
+  * @param  stream - input buffer
+  *         opcode - request/reply type
+  * @retval None
+  */
+static void arping_set_opcode(uint8_t *stream, const uint16_t opcode)
+{
+       uint16_t opcode_nw = hton_short(opcode);
+       stream_set(stream, &opcode_nw, ARPING_OFFSET_OPCODE, OPCODE_LEN);
+}
+
+/**
+  * @brief  Get opcode
+  * @param  stream - input buffer
+  * @retval opcode - request/reply type
+  */
+static uint16_t arping_get_opcode(uint8_t *stream)
+{
+       uint16_t opcode_nw = 0;
+       opcode_nw = *(uint16_t*)stream_get(stream,
+                       ARPING_OFFSET_OPCODE, OPCODE_LEN);
+       return (ntoh_short(opcode_nw));
+}
+
+
+/**
+  * @brief  Get protocol
+  * @param  stream - input buffer
+  * @retval protocol field
+  */
+static uint16_t arping_get_protocol(uint8_t *stream)
+{
+       uint16_t prot_nw = 0;
+       prot_nw = *(uint16_t*)stream_get(stream,
+                       ARPING_OFFSET_PROTOCOL, PROTOCOL_LEN_ARP);
+       return (ntoh_short(prot_nw));
+}
+
+
+/**
+  * @brief  Change ip addresses of src and dest
+  * @param  stream - input/output buffer
+  * @retval none
+  */
+static void arping_swap_ip_addresses(uint8_t * stream)
+{
+       uint32_t in_src_ip = 0;
+       uint32_t in_dst_ip = 0;
+       if (! stream)
+       {
+               printf("stream NULL passed\n\r");
+               return;
+       }
+
+       in_src_ip = arping_get_ipaddr(stream, IP_ADDR_TYPE_SRC);
+       in_dst_ip = arping_get_ipaddr(stream, IP_ADDR_TYPE_DST);
+
+       arping_set_ipaddr(stream, IP_ADDR_TYPE_DST, in_src_ip);
+       arping_set_ipaddr(stream, IP_ADDR_TYPE_SRC, in_dst_ip);
+}
+
+/**
+  * @brief  change mac addr for src/dest
+  * @param  stream - input/output buffer
+  *         self_mac - source mac
+  * @retval none
+  */
+static void arping_change_mac_addresses(uint8_t * stream,
+               const uint8_t *self_mac)
+{
+       uint8_t * rsp_mac = NULL;
+
+       if (! stream)
+       {
+               printf("stream NULL passed\n\r");
+               return;
+       }
+
+       rsp_mac = arping_get_mac(stream, MAC_ADDR_TYPE_SRC);
+
+       arping_set_mac(stream, MAC_ADDR_TYPE_DST, rsp_mac);
+       arping_set_mac(stream, MAC_ADDR_TYPE_DST_REPEAT, rsp_mac);
+       arping_set_mac(stream, MAC_ADDR_TYPE_SRC, self_mac);
+       arping_set_mac(stream, MAC_ADDR_TYPE_SRC_REPEAT, self_mac);
+}
+
+/**
+  * @brief  check if arp type of protocol
+  * @param  pkt - input buffer
+  * @retval true/false
+  */
+static uint8_t is_arp_packet(uint8_t *pkt)
+{
+       uint16_t prot = arping_get_protocol(pkt);
+       uint16_t opcode = arping_get_opcode(pkt);
+       if (PROTOCOL_ARP == prot) {
+               if (opcode < MAX_MSG_TYPE_ARPING) {
+                       return opcode;
+               }
+       }
+       return 0;
+}
+
+/**
+  * @brief  Display arp pkt content
+  * @param  pkt - input buffer
+  *         pkt_len - len of pkt
+  *         arp_msg - opcode of pkt
+  * @retval None
+  */
+static void display_arp(uint8_t *pkt, uint16_t pkt_len, uint8_t arp_msg)
+{
+       char ip_addr_s[16];
+       char mac_s[30];
+       uint8_t *mac = NULL;
+       char str_req[2][20] = {"ARP_REQ_RCVD", "ARP_RSP_RCVD"};
+
+       if (arp_msg < MAX_MSG_TYPE_ARPING) {
+               ipv4_addr_ntoa(arping_get_ipaddr(pkt, IP_ADDR_TYPE_SRC), ip_addr_s, 20);
+               mac = arping_get_mac(pkt, MAC_ADDR_TYPE_SRC);
+
+               snprintf(mac_s, 30, "%2x:%2x:%2x:%2x:%2x:%2x",
+                               mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+
+               printf("%s: %u bytes from %s (%s)\n\r",
+                               str_req[arp_msg-1], pkt_len,  ip_addr_s, mac_s);
+       }
+}
+
+/**
+  * @brief  check if pkt destination is me
+  * @param  src_ip - self ip
+  *         pkt - input buffer
+  * @retval 1 if pass, else 0
+  */
+static uint8_t is_arp_pkt_for_me(uint32_t *src_ip, uint8_t *pkt)
+{
+       uint32_t in_dst_ip = 0;
+
+       in_dst_ip = arping_get_ipaddr(pkt, IP_ADDR_TYPE_DST);
+       if (! is_same_buff(&in_dst_ip, src_ip, IP_ADDR_LEN) ){
+               return 0;
+       }
+
+       return 1;
+}
+
+
+/** Exported Functions **/
+
+/**
+  * @brief  check and handle input stream for arp packet
+  * @param  src_ip - self ip
+  *         src_mac - self mac addr
+  *         pkt - input buffer
+  *         pkt_len - pkt size
+  *         resp_len - rsp pkt size
+  * @retval arp response buffer if valid arp request or NULL
+  */
+uint8_t * arp_req_handler(uint32_t *src_ip, const uint8_t *src_mac,
+               uint8_t *pkt, uint16_t pkt_len, uint16_t *resp_len)
+{
+       uint8_t is_arp_req = 0;
+       uint8_t *arp_resp = NULL;
+
+       if (! pkt_len || ! pkt) {
+               if(resp_len)
+                       *resp_len = 0;
+               return NULL;
+       }
+
+       /* discard if not arp pkt */
+       is_arp_req = is_arp_packet(pkt);
+       if(! is_arp_req) {
+               return NULL;
+       }
+
+       if (! is_arp_pkt_for_me(src_ip, pkt)) {
+               return NULL;
+       }
+
+       display_arp(pkt, pkt_len, is_arp_req);
+
+       if(ARP_REPLY == is_arp_req) {
+               return NULL;
+       }
+
+       arp_resp = malloc(ARPING_MAX_PKT_SIZE);
+       assert(arp_resp);
+
+
+       /* replicate packet */
+       memset(arp_resp, 0, ARPING_MAX_PKT_SIZE);
+       memcpy(arp_resp, pkt, ARPING_MAX_PKT_SIZE);
+
+       /* set opcode */
+       arping_set_opcode(arp_resp, 2);
+
+       /* swap source and destination ip addresses */
+       arping_swap_ip_addresses(arp_resp);
+       arping_change_mac_addresses(arp_resp, src_mac);
+
+       if(resp_len)
+               *resp_len = pkt_len;
+
+       return arp_resp;
+}
+
+/**
+  * @brief  send arping request
+  * @param  net_handle - network handle
+  *         src_mac - source mac addr
+  *         src_ip - source ip addr
+  *         dst_mac - destination mac addr
+  *         dst_ip - destination ip addr
+  * @retval response if valid arp request or NULL
+  */
+stm_ret_t send_arp_req(struct network_handle *net_handle, uint8_t *src_mac,
+               uint32_t *src_ip, uint8_t *dst_mac, uint32_t *dst_ip)
+{
+       struct pbuf *buffer = NULL;
+       int ret;
+
+       if (!net_handle || !src_mac || !src_ip || !dst_mac || !dst_ip)
+               return STM_FAIL;
+
+       arping_set_mac(arp_req_tx, MAC_ADDR_TYPE_SRC, src_mac);
+       arping_set_mac(arp_req_tx, MAC_ADDR_TYPE_SRC_REPEAT, src_mac);
+
+       /* modify the request template */
+       arping_set_ipaddr(arp_req_tx, IP_ADDR_TYPE_DST, *dst_ip);
+       arping_set_ipaddr(arp_req_tx, IP_ADDR_TYPE_SRC, *src_ip);
+       arping_set_mac(arp_req_tx, MAC_ADDR_TYPE_DST, dst_mac);
+       arping_set_mac(arp_req_tx, MAC_ADDR_TYPE_DST_REPEAT, dst_mac);
+
+       buffer = malloc(sizeof(struct pbuf));
+       assert(buffer);
+
+       buffer->payload = malloc(ARPING_MAX_PKT_SIZE);
+       assert(buffer->payload);
+
+       buffer->len = 42;
+
+       memcpy(buffer->payload, arp_req_tx, ARPING_MAX_PKT_SIZE);
+
+       ret = network_write(net_handle, buffer);
+
+       return ret;
+}
+
diff --git a/host/stm32/app/data/arp_server_stub.h b/host/stm32/app/data/arp_server_stub.h
new file mode 100644 (file)
index 0000000..3ba7824
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __ARP_SERVER_STUB_H
+#define __ARP_SERVER_STUB_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Includes **/
+#include "common.h"
+
+/** constants/macros **/
+#define DEBUG_STREAM_ENABLED      1
+
+typedef enum {
+       MAC_ADDR_TYPE_SRC = 200,
+       MAC_ADDR_TYPE_SRC_REPEAT,
+       MAC_ADDR_TYPE_DST,
+       MAC_ADDR_TYPE_DST_REPEAT,
+       IP_ADDR_TYPE_SRC,
+       IP_ADDR_TYPE_DST,
+       PORT_TYPE_SRC,
+       PORT_TYPE_DST,
+       TYPE_MAX
+} ie_type_e;
+
+
+/** Exported Structures **/
+
+/** Exported variables **/
+
+/** Inline functions **/
+
+/** Exported Functions **/
+
+uint8_t * arp_req_handler(uint32_t *self_ip, const uint8_t *mac, uint8_t *pkt,
+               uint16_t pkt_len, uint16_t *resp_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 50f4e61b0c4caa14c59dffa28096a1b2637bb192..f293ab4e586b85219f5fa1c65823a95298840d07 100644 (file)
 char print_buff[2048*3];
 #endif
 
+uint16_t hton_short (uint16_t x)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  uint16_t val = 0;
+
+  val = (x &0x00FF)<<8;
+  val |= (x &0xFF00)>>8;
+
+  return val;
+#else
+# error "not able to identify endianness"
+#endif
+}
+
+uint32_t hton_long (uint32_t x)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+       uint32_t val = (x&0xFF000000) >> 24;
+
+       val |= (x&0x00FF0000) >> 8;
+       val |= (x&0x0000FF00) << 8;
+       val |= (x&0x000000FF) << 24;
+
+       return val;
+#else
+# error "not able to identify endianness"
+#endif
+}
+
+/**
+  * @brief  dump hex for buffer
+  * @param  buff - buff to print
+  *         rx_len - size of buf
+  *         human_str - help string to prepend
+  * @retval None
+  */
 void print_hex_dump(uint8_t *buff, uint16_t rx_len, char *human_str)
 {
 #if DEBUG_HEX_STREAM_PRINT
index 90dfacf5a42efb993f98b3bee13105c45362c55d..fb59200beab928e37e150c0c8f6dfd4aaa83c480 100644 (file)
@@ -33,6 +33,12 @@ extern "C" {
 #define htole16(x)                        ((uint16_t)(x))
 #define le16toh(x)                        ((uint16_t)(x))
 
+#define IP_ADDR_LEN                                      4
+#define MAC_LEN                           6
+#define MIN_MAC_STRING_LEN                17
+
+
+
 typedef enum stm_ret_s {
        STM_FAIL = -1,
        STM_OK = 0
@@ -64,6 +70,15 @@ typedef struct {
 /** Exported variables **/
 
 /** Exported Functions **/
+uint16_t hton_short (uint16_t x);
+uint32_t hton_long (uint32_t x);
+
+#define ntoh_long hton_long
+#define ntoh_short hton_short
+
+typedef unsigned char   u_char;
+typedef unsigned long   u_long;
+
 void hard_delay(int x);
 int min(int x, int y);
 
diff --git a/host/stm32/common/util.c b/host/stm32/common/util.c
new file mode 100644 (file)
index 0000000..ec462ff
--- /dev/null
@@ -0,0 +1,255 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/** Includes **/
+#include "util.h"
+#include "ctype.h"
+#include "string.h"
+#include "trace.h"
+
+/** Constants/Macros **/
+
+/** Exported variables **/
+
+/** Function declaration **/
+
+/** Exported Functions **/
+/*
+ * Check whether "cp" is a valid ascii representation
+ * of an Internet address and convert to a binary address.
+ * Returns 1 if the address is valid, 0 if not.
+ * This replaces inet_addr, the return value from which
+ * cannot distinguish between failure and a local broadcast address.
+ */
+int ipv4_addr_aton(const char *cp, uint32_t *ip_uint32)
+{
+       u_long val, base, n;
+       char c;
+       u_long parts[4], *pp = parts;
+
+       for (;;) {
+               /*
+                * Collect number up to ``.''.
+                * Values are specified as for C:
+                * 0x=hex, 0=octal, other=decimal.
+                */
+               val = 0; base = 10;
+               if (*cp == '0') {
+                       if (*++cp == 'x' || *cp == 'X')
+                               base = 16, cp++;
+                       else
+                               base = 8;
+               }
+               while ((c = *cp) != '\0') {
+                       if (isascii(c) && isdigit(c)) {
+                               val = (val * base) + (c - '0');
+                               cp++;
+                               continue;
+                       }
+                       if (base == 16 && isascii(c) && isxdigit(c)) {
+                               val = (val << 4) +
+                                       (c + 10 - (islower(c) ? 'a' : 'A'));
+                               cp++;
+                               continue;
+                       }
+                       break;
+               }
+               if (*cp == '.') {
+                       /*
+                        * Internet format:
+                        *      a.b.c.d
+                        *      a.b.c   (with c treated as 16-bits)
+                        *      a.b     (with b treated as 24 bits)
+                        */
+                       if (pp >= parts + 3 || val > 0xff)
+                               return (0);
+                       *pp++ = val, cp++;
+               } else
+                       break;
+       }
+       /*
+        * Check for trailing characters.
+        */
+       if (*cp && (!isascii(*cp) || !isspace(*cp)))
+               return (0);
+       /*
+        * Concoct the address according to
+        * the number of parts specified.
+        */
+       n = pp - parts + 1;
+       switch (n) {
+
+       case 1:                         /* a -- 32 bits */
+               break;
+
+       case 2:                         /* a.b -- 8.24 bits */
+               if (val > 0xffffff)
+                       return (0);
+               val |= parts[0] << 24;
+               break;
+
+       case 3:                         /* a.b.c -- 8.8.16 bits */
+               if (val > 0xffff)
+                       return (0);
+               val |= (parts[0] << 24) | (parts[1] << 16);
+               break;
+
+       case 4:                         /* a.b.c.d -- 8.8.8.8 bits */
+               if (val > 0xff)
+                       return (0);
+               val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+               break;
+       }
+       if(ip_uint32) {
+               *ip_uint32 = hton_long(val);
+       }
+       return (1);
+}
+
+/**
+ * @brief  convert ip in int to string
+ *
+ * @param addr ip address in network order to convert
+ * @param buf target buffer where the string is stored
+ * @param buflen length of buf
+ * @return either pointer to buf which now holds the ASCII
+ *         representation of addr or NULL if buf was too small
+ */
+
+char * ipv4_addr_ntoa(uint32_t addr, char *buf, int buflen)
+{
+       char inv[3];
+       char *rp;
+       uint8_t *ap;
+       uint8_t rem;
+       uint8_t n;
+       uint8_t i;
+       int len = 0;
+       uint32_t addr_nw = ntoh_long(addr);
+
+       rp = buf;
+       ap = (uint8_t *)&addr_nw;
+       for (n = 0; n < 4; n++) {
+               i = 0;
+               do {
+                       rem = *ap % (uint8_t)10;
+                       *ap /= (uint8_t)10;
+                       inv[i++] = (char)('0' + rem);
+               } while (*ap);
+               while (i--) {
+                       if (len++ >= buflen) {
+                               return NULL;
+                       }
+                       *rp++ = inv[i];
+               }
+               if (len++ >= buflen) {
+                       return NULL;
+               }
+               *rp++ = '.';
+               ap++;
+       }
+       *--rp = 0;
+       return buf;
+}
+
+/**
+  * @brief  Convert mac string to byte stream
+  * @param  out - output mac in bytes
+  *         s - input mac string
+  * @retval STM_OK/STM_FAIL
+  */
+stm_ret_t convert_mac_to_bytes(uint8_t *out, const char *s)
+{
+       int mac[MAC_LEN] = {0};
+       int num_bytes = 0;
+
+       if (!s || (strlen(s) < MIN_MAC_STRING_LEN))  {
+               return STM_FAIL;
+       }
+
+       num_bytes =  sscanf(s, "%2x:%2x:%2x:%2x:%2x:%2x",
+                       &mac[0],&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
+
+       if ((num_bytes < MAC_LEN)  ||
+               (mac[0] > 0xFF) ||
+               (mac[1] > 0xFF) ||
+               (mac[2] > 0xFF) ||
+               (mac[3] > 0xFF) ||
+               (mac[4] > 0xFF) ||
+               (mac[5] > 0xFF)) {
+               return STM_FAIL;
+       }
+
+       out[0] = mac[0]&0xff;
+       out[1] = mac[1]&0xff;
+       out[2] = mac[2]&0xff;
+       out[3] = mac[3]&0xff;
+       out[4] = mac[4]&0xff;
+       out[5] = mac[5]&0xff;
+
+       return STM_OK;
+}
+
+/**
+  * @brief  compare two buff in bytes
+  * @param  buff1 - in bytes
+  *         buff2 - in bytes
+  * @retval 1 if same, else 0
+  */
+uint8_t is_same_buff(void *buff1, void *buff2, uint16_t len)
+{
+       uint16_t idx;
+       uint8_t *b1 = (uint8_t*)buff1;
+       uint8_t *b2 = (uint8_t*)buff2;
+
+       if ((b1 == NULL) && (b2==NULL)) {
+               if(len) {
+                       return 0;
+               }
+               return 1;
+       }
+
+       if(!b1 || !b2) {
+               return 0;
+       }
+
+       /* Function assumes buff1 and buff2 are allocated for len */
+       for (idx=0; idx < len; idx++) {
+               if (*b1 != *b2) {
+                       return 0;
+               }
+               b1++;
+               b2++;
+       }
+       return 1;
+}
+
+/**
+  * @brief  Get ip in 32bit from dotted string notation
+  * @param  ip_s - input ip address in string
+  *         ip_x - output ip address in 32 bit
+  * @retval STM_OK/STM_FAIL
+  */
+stm_ret_t get_ipaddr_from_str(const char *ip_s, uint32_t *ip_x)
+{
+       uint32_t ip_nw = 0;
+       if (! ipv4_addr_aton(ip_s, &ip_nw))
+       {
+               return STM_FAIL;
+       }
+       /* ipv4_addr_aton does conversion in network order. reverse */
+       *ip_x = ntoh_long(ip_nw);
+       return STM_OK;
+}
diff --git a/host/stm32/common/util.h b/host/stm32/common/util.h
new file mode 100644 (file)
index 0000000..bf5b515
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __UTIL_H
+#define __UTIL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Includes **/
+#include "common.h"
+
+/** Constants/Macros **/
+
+/** Exported Structures **/
+
+/** Exported variables **/
+
+/** Exported Functions **/
+
+stm_ret_t get_ipaddr_from_str(const char *ip_s, uint32_t *ip_x);
+int ipv4_addr_aton(const char *cp, uint32_t *ip_uint32);
+char * ipv4_addr_ntoa(const uint32_t addr, char *buf, int buflen);
+stm_ret_t convert_mac_to_bytes(uint8_t *out, const char *s);
+uint8_t is_same_buff(void *buff1, void *buff2, uint16_t len);
+stm_ret_t get_self_ip(int iface_type, uint32_t *self_ip);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/host/stm32/driver/netif/netdev_if.h b/host/stm32/driver/netif/netdev_if.h
new file mode 100644 (file)
index 0000000..fdae1a7
--- /dev/null
@@ -0,0 +1,100 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __NETDEV_IF_H
+#define __NETDEV_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Network data buffer
+ */
+struct pbuf {
+       /* Data buffer */
+       uint8_t *payload;
+       /* Length of data buffer */
+       uint16_t len;
+};
+
+/**
+ * @brief Network device instance
+ */
+typedef struct netdev * netdev_handle_t;
+
+/**
+ * @brief Network operations implemented by driver
+ */
+struct netdev_ops {
+       /* Open device */
+       int (* netdev_open) (netdev_handle_t netdev);
+       /* Close device */
+       int (* netdev_close) (netdev_handle_t netdev);
+       /* Transmit packet */
+       int (* netdev_xmit) (netdev_handle_t netdev, struct pbuf *net_buf);
+};
+
+/**
+ * @brief Allocate network device instance for given interface name
+ * @param sizeof_priv - sizeof driver private instance
+ * @param name - Interface name
+ * @retval network device instance
+ */
+netdev_handle_t netdev_alloc(uint32_t sizeof_priv, char *name);
+
+/**
+ * @brief Free network device instance
+ * @param netdev - Network device instance
+ * @retval none
+ */
+void netdev_free(netdev_handle_t netdev);
+
+/**
+ * @brief Returns address of driver priv instance from network device instance
+ * @param netdev - Network device instance
+ * @retval - Driver priv instance
+ */
+void * netdev_get_priv(netdev_handle_t netdev);
+
+/**
+ *  @brief Register a network interface
+ *  @param netdev - Network device instance
+ *  @param netdev_ops - Network operations implemented by driver
+ *  @retval -   on success: 0
+ *              on failure: -1
+ */
+int netdev_register(netdev_handle_t netdev, struct netdev_ops *ops);
+
+/**
+ * @brief Unregister network interfcace
+ * @param netdev - Network device instance
+ * @retval -    on success: 0
+ *              on failure: -1
+ */
+int netdev_unregister(netdev_handle_t netdev);
+
+/**
+ * @brief Rx handler of network stack
+ * @param netdev - Network device instance
+ * @param pbuf - received data buffer
+ */
+int netdev_rx(netdev_handle_t netdev, struct pbuf *net_buf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/host/stm32/driver/network/netdev_api.c b/host/stm32/driver/network/netdev_api.c
new file mode 100644 (file)
index 0000000..50eb1ae
--- /dev/null
@@ -0,0 +1,144 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "common.h"
+#include "trace.h"
+#include "netdev_if.h"
+#include "netdev_api.h"
+
+/**
+  * @brief  init network interface
+  * @param  None
+  * @retval STM_OK/STM_FAIL
+  */
+int network_init(void)
+{
+       netdev_init();
+       return STM_OK;
+}
+
+
+/**
+  * @brief  open and return network interface handle
+  * @param  if_name - interfae to open
+  *         net_rx_callback - callback called on incoming data
+  * @retval handle of network interface
+  */
+struct network_handle * network_open(char *if_name, void (* net_rx_callback)(struct network_handle *))
+{
+       struct netdev *ndev = NULL;
+       struct network_handle *net_handle = NULL;
+
+       if (!if_name)
+               return NULL;
+
+       ndev = netdev_get(if_name);
+
+       if (!ndev) {
+               printf ("Invalid interface name\n");
+               return NULL;
+       }
+
+       /* create network handle */
+       net_handle = malloc(sizeof(struct network_handle));
+
+       net_handle->ndev = ndev;
+       net_handle->net_rx_callback = net_rx_callback;
+
+       if (netdev_open(ndev)) {
+               printf ("Failed to setup netdev\n");
+               free(net_handle);
+               return NULL;
+       }
+
+       ndev->net_handle = net_handle;
+
+       return net_handle;
+}
+
+
+/**
+  * @brief  read from network interface
+  * @param  handle - network interface handle
+  *         net_rx_callback - callback called on incoming data
+  *         xTicksToWait - wait for ticks
+  * @retval buffer read
+  */
+struct pbuf * network_read(struct network_handle *handle, TickType_t xTicksToWait)
+{
+       struct pbuf *buffer = NULL;
+
+       if (!handle || !handle->ndev)
+               return NULL;
+
+       buffer = malloc(sizeof(struct pbuf));
+
+       if (!buffer)
+               return NULL;
+
+       xQueueReceive(handle->ndev->rx_q, buffer, xTicksToWait);
+
+       return buffer;
+}
+
+
+/**
+  * @brief  write onnetwork interface
+  * @param  handle - network interface handle
+  *         buffer - buffer to transmit
+  * @retval 0 on success
+  */
+int network_write(struct network_handle *net_handle, struct pbuf *buffer)
+{
+       struct netdev *ndev;
+       int ret;
+
+       if (!net_handle || !buffer)
+               return STM_FAIL;
+
+       ndev = net_handle->ndev;
+
+       if (ndev && (ndev->state == NETDEV_STATE_UP)) {
+               if (ndev->net_ops && ndev->net_ops->netdev_xmit) {
+                       ret = ndev->net_ops->netdev_xmit(ndev, buffer);
+               }
+       }
+
+       return ret;
+}
+
+
+/**
+  * @brief  close network interface
+  * @param  handle - network interface handle
+  * @retval 0 on success
+  */
+int network_close(struct network_handle *net_handle)
+{
+       netdev_close(net_handle->ndev);
+       free(net_handle);
+
+       return STM_OK;
+}
+
+
+/**
+  * @brief  destroy network interface
+  * @param  None
+  * @retval None
+  */
+int network_deinit(void)
+{
+       return STM_OK;
+}
diff --git a/host/stm32/driver/network/netdev_api.h b/host/stm32/driver/network/netdev_api.h
new file mode 100644 (file)
index 0000000..ce7a705
--- /dev/null
@@ -0,0 +1,74 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __NETDEV_API_H
+#define __NETDEV_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "netdev_stub.h"
+
+/**
+  * @brief  init network interface
+  * @param  None
+  * @retval STM_OK/STM_FAIL
+  */
+int network_init(void);
+
+/**
+  * @brief  open and return network interface handle
+  * @param  if_name - interfae to open
+  *         net_rx_callback - callback called on incoming data
+  * @retval handle of network interface
+  */
+struct network_handle * network_open(char *if_name, void (* net_rx_callback)(struct network_handle *));
+
+/**
+  * @brief  read from network interface
+  * @param  handle - network interface handle
+  *         net_rx_callback - callback called on incoming data
+  *         xTicksToWait - wait for ticks
+  * @retval buffer read
+  */
+struct pbuf * network_read(struct network_handle *handle, TickType_t xTicksToWait);
+
+/**
+  * @brief  write onnetwork interface
+  * @param  handle - network interface handle
+  *         buffer - buffer to transmit
+  * @retval 0 on success
+  */
+int network_write(struct network_handle *, struct pbuf *buffer);
+
+/**
+  * @brief  close network interface
+  * @param  handle - network interface handle
+  * @retval 0 on success
+  */
+int network_close(struct network_handle *net_handle);
+
+/**
+  * @brief  destroy network interface
+  * @param  None
+  * @retval None
+  */
+int network_deinit(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/host/stm32/driver/network/netdev_stub.c b/host/stm32/driver/network/netdev_stub.c
new file mode 100644 (file)
index 0000000..affcc3d
--- /dev/null
@@ -0,0 +1,272 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "trace.h"
+#include "string.h"
+#include "cmsis_os.h"
+#include "netdev_if.h"
+#include "app_main.h"
+
+struct netdev *ndev_db[MAX_INTERFACE];
+static uint8_t ndev_index = 0;
+
+/**
+  * @brief  initialize detdev
+  * @param  None
+  * @retval None
+  */
+void netdev_init(void)
+{
+       int i;
+
+       for (i = 0; i < MAX_INTERFACE; i++) {
+               ndev_db[i] = NULL;
+       }
+}
+
+/**
+  * @brief  open netdev
+  * @param  ndev - netdev
+  * @retval 0 on success
+  */
+int netdev_open(netdev_handle_t ndev)
+{
+       if (!ndev)
+               return STM_FAIL;
+
+       if (ndev->rx_q) {
+               xQueueReset(ndev->rx_q);
+               return STM_OK;
+       }
+
+       ndev->rx_q = xQueueCreate(RX_QUEUE_SIZE, sizeof(struct pbuf));
+
+       if (!ndev->rx_q)
+               return STM_FAIL;
+
+       ndev->state = NETDEV_STATE_UP;
+
+       return STM_OK;
+}
+
+/**
+  * @brief  close netdev
+  * @param  ndev - netdev
+  * @retval None
+  */
+void netdev_close(netdev_handle_t ndev)
+{
+       if (!ndev)
+               return;
+
+       ndev->state = NETDEV_STATE_DOWN;
+
+       osDelay(200);
+
+       /* reset queue */
+       if (ndev->rx_q)
+               xQueueReset(ndev->rx_q);
+
+       ndev->net_handle = NULL;
+}
+
+/**
+  * @brief  get netdev handle from interface name
+  * @param  if_name - interface name
+  * @retval netdev handle
+  */
+struct netdev * netdev_get(char *if_name)
+{
+       int i = 0;
+       struct netdev *ndev;
+
+       if (!if_name)
+               return NULL;
+
+       while (i < MAX_INTERFACE) {
+               ndev = ndev_db[i];
+
+               if (ndev) {
+                       if (strncmp(if_name, ndev->name, MAX_IF_NAME_SIZE) == 0)
+                               return ndev;
+               }
+
+               i++;
+       }
+
+       return NULL;
+}
+
+/**
+  * @brief  allocate netdev handle for interface
+  * @param  sizeof_priv - size of priv interface
+  *         name - interface name
+  * @retval allocated netdev
+  */
+netdev_handle_t netdev_alloc(uint32_t sizeof_priv, char *name)
+{
+       struct netdev *ndev = NULL;
+
+       if (!name)
+               return NULL;
+
+       ndev = (struct netdev *) malloc(sizeof(struct netdev));
+
+       if (ndev) {
+               memset(ndev, 0, sizeof(struct netdev));
+               memcpy(ndev->name, name, MAX_IF_NAME_SIZE);
+
+               ndev->priv = malloc(sizeof_priv);
+
+               if (!ndev->priv) {
+                       printf("Failed to allocate memory for priv\n");
+                       free(ndev);
+                       return NULL;
+               }
+       } else {
+               printf("Failed to allocate memory for net dev\n");
+       }
+
+       return ndev;
+}
+
+
+/**
+  * @brief  free netdev's private handle
+  * @param  dev - netdev handle
+  * @retval None
+  */
+void netdev_free(netdev_handle_t dev)
+{
+       struct netdev *ndev = (struct netdev *) dev;
+
+       if (ndev) {
+               if (ndev->priv)
+                       free(ndev->priv);
+
+               if (ndev->net_handle)
+                       free(ndev->net_handle);
+
+               free(ndev);
+       }
+}
+
+
+/**
+  * @brief  get netdev's private interface
+  * @param  dev - private interface
+  * @retval private interface handle on success else NULL
+  */
+void * netdev_get_priv(netdev_handle_t dev)
+{
+       struct netdev *ndev = (struct netdev *) dev;
+
+       if (ndev) {
+               return ndev->priv;
+       }
+
+       return NULL;
+}
+
+
+/**
+  * @brief  register netdev
+  * @param  dev - private interface
+  *         ops - network options to register
+  * @retval 0 on success, else -1
+  */
+int netdev_register(netdev_handle_t dev, struct netdev_ops *ops)
+{
+       struct netdev *ndev = (struct netdev *) dev;
+
+       if (!ndev || !ops) {
+               printf ("Invalid arguments\n");
+               return STM_FAIL;
+       }
+
+       ndev->net_ops = ops;
+       ndev->state = NETDEV_STATE_UP;
+       ndev_db[ndev_index % MAX_INTERFACE] = ndev;
+
+       ndev_index++;
+
+       return STM_OK;
+}
+
+
+/**
+  * @brief  unregister netdev
+  * @param  dev - private interface
+  * @retval 0 on success, else -1
+  */
+int netdev_unregister(netdev_handle_t dev)
+{
+       struct netdev *ndev = (struct netdev *) dev;
+
+       if (!ndev) {
+               printf ("Invalid arguments\n");
+               return STM_FAIL;
+       }
+
+       ndev->net_ops = NULL;
+       ndev->state = NETDEV_STATE_DOWN;
+
+       return STM_OK;
+}
+
+/**
+  * @brief  receive on netdev
+  * @param  dev - private interface
+  *         net_buf - buffer received
+  * @retval 0 on success, else -1
+  */
+int netdev_rx(netdev_handle_t dev, struct pbuf *net_buf)
+{
+       struct netdev *ndev = (struct netdev *) dev;
+       struct network_handle *net_handle;
+
+       if (!ndev || !net_buf) {
+               printf ("Invalid arguments\n");
+               return STM_FAIL;
+       }
+
+       if (ndev->state == NETDEV_STATE_UP) {
+               if (pdTRUE != xQueueSend(ndev->rx_q, net_buf, portMAX_DELAY)) {
+                       printf ("Failed to enqueue received packet\n");
+                       goto done;
+               }
+
+               net_handle = (struct network_handle *) ndev->net_handle;
+
+               if (net_handle->net_rx_callback)
+                       net_handle->net_rx_callback(net_handle);
+
+               free(net_buf);
+
+       } else {
+               goto done;
+       }
+
+       return STM_OK;
+
+done:
+       if (net_buf) {
+               if (net_buf->payload) {
+                       free(net_buf->payload);
+               }
+               free(net_buf);
+       }
+       return STM_FAIL;
+}
diff --git a/host/stm32/driver/network/netdev_stub.h b/host/stm32/driver/network/netdev_stub.h
new file mode 100644 (file)
index 0000000..f8d1443
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/** prevent recursive inclusion **/
+#ifndef __NETDEV_STUB_H
+#define __NETDEV_STUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "FreeRTOS.h"
+#include "queue.h"
+#include "common.h"
+#include "netdev_if.h"
+
+#define MAX_IF_NAME_SIZE    256
+#define MAX_INTERFACE       2
+
+#define NETDEV_STATE_DOWN   0
+#define NETDEV_STATE_UP     1
+
+#define RX_QUEUE_SIZE       50
+
+struct network_handle;
+
+struct netdev {
+       /* Interface name */
+       char name[MAX_IF_NAME_SIZE];
+
+       /* Driver API's */
+       struct netdev_ops *net_ops;
+
+       /* Netdev state */
+       uint8_t state;
+
+       /*Application handle */
+       struct network_handle *net_handle;
+
+       /* Rx queue */
+       QueueHandle_t rx_q;
+
+       /* Driver priv */
+       void *priv;
+};
+
+struct network_handle {
+       struct netdev *ndev;
+       void (* net_rx_callback)();
+};
+
+/**
+  * @brief  initialize detdev
+  * @param  None
+  * @retval None
+  */
+void netdev_init();
+
+/**
+  * @brief  open netdev
+  * @param  ndev - netdev
+  * @retval 0 on success
+  */
+int netdev_open(struct netdev *ndev);
+
+/**
+  * @brief  close netdev
+  * @param  ndev - netdev
+  * @retval None
+  */
+void netdev_close(struct netdev *ndev);
+
+/**
+  * @brief  get netdev handle from interface name
+  * @param  if_name - interface name
+  * @retval netdev handle
+  */
+struct netdev * netdev_get(char *if_name);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
index 3d5c8634e3907a290b1c35931849d66de5353250..165db5d40e9b5daf28e519a962e1bf0a7995d982 100644 (file)
@@ -24,8 +24,7 @@ extern "C" {
 #include "common.h"
 
 /** Exported Functions **/
-stm_ret_t serial_rx_handler(interface_buffer_handle_t buf_handle,
-               uint8_t * rxbuff, uint16_t rx_len);
+stm_ret_t serial_rx_handler(uint8_t if_num, uint8_t *rxbuff, uint16_t rx_len);
 
 #ifdef __cplusplus
 }
index 04866c8c67463754c7eb72037a8d420eac26f65f..23f9b4be1a5b69c59a16ae306cdf655398ff1586 100644 (file)
@@ -139,7 +139,6 @@ static uint8_t * serial_read(const serial_handle_t * serial_hdl,
                                                         uint16_t * rlen)
 {
        /* This is a non-blocking call */
-       uint8_t *rbuffer = NULL;
        interface_buffer_handle_t buf_handle = {0};
 
        /* Initial value */
@@ -178,25 +177,9 @@ static uint8_t * serial_read(const serial_handle_t * serial_hdl,
                return NULL;
        }
 
-       /* SPI driver allocates buffer for interface header + payload.
-        * Here onward we do not need interface header, so strip off
-        * interface header and only allocate buffer for payload_len.
-        */
-       rbuffer = (uint8_t*)malloc(buf_handle.payload_len);
-       if (! rbuffer) {
-               printf("serial read malloc failed\n\r");
-               return NULL;
-       }
-
        *rlen = buf_handle.payload_len;
-       memcpy(rbuffer, buf_handle.payload, buf_handle.payload_len);
 
-       /* free up lower level spi driver buffer */
-       if (buf_handle.free_buf_handle) {
-               buf_handle.free_buf_handle(buf_handle.priv_buffer_handle);
-       }
-
-       return rbuffer;
+       return buf_handle.payload;
 }
 
 /**
@@ -228,22 +211,28 @@ static int serial_write(const serial_handle_t * serial_hdl,
   *         rx_len - size of rxbuff
   * @retval None
   */
-stm_ret_t serial_rx_handler(interface_buffer_handle_t buf_handle,
-       uint8_t *rxbuff, uint16_t rx_len)
+stm_ret_t serial_rx_handler(uint8_t if_num, uint8_t *rxbuff, uint16_t rx_len)
 {
+       interface_buffer_handle_t buf_handle = {0};
        serial_handle_t * serial_hdl = NULL;
 
-       serial_hdl = get_serial_handle(buf_handle.if_num);
+       serial_hdl = get_serial_handle(if_num);
 
        if ((! serial_hdl) || (serial_hdl->state != ACTIVE)) {
                printf("Serial interface not registered yet\n\r");
                return STM_FAIL ;
        }
+       buf_handle.if_type = ESP_SERIAL_IF;
+       buf_handle.if_num = if_num;
+       buf_handle.payload_len = rx_len;
+       buf_handle.payload = rxbuff;
+       buf_handle.priv_buffer_handle = rxbuff;
+       buf_handle.free_buf_handle = free;
 
        /* send to serial queue */
        if (pdTRUE != xQueueSend(serial_hdl->queue,
                    &buf_handle, portMAX_DELAY)) {
-               printf("Failed send serialif queue[%u]\n\r", buf_handle.if_num);
+               printf("Failed send serialif queue[%u]\n\r", if_num);
                return STM_FAIL;
        }
 
index 374796f41cdcf401a1cf8f4dea1db34e00583c26..e389b1f787807a83275c32f3e1702819c1d235a7 100644 (file)
@@ -21,6 +21,7 @@
 #include "spi_drv.h"
 #include "adapter.h"
 #include "serial_drv.h"
+#include "netdev_if.h"
 
 /** Constants/Macros **/
 #define TO_SLAVE_QUEUE_SIZE                  20
 
 #define MAX_PAYLOAD_SIZE (MAX_SPI_BUFFER_SIZE-sizeof(struct esp_payload_header))
 
+static int esp_netdev_open(netdev_handle_t netdev);
+static int esp_netdev_close(netdev_handle_t netdev);
+static int esp_netdev_xmit(netdev_handle_t netdev, struct pbuf *net_buf);
+
+static struct esp_private *esp_priv[MAX_NETWORK_INTERFACES];
+
+static struct netdev_ops esp_net_ops = {
+       .netdev_open = esp_netdev_open,
+       .netdev_close = esp_netdev_close,
+       .netdev_xmit = esp_netdev_xmit,
+};
+
 /** Exported variables **/
 
 static osSemaphoreId osSemaphore;
@@ -50,7 +63,135 @@ static void (*spi_drv_evt_handler_fp) (uint8_t);
 static void transaction_task(void const* pvParameters);
 static void process_rx_task(void const* pvParameters);
 static uint8_t * get_tx_buffer(void);
+static void deinit_netdev(void);
+
+/**
+  * @brief  get private interface of expected type and number
+  * @param  if_type - interface type
+  *         if_num - interface number
+  * @retval interface handle if found, else NULL
+  */
+static struct esp_private * get_priv(uint8_t if_type, uint8_t if_num)
+{
+       int i = 0;
+
+       for (i = 0; i < MAX_NETWORK_INTERFACES; i++) {
+               if((esp_priv[i]) &&
+                       (esp_priv[i]->if_type == if_type) &&
+                       (esp_priv[i]->if_num == if_num))
+                       return esp_priv[i];
+       }
+
+       return NULL;
+}
+
+/**
+  * @brief  open virtual network device
+  * @param  netdev - network device
+  * @retval 0 on success
+  */
+static int esp_netdev_open(netdev_handle_t netdev)
+{
+       return STM_OK;
+}
+
+/**
+  * @brief  close virtual network device
+  * @param  netdev - network device
+  * @retval 0 on success
+  */
+static int esp_netdev_close(netdev_handle_t netdev)
+{
+       return STM_OK;
+}
+
+/**
+  * @brief  transmit on virtual network device
+  * @param  netdev - network device
+  *         net_buf - buffer to transmit
+  * @retval None
+  */
+static int esp_netdev_xmit(netdev_handle_t netdev, struct pbuf *net_buf)
+{
+       struct esp_private *priv;
+       int ret;
+
+       if (!netdev || !net_buf)
+               return STM_FAIL;
+       priv = (struct esp_private *) netdev_get_priv(netdev);
+
+       if (!priv)
+               return STM_FAIL;
+
+       ret = send_to_slave(priv->if_type, priv->if_num,
+                       net_buf->payload, net_buf->len);
+       free(net_buf);
+
+       return ret;
+}
 
+/**
+  * @brief  create virtual network device
+  * @param  None
+  * @retval None
+  */
+static int init_netdev(void)
+{
+       void *ndev = NULL;
+       int i = 0;
+       struct esp_private *priv = NULL;
+       char *if_name = STA_INTERFACE;
+       uint8_t if_type = ESP_STA_IF;
+
+       for (i = 0; i < MAX_NETWORK_INTERFACES; i++) {
+               /* Alloc and init netdev */
+               ndev = netdev_alloc(sizeof(struct esp_private), if_name);
+               if (!ndev) {
+                       deinit_netdev();
+                       return STM_FAIL;
+               }
+
+               priv = (struct esp_private *) netdev_get_priv(ndev);
+               if (!priv) {
+                       deinit_netdev();
+                       return STM_FAIL;
+               }
+
+               priv->netdev = ndev;
+               priv->if_type = if_type;
+               priv->if_num = 0;
+
+               if (netdev_register(ndev, &esp_net_ops)) {
+                       deinit_netdev();
+                       return STM_FAIL;
+               }
+
+               if_name = SOFTAP_INTERFACE;
+               if_type = ESP_AP_IF;
+
+               esp_priv[i] = priv;
+       }
+
+       return STM_OK;
+}
+
+/**
+  * @brief  destroy virtual network device
+  * @param  None
+  * @retval None
+  */
+static void deinit_netdev(void)
+{
+       for (int i = 0; i < MAX_NETWORK_INTERFACES; i++) {
+               if (esp_priv[i]) {
+                       if (esp_priv[i]->netdev) {
+                               netdev_unregister(esp_priv[i]->netdev);
+                               netdev_free(esp_priv[i]->netdev);
+                       }
+                       esp_priv[i] = NULL;
+               }
+       }
+}
 
 /** function definition **/
 
@@ -66,6 +207,7 @@ void stm_spi_init(void(*spi_drv_evt_handler)(uint8_t))
        spi_drv_evt_handler_fp = spi_drv_evt_handler;
        osSemaphoreDef(SEM);
 
+       init_netdev();
        /* spi handshake semaphore */
        osSemaphore = osSemaphoreCreate(osSemaphore(SEM) , 1);
        assert(osSemaphore);
@@ -139,11 +281,10 @@ stm_ret_t send_to_slave(uint8_t iface_type, uint8_t iface_num,
        buf_handle.if_num = iface_num;
        buf_handle.payload_len = wlen;
        buf_handle.payload = wbuffer;
-       buf_handle.priv_buffer_handle = NULL;
-       buf_handle.free_buf_handle = NULL;
+       buf_handle.priv_buffer_handle = wbuffer;
+       buf_handle.free_buf_handle = free;
 
-       if (pdTRUE != xQueueSend(to_slave_queue, &buf_handle, portMAX_DELAY))
-       {
+       if (pdTRUE != xQueueSend(to_slave_queue, &buf_handle, portMAX_DELAY)) {
                printf("Failed to send buffer to_slave_queue\n\r");
                return STM_FAIL;
        }
@@ -178,7 +319,7 @@ static stm_ret_t spi_transaction(uint8_t * txbuff)
        assert(txbuff);
 
        /* Allocate rx buffer */
-       rxbuff = (uint8_t *) malloc(MAX_SPI_BUFFER_SIZE);
+       rxbuff = (uint8_t *)malloc(MAX_SPI_BUFFER_SIZE);
        assert(rxbuff);
 
        memset(rxbuff, 0, MAX_SPI_BUFFER_SIZE);
@@ -205,7 +346,8 @@ static stm_ret_t spi_transaction(uint8_t * txbuff)
                                /* Free up buffer, as one of following -
                                 * 1. no payload to process
                                 * 2. input packet size > driver capacity
-                                * 3. payload header size mismatch, wrong header/bit packing?
+                                * 3. payload header size mismatch,
+                                * wrong header/bit packing?
                                 * */
                                if (rxbuff) {
                                        free(rxbuff);
@@ -296,9 +438,11 @@ static void process_rx_task(void const* pvParameters)
 {
        stm_ret_t ret = STM_OK;
        interface_buffer_handle_t buf_handle = {0};
-       uint8_t free_needed = 1;
        uint8_t *payload = NULL;
+       struct pbuf *buffer = NULL;
        struct esp_priv_event *event = NULL;
+       struct esp_private *priv = NULL;
+       uint8_t *serial_buf = NULL;
 
        while (1) {
                ret = xQueueReceive(from_slave_queue, &buf_handle, portMAX_DELAY);
@@ -313,24 +457,41 @@ static void process_rx_task(void const* pvParameters)
                /* process received buffer for all possible interface types */
                if (buf_handle.if_type == ESP_SERIAL_IF) {
 
+                       serial_buf = (uint8_t *)malloc(buf_handle.payload_len);
+                       assert(serial_buf);
+
+                       memcpy(serial_buf, payload, buf_handle.payload_len);
+
                        /* serial interface path */
-                       if (STM_OK == serial_rx_handler(buf_handle, payload,
-                                               buf_handle.payload_len)) {
-                               free_needed = 0;
-                       }
-               } else if(buf_handle.if_type == ESP_STA_IF) {
+                       serial_rx_handler(buf_handle.if_num, serial_buf,
+                                       buf_handle.payload_len);
+
+               } else if((buf_handle.if_type == ESP_STA_IF) ||
+                               (buf_handle.if_type == ESP_AP_IF)) {
+                       priv = get_priv(buf_handle.if_type, buf_handle.if_num);
+
+                       if (priv) {
+                               buffer = (struct pbuf *)malloc(sizeof(struct pbuf));
+                               assert(buffer);
 
-                       /* TODO: Handle handle packets from esp station */
-                       /* Next patch will cover this functionality */
-                       UNUSED_VAR(payload);
+                               buffer->len = buf_handle.payload_len;
+                               buffer->payload = malloc(buf_handle.payload_len);
+                               assert(buffer->payload);
+
+                               memcpy(buffer->payload, buf_handle.payload,
+                                               buf_handle.payload_len);
+
+                               netdev_rx(priv->netdev, buffer);
+                       }
 
                } else if (buf_handle.if_type == ESP_PRIV_IF) {
                        /* priv transaction received */
 
                        event = (struct esp_priv_event *) (payload);
                        if (event->event_type == ESP_PRIV_EVENT_INIT) {
-                               /* halt spi transactions for some time, this is one time delay,
-                                * to give breathing time to slave before spi trans start */
+                               /* halt spi transactions for some time,
+                                * this is one time delay, to give breathing
+                                * time to slave before spi trans start */
                                stop_spi_transactions_for_msec(50000);
                                if (spi_drv_evt_handler_fp) {
                                        spi_drv_evt_handler_fp(SPI_DRIVER_ACTIVE);
@@ -345,10 +506,8 @@ static void process_rx_task(void const* pvParameters)
                 * responsible for freeing buffer. In case not offloaded or
                 * failed to offload, buffer should be freed here.
                 */
-               if (free_needed) {
-                       if (buf_handle.free_buf_handle) {
-                               buf_handle.free_buf_handle(buf_handle.priv_buffer_handle);
-                       }
+               if (buf_handle.free_buf_handle) {
+                       buf_handle.free_buf_handle(buf_handle.priv_buffer_handle);
                }
        }
 }
index 4f8245728f520158807c4cd12cfa02090cdbac13..f49c154b09d2c5a48b6a6f9ed5bf629ad479d28e 100644 (file)
@@ -24,6 +24,10 @@ extern "C" {
 #include "common.h"
 
 /** constants/macros **/
+#define MAX_NETWORK_INTERFACES  2
+#define STA_INTERFACE           "ESP_STATION"
+#define SOFTAP_INTERFACE        "ESP_SOFTAP"
+
 typedef enum spi_drv_events_s {
        SPI_DRIVER_ACTIVE
 } spi_drv_events_e;
@@ -39,6 +43,12 @@ void stm_spi_init(void(*spi_drv_evt_handler)(uint8_t));
 stm_ret_t send_to_slave(uint8_t iface_type, uint8_t iface_num,
                uint8_t * wbuffer, uint16_t wlen);
 
+struct esp_private {
+       uint8_t     if_type;
+       uint8_t     if_num;
+       void        *netdev;
+};
+
 #ifdef __cplusplus
 }
 #endif
index e7250a4318359380642088452ca30079a508ff03..1832067545fa339af83cfb1b79c212d5d4aae9cb 100644 (file)
@@ -5,20 +5,23 @@
                        <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.661834455" moduleId="org.eclipse.cdt.core.settings" name="Debug">
                                <macros>
                                        <stringMacro name="CODE_BASE" type="VALUE_PATH_DIR" value="/my/abs/git/repo/path/of/hosted"/>
-                                       <stringMacro name="INPUT__OPERATING_MODE" type="VALUE_TEXT" value="&quot;STATION&quot;"/>
-                                       <stringMacro name="INPUT_STATION_IS_WPA3_SUPPORTED" type="VALUE_TEXT" value="0"/>
-                                       <stringMacro name="INPUT_SOFTAP_SSID_HIDDEN" type="VALUE_TEXT" value="0"/>
-                                       <stringMacro name="INPUT_GET_CONNECTED_STATIONS_LIST" type="VALUE_TEXT" value="1"/>
-                                       <stringMacro name="INPUT_STATION_BSSID" type="VALUE_TEXT" value="&quot;0&quot;"/>
-                                       <stringMacro name="INPUT_SOFTAP_CHANNEL" type="VALUE_TEXT" value="1"/>
+                                       <stringMacro name="INPUT__OPERATING_MODE" type="VALUE_TEXT" value="&quot;STATION+SOFTAP&quot;"/>
+                                       <stringMacro name="INPUT_STATION__SSID" type="VALUE_TEXT" value="&quot;MyWifi&quot;"/>
                                        <stringMacro name="INPUT_STATION_PASSWORD" type="VALUE_TEXT" value="&quot;MyWifi@123&quot;"/>
-                                       <stringMacro name="INPUT_GET_AP_SCAN_LIST" type="VALUE_TEXT" value="0"/>
-                                       <stringMacro name="INPUT_SOFTAP_PASSWORD" type="VALUE_TEXT" value="&quot;ESPWifi@123&quot;"/>
+                                       <stringMacro name="INPUT_STATION_BSSID" type="VALUE_TEXT" value="&quot;0&quot;"/>
+                                       <stringMacro name="INPUT_STATION_IS_WPA3_SUPPORTED" type="VALUE_TEXT" value="0"/>
+                                       <stringMacro name="INPUT_STATION_SRC_IP" type="VALUE_TEXT" value="&quot;192.168.1.233&quot;"/>
+                                       <stringMacro name="INPUT_STATION_ARP_DEST_IP" type="VALUE_TEXT" value="&quot;192.168.1.203&quot;"/>
+                                       <stringMacro name="INPUT_GET_AP_SCAN_LIST" type="VALUE_TEXT" value="1"/>
                                        <stringMacro name="INPUT_SOFTAP__SSID" type="VALUE_TEXT" value="&quot;ESPWifi&quot;"/>
+                                       <stringMacro name="INPUT_SOFTAP_PASSWORD" type="VALUE_TEXT" value="&quot;ESPWifi@123&quot;"/>
+                                       <stringMacro name="INPUT_SOFTAP_CHANNEL" type="VALUE_TEXT" value="1"/>
                                        <stringMacro name="INPUT_SOFTAP_BANDWIDTH" type="VALUE_TEXT" value="2"/>
                                        <stringMacro name="INPUT_SOFTAP_ENCRYPTION" type="VALUE_TEXT" value="3"/>
                                        <stringMacro name="INPUT_SOFTAP_MAX_CONN" type="VALUE_TEXT" value="4"/>
-                                       <stringMacro name="INPUT_STATION__SSID" type="VALUE_TEXT" value="&quot;MyWifi&quot;"/>
+                                       <stringMacro name="INPUT_SOFTAP_SSID_HIDDEN" type="VALUE_TEXT" value="0"/>
+                                       <stringMacro name="INPUT_SOFTAP_SRC_IP" type="VALUE_TEXT" value="&quot;192.168.2.1&quot;"/>
+                                       <stringMacro name="INPUT_SOFTAP_ARP_DEST_IP" type="VALUE_TEXT" value="&quot;192.168.2.22&quot;"/>
                                </macros>
                                <externalSettings/>
                                <extensions>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_PASSWORD=${INPUT_STATION_PASSWORD}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_BSSID=${INPUT_STATION_BSSID}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_IS_WPA3_SUPPORTED=${INPUT_STATION_IS_WPA3_SUPPORTED}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_STATION_SRC_IP=${INPUT_STATION_SRC_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_SRC_IP=${INPUT_SOFTAP_SRC_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_STATION_ARP_DEST_IP=${INPUT_STATION_ARP_DEST_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_ARP_DEST_IP=${INPUT_SOFTAP_ARP_DEST_IP}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP__SSID=${INPUT_SOFTAP__SSID}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_PASSWORD=${INPUT_SOFTAP_PASSWORD}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_CHANNEL=${INPUT_SOFTAP_CHANNEL}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_BANDWIDTH=${INPUT_SOFTAP_BANDWIDTH}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT__OPERATING_MODE=${INPUT__OPERATING_MODE}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_GET_AP_SCAN_LIST=${INPUT_GET_AP_SCAN_LIST}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_GET_CONNECTED_STATIONS_LIST=${INPUT_GET_CONNECTED_STATIONS_LIST}&quot;"/>
                                                                </option>
                                                                <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.884108698" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/common/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/common/protobuf-c&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/spi&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/serial/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/netif&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/app/control&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/app/data&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/common&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/host_common/include&quot;"/>
                                                                </option>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_PASSWORD=${INPUT_STATION_PASSWORD}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_BSSID=${INPUT_STATION_BSSID}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_STATION_IS_WPA3_SUPPORTED=${INPUT_STATION_IS_WPA3_SUPPORTED}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_STATION_SRC_IP=${INPUT_STATION_SRC_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_SRC_IP=${INPUT_SOFTAP_SRC_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_STATION_ARP_DEST_IP=${INPUT_STATION_ARP_DEST_IP}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_ARP_DEST_IP=${INPUT_SOFTAP_ARP_DEST_IP}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP__SSID=${INPUT_SOFTAP__SSID}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_PASSWORD=${INPUT_SOFTAP_PASSWORD}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_CHANNEL=${INPUT_SOFTAP_CHANNEL}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_SOFTAP_BANDWIDTH=${INPUT_SOFTAP_BANDWIDTH}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT__OPERATING_MODE=${INPUT__OPERATING_MODE}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;INPUT_GET_AP_SCAN_LIST=${INPUT_GET_AP_SCAN_LIST}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;INPUT_GET_CONNECTED_STATIONS_LIST=${INPUT_GET_CONNECTED_STATIONS_LIST}&quot;"/>
                                                                </option>
                                                                <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.438442903" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="../Core/Inc"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/common/protobuf-c&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/host_common/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/common&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/netif&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/serial&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/driver/spi&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/app/control&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/app/data&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CODE_BASE}/host/stm32/app&quot;"/>
                                                                </option>
                                                                <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.163265464" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
diff --git a/host/stm32/proj/.mxproject b/host/stm32/proj/.mxproject
deleted file mode 100644 (file)
index a81d0e3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-[PreviousGenFiles]
-AdvancedFolderStructure=true
-HeaderFileListSize=8
-HeaderFiles#0=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/gpio.h
-HeaderFiles#1=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/FreeRTOSConfig.h
-HeaderFiles#2=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/dma.h
-HeaderFiles#3=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/spi.h
-HeaderFiles#4=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/usart.h
-HeaderFiles#5=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/stm32f4xx_it.h
-HeaderFiles#6=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/stm32f4xx_hal_conf.h
-HeaderFiles#7=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc/main.h
-HeaderFolderListSize=1
-HeaderPath#0=/my/abs/workspace_dir/path/stm_spi_host/Core/Inc
-HeaderFiles=;
-SourceFileListSize=9
-SourceFiles#0=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/gpio.c
-SourceFiles#1=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/freertos.c
-SourceFiles#2=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/dma.c
-SourceFiles#3=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/spi.c
-SourceFiles#4=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/usart.c
-SourceFiles#5=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/stm32f4xx_it.c
-SourceFiles#6=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/stm32f4xx_hal_msp.c
-SourceFiles#7=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/stm32f4xx_hal_timebase_tim.c
-SourceFiles#8=/my/abs/workspace_dir/path/stm_spi_host/Core/Src/main.c
-SourceFolderListSize=1
-SourcePath#0=/my/abs/workspace_dir/path/stm_spi_host/Core/Src
-SourceFiles=;
-
-[PreviousLibFiles]
-LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h;Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h;Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h;Middlewares/Third_Party/FreeRTOS/Source/include/list.h;Middlewares/Third_Party/FreeRTOS/Source/include/message_buffer.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h;Middlewares/Third_Party/FreeRTOS/Source/include/portable.h;Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h;Middlewares/Third_Party/FreeRTOS/Source/include/queue.h;Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h;Middlewares/Third_Party/FreeRTOS/Source/include/stack_macros.h;Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h;Middlewares/Third_Party/FreeRTOS/Source/include/stream_buffer.h;Middlewares/Third_Party/FreeRTOS/Source/include/task.h;Middlewares/Third_Party/FreeRTOS/Source/include/timers.h;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h;Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h;Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h;Middlewares/Third_Party/FreeRTOS/Source/include/list.h;Middlewares/Third_Party/FreeRTOS/Source/include/message_buffer.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h;Middlewares/Third_Party/FreeRTOS/Source/include/portable.h;Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h;Middlewares/Third_Party/FreeRTOS/Source/include/queue.h;Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h;Middlewares/Third_Party/FreeRTOS/Source/include/stack_macros.h;Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h;Middlewares/Third_Party/FreeRTOS/Source/include/stream_buffer.h;Middlewares/Third_Party/FreeRTOS/Source/include/task.h;Middlewares/Third_Party/FreeRTOS/Source/include/timers.h;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f469xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_iccarm.h;
-
-[PreviousUsedCubeIDEFiles]
-SourceFiles=Core/Src/main.c;Core/Src/gpio.c;Core/Src/freertos.c;Core/Src/dma.c;Core/Src/spi.c;Core/Src/usart.c;Core/Src/stm32f4xx_it.c;Core/Src/stm32f4xx_hal_msp.c;Core/Src/stm32f4xx_hal_timebase_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Core/Src/system_stm32f4xx.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Core/Src/system_stm32f4xx.c;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;
-HeaderPath=Drivers/STM32F4xx_HAL_Driver/Inc;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;Middlewares/Third_Party/FreeRTOS/Source/include;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F;Drivers/CMSIS/Device/ST/STM32F4xx/Include;Drivers/CMSIS/Include;Core/Inc;
-CDefines=USE_HAL_DRIVER;STM32F469xx;USE_HAL_DRIVER;USE_HAL_DRIVER;
-
This page took 0.112896 seconds and 4 git commands to generate.