mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2026-03-20 17:44:53 +00:00
update
This commit is contained in:
parent
9ffd9dac1a
commit
eac35630e6
31 changed files with 185 additions and 130 deletions
|
|
@ -31,7 +31,7 @@ typedef struct _ina219drv {
|
|||
signed short ss[2];
|
||||
unsigned int ui;
|
||||
} buf_i2c;
|
||||
volatile i2c_drv_t i2c;
|
||||
i2c_drv_t i2c;
|
||||
} INA219DRV, *PINA219DRV;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ typedef struct _ina219drv {
|
|||
signed short ss[2];
|
||||
unsigned int ui;
|
||||
} buf_i2c;
|
||||
volatile i2c_drv_t i2c;
|
||||
i2c_drv_t i2c;
|
||||
} INA219DRV, *PINA219DRV;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ a lot of data that needs to be copied, this should be set high. */
|
|||
|
||||
/* Support Multicast */
|
||||
#define LWIP_IGMP 1
|
||||
|
||||
extern __attribute__ ((long_call)) unsigned int Rand(void);
|
||||
#define LWIP_RAND() Rand()
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@
|
|||
|
||||
#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 {
|
||||
SRVCONN_NONE =0,
|
||||
SRVCONN_CLOSEWAIT, // ожидает закрытия
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#ifndef _WEBSOCK_H_
|
||||
#define _WEBSOCK_H_
|
||||
#include "lwip/err.h"
|
||||
#include "tcpsrv/tcp_srv_conn.h"
|
||||
|
||||
//#define WS_NONBLOCK 0x02
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
RTW_SECURITY_WPA_TKIP_PSK - WPA Security
|
||||
RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher
|
||||
RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers */
|
||||
#define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK // WEP security is NOT IMPLEMENTED. It is NOT SECURE!
|
||||
#define DEF_AP_SECURITY RTW_ENCRYPTION_WPA2_MIXED // WEP security is NOT IMPLEMENTED. It is NOT SECURE!
|
||||
#define DEF_AP_BEACON 100 // 100...6000 ms
|
||||
#define DEF_AP_CHANNEL 1 // 1..14
|
||||
#define DEF_AP_CHANNEL 1 // 1..14
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
#define DEF_ST_AUTORECONNECT 1 // 0 - none, 1..254 - count, 255 - all
|
||||
#define DEF_ST_RECONNECT_PAUSE 1 // 5 sec
|
||||
#define DEF_ST_SLEEP 3 // 0 - Off, 1 - IPS, 2 - LPS, 3 - IPS/LPS mode
|
||||
#define DEF_ST_LPS_DTIM 0 // LPS DTIM
|
||||
#define DEF_ST_LPS_DTIM 1 // LPS DTIM
|
||||
#define DEF_ST_DHCP_MODE 1 // =0 dhcp off,
|
||||
// =1 - dhcp on, - динамический ip
|
||||
// =2 Static ip, - fixed ip
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ LOCAL void fATHF(int argc, char *argv[]) {
|
|||
if (pbuf != NULL) {
|
||||
DIR dir;
|
||||
FILINFO fno;
|
||||
struct os_tm tm;
|
||||
fno.lfname = (TCHAR*) pbuf;
|
||||
fno.lfsize = 512;
|
||||
u8 * sdir;
|
||||
|
|
@ -270,7 +269,7 @@ LOCAL void fATHF(int argc, char *argv[]) {
|
|||
} else
|
||||
printf("FATFS: Open dir fail!\n");
|
||||
free(pbuf);
|
||||
if(sdir != logical_drv) free(sdir);
|
||||
if((void *)sdir != (void *)logical_drv) free(sdir);
|
||||
}
|
||||
}
|
||||
sd_unmount(fs);
|
||||
|
|
@ -348,7 +347,7 @@ LOCAL void fATHS(int argc, char *argv[]) {
|
|||
} else
|
||||
printf("FATFS: Open dir fail!\n");
|
||||
free(pbuf);
|
||||
if(sdir != logical_drv) free(sdir);
|
||||
if((void *)sdir != (void *)logical_drv) free(sdir);
|
||||
}
|
||||
}
|
||||
sd_unmount(fs);
|
||||
|
|
|
|||
|
|
@ -193,7 +193,9 @@ LOCAL void fATWI(int argc, char *argv[]) {
|
|||
show_wifi_st_cfg();
|
||||
printf("\nWIFI AP clients:\n");
|
||||
printf(&str_rom_57ch3Dch0A[25]); // "================================\n"
|
||||
#if SDK_VER_NUM > 0x4000
|
||||
show_wifi_ap_clients();
|
||||
#endif
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
//#include "hal_diag.h"
|
||||
#include "rtl8195a/rtl_libc.h"
|
||||
|
||||
void dump_bytes(uint32 addr, int size);
|
||||
extern void dump_bytes(uint32 addr, int size);
|
||||
extern Rltk_wlan_t rltk_wlan_info[2]; // in wrapper.h
|
||||
|
||||
LOCAL void tst_wlan_struct(int argc, char *argv[])
|
||||
{
|
||||
(void) argc; (void) argv;
|
||||
(void)argc; (void)argv;
|
||||
printf("Test: sizeof(struct _ADAPTER) = %d\n", sizeof(struct _ADAPTER)); //6088
|
||||
printf("mlmeextpriv\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv)); //+1256
|
||||
printf("TSFValue\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv.TSFValue)); //+1992
|
||||
|
|
@ -55,6 +55,21 @@ LOCAL void tst_wlan_struct(int argc, char *argv[])
|
|||
};
|
||||
}
|
||||
|
||||
LOCAL void show_wlan_param(int argc, char *argv[]) {
|
||||
(void)argc; (void)argv;
|
||||
_adapter * ad = *(_adapter **)((rltk_wlan_info[0].dev)->priv);
|
||||
#if 1
|
||||
printf("reconnect_deauth_filtered\t%u\n", ad->mlmeextpriv.reconnect_deauth_filtered);
|
||||
printf("reconnect_times\t%u\n", ad->mlmeextpriv.reconnect_times);
|
||||
printf("reconnect_cnt\t%u\n", ad->mlmeextpriv.reconnect_cnt);
|
||||
printf("reconnect_timeout\t%u\n", ad->mlmeextpriv.reconnect_timeout);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
MON_RAM_TAB_SECTION COMMAND_TABLE console_wlan_tst[] = {
|
||||
{"CHKWL", 0, tst_wlan_struct, ": Chk wlan struct"}
|
||||
{"CHKWL", 0, tst_wlan_struct, ": Chk wlan struct"},
|
||||
{"CHKAP", 0, show_wlan_param, ": Chow wlan parm"}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Author: pvvx
|
||||
*/
|
||||
#include "driver/i2c_drv.h"
|
||||
#include "rtl_lib.h"
|
||||
|
||||
#if CONFIG_I2C_EN
|
||||
|
||||
|
|
@ -44,14 +45,14 @@ static const PinMapI2C PinMap_I2C[] = {
|
|||
};
|
||||
|
||||
static void * i2c_base_reg[4] = {
|
||||
I2C0_REG_BASE,
|
||||
I2C1_REG_BASE,
|
||||
I2C2_REG_BASE,
|
||||
I2C3_REG_BASE
|
||||
(void *)I2C0_REG_BASE,
|
||||
(void *)I2C1_REG_BASE,
|
||||
(void *)I2C2_REG_BASE,
|
||||
(void *)I2C3_REG_BASE
|
||||
};
|
||||
|
||||
#if 1
|
||||
#define test_printf
|
||||
#define test_printf(...)
|
||||
#define i2c_dump_regs(p)
|
||||
#else
|
||||
#define test_printf rtl_printf
|
||||
|
|
@ -87,9 +88,9 @@ LOCAL int i2c_ready(i2c_drv_t *pi2c, unsigned char flg)
|
|||
if(i2c_reg(REG_DW_I2C_IC_RAW_INTR_STAT) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
|
||||
error_printf("I2C%d Abort!\n", pi2c->idx);
|
||||
// Clear abort status.
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_CLR_TX_ABRT);
|
||||
i2c_reg(REG_DW_I2C_IC_CLR_TX_ABRT);
|
||||
// Be sure that all interrupts flag are cleared.
|
||||
// (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
// i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
pi2c->status = DRV_I2C_ABORT;
|
||||
return DRV_I2C_ABORT;
|
||||
}
|
||||
|
|
@ -116,7 +117,7 @@ LOCAL int i2c_ready(i2c_drv_t *pi2c, unsigned char flg)
|
|||
int _i2c_break(i2c_drv_t *pi2c)
|
||||
{
|
||||
test_printf("%s\n", __func__);
|
||||
// (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
// i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
// ABORT operation
|
||||
int poll_count = DRV_I2C_POOL_TIMEOUT;
|
||||
i2c_reg(REG_DW_I2C_IC_ENABLE) |= 2;
|
||||
|
|
@ -130,7 +131,7 @@ int _i2c_break(i2c_drv_t *pi2c)
|
|||
};
|
||||
pi2c->status = DRV_I2C_OFF;
|
||||
// All interrupts flag are cleared.
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
return DRV_I2C_OK;
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +226,7 @@ LOCAL int i2c_enable(i2c_drv_t *pi2c)
|
|||
};
|
||||
};
|
||||
// Be sure that all interrupts flag are cleared.
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
pi2c->status = DRV_I2C_IC_ENABLE;
|
||||
return DRV_I2C_OK;
|
||||
}
|
||||
|
|
@ -286,7 +287,7 @@ int _i2c_setup(i2c_drv_t *pi2c, PinName sda, PinName scl, unsigned char mode)
|
|||
return DRV_I2C_ERR;
|
||||
}
|
||||
// Pins -> index
|
||||
PinMapI2C *p = PinMap_I2C;
|
||||
PinMapI2C *p = (PinMapI2C *)PinMap_I2C;
|
||||
while(p->sda != 0xFF) {
|
||||
if(p->sda == sda && p->scl == scl) {
|
||||
pi2c->io_sel = RTL_GET_PERI_SEL(p->sel);
|
||||
|
|
@ -432,7 +433,7 @@ int _i2c_read(i2c_drv_t *pi2c, uint32 address, const char *data, int length, int
|
|||
*d++ = i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
length--;
|
||||
}
|
||||
else (volatile) i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
else i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
};
|
||||
}
|
||||
while(length) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
#include "rtl8195a/rtl_libc.h"
|
||||
#include "driver/i2c_drv.h"
|
||||
#include "platform_stdlib.h"
|
||||
#include "web_websocket.h"
|
||||
#include "tcpsrv/tcp_srv_conn.h"
|
||||
|
||||
#include "hal_com_reg.h"
|
||||
|
||||
|
|
@ -101,7 +103,7 @@ void ina_tick_handler(void *par) {
|
|||
break;
|
||||
case 4:
|
||||
if (i2c_reg(REG_DW_I2C_IC_RAW_INTR_STAT) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
|
||||
uint32 tmp = i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
i2c_reg(REG_DW_I2C_IC_CLR_INTR);
|
||||
p->errs++;
|
||||
p->status = 0;
|
||||
break;
|
||||
|
|
@ -121,10 +123,10 @@ void ina_tick_handler(void *par) {
|
|||
else p->buf_rx++;
|
||||
};
|
||||
} else {
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
(volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
i2c_reg(REG_DW_I2C_IC_DATA_CMD);
|
||||
};
|
||||
}
|
||||
case 3:
|
||||
|
|
@ -183,7 +185,8 @@ size_t ina219_getdata(void *pd, uint16 cnt)
|
|||
taskENABLE_INTERRUPTS();
|
||||
return cnt * sizeof(INA219DATA) + 4;
|
||||
}
|
||||
#define mMIN(a, b) ((a<b)?a:b)
|
||||
|
||||
//#define mMIN(a, b) ((a<b)?a:b)
|
||||
#define mMAX(a, b) ((a>b)?a:b)
|
||||
|
||||
#include "web_srv.h"
|
||||
|
|
@ -390,14 +393,14 @@ LOCAL void fATI2C(int argc, char *argv[])
|
|||
if(argv[1][0] == 'w') {
|
||||
_i2c_write(pi2c, buf[0], &buf[1], i-1, 1);
|
||||
rtl_printf("I2C%d write[%d]:\n", pi2c->idx, i-1);
|
||||
dump_bytes(&buf[0], i);
|
||||
dump_bytes((uint32)&buf[0], i);
|
||||
}
|
||||
else if(argv[1][0] == 'r') {
|
||||
i = buf[1];
|
||||
if(i > sizeof(buf) - 1) i = sizeof(buf) - 1;
|
||||
_i2c_read(pi2c, buf[0], &buf[1], i, 1);
|
||||
rtl_printf("I2C%d read[%d]:\n", pi2c->idx, i);
|
||||
dump_bytes(&buf[0], i+1);
|
||||
dump_bytes((uint32)&buf[0], i+1);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue