/* * ESPRESSIF MIT License * * Copyright (c) 2016 * * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished * to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _ETS_SYS_H #define _ETS_SYS_H #include "c_types.h" #include "eagle_soc.h" #include #ifdef __cplusplus extern "C" { #endif /* * This "print character function" prototype is modeled after the argument for * ets_install_putc1() found in "ESP8266_NONOS_SDK/include/osapi.h". This * deviates away from the familiar C library definition of putchar; however, it * agrees with the code we are working with. Note, in the ROM some "printf * character functions" always return 0 (uart_tx_one_char and ets_putc), some * return last character printed (buildin _putc1), and some return nothing * (ets_write_char). Using a void return type safely represents them all. */ typedef void (*fp_putc_t)(char); typedef uint32_t ETSSignal; typedef uint32_t ETSParam; typedef struct ETSEventTag ETSEvent; struct ETSEventTag { ETSSignal sig; ETSParam par; }; typedef void (*ETSTask)(ETSEvent *e); /* timer related */ typedef uint32_t ETSHandle; typedef void ETSTimerFunc(void *timer_arg); typedef struct _ETSTIMER_ { struct _ETSTIMER_ *timer_next; uint32_t timer_expire; uint32_t timer_period; ETSTimerFunc *timer_func; void *timer_arg; } ETSTimer; /* interrupt related */ // The xtos_1int handler calls with param1 as the arg, param2 as a pointer // to an exception frame in memory. typedef void (*int_handler_t)(void*, void*); #define ETS_SLC_INUM 1 #define ETS_SDIO_INUM 1 #define ETS_SPI_INUM 2 #define ETS_GPIO_INUM 4 #define ETS_UART_INUM 5 #define ETS_UART1_INUM 5 #define ETS_CCOMPARE0_INUM 6 #define ETS_SOFT_INUM 7 #define ETS_WDT_INUM 8 #define ETS_FRC_TIMER1_INUM 9 /* use edge*/ // The xtos_1int handler calls with param1 as the arg, param2 as a pointer // to an exception frame in memory. void ets_intr_lock(void); void ets_intr_unlock(void); void NmiTimSetFunc(void (*func)(void)); #define ETS_INTR_LOCK() \ ets_intr_lock() #define ETS_INTR_UNLOCK() \ ets_intr_unlock() #define ETS_INTR_ENABLE(inum) \ ets_isr_unmask((1<