MeterLogger
osapi.h
Go to the documentation of this file.
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef _OSAPI_H_
26 #define _OSAPI_H_
27 
28 #include <string.h>
29 #include "user_config.h"
30 
31 #define os_bzero ets_bzero
32 #define os_delay_us ets_delay_us
33 #define os_install_putc1 ets_install_putc1
34 
35 #define os_memcmp ets_memcmp
36 #define os_memcpy ets_memcpy
37 #define os_memmove ets_memmove
38 #define os_memset ets_memset
39 #define os_strcat strcat
40 #define os_strchr strchr
41 #define os_strcmp ets_strcmp
42 #define os_strcpy ets_strcpy
43 #define os_strlen ets_strlen
44 #define os_strncmp ets_strncmp
45 #define os_strncpy ets_strncpy
46 #define os_strstr ets_strstr
47 #ifdef USE_US_TIMER
48 #define os_timer_arm_us(a, b, c) ets_timer_arm_new(a, b, c, 0)
49 #endif
50 #define os_timer_arm(a, b, c) ets_timer_arm_new(a, b, c, 1)
51 #define os_timer_disarm ets_timer_disarm
52 #define os_timer_setfn ets_timer_setfn
53 
54 #define os_sprintf ets_sprintf
55 
56 #ifdef USE_OPTIMIZE_PRINTF
57 #define os_printf(fmt, ...) do { \
58  static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
59  os_printf_plus(flash_str, ##__VA_ARGS__); \
60  } while(0)
61 #else
62 #define os_printf os_printf_plus
63 #endif
64 
65 unsigned long os_random(void);
66 int os_get_random(unsigned char *buf, size_t len);
67 
68 #endif
69 
int os_get_random(unsigned char *buf, size_t len)
unsigned long os_random(void)