open_esplibs libwpa: source code for os_xtensa.c (#283)

This commit is contained in:
Our Air Quality 2016-11-24 02:56:34 +11:00 committed by sheinz
parent ca6c6e1d3e
commit df76e77598
5 changed files with 49 additions and 0 deletions

View file

@ -279,9 +279,11 @@ NoiseTimerInterval sdk_NoiseTimerInterval
operation_test sdk_operation_test operation_test sdk_operation_test
os_delay_us sdk_os_delay_us os_delay_us sdk_os_delay_us
os_get_cpu_frequency sdk_os_get_cpu_frequency os_get_cpu_frequency sdk_os_get_cpu_frequency
os_get_random sdk_os_get_random
os_get_time sdk_os_get_time os_get_time sdk_os_get_time
os_install_putc1 sdk_os_install_putc1 os_install_putc1 sdk_os_install_putc1
os_putc sdk_os_putc os_putc sdk_os_putc
os_random sdk_os_random
os_timer_arm sdk_os_timer_arm os_timer_arm sdk_os_timer_arm
os_timer_disarm sdk_os_timer_disarm os_timer_disarm sdk_os_timer_disarm
os_timer_setfn sdk_os_timer_setfn os_timer_setfn sdk_os_timer_setfn

View file

@ -0,0 +1,2 @@
# Object files to be removed from libwpa
os_xtensa.o

View file

@ -35,6 +35,9 @@ int sdk_hostapd_setup_wpa_psk(struct _unknown_softap2 *);
// md5.o // md5.o
// os_xtensa.o // os_xtensa.o
int sdk_os_get_time(uint32_t time[]);
uint32_t sdk_os_random();
int sdk_os_get_random(uint8_t *dst, uint32_t size);
// rc4.o // rc4.o

View file

@ -111,6 +111,10 @@
#define OPEN_LIBWPA (OPEN_ESPLIBS) #define OPEN_LIBWPA (OPEN_ESPLIBS)
#endif #endif
#ifndef OPEN_LIBWPA_OS_XTENSA
#define OPEN_LIBWPA_OS_XTENSA (OPEN_LIBWPA)
#endif
#ifndef OPEN_LIBWPA_WPA_MAIN #ifndef OPEN_LIBWPA_WPA_MAIN
#define OPEN_LIBWPA_WPA_MAIN (OPEN_LIBWPA) #define OPEN_LIBWPA_WPA_MAIN (OPEN_LIBWPA)
#endif #endif

View file

@ -0,0 +1,38 @@
/* Recreated Espressif libwpa is_xtensa.s contents.
Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
BSD Licensed as described in the file LICENSE
*/
#include "open_esplibs.h"
#if OPEN_LIBWPA_OS_XTENSA
// The contents of this file are only built if OPEN_LIBWPA_WPA_MAIN is set to true
#include <stdlib.h>
#include <string.h>
#include <esplibs/libwpa.h>
#include <common_macros.h>
// Used by wpa_get_ntp_timestamp.
int IRAM sdk_os_get_time(uint32_t time[]) {
return 0;
}
uint32_t IRAM sdk_os_random() {
return rand();
}
int IRAM sdk_os_get_random(uint8_t *dst, uint32_t size) {
uint32_t end = size >> 2;
if (end > 0) {
uint32_t i = 0;
do {
uint32_t n = rand();
memcpy(dst, &n, sizeof(n));
dst += 4;
i++;
} while (i < end);
}
return 0;
}
#endif /* OPEN_LIBWPA_OS_XTENSA */