mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2024-11-24 06:54:20 +00:00
update
This commit is contained in:
parent
b3dc0dda87
commit
0830a1244a
29 changed files with 240 additions and 152 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
.dygraph-legend {
|
.dygraph-legend {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
width: 250px; /* labelsDivWidth */
|
width: 250px; /* labelsDivWidth */
|
||||||
/*
|
/*
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
.dygraph-axis-label {
|
.dygraph-axis-label {
|
||||||
/* position: absolute; */
|
/* position: absolute; */
|
||||||
/* font-size: 14px; */
|
font-size: 12px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
@ -10,83 +10,35 @@ var process = module.exports = {};
|
||||||
var cachedSetTimeout;
|
var cachedSetTimeout;
|
||||||
var cachedClearTimeout;
|
var cachedClearTimeout;
|
||||||
|
|
||||||
function defaultSetTimout() {
|
|
||||||
throw new Error('setTimeout has not been defined');
|
|
||||||
}
|
|
||||||
function defaultClearTimeout () {
|
|
||||||
throw new Error('clearTimeout has not been defined');
|
|
||||||
}
|
|
||||||
(function () {
|
(function () {
|
||||||
try {
|
try {
|
||||||
if (typeof setTimeout === 'function') {
|
cachedSetTimeout = setTimeout;
|
||||||
cachedSetTimeout = setTimeout;
|
|
||||||
} else {
|
|
||||||
cachedSetTimeout = defaultSetTimout;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
cachedSetTimeout = defaultSetTimout;
|
cachedSetTimeout = function () {
|
||||||
|
throw new Error('setTimeout is not defined');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (typeof clearTimeout === 'function') {
|
cachedClearTimeout = clearTimeout;
|
||||||
cachedClearTimeout = clearTimeout;
|
|
||||||
} else {
|
|
||||||
cachedClearTimeout = defaultClearTimeout;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
cachedClearTimeout = defaultClearTimeout;
|
cachedClearTimeout = function () {
|
||||||
|
throw new Error('clearTimeout is not defined');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} ())
|
} ())
|
||||||
function runTimeout(fun) {
|
function runTimeout(fun) {
|
||||||
if (cachedSetTimeout === setTimeout) {
|
if (cachedSetTimeout === setTimeout) {
|
||||||
//normal enviroments in sane situations
|
|
||||||
return setTimeout(fun, 0);
|
return setTimeout(fun, 0);
|
||||||
|
} else {
|
||||||
|
return cachedSetTimeout.call(null, fun, 0);
|
||||||
}
|
}
|
||||||
// if setTimeout wasn't available but was latter defined
|
|
||||||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
||||||
cachedSetTimeout = setTimeout;
|
|
||||||
return setTimeout(fun, 0);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
||||||
return cachedSetTimeout(fun, 0);
|
|
||||||
} catch(e){
|
|
||||||
try {
|
|
||||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
||||||
return cachedSetTimeout.call(null, fun, 0);
|
|
||||||
} catch(e){
|
|
||||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
||||||
return cachedSetTimeout.call(this, fun, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function runClearTimeout(marker) {
|
function runClearTimeout(marker) {
|
||||||
if (cachedClearTimeout === clearTimeout) {
|
if (cachedClearTimeout === clearTimeout) {
|
||||||
//normal enviroments in sane situations
|
clearTimeout(marker);
|
||||||
return clearTimeout(marker);
|
} else {
|
||||||
|
cachedClearTimeout.call(null, marker);
|
||||||
}
|
}
|
||||||
// if clearTimeout wasn't available but was latter defined
|
|
||||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
||||||
cachedClearTimeout = clearTimeout;
|
|
||||||
return clearTimeout(marker);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
||||||
return cachedClearTimeout(marker);
|
|
||||||
} catch (e){
|
|
||||||
try {
|
|
||||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
||||||
return cachedClearTimeout.call(null, marker);
|
|
||||||
} catch (e){
|
|
||||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
||||||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
||||||
return cachedClearTimeout.call(this, marker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
var queue = [];
|
var queue = [];
|
||||||
var draining = false;
|
var draining = false;
|
||||||
|
|
|
@ -26,7 +26,7 @@ var gu = new Dygraph(
|
||||||
series : {
|
series : {
|
||||||
'U': { axis: 'y2' }
|
'U': { axis: 'y2' }
|
||||||
}
|
}
|
||||||
, axes: { y2: {valueRange: [3000, 3500] }}
|
// , axes: { y2: {valueRange: [3000, 3500] }}
|
||||||
// , axes: { y2: {valueRange: [3000, 3500] }, y: {valueRange: [0, 2] }}
|
// , axes: { y2: {valueRange: [3000, 3500] }, y: {valueRange: [0, 2] }}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ var rdnextflg = false;
|
||||||
var cur_idx = 0;
|
var cur_idx = 0;
|
||||||
var sig = 10;
|
var sig = 10;
|
||||||
var ttout = 100;
|
var ttout = 100;
|
||||||
|
var wstt;
|
||||||
function wsping() { ws.send('ina219'); wstt = setTimeout(wsping, ttout);};
|
function wsping() { ws.send('ina219'); wstt = setTimeout(wsping, ttout);};
|
||||||
ws = new WebSocket('ws://rtl871x0/web.cgi');
|
ws = new WebSocket('ws://rtl871x0/web.cgi');
|
||||||
ws.binaryType = 'arraybuffer';
|
ws.binaryType = 'arraybuffer';
|
||||||
|
|
|
@ -1,40 +1,55 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="dygraph.css">
|
<link rel="stylesheet" href="ina2.css">
|
||||||
<title>Get data INA219</title>
|
<title>Get data INA219</title>
|
||||||
<script type="text/javascript" src="dygraph.min.js"></script>
|
<script type="text/javascript" src="dygraph.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3 style="width:800px; text-align: center;">U & I (INA219)</h3>
|
<div style="width:1000px; height:500px;">
|
||||||
<div id="div_v" style="width:800px; height:400px;"></div>
|
<div id="div_v" style="width:100%; height:400px;"></div>
|
||||||
<script type="text/javascript">
|
<p style="text-align: center;">
|
||||||
var datau = [];
|
<input type="button" id="butOnOff" value="Stop">
|
||||||
//var datai = [];
|
<input type="radio" name='rm1' id="FixEnd"/>
|
||||||
var gu = new Dygraph(
|
<label for="FixEnd">Fixed</label>
|
||||||
document.getElementById("div_v"),
|
<input type="radio" checked name='rm1' id="FixNone"/>
|
||||||
datau,
|
<label for="FixNone">Float</label><br>
|
||||||
{
|
Window: <span id='wdsize'>?</span> sec<br>
|
||||||
showRangeSelector: true,
|
Sample Rate: <span id='smprate'>?</span> smps
|
||||||
labels: ['X', 'U', 'I'],
|
</p>
|
||||||
// drawPoints: true,
|
<div id='labdiv' style="text-align: center;"></div>
|
||||||
// rollPeriod: 2,
|
</div>
|
||||||
// errorBars: true,
|
|
||||||
// showRoller: true,
|
|
||||||
ylabel: 'U(mV)',
|
|
||||||
y2label: 'I(mA)',
|
|
||||||
series : {
|
|
||||||
'I': { axis: 'y2' }
|
|
||||||
}
|
|
||||||
// , axes: { y: {valueRange: [3000, 3500] }, y2: {valueRange: [0, 30] }}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var $ = function(id) {
|
||||||
|
return document.getElementById(id);
|
||||||
|
}
|
||||||
|
var stg = 0;
|
||||||
|
var smprate = 1819;
|
||||||
|
var smps = smprate;
|
||||||
|
var samples = 10*smprate;
|
||||||
|
var rend = 1;
|
||||||
var oldblkid = 0;
|
var oldblkid = 0;
|
||||||
var rdnextflg = false;
|
var rdnextflg = false;
|
||||||
var cur_idx = 0;
|
var cur_idx = 0;
|
||||||
var sig = 10;
|
var sttim = 0;
|
||||||
function wsping() {ws.send('ina219'); wstt = setTimeout(wsping, 50);};
|
$("butOnOff").onclick = function() {
|
||||||
|
if(rend) {
|
||||||
|
rend = 0;
|
||||||
|
$("butOnOff").value = "Run";
|
||||||
|
} else {
|
||||||
|
rend = 1;
|
||||||
|
$("butOnOff").value = "Stop";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var datau = [];
|
||||||
|
var gu;
|
||||||
|
//window.onresize= function(){// alert('Ðàçìåðû div #Test èçìåíåíû.');}
|
||||||
|
function wsping() {
|
||||||
|
clearTimeout(wstt);
|
||||||
|
ws.send('ina219');
|
||||||
|
wstt = setTimeout(wsping, 500);
|
||||||
|
}
|
||||||
ws = new WebSocket('ws://rtl871x0/web.cgi');
|
ws = new WebSocket('ws://rtl871x0/web.cgi');
|
||||||
ws.binaryType = 'arraybuffer';
|
ws.binaryType = 'arraybuffer';
|
||||||
ws.onopen = function(){ ws.send('user=rtl871x:supervisor'); ws.send('sys_debug=0'); wstt = setTimeout(wsping, 50);};
|
ws.onopen = function(){ ws.send('user=rtl871x:supervisor'); ws.send('sys_debug=0'); wstt = setTimeout(wsping, 50);};
|
||||||
|
@ -45,21 +60,79 @@ ws.onmessage = function (event) {
|
||||||
if(wordarray.length > 2) {
|
if(wordarray.length > 2) {
|
||||||
var blksz = wordarray[0];
|
var blksz = wordarray[0];
|
||||||
if(wordarray.length == blksz*2 + 2) {
|
if(wordarray.length == blksz*2 + 2) {
|
||||||
var blkid = wordarray[1] & 0xFFFF;
|
if(!sttim) {
|
||||||
if(rdnextflg) {
|
sttim = new Date().getTime();
|
||||||
cur_idx += (blkid - oldblkid) & 0xFFFF;
|
setInterval(function(){wsSmpRate()}, 500);
|
||||||
} else rdnextflg = true;
|
} else {
|
||||||
oldblkid = blkid + blksz;
|
var blkid = wordarray[1] & 0xFFFF;
|
||||||
for (var i=2; i<wordarray.length; i+=2) {
|
if(rdnextflg) {
|
||||||
if(cur_idx > 10000 ) datau.shift();
|
cur_idx += (blkid - oldblkid) & 0xFFFF;
|
||||||
datau.push([cur_idx*0.001, wordarray[i]*0.5, wordarray[i+1]*0.1]);
|
} else rdnextflg = true;
|
||||||
cur_idx++;
|
oldblkid = blkid + blksz;
|
||||||
}
|
for (var i=2; i<wordarray.length; i+=2) {
|
||||||
gu.updateOptions({'file':datau});
|
if(rend) {
|
||||||
}
|
if(cur_idx >= samples ) datau.shift();
|
||||||
wstt = setTimeout(wsping, 50);
|
if(wordarray[i] & 2) datau.push([cur_idx/smprate, wordarray[i]*0.0005, wordarray[i+1]*0.1]);
|
||||||
}
|
else datau.push([cur_idx/smprate]);
|
||||||
}
|
}
|
||||||
|
cur_idx++;
|
||||||
|
}
|
||||||
|
if(!stg) {
|
||||||
|
gu = new Dygraph(
|
||||||
|
$("div_v"),
|
||||||
|
datau,
|
||||||
|
{
|
||||||
|
title: 'U & I (INA219)',
|
||||||
|
// rightGap: 250,
|
||||||
|
showRangeSelector: true,
|
||||||
|
// drawPoints: true,
|
||||||
|
// rollPeriod: 10,
|
||||||
|
// errorBars: true,
|
||||||
|
// fillGraph: true,
|
||||||
|
showRoller: true,
|
||||||
|
// maxNumberWidth: 10,
|
||||||
|
// digitsAfterDecimal: 3,
|
||||||
|
xlabel: 'T(sec)',
|
||||||
|
ylabel: 'U(V)',
|
||||||
|
y2label: 'I(mA)',
|
||||||
|
colors: ['rgb(51,204,204)','rgb(255,100,100)'],
|
||||||
|
// highlightSeriesOpts: { strokeWidth: 2 },
|
||||||
|
series : { 'I': { axis: 'y2' } },
|
||||||
|
axes: {
|
||||||
|
x: {valueFormatter: function(x){return this.getLabels()[0] + ': '+ x.toPrecision(3);}},
|
||||||
|
y: {valueRange: [0,]},
|
||||||
|
y2: {valueRange: [0,]}},
|
||||||
|
labels: ['T', 'U', 'I'],
|
||||||
|
labelsDiv: $('labdiv'),
|
||||||
|
legend: 'always', // "follow"
|
||||||
|
// legendFormatter: legendFormatter
|
||||||
|
});
|
||||||
|
setInterval(function(){renderChart()}, 50);
|
||||||
|
stg = 1;
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
wstt = setTimeout(wsping, 40);
|
||||||
|
} } }
|
||||||
|
function wsSmpRate() {
|
||||||
|
smps = cur_idx * 1000/ (new Date().getTime() - sttim);
|
||||||
|
$('smprate').innerHTML = smps.toFixed(1);
|
||||||
|
}
|
||||||
|
var renderChart = function() {
|
||||||
|
// $('div_v').style.height = (window.innerHeight-180) + 'px';
|
||||||
|
var dl;
|
||||||
|
if (gu.dateWindow_) {
|
||||||
|
dl = gu.dateWindow_[1] - gu.dateWindow_[0];
|
||||||
|
if ($("FixEnd").checked) {
|
||||||
|
var ls = datau.length - 1;
|
||||||
|
gu.dateWindow_[1] = datau[ls][0];
|
||||||
|
gu.dateWindow_[0] = datau[ls][0] - dl;
|
||||||
|
} else if (gu.dateWindow_[0] < datau[0][0]) {
|
||||||
|
gu.dateWindow_[0] = datau[0][0];
|
||||||
|
gu.dateWindow_[1] = datau[0][0] + dl;
|
||||||
|
}
|
||||||
|
} else dl = datau.length/smprate;
|
||||||
|
$("wdsize").innerHTML = dl.toFixed(3);
|
||||||
|
if(rend) gu.updateOptions({'file': datau});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -30,6 +30,7 @@ extern int inic_stop(void);
|
||||||
|
|
||||||
#if CONFIG_DEBUG_LOG > 0
|
#if CONFIG_DEBUG_LOG > 0
|
||||||
#undef printf
|
#undef printf
|
||||||
|
extern int rtl_printf(const char *fmt, ...);
|
||||||
#define printf(...) rtl_printf(__VA_ARGS__)
|
#define printf(...) rtl_printf(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#undef printf
|
#undef printf
|
||||||
|
@ -832,13 +833,13 @@ int wifi_on(rtw_mode_t mode) {
|
||||||
wifi_set_mib();
|
wifi_set_mib();
|
||||||
printf("Initializing WIFI ...\n");
|
printf("Initializing WIFI ...\n");
|
||||||
for (idx = 0; idx < devnum; idx++) {
|
for (idx = 0; idx < devnum; idx++) {
|
||||||
ret = rltk_wlan_init(idx, mode);
|
ret = rltk_wlan_init(idx, mode); // 56
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (idx = 0; idx < devnum; idx++)
|
for (idx = 0; idx < devnum; idx++) {
|
||||||
rltk_wlan_start(idx);
|
rltk_wlan_start(idx);
|
||||||
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
if (rltk_wlan_running(devnum - 1)) {
|
if (rltk_wlan_running(devnum - 1)) {
|
||||||
printf("WIFI initialized\n");
|
printf("WIFI initialized\n");
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <osdep_service.h>
|
#include <osdep_service.h>
|
||||||
#include <wlan/wlan_test_inc.h>
|
#include <wlan/wlan_test_inc.h>
|
||||||
#include <dhcp/dhcps.h>
|
#include <dhcp/dhcps.h>
|
||||||
|
#include <wifi_constants.h>
|
||||||
#include <wifi/wifi_conf.h>
|
#include <wifi/wifi_conf.h>
|
||||||
#include <wifi/wifi_util.h>
|
#include <wifi/wifi_util.h>
|
||||||
#include <platform/platform_stdlib.h>
|
#include <platform/platform_stdlib.h>
|
||||||
|
@ -382,7 +383,7 @@ static void cmd_wifi_connect(int argc, char **argv)
|
||||||
char *ssid;
|
char *ssid;
|
||||||
rtw_security_t security_type;
|
rtw_security_t security_type;
|
||||||
char *password;
|
char *password;
|
||||||
int ssid_len;
|
// int ssid_len;
|
||||||
int password_len;
|
int password_len;
|
||||||
int key_id;
|
int key_id;
|
||||||
void *semaphore;
|
void *semaphore;
|
||||||
|
@ -411,21 +412,21 @@ static void cmd_wifi_connect(int argc, char **argv)
|
||||||
if(argc == 2){
|
if(argc == 2){
|
||||||
security_type = RTW_SECURITY_OPEN;
|
security_type = RTW_SECURITY_OPEN;
|
||||||
password = NULL;
|
password = NULL;
|
||||||
ssid_len = strlen((const char *)argv[1]);
|
// ssid_len = strlen((const char *)argv[1]);
|
||||||
password_len = 0;
|
password_len = 0;
|
||||||
key_id = 0;
|
key_id = 0;
|
||||||
semaphore = NULL;
|
semaphore = NULL;
|
||||||
}else if(argc ==3){
|
}else if(argc ==3){
|
||||||
security_type = RTW_SECURITY_WPA2_AES_PSK;
|
security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||||
password = argv[2];
|
password = argv[2];
|
||||||
ssid_len = strlen((const char *)argv[1]);
|
// ssid_len = strlen((const char *)argv[1]);
|
||||||
password_len = strlen((const char *)argv[2]);
|
password_len = strlen((const char *)argv[2]);
|
||||||
key_id = 0;
|
key_id = 0;
|
||||||
semaphore = NULL;
|
semaphore = NULL;
|
||||||
}else{
|
}else{
|
||||||
security_type = RTW_SECURITY_WEP_PSK;
|
security_type = RTW_SECURITY_WEP_PSK;
|
||||||
password = argv[2];
|
password = argv[2];
|
||||||
ssid_len = strlen((const char *)argv[1]);
|
// ssid_len = strlen((const char *)argv[1]);
|
||||||
password_len = strlen((const char *)argv[2]);
|
password_len = strlen((const char *)argv[2]);
|
||||||
key_id = atoi(argv[3]);
|
key_id = atoi(argv[3]);
|
||||||
if(( password_len != 5) && (password_len != 13)) {
|
if(( password_len != 5) && (password_len != 13)) {
|
||||||
|
|
|
@ -96,12 +96,14 @@ void wait_ms(int ms) { // До 1073741 секунд? 298 часов
|
||||||
void wait_us(int us) { // До 2.147483648 секунды!
|
void wait_us(int us) { // До 2.147483648 секунды!
|
||||||
uint32_t start;
|
uint32_t start;
|
||||||
#ifdef WAIT_US_USE_CYCCNT
|
#ifdef WAIT_US_USE_CYCCNT
|
||||||
if(us < 1) return;
|
if((uint32_t)us < 1) return;
|
||||||
if (us < 327) { // G-timer resolution is ~31 us (1/32K), use DWT->CYCCNT...
|
if ((uint32_t)us < 327) { // G-timer resolution is ~31 us (1/32K), use DWT->CYCCNT...
|
||||||
if(!(DWT->CTRL & DWT_CTRL_CYCCNTENA_Msk)) { // уже включен?
|
if(!(DWT->CTRL & DWT_CTRL_CYCCNTENA_Msk)) { // уже включен?
|
||||||
|
// taskENTER_CRITICAL();
|
||||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; // открыть доступ
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; // открыть доступ
|
||||||
DWT->CYCCNT = 0; // обнулить и запустить
|
DWT->CYCCNT = 0; // обнулить и запустить
|
||||||
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; // запустить счет
|
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; // запустить счет
|
||||||
|
// taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
start = DWT->CYCCNT + us * (PLATFORM_CLOCK / 1000000ul);
|
start = DWT->CYCCNT + us * (PLATFORM_CLOCK / 1000000ul);
|
||||||
while ((int32_t)(start - DWT->CYCCNT) > 0);
|
while ((int32_t)(start - DWT->CYCCNT) > 0);
|
||||||
|
|
|
@ -28,7 +28,6 @@ void us_ticker_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (us_ticker_inited) return;
|
if (us_ticker_inited) return;
|
||||||
us_ticker_inited = 1;
|
|
||||||
|
|
||||||
// Initial a G-Timer
|
// Initial a G-Timer
|
||||||
Timer6Adapter.IrqDis = 1; // Disable Irq
|
Timer6Adapter.IrqDis = 1; // Disable Irq
|
||||||
|
@ -44,6 +43,7 @@ void us_ticker_init(void)
|
||||||
HalTimerOp.HalTimerInit((VOID*) &Timer6Adapter);
|
HalTimerOp.HalTimerInit((VOID*) &Timer6Adapter);
|
||||||
|
|
||||||
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID);
|
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID);
|
||||||
|
us_ticker_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (!TICK_READ_FROM_CPU) || !defined(PLATFORM_FREERTOS)
|
#if (!TICK_READ_FROM_CPU) || !defined(PLATFORM_FREERTOS)
|
||||||
|
@ -56,9 +56,9 @@ uint32_t us_ticker_read()
|
||||||
uint64_t us_tick;
|
uint64_t us_tick;
|
||||||
|
|
||||||
//1 Our G-timer resolution is ~31 us (1/32K), and is a countdown timer
|
//1 Our G-timer resolution is ~31 us (1/32K), and is a countdown timer
|
||||||
// if (!us_ticker_inited) {
|
if (!us_ticker_inited) {
|
||||||
// us_ticker_init();
|
us_ticker_init();
|
||||||
// }
|
}
|
||||||
tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID);
|
tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID);
|
||||||
tick_cnt = 0xffffffff - tick_cnt; // it's a down counter
|
tick_cnt = 0xffffffff - tick_cnt; // it's a down counter
|
||||||
ticks_125ms = tick_cnt/(GTIMER_CLK_HZ/8);
|
ticks_125ms = tick_cnt/(GTIMER_CLK_HZ/8);
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum _HAL_RESET_REASON{
|
||||||
typedef u32 HAL_RESET_REASON;
|
typedef u32 HAL_RESET_REASON;
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER_MODULE
|
#ifdef CONFIG_TIMER_MODULE
|
||||||
|
/* Min Step 31 us ! */
|
||||||
extern _LONG_CALL_ unsigned int HalDelayUs(unsigned int us);
|
extern _LONG_CALL_ unsigned int HalDelayUs(unsigned int us);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ LOCAL uint8 INFRA_START_SECTION _Get_ChipId() {
|
||||||
LOCAL void INFRA_START_SECTION sdr_preinit(void) {
|
LOCAL void INFRA_START_SECTION sdr_preinit(void) {
|
||||||
|
|
||||||
HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0,
|
HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0,
|
||||||
((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03)
|
((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03) L25EOUTVOLTAGE ?
|
||||||
LDO25M_CTRL(ON);
|
LDO25M_CTRL(ON);
|
||||||
SRAM_MUX_CFG(0x2);
|
SRAM_MUX_CFG(0x2);
|
||||||
SDR_CLK_SEL(SDR_CLOCK_SEL_VALUE); // REG_PESOC_CLK_SEL
|
SDR_CLK_SEL(SDR_CLOCK_SEL_VALUE); // REG_PESOC_CLK_SEL
|
||||||
|
|
|
@ -203,12 +203,12 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter;
|
||||||
HalReInitPlatformTimer(); // HalInitPlatformTimerV02(); HalTimerOpInit_Patch((VOID*) (&HalTimerOp));
|
HalReInitPlatformTimer(); // HalInitPlatformTimerV02(); HalTimerOpInit_Patch((VOID*) (&HalTimerOp));
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
En32KCalibration();
|
En32KCalibration();
|
||||||
|
|
||||||
//---- Spic
|
//---- Spic
|
||||||
// _memset(SpicInitParaAllClk, 0, sizeof(SpicInitParaAllClk));
|
// _memset(SpicInitParaAllClk, 0, sizeof(SpicInitParaAllClk));
|
||||||
*(uint32 *)(&SpicInitParaAllClk[0][0].BaudRate) = 0x01310202; // patch
|
*(uint32 *)(&SpicInitParaAllClk[0][0].BaudRate) = 0x01310202; // patch
|
||||||
*(uint32 *)(&SpicInitParaAllClk[1][0].BaudRate) = 0x11311301; // patch
|
*(uint32 *)(&SpicInitParaAllClk[1][0].BaudRate) = 0x11311301; // patch
|
||||||
// *(uint32 *)(&SpicInitParaAllClk[2][0].BaudRate) = 0x21311301; // patch
|
// *(uint32 *)(&SpicInitParaAllClk[2][0].BaudRate) = 0x21311301; // patch
|
||||||
|
#ifdef CONFIG_SDR_EN
|
||||||
SPI_FLASH_PIN_FCTRL(ON);
|
SPI_FLASH_PIN_FCTRL(ON);
|
||||||
/*
|
/*
|
||||||
// uint8 SpicBaudRate = CPU_CLK_TYPE_NO - 1 - ((HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL1) >> 4) & 7);
|
// uint8 SpicBaudRate = CPU_CLK_TYPE_NO - 1 - ((HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL1) >> 4) & 7);
|
||||||
|
@ -224,7 +224,6 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter;
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
// SpicFlashInitRtl8195A(SpicDualBitMode); // SpicReadIDRtl8195A(); SpicDualBitMode
|
// SpicFlashInitRtl8195A(SpicDualBitMode); // SpicReadIDRtl8195A(); SpicDualBitMode
|
||||||
#ifdef CONFIG_SDR_EN
|
|
||||||
//---- SDRAM
|
//---- SDRAM
|
||||||
uint8 ChipId = HalGetChipId();
|
uint8 ChipId = HalGetChipId();
|
||||||
if (ChipId >= CHIP_ID_8195AM) {
|
if (ChipId >= CHIP_ID_8195AM) {
|
||||||
|
@ -253,9 +252,9 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter;
|
||||||
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init or None
|
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init or None
|
||||||
#else
|
#else
|
||||||
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & (~BIT(21))); // Flag SDRAM Not Init
|
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & (~BIT(21))); // Flag SDRAM Not Init
|
||||||
#endif // CONFIG_SDR_EN
|
|
||||||
//----- Close Flash
|
//----- Close Flash
|
||||||
SPI_FLASH_PIN_FCTRL(OFF);
|
SPI_FLASH_PIN_FCTRL(OFF);
|
||||||
|
#endif // CONFIG_SDR_EN
|
||||||
|
|
||||||
InitSoCPM();
|
InitSoCPM();
|
||||||
VectorTableInitForOSRtl8195A(&vPortSVCHandler, &xPortPendSVHandler,
|
VectorTableInitForOSRtl8195A(&vPortSVCHandler, &xPortPendSVHandler,
|
||||||
|
|
|
@ -712,7 +712,8 @@ VOID HalSsiSetSclkRtl8195a(VOID *Adapter, u32 ClkRate)
|
||||||
}
|
}
|
||||||
ClockDivider &= 0xFFFE; // bit 0 always is 0
|
ClockDivider &= 0xFFFE; // bit 0 always is 0
|
||||||
}
|
}
|
||||||
DBG_SSI_INFO("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider));
|
// DBG_SSI_INFO("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider));
|
||||||
|
DiagPrintf("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider));
|
||||||
pHalSsiAdapter->ClockDivider = ClockDivider;
|
pHalSsiAdapter->ClockDivider = ClockDivider;
|
||||||
|
|
||||||
SsiEn = HAL_SSI_READ32(spi_idx, REG_DW_SSI_SSIENR); // Backup SSI_EN register
|
SsiEn = HAL_SSI_READ32(spi_idx, REG_DW_SSI_SSIENR); // Backup SSI_EN register
|
||||||
|
|
|
@ -67,7 +67,7 @@ En32KCalibration(
|
||||||
DiagPrintf("Check lock: %d\n", Ttemp);
|
DiagPrintf("Check lock: %d\n", Ttemp);
|
||||||
DiagPrintf("0x278: %x\n", Rtemp);
|
DiagPrintf("0x278: %x\n", Rtemp);
|
||||||
#endif
|
#endif
|
||||||
if (Ttemp > 100000) { /*Delay 100ms*/
|
if (Ttemp > 100000/63) { /*Delay 100ms*/
|
||||||
DiagPrintf("32K Calibration Fail!\n", Ttemp);
|
DiagPrintf("32K Calibration Fail!\n", Ttemp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -6,6 +6,7 @@ SDK_PATH ?= ../SDKRTLA/USDK/
|
||||||
OPENOCD_PATH = d:/MCU/OpenOCD/bin/
|
OPENOCD_PATH = d:/MCU/OpenOCD/bin/
|
||||||
TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/
|
TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/
|
||||||
FLASHER_TYPE ?= Jlink
|
FLASHER_TYPE ?= Jlink
|
||||||
|
PYTHON27_PATH ?= c:/Python27/
|
||||||
#FLASHER_TYPE ?= OCD
|
#FLASHER_TYPE ?= OCD
|
||||||
FLASHER_PATH ?= $(SDK_PATH)flasher/
|
FLASHER_PATH ?= $(SDK_PATH)flasher/
|
||||||
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/
|
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/
|
||||||
|
@ -38,6 +39,7 @@ endif
|
||||||
PICK = $(TOOLS_PATH)pick$(EXE)
|
PICK = $(TOOLS_PATH)pick$(EXE)
|
||||||
PADDING = $(TOOLS_PATH)padding$(EXE)
|
PADDING = $(TOOLS_PATH)padding$(EXE)
|
||||||
CHCKSUM = $(TOOLS_PATH)checksum$(EXE)
|
CHCKSUM = $(TOOLS_PATH)checksum$(EXE)
|
||||||
|
PYTHON = $(PYTHON27)python$(EXE)
|
||||||
|
|
||||||
# openocd tools
|
# openocd tools
|
||||||
OPENOCD = $(OPENOCD_PATH)openocd
|
OPENOCD = $(OPENOCD_PATH)openocd
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h2 class="title">Debug and Tests</h2>
|
<h2 class="title">Debug and Tests</h2>
|
||||||
<p class="center">
|
<p class="center">
|
||||||
Chart <a href="/heap.htm">'heap'</a>, <a href="/tst.htm">ST-AP RSSI</a><br><br>
|
Chart <a href="/heap.htm">'heap'</a>, <a href="/tst.htm">ST-AP RSSI</a>, <a href="/i219ws.htm">INA219</a><br><br>
|
||||||
<a href='/protect/timeout.htm?sys_restart=12345'>System Restart</a><br><br>
|
<a href='/protect/timeout.htm?sys_restart=12345'>System Restart</a><br><br>
|
||||||
Counter erase the last flash sector config: ~sys_rdec0x980FE000~<br><br>
|
Counter erase the last flash sector config: ~sys_rdec0x980FE000~<br><br>
|
||||||
</p>
|
</p>
|
||||||
|
|
10
project.mk
10
project.mk
|
@ -48,6 +48,8 @@ DRAM_C += project/src/console/atcmd_user.c
|
||||||
DRAM_C += project/src/console/wifi_console.c
|
DRAM_C += project/src/console/wifi_console.c
|
||||||
#DRAM_C += project/src/console/wlan_tst.c
|
#DRAM_C += project/src/console/wlan_tst.c
|
||||||
#ADD_SRC_C += project/src/console/pwm_tst.c
|
#ADD_SRC_C += project/src/console/pwm_tst.c
|
||||||
|
ADD_SRC_C += project/src/WS2812/ws2812_tst.c
|
||||||
|
ADD_SRC_C += project/src/WS2812/WS2812.c
|
||||||
|
|
||||||
ifdef USE_SDCARD
|
ifdef USE_SDCARD
|
||||||
ADD_SRC_C += project/src/console/sd_fat.c
|
ADD_SRC_C += project/src/console/sd_fat.c
|
||||||
|
@ -81,10 +83,16 @@ endif
|
||||||
INCLUDES += project/inc/web
|
INCLUDES += project/inc/web
|
||||||
ADD_SRC_C += project/src/tcpsrv/tcp_srv_conn.c
|
ADD_SRC_C += project/src/tcpsrv/tcp_srv_conn.c
|
||||||
ADD_SRC_C += project/src/webfs/webfs.c
|
ADD_SRC_C += project/src/webfs/webfs.c
|
||||||
|
|
||||||
|
ifdef COMPILE_SCI
|
||||||
ADD_SRC_C += project/src/web/web_srv.c
|
ADD_SRC_C += project/src/web/web_srv.c
|
||||||
ADD_SRC_C += project/src/web/web_utils.c
|
ADD_SRC_C += project/src/web/web_utils.c
|
||||||
ADD_SRC_C += project/src/web/web_websocket.c
|
ADD_SRC_C += project/src/web/web_websocket.c
|
||||||
ADD_SRC_C += project/src/web/websock.c
|
ADD_SRC_C += project/src/web/websock.c
|
||||||
|
ADD_SRC_C += project/src/web/web_auth.c
|
||||||
ADD_SRC_C += project/src/web/web_int_callbacks.c
|
ADD_SRC_C += project/src/web/web_int_callbacks.c
|
||||||
ADD_SRC_C += project/src/web/web_int_vars.c
|
ADD_SRC_C += project/src/web/web_int_vars.c
|
||||||
ADD_SRC_C += project/src/web/web_auth.c
|
else
|
||||||
|
ADD_SRC_C += project/src/web/_sci_web.c
|
||||||
|
ADD_SRC_C += project/src/web/_sci_web_user.c
|
||||||
|
endif
|
||||||
|
|
|
@ -12,11 +12,6 @@
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
|
|
||||||
#undef mMIN
|
|
||||||
#define mMIN(a, b) ((a < b)? a : b)
|
|
||||||
#define mMAX(a, b) ((a>b)?a:b)
|
|
||||||
|
|
||||||
|
|
||||||
enum srvconn_state {
|
enum srvconn_state {
|
||||||
SRVCONN_NONE =0,
|
SRVCONN_NONE =0,
|
||||||
SRVCONN_CLOSEWAIT, // ожидает закрытия
|
SRVCONN_CLOSEWAIT, // ожидает закрытия
|
||||||
|
@ -35,9 +30,11 @@ enum srvconn_state {
|
||||||
#define MAX_TIME_WAIT_PCB 10
|
#define MAX_TIME_WAIT_PCB 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _mMIN(a, b) ((a < b)? a : b)
|
||||||
|
|
||||||
// кол-во одновременно открытых соединений по умолчанию
|
// кол-во одновременно открытых соединений по умолчанию
|
||||||
#ifndef TCP_SRV_MAX_CONNECTIONS
|
#ifndef TCP_SRV_MAX_CONNECTIONS
|
||||||
#define TCP_SRV_MAX_CONNECTIONS mMIN(MEMP_NUM_TCP_PCB, 10)
|
#define TCP_SRV_MAX_CONNECTIONS _mMIN(MEMP_NUM_TCP_PCB, 10)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// порт сервера по умолчанию
|
// порт сервера по умолчанию
|
||||||
|
|
|
@ -320,6 +320,9 @@ LOCAL void fATDS(int argc, char *argv[])
|
||||||
uint32 sleep_ms = 10000;
|
uint32 sleep_ms = 10000;
|
||||||
if(argc > 1) sleep_ms = atoi(argv[1]);
|
if(argc > 1) sleep_ms = atoi(argv[1]);
|
||||||
#if 0 // WakeUp PB_1
|
#if 0 // WakeUp PB_1
|
||||||
|
#include "gpio_api.h"
|
||||||
|
extern void HalInitLogUart(void);
|
||||||
|
extern void HalDeinitLogUart(void);
|
||||||
if(argc > 2) {
|
if(argc > 2) {
|
||||||
printf("%u ms waiting low level on PB_1 before launching Deep-Sleep...\n", sleep_ms);
|
printf("%u ms waiting low level on PB_1 before launching Deep-Sleep...\n", sleep_ms);
|
||||||
// turn off log uart
|
// turn off log uart
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
|
|
||||||
#include "hal_com_reg.h"
|
#include "hal_com_reg.h"
|
||||||
|
|
||||||
|
#undef mMIN
|
||||||
|
#define mMIN(a, b) ((a < b)? a : b)
|
||||||
|
#undef mMAX
|
||||||
|
#define mMAX(a, b) ((a > b)? a : b)
|
||||||
|
|
||||||
//#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
|
//#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
|
||||||
//#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
|
//#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
|
||||||
|
|
||||||
|
@ -44,7 +49,7 @@ INA219DRV ina219drv = {
|
||||||
.i2c.status = DRV_I2C_OFF,
|
.i2c.status = DRV_I2C_OFF,
|
||||||
.i2c.idx = 1, // I2C1
|
.i2c.idx = 1, // I2C1
|
||||||
.i2c.io_sel = S0, // PC_4, PC_5
|
.i2c.io_sel = S0, // PC_4, PC_5
|
||||||
.i2c.mode = DRV_I2C_FS_MODE // DRV_I2C_HS_MODE
|
.i2c.mode = DRV_I2C_FS_MODE // DRV_I2C_FS_MODE
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
void ina219_write(unsigned char reg, unsigned short data)
|
void ina219_write(unsigned char reg, unsigned short data)
|
||||||
|
@ -186,9 +191,6 @@ size_t ina219_getdata(void *pd, uint16 cnt)
|
||||||
return cnt * sizeof(INA219DATA) + 4;
|
return cnt * sizeof(INA219DATA) + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define mMIN(a, b) ((a<b)?a:b)
|
|
||||||
#define mMAX(a, b) ((a>b)?a:b)
|
|
||||||
|
|
||||||
#include "web_srv.h"
|
#include "web_srv.h"
|
||||||
#include "websock.h"
|
#include "websock.h"
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@ extern void console_init(void);
|
||||||
|
|
||||||
void user_init_thrd(void) {
|
void user_init_thrd(void) {
|
||||||
|
|
||||||
|
|
||||||
|
/* Read system config*/
|
||||||
|
|
||||||
if(syscfg.cfg.b.pin_clear_cfg_enable
|
if(syscfg.cfg.b.pin_clear_cfg_enable
|
||||||
&& 0) { // user_test_clear_pin()
|
&& 0) { // user_test_clear_pin()
|
||||||
wifi_cfg.load_flg = 0;
|
wifi_cfg.load_flg = 0;
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
* Created on: 23/04/2017.
|
* Created on: 23/04/2017.
|
||||||
* Author: pvvx
|
* Author: pvvx
|
||||||
*/
|
*/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
#ifdef USE_WEB
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "diag.h"
|
#include "diag.h"
|
||||||
#include "web_utils.h"
|
#include "web_utils.h"
|
||||||
|
@ -12,8 +14,10 @@
|
||||||
#include "web_srv.h"
|
#include "web_srv.h"
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
#include "esp_comp.h"
|
#include "esp_comp.h"
|
||||||
|
#endif // USE_WEB
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef USE_WEB
|
||||||
/* ----------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------
|
||||||
* pbuf[77] = Username and password are combined into a string "username:password"
|
* pbuf[77] = Username and password are combined into a string "username:password"
|
||||||
* Return: Authorization Level
|
* Return: Authorization Level
|
||||||
|
@ -46,3 +50,4 @@ uint8 UserAuthorization(uint8 *pbuf, size_t declen)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif // USE_WEB
|
|
@ -3,6 +3,7 @@
|
||||||
* Description: The web server inernal callbacks.
|
* Description: The web server inernal callbacks.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#ifdef USE_WEB
|
#ifdef USE_WEB
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
@ -53,16 +54,22 @@
|
||||||
#undef atoi
|
#undef atoi
|
||||||
#define atoi rom_atoi
|
#define atoi rom_atoi
|
||||||
|
|
||||||
//#define mMIN(a, b) ((a<b)?a:b)
|
#undef mMIN
|
||||||
|
#define mMIN(a, b) ((a < b)? a : b)
|
||||||
|
//#undef mMAX
|
||||||
|
//#define mMAX(a, b) ((a > b)? a : b)
|
||||||
|
|
||||||
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
||||||
|
extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */
|
||||||
|
|
||||||
|
#endif // USE_WEB
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef USE_WEB
|
||||||
|
|
||||||
#define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); }
|
#define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); }
|
||||||
#define CloseFlash() { SpicDisableRtl8195A(); device_mutex_unlock(RT_DEV_LOCK_FLASH); }
|
#define CloseFlash() { SpicDisableRtl8195A(); device_mutex_unlock(RT_DEV_LOCK_FLASH); }
|
||||||
|
|
||||||
|
|
||||||
extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */
|
|
||||||
|
|
||||||
|
|
||||||
#if WEB_DEBUG_FUNCTIONS
|
#if WEB_DEBUG_FUNCTIONS
|
||||||
//#define TEST_SEND_WAVE
|
//#define TEST_SEND_WAVE
|
||||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* FileName: webserver.c
|
* FileName: webserver.c
|
||||||
* Description: The web server mode configuration.
|
* Description: The web server mode configuration.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#ifdef USE_WEB
|
#ifdef USE_WEB
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
#include "user/sys_cfg.h"
|
#include "user/sys_cfg.h"
|
||||||
#include "wifi_api.h"
|
#include "wifi_api.h"
|
||||||
|
#include "sleep_ex_api.h"
|
||||||
#include "sys_api.h"
|
#include "sys_api.h"
|
||||||
#include "esp_comp.h"
|
#include "esp_comp.h"
|
||||||
|
|
||||||
|
@ -67,6 +68,11 @@ extern int rom_atoi(const char *);
|
||||||
#undef atoi
|
#undef atoi
|
||||||
#define atoi rom_atoi
|
#define atoi rom_atoi
|
||||||
|
|
||||||
|
#endif // USE_WEB
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef USE_WEB
|
||||||
|
|
||||||
typedef uint32 (* call_func)(uint32 a, uint32 b, uint32 c);
|
typedef uint32 (* call_func)(uint32 a, uint32 b, uint32 c);
|
||||||
extern QueueHandle_t xQueueWebSrv;
|
extern QueueHandle_t xQueueWebSrv;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
* ver1.1 02/04/2015 SDK 1.0.0
|
* ver1.1 02/04/2015 SDK 1.0.0
|
||||||
* ver2.0 14/14/2017 RTL871x
|
* ver2.0 14/14/2017 RTL871x
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#ifdef USE_WEB
|
#ifdef USE_WEB
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
@ -36,17 +37,23 @@
|
||||||
#include "overlay.h"
|
#include "overlay.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
|
//#define mMAX(a, b) ((a>b)?a:b)
|
||||||
|
extern int rom_atoi(const char *);
|
||||||
|
#undef atoi
|
||||||
|
#define atoi(s) rom_atoi(s)
|
||||||
|
|
||||||
|
#endif // USE_WEB
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef USE_WEB
|
||||||
|
|
||||||
#define USE_WEB_NAGLE // https://en.wikipedia.org/wiki/Nagle%27s_algorithm
|
#define USE_WEB_NAGLE // https://en.wikipedia.org/wiki/Nagle%27s_algorithm
|
||||||
#define MIN_REQ_LEN 7 // Minimum length for a valid HTTP/0.9 request: "GET /\r\n" -> 7 bytes
|
#define MIN_REQ_LEN 7 // Minimum length for a valid HTTP/0.9 request: "GET /\r\n" -> 7 bytes
|
||||||
#define CRLF "\r\n"
|
#define CRLF "\r\n"
|
||||||
|
|
||||||
#define max_len_buf_write_flash 2048 // размер буфера при записи flash. Увеличение/уменньшение размера (до сектора 4096) ускорения не дает (1..2%)
|
#define max_len_buf_write_flash 2048 // размер буфера при записи flash. Увеличение/уменньшение размера (до сектора 4096) ускорения не дает (1..2%)
|
||||||
|
|
||||||
//#define mMIN(a, b) ((a<b)?a:b)
|
|
||||||
//#define mMAX(a, b) ((a>b)?a:b)
|
|
||||||
#undef atoi
|
|
||||||
#define atoi(s) rom_atoi(s)
|
|
||||||
|
|
||||||
LOCAL void web_print_headers(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR ;
|
LOCAL void web_print_headers(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR ;
|
||||||
|
|
||||||
//LOCAL void webserver_discon(void *arg) ICACHE_FLASH_ATTR;
|
//LOCAL void webserver_discon(void *arg) ICACHE_FLASH_ATTR;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Created on: 25 дек. 2014 г.
|
* Created on: 25 дек. 2014 г.
|
||||||
* Author: PV`
|
* Author: PV`
|
||||||
*/
|
*/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
@ -18,7 +19,10 @@
|
||||||
#include "web_utils.h"
|
#include "web_utils.h"
|
||||||
#include "esp_comp.h"
|
#include "esp_comp.h"
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
|
//#define mMAX(a, b) ((a>b)?a:b)
|
||||||
|
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* xstrcpy() из сегментов flash и IRAM с возвратом размера строки:
|
* xstrcpy() из сегментов flash и IRAM с возвратом размера строки:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Author: pvvx
|
* Author: pvvx
|
||||||
* 2016
|
* 2016
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#ifdef WEBSOCKET_ENA
|
#ifdef WEBSOCKET_ENA
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
@ -21,6 +22,14 @@
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
#include "esp_comp.h"
|
#include "esp_comp.h"
|
||||||
|
|
||||||
|
|
||||||
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
|
|
||||||
|
#endif // WEBSOCKET_ENA
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef WEBSOCKET_ENA
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#undef DEBUGSOO
|
#undef DEBUGSOO
|
||||||
#define DEBUGSOO 4
|
#define DEBUGSOO 4
|
||||||
|
@ -28,8 +37,6 @@
|
||||||
|
|
||||||
#define copy_s4d1 rtl_memcpy
|
#define copy_s4d1 rtl_memcpy
|
||||||
|
|
||||||
//#define mMIN(a, b) ((a<b)?a:b)
|
|
||||||
|
|
||||||
#define MAX_RX_BUF_SIZE 8192
|
#define MAX_RX_BUF_SIZE 8192
|
||||||
|
|
||||||
const char txt_wsping[] ICACHE_RODATA_ATTR = "ws:ping";
|
const char txt_wsping[] ICACHE_RODATA_ATTR = "ws:ping";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Author: PV`
|
* Author: PV`
|
||||||
* (c) PV` 2016
|
* (c) PV` 2016
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#ifndef COMPILE_SCI // Use Single Compilation Unit "web"
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
#ifdef WEBSOCKET_ENA
|
#ifdef WEBSOCKET_ENA
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
|
@ -20,6 +21,10 @@
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
#include "esp_comp.h"
|
#include "esp_comp.h"
|
||||||
#include "hal_crypto.h"
|
#include "hal_crypto.h"
|
||||||
|
#endif // WEBSOCKET_ENA
|
||||||
|
#endif // COMPILE_SCI
|
||||||
|
|
||||||
|
#ifdef WEBSOCKET_ENA
|
||||||
|
|
||||||
// HTTP/1.1 101 Web Socket Protocol Handshake\r\n
|
// HTTP/1.1 101 Web Socket Protocol Handshake\r\n
|
||||||
const uint8 WebSocketHTTPOkKey[] ICACHE_RODATA_ATTR = "HTTP/1.1 101 Switching Protocols\r\nAccess-Control-Allow-Origin: *\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: %s\r\n\r\n";
|
const uint8 WebSocketHTTPOkKey[] ICACHE_RODATA_ATTR = "HTTP/1.1 101 Switching Protocols\r\nAccess-Control-Allow-Origin: *\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: %s\r\n\r\n";
|
||||||
|
|
1
webfs.mk
1
webfs.mk
|
@ -4,5 +4,6 @@ include $(SDK_PATH)paths.mk
|
||||||
all:
|
all:
|
||||||
@mkdir -p $(BIN_DIR)
|
@mkdir -p $(BIN_DIR)
|
||||||
./tools/webfs/WEBFS22.exe -h "*.htm, *.html, *.cgi, *.xml, *.bin, *.txt, *.wav" -z "mdbini.bin, *.inc, *.ini, snmp.bib, *.ovl" ./WEBFiles $(BIN_DIR) WEBFiles.bin
|
./tools/webfs/WEBFS22.exe -h "*.htm, *.html, *.cgi, *.xml, *.bin, *.txt, *.wav" -z "mdbini.bin, *.inc, *.ini, snmp.bib, *.ovl" ./WEBFiles $(BIN_DIR) WEBFiles.bin
|
||||||
|
#@$(PHYTON) ./tools/webfs/py/webfs_tool.py build -s ./WEBFiles -d "*.htm, *.html, *.cgi, *.xml, *.bin, *.txt, *.wav, *.js" -n "*.inc, *.ini, snmp.bib, *.ovl" $(BIN_DIR)/WEBFiles1.bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
Loading…
Reference in a new issue