From 437e8beb336e4debfb2a8ef37d614a8da27235f7 Mon Sep 17 00:00:00 2001 From: pvvx Date: Sun, 14 May 2017 05:55:03 +0300 Subject: [PATCH] update --- WEBFiles/protect2/cookie.js | 26 +++++++++---------- WEBFiles/protect2/hexdmpb.htm | 5 ++-- WEBFiles/protect2/hexdmpd.htm | 5 ++-- WEBFiles/protect2/tstfuncs.htm | 14 ++-------- project/inc/web/web_utils.h | 15 +++++++++++ project/src/console/pwm_tst.c | 7 +---- project/src/web/web_int_callbacks.c | 39 +++++++++++++++++++--------- project/src/web/web_utils.c | 40 +++++++++++++++++++++++++++++ 8 files changed, 102 insertions(+), 49 deletions(-) diff --git a/WEBFiles/protect2/cookie.js b/WEBFiles/protect2/cookie.js index ea8a307..0358dc0 100644 --- a/WEBFiles/protect2/cookie.js +++ b/WEBFiles/protect2/cookie.js @@ -24,18 +24,18 @@ function setCookieElem(name, defv) { function NewCookie(add) { var val = parseInt(document.getElementById('start').value, 16) & 0xFFFFFFF0; if (val == NaN) - setCookieElem('start', '0x40000000'); + setCookieElem('start', '0x10000000'); else { val += add; - setCookie('start', '0x' + val.toString(16)); + setCookie('start', '0x' + (val >>> 0).toString(16)); var nval = val + 256; - setCookie('stop', '0x' + nval.toString(16)); - document.getElementById('start').value = '0x' + val.toString(16); + setCookie('stop', '0x' + (nval >>> 0).toString(16)); + document.getElementById('start').value = '0x' + (val >>> 0).toString(16); document.getElementById('pmem').contentWindow.location.reload(); } } -setCookieElem('start', '0x40000000'); -setCookieElem('set_ramaddr', '0x3FFF0000'); +setCookieElem('start', '0x10000000'); +setCookieElem('set_ramaddr', '0x10000000'); setCookieElem('set_ramdata', '0x12345678'); function UpTxt(xD, n, v) { var x = getXMLValue(xD, n, v); @@ -55,16 +55,16 @@ function SendRamVal(x) { var addr = parseInt(document.getElementById('set_ramaddr').value, 16); var val = parseInt(document.getElementById('set_ramdata').value, 16); if (addr != NaN && val != NaN) { - document.getElementById('set_ramaddr').value = '0x' + addr.toString(16); - setCookie('set_ramaddr','0x' + addr.toString(16)); - document.getElementById('set_ramdata').value = '0x' + val.toString(16); - setCookie('set_ramdata','0x' + val.toString(16)); + document.getElementById('set_ramaddr').value = '0x' + (addr >>> 0).toString(16); + setCookie('set_ramaddr','0x' + (addr >>> 0).toString(16)); + document.getElementById('set_ramdata').value = '0x' + (val >>> 0).toString(16); + setCookie('set_ramdata','0x' + (val >>> 0).toString(16)); if (x != 0) - newAJAXCommand('chiprams.xml?start=0x' + addr.toString(16), + newAJAXCommand('chiprams.xml?start=0x' + (addr >>> 0).toString(16), UpdateValuesRam, 0); else - newAJAXCommand('chiprams.xml?sys_ram0x' + addr.toString(16) + '=0x' - + val.toString(16) + '&start=0x' + addr.toString(16), + newAJAXCommand('chiprams.xml?sys_ram0x' + (addr >>> 0).toString(16) + '=0x' + + val.toString(16) + '&start=0x' + (addr >>> 0).toString(16), UpdateValuesRam, 0); } } \ No newline at end of file diff --git a/WEBFiles/protect2/hexdmpb.htm b/WEBFiles/protect2/hexdmpb.htm index 098f1ed..6c7748b 100644 --- a/WEBFiles/protect2/hexdmpb.htm +++ b/WEBFiles/protect2/hexdmpb.htm @@ -11,7 +11,7 @@ - + @@ -21,7 +21,7 @@
RAM Start addr
- + @@ -34,7 +34,6 @@
Write addr, value:
diff --git a/WEBFiles/protect2/hexdmpd.htm b/WEBFiles/protect2/hexdmpd.htm index 3b30c46..38bafbf 100644 --- a/WEBFiles/protect2/hexdmpd.htm +++ b/WEBFiles/protect2/hexdmpd.htm @@ -11,7 +11,7 @@ - + @@ -21,7 +21,7 @@
RAM Start addr   
- + @@ -34,7 +34,6 @@
Write addr, value:
diff --git a/WEBFiles/protect2/tstfuncs.htm b/WEBFiles/protect2/tstfuncs.htm index 417e3ed..da1a0c0 100644 --- a/WEBFiles/protect2/tstfuncs.htm +++ b/WEBFiles/protect2/tstfuncs.htm @@ -34,26 +34,16 @@ 0x98000000..0x98100000 1024 kbytes - - I/O SoC: - 0x40000000..0x40080000 - .. kbytes - - - ARM: - 0xEF000000..0xEFFFFFFF - .. kbytes - - + - +
Start addr
End addr

diff --git a/project/inc/web/web_utils.h b/project/inc/web/web_utils.h index b96d1c1..8d00c33 100644 --- a/project/inc/web/web_utils.h +++ b/project/inc/web/web_utils.h @@ -8,6 +8,21 @@ #ifndef _INCLUDE_WEB_UTILS_H_ #define _INCLUDE_WEB_UTILS_H_ +typedef enum { + SEG_ID_ROM = 0, + SEG_ID_SRAM, + SEG_ID_TCM, + SEG_ID_FLASH, + SEG_ID_SDRAM, + SEG_ID_SOC, + SEG_ID_CPU, + SEG_ID_ERR, + SEG_ID_MAX +} SEG_ID; + +extern const uint32 tab_seg_def[]; +SEG_ID get_seg_id(uint32 addr, int32 size); + int rom_atoi(const char *s); void copy_align4(void *ptrd, void *ptrs, uint32 len); uint32 hextoul(uint8 *s); diff --git a/project/src/console/pwm_tst.c b/project/src/console/pwm_tst.c index 5e995c3..95f0a1d 100644 --- a/project/src/console/pwm_tst.c +++ b/project/src/console/pwm_tst.c @@ -44,16 +44,11 @@ LOCAL void fATPWM(int argc, char *argv[]) { }; } -LOCAL void fATWLED(int argc, char *argv[]) { - HalPinCtrlRtl8195A(WL_LED, 2, 1); - HalPinCtrlRtl8195A(EGTIM, ahextoul(argv[1]), 1); -} //------------------------------------------------------------------------------ // atpwm=34,1048575,524287 // atpwm=34,122,61 (8.187kHz) // atsw 40000368 85001002 (8.187kHz) // atsd 40000360 6 -MON_RAM_TAB_SECTION COMMAND_TABLE console_commands_adc[] = { - { "ATWLED", 0, fATWLED, ": WLED Test" }, +MON_RAM_TAB_SECTION COMMAND_TABLE console_commands_pwm[] = { { "ATPWM", 3, fATPWM, "=,,: PWM Test" } }; diff --git a/project/src/web/web_int_callbacks.c b/project/src/web/web_int_callbacks.c index 4ce4f51..72fd6ce 100644 --- a/project/src/web/web_int_callbacks.c +++ b/project/src/web/web_int_callbacks.c @@ -53,6 +53,10 @@ #define mMIN(a, b) ((audata_stop &= 0xfffffff0; while(web_conn->msgbuflen + (9+3*16+17+2) <= web_conn->msgbufsize) { - if((uint32)addr < 0x9A000000) { +// if((uint32)addr < 0x9A000000) { + if((uint32)addr >= 0x98000000 && (uint32)addr < 0x9A000000) { + OpenFlash(); + } tcp_puts("%08x", addr); for(i=0 ; i < 4 ; i++) data.dw[i] = *addr++; web_conn->udata_start = (uint32)addr; - if(ts_conn->flag.user_option1) { + if(ts_conn->flag.user_option1) { // dword or byte ? for(i=0 ; i < 4 ; i++) tcp_puts(" %08x", data.dw[i]); } else { for(i=0 ; i < 16 ; i++) tcp_puts(" %02x", data.b[i]); } + if((uint32)addr >= 0x98000000 && (uint32)addr < 0x9A000000) { + CloseFlash(); + } tcp_put(' '); tcp_put(' '); for(i=0 ; i < 16 ; i++) tcp_put((data.b[i] >=' ' && data.b[i] != 0x7F)? data.b[i] : '.'); tcp_puts("\r\n"); @@ -248,13 +258,12 @@ void ICACHE_FLASH_ATTR web_hexdump(TCP_SERV_CONN *ts_conn) if(!CheckSCB(SCB_WEBSOC)) SetSCB(SCB_FCLOSE | SCB_DISCONNECT); // connection close return; } - } - else { - tcp_puts("%p = Bad address!\r\n", addr); - ClrSCB(SCB_RETRYCB); - if(!CheckSCB(SCB_WEBSOC)) SetSCB(SCB_FCLOSE | SCB_DISCONNECT); // connection close - return; - }; +// } else { +// tcp_puts("%p = Bad address!\r\n", addr); +// ClrSCB(SCB_RETRYCB); +// if(!CheckSCB(SCB_WEBSOC)) SetSCB(SCB_FCLOSE | SCB_DISCONNECT); // connection close +// return; +// }; } // repeat in the next call ... SetSCB(SCB_RETRYCB); @@ -283,18 +292,18 @@ void ICACHE_FLASH_ATTR web_get_flash(TCP_SERV_CONN *ts_conn) #if DEBUGSOO > 2 os_printf("%08x..%08x ",web_conn->udata_start, web_conn->udata_start + len ); #endif -// device_mutex_lock(RT_DEV_LOCK_FLASH); + device_mutex_lock(RT_DEV_LOCK_FLASH); if(spi_flash_read(web_conn->udata_start, web_conn->msgbuf, len)) { web_conn->udata_start += len; web_conn->msgbuflen += len; if(web_conn->udata_start < web_conn->udata_stop) { SetNextFunSCB(web_get_flash); -// device_mutex_unlock(RT_DEV_LOCK_FLASH); + device_mutex_unlock(RT_DEV_LOCK_FLASH); SetSCB(SCB_RETRYCB); return; }; }; -// device_mutex_unlock(RT_DEV_LOCK_FLASH); + device_mutex_unlock(RT_DEV_LOCK_FLASH); ClrSCB(SCB_RETRYCB); // SetSCB(SCB_FCLOSE | SCB_DISCONNECT); return; @@ -320,7 +329,13 @@ void ICACHE_FLASH_ATTR web_get_ram(TCP_SERV_CONN *ts_conn) } // Get/put as many bytes as possible uint32 len = mMIN(web_conn->msgbufsize - web_conn->msgbuflen, web_conn->udata_stop - web_conn->udata_start); + if((uint32)web_conn->udata_start >= 0x98000000 && (uint32)web_conn->udata_start < 0x9A000000) { + OpenFlash(); + } copy_align4(web_conn->msgbuf, (void *)(web_conn->udata_start), len); + if((uint32)web_conn->udata_start >= 0x98000000 && (uint32)web_conn->udata_start < 0x9A000000) { + CloseFlash(); + } web_conn->msgbuflen += len; web_conn->udata_start += len; #if DEBUGSOO > 2 diff --git a/project/src/web/web_utils.c b/project/src/web/web_utils.c index b6c704f..1adb718 100644 --- a/project/src/web/web_utils.c +++ b/project/src/web/web_utils.c @@ -95,6 +95,46 @@ int ICACHE_FLASH_ATTR rom_atoi(const char *s) n = 10*n - (*s++ - '0'); return neg ? n : -n; } + +/****************************************************************************** + * get_seg_id() +*******************************************************************************/ +const char * const txt_tab_seg[] = { + "ROM" // 0 + "SRAM", // 1 + "TCM", // 2 + "FLASH", // 3 // -> flash On + "SDRAM", // 4 // -> Test ChipID or HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Off + "SOC", // 5 // protected ! + "CPU", // 6 // protected ! + "UNK", // 7 + }; + +const uint32 tab_seg_def[] = { + 0x00000000, 0x00050000, + 0x10000000, 0x10070000, + 0x1fff0000, 0x20000000, + 0x98000000, 0xA0000000, + 0x30000000, 0x30200000, + 0x40000000, 0x40800000, + 0xE0000000, 0xE0010000, + 0x00000000, 0xFFFFFFFF +}; + +SEG_ID get_seg_id(uint32 addr, int32 size) { + SEG_ID ret = SEG_ID_ERR; + uint32 * ptr = &tab_seg_def; + if (size > 0) { + do { + ret++; + if (addr >= ptr[0] && addr + size <= ptr[1]) { + return ret; + }; + ptr += 2; + } while (ret < SEG_ID_MAX); + }; + return 0; +} /****************************************************************************** * copy_align4 * копирует данные из области кеширования flash и т.д.