├── .cproject ├── .editorconfig ├── .gitignore ├── .project ├── .settings ├── language.settings.xml ├── org.eclipse.cdt.codan.core.prefs ├── org.eclipse.cdt.core.prefs ├── org.eclipse.cdt.managedbuilder.core.prefs └── org.eclipse.core.resources.prefs ├── AutoMake.bat ├── IrDA_sensor_case.stl ├── IrDa_sensor_case_printed.jpg ├── LICENSE ├── Makefile ├── Mercury-231.png ├── PowerMeter-IrDA.jpg ├── PowerMeter-IrDA_direct.jpg ├── ProgBin.bat ├── README.md ├── WEBFS22.exe ├── WEBFiles ├── $js.inc ├── 404.htm ├── adc.htm ├── adc.wav ├── adc.xml ├── bymonth.htm ├── cookies.js ├── curr_time.csv ├── debug.log ├── disk_er1.htm ├── disk_er2.htm ├── disk_er3.htm ├── disk_ok.htm ├── favicon.ico ├── footer.inc ├── grf.js ├── grfx1.inc ├── grfx2.inc ├── heap.htm ├── heap.xml ├── help.htm ├── help_commands.htm ├── history.csv ├── history.htm ├── historyall.csv ├── historyall.htm ├── historyallcnt.csv ├── historycnt.csv ├── index.htm ├── lastkwt.htm ├── lastkwt.xml ├── led.xml ├── leds.xml ├── logo.gif ├── menu.inc ├── menumain.inc ├── power.xml ├── powercnt.htm ├── powercnt.xml ├── protect │ ├── aps.xml │ ├── chiprams.xml │ ├── cookie.js │ ├── debug.htm │ ├── debug.log │ ├── debugram.htm │ ├── debugram.txt │ ├── dsleep.htm │ ├── esp_init_data_default.bin │ ├── fram_all.bin │ ├── fullflash.bin │ ├── gpio.htm │ ├── gpio.xml │ ├── hexdmpb.htm │ ├── hexdmpb.txt │ ├── hexdmpd.htm │ ├── hexdmpd.txt │ ├── init.ini │ ├── pr_request.xml │ ├── ram.bin │ ├── rfinit1.htm │ ├── rfinit2.htm │ ├── rfinit3.htm │ ├── scan.htm │ ├── scan.xml │ ├── send_command.htm │ ├── setmeter.htm │ ├── settings.bin │ ├── setup.htm │ ├── system.xml │ ├── uart.htm │ ├── upload.htm │ └── wifi.htm ├── scripts.js ├── settings.htm ├── site.js ├── slider.inc ├── slider.js ├── style.css ├── time.inc ├── timelogs.htm ├── timeout.htm ├── timer.inc ├── tst.htm ├── tst.xml ├── vdd.htm ├── vdd.inc └── vdd.xml ├── WatchdogESP01 ├── WatchdogESP01.c ├── WatchdogESP01.hex └── WatchdogESP01.png ├── Web1.jpg ├── Web2.jpg ├── Web3.jpg ├── Web4.jpg ├── Web4_2.jpg ├── Web5.jpg ├── Web6.jpg ├── WebSocket ├── ws2.css └── ws2.htm ├── app ├── .gitignore ├── Makefile ├── NULL ├── driver │ ├── Makefile │ ├── adc.c │ ├── eeprom.c │ ├── gpio16.c │ ├── i2c.c │ ├── i2s.c │ ├── int_time_us.c │ ├── rs485drv.c │ ├── sigma_delta.c │ └── spi.c ├── gdbstub │ ├── License │ ├── Makefile │ ├── README.md │ ├── eagle_soc.h │ ├── gdbcmds │ ├── gdbstub-cfg.h │ ├── gdbstub-entry.S │ ├── gdbstub-entry.h │ ├── gdbstub.c │ └── gdbstub.h ├── include │ ├── captdns.h │ ├── debug_ram.h │ ├── driver │ │ ├── adc.h │ │ ├── eeprom.h │ │ ├── gpio16.h │ │ ├── i2c.h │ │ ├── i2s.h │ │ ├── int_time_us.h │ │ ├── rs485drv.h │ │ ├── sigma_delta.h │ │ ├── spi.h │ │ ├── spi_readme.txt │ │ └── spi_register.h │ ├── flash_eep.h │ ├── mdbrs485.h │ ├── mdbtab.h │ ├── mercury.h │ ├── modbusrtu.h │ ├── modbustcp.h │ ├── netbios.h │ ├── overlay.h │ ├── power_meter.h │ ├── sntp.h │ ├── sys_const_utils.h │ ├── tcp2uart.h │ ├── tcp_srv_conn.h │ ├── web_fs_init.h │ ├── web_iohw.h │ ├── web_srv.h │ ├── web_utils.h │ ├── web_websocket.h │ ├── webfs.h │ ├── websock.h │ ├── wifi.h │ └── wifi_events.h ├── mdbtcp │ ├── Makefile │ ├── mdbfunc.c │ ├── mdbrs485.c │ ├── mdbtab.c │ └── modbustcp.c ├── sdklib │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── lwip │ │ ├── COPYING │ │ ├── Makefile │ │ ├── api │ │ │ ├── Makefile │ │ │ ├── api_lib.c │ │ │ ├── api_msg.c │ │ │ ├── err.c │ │ │ ├── netbuf.c │ │ │ ├── netdb.c │ │ │ ├── netifapi.c │ │ │ ├── sockets.c │ │ │ └── tcpip.c │ │ ├── app │ │ │ ├── Espressif.License │ │ │ ├── Makefile │ │ │ ├── dhcpserver.c │ │ │ ├── espconn.c │ │ │ ├── espconn_mdns.c │ │ │ ├── espconn_tcp.c │ │ │ ├── espconn_udp.c │ │ │ ├── netio.c │ │ │ └── ping.c │ │ ├── core │ │ │ ├── Makefile │ │ │ ├── def.c │ │ │ ├── dhcp.c │ │ │ ├── dns.c │ │ │ ├── init.c │ │ │ ├── ipv4 │ │ │ │ ├── Makefile │ │ │ │ ├── autoip.c │ │ │ │ ├── icmp.c │ │ │ │ ├── igmp.c │ │ │ │ ├── inet.c │ │ │ │ ├── inet_chksum.c │ │ │ │ ├── ip.c │ │ │ │ ├── ip_addr.c │ │ │ │ └── ip_frag.c │ │ │ ├── mdns.c │ │ │ ├── mem.c │ │ │ ├── memp.c │ │ │ ├── netif.c │ │ │ ├── pbuf.c │ │ │ ├── raw.c │ │ │ ├── sntp.c │ │ │ ├── stats.c │ │ │ ├── sys.c │ │ │ ├── tcp.c │ │ │ ├── tcp_in.c │ │ │ ├── tcp_out.c │ │ │ ├── timers.c │ │ │ └── udp.c │ │ └── netif │ │ │ ├── Makefile │ │ │ └── etharp.c │ ├── phy │ │ ├── Makefile │ │ └── phy_chip_v6_unused.c │ ├── pp │ │ ├── Makefile │ │ └── pplibadd.c │ ├── system │ │ ├── Makefile │ │ ├── app_main.c │ │ ├── eagle_lwip_if.c │ │ ├── ets_run_new.c │ │ ├── ets_timer.c │ │ ├── main-vectors.c │ │ ├── mem_manager.c │ │ ├── os_printf.c │ │ ├── rom2ram.c │ │ ├── spi_flash.c │ │ ├── spi_overlap.c │ │ └── wdt.c │ └── wpa │ │ ├── Makefile │ │ ├── os_xtensa.c │ │ └── wpa_debug.c ├── user │ ├── Makefile │ ├── crc.c │ ├── debug_ram.c │ ├── include │ │ └── crc.h │ ├── iot_cloud.c │ ├── mercury.c │ ├── power_meter.c │ └── user_main.c └── web │ ├── Makefile │ ├── captdns.c │ ├── flash_eep.c │ ├── include │ └── web_srv_int.h │ ├── localtime.c │ ├── netbios.c │ ├── overlay.c │ ├── sntp.c │ ├── sys_const.c │ ├── tcp2uart.c │ ├── tcp_srv_conn.c │ ├── tcp_srv_conn.c.old │ ├── uart_tcp.c │ ├── web_fs_init.c │ ├── web_int_callbacks.c │ ├── web_int_vars.c │ ├── web_iohw.c │ ├── web_srv.c │ ├── web_utils.c │ ├── web_websocket.c │ ├── webfs.c │ ├── websock.c │ ├── wifi.c │ └── wifi_events.c ├── asm_damp.bat ├── bin ├── .gitignore ├── 0x00000.bin ├── 0x07000.bin ├── blank.bin ├── clear_eep.bin ├── esp_init_data_default.bin ├── firmware.bin ├── firmware_512k_2step_ota.bin ├── firmware_sdk154.bin ├── firmware_with_MCP2120.bin ├── make_firmware_image.py ├── rapid_loader.bin ├── rapid_loader_40m.bin ├── rapid_loader_40m_512.bin ├── rapid_loader_512.bin └── readme.txt ├── esp8266_irda_bug.jpg ├── esptool.py ├── include ├── arch │ ├── cc.h │ ├── perf.h │ └── sys_arch.h ├── bios.h ├── bios │ ├── add_funcs.h │ ├── cha1.h │ ├── ets.h │ ├── gpio.h │ ├── mem.h │ ├── rom_phy.h │ ├── rtc_dtm.h │ ├── spiflash.h │ ├── uart.h │ ├── vectors.h │ ├── xthal.h │ └── xtos.h ├── c_types.h ├── ets_sys.h ├── gpio.h ├── hw │ ├── core-isa.h │ ├── corebits.h │ ├── eagle_soc.h │ ├── eagle_soc_.h │ ├── esp8266.h │ ├── gpio_register.h │ ├── i2s_reg.h │ ├── pin_mux_register.h │ ├── sdio_slv.h │ ├── slc_register.h │ ├── specreg.h │ ├── spi.h │ ├── spi_register.h │ ├── timer_register.h │ └── uart_register.h ├── iot_cloud.h ├── ip_addr.h ├── localtime.h ├── lwip │ ├── api.h │ ├── api_msg.h │ ├── app │ │ ├── dhcpserver.h │ │ ├── espconn.h │ │ ├── espconn_tcp.h │ │ ├── espconn_udp.h │ │ └── ping.h │ ├── arch.h │ ├── autoip.h │ ├── debug.h │ ├── def.h │ ├── dhcp.h │ ├── dns.h │ ├── err.h │ ├── icmp.h │ ├── igmp.h │ ├── inet.h │ ├── inet_chksum.h │ ├── init.h │ ├── ip.h │ ├── ip_addr.h │ ├── ip_frag.h │ ├── mdns.h │ ├── mem.h │ ├── memp.h │ ├── memp_std.h │ ├── netbuf.h │ ├── netdb.h │ ├── netif.h │ ├── netifapi.h │ ├── opt.h │ ├── pbuf.h │ ├── puck_def.h │ ├── raw.h │ ├── sio.h │ ├── snmp.h │ ├── snmp_asn1.h │ ├── snmp_msg.h │ ├── snmp_structs.h │ ├── sntp.h │ ├── sockets.h │ ├── stats.h │ ├── sys.h │ ├── tcp.h │ ├── tcp_impl.h │ ├── tcpip.h │ ├── timers.h │ └── udp.h ├── lwipopts.h ├── netif │ ├── etharp.h │ ├── if_llc.h │ ├── ppp_oe.h │ └── wlan_lwip_if.h ├── os_type.h ├── osapi.h ├── phy │ └── phy.h ├── pp │ └── esf_buf.h ├── queue.h ├── sdk │ ├── add_func.h │ ├── app_main.h │ ├── ets_run_new.h │ ├── fatal_errs.h │ ├── flash.h │ ├── libmain.h │ ├── mem_manager.h │ ├── os_printf.h │ ├── rom2ram.h │ ├── sdk_config.h │ ├── sys_const.h │ └── wdt.h ├── user_config.h └── user_interface.h ├── info ├── ESP8266_reg │ ├── ESP8266_Pin_List_141105.xlsx │ ├── ESP8266_RF_init_esp_init_data_default_bin.xlsx │ ├── gpio_reg.xlsx │ ├── pin_reg.xlsx │ ├── spi_reg.xlsx │ ├── timers_reg.xlsx │ └── uart_reg.xlsx ├── WebHTML │ ├── default.htm │ └── fsupload.htm ├── d3v3.zip ├── d3v4.7.3.zip ├── freq_corr_en.gif ├── libs │ ├── bios │ │ ├── SpiFlash.c │ │ ├── cha1.c │ │ ├── ets_run.c │ │ ├── gpio.c │ │ ├── mem.c │ │ ├── rtc_dtm.c │ │ ├── sip_slc.c │ │ ├── uartdev.c │ │ └── wdt.c │ ├── boot │ │ └── boot_1_2.c │ ├── main │ │ ├── UserEnter.s │ │ ├── debug-vector.s │ │ ├── double-vector.s │ │ ├── kernel-vector.s │ │ ├── nmi-vector.s │ │ ├── nmi.c │ │ ├── startup.c │ │ ├── startup_1.5.4.c │ │ ├── user-vector.s │ │ ├── user_interface.c │ │ └── wdt.c │ ├── net80211 │ │ ├── Descript.ion │ │ └── ieee80211_output.h │ └── phy │ │ ├── phy.c │ │ ├── phy_chip_v6.c │ │ ├── phy_get_vdd33.c │ │ ├── phy_sleep.c │ │ └── sar_read_fast.c └── smoothie-master.zip ├── ld ├── eagle.app.v6.ld ├── eagle.rom.addr.v6.ld ├── labels.ld └── overlay.ld ├── lib ├── 2.0.0 │ ├── clibsdk.bat │ ├── libcrypto.a │ ├── libdhcps.a │ ├── liblwipif.a │ ├── libmgcc.a │ ├── libmlwip.a │ ├── libmmain.a │ ├── libmmain.a.patch.txt │ ├── libmphy.a │ ├── libmpp.a │ ├── libmwpa.a │ ├── libnet80211.a │ ├── libnet80211_new.a │ ├── libpp.a │ ├── libsdk.a │ ├── mlibsdk.bat │ ├── new_libdhcps.bat │ ├── new_liblwipif.bat │ ├── new_libmgcc.bat │ ├── new_libmlwip.bat │ ├── new_libmmain.bat │ ├── new_libmphy.bat │ ├── new_libmpp.bat │ ├── new_libmwpa.bat │ ├── new_libnet80211new.bat │ ├── o-asm.bat │ └── rom_files_list.txt ├── clibsdk.bat ├── libcrypto.a ├── libdhcps.a ├── liblwipif.a ├── libmgcc.a ├── libmlwip.a ├── libmmain.a ├── libmmain.a.patch.txt ├── libmphy.a ├── libmwpa.a ├── libnet80211.a ├── libpp.a ├── libsdk.a ├── mlibsdk.bat ├── new_libdhcps.bat ├── new_liblwipif.bat ├── new_libmgcc.bat ├── new_libmlwip.bat ├── new_libmmain.bat ├── new_libmmain1.5.4.bat ├── new_libmphy.bat ├── new_libmpp.bat ├── new_libmwpa.bat ├── new_libmwpa1.5.4.bat ├── o-asm.bat └── rom_files_list.txt ├── mem.txt ├── mem_usage.bat ├── ovls.py ├── ovls └── ovls.7z ├── read_firmware.bat ├── uploader.py ├── webbin ├── Makefile ├── WEBFS22.zip ├── WEBFiles_tiny.7z ├── WEBFiles_tiny.bin ├── compress_java.bat ├── example_WEBFiles.bin ├── example_iot_cloud.ini ├── web_vars.txt └── yuicompressor.jar ├── webfs ├── README.md ├── webfs_upload1.py └── webfs_upload2.py └── write_firmware.bat /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /app/mdns 2 | /AutoMake/ 3 | /CreateLib/ 4 | /eagle.app.v6.asm 5 | /firmware.bin 6 | iot_cloud.ini 7 | WEBFiles.bin 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PowerMeter-IrDA 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /AutoMake.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @if %1x==x goto aaa_end 3 | @if not exist %1 goto err_end 4 | @echo ------------------------------------------------------------------------------ 5 | @C:\Python27\python.exe ..\esptool.py elf2image -o ..\bin\ -ff 80m -fm qio -fs 4m %1 6 | @echo ------------------------------------------------------------------------------ 7 | @if not exist ..\bin\0x00000.bin goto err_end 8 | @echo Add rapid_loader... 9 | @if exist ..\bin\0.bin del ..\bin\0.bin >nul 10 | @rename ..\bin\0x00000.bin 0.bin >nul 11 | @copy /b ..\bin\rapid_loader.bin + ..\bin\0.bin ..\bin\0x00000.bin >nul 12 | goto end 13 | :aaa_end 14 | echo Use Eclipse Manage Configurations: AutoMake! 15 | goto end 16 | :err_end 17 | echo Error! 18 | :end 19 | -------------------------------------------------------------------------------- /IrDA_sensor_case.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/IrDA_sensor_case.stl -------------------------------------------------------------------------------- /IrDa_sensor_case_printed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/IrDa_sensor_case_printed.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Mercury-231.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Mercury-231.png -------------------------------------------------------------------------------- /PowerMeter-IrDA.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/PowerMeter-IrDA.jpg -------------------------------------------------------------------------------- /PowerMeter-IrDA_direct.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/PowerMeter-IrDA_direct.jpg -------------------------------------------------------------------------------- /ProgBin.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @if %1x==x goto aaa_end 3 | @if not exist bin/%1.bin goto err_end 4 | @C:/Python27/python.exe esptool.py -p %2 -b %3 write_flash -ff 80m -fm qio -fs 4m 0x00000 bin/0x00000.bin %1 bin/%1.bin 5 | goto end 6 | :aaa_end 7 | echo Use Eclipse! 8 | goto end 9 | :err_end 10 | echo Error! 11 | :end 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PowerMeter IrDA interface 2 | --- 3 | 4 | Web server based on esp8266 with IrDA interface to power meter (Mercury 230/231 AT).
5 | Over-The-Air firmware updating. 6 | --- 7 | Подробно здесь: [vad-7.blogspot.ru](http://vad-7.blogspot.ru/2017/03/mercury231.html) 8 | 9 | Возможности: 10 | Получение данных со многотарифных счетчиков Меркурий 231 АТ (230) через инфракрасный порт.
11 | Отправка данных на IoT сервер.
12 | Автоматическая корректировка времени счетчика.
13 | Графики - по дням, по часам, детально по минутам.
14 | Отправка произвольной команды на счетчик.

15 | 16 | Использутся i2c FRAM память (30 байт).
17 | Данные для графиков записываются во флеш память модуля esp.
18 | Два циклических буфера - по дням на 7680 дней и детальное потребление до конца памяти (для флеши 4 Мбайта - 2136 дней).
19 | 20 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Mercury-231.png) 21 | 22 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web1.jpg) 23 | 24 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web2.jpg) 25 | 26 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web3.jpg) 27 | 28 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web4.jpg) 29 | 30 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web4_2.jpg) 31 | 32 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web5.jpg) 33 | 34 | ![alt tag](https://github.com/vad7/PowerMeter-IrDA/blob/master/Web6.jpg) 35 | 36 | Схема (bin/firmware.bin): 37 | ![SCH](https://github.com/vad7/PowerMeter-IrDA/blob/master/PowerMeter-IrDA_direct.jpg) 38 | 39 | Схема с конвертером UART-IrDA MCP2120 (bin/firmware_with_MCP2120.bin): 40 | 41 | ![SCH](https://github.com/vad7/PowerMeter-IrDA/blob/master/PowerMeter-IrDA.jpg) 42 | 43 | VCC - 3.3V
44 | FM24* - I2C FRAM memory
45 | 46 | -------------------------------------------------------------------------------- /WEBFS22.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WEBFS22.exe -------------------------------------------------------------------------------- /WEBFiles/$js.inc: -------------------------------------------------------------------------------- 1 | var $ = function(id){return document.getElementById(id);} -------------------------------------------------------------------------------- /WEBFiles/404.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 404 - Page not found 5 | 6 | 7 | 8 |

ESP8266 Built-in Web server ©

9 |
10 |

404 - Page not found

11 |

Sorry, the page you are requesting was not found on this server.

12 |
13 | ~inc:footer.inc~ 14 | -------------------------------------------------------------------------------- /WEBFiles/adc.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | ADC: ? 3 | 11 | ~inc:grfx2.inc~ -------------------------------------------------------------------------------- /WEBFiles/adc.wav: -------------------------------------------------------------------------------- 1 | ~test_adc~ -------------------------------------------------------------------------------- /WEBFiles/adc.xml: -------------------------------------------------------------------------------- 1 | ADC~sys_adc~ -------------------------------------------------------------------------------- /WEBFiles/cookies.js: -------------------------------------------------------------------------------- 1 | var cookie_path = "/"; 2 | function getCookie(name) { 3 | var prefix = name + "="; 4 | var cookieStartIndex = document.cookie.indexOf(prefix); 5 | if (cookieStartIndex == -1) 6 | return null; 7 | var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex 8 | + prefix.length); 9 | if (cookieEndIndex == -1) 10 | cookieEndIndex = document.cookie.length; 11 | return unescape(document.cookie.substring(cookieStartIndex + prefix.length, 12 | cookieEndIndex)); 13 | } 14 | function setCookie(name, value) { 15 | // var d = new Date(); 16 | // d.setTime(d.getTime() + (1000 * 86400000)); 17 | // var expires = ";expires="+d.toUTCString(); 18 | var expires = ""; 19 | document.cookie = name + "=" + escape(value) + expires + ";path=" + cookie_path; 20 | } 21 | function setCookieElem(name, defv) { 22 | var val = getCookie(name); 23 | if (val == null) { 24 | val = defv; 25 | setCookie(name, val); 26 | } 27 | var f = document.getElementById(name); 28 | if(f.type === "checkbox") { 29 | f.checked = val == 1 ? true : false; 30 | } else if(f.type === "radio") { 31 | var f = document.getElementsByName(name); 32 | for(var i=0; iImage Corrupt or Wrong Version! 3 | 4 | ~inc:footer.inc~ 5 | -------------------------------------------------------------------------------- /WEBFiles/disk_er2.htm: -------------------------------------------------------------------------------- 1 | ~inc:timer.inc~ 2 |

File to big in flash!

3 | 4 | ~inc:footer.inc~ 5 | -------------------------------------------------------------------------------- /WEBFiles/disk_er3.htm: -------------------------------------------------------------------------------- 1 | ~inc:timer.inc~ 2 |

Bad file!

3 | 4 | ~inc:footer.inc~ 5 | -------------------------------------------------------------------------------- /WEBFiles/disk_ok.htm: -------------------------------------------------------------------------------- 1 | ~inc:timer.inc~ 2 |

Update Successful!

3 | 4 | ~inc:footer.inc~ 5 | -------------------------------------------------------------------------------- /WEBFiles/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WEBFiles/favicon.ico -------------------------------------------------------------------------------- /WEBFiles/footer.inc: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /WEBFiles/grfx1.inc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Счетчик электроэнергии 5 | 6 | 7 | 8 | ~inc:menumain.inc~ 9 | ~inc:slider.inc~ 10 |
-------------------------------------------------------------------------------- /WEBFiles/grfx2.inc: -------------------------------------------------------------------------------- 1 |
2 |
Обновление - ? мс'
3 |
4 | 5 | 6 | 7 | ~inc:footer.inc~ 8 | -------------------------------------------------------------------------------- /WEBFiles/heap.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | Heap Size: ? bytes 3 | ~inc:grfx2.inc~ 11 | -------------------------------------------------------------------------------- /WEBFiles/heap.xml: -------------------------------------------------------------------------------- 1 | Heap Size~sys_heap~ -------------------------------------------------------------------------------- /WEBFiles/history.csv: -------------------------------------------------------------------------------- 1 | ~bin_history~ -------------------------------------------------------------------------------- /WEBFiles/historyall.csv: -------------------------------------------------------------------------------- 1 | ~bin_historyall~ -------------------------------------------------------------------------------- /WEBFiles/historyallcnt.csv: -------------------------------------------------------------------------------- 1 | ~bin_historyallcnt~ -------------------------------------------------------------------------------- /WEBFiles/historycnt.csv: -------------------------------------------------------------------------------- 1 | ~bin_historycnt~ -------------------------------------------------------------------------------- /WEBFiles/lastkwt.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | Мощность, Вт: ? 3 | ~inc:grfx2.inc~ 11 | -------------------------------------------------------------------------------- /WEBFiles/lastkwt.xml: -------------------------------------------------------------------------------- 1 | Last kWt(~PWMT_P0~/100).toFixed(2) -------------------------------------------------------------------------------- /WEBFiles/led.xml: -------------------------------------------------------------------------------- 1 | 2 | ~gpio1_inp~ 3 | ~gpio1_out~ 4 | ~gpio1_dir~ 5 | ~gpio1_fun~ 6 | -------------------------------------------------------------------------------- /WEBFiles/leds.xml: -------------------------------------------------------------------------------- 1 | 2 | ~gpio_inp~ 3 | ~gpio_out~ 4 | ~gpio_dir~ 5 | -------------------------------------------------------------------------------- /WEBFiles/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WEBFiles/logo.gif -------------------------------------------------------------------------------- /WEBFiles/menu.inc: -------------------------------------------------------------------------------- 1 |

Power Meter

2 | 18 | -------------------------------------------------------------------------------- /WEBFiles/menumain.inc: -------------------------------------------------------------------------------- 1 |

Счетчик электроэнергии

2 | 16 | -------------------------------------------------------------------------------- /WEBFiles/power.xml: -------------------------------------------------------------------------------- 1 | ~power_xml~ -------------------------------------------------------------------------------- /WEBFiles/powercnt.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | Power Cnt: ? 3 | ~inc:grfx2.inc~ 11 | -------------------------------------------------------------------------------- /WEBFiles/powercnt.xml: -------------------------------------------------------------------------------- 1 | Power Cnt~PowerCnt~ -------------------------------------------------------------------------------- /WEBFiles/protect/aps.xml: -------------------------------------------------------------------------------- 1 | ~wifi_aps_xml~ 2 | -------------------------------------------------------------------------------- /WEBFiles/protect/chiprams.xml: -------------------------------------------------------------------------------- 1 | 2 | ~start~ 3 | ~xml_ram~ 4 | 5 | -------------------------------------------------------------------------------- /WEBFiles/protect/debug.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WEBFiles/protect/debug.log -------------------------------------------------------------------------------- /WEBFiles/protect/debugram.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug to RAM 5 | 6 | 7 | 8 | ~inc:menu.inc~ 9 |
10 |

Debug to RAM

11 | Address: ~dbg_addr~ filled: ~dbg_len~
12 |
13 | Size:   14 | stop 15 | tiny 16 | all 17 | IotR 18 | +IotS 19 |   20 | 21 | 27 |
28 |
29 | save txt file... 30 |
31 | 32 |
33 | 34 |
35 | 36 |
37 | ~inc:footer.inc~ 38 | ~inc:vdd.inc~ 39 | -------------------------------------------------------------------------------- /WEBFiles/protect/debugram.txt: -------------------------------------------------------------------------------- 1 | ~dbg_ram~ -------------------------------------------------------------------------------- /WEBFiles/protect/dsleep.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 5 | 6 | 7 | 8 | 9 | ~inc:menu.inc~ 10 |
11 |

Test DeepSleep

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
DeepSleep Time(us):
DeepSleep Mode:
Sys_const 108:
34 |

35 | Old sleep_mode = ~sys_sleep_old~
36 | Start event = ~sys_rst~ (0-power, 1-wdt, 2-exception, 3-soft wdt, 4-software, 5-deep-sleep, 6-external)
37 | Reset event = ~sys_res_event~ (1-power, 2-reset, 3-software, 4-wdt)
38 |

39 |
40 | ~inc:footer.inc~ 41 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /WEBFiles/protect/esp_init_data_default.bin: -------------------------------------------------------------------------------- 1 | ~bin_flash_const~ -------------------------------------------------------------------------------- /WEBFiles/protect/fram_all.bin: -------------------------------------------------------------------------------- 1 | ~bin_fram_all~ -------------------------------------------------------------------------------- /WEBFiles/protect/fullflash.bin: -------------------------------------------------------------------------------- 1 | ~bin_flash_all~ -------------------------------------------------------------------------------- /WEBFiles/protect/gpio.xml: -------------------------------------------------------------------------------- 1 | 2 | ~gpio_inp~ 3 | ~gpio_out~ 4 | ~gpio_dir~ 5 | ~gpio0_fun~ 6 | ~gpio1_fun~ 7 | ~gpio2_fun~ 8 | ~gpio3_fun~ 9 | ~gpio4_fun~ 10 | ~gpio5_fun~ 11 | ~gpio6_fun~ 12 | ~gpio7_fun~ 13 | ~gpio8_fun~ 14 | ~gpio9_fun~ 15 | ~gpio10_fun~ 16 | ~gpio11_fun~ 17 | ~gpio12_fun~ 18 | ~gpio13_fun~ 19 | ~gpio14_fun~ 20 | ~gpio15_fun~ 21 | ~gpio0_pull~ 22 | ~gpio1_pull~ 23 | ~gpio2_pull~ 24 | ~gpio3_pull~ 25 | ~gpio4_pull~ 26 | ~gpio5_pull~ 27 | ~gpio6_pull~ 28 | ~gpio7_pull~ 29 | ~gpio8_pull~ 30 | ~gpio9_pull~ 31 | ~gpio10_pull~ 32 | ~gpio11_pull~ 33 | ~gpio12_pull~ 34 | ~gpio13_pull~ 35 | ~gpio14_pull~ 36 | ~gpio15_pull~ 37 | ~gpio0_opd~ 38 | ~gpio1_opd~ 39 | ~gpio2_opd~ 40 | ~gpio3_opd~ 41 | ~gpio4_opd~ 42 | ~gpio5_opd~ 43 | ~gpio6_opd~ 44 | ~gpio7_opd~ 45 | ~gpio8_opd~ 46 | ~gpio9_opd~ 47 | ~gpio10_opd~ 48 | ~gpio11_opd~ 49 | ~gpio12_opd~ 50 | ~gpio13_opd~ 51 | ~gpio14_opd~ 52 | ~gpio15_opd~ 53 | -------------------------------------------------------------------------------- /WEBFiles/protect/hexdmpb.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 HexDump Byte 5 | 6 | 7 | 8 | ~inc:menu.inc~ 9 |
10 |

HexDump Bytes

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
RAM Start addr
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Write addr, value:
Read addr, value:??
35 |
36 | 40 | 41 | 46 | -------------------------------------------------------------------------------- /WEBFiles/protect/hexdmpb.txt: -------------------------------------------------------------------------------- 1 | ~hexdmpb~ -------------------------------------------------------------------------------- /WEBFiles/protect/hexdmpd.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 HexDump DWord 5 | 6 | 7 | 8 | ~inc:menu.inc~ 9 |
10 |

HexDump DWord

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
RAM Start addr   
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Write addr, value:
Read addr, value:??
35 |
36 | 40 | 41 | 46 | -------------------------------------------------------------------------------- /WEBFiles/protect/hexdmpd.txt: -------------------------------------------------------------------------------- 1 | ~hexdmpd~ -------------------------------------------------------------------------------- /WEBFiles/protect/init.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WEBFiles/protect/init.ini -------------------------------------------------------------------------------- /WEBFiles/protect/pr_request.xml: -------------------------------------------------------------------------------- 1 | ~wifi_prrq_xml~ -------------------------------------------------------------------------------- /WEBFiles/protect/ram.bin: -------------------------------------------------------------------------------- 1 | ~bin_ram~ -------------------------------------------------------------------------------- /WEBFiles/protect/scan.xml: -------------------------------------------------------------------------------- 1 | ~wifi_scan~ 2 | -------------------------------------------------------------------------------- /WEBFiles/protect/send_command.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Отправить команду 5 | 6 | 7 | ~inc:menumain.inc~ 8 |
9 |

Отправить команду на счетчик

10 |
11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Шестнадцатеричная строка, максимум 16 байт (00 00 00...): 14 |
Ответ (~command_resp_st~):
25 |

26 | 27 | 28 |

29 |
30 |
31 |
32 |

33 | Описание команд. 34 |

35 |
36 | ~inc:footer.inc~ 37 | 38 | 48 | -------------------------------------------------------------------------------- /WEBFiles/protect/settings.bin: -------------------------------------------------------------------------------- 1 | ~bin_flash_settings~ -------------------------------------------------------------------------------- /WEBFiles/protect/upload.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 Image Upload 5 | 6 | 7 | ~inc:menu.inc~ 8 |
9 |

Firmware or WebFS Image Upload

10 |

11 | Select *.bin file...

12 | 13 |

14 |
15 |

16 | Curent Disk has ~wfs_files~ files, Disk Size: ~wfs_size~ bytes.
17 | Disk Addres: ~wfs_addr~, Max Disk Size: ~wfs_max_size~ bytes, Max 250 files.

18 | Flash ID: ~sys_fid~, Size: ~sys_fsize~ bytes.
19 | Download fullflash.bin

20 |

21 | Upload sector # 22 | 23 |

24 | ~inc:footer.inc~ 25 | -------------------------------------------------------------------------------- /WEBFiles/scripts.js: -------------------------------------------------------------------------------- 1 | var setFormCheckBoxes = function(form) { 2 | var inputs = document.getElementsByTagName('input'); 3 | for(var i=0; i 2 | 3 | 4 | Settings and utilites 5 | 6 | 7 | ~inc:menu.inc~ 8 |
9 |
10 | Send command 11 |

12 | Connect status: ~PWMT_conn_st~
13 | Last response: ~PWMT_last_resp~
14 | Send queue len: ~PWMT_qlen~
15 |
16 | TotalKWT: ~TotalKWT~   Get power.xml
17 | TotalCnt: ~TotalCnt~, PowerCnt: ~PowerCnt~, LastCnt: ~LastCnt~
18 | Ptr: ~PtrCurr~, LastTime: ~TotalCntTime~
19 | By day: Last: ~St_LD~, Total: ~St_LT~, T1: ~St_LT1~, Ptr: ~PtrCurrDay~
20 |
21 | Archive: Total: ~PWMT_arT~, T1: ~PWMT_arT1~
22 | Today: ~PWMT_arTd~, T1: ~PWMT_arTd1~
23 | 24 | 25 | 26 |
27 | IrDA Errors: ~PWMT_errs~
28 | i2c errors: ~i2c_errors~
29 | IoT last status: ~iot_flg~, ~iot_LastSt_time~ - ~iot_LastSt~
30 | Make time: ~mktime~
31 | SSID name: ~wifi_ap_ssid~ WEB ver: ~sys_webver~, SDK ver: ~sys_sdkver~.
32 | WiFi ip: ~wifi_ap_ip~, IP: ~wifi_st_ip~

33 | Time: ~sntp_time~
34 | Power on time: ~sys_mactime~

35 |
36 | ~inc:footer.inc~ 37 | ~inc:time.inc~ 38 | -------------------------------------------------------------------------------- /WEBFiles/slider.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WEBFiles/time.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WEBFiles/timeout.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 WIFI 5 | 6 | 7 | 8 |

ESP8266 Built-in Web server ©

9 |
10 |

Timeout ? sec...

11 | * Redirect: http://~sys_url~/ *

12 | Main 13 |
14 | ~inc:footer.inc~ 15 | 16 | 17 | -------------------------------------------------------------------------------- /WEBFiles/timer.inc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ESP8266 5 | 6 | 7 | 8 |

ESP8266 Built-in Web server ©

9 |
10 |

Timeout ? sec...

11 | Redirect: Main -------------------------------------------------------------------------------- /WEBFiles/tst.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | Test: ? 3 | ~inc:grfx2.inc~ -------------------------------------------------------------------------------- /WEBFiles/tst.xml: -------------------------------------------------------------------------------- 1 | Test-1*~wifi_st_rssi~? 2 | -------------------------------------------------------------------------------- /WEBFiles/vdd.htm: -------------------------------------------------------------------------------- 1 | ~inc:grfx1.inc~ 2 | Vdd: ?V 3 | ~inc:grfx2.inc~ 11 | 12 | -------------------------------------------------------------------------------- /WEBFiles/vdd.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WEBFiles/vdd.xml: -------------------------------------------------------------------------------- 1 | Vdd(eval(~sys_vdd33~*100.0/~sys_ucnst_0~.0)).toFixed(3) 2 | -------------------------------------------------------------------------------- /WatchdogESP01/WatchdogESP01.hex: -------------------------------------------------------------------------------- 1 | :1000000009C016C015C014C013C012C011C010C062 2 | :1000100010C00EC011241FBECFE9CDBF20E0A0E666 3 | :10002000B0E001C01D92A136B207E1F729D09BC014 4 | :10003000E7CF1F920F920FB60F9211240F900FBEB1 5 | :100040000F901F901895009739F02AE22A95F1F742 6 | :1000500000C0A8950197F7CF0895CF93DF938F3F06 7 | :100060002FEF920711F488E592E0EC01209729F038 8 | :1000700088EE93E0E8DF2197F9CFDF91CF910895E3 9 | :1000800080E886BD16BC80E187BB8CE288BB83E03C 10 | :1000900085BD81E385BF80E090E04BD08093600018 11 | :1000A0008F3F19F487E0809360008091600088643E 12 | :1000B0008093600088E181BD8091600081BD78946B 13 | :1000C00084E690E0C0DFC49A85E090E03AD0C5DFD6 14 | :1000D000C8E18895C1BD8091600081BD86B3837001 15 | :1000E000C1F783E090E02DD08F3F2FEF920711F4FE 16 | :1000F00088E893E1009749F0A8952AE22A95F1F75C 17 | :1001000000C026B301972370A9F386B3837009F763 18 | :10011000C49881E090E015D08F3F2FEF920711F443 19 | :1001200080E197E290DFC49A85E090E00AD08BDF0F 20 | :10013000D0CFE199FECF1FBA8EBBE09A99278DB33D 21 | :100140000895A8E142E002C0A82F862FE82FE19988 22 | :10015000FECF1FBA05C0EEBBE09AE3950DB20D923B 23 | :0A0160004150C8F70895F894FFCF4E 24 | :00000001FF 25 | -------------------------------------------------------------------------------- /WatchdogESP01/WatchdogESP01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WatchdogESP01/WatchdogESP01.png -------------------------------------------------------------------------------- /Web1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web1.jpg -------------------------------------------------------------------------------- /Web2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web2.jpg -------------------------------------------------------------------------------- /Web3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web3.jpg -------------------------------------------------------------------------------- /Web4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web4.jpg -------------------------------------------------------------------------------- /Web4_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web4_2.jpg -------------------------------------------------------------------------------- /Web5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web5.jpg -------------------------------------------------------------------------------- /Web6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/Web6.jpg -------------------------------------------------------------------------------- /WebSocket/ws2.css: -------------------------------------------------------------------------------- 1 | #consoleLog { 2 | overflow-y: scroll; 3 | width: 480px; 4 | height: 200px; 5 | border: solid 1px #aaaaaa; 6 | background-color: #ffffff; 7 | padding-left: 5px; } 8 | #consoleLog > pre { 9 | margin-top: 0; 10 | margin-bottom: 0; } 11 | #consoleLog > pre:nth-child(even) { 12 | background-color: #fafafa; } 13 | -------------------------------------------------------------------------------- /WebSocket/ws2.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/WebSocket/ws2.htm -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | *.output* 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /app/NULL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/app/NULL -------------------------------------------------------------------------------- /app/driver/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libdriver.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | INCLUDES := $(INCLUDES) -I $(PDIR)include 40 | INCLUDES += -I ./ 41 | PDIR := ../$(PDIR) 42 | sinclude $(PDIR)Makefile 43 | 44 | -------------------------------------------------------------------------------- /app/driver/eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eeprom read/write 3 | * 4 | * Created: 12.05.2016 5 | * Written by Vadim Kulakov, vad7 @ yahoo.com 6 | * 7 | */ 8 | #include "driver/eeprom.h" 9 | 10 | #ifdef USE_HSPI 11 | 12 | // max len = 64 bytes 13 | uint8_t eeprom_read_block(uint32_t addr, uint8_t *buffer, uint32_t len) 14 | { 15 | if(len > MAX_EEPROM_BLOCK_LEN) return 1; 16 | spi_write_read_block(SPI_RECEIVE, (EEPROM_READ< MAX_EEPROM_BLOCK_LEN) return 1; 24 | uint8_t opcode[1] = { EEPROM_WREN }; 25 | spi_write_read_block(SPI_SEND + SPI_RECEIVE, 0, opcode, 1); 26 | spi_write_read_block(SPI_SEND, (EEPROM_WRITE<3) 18 | #define I2SDMABUFLEN (64)//(32*2) //Length of one buffer, in 32-bit words (>2) 19 | 20 | long underrunCnt; // DMA underrun counter 21 | 22 | void ICACHE_FLASH_ATTR i2sInit(int rate, int lockBitcount, uint32 sample); 23 | void i2sSetRate(int rate, int lockBitcount); 24 | bool i2sPushSample(unsigned int sample); 25 | bool ICACHE_FLASH_ATTR i2s_is_full(); 26 | bool ICACHE_FLASH_ATTR i2s_is_empty(); 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /app/include/driver/int_time_us.h: -------------------------------------------------------------------------------- 1 | #ifndef __INT_TIME_US__ 2 | #define __INT_TIME_US__ 3 | 4 | void int_us_init(uint32 us) ICACHE_FLASH_ATTR; 5 | void int_us_disable(void) ICACHE_FLASH_ATTR; 6 | 7 | void set_new_time_int_us(uint32 us) ICACHE_FLASH_ATTR; 8 | 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /app/include/driver/sigma_delta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sigma_delta.h 3 | * 4 | * Created on: 14/02/2015 г. 5 | * Author: PV` 6 | */ 7 | 8 | #ifndef _DRIVER_SIGMA_DELTA_H_ 9 | #define _DRIVER_SIGMA_DELTA_H_ 10 | 11 | void sigma_delta_setup(uint32 GPIO_NUM) ICACHE_FLASH_ATTR; 12 | void sigma_delta_close(uint32 GPIO_NUM) ICACHE_FLASH_ATTR; 13 | void set_sigma_duty_312KHz(uint8 duty) ICACHE_FLASH_ATTR; 14 | 15 | #endif /* _DRIVER_SIGMA_DELTA_H_ */ 16 | -------------------------------------------------------------------------------- /app/include/mdbrs485.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: mdbrs485.h 3 | * ModBus TCP RTU <> RS-485 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | #ifndef _INCLUDE_MODBUSTCPRS485_H_ 8 | #define _INCLUDE_MODBUSTCPRS485_H_ 9 | 10 | #include "user_config.h" 11 | //#ifdef USE_RS485DRV 12 | //#include "driver/rs485drv.h" 13 | #include "modbusrtu.h" 14 | #include "mdbtab.h" 15 | //#include "modbustcp.h" 16 | 17 | #define MDB_TCP_RS485_MIN_HEAP 24576 18 | 19 | uint32 CalkCRC16tab(uint8 * blk, uint32 len); 20 | struct srs485msg * rs485_new_tx_msg(smdbtcp * p, bool flg_out) ICACHE_FLASH_ATTR; 21 | uint32 rs485_test_msg(uint8 * pbufi, uint32 len); 22 | bool rs485_rx_msg(struct srs485msg *msg); 23 | 24 | //#endif USE_RS485DRV 25 | #endif /* _INCLUDE_MODBUSTCPRS485_H_ */ 26 | -------------------------------------------------------------------------------- /app/include/mdbtab.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: mdbtab.h 3 | * ModBus TCP RTU <> RS-485 4 | * Author: PV` 5 | * (c) PV` 2016 6 | *******************************************************************************/ 7 | #ifndef _INCLUDE_MDBTAB_H_ 8 | #define _INCLUDE_MDBTAB_H_ 9 | 10 | #include "user_config.h" 11 | #ifdef MDB_RS485_MASTER 12 | 13 | #ifndef MDB_BUF_MAX 14 | #define MDB_BUF_MAX 1000 // размер буфера Modbus переменных для обмена между интерфейсами Web<->RS-485<->TCP 15 | #endif 16 | #define MDB_SYS_VAR_ADDR (MDB_BUF_MAX + 100) // адрес старта системных переменных буфера Modbus для обмена между интерфейсами Web<->RS-485<->TCP 17 | 18 | typedef struct __attribute__ ((packed)) { // 19 | uint16 start_flg; //0 флаг пуска 20 | uint16 id; //1 Адрес внешнего устройства 21 | uint16 cmd; //2 Номер команды 22 | uint16 len; //3 Кол-во слов передачи 23 | uint16 ext_addr; //4 Адрес данных во внешнем устройстве 24 | uint16 int_addr; //5 Адрес данных во внутреннем устройстве (ESP) 25 | uint16 timer_set; //6 таймерная установка 26 | uint16 rx_err; //7 счетчик запросов без ответа (до 0xffff) 27 | uint16 fifo_cnt; //8 счетчик неотработанных сообщений в очереди 28 | uint16 timer_cnt; //9 таймерный счетчик 29 | }smdbtrn; 30 | 31 | #define MDB_TRN_MAX 10 // кол-во таблиц управления транзакциями в режиме master Modbus RTU RS-485 32 | 33 | typedef struct { // 34 | uint16 ubuf[MDB_BUF_MAX]; // буфер переменных Modbus для обмена между интерфейсами Web<->RS-485<->TCP 35 | smdbtrn trn[MDB_TRN_MAX]; 36 | }smdb_ubuf; 37 | 38 | bool mdb_start_trn(uint32 num); 39 | void init_mdbtab(void); 40 | 41 | #else 42 | 43 | #ifndef MDB_BUF_MAX 44 | #define MDB_BUF_MAX 100 // размер буфера Modbus переменных для обмена между интерфейсами Web<->RS-485<->TCP 45 | #endif 46 | #define MDB_SYS_VAR_ADDR (1100) // адрес старта системных переменных буфера Modbus для обмена между интерфейсами Web<->RS-485<->TCP 47 | 48 | typedef struct { // 49 | uint16 ubuf[MDB_BUF_MAX]; // буфер переменных Modbus для обмена между интерфейсами Web<->RS-485<->TCP 50 | }smdb_ubuf; 51 | 52 | #endif 53 | 54 | extern smdb_ubuf mdb_buf; // буфер переменных Modbus для обмена между интерфейсами Web<->RS-485<->TCP 55 | 56 | bool mbd_fini(uint8 * cfile); 57 | 58 | #endif /* _INCLUDE_MDBTAB_H_ */ 59 | -------------------------------------------------------------------------------- /app/include/modbustcp.h: -------------------------------------------------------------------------------- 1 | #ifndef _ModBusTcp_H_ 2 | //=============================================================================== 3 | // ModBusTCP.h 11.2010 pvvx 4 | //=============================================================================== 5 | #define _ModBusTcp_H_ 6 | 7 | #include "lwip/tcp.h" 8 | #include "tcp_srv_conn.h" 9 | 10 | #define DEFAULT_MDB_PORT USE_MODBUS // 502 11 | #define DEFAULT_MDB_ID 50 // номер устройства ESP8266 по шине modbus 12 | 13 | extern TCP_SERV_CFG * mdb_tcp_servcfg; 14 | extern TCP_SERV_CONN * mdb_tcp_conn; 15 | 16 | err_t mdb_tcp_start(uint16 portn) ICACHE_FLASH_ATTR; 17 | void mdb_tcp_close(void) ICACHE_FLASH_ATTR; 18 | uint32 WrMdbData(uint8 * dbuf, uint16 addr, uint32 len) ICACHE_FLASH_ATTR; 19 | uint32 RdMdbData(uint8 * mdbbuf, uint32 addr, uint32 len) ICACHE_FLASH_ATTR; 20 | 21 | #endif //_ModBusTcp_H_ 22 | -------------------------------------------------------------------------------- /app/include/netbios.h: -------------------------------------------------------------------------------- 1 | #ifndef __NETBIOS_H__ 2 | #define __NETBIOS_H__ 3 | 4 | #include "user_interface.h" 5 | 6 | #ifdef USE_NETBIOS 7 | 8 | /** default port number for "NetBIOS Name service */ 9 | #define NETBIOS_PORT 137 10 | 11 | /** size of a NetBIOS name */ 12 | #define NETBIOS_NAME_LEN 16 13 | 14 | extern uint8 netbios_name[NETBIOS_NAME_LEN + 1]; 15 | 16 | void netbios_init(void) ICACHE_FLASH_ATTR; 17 | struct udp_pcb * ICACHE_FLASH_ATTR netbios_pcb(void) ICACHE_FLASH_ATTR; 18 | void netbios_set_name(uint8 * name) ICACHE_FLASH_ATTR; 19 | bool netbios_off(void) ICACHE_FLASH_ATTR; 20 | 21 | #endif 22 | 23 | #endif /* __NETBIOS_H__ */ 24 | -------------------------------------------------------------------------------- /app/include/overlay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * overlay.h 3 | * 4 | * Created on: 01/02/2016 5 | * Author: PVV 6 | */ 7 | #ifndef _INCLUDE_OVERLAY_H_ 8 | #define _INCLUDE_OVERLAY_H_ 9 | 10 | #include "tcp_srv_conn.h" 11 | 12 | typedef int tovl_call(int flg); 13 | 14 | extern tovl_call * ovl_call; 15 | 16 | int ovl_loader(uint8 *filename); 17 | 18 | 19 | #endif /* _INCLUDE_OVERLAY_H_ */ 20 | -------------------------------------------------------------------------------- /app/include/sntp.h: -------------------------------------------------------------------------------- 1 | #ifndef __SNTP_H__ 2 | #define __SNTP_H__ 3 | 4 | #include "lwip/ip_addr.h" 5 | #include 6 | 7 | bool sntp_inits(int8_t UTC_offset, uint16_t update_delay_min, char * srv) ICACHE_FLASH_ATTR; 8 | void sntp_close(void) ICACHE_FLASH_ATTR; 9 | time_t get_sntp_time(void) ICACHE_FLASH_ATTR; 10 | time_t get_sntp_localtime(void) ICACHE_FLASH_ATTR; 11 | time_t sntp_local_to_UTC_time(time_t local) ICACHE_FLASH_ATTR; 12 | void sntp_set_time(time_t t) ICACHE_FLASH_ATTR; 13 | 14 | extern ip_addr_t dhcp_sntp_server_address; 15 | extern int16_t sntp_time_adjust; // sec 16 | extern int8 sntp_status; // 1,2 = ok, -1 = manual set 17 | extern uint32 sntp_update_delay; // us 18 | 19 | void sntp_send_request(ip_addr_t *server_addr) ICACHE_FLASH_ATTR; 20 | 21 | #endif /* __SNTP_H__ */ 22 | -------------------------------------------------------------------------------- /app/include/sys_const_utils.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: sys_const_utils.h 3 | * Description: read/write sdk_sys_cont (esp_init_data_default.bin) 4 | * Author: PV` 5 | *******************************************************************************/ 6 | #ifndef _INCLUDE_SYS_CONST_U_H_ 7 | #define _INCLUDE_SYS_CONST_U_H_ 8 | 9 | #include "hw/esp8266.h" 10 | #include "sdk/sys_const.h" 11 | 12 | uint8 read_sys_const(uint8 idx); 13 | bool write_sys_const(uint8 idx, uint8 data); 14 | 15 | #endif /* _INCLUDE_SYS_CONST_U_H_ */ 16 | -------------------------------------------------------------------------------- /app/include/web_fs_init.h: -------------------------------------------------------------------------------- 1 | 2 | #include "web_srv.h" 3 | 4 | #define CRLF "\r\n" 5 | #define FINI_BUF_SIZE 512 6 | 7 | struct buf_fini 8 | { 9 | TCP_SERV_CONN ts_conn; 10 | WEB_SRV_CONN web_conn; 11 | uint8 buf[FINI_BUF_SIZE+1]; 12 | }; 13 | 14 | struct buf_fini * web_fini_init(uint8 init_msgbuf) ICACHE_FLASH_ATTR; 15 | uint8 web_fini(const uint8 * fname) ICACHE_FLASH_ATTR; 16 | -------------------------------------------------------------------------------- /app/include/web_iohw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * web_iohw.h 3 | * 4 | */ 5 | 6 | #ifndef _WEB_IOHW_H_ 7 | #define _WEB_IOHW_H_ 8 | 9 | #include "user_config.h" 10 | 11 | void set_cpu_clk(void) ICACHE_FLASH_ATTR; // select cpu frequency 80 or 160 MHz 12 | void set_gpiox_mux_pull(uint8 pin_num, uint8 pull) ICACHE_FLASH_ATTR; 13 | void set_gpiox_mux_func(uint8 pin_num, uint8 func) ICACHE_FLASH_ATTR; 14 | uint32 get_gpiox_mux_func(uint8 pin_num) ICACHE_FLASH_ATTR; 15 | void set_gpiox_mux_func_ioport(uint8 pin_num) ICACHE_FLASH_ATTR; 16 | void set_gpiox_mux_func_default(uint8 pin_num) ICACHE_FLASH_ATTR; 17 | volatile uint32 * get_addr_gpiox_mux(uint8 pin_num) ICACHE_FLASH_ATTR; 18 | uint32 get_gpiox_mux(uint8 pin_num) ICACHE_FLASH_ATTR; 19 | 20 | #ifdef USE_GPIO3_AS_CFG_RESET 21 | void test_pin_clr_wifi_config(void) ICACHE_FLASH_ATTR; 22 | #endif 23 | uint64 get_mac_time(void) ICACHE_FLASH_ATTR; 24 | 25 | #endif /* _WEB_IOHW_H_ */ 26 | -------------------------------------------------------------------------------- /app/include/web_utils.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: web_utils.h 3 | * Alternate SDK 4 | * Author: PV` 5 | * (c) PV` 2015 6 | * 7 | * added vad7 8 | *******************************************************************************/ 9 | 10 | #ifndef _INCLUDE_WEB_UTILS_H_ 11 | #define _INCLUDE_WEB_UTILS_H_ 12 | 13 | //int rom_atoi(const char *s) ICACHE_FLASH_ATTR; 14 | int atoi_z(const char *s, uint8_t endchar_zero) ICACHE_FLASH_ATTR; 15 | #define rom_atoi(s) atoi_z(s, 0) 16 | void copy_align4(void *ptrd, void *ptrs, uint32 len); 17 | uint32 hextoul(uint8 *s) ICACHE_FLASH_ATTR; 18 | uint32 ahextoul(uint8 *s) ICACHE_FLASH_ATTR; 19 | uint8 * cmpcpystr(uint8 *pbuf, uint8 *pstr, uint8 a, uint8 b, uint16 len) ICACHE_FLASH_ATTR; 20 | uint8 * web_strnstr(const uint8* buffer, const uint8* token, int n) ICACHE_FLASH_ATTR; 21 | bool base64decode(const uint8 *in, int len, uint8_t *out, int *outlen) ICACHE_FLASH_ATTR; 22 | size_t base64encode(char* target, size_t target_len, const char* source, size_t source_len) ICACHE_FLASH_ATTR; 23 | void strtomac(uint8 *s, uint8 *macaddr) ICACHE_FLASH_ATTR; 24 | //uint32 strtoip(uint8 *s) ICACHE_FLASH_ATTR; // ipaddr_addr(); 25 | int urldecode(uint8 *d, uint8 *s, uint16 lend, uint16 lens) ICACHE_FLASH_ATTR; 26 | //int urlencode(uint8 *d, uint8 *s, uint16 lend, uint16 lens) ICACHE_FLASH_ATTR; 27 | int htmlcode(uint8 *d, uint8 *s, uint16 lend, uint16 lens) ICACHE_FLASH_ATTR; 28 | void print_hex_dump(uint8 *buf, uint32 len, uint8 k) ICACHE_FLASH_ATTR; 29 | // char* str_to_upper_case(char* text) ICACHE_FLASH_ATTR; 30 | uint32 str_array(uint8 *s, uint32 *buf, uint32 max_buf) ICACHE_FLASH_ATTR; 31 | uint32 str_array_w(uint8 *s, uint16 *buf, uint32 max_buf) ICACHE_FLASH_ATTR; 32 | uint32 str_array_b(uint8 *s, uint8 *buf, uint32 max_buf) ICACHE_FLASH_ATTR; 33 | char* word_to_lower_case(char* text) ICACHE_FLASH_ATTR; 34 | uint32 str_array_hex_byte(uint8 *s, uint8 *buf, uint32 buf_size) ICACHE_FLASH_ATTR; 35 | 36 | bool str_cmp_wildcards(char* wildstring, char *matchstring) ICACHE_FLASH_ATTR; 37 | 38 | #endif /* _INCLUDE_WEB_UTILS_H_ */ 39 | -------------------------------------------------------------------------------- /app/include/web_websocket.h: -------------------------------------------------------------------------------- 1 | #ifndef _WEB_WEBSOCKET_H_ 2 | /****************************************************************************** 3 | * FileName: web_websocket.h 4 | * Description: websocket for web ESP8266 5 | * Author: PV` 6 | * (c) PV` 2016 7 | *******************************************************************************/ 8 | #define _WEB_WEBSOCKET_H_ 9 | #include "user_config.h" 10 | #ifdef WEBSOCKET_ENA 11 | #include "websock.h" 12 | 13 | err_t websock_tx_close_err(TCP_SERV_CONN *ts_conn, uint32 err); 14 | bool websock_rx_data(TCP_SERV_CONN *ts_conn); 15 | 16 | #endif // WEBSOCKET_ENA 17 | #endif /* _WEB_WEBSOCKET_H_ */ 18 | -------------------------------------------------------------------------------- /app/include/wifi_events.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wifi_events.h 3 | * Author: pvvx 4 | */ 5 | 6 | #ifndef _INCLUDE_WIFI_EVENTS_H_ 7 | #define _INCLUDE_WIFI_EVENTS_H_ 8 | 9 | #include "user_config.h" 10 | #include "user_interface.h" 11 | 12 | struct s_probe_requests { 13 | uint8 mac[6]; 14 | sint8 rssi_min; 15 | sint8 rssi_max; 16 | } __attribute__((packed)); 17 | 18 | #define MAX_COUNT_BUF_PROBEREQS 64 19 | extern struct s_probe_requests buf_probe_requests[MAX_COUNT_BUF_PROBEREQS]; 20 | extern uint32 probe_requests_count; 21 | 22 | void wifi_handle_event_cb(System_Event_t *evt) ICACHE_FLASH_ATTR; 23 | 24 | extern int flg_open_all_service; // default = false 25 | 26 | extern int st_reconn_count; 27 | extern os_timer_t st_disconn_timer; 28 | void station_reconnect_off(void) ICACHE_FLASH_ATTR; 29 | 30 | void close_all_service(void) ICACHE_FLASH_ATTR; 31 | void open_all_service(int flg) ICACHE_FLASH_ATTR; 32 | 33 | #endif // _INCLUDE_WIFI_EVENTS_H_ 34 | -------------------------------------------------------------------------------- /app/mdbtcp/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libmdbtcp.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | PDIR := ../$(PDIR) 40 | sinclude $(PDIR)Makefile 41 | 42 | -------------------------------------------------------------------------------- /app/sdklib/.gitignore: -------------------------------------------------------------------------------- 1 | *.output* 2 | -------------------------------------------------------------------------------- /app/sdklib/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################# 2 | # Required variables for each makefile 3 | # Discard this section from all parent makefiles 4 | # Expected variables (with automatic defaults): 5 | # SUBDIRS (all subdirs with a Makefile) 6 | # GEN_LIBS - list of libs to be generated () 7 | # GEN_IMAGES - list of object file images to be generated () 8 | # GEN_BINS - list of binaries to be generated () 9 | # COMPONENTS_xxx - a list of libs/objs in the form 10 | # subdir/lib to be extracted and rolled up into 11 | # a generated lib/image xxx.a () 12 | # 13 | TARGET = eagle 14 | 15 | USE_OPEN_LWIP = 140 16 | USE_OPEN_DHCPS = 1 17 | 18 | UP_EXTRACT_DIR = .. 19 | 20 | COMPONENTS_libsdk = \ 21 | system/libaddmmain.a \ 22 | phy/libaddmphy.a \ 23 | pp/libaddpp.a \ 24 | wpa/libaddwpa.a 25 | 26 | ifdef USE_OPEN_LWIP 27 | COMPONENTS_libsdk += lwip/liblwip.a 28 | CONFIGURATION_DEFINES += -DUSE_OPEN_LWIP 29 | endif 30 | 31 | ifdef USE_OPEN_DHCPS 32 | CONFIGURATION_DEFINES += -DUSE_OPEN_DHCPS 33 | endif 34 | 35 | ifndef PDIR # { 36 | GEN_LIBS = libsdk.a 37 | SUBDIRS = \ 38 | system \ 39 | phy \ 40 | pp \ 41 | wpa 42 | 43 | ifdef USE_OPEN_LWIP 44 | SUBDIRS += lwip 45 | endif 46 | 47 | ADDLIBDIR = ../../lib/ 48 | SPECIAL_MKTARGETS = $(ADDLIBDIR)libsdk.a 49 | INPLIB = .output/eagle/lib/libsdk.a 50 | 51 | ADDLIBS_libsdk = \ 52 | libmgcc.a \ 53 | libmmain.a \ 54 | libmphy.a \ 55 | libpp.a \ 56 | libmwpa.a \ 57 | libcrypto.a \ 58 | libnet80211.a 59 | 60 | ifndef USE_OPEN_LWIP 61 | ADDLIBS_libsdk += \ 62 | liblwipif.a \ 63 | libmlwip.a 64 | endif 65 | 66 | ifndef USE_OPEN_DHCPS 67 | ADDLIBS_libsdk += libdhcps.a 68 | endif 69 | 70 | endif # } PDIR 71 | 72 | APPDIR = . 73 | 74 | ############################################################# 75 | # Recursion Magic - Don't touch this!! 76 | # 77 | # Each subtree potentially has an include directory 78 | # corresponding to the common APIs applicable to modules 79 | # rooted at that subtree. Accordingly, the INCLUDE PATH 80 | # of a module can only contain the include directories up 81 | # its parent path, and not its siblings 82 | # 83 | # Required for each makefile to inherit from the parent 84 | 85 | # INCLUDES := $(INCLUDES) -I $(PDIR)include 86 | PDIR := ../$(PDIR) 87 | sinclude $(PDIR)Makefile 88 | 89 | 90 | .PHONY: FORCE 91 | FORCE: 92 | -------------------------------------------------------------------------------- /app/sdklib/lwip/COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/sdklib/lwip/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | UP_EXTRACT_DIR = .. 16 | GEN_LIBS = liblwip.a 17 | COMPONENTS_liblwip = api/liblwipapi.a \ 18 | app/liblwipapp.a \ 19 | core/liblwipcore.a \ 20 | core/ipv4/liblwipipv4.a \ 21 | netif/liblwipnetif.a 22 | endif 23 | 24 | 25 | ############################################################# 26 | # Configuration i.e. compile options etc. 27 | # Target specific stuff (defines etc.) goes in here! 28 | # Generally values applying to a tree are captured in the 29 | # makefile at its root level - these are then overridden 30 | # for a subtree within the makefile rooted therein 31 | # 32 | #DEFINES += 33 | 34 | ############################################################# 35 | # Recursion Magic - Don't touch this!! 36 | # 37 | # Each subtree potentially has an include directory 38 | # corresponding to the common APIs applicable to modules 39 | # rooted at that subtree. Accordingly, the INCLUDE PATH 40 | # of a module can only contain the include directories up 41 | # its parent path, and not its siblings 42 | # 43 | # Required for each makefile to inherit from the parent 44 | # 45 | 46 | INCLUDES := $(INCLUDES) -I $(PDIR)include 47 | INCLUDES += -I ./ 48 | PDIR := ../$(PDIR) 49 | sinclude $(PDIR)Makefile 50 | 51 | -------------------------------------------------------------------------------- /app/sdklib/lwip/api/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipapi.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /app/sdklib/lwip/api/netbuf.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/app/sdklib/lwip/api/netbuf.c -------------------------------------------------------------------------------- /app/sdklib/lwip/api/tcpip.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/app/sdklib/lwip/api/tcpip.c -------------------------------------------------------------------------------- /app/sdklib/lwip/app/Espressif.License: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/app/sdklib/lwip/app/Espressif.License -------------------------------------------------------------------------------- /app/sdklib/lwip/app/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipapp.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /app/sdklib/lwip/core/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipcore.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /app/sdklib/lwip/core/ipv4/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipipv4.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /app/sdklib/lwip/core/ipv4/icmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/app/sdklib/lwip/core/ipv4/icmp.c -------------------------------------------------------------------------------- /app/sdklib/lwip/core/ipv4/inet.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Functions common to all TCP/IPv4 modules, such as the byte order functions. 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/inet.h" 42 | 43 | -------------------------------------------------------------------------------- /app/sdklib/lwip/core/sys.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * lwIP Operating System abstraction 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/sys.h" 42 | 43 | /* Most of the functions defined in sys.h must be implemented in the 44 | * architecture-dependent file sys_arch.c */ 45 | 46 | #if !NO_SYS 47 | 48 | /** 49 | * Sleep for some ms. Timeouts are NOT processed while sleeping. 50 | * 51 | * @param ms number of milliseconds to sleep 52 | */ 53 | void 54 | sys_msleep(u32_t ms) 55 | { 56 | if (ms > 0) { 57 | sys_sem_t delaysem; 58 | err_t err = sys_sem_new(&delaysem, 0); 59 | if (err == ERR_OK) { 60 | sys_arch_sem_wait(&delaysem, ms); 61 | sys_sem_free(&delaysem); 62 | } 63 | } 64 | } 65 | 66 | #endif /* !NO_SYS */ 67 | -------------------------------------------------------------------------------- /app/sdklib/lwip/netif/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipnetif.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /app/sdklib/phy/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libaddmphy.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | #INCLUDES := $(INCLUDES) -I $(PDIR)include 40 | PDIR := ../$(PDIR) 41 | sinclude $(PDIR)Makefile 42 | 43 | -------------------------------------------------------------------------------- /app/sdklib/phy/phy_chip_v6_unused.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: phy_chip_v6_unused.c 3 | * Description: Alternate SDK (libphy.a) 4 | * (c) PV` 2015 5 | *******************************************************************************/ 6 | #include "user_config.h" 7 | #include "bios.h" 8 | #include "hw/esp8266.h" 9 | #include "phy/phy.h" 10 | 11 | // (!) закоменитрованы неиспользуемые функции 12 | 13 | // вызывается из phy_chip_v6.o 14 | void ICACHE_FLASH_ATTR chip_v6_set_sense(void) 15 | { 16 | // ret.n 17 | } 18 | 19 | /* 20 | void ICACHE_FLASH_ATTR chip_v6_get_sense(void) 21 | { 22 | // ret.n 23 | } 24 | */ 25 | 26 | // вызывается из phy_chip_v6.o 27 | int ICACHE_FLASH_ATTR chip_v6_unset_chanfreq(void) 28 | { 29 | return 0; 30 | } 31 | 32 | /* 33 | int ICACHE_FLASH_ATTR data_collect(void) 34 | { 35 | ??? 36 | } 37 | 38 | void ICACHE_FLASH_ATTR operation_test(void) 39 | { 40 | ??? 41 | } 42 | 43 | 44 | // используется из slop_test() 45 | void ICACHE_FLASH_ATTR slop_wdt_feed(void) 46 | { 47 | WDT_FEED = WDT_FEED_MAGIC; 48 | } 49 | 50 | void ICACHE_FLASH_ATTR slop_test(void) 51 | { 52 | 53 | os_printf_plus("slop_test\n"); 54 | CLK_PRE_PORT |= 1; 55 | i2c_writeReg_Mask(106, 2, 8, 4, 0, 0); 56 | uint32 x = IOREG(0x3FF20C00); 57 | RFChannelSel(14); 58 | int i; 59 | for(i=0; i<200; i++) { 60 | slop_wdt_feed(); 61 | IOREG(0x60000738) = operation_test(); 62 | pm_set_sleep_mode(2); 63 | pm_wakeup_opt(8, 0); 64 | pm_set_sleep_cycles(170); 65 | x = IOREG(0x3FF20C00); 66 | pm_goto_sleep(2); 67 | pm_wait4wakeup(2); 68 | pm_wakeup_init(2, 0); 69 | x = IOREG(0x3FF20C00); 70 | } 71 | } 72 | 73 | void ICACHE_FLASH_ATTR wd_reset_cnt(void) 74 | { 75 | uint32 x = rtc_get_reset_reason(); 76 | if(x == 4) os_printf("wd_reset %d\n", RTC_RAM_BASE[0xFC>>2]); 77 | else if(x == 2 || x != 1) { 78 | RTC_RAM_BASE[0xFC>>2] = 0; 79 | os_printf("wd_reset %d\n", RTC_RAM_BASE[0xFC>>2]); 80 | } 81 | } 82 | */ 83 | -------------------------------------------------------------------------------- /app/sdklib/pp/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libaddpp.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | PDIR := ../$(PDIR) 40 | sinclude $(PDIR)Makefile 41 | 42 | -------------------------------------------------------------------------------- /app/sdklib/pp/pplibadd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FileName: pplibadd.c 3 | * Description: Alternate SDK (libpp.a) 4 | * (c) PV` 2015 5 | */ 6 | #include "c_types.h" 7 | #include "user_config.h" 8 | 9 | #if DEF_SDK_VERSION >= 1300 10 | /* bit_popcount() используется из SDK libpp.a: if_hwctrl.o и trc.o */ 11 | uint32 ICACHE_FLASH_ATTR bit_popcount(uint32 x) 12 | { 13 | uint32 ret = 0; 14 | while(x) { 15 | ret += x & 1; 16 | x >>= 1; 17 | } 18 | return ret; 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /app/sdklib/system/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libaddmmain.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | #INCLUDES := $(INCLUDES) -I $(PDIR)include 40 | #INCLUDES += -I ./include 41 | PDIR := ../$(PDIR) 42 | sinclude $(PDIR)Makefile 43 | 44 | -------------------------------------------------------------------------------- /app/sdklib/system/ets_timer.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: ets_timer.c 3 | * Description: Alternate SDK (libmain.a) 4 | * (c) PV` 2015 5 | ******************************************************************************/ 6 | #include "bios.h" 7 | #include "hw/eagle_soc.h" 8 | #include "hw/esp8266.h" 9 | 10 | extern bool timer2_ms_flag; 11 | 12 | #define MIN_US_TIMER 0 13 | 14 | // us timer 15 | // 0xFFFFFFFF/(80000000 >> 4) = 858.993459 16 | // (80000000 >> 4)/(1000000>>2) = 20 17 | // (80000000 >> 4)/1000000 = 5 18 | // ms timer 19 | // 0xFFFFFFFF/(80000000 >> 8) = 13743.895344 20 | // (80000000 >> 8)/(1000>>2) = 1250 21 | // (80000000 >> 8)/1000 = 312.5 22 | #define XS_TO_RTC_TIMER_TICKS(t, prescaler, period) \ 23 | (((t) > (0xFFFFFFFF/(APB_CLK_FREQ >> prescaler))) ? \ 24 | (((t) >> 2) * ((APB_CLK_FREQ >> prescaler)/(period>>2)) + ((t) & 0x3) * ((APB_CLK_FREQ >> prescaler)/period)) : \ 25 | (((t) * (APB_CLK_FREQ >> prescaler)) / period)) 26 | 27 | void ets_timer_arm_new(ETSTimer *ptimer, uint32_t us_ms, int repeat_flag, int isMstimer) 28 | { 29 | ets_intr_lock(); 30 | if(ptimer->timer_next != (ETSTimer *)0xffffffff) ets_timer_disarm(ptimer); 31 | if(us_ms) { 32 | if(timer2_ms_flag == 0) { // us_timer 33 | if(isMstimer) us_ms *= 1000; 34 | #if ((APB_CLK_FREQ>>4)%1000000) 35 | us_ms = XS_TO_RTC_TIMER_TICKS(us_ms, 4, 1000000); 36 | #else 37 | us_ms *= (APB_CLK_FREQ>>4)/1000000; 38 | #endif 39 | } 40 | else { // ms_timer 41 | #if ((APB_CLK_FREQ>>8)%1000) 42 | us_ms = XS_TO_RTC_TIMER_TICKS(us_ms, 8, 1000); 43 | #else 44 | us_ms *= (APB_CLK_FREQ>>8)/1000; 45 | #endif 46 | } 47 | } 48 | #if MIN_US_TIMER != 0 49 | if(us_ms < MIN_US_TIMER) us_ms = MIN_US_TIMER; 50 | #endif 51 | if(repeat_flag) ptimer->timer_period = us_ms; 52 | MEMW(); 53 | timer_insert(TIMER1_COUNT + us_ms, ptimer); 54 | } 55 | 56 | /* 57 | // ------------------------------------------------------ 58 | // system_timer_reinit 59 | // устанавливает делитель таймера на :16 вместо :256 60 | void ICACHE_FLASH_ATTR system_timer_reinit(void) 61 | { 62 | timer2_ms_flag = 1; 63 | TIMER1_CTRL = 0x84; 64 | } 65 | */ 66 | -------------------------------------------------------------------------------- /app/sdklib/system/os_printf.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: os_printf.c 3 | * Description: Alternate SDK (libmain.a) 4 | * (c) PV` 2015 5 | *******************************************************************************/ 6 | #include "bios.h" 7 | #include 8 | #include "sdk/rom2ram.h" 9 | #include "sdk/os_printf.h" 10 | 11 | extern char * _sprintf_buf; // 0x3FFFE360 12 | extern char print_mem_buf[1024]; // 0x3FFFE364..0x3FFFEA80 max 1820 bytes 13 | extern bool system_get_os_print(void); 14 | //============================================================================= 15 | // FLASH code (ICACHE_FLASH_ATTR) 16 | //============================================================================= 17 | //============================================================================= 18 | // int os_printf_plus(const char *format, ...) 19 | // Использует буфер в области RAM-BIOS 20 | //----------------------------------------------------------------------------- 21 | int __wrap_os_printf_plus(const char *format, ...) 22 | //int ICACHE_FLASH_ATTR rom_printf(const char *format, ...) 23 | { 24 | int i = 0; 25 | if(system_get_os_print()) { 26 | va_list args; 27 | va_start(args, format); 28 | i = ets_vprintf(ets_write_char, ((uint32)format >> 30)? rom_strcpy(print_mem_buf, (void *)format, sizeof(print_mem_buf)-1) : format, args); 29 | va_end (args); 30 | } 31 | return i; 32 | } 33 | 34 | //============================================================================= 35 | // int os_sprintf_plus(char *str, const char *format, ...) 36 | // Использует буфер в области RAM-BIOS 37 | // Вывод может быть расположен в IRAM 38 | //----------------------------------------------------------------------------- 39 | void _sprintf_out(char c) 40 | { 41 | if(_sprintf_buf != NULL) { 42 | write_align4_chr(_sprintf_buf++, c); // *_sprintf_buf++ = c; 43 | write_align4_chr(_sprintf_buf, 0); // *_sprintf_buf = 0; 44 | } 45 | } 46 | 47 | int ets_sprintf(char *str, const char *format, ...) 48 | { 49 | _sprintf_buf = str; 50 | va_list args; 51 | va_start(args, format); 52 | int i = ets_vprintf(_sprintf_out, ((uint32)format >> 30)? rom_strcpy(print_mem_buf, (void *)format, sizeof(print_mem_buf)-1) : format, args); 53 | va_end (args); 54 | return i; 55 | } 56 | -------------------------------------------------------------------------------- /app/sdklib/wpa/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libaddwpa.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | PDIR := ../$(PDIR) 40 | sinclude $(PDIR)Makefile 41 | 42 | -------------------------------------------------------------------------------- /app/sdklib/wpa/os_xtensa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FileName: os_xtenca.c 3 | * Description: Alternate SDK (libwpa.a) 4 | * (c) PV` 2015 5 | */ 6 | 7 | #include "user_config.h" 8 | #include "bios.h" 9 | 10 | /* 11 | char * ICACHE_FLASH_ATTR ets_strdup(char * s) 12 | { 13 | char * pret = (0); 14 | if(s != (0)) { 15 | uint32 len = ets_strlen(s) + 1; 16 | pret = (char *)os_malloc(len); 17 | if(pret != (0)) ets_memcpy(pret, s, len); 18 | } 19 | return pret; 20 | } 21 | */ 22 | 23 | uint32 ICACHE_FLASH_ATTR os_get_time(void) 24 | { 25 | return 0; 26 | } 27 | 28 | extern uint32 phy_get_rand(void); // return *((uint32 *)(&g_phyFuns+0x290)) ^ *((uint32 *)0x3FF20E44); 29 | 30 | uint32 ICACHE_FLASH_ATTR r_rand(void) 31 | { 32 | return phy_get_rand(); 33 | } 34 | 35 | uint32 ICACHE_FLASH_ATTR os_random(void) 36 | { 37 | return phy_get_rand(); 38 | } 39 | 40 | /* os_get_random - Get cryptographically strong pseudo random data : 41 | * Buffer for pseudo random data : 42 | * Length of the buffer Returns: 43 | * 0 on success, -1 on failure */ 44 | int ICACHE_FLASH_ATTR os_get_random(unsigned char * buf, size_t len) 45 | { 46 | if(buf != NULL) { 47 | while(len) { 48 | uint32 z = phy_get_rand(); 49 | do { 50 | *buf++ = (char)z; 51 | z >>= 8; 52 | } while(--len & 3); 53 | } 54 | } 55 | return 0; 56 | } 57 | 58 | /* 59 | Name: strrchr 60 | Prototype: char * strrchr (const char *string, int c) 61 | Description: 62 | The function strrchr is like strchr, except that it searches backwards 63 | from the end of the string string (instead of forwards from the 64 | front). 65 | For example, 66 | strrchr ("hello, world", 'l') 67 | "ld" */ 68 | char * ICACHE_FLASH_ATTR ets_strrchr(const char *string, int c) 69 | { 70 | char * pret = NULL; 71 | if(string != NULL) { 72 | char ch; 73 | do { 74 | ch = *string; 75 | if(ch == c) pret = (char *)string; 76 | string ++; 77 | } while(ch != 0); 78 | } 79 | return pret; 80 | } 81 | -------------------------------------------------------------------------------- /app/sdklib/wpa/wpa_debug.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FileName: wpa_debug.c 3 | * Description: Alternate SDK (libwpa.a) 4 | * (c) PV` 2015 5 | */ 6 | #include "user_config.h" 7 | #include "bios.h" 8 | 9 | unsigned int ICACHE_FLASH_ATTR eloop_cancel_timeout(void) 10 | { 11 | return 0; 12 | } 13 | 14 | unsigned int ICACHE_FLASH_ATTR eloop_register_timeout(void) 15 | { 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /app/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | #INCLUDES := $(INCLUDES) -I $(PDIR)include 40 | INCLUDES += -I ./include 41 | PDIR := ../$(PDIR) 42 | sinclude $(PDIR)Makefile 43 | 44 | -------------------------------------------------------------------------------- /app/user/include/crc.h: -------------------------------------------------------------------------------- 1 | // CRC16-MODBUS 2 | #include "c_types.h" 3 | 4 | uint16_t ICACHE_FLASH_ATTR crc_modbus(uint8 *input_str, size_t num_bytes); 5 | -------------------------------------------------------------------------------- /app/web/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libweb.a 16 | endif 17 | 18 | ############################################################# 19 | # Configuration i.e. compile options etc. 20 | # Target specific stuff (defines etc.) goes in here! 21 | # Generally values applying to a tree are captured in the 22 | # makefile at its root level - these are then overridden 23 | # for a subtree within the makefile rooted therein 24 | # 25 | #DEFINES += 26 | 27 | ############################################################# 28 | # Recursion Magic - Don't touch this!! 29 | # 30 | # Each subtree potentially has an include directory 31 | # corresponding to the common APIs applicable to modules 32 | # rooted at that subtree. Accordingly, the INCLUDE PATH 33 | # of a module can only contain the include directories up 34 | # its parent path, and not its siblings 35 | # 36 | # Required for each makefile to inherit from the parent 37 | # 38 | 39 | #INCLUDES := $(INCLUDES) -I $(PDIR)include 40 | INCLUDES += -I ./include 41 | PDIR := ../$(PDIR) 42 | sinclude $(PDIR)Makefile 43 | 44 | -------------------------------------------------------------------------------- /app/web/include/web_srv_int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: web_srv_int.h 3 | * Description: The web server configration. 4 | * Small WEB server ESP8266EX 5 | * 6 | * Author: PV` 12/2014 7 | */ 8 | 9 | #ifndef _INCLUDE_WEB_SRV_INT_H_ 10 | #define _INCLUDE_WEB_SRV_INT_H_ 11 | 12 | #include "web_srv.h" 13 | 14 | #define WEB_NAME_VERSION "PVs/0.1" 15 | 16 | // #define WEBSOCKET_ENA 1 17 | 18 | // lifetime (sec) of static responses as string 60*60*24*14=1209600" 19 | #define FILE_CACHE_MAX_AGE_SEC 3600 // время для кеша файлов, ставить 0 пока тест! 20 | 21 | #define MAX_HTTP_HEAD_BUF 3070 // максимальный размер HTTP запроса (GET) 22 | 23 | #define RESCHKS_SEND_SIZE 16 24 | #define RESCHKE_SEND_SIZE 8 25 | #define RESCHK_SEND_SIZE (RESCHKS_SEND_SIZE + RESCHKE_SEND_SIZE) 26 | 27 | #define MIN_SEND_SIZE (256 + RESCHK_SEND_SIZE) // минимальный размер буфера для передачи файла 28 | #define MAX_SEND_SIZE ((TCP_MSS*4) + RESCHK_SEND_SIZE) // максимальный размер буфера для передачи 4*MSS = 5840 (MSS=1460) 29 | 30 | #define HTTP_SEND_SIZE 384 // минимальный размер буфера для передачи заголовка HTTP 31 | #define SCB_SEND_SIZE 128 // минимальный резерв в буфере для callback 32 | 33 | #define webfile bffiles[0] // File pointer for main file 34 | 35 | //----------------------------------------------------------------------------- 36 | 37 | void web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *pvar) ICACHE_FLASH_ATTR; 38 | void web_int_cookie(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR; 39 | void web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) ICACHE_FLASH_ATTR; 40 | 41 | void web_hexdump(TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR; 42 | bool web_inc_fopen(TCP_SERV_CONN *ts_conn, uint8 *cFile) ICACHE_FLASH_ATTR; 43 | bool web_inc_fclose(WEB_SRV_CONN *web_conn) ICACHE_FLASH_ATTR; 44 | 45 | bool web_trim_bufi(TCP_SERV_CONN *ts_conn, uint8 *pdata, uint32 data_len) ICACHE_FLASH_ATTR; 46 | bool web_feee_bufi(TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR; 47 | //uint8 * head_find_ctr(HTTP_CONN *CurHTTP, const uint8 * c, int clen, int dlen) ICACHE_FLASH_ATTR; 48 | 49 | #endif /* _INCLUDE_WEB_SRV_INT_H_ */ 50 | -------------------------------------------------------------------------------- /app/web/localtime.c: -------------------------------------------------------------------------------- 1 | 2 | #include "user_config.h" 3 | #ifndef BUILD_FOR_OTA_512k 4 | #include "bios.h" 5 | #include "hw/esp8266.h" 6 | #include "localtime.h" 7 | 8 | ///////////////////////////////////////////////////////////////////////////////// 9 | 10 | #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) 11 | 12 | static const int mon_lengths[2][12] = { 13 | {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, 14 | {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} 15 | } ; 16 | 17 | static const int year_lengths[2] = { 18 | 365, 19 | 366 20 | } ; 21 | 22 | void ICACHE_FLASH_ATTR _localtime(time_t * tim_p, struct tm * res) 23 | { 24 | long days, rem; 25 | time_t lcltime; 26 | // int i; 27 | int y; 28 | int yleap; 29 | const int *ip; 30 | 31 | /* base decision about std/dst time on current time */ 32 | lcltime = *tim_p; 33 | 34 | days = lcltime / SECSPERDAY; 35 | rem = lcltime % SECSPERDAY; 36 | while (rem < 0) 37 | { 38 | rem += SECSPERDAY; 39 | --days; 40 | } 41 | while (rem >= SECSPERDAY) 42 | { 43 | rem -= SECSPERDAY; 44 | ++days; 45 | } 46 | 47 | /* compute hour, min, and sec */ 48 | (*res).tm_hour = (rem / SECSPERHOUR); 49 | rem %= SECSPERHOUR; 50 | res->tm_min = (rem / SECSPERMIN); 51 | res->tm_sec = (rem % SECSPERMIN); 52 | 53 | /* compute day of week */ 54 | if ((res->tm_wday = ((EPOCH_WDAY + days) % DAYSPERWEEK)) < 0) 55 | res->tm_wday += DAYSPERWEEK; 56 | 57 | /* compute year & day of year */ 58 | y = EPOCH_YEAR; 59 | if (days >= 0) 60 | { 61 | for (;;) 62 | { 63 | yleap = isleap(y); 64 | if (days < year_lengths[yleap]) 65 | break; 66 | y++; 67 | days -= year_lengths[yleap]; 68 | } 69 | } 70 | else 71 | { 72 | do 73 | { 74 | --y; 75 | yleap = isleap(y); 76 | days += year_lengths[yleap]; 77 | } while (days < 0); 78 | } 79 | 80 | res->tm_year = y - YEAR_BASE; 81 | res->tm_yday = days; 82 | ip = mon_lengths[yleap]; 83 | for (res->tm_mon = 0; days >= ip[res->tm_mon]; ++res->tm_mon) 84 | days -= ip[res->tm_mon]; 85 | res->tm_mday = days + 1; 86 | 87 | res->tm_isdst = 0; 88 | return; 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /app/web/overlay.c: -------------------------------------------------------------------------------- 1 | /* 2 | * overlay.c 3 | * 4 | * Created on: 01/02/2016 5 | * Author: PVV 6 | */ 7 | #include "user_config.h" 8 | #ifdef USE_OVERLAY 9 | #include "bios.h" 10 | #include "hw/esp8266.h" 11 | #include "webfs.h" 12 | #include "sdk/rom2ram.h" 13 | #include "overlay.h" 14 | //#include "web_srv_int.h" 15 | 16 | #define mMIN(a, b) ((a= IRAM_BASE && ovl_call != NULL) { 33 | ovl_call(0); // close прошлый оверлей 34 | ovl_call = NULL; 35 | } 36 | while(fhead.head.number_segs) { 37 | fhead.head.number_segs--; 38 | if(WEBFSGetArray(ffile, (uint8*)&fseg, sizeof(fseg)) == sizeof(fseg) 39 | && fseg.segment_size != 0 40 | ) { 41 | os_printf("ld:%p[%d] ", fseg.memory_offset, fseg.segment_size); 42 | while(fseg.segment_size) { 43 | len = mMIN(fseg.segment_size, sizeof(rambuf)); 44 | if(WEBFSGetArray(ffile, rambuf, len) != len) { 45 | ret = -1; // ошибка 46 | WEBFSClose(ffile); 47 | return ret; 48 | } 49 | copy_s1d4((void *)fseg.memory_offset, rambuf, len); 50 | fseg.memory_offset += len; 51 | fseg.segment_size -= len; 52 | } 53 | } 54 | } 55 | if(fhead.entry_point >= IRAM_BASE) { 56 | os_printf("run:%p ", fhead.entry_point); 57 | ovl_call = (tovl_call *)fhead.entry_point; 58 | ret = 0; 59 | } 60 | else ret = 1; 61 | } 62 | else ret = -1; 63 | WEBFSClose(ffile); 64 | } 65 | return ret; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /app/web/sys_const.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: sys_const.c 3 | * Description: read/write sdk_sys_cont (esp_init_data_default.bin) 4 | * Author: PV` 5 | * ver1.1 02/04/2015 SDK 1.0.1 6 | *******************************************************************************/ 7 | #include "user_config.h" 8 | #ifndef BUILD_FOR_OTA_512k 9 | #include "ets_sys.h" 10 | #include "os_type.h" 11 | #include "osapi.h" 12 | #include "sdk/rom2ram.h" 13 | #include "sdk/flash.h" 14 | #include "sys_const_utils.h" 15 | #include "sdk/mem_manager.h" 16 | 17 | uint8 * ICACHE_FLASH_ATTR rd_buf_sec_blk(uint32 faddr, uint32 size) 18 | { 19 | uint8 * pbuf = NULL; 20 | pbuf = os_malloc(size); 21 | #ifdef FIX_SDK_FLASH_SIZE 22 | if(pbuf != NULL) copy_s4d1(pbuf, (void *)(faddr + FLASH_BASE), size ); 23 | #else 24 | if(pbuf != NULL) { 25 | if(spi_flash_read(faddr, pbuf, size)) != SPI_FLASH_RESULT_OK) { 26 | os_free(pbuf); 27 | pbuf = NULL; 28 | } 29 | } 30 | #endif 31 | return pbuf; 32 | } 33 | 34 | bool ICACHE_FLASH_ATTR wr_buf_sec_blk(uint32 faddr, uint32 size, uint8 *buf) 35 | { 36 | bool ret = false; 37 | if((spi_flash_erase_sector((uint32)(faddr >> 12)) == SPI_FLASH_RESULT_OK) 38 | &&(spi_flash_write(faddr, (uint32 *)buf, size) == SPI_FLASH_RESULT_OK)) { 39 | ret = true; 40 | } 41 | os_free(buf); 42 | return ret; 43 | } 44 | 45 | uint8 ICACHE_FLASH_ATTR read_sys_const(uint8 idx) { 46 | #ifdef FIX_SDK_FLASH_SIZE 47 | return get_sys_const(idx); 48 | #else 49 | uint8 ret = 0xff; 50 | if (idx < MAX_IDX_SYS_CONST) 51 | spi_flash_read(faddr_esp_init_data_default + idx, (uint32 *)&ret, 1); 52 | return ret; 53 | #endif 54 | } 55 | 56 | bool ICACHE_FLASH_ATTR write_sys_const(uint8 idx, uint8 data) { 57 | if (idx >= MAX_IDX_SYS_CONST) 58 | return false; 59 | uint32 faddr = faddr_esp_init_data_default; 60 | if (get_sys_const(idx) != data) { 61 | uint8 * buf = rd_buf_sec_blk(faddr, SIZE_SAVE_SYS_CONST); 62 | if(buf != NULL) { 63 | buf[idx] = data; 64 | return wr_buf_sec_blk(faddr, SIZE_SAVE_SYS_CONST, buf); 65 | } 66 | } 67 | else return true; 68 | return false; 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /asm_damp.bat: -------------------------------------------------------------------------------- 1 | @if exist .\app\.output\eagle\image\eagle.app.v6.out C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-objdump -S -s .\app\.output\eagle\image\eagle.app.v6.out > eagle.app.v6.asm 2 | @if exist .\AutoMake\esp8266web.elf C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-objdump -S .\AutoMake\esp8266web.elf > esp8266web.asm 3 | 4 | 5 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | 0.bin 2 | -------------------------------------------------------------------------------- /bin/0x00000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/0x00000.bin -------------------------------------------------------------------------------- /bin/0x07000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/0x07000.bin -------------------------------------------------------------------------------- /bin/blank.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/blank.bin -------------------------------------------------------------------------------- /bin/clear_eep.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/clear_eep.bin -------------------------------------------------------------------------------- /bin/esp_init_data_default.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/esp_init_data_default.bin -------------------------------------------------------------------------------- /bin/firmware.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/firmware.bin -------------------------------------------------------------------------------- /bin/firmware_512k_2step_ota.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/firmware_512k_2step_ota.bin -------------------------------------------------------------------------------- /bin/firmware_sdk154.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/firmware_sdk154.bin -------------------------------------------------------------------------------- /bin/firmware_with_MCP2120.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/firmware_with_MCP2120.bin -------------------------------------------------------------------------------- /bin/make_firmware_image.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # ESP8266 make firmware image 4 | # 5 | # Arguments: dir of *.bin 6 | # 7 | # (c) vad7 8 | 9 | import argparse 10 | import os 11 | 12 | argp = argparse.ArgumentParser() 13 | argp.add_argument('flashsize', action='store', help='Flash size, kb') 14 | argp.add_argument('dir', action='store', help='Directory of *.bin') 15 | args = argp.parse_args() 16 | fout_name = args.dir + "firmware.bin" 17 | fout = open(fout_name, "wb") 18 | fin = open(args.dir + "0x00000.bin", "rb") 19 | data = fin.read() 20 | fin.close() 21 | data += b"\xFF" * (0x7000 - len(data)) 22 | fin = open(args.dir + "0x07000.bin", "rb") 23 | data2 = fin.read() 24 | fin.close() 25 | data = data + data2 26 | fout.write(data) 27 | fout.flush() 28 | size = os.fstat(fout.fileno()).st_size 29 | fout.close() 30 | print "Make: " + fout_name 31 | ota2stepmax = 286720 32 | if int(args.flashsize) == 512: 33 | webfs = (size + 0xFFF) & 0xFF000 34 | maxota = 0x7B000 - webfs 35 | ota2step1 = " (2 step: " + str(ota2stepmax) + ")" 36 | ota2step2 = " (2 step: " + str(ota2stepmax - size) + ")" 37 | else: 38 | webfs = 0x80000 39 | maxota = 0x7B000 40 | ota2step1 = "" 41 | ota2step2 = "" 42 | print "Firmware size: " + str(size) + ", WebFS addr: " + str(webfs) + ", Max OTA size: " + str(maxota) + ota2step1 43 | print "Space available for OTA: " + str(maxota - size) + ota2step2 44 | -------------------------------------------------------------------------------- /bin/rapid_loader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/rapid_loader.bin -------------------------------------------------------------------------------- /bin/rapid_loader_40m.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/rapid_loader_40m.bin -------------------------------------------------------------------------------- /bin/rapid_loader_40m_512.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/rapid_loader_40m_512.bin -------------------------------------------------------------------------------- /bin/rapid_loader_512.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/bin/rapid_loader_512.bin -------------------------------------------------------------------------------- /bin/readme.txt: -------------------------------------------------------------------------------- 1 | Addr - file name - Info 2 | -------------------------------------------------------- 3 | 0x00000 - bin/0x00000.bin - Program codes IRAM/RAM 4 | 0x07000 - bin/0x07000.bin - Program codes Cache Flash 5 | 0x79000 - bin/clear_eep.bin - Clear settings EEP area 6 | 0x7C000 - bin/esp_init_data_default.bin - RF SDK options 7 | 0x7E000 - bin/blank.bin - Default SDK WiFi config 8 | 9 | bin/rapid_loader.bin - loader FlashSPI CLK x2 (80MHz) 10 | bin/rapid_loader_m40.bin - loader FlashSPI CLK x1 (40MHz) 11 | 12 | If Flash > 512 kbytes: 13 | 0x80000 - webbin/WEBFiles.bin 14 | Use PVFS2.exe or http://192.168.4.1/fsupload. 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /esp8266_irda_bug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/esp8266_irda_bug.jpg -------------------------------------------------------------------------------- /include/arch/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __PERF_H__ 35 | #define __PERF_H__ 36 | 37 | #define PERF_START /* null definition */ 38 | #define PERF_STOP(x) /* null definition */ 39 | 40 | #endif /* __PERF_H__ */ 41 | -------------------------------------------------------------------------------- /include/arch/sys_arch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/include/arch/sys_arch.h -------------------------------------------------------------------------------- /include/bios.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: bios.h 3 | * Description: funcs in ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #ifndef _INCLUDE_BIOS_H_ 9 | #define _INCLUDE_BIOS_H_ 10 | #include "bios/spiflash.h" 11 | #include "bios/cha1.h" 12 | #include "bios/ets.h" 13 | #include "bios/gpio.h" 14 | #include "bios/uart.h" 15 | #include "bios/vectors.h" 16 | #include "bios/xthal.h" 17 | #include "bios/xtos.h" 18 | #include "bios/rtc_dtm.h" 19 | #include "bios/add_funcs.h" 20 | 21 | #endif // _INCLUDE_BIOS_H_ 22 | -------------------------------------------------------------------------------- /include/bios/add_funcs.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: add_funcs.h 3 | * Description: Do not sorted functions ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #ifndef _INCLUDE_BIOS_ADD_FUNCS_H_ 9 | #define _INCLUDE_BIOS_ADD_FUNCS_H_ 10 | 11 | int rom_get_power_db(void); 12 | void rom_en_pwdet(int); 13 | void rom_i2c_writeReg(uint32 block, uint32 host_id, uint32 reg_add, uint32 data); 14 | void rom_i2c_writeReg_Mask(uint32 block, uint32 host_id, uint32 reg_add, uint32 Msb, uint32 Lsb, uint32 indata); 15 | uint8 rom_i2c_readReg_Mask(uint32 block, uint32 host_id, uint32 reg_add, uint32 Msb, uint32 Lsb); 16 | uint8 rom_i2c_readReg(uint32 block, uint32 host_id, uint32 reg_add); 17 | 18 | 19 | #endif /* _INCLUDE_BIOS_ADD_FUNCS_H_ */ 20 | -------------------------------------------------------------------------------- /include/bios/mem.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: mem.h 3 | * Description: mem funcs in ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #ifndef _BIOS_MEM_H_ 9 | #define _BIOS_MEM_H_ 10 | 11 | #include "c_types.h" 12 | /* WARNING !!! mem_xxx use size < 4096 !!! */ 13 | extern void mem_init(void * start_addr); // uint8 * 14 | extern void * mem_malloc(uint16 size); // size < 4096 15 | extern void * mem_calloc(uint16 n, uint16 count); // n*count < 4096 16 | extern void * mem_zalloc(uint16 size); // size < 4096, = mem_calloc(1, size); 17 | extern void * mem_realloc(void * p, uint16 size); 18 | extern void * mem_trim(void * p, uint16 size); 19 | extern void mem_free(uint8 * x); 20 | 21 | /* 22 | PROVIDE ( mem_calloc = 0x40001c2c ); 23 | PROVIDE ( mem_free = 0x400019e0 ); 24 | PROVIDE ( mem_init = 0x40001998 ); 25 | PROVIDE ( mem_malloc = 0x40001b40 ); 26 | PROVIDE ( mem_realloc = 0x40001c6c ); 27 | PROVIDE ( mem_trim = 0x40001a14 ); 28 | PROVIDE ( mem_zalloc = 0x40001c58 ); 29 | */ 30 | #endif /* _BIOS_MEM_H_ */ 31 | -------------------------------------------------------------------------------- /include/bios/rtc_dtm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: gpio_bios.h 3 | * Description: rtc & dtm funcs in ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #ifndef _BIOS_RTC_DTM_H_ 9 | #define _BIOS_RTC_DTM_H_ 10 | 11 | #include "c_types.h" 12 | 13 | /* 14 | PROVIDE ( ets_rtc_int_register = 0x40002a40 ); 15 | PROVIDE ( ets_enter_sleep = 0x400027b8 ); 16 | PROVIDE ( rtc_enter_sleep = 0x40002870 ); 17 | PROVIDE ( rtc_get_reset_reason = 0x400025e0 ); 18 | PROVIDE ( rtc_intr_handler = 0x400029ec ); 19 | PROVIDE ( rtc_set_sleep_mode = 0x40002668 ); 20 | PROVIDE ( dtm_get_intr_mask = 0x400026d0 ); 21 | PROVIDE ( dtm_params_init = 0x4000269c ); 22 | PROVIDE ( dtm_set_intr_mask = 0x400026c8 ); 23 | PROVIDE ( dtm_set_params = 0x400026dc ); 24 | PROVIDE ( software_reset = 0x4000264c ); 25 | PROVIDE ( save_rxbcn_mactime = 0x400027a4 ); 26 | PROVIDE ( save_tsf_us = 0x400027ac ); 27 | */ 28 | 29 | struct sdtm_params // RAM_BIOS:3FFFDD64 30 | { 31 | ETSTimer timer;//+0x00..0x14 32 | uint32 dtm_14;//+0x14 // a6 dtm_set_params 33 | uint32 rxbcn_mactime;//+0x18 34 | uint32 tsf_us;//+0x1C 35 | uint32 sleep_time;//+0x20 time 36 | uint32 timer_us;//+0x24 37 | uint32 time_ms;//+0x28 38 | uint32 dtm_2C;//+0x2C // a4 dtm_set_params 39 | uint32 mode;//+0x30 40 | uint32 cycles;//+0x34 timer cycles 41 | uint32 intr_mask;//+0x38 42 | uint32 sleep_func;//+0x3C 43 | uint32 int_func;//+0x40 44 | uint32 dtm_44;//+0x44 45 | }; 46 | 47 | // RAM_BIOS:3FFFDD64 48 | extern struct sdtm_params dtm_params; // 64 bytes 49 | // RAM_BIOS:3FFFC700 50 | extern uint32 rtc_claib; // ~ = 0x7073 51 | /* software_reset: Not work for any mode! */ 52 | void software_reset(void); 53 | void rtc_set_sleep_mode(uint32 a, uint32 t, uint32 m); 54 | /*rtc_reset_reason: =1 - ch_pd, =2 - reset, =4 - Wdt Reset ... > 7 unknown reset */ 55 | uint32 rtc_get_reset_reason(void); 56 | void save_rxbcn_mactime(uint32 t); 57 | void save_tsf_us(uint32 us); 58 | void dtm_set_intr_mask(uint32 mask); 59 | uint32 dtm_get_intr_mask(void); 60 | void dtm_params_init(void * sleep_func, void * int_func); 61 | void dtm_set_params(int mode, int time_ms_a3, int a4, int cycles, int a6); 62 | void rtc_intr_handler(void); 63 | void rtc_enter_sleep(void); 64 | void ets_rtc_int_register(void); 65 | /* { ets_set_idle_cb(rtc_enter_sleep, 0); } */ 66 | void ets_enter_sleep(void); 67 | 68 | #endif /* _BIOS_RTC_DTM_H_ */ 69 | -------------------------------------------------------------------------------- /include/bios/vectors.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: Vectors.h 3 | * Description: Vectors funcs in ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | 9 | #ifndef _INCLUDE_BIOS_VECTORS_H_ 10 | #define _INCLUDE_BIOS_VECTORS_H_ 11 | 12 | /* 13 | PROVIDE ( _DebugExceptionVector = 0x40000010 ); 14 | PROVIDE ( _NMIExceptionVector = 0x40000020 ); 15 | PROVIDE ( _KernelExceptionVector = 0x40000030 ); 16 | PROVIDE ( _UserExceptionVector = 0x40000050 ); 17 | PROVIDE ( _DoubleExceptionVector = 0x40000070 ); 18 | #PROVIDE ( _ResetVector = 0x40000080 ); 19 | PROVIDE ( _ResetHandler = 0x400000a4 ); 20 | */ 21 | 22 | void _ResetVector(void); 23 | 24 | #endif /* _INCLUDE_BIOS_VECTORS_H_ */ 25 | -------------------------------------------------------------------------------- /include/bios/xthal.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: xthal_bios.h 3 | * Description: HAL funcs in ROM-BIOS 4 | * Alternate SDK 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #ifndef _INCLUDE_BIOS_XTAL_H_ 9 | #define _INCLUDE_BIOS_XTAL_H_ 10 | 11 | #ifndef XTENSA_HAL_H // xtensa-lx106-elf/include/xtensa/hal.h 12 | 13 | // Instruction/Data RAM/ROM Access 14 | extern void* xthal_memcpy(void *dst, const void *src, unsigned len); 15 | extern void* xthal_bcopy(const void *src, void *dst, unsigned len); 16 | 17 | /* set and get CCOMPAREn registers (if not present, get returns 0) */ 18 | extern void xthal_set_ccompare(int x, unsigned r); // { if(x) return; wsr.ccompare0 = r } 19 | extern unsigned xthal_get_ccompare(int x); // { if(x) return 0; else return rsr.ccompare0 } 20 | 21 | /* get CCOUNT register (if not present return 0) */ 22 | extern unsigned xthal_get_ccount(void); // { return rsr.ccount} 23 | 24 | /* INTENABLE,INTERRUPT,INTSET,INTCLEAR register access functions: */ 25 | extern unsigned xthal_get_interrupt( void ); // { return rsr.interrupt } 26 | #define xthal_get_intread xthal_get_interrupt /* backward compatibility */ 27 | extern void xthal_set_intclear( unsigned ); // { return wsr.intclear } 28 | 29 | // Register Windows 30 | /* This spill any live register windows (other than the caller's): 31 | * (NOTE: current implementation require privileged code, but 32 | * a user-callable implementation is possible.) */ 33 | extern void xthal_window_spill( void ); // { return; } 34 | extern void xthal_window_spill_nw( void ); // { return 0; } 35 | 36 | extern unsigned xthal_spill_registers_into_stack_nw(void); // { return 0; } 37 | 38 | 39 | /* eagle.rom.addr.v6.ld 40 | PROVIDE ( xthal_bcopy = 0x40000688 ); 41 | -PROVIDE ( xthal_copy123 = 0x4000074c ); 42 | PROVIDE ( xthal_get_ccompare = 0x4000dd4c ); 43 | PROVIDE ( xthal_get_ccount = 0x4000dd38 ); 44 | PROVIDE ( xthal_get_interrupt = 0x4000dd58 ); 45 | PROVIDE ( xthal_get_intread = 0x4000dd58 ); 46 | PROVIDE ( xthal_memcpy = 0x400006c4 ); 47 | PROVIDE ( xthal_set_ccompare = 0x4000dd40 ); 48 | PROVIDE ( xthal_set_intclear = 0x4000dd60 ); 49 | PROVIDE ( xthal_spill_registers_into_stack_nw = 0x4000e320 ); 50 | PROVIDE ( xthal_window_spill = 0x4000e324 ); 51 | PROVIDE ( xthal_window_spill_nw = 0x4000e320 ); 52 | */ 53 | 54 | #endif /* XTENSA_HAL_H */ 55 | #endif /* _INCLUDE_BIOS_XTAL_H_ */ 56 | -------------------------------------------------------------------------------- /include/hw/sdio_slv.h: -------------------------------------------------------------------------------- 1 | #ifndef SDIO_SLAVE_H 2 | #define SDIO_SLAVE_H 3 | #include "hw/slc_register.h" 4 | #include "c_types.h" 5 | #include "user_interface.h" 6 | struct sdio_queue 7 | { 8 | uint32 blocksize:12; 9 | uint32 datalen:12; 10 | uint32 unused:5; 11 | uint32 sub_sof:1; 12 | uint32 eof:1; 13 | uint32 owner:1; 14 | 15 | uint32 buf_ptr; 16 | uint32 next_link_ptr; 17 | }; 18 | 19 | struct sdio_slave_status_element 20 | { 21 | uint32 wr_busy:1; 22 | uint32 rd_empty :1; 23 | uint32 comm_cnt :3; 24 | uint32 intr_no :3; 25 | uint32 rx_length:16; 26 | uint32 res:8; 27 | }; 28 | 29 | union sdio_slave_status 30 | { 31 | struct sdio_slave_status_element elm_value; 32 | uint32 word_value; 33 | }; 34 | 35 | #define RX_AVAILIBLE 2 36 | #define TX_AVAILIBLE 1 37 | #define INIT_STAGE 0 38 | 39 | #define SDIO_QUEUE_LEN 8 40 | #define MOSI 0 41 | #define MISO 1 42 | #define SDIO_DATA_ERROR 6 43 | 44 | #define SLC_INTEREST_EVENT (SLC_TX_EOF_INT_ENA | SLC_RX_EOF_INT_ENA | SLC_RX_UDF_INT_ENA | SLC_TX_DSCR_ERR_INT_ENA) 45 | #define TRIG_TOHOST_INT() SET_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0);\ 46 | CLEAR_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0) 47 | 48 | /* 49 | void sdio_slave_init(void); 50 | void sdio_slave_isr(void *para); 51 | void sdio_task_init(void); 52 | void sdio_err_task(os_event_t *e); 53 | void rx_buff_load_done(uint16 rx_len); 54 | void tx_buff_handle_done(void); 55 | void rx_buff_read_done(void); 56 | void tx_buff_write_done(void); 57 | */ 58 | #endif 59 | -------------------------------------------------------------------------------- /include/hw/specreg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Xtensa Special Register symbolic names 3 | */ 4 | 5 | #ifndef __SPECREG_H 6 | #define __SPECREG_H 7 | 8 | /* Special registers: */ 9 | #define LBEG 0 10 | #define LEND 1 11 | #define LCOUNT 2 12 | #define SAR 3 13 | #define BR 4 14 | #define LITBASE 5 15 | #define SCOMPARE1 12 16 | #define ACCLO 16 17 | #define ACCHI 17 18 | #define MR_0 32 19 | #define MR_1 33 20 | #define MR_2 34 21 | #define MR_3 35 22 | #define PREFCTL 40 23 | #define WINDOWBASE 72 24 | #define WINDOWSTART 73 25 | #define PTEVADDR 83 26 | #define RASID 90 27 | #define ITLBCFG 91 28 | #define DTLBCFG 92 29 | #define IBREAKENABLE 96 30 | #define CACHEATTR 98 31 | #define DDR 104 32 | #define IBREAKA_0 128 33 | #define IBREAKA_1 129 34 | #define DBREAKA_0 144 35 | #define DBREAKA_1 145 36 | #define DBREAKC_0 160 37 | #define DBREAKC_1 161 38 | #define EPC_1 177 39 | #define EPC_2 178 40 | #define EPC_3 179 41 | #define EPC_4 180 42 | #define EPC_5 181 43 | #define EPC_6 182 44 | #define EPC_7 183 45 | #define DEPC 192 46 | #define EPS_2 194 47 | #define EPS_3 195 48 | #define EPS_4 196 49 | #define EPS_5 197 50 | #define EPS_6 198 51 | #define EPS_7 199 52 | #define EXCSAVE_1 209 53 | #define EXCSAVE_2 210 54 | #define EXCSAVE_3 211 55 | #define EXCSAVE_4 212 56 | #define EXCSAVE_5 213 57 | #define EXCSAVE_6 214 58 | #define EXCSAVE_7 215 59 | #define CPENABLE 224 60 | #define INTERRUPT 226 61 | #define INTREAD INTERRUPT /* alternate name for backward compatibility */ 62 | #define INTSET INTERRUPT /* alternate name for backward compatibility */ 63 | #define INTCLEAR 227 64 | #define INTENABLE 228 65 | #define PS 230 66 | #define VECBASE 231 67 | #define EXCCAUSE 232 68 | #define DEBUGCAUSE 233 69 | #define CCOUNT 234 70 | #define PRID 235 71 | #define ICOUNT 236 72 | #define ICOUNTLEVEL 237 73 | #define EXCVADDR 238 74 | #define CCOMPARE_0 240 75 | #define CCOMPARE_1 241 76 | #define CCOMPARE_2 242 77 | #define MISC_REG_0 244 78 | #define MISC_REG_1 245 79 | #define MISC_REG_2 246 80 | #define MISC_REG_3 247 81 | 82 | /* Special cases (bases of special register series): */ 83 | #define MR 32 84 | #define IBREAKA 128 85 | #define DBREAKA 144 86 | #define DBREAKC 160 87 | #define EPC 176 88 | #define EPS 192 89 | #define EXCSAVE 208 90 | #define CCOMPARE 240 91 | #define MISC_REG 244 92 | 93 | #define __stringify_1(x...) #x 94 | #define __stringify(x...) __stringify_1(x) 95 | #define RSR(sr) ({uint32_t r; asm volatile ("rsr %0,"__stringify(sr) : "=a"(r)); r;}) 96 | 97 | #endif /* __SPECREG_H */ 98 | -------------------------------------------------------------------------------- /include/iot_cloud.h: -------------------------------------------------------------------------------- 1 | 2 | #define DEFAULT_TC_HOST_PORT 80 3 | #define TCP_REQUEST_TIMEOUT 15 // sec 4 | 5 | extern const uint8 iot_get_request_tpl[]; 6 | extern const uint8 key_http_ok[]; 7 | extern uint8 iot_cloud_ini[]; 8 | extern char iot_last_status[]; // last status/error returned by server 9 | extern time_t iot_last_status_time; 10 | extern int iot_tc_init_flg; 11 | 12 | char *iot_server_name; // = NULL; // set from ini: iot_server= 13 | typedef struct _IOT_DATA { 14 | uint32 min_interval; // msec 15 | uint32 last_run; // system_get_time() 16 | struct _IOT_DATA *next; 17 | char iot_request[]; // set from ini: iot_add= 18 | } IOT_DATA; 19 | IOT_DATA *iot_data_first; // = NULL; 20 | IOT_DATA *iot_data_processing; // = NULL; 21 | 22 | -------------------------------------------------------------------------------- /include/ip_addr.h: -------------------------------------------------------------------------------- 1 | #ifndef __IP_ADDR_H__ 2 | #define __IP_ADDR_H__ 3 | 4 | #include "c_types.h" 5 | 6 | struct ip_addr { 7 | uint32 addr; 8 | }; 9 | 10 | typedef struct ip_addr ip_addr_t; 11 | 12 | struct ip_info { 13 | struct ip_addr ip; 14 | struct ip_addr netmask; 15 | struct ip_addr gw; 16 | }; 17 | 18 | #define IP4_ADDR(ipaddr, a,b,c,d) \ 19 | (ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \ 20 | ((uint32)((c) & 0xff) << 16) | \ 21 | ((uint32)((b) & 0xff) << 8) | \ 22 | (uint32)((a) & 0xff) 23 | 24 | /** 25 | * Determine if two address are on the same network. 26 | * 27 | * @arg addr1 IP address 1 28 | * @arg addr2 IP address 2 29 | * @arg mask network identifier mask 30 | * @return !0 if the network identifiers of both address match 31 | */ 32 | #define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \ 33 | (mask)->addr) == \ 34 | ((addr2)->addr & \ 35 | (mask)->addr)) 36 | 37 | /** Set an IP address given by the four byte-parts. 38 | Little-endian version that prevents the use of htonl. */ 39 | #define IP4_ADDR(ipaddr, a,b,c,d) \ 40 | (ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \ 41 | ((uint32)((c) & 0xff) << 16) | \ 42 | ((uint32)((b) & 0xff) << 8) | \ 43 | (uint32)((a) & 0xff) 44 | 45 | #define ip4_addr1(ipaddr) (((uint8*)(ipaddr))[0]) 46 | #define ip4_addr2(ipaddr) (((uint8*)(ipaddr))[1]) 47 | #define ip4_addr3(ipaddr) (((uint8*)(ipaddr))[2]) 48 | #define ip4_addr4(ipaddr) (((uint8*)(ipaddr))[3]) 49 | 50 | #define ip4_addr1_16(ipaddr) ((uint16)ip4_addr1(ipaddr)) 51 | #define ip4_addr2_16(ipaddr) ((uint16)ip4_addr2(ipaddr)) 52 | #define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr)) 53 | #define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr)) 54 | 55 | 56 | /** 255.255.255.255 */ 57 | #define IPADDR_NONE ((uint32)0xffffffffUL) 58 | /** 0.0.0.0 */ 59 | #define IPADDR_ANY ((uint32)0x00000000UL) 60 | uint32 ipaddr_addr(const char *cp); 61 | 62 | #define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \ 63 | ip4_addr2_16(ipaddr), \ 64 | ip4_addr3_16(ipaddr), \ 65 | ip4_addr4_16(ipaddr) 66 | 67 | #define IPSTR "%d.%d.%d.%d" 68 | 69 | #endif /* __IP_ADDR_H__ */ 70 | -------------------------------------------------------------------------------- /include/localtime.h: -------------------------------------------------------------------------------- 1 | 2 | #define SECSPERMIN 60UL 3 | #define MINSPERHOUR 60UL 4 | #define HOURSPERDAY 24UL 5 | #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 6 | #define SECSPERDAY (SECSPERHOUR * HOURSPERDAY) 7 | #define DAYSPERWEEK 7 8 | #define MONSPERYEAR 12 9 | 10 | #define YEAR_BASE 1900 11 | #define EPOCH_YEAR 1970 12 | #define EPOCH_WDAY 4 13 | #define EPOCH_YEARS_SINCE_LEAP 2 14 | #define EPOCH_YEARS_SINCE_CENTURY 70 15 | #define EPOCH_YEARS_SINCE_LEAP_CENTURY 370 16 | 17 | typedef unsigned long time_t; 18 | 19 | #ifndef _TM_DEFINED 20 | /* 21 | * A structure for storing all kinds of useful information about the 22 | * current (or another) time. 23 | */ 24 | struct tm 25 | { 26 | int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */ 27 | int tm_min; /* Minutes: 0-59 */ 28 | int tm_hour; /* Hours since midnight: 0-23 */ 29 | int tm_mday; /* Day of the month: 1-31 */ 30 | int tm_mon; /* Months *since* january: 0-11 */ 31 | int tm_year; /* Years since 1900 */ 32 | int tm_wday; /* Days since Sunday (0-6) */ 33 | int tm_yday; /* Days since Jan. 1: 0-365 */ 34 | int tm_isdst; /* +1 Daylight Savings Time, 0 No DST, 35 | * -1 don't know */ 36 | }; 37 | #define _TM_DEFINED 38 | #endif 39 | -------------------------------------------------------------------------------- /include/lwip/app/espconn_tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __ESPCONN_TCP_H__ 2 | #define __ESPCONN_TCP_H__ 3 | #include "lwipopts.h" 4 | #ifdef USE_ESPCONN 5 | 6 | #ifndef ESPCONN_TCP_DEBUG 7 | #define ESPCONN_TCP_DEBUG LWIP_DBG_OFF 8 | #endif 9 | #include "lwip/app/espconn.h" 10 | 11 | #ifndef ESPCONN_TCP_TIMER 12 | #define ESPCONN_TCP_TIMER 40 13 | #endif 14 | 15 | #define espconn_keepalive_enable(pcb) ((pcb)->so_options |= SOF_KEEPALIVE) 16 | #define espconn_keepalive_disable(pcb) ((pcb)->so_options &= ~SOF_KEEPALIVE) 17 | 18 | /****************************************************************************** 19 | * FunctionName : espconn_kill_oldest_pcb 20 | * Description : A oldest incoming connection has been killed. 21 | * Parameters : none 22 | * Returns : none 23 | *******************************************************************************/ 24 | 25 | extern void espconn_kill_oldest_pcb(void); 26 | 27 | /****************************************************************************** 28 | * FunctionName : espconn_tcp_disconnect 29 | * Description : A new incoming connection has been disconnected. 30 | * Parameters : espconn -- the espconn used to disconnect with host 31 | * Returns : none 32 | *******************************************************************************/ 33 | 34 | extern void espconn_tcp_disconnect(espconn_msg *pdiscon); 35 | 36 | /****************************************************************************** 37 | * FunctionName : espconn_tcp_client 38 | * Description : Initialize the client: set up a connect PCB and bind it to 39 | * the defined port 40 | * Parameters : espconn -- the espconn used to build client 41 | * Returns : none 42 | *******************************************************************************/ 43 | 44 | extern sint8 espconn_tcp_client(struct espconn* espconn); 45 | 46 | /****************************************************************************** 47 | * FunctionName : espconn_tcp_server 48 | * Description : Initialize the server: set up a listening PCB and bind it to 49 | * the defined port 50 | * Parameters : espconn -- the espconn used to build server 51 | * Returns : none 52 | *******************************************************************************/ 53 | 54 | extern sint8 espconn_tcp_server(struct espconn *espconn); 55 | 56 | #endif // USE_ESPCONN 57 | 58 | #endif /* __CLIENT_TCP_H__ */ 59 | 60 | -------------------------------------------------------------------------------- /include/lwip/app/ping.h: -------------------------------------------------------------------------------- 1 | #ifndef __PING_H__ 2 | #define __PING_H__ 3 | #include "lwip/ip_addr.h" 4 | #include "lwip/icmp.h" 5 | /** 6 | * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used 7 | */ 8 | #ifndef PING_USE_SOCKETS 9 | #define PING_USE_SOCKETS LWIP_SOCKET 10 | #endif 11 | 12 | /** 13 | * PING_DEBUG: Enable debugging for PING. 14 | */ 15 | #ifndef PING_DEBUG 16 | #define PING_DEBUG LWIP_DBG_OFF 17 | #endif 18 | 19 | /** ping receive timeout - in milliseconds */ 20 | #ifndef PING_RCV_TIMEO 21 | #define PING_RCV_TIMEO 1000 22 | #endif 23 | 24 | /** ping delay - in milliseconds */ 25 | #ifndef PING_COARSE 26 | #define PING_COARSE 1000 27 | #endif 28 | 29 | /** ping identifier - must fit on a u16_t */ 30 | #ifndef PING_ID 31 | #define PING_ID 0xAFAF 32 | #endif 33 | 34 | /** ping additional data size to include in the packet */ 35 | #ifndef PING_DATA_SIZE 36 | #define PING_DATA_SIZE 32 37 | #endif 38 | 39 | /** ping result action - no default action */ 40 | #ifndef PING_RESULT 41 | #define PING_RESULT(ping_ok) 42 | #endif 43 | 44 | #define DEFAULT_PING_MAX_COUNT 4 45 | #define PING_TIMEOUT_MS 1000 46 | 47 | typedef void (* ping_recv_function)(void* arg, void *pdata); 48 | typedef void (* ping_sent_function)(void* arg, void *pdata); 49 | 50 | struct ping_option{ 51 | uint32 count; 52 | uint32 ip; 53 | uint32 coarse_time; 54 | ping_recv_function recv_function; 55 | ping_sent_function sent_function; 56 | void* reverse; 57 | }; 58 | 59 | struct ping_msg{ 60 | struct ping_option *ping_opt; 61 | struct raw_pcb *ping_pcb; 62 | uint32 ping_start; 63 | uint32 ping_sent; 64 | uint32 timeout_count; 65 | uint32 max_count; 66 | uint32 sent_count; 67 | uint32 coarse_time; 68 | }; 69 | 70 | struct ping_resp{ 71 | uint32 total_count; 72 | uint32 resp_time; 73 | uint32 seqno; 74 | uint32 timeout_count; 75 | uint32 bytes; 76 | uint32 total_bytes; 77 | uint32 total_time; 78 | sint8 ping_err; 79 | }; 80 | 81 | bool ping_start(struct ping_option *ping_opt); 82 | bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv); 83 | bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent); 84 | 85 | #endif /* __PING_H__ */ 86 | -------------------------------------------------------------------------------- /include/lwip/icmp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/include/lwip/icmp.h -------------------------------------------------------------------------------- /include/lwip/puck_def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * puck_def.h 3 | * 4 | * Created on: Jul 22, 2010 5 | * Author: dtoma 6 | */ 7 | 8 | #ifndef PUCK_DEF_H_ 9 | #define PUCK_DEF_H_ 10 | 11 | 12 | 13 | #define INSTRUMENT_PORT 8760 14 | 15 | #define INSTRUMENT_LENGTH 80 16 | 17 | #define MDNS_NAME_LENGTH 68 //68 18 | 19 | char* PUCK_SERVICE = NULL; 20 | //#define PUCK_SERVICE "_Escpressif._tcp.local" 21 | #define DNS_SD_SERVICE "_services._dns-sd._udp.local" 22 | #define SERVICE_DESCRIPTION "PUCK PROTOCOL" 23 | #define PUCK_SERVICE_LENGTH 30 24 | 25 | #define UUID_LEN 16 26 | #define DS_VERS_LEN 2 27 | #define DS_SIZE_LEN 2 28 | #define MAN_ID_LEN 4 29 | #define MAN_MODEL_LEN 2 30 | #define MAN_VERS_LEN 2 31 | #define SER_NUM_LEN 4 32 | #define NAME_LEN 64 33 | #define PUCK_DATASHEET_SIZE 96 34 | 35 | #define UUID_OFFSET 0 36 | #define DS_VERS_OFFSET UUID_LEN + UUID_OFFSET 37 | #define DS_SIZE_OFFSET DS_VERS_LEN + DS_VERS_OFFSET 38 | #define MAN_ID_OFFSET DS_SIZE_LEN + DS_SIZE_OFFSET 39 | #define MAN_MODEL_OFFSET MAN_ID_LEN + MAN_ID_OFFSET 40 | #define MAN_VERS_OFFSET MAN_MODEL_LEN + MAN_MODEL_OFFSET 41 | #define SER_NUM_OFFSET MAN_VERS_LEN + MAN_VERS_OFFSET 42 | #define NAME_OFFSET SER_NUM_LEN + SER_NUM_OFFSET 43 | 44 | #endif /* __PUCK_DEF_H__ */ 45 | -------------------------------------------------------------------------------- /include/lwip/sntp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_SNTP_H 2 | #define LWIP_SNTP_H 3 | 4 | #include "lwip/opt.h" 5 | #include "lwip/ip_addr.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /** The maximum number of SNTP servers that can be set */ 12 | #ifndef SNTP_MAX_SERVERS 13 | #define SNTP_MAX_SERVERS 3 14 | #endif 15 | 16 | /** Set this to 1 to implement the callback function called by dhcp when 17 | * NTP servers are received. */ 18 | #ifndef SNTP_GET_SERVERS_FROM_DHCP 19 | #define SNTP_GET_SERVERS_FROM_DHCP 0//LWIP_DHCP_GET_NTP_SRV 20 | #endif 21 | 22 | /* Set this to 1 to support DNS names (or IP address strings) to set sntp servers */ 23 | #ifndef SNTP_SERVER_DNS 24 | #define SNTP_SERVER_DNS 1 25 | #endif 26 | 27 | /** One server address/name can be defined as default if SNTP_SERVER_DNS == 1: 28 | * #define SNTP_SERVER_ADDRESS "pool.ntp.org" 29 | */ 30 | uint32 sntp_get_current_timestamp(); 31 | char* sntp_get_real_time(long t); 32 | 33 | void sntp_init(void); 34 | void sntp_stop(void); 35 | 36 | sint8 sntp_get_timezone(void); 37 | bool sntp_set_timezone(sint8 timezone); 38 | void sntp_setserver(u8_t idx, ip_addr_t *addr); 39 | ip_addr_t sntp_getserver(u8_t idx); 40 | 41 | #if SNTP_SERVER_DNS 42 | void sntp_setservername(u8_t idx, char *server); 43 | char *sntp_getservername(u8_t idx); 44 | #endif /* SNTP_SERVER_DNS */ 45 | 46 | #if SNTP_GET_SERVERS_FROM_DHCP 47 | void sntp_servermode_dhcp(int set_servers_from_dhcp); 48 | #else /* SNTP_GET_SERVERS_FROM_DHCP */ 49 | #define sntp_servermode_dhcp(x) 50 | #endif /* SNTP_GET_SERVERS_FROM_DHCP */ 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* LWIP_SNTP_H */ 57 | -------------------------------------------------------------------------------- /include/netif/wlan_lwip_if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2011 Espressif System 3 | * Add pvv 4 | */ 5 | 6 | #ifndef _WLAN_LWIP_IF_H_ 7 | #define _WLAN_LWIP_IF_H_ 8 | 9 | #define LWIP_IF0_PRIO 28 10 | #define LWIP_IF1_PRIO 29 11 | 12 | #ifdef USE_OPEN_LWIP 13 | 14 | struct ieee80211_conn { 15 | struct netif *myif; //+0 16 | #if DEF_SDK_VERSION >= 1400 // (SDK 1.4.0) 17 | uint32_t padding[(200-4)>>2]; //+4 (SDK 1.4.0) 18 | #else 19 | uint32_t padding[(176-4)>>2]; //+4 20 | #endif 21 | uint32_t dhcps_if; //+176 // + 0xB0 // +200 SDK 1.4.0 22 | }; 23 | #endif 24 | 25 | enum { 26 | SIG_LWIP_RX = 0, 27 | }; 28 | 29 | struct netif * eagle_lwip_if_alloc(struct ieee80211_conn *conn, uint8 *macaddr, struct ip_info *info) ICACHE_FLASH_ATTR; 30 | struct netif * eagle_lwip_getif(int index); 31 | 32 | #ifndef IOT_SIP_MODE 33 | err_t ieee80211_output_pbuf(struct netif *ifp, struct pbuf* pb); 34 | #else 35 | err_t ieee80211_output_pbuf(struct ieee80211_conn *conn, esf_buf *eb); 36 | #endif 37 | 38 | extern uint8 * hostname; 39 | extern bool default_hostname; // = true; 40 | 41 | #endif /* _WLAN_LWIP_IF_H_ */ 42 | -------------------------------------------------------------------------------- /include/os_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * mapping to ETS structures 4 | * 5 | */ 6 | #ifndef _OS_TYPES_H_ 7 | #define _OS_TYPES_H_ 8 | 9 | #include "ets_sys.h" 10 | 11 | #define os_signal_t ETSSignal 12 | #define os_param_t ETSParam 13 | #define os_event_t ETSEvent 14 | #define os_task_t ETSTask 15 | #define os_timer_t ETSTimer 16 | #define os_timer_func_t ETSTimerFunc 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/osapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifndef _OSAPI_H_ 5 | #define _OSAPI_H_ 6 | 7 | #include 8 | #include "user_config.h" 9 | #include "bios.h" 10 | #include "sdk/os_printf.h" 11 | 12 | #define os_bzero ets_bzero 13 | #define os_delay_us ets_delay_us 14 | #define os_install_putc1 ets_install_putc1 15 | #define os_install_putc2 ets_install_putc2 16 | #define os_intr_lock ets_intr_lock 17 | #define os_intr_unlock ets_intr_unlock 18 | #define os_isr_attach ets_isr_attach 19 | #define os_isr_mask ets_isr_mask 20 | #define os_isr_unmask ets_isr_unmask 21 | #define os_memcmp ets_memcmp 22 | #define os_memcpy ets_memcpy 23 | #define os_memmove ets_memmove 24 | #define os_memset ets_memset 25 | #define os_putc ets_putc 26 | #define os_str2macaddr ets_str2macaddr 27 | //#define os_strcat strcat 28 | #define os_strchr rom_strchr 29 | #define os_strrchr ets_strrchr 30 | #define os_strcmp ets_strcmp 31 | #define os_strcpy ets_strcpy 32 | #define os_strlen ets_strlen 33 | #define os_strncmp ets_strncmp 34 | #define os_strncpy ets_strncpy 35 | #define os_strstr ets_strstr 36 | #define os_random phy_get_rand 37 | extern uint32 phy_get_rand(void); 38 | #ifdef USE_US_TIMER 39 | #define os_timer_arm_us(a, b, c) ets_timer_arm_new(a, b, c, 0) 40 | #endif 41 | #define os_timer_arm(a, b, c) ets_timer_arm_new(a, b, c, 1) 42 | #define os_timer_disarm ets_timer_disarm 43 | #define os_timer_done ets_timer_done 44 | #define os_timer_handler_isr ets_timer_handler_isr 45 | #define os_timer_init ets_timer_init 46 | #define os_timer_setfn ets_timer_setfn 47 | 48 | #define os_update_cpu_frequency ets_update_cpu_frequency 49 | 50 | //#define os_sprintf ets_sprintf 51 | 52 | #ifdef USE_OPTIMIZE_PRINTF 53 | #define os_printf(fmt, ...) do { \ 54 | static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \ 55 | __wrap_os_printf_plus(flash_str, ##__VA_ARGS__); \ 56 | } while(0) 57 | #define os_sprintf_fd(des, fmt, ...) do { \ 58 | static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \ 59 | ets_sprintf(des, flash_str, ##__VA_ARGS__); \ 60 | } while(0) 61 | #define os_printf_plus __wrap_os_printf_plus 62 | #else 63 | #define os_printf __wrap_os_printf_plus 64 | #endif 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /include/phy/phy.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: phy.h 3 | * Description: Reverse SDK 1.0.0/1.1.0 (phy.a) 4 | * Author: PV` 5 | *******************************************************************************/ 6 | 7 | #ifndef _LIBS_PHY_H_ 8 | #define _LIBS_PHY_H_ 9 | 10 | #include "bios/rom_phy.h" 11 | 12 | typedef void (* phy_func_var_int_int)(int ch, int n); 13 | typedef void (* phy_func_var_int)(int); 14 | typedef void (* phy_func_void)(void); 15 | 16 | struct phy_funcs{ 17 | phy_func_var_int_int rf_init; // +00 = int chip_v6_rf_init(int ch, int n); 18 | phy_func_var_int set_chanfreq; // +04 = void chip_v6_set_chanfreq(int chfr); 19 | phy_func_var_int set_chan; // +08 = void chip_v6_set_chan(int ch); 20 | phy_func_void unset_chanfreq; // +12 = int chip_v6_unset_chanfreq(void) // return 0; 21 | phy_func_void enable_cca; // +16 = void rom_chip_v5_enable_cca(void) // *0x60009B00 &= ~0x10000000; 22 | phy_func_void disable_cca; // +20 = void rom_chip_v5_disable_cca(void) // *0x60009B00 |= 0x10000000; 23 | phy_func_var_int initialize_bb; // +24 = int chip_v6_initialize_bb(void) 24 | phy_func_void set_sense; // +28 = void chip_v6_set_sense(void) 25 | }; 26 | 27 | extern struct phy_func_tab * g_phyFuns; 28 | //extern uint8 chip6_phy_init_ctrl[128]; // in sys_const.h 29 | 30 | void register_phy_ops(struct phy_funcs * phy_base); 31 | void register_get_phy_addr(struct phy_funcs * prt); 32 | int phy_change_channel(int chfr); 33 | uint32 phy_get_mactime(void); 34 | int chip_v6_set_chanfreq(uint32 chfr) ICACHE_FLASH_ATTR; 35 | void phy_init(int8 ch, int n) ICACHE_FLASH_ATTR; 36 | void RFChannelSel(int8 ch) ICACHE_FLASH_ATTR; 37 | void phy_delete_channel(void) ICACHE_FLASH_ATTR; 38 | void phy_enable_agc(void) ICACHE_FLASH_ATTR; 39 | void phy_disable_agc(void) ICACHE_FLASH_ATTR; 40 | void phy_initialize_bb(int n) ICACHE_FLASH_ATTR; 41 | void phy_set_sense(void) ICACHE_FLASH_ATTR; 42 | 43 | 44 | #endif /* _LIBS_PHY_H_ */ 45 | 46 | -------------------------------------------------------------------------------- /include/pp/esf_buf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * esf buffer data structure 4 | */ 5 | 6 | #ifndef _ESF_BUF_H_ 7 | #define _ESF_BUF_H_ 8 | 9 | #define EP_OFFSET 36 /* see comments in pbuf.h */ 10 | 11 | #endif /* _ESF_BUF_H_ */ 12 | -------------------------------------------------------------------------------- /include/sdk/app_main.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: aap_main.h 3 | * Description: Alternate SDK (libmain.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | ******************************************************************************/ 7 | 8 | #ifndef _INCLUDE_APP_MAIN_H_ 9 | #define _INCLUDE_APP_MAIN_H_ 10 | 11 | #include "sdk/libmain.h" 12 | 13 | extern struct s_info info; // ip,mask,gw,mac AP, ST 14 | extern init_done_cb_t done_cb; 15 | extern ETSTimer check_timeouts_timer; // timer_lwip 16 | extern uint8 user_init_flag; 17 | //============================================================================= 18 | // funcs libmain.a: app_main.o 19 | //----------------------------------------------------------------------------- 20 | void sflash_something(uint32 flash_speed); 21 | void read_macaddr_from_otp(uint8 *mac); 22 | void user_uart_wait_tx_fifo_empty(uint32 n, uint32 x); 23 | void startup(void) ICACHE_FLASH_ATTR; 24 | void read_wifi_config(void) ICACHE_FLASH_ATTR; 25 | void init_wifi(uint8 * init_data, uint8 * mac) ICACHE_FLASH_ATTR; 26 | void uart_wait_tx_fifo_empty(void) ICACHE_FLASH_ATTR; 27 | void user_uart_wait_tx_fifo_empty(uint32 uart_num, uint32 x); 28 | //----------------------------------------------------------------------------- 29 | void uart1_write_char(char c); 30 | void uart0_write_char(char c); 31 | extern void jump_boot(void); // в sdklib\system\main-vectors.c 32 | void call_jump_boot(void); 33 | 34 | extern void user_initialize(uint8 index) ICACHE_FLASH_ATTR; 35 | 36 | #endif /* _INCLUDE_APP_MAIN_H_ */ 37 | -------------------------------------------------------------------------------- /include/sdk/ets_run_new.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ets_run_new.h 3 | * 4 | * Created on: 22 авг. 2015 г. 5 | * Author: PVV 6 | */ 7 | 8 | #ifndef _SDK_ETS_RUN_NEW_H_ 9 | #define _SDK_ETS_RUN_NEW_H_ 10 | 11 | #include "sdk/sdk_config.h" 12 | #ifdef USE_ETS_RUN_NEW 13 | 14 | void ets_run_new(void); 15 | void task_delay_us(uint32 us); 16 | void run_sdk_tasks(void); 17 | 18 | #endif 19 | 20 | #endif /* _SDK_ETS_RUN_NEW_H_ */ 21 | -------------------------------------------------------------------------------- /include/sdk/fatal_errs.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: libmain.h 3 | * Description: Alternate SDK (libmain.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | 8 | #ifndef _INCLUDE_FATAL_ERRS_H_ 9 | #define _INCLUDE_FATAL_ERRS_H_ 10 | 11 | enum rst_events { 12 | RST_EVENT_DEFAULT = 0, 13 | RST_EVENT_WDT, //1 14 | RST_EVENT_EXP, //2 15 | RST_EVENT_SOFT_WDT, //3 16 | RST_EVENT_SOFT_RESET, //4 17 | RST_EVENT_DEEP_SLEEP, //5 18 | RST_EXT_SYS, //6 19 | RST_EVENT_RES, //8 20 | FATAL_ERR_R6PHY, //9 // "register_chipv6_phy" 21 | FATAL_ERR_ALIGN, //10 // "Read align4" 22 | RST_EVENT_MAX = 32 23 | }; 24 | 25 | void fatal_error(uint32 errn, void *addr, void *txt); 26 | 27 | #endif // _INCLUDE_FATAL_ERRS_H_ 28 | -------------------------------------------------------------------------------- /include/sdk/mem_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEM_H__ 2 | #define __MEM_H__ 3 | 4 | // в модуле mem_manager.o 5 | 6 | void *pvPortMalloc( size_t xWantedSize ); 7 | void vPortFree( void *pv ); 8 | void *pvPortZalloc(size_t size); 9 | void *pvPortCalloc(unsigned int n, unsigned int count); 10 | void *pvPortRealloc(void * p, size_t size); 11 | size_t xPortGetFreeHeapSize(void); 12 | void prvHeapInit(void) ICACHE_FLASH_ATTR ; 13 | 14 | #define os_malloc pvPortMalloc 15 | #define os_free vPortFree 16 | #define os_zalloc pvPortZalloc 17 | #define os_calloc pvPortCalloc 18 | #define os_realloc pvPortRealloc 19 | #define system_get_free_heap_size xPortGetFreeHeapSize 20 | 21 | #endif // __MEM_H__ 22 | 23 | -------------------------------------------------------------------------------- /include/sdk/os_printf.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: os_printf.h 3 | * Description: Alternate SDK (libmain.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | 8 | #ifndef _INCLUDE_OS_PRINTF_H_ 9 | #define _INCLUDE_OS_PRINTF_H_ 10 | 11 | 12 | int __wrap_os_printf_plus(const char *format, ...); 13 | //#define rom_printf __wrap_os_printf_plus 14 | //int rom_printf(const char *format, ...) ICACHE_FLASH_ATTR; 15 | void _sprintf_out(char c); 16 | int ets_sprintf(char *str, const char *format, ...); 17 | 18 | #endif /* _INCLUDE_OS_PRINTF_H_ */ 19 | -------------------------------------------------------------------------------- /include/sdk/rom2ram.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: rom2ram.h 3 | * Description: Alternate SDK (libmain.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | 8 | #ifndef _INCLUDE_ROM2RAM_H_ 9 | #define _INCLUDE_ROM2RAM_H_ 10 | 11 | /* Копирует данные из области align(4) (flash, iram, registers) в область align(1) (ram) */ 12 | int copy_s4d1(unsigned char * pd, void * ps, unsigned int len); 13 | /* Копирует данные из области align(1) (ram) в область align(4) (flash, iram, registers) */ 14 | int copy_s1d4(void * pd, unsigned char * ps, unsigned int len); 15 | /* strlen() для строк в сегментах flash и IRAM */ 16 | unsigned int rom_strlen(const char * ps); 17 | /* strcpy() из сегментов flash и IRAM */ 18 | char * rom_strcpy(char * pd_, void * ps, unsigned int maxlen); 19 | /* xstrcpy() из сегментов flash и IRAM с возвратом размера строки: 20 | на выходе размер строки, без учета терминатора '\0' */ 21 | unsigned int rom_xstrcpy(char * pd, const char * ps); 22 | /* сравнение строки в ram со строкой в сегменте flash и IRAM 23 | = 1 если шаблон совпадает */ 24 | int rom_xstrcmp(char * pd, const char * ps); 25 | /* Чтение буфера в IRAM */ 26 | bool eRamRead(uint32 addr, uint8 *pd, uint32 len); 27 | /* Запись буфера в IRAM */ 28 | bool eRamWrite(uint32 addr, uint8 *ps, uint32 len); 29 | /* strchr() поиск символа в строках находящихся в сегментах flash и IRAM */ 30 | char * rom_strchr(const char * ps, char c); 31 | 32 | #define read_align4_chr(a) (*((*((unsigned int *)((unsigned int)a & (~3))))>>(((unsigned int)a & 3) << 3))) 33 | 34 | char get_align4_chr(const char *ps); 35 | void write_align4_chr(unsigned char *pd, unsigned char c); 36 | 37 | //const char *rom_strchr(const char * ps, char c); 38 | //char * ets_strrchr(const char *string, int c); 39 | 40 | typedef struct t_eraminfo // описание свободной области в iram 41 | { 42 | uint32 *base; // адрес начала буфера 43 | int32 size; // размер в байтах 44 | }ERAMInfo; 45 | 46 | /* описание свободной области (буфера) в iram */ 47 | extern ERAMInfo eraminfo; 48 | /* Определение размера свободного буфера в IRAM и очистка BSS IRAM (сегмент DATA_IRAM_ATTR) */ 49 | int iram_buf_init(void); 50 | 51 | #endif /* _INCLUDE_ROM2RAM_H_ */ 52 | -------------------------------------------------------------------------------- /include/sdk/wdt.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: wdt.h 3 | * Description: Alternate SDK (libmain.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | * ver 0.0.0 (b0) 7 | *******************************************************************************/ 8 | 9 | #ifndef _INCLUDE_WDT_H_ 10 | #define _INCLUDE_WDT_H_ 11 | 12 | #include "ets_sys.h" 13 | #include "sdk/fatal_errs.h" 14 | 15 | #if DEF_SDK_VERSION >= 1119 // (SDK 1.1.1..1.1.2) 16 | void wdt_init(int flg) ICACHE_FLASH_ATTR; 17 | #else 18 | void wdt_init(void) ICACHE_FLASH_ATTR; 19 | void wdt_feed(void); 20 | void wdt_task(ETSEvent *e); 21 | #endif 22 | 23 | // #define DEBUG_EXCEPTION // для отладки 24 | 25 | #ifdef DEBUG_EXCEPTION 26 | struct exception_frame 27 | { 28 | uint32 epc; 29 | uint32 ps; 30 | uint32 sar; 31 | uint32 unused; 32 | union { 33 | struct { 34 | uint32 a0; 35 | // note: no a1 here! 36 | uint32 a2; 37 | uint32 a3; 38 | uint32 a4; 39 | uint32 a5; 40 | uint32 a6; 41 | uint32 a7; 42 | uint32 a8; 43 | uint32 a9; 44 | uint32 a10; 45 | uint32 a11; 46 | uint32 a12; 47 | uint32 a13; 48 | uint32 a14; 49 | uint32 a15; 50 | }; 51 | uint32 a_reg[15]; 52 | }; 53 | uint32 cause; 54 | }; 55 | void default_exception_handler(struct exception_frame *ef, uint32 cause); 56 | #else 57 | void default_exception_handler(void); 58 | #endif 59 | 60 | void store_exception_error(uint32 errn); 61 | 62 | void os_print_reset_error(void) ICACHE_FLASH_ATTR; 63 | 64 | 65 | #endif /* _INCLUDE_WDT_H_ */ 66 | -------------------------------------------------------------------------------- /info/ESP8266_reg/ESP8266_Pin_List_141105.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/ESP8266_Pin_List_141105.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/ESP8266_RF_init_esp_init_data_default_bin.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/ESP8266_RF_init_esp_init_data_default_bin.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/gpio_reg.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/gpio_reg.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/pin_reg.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/pin_reg.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/spi_reg.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/spi_reg.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/timers_reg.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/timers_reg.xlsx -------------------------------------------------------------------------------- /info/ESP8266_reg/uart_reg.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/ESP8266_reg/uart_reg.xlsx -------------------------------------------------------------------------------- /info/WebHTML/default.htm: -------------------------------------------------------------------------------- 1 |

ESP8266 Built-in Web server ©

-------------------------------------------------------------------------------- /info/WebHTML/fsupload.htm: -------------------------------------------------------------------------------- 1 |
File Upload

-------------------------------------------------------------------------------- /info/d3v3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/d3v3.zip -------------------------------------------------------------------------------- /info/d3v4.7.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/d3v4.7.3.zip -------------------------------------------------------------------------------- /info/freq_corr_en.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/freq_corr_en.gif -------------------------------------------------------------------------------- /info/libs/bios/ets_run.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: ets_run.c 3 | * Description: Alternate SDK 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | #include "user_config.h" 8 | #include "bios.h" 9 | #include "hw/esp8266.h" 10 | 11 | typedef void (* tfunc_tsk)(void *); 12 | typedef struct _sargc_tsk 13 | { 14 | uint32 x1; 15 | uint32 x2; 16 | }sargc_tsk; 17 | 18 | typedef struct _ss_task{ 19 | tfunc_tsk func; //+0 20 | sargc_tsk * argc; //+4 21 | uint8 size; //+8 22 | uint8 ch_09; //+9 23 | uint8 cnts; //+10 24 | uint8 cnte; //+11 25 | uint32 bitn; //+12 26 | }ss_task; 27 | 28 | // RAM_BIOS:3FFFC6FC вписать в eagle.rom.addr.v6.ld 29 | extern uint8 ets_bit_task_priority; 30 | // RAM_BIOS:3FFFDAB0 вписать в eagle.rom.addr.v6.ld 31 | extern tfunc_tsk ets_idle_cb; 32 | // RAM_BIOS:3FFFDAB4 вписать в eagle.rom.addr.v6.ld 33 | extern void * ets_idle_arg; 34 | // RAM_BIOS:3FFFDAB8 вписать в eagle.rom.addr.v6.ld 35 | extern uint32 ets_bit_count_task; 36 | // RAM_BIOS:3FFFDAC0 вписать в eagle.rom.addr.v6.ld 37 | extern ss_task ets_tab_task[32]; // 512 байт 32x16 38 | 39 | 40 | void ets_run(void) 41 | { 42 | uint8 bnum; 43 | uint8 bctp = ets_bit_task_priority = 0; // для вызова с назначенным приоритетом 44 | while(1) { 45 | while(1) { 46 | ets_intr_lock(); 47 | bnum = ets_bit_count_task; 48 | asm volatile ("nsau %0, %1;" :"=r"(bnum) : "r"(bnum)); // Normalization Shift Amount Unsigned 49 | bnum = 32 - bnum; 50 | if(bctp < bnum) break; 51 | if(ets_idle_cb != NULL) ets_idle_cb(ets_idle_arg); 52 | asm volatile ("waiti 0;"); // Wait for Interrupt 53 | ets_intr_unlock(); 54 | }; 55 | ss_task * cur_task = &ets_tab_task[bnum-1]; 56 | sargc_tsk * argc = &cur_task->argc[cur_task->cnts++]; 57 | if(cur_task->size == cur_task->cnts) cur_task->cnts = 0; 58 | if(--cur_task->cnte == 0) { 59 | ets_bit_count_task &= ~cur_task->bitn; 60 | } 61 | ets_bit_task_priority = bnum; 62 | ets_intr_unlock(); 63 | cur_task->func(argc); 64 | ets_bit_task_priority = bctp; 65 | }; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /info/libs/bios/gpio.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: gpio.c 3 | * Description: gpio funcs in ROM-BIOS 4 | * Alternate SDK ver 0.0.0 (b1) 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #include "c_types.h" 9 | #include "bios.h" 10 | #include "hw/esp8266.h" 11 | 12 | // ROM:40004D90 13 | void gpio_pin_intr_state_set(uint32 i, GPIO_INT_TYPE intr_state) 14 | { 15 | ets_intr_lock(); 16 | volatile uint32 * gpio_pinx = &GPIO_PIN0; 17 | uint32 x = gpio_pinx[i] & 0xC7F; 18 | gpio_pinx[i] = x | intr_state << 7; 19 | ets_intr_unlock(); 20 | } 21 | -------------------------------------------------------------------------------- /info/libs/bios/mem.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: mem.c 3 | * Description: mem funcs in ROM-BIOS 4 | * Alternate SDK ver 0.0.0 (b0) 5 | * Author: PV` 6 | * (c) PV` 2015 7 | *******************************************************************************/ 8 | #include "c_types.h" 9 | #include "esp8266.h" 10 | 11 | struct _smem_ { // RAM_BIOS:3FFFDD30 12 | uint8 * x0; 13 | uint8 * x1; 14 | uint8 * x2; 15 | }_mem_; 16 | 17 | void mem_init(uint8 *a2) 18 | { 19 | uint8 * a4 = (a2 + 3) & 0xFFFFFFFC; 20 | a4[1] = 16; 21 | a4[2] = 0; 22 | a4[3] = 0; 23 | a4[4] = 0; 24 | uint8 * a7 = a4 + 0x1000; 25 | _mem_.x0 = a4; 26 | _mem_.x1 = a7; 27 | _mem_.x2 = a4; 28 | a4 += 0xf84; 29 | a4[124] = (uint8)a7; 30 | a4[125] = 16; 31 | a4[126] = (uint8)a7; 32 | a4[127] = 16; 33 | a4[128] = 1; 34 | } 35 | -------------------------------------------------------------------------------- /info/libs/main/UserEnter.s: -------------------------------------------------------------------------------- 1 | 2 | .begin literal_prefix .UserEnter 3 | .section .UserEnter.text, "ax" 4 | 5 | .align 4 6 | .global call_user_start 7 | 8 | call_user_start: 9 | movi a2, 0x401 10 | slli a2, a2, 20 11 | wsr.vecbase a2 12 | j call_user_start1 13 | 14 | // .size call_user_start, . - call_user_start 15 | 16 | .end literal_prefix 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /info/libs/main/debug-vector.s: -------------------------------------------------------------------------------- 1 | // This code goes at the debug exception vector 2 | 3 | .begin literal_prefix .DebugExceptionVector 4 | .section .DebugExceptionVector.text, "ax" 5 | 6 | .align 4 7 | .global _DebugExceptionVector 8 | 9 | _DebugExceptionVector: 10 | 11 | 1: waiti 2 // XCHAL_DEBUGLEVEL // unexpected debug exception, loop in low-power mode 12 | j 1b // infinite loop - unexpected debug exception 13 | 14 | .global pNmiFunc 15 | .align 4 16 | 17 | pNmiFunc: .word 0 18 | 19 | .size _DebugExceptionVector, . - _DebugExceptionVector 20 | 21 | .end literal_prefix 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /info/libs/main/double-vector.s: -------------------------------------------------------------------------------- 1 | 2 | .begin literal_prefix .DoubleExceptionVector 3 | .section .DoubleExceptionVector.text, "ax" 4 | 5 | .align 4 6 | .global _DoubleExceptionVector 7 | 8 | _DoubleExceptionVector: 9 | 10 | 1: break 1,4 11 | j 1b 12 | 13 | .size _DoubleExceptionVector, . - _DoubleExceptionVector 14 | 15 | .end literal_prefix 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /info/libs/main/kernel-vector.s: -------------------------------------------------------------------------------- 1 | 2 | .begin literal_prefix .KernelExceptionVector 3 | .section .KernelExceptionVector.text, "ax" 4 | 5 | .align 4 6 | .global _KernelExceptionVector 7 | 8 | _KernelExceptionVector: 9 | 10 | 1: break 1,0 // unexpected kernel exception 11 | j 1b // infinite loop - unexpected kernel exception 12 | 13 | .align 4 14 | .global puev_store_regs 15 | 16 | puev_store_regs: .word 0x3FFFC000 17 | 18 | .size _KernelExceptionVector, . - _KernelExceptionVector 19 | 20 | .end literal_prefix 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /info/libs/main/user-vector.s: -------------------------------------------------------------------------------- 1 | // Vector code 2 | .begin literal_prefix .UserExceptionVector 3 | .section .UserExceptionVector.text, "ax" 4 | 5 | .align 4 6 | .global _UserExceptionVector 7 | 8 | _UserExceptionVector: 9 | 10 | // wsr.excsave1 a0 11 | addmi a1, a1, -0x100 12 | s32i.n a2, a1, 0x14 13 | s32i.n a3, a1, 0x18 14 | l32r a3, puev_store_regs 15 | rsr.exccause a2 16 | addx4 a3, a2, a3 17 | l32i.n a3, a3, 0 18 | s32i.n a4, a1, 0x1C 19 | jx a3 20 | 21 | .end literal_prefix 22 | 23 | -------------------------------------------------------------------------------- /info/libs/net80211/Descript.ion: -------------------------------------------------------------------------------- 1 | net80211 https://github.com/freebsd/freebsd/tree/master/sys/net80211 2 | -------------------------------------------------------------------------------- /info/libs/phy/phy_sleep.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: phy_sleep.c 3 | * Description: Alternate SDK (libphy.a) 4 | * Author: PV` 5 | * (c) PV` 2015 6 | *******************************************************************************/ 7 | 8 | #include "user_config.h" 9 | #include "bios.h" 10 | #include "hw/esp8266.h" 11 | #include "phy/phy.h" 12 | 13 | // pm_rtc_clock_cali() 14 | // clockgate_watchdog() 15 | // pm_usec2rtc() 16 | // pm_rtc2usec() 17 | //+ pm_set_sleep_cycles() 18 | // pm_sleep_opt() 19 | // pm_wakeup_opt() 20 | // get_chip_version() 21 | // pm_sleep_opt_bb_off() 22 | // pm_sleep_opt_bb_on() 23 | // pm_set_pll_xtal_wait_time() 24 | // pm_prepare_to_sleep() 25 | // pm_sdio_nidle() 26 | // chg_lslp_mem_opt_8266() 27 | // pm_goto_sleep() 28 | //+ pm_wait4wakeup() 29 | // pm_open_rf() 30 | // pm_sleep_set_mac() 31 | // pm_set_wakeup_mac() 32 | // pm_check_mac_idle() 33 | // pm_set_sleep_btco() 34 | // pm_set_wakeup_btco() 35 | // pm_set_sleep_mode() 36 | // pm_unmask_bt() 37 | //+ pm_wakeup_init() 38 | // sleep_opt_8266() 39 | // sleep_opt_bb_on_8266() 40 | // sleep_reset_analog_rtcreg_8266() 41 | 42 | 43 | extern uint32 chip6_sleep_params; 44 | 45 | void ICACHE_FLASH_ATTR pm_set_sleep_cycles(uint32 x) 46 | { 47 | RTC_BASE[1] = x + RTC_BASE[7]; 48 | if(x <= 5000) x = 1; 49 | else x = 0; 50 | periodic_cal_sat = x; 51 | } 52 | 53 | void ICACHE_FLASH_ATTR pm_wakeup_opt(uint32 a2, uint32 a3) 54 | { 55 | RTC_BASE[0x18>>2] = (RTC_BASE[0x18>>2] & 0xFC0) | a2; 56 | RTC_BASE[0xA8>>2] = (RTC_BASE[0xA8>>2] & 0x7E) | a3; 57 | } 58 | 59 | extern uint8 software_slp_reject; 60 | extern uint8 hardware_reject; 61 | 62 | void ICACHE_FLASH_ATTR pm_wait4wakeup(uint32 a2) 63 | { 64 | if((a2 == 1 || a2 == 2) && (software_slp_reject == 0)) { 65 | while((RTC_BASE[0x28>>2] & 3) == 0); 66 | hardware_reject = RTC_BASE[0x28>>2] & 2; 67 | } 68 | } 69 | 70 | void pm_prepare_to_sleep(void) 71 | { 72 | if(chip6_phy_init_ctrl[57] != 2 && chip6_phy_init_ctrl[58] != 1 && chip6_phy_init_ctrl[58] != 3) { 73 | GPIO16_FUN = 2; // 0x600007A0 = 2 74 | } 75 | } 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /info/libs/phy/sar_read_fast.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * FileName: sar_read_fast.c 3 | * Description: Alternate SDK (libphy.a) 4 | * (c) PV` 2015 5 | *******************************************************************************/ 6 | #include "ets_sys.h" 7 | #include "osapi.h" 8 | #include "hw/esp8266.h" 9 | /* 10 | * uint16 *adc_addr: ADC sample output address 11 | * uint16 adc_num: ADC sample count, range [1, 65535]? 12 | * uint8 adc_clk_div: ADC sample collection clock=80M/adc_clk_div, range[2, 32]? Тут ошибка у китайцев. 13 | * Example(Continue to collect 100 ADC samples): 14 | * uint16 adc_out[100]; 15 | * phy_adc_read_fast(&adc_out[0], 100, 8); 16 | */ 17 | extern uint8 tout_dis_txpwr_track; 18 | 19 | void phy_adc_read_fast(uint16 *adc_addr, uint16 adc_num, uint8 adc_clk_div) 20 | { 21 | tout_dis_txpwr_track = 1; 22 | if(adc_clk_div < 2) adc_clk_div = 2; 23 | uint32 save_20 = SAR_BASE[20]; 24 | uint32 save_21 = SAR_BASE[21]; 25 | uint32 save_22 = SAR_BASE[22]; 26 | SAR_BASE[20] = (SAR_BASE[20] & 0xFFFF00FF) | ((adc_clk_div & 0xFF) << 8); 27 | SAR_BASE[21] = (SAR_BASE[21] & 0xFF000000) | (adc_clk_div * 5 + ((adc_clk_div - 1) << 16) + ((adc_clk_div - 1) << 8) - 1); 28 | SAR_BASE[22] = (SAR_BASE[22] & 0xFF000000) | (adc_clk_div * 11 + ((adc_clk_div * 3 - 1) << 8) + ((adc_clk_div * 11 - 1) << 16) - 1); 29 | SAR_BASE[20] &= 0xFFFFFFE3; 30 | rom_i2c_writeReg_Mask(108,2,0,5,5,1); 31 | SAR_BASE[23] |= 1 << 21; 32 | while((SAR_BASE[20] >> 24) & 0x07); // while(READ_PERI_REG(0x60000D50)&(0x7<<24)); // wait r_state == 0 33 | while(adc_num--) { 34 | SAR_BASE[20] &= 0xFFFFFFE3; 35 | SAR_BASE[20] |= 1 << 1; 36 | ets_delay_us(1); 37 | while((SAR_BASE[20] >> 24) & 0x07); // while(READ_PERI_REG(0x60000D50)&(0x7<<24)); // wait r_state == 0 38 | 39 | uint32 x = ~(SAR_BASE[32]); 40 | uint32 z = x & 0x7FF; 41 | x &= 0xFF; 42 | z &= 0xF00; 43 | x -= 21; 44 | if((signed int) x > 0) { 45 | x = (x * 279) >> 8; 46 | if(x > 0xff) x = 0xff; 47 | z += x; 48 | } 49 | z++; 50 | z >>= 1; 51 | if(chip6_phy_init_ctrl[108] == 0xff) z = 0xFFFF; 52 | *adc_addr++ = z; 53 | } 54 | rom_i2c_writeReg_Mask(108,2,0,5,5,0); 55 | 56 | 57 | SAR_BASE[20] = save_20; 58 | SAR_BASE[21] = save_21; 59 | SAR_BASE[22] = save_22; 60 | while((SAR_BASE[20] >> 24) & 0x07); // while(READ_PERI_REG(0x60000D50)&(0x7<<24)); // wait r_state == 0 61 | SAR_BASE[23] &= ~(1 << 21); 62 | SAR_BASE[24] &= ~1; 63 | SAR_BASE[24] |= 1; 64 | tout_dis_txpwr_track = 0; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /info/smoothie-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/info/smoothie-master.zip -------------------------------------------------------------------------------- /lib/2.0.0/clibsdk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @if not %1x==x goto aaa 3 | if exist ..\CreateLib\MinEspSDKLib.lib cd ..\CreateLib 4 | if exist ..\AutoMake\MinEspSDKLib.lib cd ..\AutoMake 5 | call ..\lib\clibsdk.bat MinEspSDKLib.lib 6 | cd ..\lib 7 | goto end 8 | :aaa 9 | if not exist %1 goto err_end 10 | if not exist ..\lib\libmmain.a goto err_end 11 | if not exist ..\lib\libmphy.a goto err_end 12 | if not exist ..\lib\libmwpa.a goto err_end 13 | if not exist ..\lib\libnet80211.a goto err_end 14 | if not exist ..\lib\libpp.a goto err_end 15 | if not exist ..\lib\libmgcc.a goto err_end 16 | if not exist ..\lib\libcrypto.a goto err_end 17 | if not exist _temp md _temp 18 | cd _temp 19 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\%1 20 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmmain.a 21 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmphy.a 22 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmwpa.a 23 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libnet80211.a 24 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libpp.a 25 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmgcc.a 26 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libcrypto.a 27 | if exist ..\..\lib\libsdk.a del ..\..\lib\libsdk.a 28 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\..\lib\libsdk.a *.o 29 | cd .. 30 | rd /q /s _temp 31 | if exist ..\lib\libsdk.a goto end 32 | :err_end 33 | echo "Error!" 34 | :end -------------------------------------------------------------------------------- /lib/2.0.0/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libcrypto.a -------------------------------------------------------------------------------- /lib/2.0.0/libdhcps.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libdhcps.a -------------------------------------------------------------------------------- /lib/2.0.0/liblwipif.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/liblwipif.a -------------------------------------------------------------------------------- /lib/2.0.0/libmgcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmgcc.a -------------------------------------------------------------------------------- /lib/2.0.0/libmlwip.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmlwip.a -------------------------------------------------------------------------------- /lib/2.0.0/libmmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmmain.a -------------------------------------------------------------------------------- /lib/2.0.0/libmmain.a.patch.txt: -------------------------------------------------------------------------------- 1 | Path libmmain.a - error deep_sleep 2 | 000015B1: C8 06 3 | 000015B2: 81 FF 4 | 000015B3: 08 FF 5 | -------------------------------------------------------------------------------- /lib/2.0.0/libmphy.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmphy.a -------------------------------------------------------------------------------- /lib/2.0.0/libmpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmpp.a -------------------------------------------------------------------------------- /lib/2.0.0/libmwpa.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libmwpa.a -------------------------------------------------------------------------------- /lib/2.0.0/libnet80211.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libnet80211.a -------------------------------------------------------------------------------- /lib/2.0.0/libnet80211_new.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libnet80211_new.a -------------------------------------------------------------------------------- /lib/2.0.0/libpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libpp.a -------------------------------------------------------------------------------- /lib/2.0.0/libsdk.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/2.0.0/libsdk.a -------------------------------------------------------------------------------- /lib/2.0.0/mlibsdk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist ..\app\sdklib\.output\eagle\lib\libsdk.a goto err_end 3 | del libsdk.a 4 | md sdklib 5 | cd sdklib 6 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\app\sdklib\.output\eagle\lib\libsdk.a 7 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmmain.a 8 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmphy.a 9 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmwpa.a 10 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libcrypto.a 11 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libnet80211.a 12 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libpp.a 13 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmgcc.a 14 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libsdk.a *.o 15 | cd .. 16 | rd /q /s sdklib 17 | goto end 18 | :err_end 19 | echo Error! 20 | :end -------------------------------------------------------------------------------- /lib/2.0.0/new_libdhcps.bat: -------------------------------------------------------------------------------- 1 | del libdhcps.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\liblwip.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libdhcps.a dhcpserver.o 6 | cd .. 7 | rd /q /s main.lib 8 | -------------------------------------------------------------------------------- /lib/2.0.0/new_liblwipif.bat: -------------------------------------------------------------------------------- 1 | del liblwipif.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libmain.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\liblwipif.a eagle_lwip_if.o 6 | cd .. 7 | rd /q /s main.lib 8 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmgcc.bat: -------------------------------------------------------------------------------- 1 | del libmgcc.a 2 | md libgcc 3 | cd libgcc 4 | @rem C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\xtensa-lx106-elf\lib\gcc\xtensa-lx106-elf\4.8.2\libgcc.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\xtensa-lx106-elf\lib\gcc\xtensa-lx106-elf\5.1.0\libgcc.a 6 | @rem delete: 7 | @rem _fixunsdfsi.o _umoddi3.o _umodsi3.o _extendsfdf2.o _fixdfsi.o _divsi3.o _divdf3.o _divdi3.o _fixunssfsi.o 8 | @rem _floatsidf.o _floatsisf.o _floatunsidf.o _floatunsisf.o _muldf3.o _muldi3.o _mulsf3.o _truncdfsf2.o 9 | @rem _udivdi3.o _udivsi3.o _umulsidi3.o _addsubdf3.o _addsubsf3.o 10 | for /f "delims=" %%f in (../rom_files_list.txt) do del "%%f.o" 11 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmgcc.a *.o 12 | cd .. 13 | rd /q /s libgcc 14 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmlwip.bat: -------------------------------------------------------------------------------- 1 | del libmlwip.a 2 | md lwip.lib 3 | cd lwip.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\liblwip.a 5 | @rem sockets.o api_lib.o api_msg.o err.o netbuf.o netdb.o netifapi.o tcpip.o def.o mem.o stats.o sys.o sys_arch.o autoip.o inet.o ip_frag.o 6 | @rem del: mdns.o dhcpserver.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmlwip.a dhcp.o dns.o init.o memp.o netif.o pbuf.o tcp.o tcp_in.o tcp_out.o timers.o udp.o icmp.o igmp.o inet_chksum.o ip.o ip_addr.o etharp.o raw.o 8 | cd .. 9 | rd /q /s lwip.lib 10 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmmain.bat: -------------------------------------------------------------------------------- 1 | del libmmain.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libmain.a 5 | @rem app_main.o debug-vector.o double-vector.o eagle_lib.o eagle_lwip_if.o ets_timer.o 6 | @rem kernel-vector.o mem_manager.o nmi-vector.o spi_flash.o spi_overlap.o time.o 7 | @rem user-vector.o user_interface.o vector.o 8 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmmain.a user_interface.o 9 | cd .. 10 | rd /q /s main.lib 11 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmphy.bat: -------------------------------------------------------------------------------- 1 | del libmphy.a 2 | md libphy.lib 3 | cd libphy.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libphy.a 5 | @rem phy.o phy_chip_v6.o phy_chip_v6_ana.o phy_chip_v6_cal.o phy_sleep.o 6 | @rem delete: ate_test.o phy_chip_v6_unused.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmphy.a phy.o phy_chip_v6.o phy_chip_v6_ana.o phy_chip_v6_cal.o phy_sleep.o 8 | cd .. 9 | rd /q /s libphy.lib 10 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmpp.bat: -------------------------------------------------------------------------------- 1 | del libmpp.a 2 | md libpp.lib 3 | cd libpp.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libpp.a 5 | @rem esf_buf.o if_hwctrl.o lmac.o mac_frame.o pm.o pm_for_bcn_only_mode.o pp.o rate_control.o trc.o wdev.o 6 | @del mac_frame.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmpp.a *.o 8 | cd .. 9 | rd /q /s libpp.lib 10 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libmwpa.bat: -------------------------------------------------------------------------------- 1 | del libmwpa.a 2 | md wpa.lib 3 | cd wpa.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libwpa.a 5 | @rem ap_config.o common.o ieee802_1x.o os_xtensa.o sta_info.o wpa.o wpa_auth.o 6 | @rem wpa_auth_ie.o wpa_common.o wpa_debug.o wpa_ie.o wpa_main.o wpabuf.o wpas_glue.o 7 | @del wpa_debug.o 8 | @del os_xtensa.o 9 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmwpa.a *.o 10 | cd .. 11 | rd /q /s wpa.lib 12 | -------------------------------------------------------------------------------- /lib/2.0.0/new_libnet80211new.bat: -------------------------------------------------------------------------------- 1 | del libnet80211_new.a 2 | cd libnet80211_new 3 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x ..\libnet80211.a 4 | del wl_cnx.o 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libnet80211_new.a *.o 6 | cd .. 7 | 8 | -------------------------------------------------------------------------------- /lib/2.0.0/o-asm.bat: -------------------------------------------------------------------------------- 1 | for %%a in (*.a) do ( 2 | md %%a.o 3 | cd %%a.o 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x ..\%%a 5 | for %%o in (*.o) do C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-objdump -S %%o > %%o.asm 6 | cd .. 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /lib/2.0.0/rom_files_list.txt: -------------------------------------------------------------------------------- 1 | _addsubsf3 2 | _addsubdf3 3 | _divdf3 4 | _divdi3 5 | _divsi3 6 | _extendsfdf2 7 | _fixdfsi 8 | _fixunsdfsi 9 | _fixunssfsi 10 | _floatsidf 11 | _floatsisf 12 | _floatunsidf 13 | _floatunsisf 14 | _muldf3 15 | _muldi3 16 | _mulsf3 17 | _truncdfsf2 18 | _udivdi3 19 | _udivsi3 20 | _umoddi3 21 | _umodsi3 22 | _umulsidi3 -------------------------------------------------------------------------------- /lib/clibsdk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @if not %1x==x goto aaa 3 | if exist ..\CreateLib\MinEspSDKLib.lib cd ..\CreateLib 4 | if exist ..\AutoMake\MinEspSDKLib.lib cd ..\AutoMake 5 | call ..\lib\clibsdk.bat MinEspSDKLib.lib 6 | cd ..\lib 7 | goto end 8 | :aaa 9 | if not exist %1 goto err_end 10 | if not exist ..\lib\libmmain.a goto err_end 11 | if not exist ..\lib\libmphy.a goto err_end 12 | if not exist ..\lib\libmwpa.a goto err_end 13 | if not exist ..\lib\libnet80211.a goto err_end 14 | if not exist ..\lib\libpp.a goto err_end 15 | if not exist ..\lib\libmgcc.a goto err_end 16 | if not exist ..\lib\libcrypto.a goto err_end 17 | if not exist _temp md _temp 18 | cd _temp 19 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\%1 20 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmmain.a 21 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmphy.a 22 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmwpa.a 23 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libnet80211.a 24 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libpp.a 25 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libmgcc.a 26 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\lib\libcrypto.a 27 | if exist ..\..\lib\libsdk.a del ..\..\lib\libsdk.a 28 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\..\lib\libsdk.a *.o 29 | cd .. 30 | rd /q /s _temp 31 | if exist ..\lib\libsdk.a goto end 32 | :err_end 33 | echo "Error!" 34 | :end -------------------------------------------------------------------------------- /lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libcrypto.a -------------------------------------------------------------------------------- /lib/libdhcps.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libdhcps.a -------------------------------------------------------------------------------- /lib/liblwipif.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/liblwipif.a -------------------------------------------------------------------------------- /lib/libmgcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libmgcc.a -------------------------------------------------------------------------------- /lib/libmlwip.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libmlwip.a -------------------------------------------------------------------------------- /lib/libmmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libmmain.a -------------------------------------------------------------------------------- /lib/libmmain.a.patch.txt: -------------------------------------------------------------------------------- 1 | Path libmmain.a - error deep_sleep 2 | 00001483: 08 82 3 | 00001484: 71 69 4 | 00001485: 12 42 5 | 00001486: C1 06 6 | 00001487: 20 FF 7 | 00001488: 82 FF 8 | 00001489: 69 0D 9 | 0000148A: 42 F0 10 | -------------------------------------------------------------------------------- /lib/libmphy.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libmphy.a -------------------------------------------------------------------------------- /lib/libmwpa.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libmwpa.a -------------------------------------------------------------------------------- /lib/libnet80211.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libnet80211.a -------------------------------------------------------------------------------- /lib/libpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libpp.a -------------------------------------------------------------------------------- /lib/libsdk.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/lib/libsdk.a -------------------------------------------------------------------------------- /lib/mlibsdk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist ..\app\sdklib\.output\eagle\lib\libsdk.a goto err_end 3 | del libsdk.a 4 | md sdklib 5 | cd sdklib 6 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\..\app\sdklib\.output\eagle\lib\libsdk.a 7 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmmain.a 8 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmphy.a 9 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmwpa.a 10 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libcrypto.a 11 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libnet80211.a 12 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libpp.a 13 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar xo ..\libmgcc.a 14 | c:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libsdk.a *.o 15 | cd .. 16 | rd /q /s sdklib 17 | goto end 18 | :err_end 19 | echo Error! 20 | :end -------------------------------------------------------------------------------- /lib/new_libdhcps.bat: -------------------------------------------------------------------------------- 1 | del libdhcps.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\liblwip.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libdhcps.a dhcpserver.o 6 | cd .. 7 | rd /q /s main.lib 8 | -------------------------------------------------------------------------------- /lib/new_liblwipif.bat: -------------------------------------------------------------------------------- 1 | del liblwipif.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libmain.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\liblwipif.a eagle_lwip_if.o 6 | cd .. 7 | rd /q /s main.lib 8 | -------------------------------------------------------------------------------- /lib/new_libmgcc.bat: -------------------------------------------------------------------------------- 1 | del libmgcc.a 2 | md libgcc 3 | cd libgcc 4 | @rem C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\xtensa-lx106-elf\lib\gcc\xtensa-lx106-elf\4.8.2\libgcc.a 5 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\xtensa-lx106-elf\lib\gcc\xtensa-lx106-elf\5.1.0\libgcc.a 6 | @rem delete: 7 | @rem _fixunsdfsi.o _umoddi3.o _umodsi3.o _extendsfdf2.o _fixdfsi.o _divsi3.o _divdf3.o _divdi3.o _fixunssfsi.o 8 | @rem _floatsidf.o _floatsisf.o _floatunsidf.o _floatunsisf.o _muldf3.o _muldi3.o _mulsf3.o _truncdfsf2.o 9 | @rem _udivdi3.o _udivsi3.o _umulsidi3.o _addsubdf3.o _addsubsf3.o 10 | for /f "delims=" %%f in (../rom_files_list.txt) do del "%%f.o" 11 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmgcc.a *.o 12 | cd .. 13 | rd /q /s libgcc 14 | -------------------------------------------------------------------------------- /lib/new_libmlwip.bat: -------------------------------------------------------------------------------- 1 | del libmlwip.a 2 | md lwip.lib 3 | cd lwip.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\liblwip.a 5 | @rem sockets.o api_lib.o api_msg.o err.o netbuf.o netdb.o netifapi.o tcpip.o def.o mem.o stats.o sys.o sys_arch.o autoip.o inet.o ip_frag.o 6 | @rem del: mdns.o dhcpserver.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmlwip.a dhcp.o dns.o init.o memp.o netif.o pbuf.o tcp.o tcp_in.o tcp_out.o timers.o udp.o icmp.o igmp.o inet_chksum.o ip.o ip_addr.o etharp.o raw.o 8 | cd .. 9 | rd /q /s lwip.lib 10 | -------------------------------------------------------------------------------- /lib/new_libmmain.bat: -------------------------------------------------------------------------------- 1 | del libmmain.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libmain.a 5 | @rem app_main.o debug-vector.o double-vector.o eagle_lib.o eagle_lwip_if.o ets_timer.o 6 | @rem kernel-vector.o mem_manager.o nmi-vector.o spi_flash.o spi_overlap.o time.o 7 | @rem user-vector.o user_interface.o vector.o 8 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmmain.a user_interface.o 9 | cd .. 10 | rd /q /s main.lib 11 | -------------------------------------------------------------------------------- /lib/new_libmmain1.5.4.bat: -------------------------------------------------------------------------------- 1 | del libmmain.a 2 | md main.lib 3 | cd main.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libmain.a 5 | @rem eagle_lib.o ets_timer.o mem_manager.o user_interface.o eagle_lwip_if.o 6 | @rem del: spi_flash.o app_main.o ets_timer.o eagle_lwip_if.o mem_manager.o eagle_lib.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmmain.a user_interface.o 8 | cd .. 9 | rd /q /s main.lib 10 | -------------------------------------------------------------------------------- /lib/new_libmphy.bat: -------------------------------------------------------------------------------- 1 | del libmphy.a 2 | md libphy.lib 3 | cd libphy.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libphy.a 5 | @rem phy.o phy_chip_v6.o phy_chip_v6_ana.o phy_chip_v6_cal.o phy_sleep.o 6 | @rem delete: ate_test.o phy_chip_v6_unused.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmphy.a phy.o phy_chip_v6.o phy_chip_v6_ana.o phy_chip_v6_cal.o phy_sleep.o 8 | cd .. 9 | rd /q /s libphy.lib 10 | -------------------------------------------------------------------------------- /lib/new_libmpp.bat: -------------------------------------------------------------------------------- 1 | del libmpp.a 2 | md libpp.lib 3 | cd libpp.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libpp.a 5 | @rem esf_buf.o if_hwctrl.o lmac.o mac_frame.o pm.o pm_for_bcn_only_mode.o pp.o rate_control.o trc.o wdev.o 6 | @del mac_frame.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmpp.a *.o 8 | cd .. 9 | rd /q /s libpp.lib 10 | -------------------------------------------------------------------------------- /lib/new_libmwpa.bat: -------------------------------------------------------------------------------- 1 | del libmwpa.a 2 | md wpa.lib 3 | cd wpa.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libwpa.a 5 | @rem ap_config.o common.o ieee802_1x.o os_xtensa.o sta_info.o wpa.o wpa_auth.o 6 | @rem wpa_auth_ie.o wpa_common.o wpa_debug.o wpa_ie.o wpa_main.o wpabuf.o wpas_glue.o 7 | @del wpa_debug.o 8 | @del os_xtensa.o 9 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmwpa.a *.o 10 | cd .. 11 | rd /q /s wpa.lib 12 | -------------------------------------------------------------------------------- /lib/new_libmwpa1.5.4.bat: -------------------------------------------------------------------------------- 1 | del libmwpa.a 2 | md wpa.lib 3 | cd wpa.lib 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x C:\Espressif\ESP8266_SDK\lib\libwpa.a 5 | @rem aes-internal-enc.o aes-wrap.o ap_config.o common.o ieee802_1x.o sta_info.o wpa.o wpa_auth.o wpa_auth_ie.o wpa_common.o wpa_ie.o wpa_main.o wpabuf.o wpas_glue.o 6 | @rem del: wpa_debug.o os_xtensa.o 7 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar ru ..\libmwpa.a ap_config.o common.o ieee802_1x.o sta_info.o wpa.o wpa_auth.o wpa_auth_ie.o wpa_common.o wpa_ie.o wpa_main.o wpabuf.o wpas_glue.o 8 | @rem none: aes-internal-enc.o aes-wrap.o 9 | cd .. 10 | rd /q /s wpa.lib 11 | -------------------------------------------------------------------------------- /lib/o-asm.bat: -------------------------------------------------------------------------------- 1 | for %%a in (*.a) do ( 2 | md %%a.o 3 | cd %%a.o 4 | C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar x ..\%%a 5 | for %%o in (*.o) do C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-objdump -S %%o > %%o.asm 6 | cd .. 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /lib/rom_files_list.txt: -------------------------------------------------------------------------------- 1 | _addsubsf3 2 | _addsubdf3 3 | _divdf3 4 | _divdi3 5 | _divsi3 6 | _extendsfdf2 7 | _fixdfsi 8 | _fixunsdfsi 9 | _fixunssfsi 10 | _floatsidf 11 | _floatsisf 12 | _floatunsidf 13 | _floatunsisf 14 | _muldf3 15 | _muldi3 16 | _mulsf3 17 | _truncdfsf2 18 | _udivdi3 19 | _udivsi3 20 | _umoddi3 21 | _umodsi3 22 | _umulsidi3 -------------------------------------------------------------------------------- /mem.txt: -------------------------------------------------------------------------------- 1 | Section| Description| Start (hex)| End (hex)|Used space 2 | ------------------------------------------------------------------------------ 3 | data| Initialized Data (RAM)| 3FFE8000| 3FFE83F0| 1008 4 | rodata| ReadOnly Data (RAM)| 3FFE83F0| 3FFE8E20| 2608 5 | bss| Uninitialized Data (RAM)| 3FFE8E20| 3FFEF198| 25464 6 | text| Cached Code (IRAM)| 40100000| 40105690| 22160 7 | irom0_text| Uncached Code (SPI)| 40207000| 40241859| 239705 8 | Total Used RAM : 29080 9 | Free RAM : 52840 10 | Free IRam : 10626 11 | -------------------------------------------------------------------------------- /mem_usage.bat: -------------------------------------------------------------------------------- 1 | C:\Espressif\utils\MemAnalyzer.exe C:\Espressif\xtensa-lx106-elf\bin\xtensa-lx106-elf-objdump.exe .\app\.output\eagle\image\eagle.app.v6.out >>mem.txt 2 | -------------------------------------------------------------------------------- /ovls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: cp1251 -*- 3 | ''' 4 | test webfs_upload.py 5 | Created on 06/03/2016. 6 | 7 | @author: PVV 8 | ''' 9 | # 10 | # 11 | # 12 | import sys 13 | #import argparse 14 | import os 15 | import subprocess 16 | 17 | if __name__ == '__main__': 18 | if len(sys.argv) == 2: 19 | if sys.argv[1] == '-h': 20 | print 'Usage: labels.py eagle.app.v6.out labels.ld' 21 | sys.exit(0) 22 | elfname = "..\\app\\.output\\eagle\\image\\eagle.app.v6.out" 23 | filename = "..\\ld\\labels.ld" 24 | 25 | if len(sys.argv) > 1: 26 | if sys.argv[1]: 27 | elfname = sys.argv[1] 28 | if len(sys.argv) > 2: 29 | if sys.argv[2]: 30 | filename = sys.argv[2] 31 | symbols = {} 32 | try: 33 | ff = open(filename, "w") 34 | except: 35 | print "Error file open " + filename 36 | exit(1) 37 | try: 38 | tool_nm = "C:\\Espressif\\xtensa-lx106-elf\\bin\\xtensa-lx106-elf-nm.exe" 39 | if os.getenv("XTENSA_CORE") == "lx106": 40 | tool_nm = "xt-nm" 41 | proc = subprocess.Popen([tool_nm, "-n", elfname], stdout=subprocess.PIPE) 42 | except OSError: 43 | print "Error calling " + tool_nm + ", do you have Xtensa toolchain in PATH?" 44 | exit(1) 45 | for l in proc.stdout: 46 | fields = l.strip().split() 47 | try: 48 | symbols[fields[2]] = int(fields[0], 16) 49 | # print fields[2] + "\t" + fields[0] 50 | try: 51 | if fields[2].find("$") == -1 : 52 | if fields[2] != "call_user_start": 53 | ff.write("PROVIDE\t("+ fields[2] + " = 0x" + fields[0] + ");\n") 54 | except: 55 | print "Error write files: " + filename + " !" 56 | exit(1) 57 | except ValueError as verr: 58 | pass 59 | except Exception as ex: 60 | pass 61 | ff.close() 62 | exit(0) -------------------------------------------------------------------------------- /ovls/ovls.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/ovls/ovls.7z -------------------------------------------------------------------------------- /read_firmware.bat: -------------------------------------------------------------------------------- 1 | rem esptool.py --port COM9 -b 460800 read_flash 0 524288 firmware.bin 2 | esptool.py --port COM5 -b 460800 read_flash %1 %2 %3 3 | -------------------------------------------------------------------------------- /webbin/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | WEBFiles.bin: 3 | ../WEBFS22.exe -h "*.htm, *.html, *.cgi, *.xml, *.bin, *.txt, *.wav, *.csv" -z "mdbini.bin, *.inc, *.ini, snmp.bib, *.ovl" ../WEBFiles ../webbin WEBFiles.bin 4 | 5 | PDIR := ../$(PDIR) 6 | sinclude $(PDIR)Makefile 7 | 8 | .PHONY: FORCE 9 | FORCE: 10 | -------------------------------------------------------------------------------- /webbin/WEBFS22.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/webbin/WEBFS22.zip -------------------------------------------------------------------------------- /webbin/WEBFiles_tiny.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/webbin/WEBFiles_tiny.7z -------------------------------------------------------------------------------- /webbin/WEBFiles_tiny.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/webbin/WEBFiles_tiny.bin -------------------------------------------------------------------------------- /webbin/compress_java.bat: -------------------------------------------------------------------------------- 1 | java -jar yuicompressor.jar %1.js -o %1-min.js 2 | -------------------------------------------------------------------------------- /webbin/example_WEBFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/webbin/example_WEBFiles.bin -------------------------------------------------------------------------------- /webbin/example_iot_cloud.ini: -------------------------------------------------------------------------------- 1 | iot_server=api.thingspeak.com 2 | iot_add_15000=/update?api_key=xxxxxxxxxxxxxxxx&field1=~LastCnt_Fill~&headers=false 3 | <- '\0' must be here! 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /webbin/yuicompressor.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vad7/PowerMeter-IrDA/f2e4beb69913c21584ddb63695935cd5d3ebc060/webbin/yuicompressor.jar -------------------------------------------------------------------------------- /webfs/README.md: -------------------------------------------------------------------------------- 1 | # esp8266webfs 2 | 3 | Программа для формирования и обслуживания web-диска на Python v2.7.
4 | Проект не закончен и находится в начальной стадии.
5 | Пока содержит два варианта примера загрузчика готового диска на ESP8266 по HTTP.
6 | 7 | -------------------------------------------------------------------------------- /webfs/webfs_upload2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: cp1251 -*- 3 | ''' 4 | test webfs_upload.py 5 | Created on 27/09/2015. 6 | 7 | @author: PVV 8 | ''' 9 | # 10 | # Use module 'requests' - http://docs.python-requests.org/ 11 | # 12 | 13 | import requests 14 | from requests.auth import HTTPBasicAuth 15 | 16 | 17 | if __name__ == '__main__': 18 | espurl = 'http://192.168.4.1/fsupload' 19 | username = 'ESP8266' 20 | password = '0123456789' 21 | filename = '../webbin/WEBFiles.bin' 22 | 23 | files = {'file': (filename, open(filename, 'rb'), 'application/octet-stream')} 24 | # postdata = {'':''} 25 | # headers = {'Connection' : 'keep-alive'} 26 | 27 | s = requests.Session() 28 | # q = s.post(theurl, auth=HTTPBasicAuth(username, password), headers=headers, data=postdata, files=files) 29 | q = s.post(espurl, auth=HTTPBasicAuth(username, password), files=files) 30 | print(q.status_code) 31 | -------------------------------------------------------------------------------- /write_firmware.bat: -------------------------------------------------------------------------------- 1 | rem esptool.py --port COM9 -b 460800 read_flash 0 524288 firmware.bin 2 | rem esptool.py --port COM5 -b 460800 write_flash -ff 80m -fm qio -fs 32m 0x99000 0x00000.bin 3 | esptool.py --port COM5 -b 460800 write_flash -ff 80m -fm qio -fs 32m %1 %2 4 | --------------------------------------------------------------------------------