mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2024-11-24 23:14:19 +00:00
update
This commit is contained in:
parent
3147c97e3f
commit
437e8beb33
8 changed files with 102 additions and 49 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>RAM Start addr</td>
|
||||
<td><input type="text" id="start" size="12" maxlength="10" value="0x1FFF0000"></td>
|
||||
<td><input type="text" id="start" size="12" maxlength="10" value="0x10000000"></td>
|
||||
<td><input type="button" onClick="NewCookie(-256)" value="-0x100" class="button"></td>
|
||||
<td><input type="button" onClick="NewCookie(0)" value="Show" class="button"></td>
|
||||
<td><input type="button" onClick="NewCookie(+256)" value="+0x100" class="button"></td>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>Write addr, value:</td>
|
||||
<td><input type="text" id="set_ramaddr" size="12" maxlength="10" value="0x1FFF0000"></td>
|
||||
<td><input type="text" id="set_ramaddr" size="12" maxlength="10" value="0x10000000"></td>
|
||||
<td><input type="text" id="set_ramdata" size="12" maxlength="10" value="0x12345678"></td>
|
||||
<td><input type="button" onClick="SendRamVal(0)" value="Write" class="button"></td>
|
||||
</tr>
|
||||
|
@ -34,7 +34,6 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="footer">
|
||||
Protected area: 0x9A000000..0xFFFFFFFF !<br>
|
||||
<a href='/protect2/hexdmpb.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
</div>
|
||||
<script src="cookie.js"></script>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>RAM Start addr   </td>
|
||||
<td><input type="text" id="start" size="12" maxlength="10" value="0x1FFF0000"></td>
|
||||
<td><input type="text" id="start" size="12" maxlength="10" value="0x10000000"></td>
|
||||
<td><input type=button onClick="NewCookie(-256)" value="-0x100" class="button"></td>
|
||||
<td><input type=button onClick="NewCookie(0)" value="Show" class="button"></td>
|
||||
<td><input type=button onClick="NewCookie(+256)" value="+0x100" class="button"></td>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>Write addr, value:</td>
|
||||
<td><input type="text" id="set_ramaddr" size="12" maxlength="10" value="0x1FFF0000"></td>
|
||||
<td><input type="text" id="set_ramaddr" size="12" maxlength="10" value="0x10000000"></td>
|
||||
<td><input type="text" id="set_ramdata" size="12" maxlength="10" value="0x12345678"></td>
|
||||
<td><input type="button" onClick="SendRamVal(0)" value="Write" class="button"></td>
|
||||
</tr>
|
||||
|
@ -34,7 +34,6 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="footer">
|
||||
Protected area: 0x9A000000..0xFFFFFFFF !<br>
|
||||
<a href='/protect2/hexdmpd.txt?start=0x98000000&stop=0x98100000'>HEX Dump Flash 1024k</a>
|
||||
</div>
|
||||
<script src="cookie.js"></script>
|
||||
|
|
|
@ -34,26 +34,16 @@
|
|||
<td><a href='ram.bin?start=0x98000000&stop=0x98100000'>0x98000000..0x98100000</a></td>
|
||||
<td>1024 kbytes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>I/O SoC:</td>
|
||||
<td><a href='ram.bin?start=0x40000000&stop=0x40080000'>0x40000000..0x40080000</a></td>
|
||||
<td>.. kbytes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ARM:</td>
|
||||
<td><a href='ram.bin?start=0xEF000000&stop=0xEFFFFFFF'>0xEF000000..0xEFFFFFFF</a></td>
|
||||
<td>.. kbytes</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="form">
|
||||
<tr>
|
||||
<td class="label">Start addr</td>
|
||||
<td><input type="text" id="rams" size=12 maxlength=10 value="0x3FF00000"></td>
|
||||
<td><input type="text" id="rams" size=12 maxlength=10 value="0x10000000"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">End addr</td>
|
||||
<td><input type="text" id="rame" size=12 maxlength=10 value="0x40800000"></td>
|
||||
<td><input type="text" id="rame" size=12 maxlength=10 value="0x10070000"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="center"><input type="button" onClick="NewCookie()" value="Download ram.bin" class="button"></p>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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, "=<pin>,<period>,<pulse>: PWM Test" }
|
||||
};
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
#define mMIN(a, b) ((a<b)?a:b)
|
||||
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
||||
|
||||
#define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); }
|
||||
#define CloseFlash() { SpicDisableRtl8195A(); device_mutex_unlock(RT_DEV_LOCK_FLASH); }
|
||||
|
||||
|
||||
extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */
|
||||
|
||||
|
||||
|
@ -230,16 +234,22 @@ void ICACHE_FLASH_ATTR web_hexdump(TCP_SERV_CONN *ts_conn)
|
|||
int i;
|
||||
web_conn->udata_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
|
||||
|
|
|
@ -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 и т.д.
|
||||
|
|
Loading…
Reference in a new issue