blob: f7b34b83566865849fb4b6a010eb159ec8c650b6 [file] [log] [blame]
Alexander Steffen299bc622017-06-29 23:14:58 +02001#ifndef MICROPY_INCLUDED_ESP8266_ETSHAL_H
2#define MICROPY_INCLUDED_ESP8266_ETSHAL_H
Damien George075d5972014-11-27 20:30:33 +00003
Paul Sokolovskyf22a4f82016-03-04 19:39:24 +02004#include <os_type.h>
5
Damien George6ca17c12016-03-29 10:29:57 +03006// see http://esp8266-re.foogod.com/wiki/Random_Number_Generator
Damien George69661f32020-02-27 15:36:53 +11007#define WDEV_HWRNG ((volatile uint32_t *)0x3ff20e44)
Damien George6ca17c12016-03-29 10:29:57 +03008
Paul Sokolovskye766a4a2017-11-05 00:27:21 +02009void ets_delay_us(uint16_t us);
Damien George07744832016-03-01 09:20:22 +000010void ets_intr_lock(void);
11void ets_intr_unlock(void);
12void ets_isr_mask(uint32_t mask);
13void ets_isr_unmask(uint32_t mask);
14void ets_isr_attach(int irq_no, void (*handler)(void *), void *arg);
Damien George075d5972014-11-27 20:30:33 +000015void ets_install_putc1();
Paul Sokolovskye766a4a2017-11-05 00:27:21 +020016void uart_div_modify(uint8_t uart, uint32_t divisor);
Damien George07744832016-03-01 09:20:22 +000017void ets_set_idle_cb(void (*handler)(void *), void *arg);
Damien George075d5972014-11-27 20:30:33 +000018
Paul Sokolovskyf22a4f82016-03-04 19:39:24 +020019void ets_timer_arm_new(os_timer_t *tim, uint32_t millis, bool repeat, bool is_milli_timer);
20void ets_timer_setfn(os_timer_t *tim, ETSTimerFunc callback, void *cb_data);
21void ets_timer_disarm(os_timer_t *tim);
22
Paul Sokolovsky015774a2016-09-03 20:45:11 +030023extern void ets_wdt_disable(void);
24extern void wdt_feed(void);
25
Paul Sokolovskye33d2382016-08-04 00:29:19 +030026// Opaque structure
Paul Sokolovsky5fae9142016-11-02 01:47:03 +030027#ifndef MD5_CTX
28typedef char MD5_CTX[88];
29#endif
Paul Sokolovskye33d2382016-08-04 00:29:19 +030030
31void MD5Init(MD5_CTX *context);
32void MD5Update(MD5_CTX *context, const void *data, unsigned int len);
33void MD5Final(unsigned char digest[16], MD5_CTX *context);
34
Paul Sokolovsky76c81cd2016-05-03 00:35:11 +030035// These prototypes are for recent SDKs with "malloc tracking"
Paul Sokolovskye766a4a2017-11-05 00:27:21 +020036void *pvPortMalloc(size_t sz, const char *fname, unsigned line);
37void *pvPortZalloc(size_t sz, const char *fname, unsigned line);
38void *pvPortRealloc(void *p, unsigned sz, const char *fname, unsigned line);
39void vPortFree(void *p, const char *fname, unsigned line);
Paul Sokolovsky76c81cd2016-05-03 00:35:11 +030040
Paul Sokolovsky2ec70dc2016-11-02 01:41:51 +030041uint32_t SPIRead(uint32_t offset, void *buf, uint32_t len);
42uint32_t SPIWrite(uint32_t offset, const void *buf, uint32_t len);
43uint32_t SPIEraseSector(int sector);
44
Alexander Steffen299bc622017-06-29 23:14:58 +020045#endif // MICROPY_INCLUDED_ESP8266_ETSHAL_H