Skip to content

Commit 0e01c72

Browse files
committed
posix: remove os timing call
remove gettimeofday call that requires POSIX_API which is not yet properly configured on ESP32 porting Signed-off-by: Sylvio Alves <[email protected]>
1 parent 4977d92 commit 0e01c72

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

zephyr/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ if(CONFIG_SOC_ESP32)
8181
if (CONFIG_WIFI_ESP32)
8282

8383
#TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported.
84-
set(WPA_SUPPLICANT_SRCS "../components/wpa_supplicant/port/os_xtensa.c"
84+
set(WPA_SUPPLICANT_SRCS "adapter/src/wpa_supplicant/port/os_xtensa.c"
8585
"../components/wpa_supplicant/src/ap/ap_config.c"
8686
"../components/wpa_supplicant/src/ap/ieee802_1x.c"
8787
"../components/wpa_supplicant/src/ap/wpa_auth.c"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* wpa_supplicant/hostapd / Internal implementation of OS specific functions
3+
* Copyright (c) 2005-2006, Jouni Malinen <[email protected]>
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License version 2 as
7+
* published by the Free Software Foundation.
8+
*
9+
* Alternatively, this software may be distributed under the terms of BSD
10+
* license.
11+
*
12+
* See README and COPYING for more details.
13+
*
14+
* This file is an example of operating system specific wrapper functions.
15+
* This version implements many of the functions internally, so it can be used
16+
* to fill in missing functions from the target system C libraries.
17+
*
18+
* Some of the functions are using standard C library calls in order to keep
19+
* this file in working condition to allow the functions to be tested on a
20+
* Linux target. Please note that OS_NO_C_LIB_DEFINES needs to be defined for
21+
* this file to work correctly. Note that these implementations are only
22+
* examples and are not optimized for speed.
23+
*/
24+
25+
#include "os.h"
26+
#include <stdlib.h>
27+
#include "esp_system.h"
28+
#include "utils/common.h"
29+
#include <random/rand32.h>
30+
31+
int os_get_time(struct os_time *t)
32+
{
33+
if (t == NULL) {
34+
return -1;
35+
}
36+
37+
int64_t now = k_uptime_ticks();
38+
t->sec = now / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
39+
t->usec = k_ticks_to_us_floor64(now);
40+
41+
return 0;
42+
}
43+
44+
unsigned long os_random(void)
45+
{
46+
return sys_rand32_get();
47+
}
48+
49+
int os_get_random(unsigned char *buf, size_t len)
50+
{
51+
sys_rand_get((void *)buf, len);
52+
return 0;
53+
}

0 commit comments

Comments
 (0)