fix & update

This commit is contained in:
pvvx 2017-02-01 14:57:01 +03:00
parent 0557a41f1a
commit 741520fa66
58 changed files with 6620 additions and 6810 deletions

View file

@ -76,10 +76,38 @@ void fATE1(void *arg)
printf("[ATE0]Usage to set wlan as default interface: ATE1=0\n"); printf("[ATE0]Usage to set wlan as default interface: ATE1=0\n");
} }
} }
/*
void fATTT(void *arg){
#if 1
ConfigDebugErr = -1;
ConfigDebugInfo = ~(_DBG_GDMA_ | _DBG_SPI_FLASH_);
ConfigDebugWarn = -1;
CfgSysDebugErr = -1;
CfgSysDebugInfo = -1;
CfgSysDebugWarn = -1;
#endif
printf("ethernet_init = %d\n", ethernet_mii_init()); // ethernet_init()); // HalMiiInit()); //HalMiiInitRtl8195a();
}
void fATT1(void *arg){
#if 1
ConfigDebugErr = -1;
ConfigDebugInfo = ~(_DBG_GDMA_ | _DBG_SPI_FLASH_);
ConfigDebugWarn = -1;
CfgSysDebugErr = -1;
CfgSysDebugInfo = -1;
CfgSysDebugWarn = -1;
#endif
printf("ethernet_write = %d\n", ethernet_write((const char *)0x1000, 1024));
printf("ethernet_send = %d\n", ethernet_send());
}
*/
log_item_t at_ethernet_items[ ] = { log_item_t at_ethernet_items[ ] = {
{"ATE0", fATE0,}, {"ATE0", fATE0},
{"ATE1", fATE1,} // {"ATTT", fATTT}, // Test !
// {"ATT1", fATT1}, // Test !
{"ATE1", fATE1}
}; };
void at_ethernet_init(void) void at_ethernet_init(void)

View file

@ -8,6 +8,7 @@
#include "hal_adc.h" #include "hal_adc.h"
#include "gpio_api.h" // mbed #include "gpio_api.h" // mbed
#include "sys_api.h" #include "sys_api.h"
#include "rtl8195a.h"
#include "flash_api.h" #include "flash_api.h"
#include "rtl_lib.h" #include "rtl_lib.h"
#include "build_info.h" #include "build_info.h"
@ -50,46 +51,22 @@ struct _dev_id2name {
u8 *name; u8 *name;
}; };
struct _dev_id2name dev_id2name[] = { struct _dev_id2name dev_id2name[] = { { UART0, "UART0" }, { UART1, "UART1" }, {
{UART0, "UART0"}, {UART1, "UART1"}, {UART2, "UART2"}, UART2, "UART2" }, { SPI0, "SPI0" }, { SPI1, "SPI1" }, { SPI2, "SPI2" }, {
{SPI0, "SPI0"}, {SPI1, "SPI1"}, {SPI2, "SPI2"}, SPI0_MCS, "SPI0_MCS" }, { I2C0, "I2C0" }, { I2C1, "I2C1" }, { I2C2, "I2C2" }, {
{SPI0_MCS, "SPI0_MCS"}, I2C3, "I2C3" }, { I2S0, "I2S0" }, { I2S1, "I2S1" }, { PCM0, "PCM0" }, {
{I2C0, "I2C0"}, {I2C1, "I2C1"}, {I2C2, "I2C2"}, {I2C3, "I2C3"}, PCM1, "PCM1" }, { ADC0, "ADC0" }, { DAC0, "DAC0" }, { DAC1, "DAC1" }, {
{I2S0, "I2S0"}, {I2S1, "I2S1"}, SDIOD, "SDIOD" }, { SDIOH, "SDIOH" }, { USBOTG, "USBOTG" }, { MII, "MII" }, {
{PCM0, "PCM0"}, {PCM1, "PCM1"}, WL_LED, "WL_LED" }, { WL_ANT0, "WL_ANT0" }, { WL_ANT1, "WL_ANT1" }, {
{ADC0, "ADC0"}, WL_BTCOEX, "WL_BTCOEX" }, { WL_BTCMD, "WL_BTCMD" }, { NFC, "NFC" }, {
{DAC0, "DAC0"}, {DAC1, "DAC1"}, PWM0, "PWM0" }, { PWM1, "PWM1" }, { PWM2, "PWM2" }, { PWM3, "PWM3" }, {
{SDIOD, "SDIOD"}, {SDIOH, "SDIOH"}, ETE0, "ETE0" }, { ETE1, "ETE1" }, { ETE2, "ETE2" }, { ETE3, "ETE3" }, {
{USBOTG, "USBOTG"}, EGTIM, "EGTIM" }, { SPI_FLASH, "SPI_FLASH" }, { SDR, "SDR" }, { JTAG, "JTAG" },
{MII, "MII"}, { TRACE, "TRACE" }, { LOG_UART, "LOG_UART" }, {
{WL_LED, "WL_LED"}, LOG_UART_IR, "LOG_UART_IR" }, { SIC, "SIC" }, { EEPROM, "EEPROM" }, {
{WL_ANT0,"WL_ANT0"}, {WL_ANT1,"WL_ANT1"}, DEBUG, "DEBUG" }, { 255, "" } };
{WL_BTCOEX,"WL_BTCOEX"}, {WL_BTCMD,"WL_BTCMD"},
{NFC,"NFC"},
{PWM0,"PWM0"}, {PWM1,"PWM1"}, {PWM2,"PWM2"}, {PWM3,"PWM3"},
{ETE0,"ETE0"}, {ETE1,"ETE1"}, {ETE2,"ETE2"}, {ETE3,"ETE3"},
{EGTIM,"EGTIM"},
{SPI_FLASH,"SPI_FLASH"},
{SDR,"SDR"},
{JTAG,"JTAG"},
{TRACE,"TRACE"},
{LOG_UART,"LOG_UART"}, {LOG_UART_IR,"LOG_UART_IR"},
{SIC,"SIC"},
{EEPROM,"EEPROM"},
{DEBUG,"DEBUG"},
{255,""}};
#include "rtl8195a.h" void fATSI(void *arg) {
#include "rtl8195a_sdio_host.h"
#include "hal_sdio_host.h"
#include "sd.h"
#include "sdio_host.h"
extern HAL_SDIO_HOST_ADAPTER SdioHostAdapter;
extern void SdioHostSdBusPwrCtrl(uint8_t En);
extern int SdioHostSdClkCtrl(void *Data, int En, int Divisor);
void fATXX(void *arg)
{
uint32 x = 0; uint32 x = 0;
int i; int i;
u8 * s; u8 * s;
@ -115,22 +92,16 @@ void fATXX(void *arg)
} }
printf("Dev %s, state = %s\n", dev_id2name[i].name, s); printf("Dev %s, state = %s\n", dev_id2name[i].name, s);
} }
for(i = 0; i < _PORT_MAX; i++) printf("Port %c state: 0x%04x\n", i+'A', GPIOState[i]); for (i = 0; i < _PORT_MAX; i++)
printf("Port %c state: 0x%04x\n", i + 'A', GPIOState[i]);
} }
#ifdef CONFIG_SDR_EN
extern s32 MemTest(u32 LoopCnt);
void fATSM(void *arg)
{
MemTest(1);
}
#endif
//-------- AT SYS commands --------------------------------------------------------------- //-------- AT SYS commands ---------------------------------------------------------------
void fATSD(void *arg) void fATSD(void *arg) {
{
int argc = 0; int argc = 0;
char *argv[MAX_ARGC] = { 0 }; char *argv[MAX_ARGC] = { 0 };
SD_DeInit(); AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS,
AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS, "[ATSD]: _AT_SYSTEM_DUMP_REGISTER_"); "[ATSD]: _AT_SYSTEM_DUMP_REGISTER_");
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS, "[ATSD] Usage: ATSD=REGISTER"); AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS, "[ATSD] Usage: ATSD=REGISTER");
return; return;
@ -141,14 +112,15 @@ void fATSD(void *arg)
} }
#if ATCMD_VER == ATVER_2 #if ATCMD_VER == ATVER_2
void fATXD(void *arg) void fATXD(void *arg) {
{
int argc = 0; int argc = 0;
char *argv[MAX_ARGC] = { 0 }; char *argv[MAX_ARGC] = { 0 };
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATXD]: _AT_SYSTEM_WRITE_REGISTER_"); AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS,
"[ATXD]: _AT_SYSTEM_WRITE_REGISTER_");
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATXD] Usage: ATXD=REGISTER,VALUE"); AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS,
"[ATXD] Usage: ATXD=REGISTER,VALUE");
return; return;
} }
argc = parse_param(arg, argv); argc = parse_param(arg, argv);
@ -179,7 +151,6 @@ void fATSY(void *arg)
} }
#endif #endif
#if SUPPORT_MP_MODE #if SUPPORT_MP_MODE
void fATSA(void *arg) void fATSA(void *arg)
{ {
@ -347,7 +318,6 @@ void fATSG(void *arg)
AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ALWAYS, "[ATSG] %c%c = %d", port, num, val); AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ALWAYS, "[ATSG] %c%c = %d", port, num, val);
} }
void fATSP(void *arg) void fATSP(void *arg)
{ {
int argc = 0; int argc = 0;
@ -654,7 +624,6 @@ extern void print_tcpip_at(void *arg);
// uart version 2 echo info // uart version 2 echo info
extern unsigned char gAT_Echo; extern unsigned char gAT_Echo;
void fATS0(void *arg) { void fATS0(void *arg) {
at_printf("\r\n[AT] OK"); at_printf("\r\n[AT] OK");
} }
@ -685,14 +654,27 @@ void fATSR(void *arg){
void fATSV(void *arg) { void fATSV(void *arg) {
char at_buf[32]; char at_buf[32];
char fw_buf[32]; char fw_buf[32];
char cspimode[4] = { 'S', 'D', 'Q', '?' };
if (fspic_isinit == 0) {
flash_turnon();
flash_init(&flashobj);
SpicDisableRtl8195A();
}
printf(
"DeviceID: %02X, Flash Size: %d bytes, FlashID: %02X%02X%02X/%d, SpicMode: %cIO\n",
HalGetChipId(), (u32) (1 << flashobj.SpicInitPara.id[2]),
flashobj.SpicInitPara.id[0], flashobj.SpicInitPara.id[1],
flashobj.SpicInitPara.id[2], flashobj.SpicInitPara.flashtype,
cspimode[flashobj.SpicInitPara.Mode.BitMode]);
// get at version // get at version
strcpy(at_buf, ATCMD_VERSION"."ATCMD_SUBVERSION"."ATCMD_REVISION); strcpy(at_buf, ATCMD_VERSION"."ATCMD_SUBVERSION"."ATCMD_REVISION);
// get fw version // get fw version
strcpy(fw_buf, SDK_VERSION); strcpy(fw_buf, SDK_VERSION);
printf("%s,%s(%s)\n", at_buf, fw_buf, RTL8195AFW_COMPILE_TIME);
at_printf("\r\n[ATSV] OK:%s,%s(%s)",at_buf,fw_buf,RTL8195AFW_COMPILE_TIME); at_printf("\r\n[ATSV] OK:%s,%s(%s)", at_buf, fw_buf,
RTL8195AFW_COMPILE_TIME);
} }
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1) #if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
@ -705,12 +687,14 @@ void fATSP(void *arg){
uint32_t bitmap; uint32_t bitmap;
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR, "\r\n[ATSP] Usage: ATSP=<a/r/?>"); AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR,
"\r\n[ATSP] Usage: ATSP=<a/r/?>");
at_printf("\r\n[ATSP] ERROR:1"); at_printf("\r\n[ATSP] ERROR:1");
return; return;
} else { } else {
if ((argc = parse_param(arg, argv)) != 2) { if ((argc = parse_param(arg, argv)) != 2) {
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR, "\r\n[ATSP] Usage: ATSP=<a/r/?>"); AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR,
"\r\n[ATSP] Usage: ATSP=<a/r/?>");
at_printf("\r\n[ATSP] ERROR:1"); at_printf("\r\n[ATSP] ERROR:1");
return; return;
} }
@ -734,7 +718,8 @@ void fATSP(void *arg){
case '?': // get status case '?': // get status
break; break;
default: default:
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR, "\r\n[ATSP] Usage: ATSP=<a/r/?>"); AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR,
"\r\n[ATSP] Usage: ATSP=<a/r/?>");
at_printf("\r\n[ATSP] ERROR:2"); at_printf("\r\n[ATSP] ERROR:2");
return; return;
} }
@ -749,9 +734,11 @@ void fATSE(void *arg){
char *argv[MAX_ARGC] = { 0 }; char *argv[MAX_ARGC] = { 0 };
int err_no = 0; int err_no = 0;
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "[ATSE]: _AT_SYSTEM_ECHO_DBG_SETTING"); AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS,
"[ATSE]: _AT_SYSTEM_ECHO_DBG_SETTING");
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR, "[ATSE] Usage: ATSE=<echo>,<dbg_msk>,<dbg_lv>"); AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ERROR,
"[ATSE] Usage: ATSE=<echo>,<dbg_msk>,<dbg_lv>");
err_no = 1; err_no = 1;
goto exit; goto exit;
} }
@ -784,8 +771,7 @@ void fATSE(void *arg){
at_set_debug_level(dbg_lv); at_set_debug_level(dbg_lv);
} }
exit: exit: if (err_no)
if(err_no)
at_printf("\r\n[ATSE] ERROR:%d", err_no); at_printf("\r\n[ATSE] ERROR:%d", err_no);
else else
at_printf("\r\n[ATSE] OK"); at_printf("\r\n[ATSE] OK");
@ -875,13 +861,15 @@ void fATSO(void *arg){
char *argv[MAX_ARGC] = { 0 }; char *argv[MAX_ARGC] = { 0 };
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_OTA, AT_DBG_ERROR, "\r\n[ATSO] Usage: ATSO=<ip>,<port>"); AT_DBG_MSG(AT_FLAG_OTA, AT_DBG_ERROR,
"\r\n[ATSO] Usage: ATSO=<ip>,<port>");
at_printf("\r\n[ATSO] ERROR:1"); at_printf("\r\n[ATSO] ERROR:1");
return; return;
} }
argv[0] = "update"; argv[0] = "update";
if ((argc = parse_param(arg, argv)) != 3) { if ((argc = parse_param(arg, argv)) != 3) {
AT_DBG_MSG(AT_FLAG_OTA, AT_DBG_ERROR, "\r\n[ATSO] Usage: ATSO=<ip>,<port>"); AT_DBG_MSG(AT_FLAG_OTA, AT_DBG_ERROR,
"\r\n[ATSO] Usage: ATSO=<ip>,<port>");
at_printf("\r\n[ATSO] ERROR:1"); at_printf("\r\n[ATSO] ERROR:1");
return; return;
} }
@ -923,8 +911,7 @@ void fATSC(void *arg){
if (cmd == 1) { if (cmd == 1) {
cmd_ota_image(1); cmd_ota_image(1);
} } else {
else{
cmd_ota_image(0); cmd_ota_image(0);
} }
// reboot // reboot
@ -979,11 +966,10 @@ void fATSU(void *arg){
return; return;
} }
*/ */
if(((databits < 5) || (databits > 8))||\ if (((databits < 5) || (databits > 8)) || ((stopbits < 1) || (stopbits > 2))
((stopbits < 1) || (stopbits > 2))||\ || ((parity < 0) || (parity > 2))
((parity < 0) || (parity > 2))||\ || ((flowcontrol < 0) || (flowcontrol > 1))
((flowcontrol < 0) || (flowcontrol > 1))||\ || ((configmode < 0) || (configmode > 3))\
((configmode < 0) || (configmode > 3))\
) { ) {
at_printf("\r\n[ATSU] ERROR:2"); at_printf("\r\n[ATSU] ERROR:2");
return; return;
@ -995,8 +981,9 @@ void fATSU(void *arg){
uartconf.StopBits = stopbits; uartconf.StopBits = stopbits;
uartconf.Parity = parity; uartconf.Parity = parity;
uartconf.FlowControl = flowcontrol; uartconf.FlowControl = flowcontrol;
AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "AT_UART_CONF: %d,%d,%d,%d,%d",
"AT_UART_CONF: %d,%d,%d,%d,%d", uartconf.BaudRate, uartconf.DataBits,uartconf.StopBits,uartconf.Parity,uartconf.FlowControl); uartconf.BaudRate, uartconf.DataBits, uartconf.StopBits,
uartconf.Parity, uartconf.FlowControl);
switch (configmode) { switch (configmode) {
case 0: // set current configuration, won't save case 0: // set current configuration, won't save
uart_atcmd_reinit(&uartconf); uart_atcmd_reinit(&uartconf);
@ -1015,8 +1002,7 @@ void fATSU(void *arg){
#endif //#if CONFIG_EXAMPLE_UART_ATCMD #endif //#if CONFIG_EXAMPLE_UART_ATCMD
#endif //#if CONFIG_WLAN #endif //#if CONFIG_WLAN
void fATSG(void *arg) void fATSG(void *arg) {
{
gpio_t gpio_ctrl; gpio_t gpio_ctrl;
int argc = 0, val, error_no = 0; int argc = 0, val, error_no = 0;
char *argv[MAX_ARGC] = { 0 }, port, num; char *argv[MAX_ARGC] = { 0 }, port, num;
@ -1043,9 +1029,9 @@ void fATSG(void *arg)
pin = (port << 4 | num); pin = (port << 4 | num);
AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ALWAYS, "PORT: %s[%d]", argv[2], pin); AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ALWAYS, "PORT: %s[%d]", argv[2], pin);
if(gpio_set(pin) == 0xff) if (gpio_set(pin) == 0xff) {
{ AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ERROR, "[ATSG]: Invalid Pin Name [%d]",
AT_DBG_MSG(AT_FLAG_GPIO, AT_DBG_ERROR, "[ATSG]: Invalid Pin Name [%d]", pin); pin);
error_no = 3; error_no = 3;
goto exit; goto exit;
} }
@ -1063,17 +1049,14 @@ void fATSG(void *arg)
} }
if (argv[1][0] == 'R') { if (argv[1][0] == 'R') {
val = gpio_read(&gpio_ctrl); val = gpio_read(&gpio_ctrl);
} } else {
else{
val = atoi(argv[3]); val = atoi(argv[3]);
gpio_write(&gpio_ctrl, val); gpio_write(&gpio_ctrl, val);
} }
exit: exit: if (error_no) {
if(error_no){
at_printf("\r\n[ATSG] ERROR:%d", error_no); at_printf("\r\n[ATSG] ERROR:%d", error_no);
} } else {
else{
at_printf("\r\n[ATSG] OK:%d", val); at_printf("\r\n[ATSG] OK:%d", val);
} }
} }
@ -1087,8 +1070,7 @@ exit:
* bit2: LOGUART * bit2: LOGUART
* bit3: SDIO * bit3: SDIO
*/ */
void fATSL(void *arg) void fATSL(void *arg) {
{
int argc = 0; int argc = 0;
char *argv[MAX_ARGC] = { 0 }; char *argv[MAX_ARGC] = { 0 };
int err_no = 0; int err_no = 0;
@ -1097,13 +1079,15 @@ void fATSL(void *arg)
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL]: _AT_SYS_WAKELOCK_TEST_"); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL]: _AT_SYS_WAKELOCK_TEST_");
if (!arg) { if (!arg) {
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] Usage ATSL=[a/r/?][bitmask]"); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS,
"[ATSL] Usage ATSL=[a/r/?][bitmask]");
err_no = 1; err_no = 1;
goto exit; goto exit;
} else { } else {
argc = parse_param(arg, argv); argc = parse_param(arg, argv);
if (argc < 2) { if (argc < 2) {
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] Usage ATSL=[a/r/?][bitmask]"); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS,
"[ATSL] Usage ATSL=[a/r/?][bitmask]");
err_no = 2; err_no = 2;
goto exit; goto exit;
} }
@ -1116,7 +1100,8 @@ void fATSL(void *arg)
lock_id = strtoul(argv[2], NULL, 16); lock_id = strtoul(argv[2], NULL, 16);
acquire_wakelock(lock_id); acquire_wakelock(lock_id);
} }
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x", get_wakelock_status()); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x",
get_wakelock_status());
break; break;
} }
@ -1126,12 +1111,14 @@ void fATSL(void *arg)
lock_id = strtoul(argv[2], NULL, 16); lock_id = strtoul(argv[2], NULL, 16);
release_wakelock(lock_id); release_wakelock(lock_id);
} }
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x", get_wakelock_status()); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x",
get_wakelock_status());
break; break;
} }
case '?': // get status case '?': // get status
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x", get_wakelock_status()); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] wakelock:0x%08x",
get_wakelock_status());
#if (configGENERATE_RUN_TIME_STATS == 1) #if (configGENERATE_RUN_TIME_STATS == 1)
char *cBuffer = pvPortMalloc(512); char *cBuffer = pvPortMalloc(512);
if (cBuffer != NULL) { if (cBuffer != NULL) {
@ -1149,7 +1136,8 @@ void fATSL(void *arg)
break; break;
#endif #endif
default: default:
AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS, "[ATSL] Usage ATSL=[a/r/?][bitmask]"); AT_DBG_MSG(AT_FLAG_OS, AT_DBG_ALWAYS,
"[ATSL] Usage ATSL=[a/r/?][bitmask]");
err_no = 3; err_no = 3;
break; break;
} }
@ -1174,6 +1162,110 @@ void fATSX(void *arg)
#endif #endif
void print_hex_dump(uint8_t *buf, int len, unsigned char k) {
uint32_t ss[2];
ss[0] = 0x78323025; // "%02x"
ss[1] = k; // ","...'\0'
uint8_t * ptr = buf;
while (len--) {
if (len == 0)
ss[1] = 0;
printf((uint8_t *) &ss[0], *ptr++);
}
}
//ATFD - Flash Data Dump
void fATFD(void *arg) {
int argc = 0;
char *argv[MAX_ARGC] = { 0 };
#if DEBUG_AT_USER_LEVEL > 3
printf("ATFD: _AT_FLASH_DUMP_\n");
#endif
if (!arg) {
printf("Usage: ATFD=faddr(HEX),[size]\n");
} else {
argc = parse_param(arg, argv);
if (argc >= 1) {
int addr;
sscanf(argv[1], "%x", &addr);
int size = 0;
if (argc > 2)
size = atoi(argv[2]);
if (size <= 0 || size > 16384)
size = 1;
u32 symbs_line = 32;
u32 rdsize = 8 * symbs_line;
uint8_t *flash_data = (uint8_t *) malloc(rdsize);
while (size) {
if (size < rdsize)
rdsize = size;
else
rdsize = 8 * symbs_line;
flash_stream_read(&flashobj, addr, rdsize, flash_data);
uint8_t *ptr = flash_data;
while (ptr < flash_data + rdsize) {
if (symbs_line > size)
symbs_line = size;
printf("%08X ", addr);
print_hex_dump(ptr, symbs_line, ' ');
printf("\r\n");
addr += symbs_line;
ptr += symbs_line;
size -= symbs_line;
if (size == 0)
break;
}
}
free(flash_data);
}
}
}
void fATFO(void *arg) {
int argc = 0;
char *argv[MAX_ARGC] = { 0 };
#if DEBUG_AT_USER_LEVEL > 3
printf("ATFO: _AT_FLASH_OTP_DUMP_\n");
#endif
if (!arg) {
printf("Usage: ATFO=faddr(HEX),[size]\n");
} else {
argc = parse_param(arg, argv);
if (argc >= 1) {
int addr;
sscanf(argv[1], "%x", &addr);
int size = 0;
if (argc > 2)
size = atoi(argv[2]);
if (size <= 0 || size > 16384)
size = 1;
u32 symbs_line = 32;
u32 rdsize = 8 * symbs_line;
uint8_t *flash_data = (uint8_t *) malloc(rdsize);
while (size) {
if (size < rdsize)
rdsize = size;
else
rdsize = 8 * symbs_line;
flash_otp_read(&flashobj, addr, rdsize, flash_data);
uint8_t *ptr = flash_data;
while (ptr < flash_data + rdsize) {
if (symbs_line > size)
symbs_line = size;
printf("%08X ", addr);
print_hex_dump(ptr, symbs_line, ' ');
printf("\r\n");
addr += symbs_line;
ptr += symbs_line;
size -= symbs_line;
if (size == 0)
break;
}
}
free(flash_data);
}
}
}
void fATST(void *arg) { void fATST(void *arg) {
extern void dump_mem_block_list(void); // heap_5.c extern void dump_mem_block_list(void); // heap_5.c
@ -1200,69 +1292,101 @@ void fATST(void *arg){
#endif #endif
} }
#if 0
#include "wlan_lib.h"
#include "hal_com_reg.h"
// struct net_device *rltk_wlan_info;
void fATXT(void *arg)
{
#if DEBUG_AT_USER_LEVEL > 3
printf("ATWT: _AT_CFG_DUMP_\n");
#endif
int size = 512;
int addr = 0;
uint8_t *blk_data = (uint8_t *)malloc(size);
memset(blk_data, 0xff, size);
if(blk_data) {
uint8_t * ptr = blk_data;
Hal_ReadEFuse(*(_adapter **)(rltk_wlan_info->priv), 0, 0, 512, ptr, 1);
//rtw_flash_map_update(*(_adapter **)(rltk_wlan_info->priv), 512);
u32 symbs_line = 32;
while(addr < size) {
if(symbs_line > size) symbs_line = size;
printf("%08X ", addr);
print_hex_dump(ptr, symbs_line, ' ');
printf("\r\n");
addr += symbs_line;
ptr += symbs_line;
size -= symbs_line;
if(size == 0) break;
}
free(blk_data);
}
}
#endif
log_item_t at_sys_items[] = { log_item_t at_sys_items[] = {
#if (ATCMD_VER == ATVER_1) #if (ATCMD_VER == ATVER_1)
{"ATSD", fATSD,}, // Dump register { "ATSD", fATSD}, // Dump register
{"ATSE", fATSE,}, // Edit register { "ATSE", fATSE}, // Edit register
{"ATSC", fATSC,}, // Clear OTA signature { "ATSC", fATSC}, // Clear OTA signature
{"ATSR", fATSR,}, // Recover OTA signature { "ATSR", fATSR}, // Recover OTA signature
#if CONFIG_UART_XMODEM #if CONFIG_UART_XMODEM
{"ATSY", fATSY,}, // uart ymodem upgrade { "ATSY", fATSY}, // uart ymodem upgrade
#endif #endif
#if SUPPORT_MP_MODE #if SUPPORT_MP_MODE
{"ATSA", fATSA,}, // MP ADC test { "ATSA", fATSA}, // MP ADC test
{"ATSG", fATSG,}, // MP GPIO test { "ATSG", fATSG}, // MP GPIO test
{"ATSP", fATSP,}, // MP Power related test { "ATSP", fATSP}, // MP Power related test
{"ATSB", fATSB,}, // OTU PIN setup { "ATSB", fATSB}, // OTU PIN setup
#endif #endif
#if (configGENERATE_RUN_TIME_STATS == 1) #if (configGENERATE_RUN_TIME_STATS == 1)
{"ATSS", fATSS,}, // Show CPU stats { "ATSS", fATSS}, // Show CPU stats
#endif #endif
#if SUPPORT_CP_TEST #if SUPPORT_CP_TEST
{"ATSM", fATSM,}, // Apple CP test { "ATSM", fATSM}, // Apple CP test
#endif #endif
{"ATSJ", fATSJ,}, //trun off JTAG { "ATSJ", fATSJ}, //trun off JTAG
{"ATS@", fATSs,}, // Debug message setting { "ATS@", fATSs}, // Debug message setting
{"ATS!", fATSc,}, // Debug config setting { "ATS!", fATSc}, // Debug config setting
{"ATS#", fATSt,}, // test command { "ATS#", fATSt}, // test command
{"ATS?", fATSx,}, // Help { "ATS?", fATSx}, // Help
#elif ATCMD_VER == ATVER_2 //#if ATCMD_VER == ATVER_1 #elif ATCMD_VER == ATVER_2 //#if ATCMD_VER == ATVER_1
{"AT", fATS0,}, // test AT command ready { "AT", fATS0 }, // test AT command ready
{"ATS?", fATSh,}, // list all AT command { "ATS?", fATSh }, // list all AT command
{"ATSR", fATSR,}, // system restart { "ATSR", fATSR }, // system restart
{"ATSV", fATSV,}, // show version info { "ATSV", fATSV }, // show version info
{"ATSP", fATSP,}, // power saving mode { "ATSP", fATSP }, // power saving mode
{"ATSE", fATSE,}, // enable and disable echo { "ATSE", fATSE }, // enable and disable echo
#if CONFIG_WLAN #if CONFIG_WLAN
#if CONFIG_WEBSERVER #if CONFIG_WEBSERVER
{"ATSW", fATSW,}, // start webserver { "ATSW", fATSW}, // start webserver
#endif #endif
{"ATSY", fATSY,}, // factory reset { "ATSY", fATSY }, // factory reset
#if CONFIG_OTA_UPDATE #if CONFIG_OTA_UPDATE
{"ATSO", fATSO,}, // ota upgrate { "ATSO", fATSO }, // ota upgrate
{"ATSC", fATSC,}, // chose the activited image { "ATSC", fATSC }, // chose the activited image
#endif #endif
#if CONFIG_EXAMPLE_UART_ATCMD #if CONFIG_EXAMPLE_UART_ATCMD
{"ATSU", fATSU,}, // AT uart configuration { "ATSU", fATSU }, // AT uart configuration
#endif #endif
#endif #endif
{"ATSG", fATSG,}, // GPIO control { "ATSG", fATSG }, // GPIO control
#if CONFIG_UART_XMODEM #if CONFIG_UART_XMODEM
{"ATSX", fATSX,}, // uart xmodem upgrade { "ATSX", fATSX}, // uart xmodem upgrade
#endif #endif
{"ATSD", fATSD,}, // Dump register { "ATSD", fATSD }, // Dump register
{"ATXD", fATXD,}, // Write register { "ATXD", fATXD }, // Write register
#endif // end of #if ATCMD_VER == ATVER_1 #endif // end of #if ATCMD_VER == ATVER_1
// Following commands exist in two versions // Following commands exist in two versions
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1) #if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
{"ATSL", fATSL,}, // wakelock test { "ATSL", fATSL }, // wakelock test
#endif #endif
{ "ATFD", fATFD }, // Flash Data Damp
{ "ATFO", fATFO }, // Flash OTP Damp
{ "ATST", fATST }, // add pvvx: mem info { "ATST", fATST }, // add pvvx: mem info
{"ATXX", fATXX}, // test // { "ATXT", fATXT }, // add pvvx: cfg_wifi
#ifdef CONFIG_SDR_EN { "ATSI", fATSI } // Dev/Ports Info
{"ATSM", fATSM} // memtest
#endif
}; };
#if ATCMD_VER == ATVER_2 #if ATCMD_VER == ATVER_2
@ -1275,9 +1399,9 @@ void print_system_at(void *arg){
at_printf("\r\n%s", at_sys_items[index].log_cmd); at_printf("\r\n%s", at_sys_items[index].log_cmd);
} }
#endif #endif
void at_sys_init(void) void at_sys_init(void) {
{ log_service_add_table(at_sys_items,
log_service_add_table(at_sys_items, sizeof(at_sys_items)/sizeof(at_sys_items[0])); sizeof(at_sys_items) / sizeof(at_sys_items[0]));
} }
#if SUPPORT_LOG_SERVICE #if SUPPORT_LOG_SERVICE

View file

@ -2593,57 +2593,6 @@ void print_wlan_help(void *arg){
} }
#endif // end of #if ATCMD_VER == ATVER_1 #endif // end of #if ATCMD_VER == ATVER_1
#endif // end of #if CONFIG_WLAN
#if CONFIG_LWIP_LAYER
#if ATCMD_VER == ATVER_1
void fATWL(void *arg){
#if CONFIG_SSL_CLIENT
int argc;
char *argv[MAX_ARGC] = {0};
printf("[ATWL]: _AT_WLAN_SSL_CLIENT_\n");
argv[0] = "ssl_client";
if(!arg){
printf("ATWL=SSL_SERVER_HOST\n");
return;
}
if((argc = parse_param(arg, argv)) > 1){
if(argc != 2) {
printf("ATWL=SSL_SERVER_HOST\n");
return;
}
cmd_ssl_client(argc, argv);
}
#else
printf("Please set CONFIG_SSL_CLIENT 1 in platform_opts.h to enable ATWL command\n");
#endif
}
void fATWI(void *arg){
int argc;
char *argv[MAX_ARGC] = {0};
printf("[ATWI]: _AT_WLAN_PING_TEST_\n");
if(!arg){
printf("[ATWI] Usage: ATWI=[host],[options]\n");
printf(" -t Ping the specified host until stopped\n");
printf(" -n # Number of echo requests to send (default 4 times)\n");
printf(" -l # Send buffer size (default 32 bytes)\n");
printf(" Example:\n");
printf(" ATWI=192.168.1.2,-n,100,-l,5000\n");
return;
}
argv[0] = "ping";
if((argc = parse_param(arg, argv)) > 1){
cmd_ping(argc, argv);
}
}
void fATWT(void *arg) void fATWT(void *arg)
{ {
#if CONFIG_BSD_TCP #if CONFIG_BSD_TCP
@ -2719,6 +2668,57 @@ void fATWU(void *arg)
printf("Please set CONFIG_BSD_TCP 1 in platform_opts.h to enable ATWU command\n"); printf("Please set CONFIG_BSD_TCP 1 in platform_opts.h to enable ATWU command\n");
#endif #endif
} }
#endif // end of #if CONFIG_WLAN
#if CONFIG_LWIP_LAYER
#if ATCMD_VER == ATVER_1
void fATWL(void *arg){
#if CONFIG_SSL_CLIENT
int argc;
char *argv[MAX_ARGC] = {0};
printf("[ATWL]: _AT_WLAN_SSL_CLIENT_\n");
argv[0] = "ssl_client";
if(!arg){
printf("ATWL=SSL_SERVER_HOST\n");
return;
}
if((argc = parse_param(arg, argv)) > 1){
if(argc != 2) {
printf("ATWL=SSL_SERVER_HOST\n");
return;
}
cmd_ssl_client(argc, argv);
}
#else
printf("Please set CONFIG_SSL_CLIENT 1 in platform_opts.h to enable ATWL command\n");
#endif
}
void fATWI(void *arg){
int argc;
char *argv[MAX_ARGC] = {0};
printf("[ATWI]: _AT_WLAN_PING_TEST_\n");
if(!arg){
printf("[ATWI] Usage: ATWI=[host],[options]\n");
printf(" -t Ping the specified host until stopped\n");
printf(" -n # Number of echo requests to send (default 4 times)\n");
printf(" -l # Send buffer size (default 32 bytes)\n");
printf(" Example:\n");
printf(" ATWI=192.168.1.2,-n,100,-l,5000\n");
return;
}
argv[0] = "ping";
if((argc = parse_param(arg, argv)) > 1){
cmd_ping(argc, argv);
}
}
#elif ATCMD_VER == ATVER_2 // uart at command #elif ATCMD_VER == ATVER_2 // uart at command
//move to atcmd_lwip.c //move to atcmd_lwip.c
#endif #endif
@ -2813,6 +2813,10 @@ log_item_t at_wifi_items[ ] = {
{"ATWL", fATWL,}, //p2p listen {"ATWL", fATWL,}, //p2p listen
{"ATWP", fATWP,}, //p2p peers {"ATWP", fATWP,}, //p2p peers
#endif #endif
#if CONFIG_LWIP_LAYER
{"ATWT", fATWT,},
{"ATWU", fATWU,},
#endif
#ifdef CONFIG_PROMISC #ifdef CONFIG_PROMISC
{"ATWM", fATWM,}, // WIFI promisc Usage: ATWM=DURATION_SECONDS[with_len] {"ATWM", fATWM,}, // WIFI promisc Usage: ATWM=DURATION_SECONDS[with_len]
#endif #endif

View file

@ -23,6 +23,7 @@
extern int inic_start(void); extern int inic_start(void);
extern int inic_stop(void); extern int inic_stop(void);
#endif #endif
#include "wlan_lib.h"
#if CONFIG_DEBUG_LOG > 0 #if CONFIG_DEBUG_LOG > 0
#undef printf #undef printf

View file

@ -86,6 +86,10 @@ static rtw_result_t rtw_indicate_event_handle(int event_cmd, char *buf, int buf_
return RTW_SUCCESS; return RTW_SUCCESS;
} }
#endif #endif
#if 0 // test beacon
#include "gpio_api.h" // mbed
extern gpio_t gpio_led;
#endif
void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int flags) void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int flags)
{ {
@ -193,6 +197,10 @@ void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int fla
case WIFI_EVENT_BEACON_AFTER_DHCP: case WIFI_EVENT_BEACON_AFTER_DHCP:
#if(WIFI_INDICATE_MSG>1) #if(WIFI_INDICATE_MSG>1)
printf("%s(): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__); printf("%s(): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__);
#endif
#if 0 // test beacon
gpio_write(&gpio_led, 1);
gpio_write(&gpio_led, 0);
#endif #endif
break; break;
} }

View file

@ -160,11 +160,11 @@ void ethernet_demo(void* param){
printf("TRX pre setting done\n"); printf("TRX pre setting done\n");
ethernet_init(); ethernet_init();
#if 0
DBG_INFO_MSG_OFF(_DBG_MII_); DBG_INFO_MSG_OFF(_DBG_MII_);
DBG_WARN_MSG_OFF(_DBG_MII_); DBG_WARN_MSG_OFF(_DBG_MII_);
DBG_ERR_MSG_ON(_DBG_MII_); DBG_ERR_MSG_ON(_DBG_MII_);
#endif
/*get mac*/ /*get mac*/
ethernet_address(mac); ethernet_address(mac);
memcpy((void*)xnetif[NET_IF_NUM - 1].hwaddr,(void*)mac, 6); memcpy((void*)xnetif[NET_IF_NUM - 1].hwaddr,(void*)mac, 6);
@ -172,7 +172,7 @@ void ethernet_demo(void* param){
rtw_init_sema(&mii_rx_sema,0); rtw_init_sema(&mii_rx_sema,0);
rtw_mutex_init(&mii_tx_mutex); rtw_mutex_init(&mii_tx_mutex);
if(xTaskCreate(mii_rx_thread, ((const char*)"mii_rx_thread"), 1024, NULL, tskIDLE_PRIORITY+5, NULL) != pdPASS) if(xTaskCreate(mii_rx_thread, ((const char*)"mii_rx_th"), 1024, NULL, tskIDLE_PRIORITY+5, NULL) != pdPASS)
DBG_8195A("\n\r%s xTaskCreate(mii_rx_thread) failed", __FUNCTION__); DBG_8195A("\n\r%s xTaskCreate(mii_rx_thread) failed", __FUNCTION__);
DBG_8195A("\nEthernet_mii Init done, interface %d",NET_IF_NUM - 1); DBG_8195A("\nEthernet_mii Init done, interface %d",NET_IF_NUM - 1);
@ -191,11 +191,11 @@ void ethernet_mii_init()
ethernet_if_default = 1; ethernet_if_default = 1;
rtw_init_sema(&mii_linkup_sema,0); rtw_init_sema(&mii_linkup_sema,0);
if( xTaskCreate((TaskFunction_t)dhcp_start_mii, "DHCP_START_MII", 1024, NULL, 2, NULL) != pdPASS) { if( xTaskCreate((TaskFunction_t)dhcp_start_mii, "DHCP_MII", 1024, NULL, 2, NULL) != pdPASS) {
DBG_8195A("Cannot create demo task\n\r"); DBG_8195A("Cannot create demo task\n\r");
} }
if( xTaskCreate((TaskFunction_t)ethernet_demo, "ETHERNET DEMO", 1024, NULL, 2, NULL) != pdPASS) { if( xTaskCreate((TaskFunction_t)ethernet_demo, "ETH_DEMO", 1024, NULL, 2, NULL) != pdPASS) {
DBG_8195A("Cannot create demo task\n\r"); DBG_8195A("Cannot create demo task\n\r");
} }

View file

@ -5,6 +5,7 @@
*/ */
#include "rtl8195a.h" #include "rtl8195a.h"
#ifdef CONFIG_SDIO_HOST_EN
#include "sd.h" #include "sd.h"
#include "sdio_host.h" #include "sdio_host.h"
@ -117,7 +118,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
u32 end_sector = count + sector; u32 end_sector = count + sector;
while (sector < end_sector) { while (sector < end_sector) {
rd_count = sdio_read_blocks(sector, buf, 1); rd_count = sdio_read_blocks(sector, buf, 1);
rtl_printf("rd_counts = %d\n", rd_count); // rtl_printf("rd_counts = %d\n", rd_count);
if (rd_count == 0 && RtlDownSemaWithTimeout(&sdWSema, 1000) != 1) { if (rd_count == 0 && RtlDownSemaWithTimeout(&sdWSema, 1000) != 1) {
DBG_SDIO_ERR("SD_ReadBlocks timeout\n"); DBG_SDIO_ERR("SD_ReadBlocks timeout\n");
return SD_ERROR; return SD_ERROR;
@ -172,3 +173,4 @@ SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) {
return SD_ERROR; return SD_ERROR;
} }
#endif // CONFIG_SDIO_HOST_EN

View file

@ -5,6 +5,7 @@
*/ */
#include "rtl8195a.h" #include "rtl8195a.h"
#ifdef CONFIG_SDIO_HOST_EN
#include "sd.h" #include "sd.h"
#include "sdio_host.h" #include "sdio_host.h"
#include "hal_sdio_host.h" #include "hal_sdio_host.h"
@ -45,13 +46,17 @@ void xfer_err_callback(void *param) {
} }
void card_insert_callback(void *param) { void card_insert_callback(void *param) {
#if CONFIG_DEBUG_LOG > 1
rtl_printf("SD card insert\n"); rtl_printf("SD card insert\n");
#endif
if (card_insert_irq_handler) if (card_insert_irq_handler)
card_insert_irq_handler((void *) card_insert_irq_data); card_insert_irq_handler((void *) card_insert_irq_data);
} }
void card_remove_callback(void *param) { void card_remove_callback(void *param) {
#if CONFIG_DEBUG_LOG > 1
rtl_printf("SD card removed\n"); rtl_printf("SD card removed\n");
#endif
sdio_status = SDIO_SD_NONE; sdio_status = SDIO_SD_NONE;
if (card_remove_irq_handler) if (card_remove_irq_handler)
card_remove_irq_handler((void *) card_remove_irq_data); card_remove_irq_handler((void *) card_remove_irq_data);
@ -208,7 +213,7 @@ s8 sdio_write_blocks(uint32_t sector, const uint8_t *buffer, uint32_t count) {
HAL_Status result = HalSdioHostOp.HalSdioHostWriteBlocksDma( HAL_Status result = HalSdioHostOp.HalSdioHostWriteBlocksDma(
&SdioHostAdapter, (unsigned long long) sector * SIZE_BLOCK_ADMA, &SdioHostAdapter, (unsigned long long) sector * SIZE_BLOCK_ADMA,
count); count);
if (result) { if (result != HAL_OK) {
DBG_SDIO_ERR("write fail(0x%02x)\n", result); DBG_SDIO_ERR("write fail(0x%02x)\n", result);
return -1; return -1;
} }
@ -230,7 +235,7 @@ s8 sdio_sd_init(void) {
} }
sdio_status = SDIO_SD_OK; sdio_status = SDIO_SD_OK;
if (HalSdioHostOp.HalSdioHostChangeSdClock(&SdioHostAdapter, if (HalSdioHostOp.HalSdioHostChangeSdClock(&SdioHostAdapter,
SD_CLK_41_6MHZ)) SD_CLK_41_6MHZ) != HAL_OK)
DBG_SDIO_INFO("SD card does not support high speed.\n"); DBG_SDIO_INFO("SD card does not support high speed.\n");
} }
return 0; return 0;
@ -239,7 +244,7 @@ s8 sdio_sd_init(void) {
//----- //-----
void sdio_sd_deinit() { void sdio_sd_deinit() {
if (sdio_status > SDIO_SD_NONE) if (sdio_status > SDIO_SD_NONE)
sdio_status = 1; sdio_status = SDIO_INIT_OK;
sdio_deinit_host(); // add pvvx (fix SD_DeInit()) sdio_deinit_host(); // add pvvx (fix SD_DeInit())
} }
@ -400,3 +405,4 @@ s8 sdio_sd_hook_xfer_err_cb(sdio_sd_irq_handler CallbackFun, void *param) {
return 0; return 0;
} }
#endif // CONFIG_SDIO_HOST_EN

View file

@ -341,7 +341,8 @@ typedef enum {
RTW_MODE_AP, RTW_MODE_AP,
RTW_MODE_STA_AP, RTW_MODE_STA_AP,
RTW_MODE_PROMISC, RTW_MODE_PROMISC,
RTW_MODE_P2P RTW_MODE_P2P,
RTW_MODE_MAX
} rtw_mode_t; } rtw_mode_t;
typedef enum { typedef enum {

View file

@ -38,19 +38,19 @@ extern int rtw_wx_set_freq(struct net_device *dev, struct iw_request_info *info,
extern int rtw_ex_set(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wdata, char *extra); extern int rtw_ex_set(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wdata, char *extra);
extern void wireless_send_event(struct net_device *dev, unsigned int cmd, union iwreq_data *wrqu, char *extra); extern void wireless_send_event(struct net_device *dev, unsigned int cmd, union iwreq_data *wrqu, char *extra);
extern void indicate_wx_custom_event(_adapter *padapter, char *msg); extern void indicate_wx_custom_event(_adapter *padapter, char *msg);
extern void indicate_wx_scan_result_present(__int64 padapter, __int64 a2); extern void indicate_wx_scan_result_present(uint64_t padapter, uint64_t a2);
extern void indicate_wx_scan_complete_event(__int64 padapter, __int64 a2); extern void indicate_wx_scan_complete_event(uint64_t padapter, uint64_t a2);
extern void rtw_indicate_sta_assoc(__int64 padapter, __int64 buf); extern void rtw_indicate_sta_assoc(uint64_t padapter, uint64_t buf);
extern void rtw_indicate_sta_disassoc(_adapter *padapter, uint8_t *addr); extern void rtw_indicate_sta_disassoc(_adapter *padapter, uint8_t *addr);
extern void rtw_indicate_wx_assoc_event(__int64 padapter, __int64 a2); extern void rtw_indicate_wx_assoc_event(uint64_t padapter, uint64_t a2);
extern void rtw_indicate_wx_disassoc_event(__int64 padapter, __int64 a2); extern void rtw_indicate_wx_disassoc_event(uint64_t padapter, uint64_t a2);
extern int rtw_set_wpa_ie(_adapter *padapter, char *pie, int ielen); extern int rtw_set_wpa_ie(_adapter *padapter, char *pie, int ielen);
extern void strtopsk(uint8_t *des, uint8_t *src, int len); extern void strtopsk(uint8_t *des, uint8_t *src, int len);
extern int rtw_wx_get_passphrase(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra); extern int rtw_wx_get_passphrase(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra);
extern int rtw_wx_set_ap_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra); extern int rtw_wx_set_ap_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra);
extern void mac_reg_dump(_adapter *padapter); extern void mac_reg_dump(_adapter *padapter);
extern void bb_reg_dump(_adapter *padapter); extern void bb_reg_dump(_adapter *padapter);
extern void rf_reg_dump(_adapter *padapter, int a2, int a3); extern void rf_reg_dump(_adapter *padapter); // , int a2, int a3);
extern int rtw_dbg_port(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); extern int rtw_dbg_port(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
extern int rtw_get_auto_channel(struct net_device *dev, u8 *channel_set, int channel_num); extern int rtw_get_auto_channel(struct net_device *dev, u8 *channel_set, int channel_num);
extern int rtw_set_sta_num(int ap_sta_num); extern int rtw_set_sta_num(int ap_sta_num);
@ -277,7 +277,7 @@ extern int max_timer_used_num;
//-------------------------------- //--------------------------------
// rtl8195a_cmd.o // rtl8195a_cmd.o
// Function declarations // Function declarations
extern int32_t FillH2CCmd8195A(PADAPTER padapter, int ElementID, __int64 CmdLen); extern int32_t FillH2CCmd8195A(PADAPTER padapter, int ElementID, uint64_t CmdLen);
extern void rtl8195a_set_FwRsvdPage_cmd(PADAPTER padapter, PH2CParam_RsvdPage pRsvdPage); extern void rtl8195a_set_FwRsvdPage_cmd(PADAPTER padapter, PH2CParam_RsvdPage pRsvdPage);
extern void rtl8195a_set_FwMediaStatusRpt_cmd(PADAPTER padapter, int mstatus, int macid); extern void rtl8195a_set_FwMediaStatusRpt_cmd(PADAPTER padapter, int mstatus, int macid);
extern void rtl8195a_set_FwMacIdConfig_cmd(_adapter *padapter, int mac_id, int raid, int bw, uint8_t sgi, uint32_t mask); extern void rtl8195a_set_FwMacIdConfig_cmd(_adapter *padapter, int mac_id, int raid, int bw, uint8_t sgi, uint32_t mask);
@ -1082,12 +1082,12 @@ extern signed int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame);
extern void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, int blnbc); extern void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, int blnbc);
extern void issue_auth(_adapter *padapter, struct sta_info *psta, int status); extern void issue_auth(_adapter *padapter, struct sta_info *psta, int status);
extern signed int OnAuth(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnAuth(_adapter *padapter, union recv_frame *precv_frame);
extern void issue_asocrsp(_adapter *padapter, unsigned __int16 status, struct sta_info *pstat, int pkt_type); extern void issue_asocrsp(_adapter *padapter, uint16_t status, struct sta_info *pstat, int pkt_type);
extern void issue_assocreq(_adapter *padapter); extern void issue_assocreq(_adapter *padapter);
extern void issue_nulldata(_adapter *padapter, unsigned int power_mode); extern void issue_nulldata(_adapter *padapter, unsigned int power_mode);
extern void issue_qos_nulldata(_adapter *padapter, u8 *da, uint16_t tid); extern void issue_qos_nulldata(_adapter *padapter, u8 *da, uint16_t tid);
extern void issue_deauth(_adapter *padapter, u8 *da, uint32_t reason); extern void issue_deauth(_adapter *padapter, u8 *da, uint32_t reason);
extern void issue_action_BA(_adapter *padapter, u8 *raddr, u8 action, unsigned __int16 status); extern void issue_action_BA(_adapter *padapter, u8 *raddr, u8 action, uint16_t status);
extern signed int OnAction_back(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnAction_back(_adapter *padapter, union recv_frame *precv_frame);
extern signed int send_beacon(_adapter *padapter); extern signed int send_beacon(_adapter *padapter);
extern signed int collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid); extern signed int collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid);
@ -1101,8 +1101,8 @@ extern signed int OnProbeRsp(_adapter *padapter, union recv_frame *precv_frame);
extern void report_surveydone_event(_adapter *padapter); extern void report_surveydone_event(_adapter *padapter);
extern void report_join_res(_adapter *padapter, int res); extern void report_join_res(_adapter *padapter, int res);
extern signed int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame);
extern void report_del_sta_event(_adapter *padapter, u8 *MacAddr, unsigned __int16 reason); extern void report_del_sta_event(_adapter *padapter, u8 *MacAddr, uint16_t reason);
extern signed int receive_disconnect(_adapter *padapter, u8 *MacAddr, unsigned __int16 reason); extern signed int receive_disconnect(_adapter *padapter, u8 *MacAddr, uint16_t reason);
extern signed int OnBeacon(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnBeacon(_adapter *padapter, union recv_frame *precv_frame);
extern signed int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame);
extern signed int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame); extern signed int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame);
@ -1240,7 +1240,7 @@ extern void (*promisc_callback)(u8 *, unsigned int, void *);
//-------------------------------- //--------------------------------
// rtw_psk.o // rtw_psk.o
// Function declarations // Function declarations
extern void SetEAPOL_KEYIV(OCTET_STRING ocDst, __int64 a2, OCTET32_INTEGER oc32Counter); extern void SetEAPOL_KEYIV(OCTET_STRING ocDst, uint64_t a2, OCTET32_INTEGER oc32Counter);
extern void ToDrv_SetPTK(_adapter *padapter, struct sta_info *psta); extern void ToDrv_SetPTK(_adapter *padapter, struct sta_info *psta);
extern void Message_ReplayCounter_OC2LI(int a1, LARGE_INTEGER *li); extern void Message_ReplayCounter_OC2LI(int a1, LARGE_INTEGER *li);
extern int Message_SmallerEqualReplayCounter(LARGE_INTEGER li1, int a2); extern int Message_SmallerEqualReplayCounter(LARGE_INTEGER li1, int a2);
@ -1402,7 +1402,7 @@ extern void rtw_txframes_update_attrib_vcs_info(_adapter *padapter, struct xmit_
extern int rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib); extern int rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib);
extern int32_t rtw_put_snap(uint8_t *data, int h_proto); extern int32_t rtw_put_snap(uint8_t *data, int h_proto);
extern void rtw_update_protection(_adapter *padapter, uint8_t *ie, unsigned int ie_len); extern void rtw_update_protection(_adapter *padapter, uint8_t *ie, unsigned int ie_len);
extern void rtw_count_tx_stats(PADAPTER padapter, struct xmit_frame *pxmitframe, __int64 sz); extern void rtw_count_tx_stats(PADAPTER padapter, struct xmit_frame *pxmitframe, uint64_t sz);
extern int32_t rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf, int a3); extern int32_t rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf, int a3);
extern struct list_head *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv, _irqL a2); extern struct list_head *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv, _irqL a2);
extern int32_t rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe); extern int32_t rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe);

View file

@ -37,6 +37,9 @@ struct sk_buff {
*/ */
/************************************************************/ /************************************************************/
// #include "wrapper.h"
extern struct net_device *rltk_wlan_info;
//----- ------------------------------------------------------------------ //----- ------------------------------------------------------------------
// Wlan Interface opened for upper layer // Wlan Interface opened for upper layer
//----- ------------------------------------------------------------------ //----- ------------------------------------------------------------------
@ -55,7 +58,6 @@ int rltk_wlan_set_wps_phase(unsigned char is_trigger_wps);
int rtw_ps_enable(int enable); int rtw_ps_enable(int enable);
int rltk_wlan_is_connected_to_ap(void); int rltk_wlan_is_connected_to_ap(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -301,6 +301,11 @@ void gpio_uart_at_rx_irq_callback (uint32_t id, gpio_irq_event event)
void uart_at_rx_wakeup() void uart_at_rx_wakeup()
{ {
gpio_irq_t gpio_rx_wake; gpio_irq_t gpio_rx_wake;
#ifdef RTL8711AM
#if (UART_AT_RX_WAKE!=PA_0)||(UART_AT_RX_WAKE!=PE_3)
#error "Set pin rx_wakeup!"
#endif
#endif
gpio_irq_init(&gpio_rx_wake, UART_AT_RX_WAKE, gpio_uart_at_rx_irq_callback, 0); gpio_irq_init(&gpio_rx_wake, UART_AT_RX_WAKE, gpio_uart_at_rx_irq_callback, 0);
gpio_irq_set(&gpio_rx_wake, IRQ_FALL, 1); // Falling Edge Trigger gpio_irq_set(&gpio_rx_wake, IRQ_FALL, 1); // Falling Edge Trigger
gpio_irq_enable(&gpio_rx_wake); gpio_irq_enable(&gpio_rx_wake);

View file

@ -13,27 +13,34 @@
#include "osdep_api.h" #include "osdep_api.h"
#if 0// defined(RTL8710AF) #if defined(RTL8710AF)
// RTL8710AF // RTL8710AF
#define UART_TX PA_4 // PC_3 #define UART_TX PA_4 // PC_3
#define UART_RX PA_0 // PC_0 #define UART_RX PA_0 // PC_0
#define UART_RTS PA_2 // PC_2 #define UART_RTS PA_2 // PC_2
#define UART_CTS PA_1 // PC_1 #define UART_CTS PA_1 // PC_1
#elif defined(RTL8711AM) #elif 0 // defined(RTL8711AM)
// RTL8711AM // RTL8711AM
#define UART_TX PA_7 #define UART_TX PA_7
#define UART_RX PA_6 #define UART_RX PA_6 // no Interrupt!
#define UART_RTS PA_3 #define UART_RTS PA_3
#define UART_CTS PA_5 #define UART_CTS PA_5
#else #elif 0 // else
// RTL8711AM + RTL8710AF // RTL8711AM + RTL8710AF
#define UART_TX PC_3 #define UART_TX PC_3
#define UART_RX PC_0 #define UART_RX PC_0 // no Interrupt!
#define UART_RTS PC_2 #define UART_RTS PC_2
#define UART_CTS PC_1 #define UART_CTS PC_1
#elif defined(RTL8711AM)
// RTL8711AM + RTL8710AF
#define UART_TX PE_0
#define UART_RX PE_3
#define UART_RTS PE_1
#define UART_CTS PE_2
#endif #endif
#define KEY_ENTER 0xd #define KEY_ENTER 0xd

View file

@ -55,7 +55,6 @@ DRESULT SD_disk_read(BYTE *buff, DWORD sector, UINT count){
#if _USE_WRITE == 1 #if _USE_WRITE == 1
DRESULT SD_disk_write(const BYTE *buff, DWORD sector, UINT count){ DRESULT SD_disk_write(const BYTE *buff, DWORD sector, UINT count){
SD_RESULT res; SD_RESULT res;
res = SD_WriteBlocks(sector, buff, count); res = SD_WriteBlocks(sector, buff, count);
return interpret_sd_result(res); return interpret_sd_result(res);

View file

@ -45,7 +45,7 @@
/* To enable fast seek feature, set _USE_FASTSEEK to 1. */ /* To enable fast seek feature, set _USE_FASTSEEK to 1. */
#define _USE_LABEL 0 /* 0:Disable or 1:Enable */ #define _USE_LABEL 1 /* 0:Disable or 1:Enable */
/* To enable volume label functions, set _USE_LAVEL to 1 */ /* To enable volume label functions, set _USE_LAVEL to 1 */
@ -57,7 +57,7 @@
/ Locale and Namespace Configurations / Locale and Namespace Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define _CODE_PAGE 437 #define _CODE_PAGE 866 // 437
/* The _CODE_PAGE specifies the OEM code page to be used on the target system. /* The _CODE_PAGE specifies the OEM code page to be used on the target system.
/ Incorrect setting of the code page can cause a file open failure. / Incorrect setting of the code page can cause a file open failure.
/ /

View file

@ -2568,7 +2568,6 @@ FRESULT f_read (
UINT rcnt, cc; UINT rcnt, cc;
BYTE csect, *rbuff = (BYTE*)buff; BYTE csect, *rbuff = (BYTE*)buff;
*br = 0; /* Clear read byte counter */ *br = 0; /* Clear read byte counter */
res = validate(fp); /* Check validity */ res = validate(fp); /* Check validity */
@ -2670,9 +2669,10 @@ FRESULT f_write (
const BYTE *wbuff = (const BYTE*)buff; const BYTE *wbuff = (const BYTE*)buff;
BYTE csect; BYTE csect;
*bw = 0; /* Clear write byte counter */ *bw = 0; /* Clear write byte counter */
// rtl_printf("f_write(%p, %p, %d) = %d\n", fp, buff, btw);
res = validate(fp); /* Check validity */ res = validate(fp); /* Check validity */
if (res != FR_OK) LEAVE_FF(fp->fs, res); if (res != FR_OK) LEAVE_FF(fp->fs, res);
if (fp->err) /* Check error */ if (fp->err) /* Check error */
@ -2773,8 +2773,6 @@ FRESULT f_write (
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Synchronize the File */ /* Synchronize the File */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/

View file

@ -75,8 +75,6 @@ void freertos_pre_sleep_processing(unsigned int *expected_idle_time) {
uint32_t tick_after_sleep; uint32_t tick_after_sleep;
uint32_t tick_passed; uint32_t tick_passed;
uint32_t backup_systick_reg; uint32_t backup_systick_reg;
unsigned char IsDramOn = 1;
unsigned char suspend_sdram = 1;
#if (configGENERATE_RUN_TIME_STATS == 1) #if (configGENERATE_RUN_TIME_STATS == 1)
uint32_t kernel_tick_before_sleep; uint32_t kernel_tick_before_sleep;
@ -101,20 +99,6 @@ void freertos_pre_sleep_processing(unsigned int *expected_idle_time) {
// Store gtimer timestamp before sleep // Store gtimer timestamp before sleep
tick_before_sleep = us_ticker_read(); tick_before_sleep = us_ticker_read();
if ( sys_is_sdram_power_on() == 0 ) {
IsDramOn = 0;
}
if (IsDramOn) {
#if defined(FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM) && (FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM==0)
// sdram is turned on, and we don't want suspend sdram
suspend_sdram = 0;
#endif
} else {
// sdram didn't turned on, we should not suspend it
suspend_sdram = 0;
}
#if (FREERTOS_PMU_DISABLE_LOGUART_IN_TICKLESS) #if (FREERTOS_PMU_DISABLE_LOGUART_IN_TICKLESS)
// config gpio on log uart tx for pull ctrl // config gpio on log uart tx for pull ctrl
HAL_GPIO_PIN gpio_log_uart_tx; HAL_GPIO_PIN gpio_log_uart_tx;
@ -129,8 +113,16 @@ void freertos_pre_sleep_processing(unsigned int *expected_idle_time) {
backup_systick_reg = portNVIC_SYSTICK_CURRENT_VALUE_REG; backup_systick_reg = portNVIC_SYSTICK_CURRENT_VALUE_REG;
#ifdef CONFIG_SDR_EN
// sleep // sleep
sleep_ex_selective(wakeup_event, stime, reserve_pll, suspend_sdram); #if defined(FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM) && (FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM!=0)
sleep_ex_selective(wakeup_event, stime, reserve_pll, IsSdrPowerOn());
#else
sleep_ex_selective(wakeup_event, stime, reserve_pll, 0);
#endif
#else
sleep_ex_selective(wakeup_event, stime, reserve_pll, 0);
#endif // CONFIG_SDR_EN
portNVIC_SYSTICK_CURRENT_VALUE_REG = backup_systick_reg; portNVIC_SYSTICK_CURRENT_VALUE_REG = backup_systick_reg;

View file

@ -309,7 +309,7 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
/* IAR iccarm specific functions */ /* IAR iccarm specific functions */
#include <cmsis_iar.h> // #include <cmsis_iar.h>
#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/

View file

@ -295,7 +295,7 @@ __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(in
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
/* IAR iccarm specific functions */ /* IAR iccarm specific functions */
#include <cmsis_iar.h> // #include <cmsis_iar.h>
#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/

View file

@ -79,7 +79,7 @@ extern _LONG_CALL_ROM_ const char * prvStrStr(
IN const char * str2 IN const char * str2
); );
#ifndef __GNUC__
/* /*
* Fast implementation of tolower() for internal usage. Do not use in your * Fast implementation of tolower() for internal usage. Do not use in your
* code. * code.
@ -88,6 +88,7 @@ static inline char _tolower(const char c)
{ {
return c | 0x20; return c | 0x20;
} }
#endif
/* Fast check for octal digit */ /* Fast check for octal digit */
static inline int isodigit(const char c) static inline int isodigit(const char c)

View file

@ -49,7 +49,7 @@
#define __SYSTEM_CLOCK (200000000UL/6*5) // PLATFORM_CLOCK // #define __SYSTEM_CLOCK (200000000UL/6*5) // PLATFORM_CLOCK //
extern unsigned int rand_x; extern unsigned int rand_x;
extern u32 HalGetCpuClk(VOID); //extern u32 HalGetCpuClk(VOID);
#ifdef CONFIG_CHIP_A_CUT #ifdef CONFIG_CHIP_A_CUT
const u32 SysCpkClkTbl[]= { const u32 SysCpkClkTbl[]= {

View file

@ -244,7 +244,7 @@ HAL_GPIO_IP_DeInit(
extern u16 GPIOState[_PORT_MAX-1]; // побитно 16 бит для каждого порта (A..K), бит=номер задействованного пина в порту на переферию. extern u16 GPIOState[_PORT_MAX-1]; // побитно 16 бит для каждого порта (A..K), бит=номер задействованного пина в порту на периферию.
#endif // end of "#define _HAL_GPIO_H_" #endif // end of "#define _HAL_GPIO_H_"

View file

@ -31,11 +31,12 @@ enum _HAL_RESET_REASON{
typedef u32 HAL_RESET_REASON; typedef u32 HAL_RESET_REASON;
#ifdef CONFIG_TIMER_MODULE #ifdef CONFIG_TIMER_MODULE
extern _LONG_CALL_ u32 HalDelayUs(u32 us); extern _LONG_CALL_ unsigned int HalDelayUs(unsigned int us);
#endif #endif
extern _LONG_CALL_ u32 HalGetCpuClk(VOID); extern _LONG_CALL_ unsigned int HalGetCpuClk(VOID);
extern _LONG_CALL_ u8 HalGetRomInfo(VOID); extern _LONG_CALL_ unsigned char HalGetRomInfo(VOID);
extern u8 HalGetChipId(void);
extern _LONG_CALL_ROM_ void *_memset( void *s, int c, SIZE_T n ); extern _LONG_CALL_ROM_ void *_memset( void *s, int c, SIZE_T n );
extern _LONG_CALL_ROM_ void *_memcpy( void *s1, const void *s2, SIZE_T n ); extern _LONG_CALL_ROM_ void *_memcpy( void *s1, const void *s2, SIZE_T n );

View file

@ -14,11 +14,9 @@
#include "rtl8195a_sdio_host.h" #include "rtl8195a_sdio_host.h"
#define SDIO_HOST_WAIT_FOREVER 0xFFFFFFFF #define SDIO_HOST_WAIT_FOREVER 0xFFFFFFFF
typedef struct _HAL_SDIO_HOST_OP_ { typedef struct _HAL_SDIO_HOST_OP_ {
HAL_Status (*HalSdioHostInitHost) (VOID *Data); HAL_Status (*HalSdioHostInitHost) (VOID *Data);
HAL_Status (*HalSdioHostInitCard) (VOID *Data); HAL_Status (*HalSdioHostInitCard) (VOID *Data);
@ -48,20 +46,20 @@ typedef enum _SDIO_XFER_TYPE_{
}SDIO_XFER_TYPE; }SDIO_XFER_TYPE;
typedef struct _HAL_SDIO_HOST_ADAPTER_{ typedef struct _HAL_SDIO_HOST_ADAPTER_{
IRQ_HANDLE IrqHandle; // Irq Handler IRQ_HANDLE IrqHandle; //+0..6(u32) Irq Handler
ADMA2_DESC_FMT *AdmaDescTbl; ADMA2_DESC_FMT *AdmaDescTbl; //+7(u32)
u32 Response[4]; u32 Response[4]; //+8..11(u32)
u32 CardOCR; u32 CardOCR; //+12
u32 CardStatus; u32 CardStatus; //+13
u32 IsWriteProtect; u32 IsWriteProtect; //+14
u8 SdStatus[SD_STATUS_LEN]; u8 SdStatus[SD_STATUS_LEN]; //+15..
u8 Csd[CSD_REG_LEN]; u8 Csd[CSD_REG_LEN]; //+31
volatile u8 CmdCompleteFlg; volatile u8 CmdCompleteFlg;
volatile u8 XferCompleteFlg; volatile u8 XferCompleteFlg;
volatile u8 ErrIntFlg; volatile u8 ErrIntFlg;
volatile u8 CardCurState; volatile u8 CardCurState;
u8 IsSdhc; u8 IsSdhc;
u8 CurrSdClk; u8 CurrSdClk; //+133?
u16 RCA; u16 RCA;
u16 SdSpecVer; u16 SdSpecVer;
SDIO_ERR_TYPE errType; SDIO_ERR_TYPE errType;
@ -76,6 +74,7 @@ typedef struct _HAL_SDIO_HOST_ADAPTER_{
VOID *CardRemoveCbPara; VOID *CardRemoveCbPara;
}HAL_SDIO_HOST_ADAPTER, *PHAL_SDIO_HOST_ADAPTER; }HAL_SDIO_HOST_ADAPTER, *PHAL_SDIO_HOST_ADAPTER;
extern HAL_SDIO_HOST_ADAPTER SdioHostAdapter;
extern HAL_Status extern HAL_Status
HalSdioHostInit( HalSdioHostInit(
@ -102,6 +101,5 @@ HalSdioHostOpInit(
IN VOID *Data IN VOID *Data
); );
#endif #endif

View file

@ -55,6 +55,7 @@ enum _SPIC_BIT_MODE_ {
SpicOneBitMode = 0, SpicOneBitMode = 0,
SpicDualBitMode = 1, SpicDualBitMode = 1,
SpicQuadBitMode = 2, SpicQuadBitMode = 2,
SpicMaxMode = 3
}; };
//====================================================== //======================================================
@ -98,20 +99,22 @@ enum _SPIC_BIT_MODE_ {
#define FLASH_CMD_RDP 0xAB //Release from Deep Power-Down #define FLASH_CMD_RDP 0xAB //Release from Deep Power-Down
/*Micron Special command*/ /*Micron Special command*/
#define FLASH_CMD_DE 0xC4 #define FLASH_CMD_DE 0xC4 // DIE ERASE
#define FLASH_CMD_4PP2 0x12 #define FLASH_CMD_4PP2 0x12 // 4-BYTE PAGE PROGRAM
#define FLASH_CMD_RFSR 0x70 #define FLASH_CMD_RFSR 0x70 // READ FLAG STATUS REGISTER
#define FLASH_CMD_CFSR 0x50 #define FLASH_CMD_CFSR 0x50 // CLEAR FLAG STATUS REGISTER
#define FLASH_CMD_RNCR 0xB5 #define FLASH_CMD_RNCR 0xB5 // READ NONVOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_WNCR 0xB1 #define FLASH_CMD_WNCR 0xB1 // WRITE NONVOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_RVCR 0x85 #define FLASH_CMD_RVCR 0x85 // READ VOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_WVCR 0x81 #define FLASH_CMD_WVCR 0x81 // WRITE VOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_REVCR 0x65 #define FLASH_CMD_REVCR 0x65 // READ ENHANCED VOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_WEVCR 0x61 #define FLASH_CMD_WEVCR 0x61 // WRITE ENHANCED VOLATILE CONFIGURATION REGISTER
#define FLASH_CMD_REAR 0xC8 #define FLASH_CMD_REAR 0xC8 // READ EXTENDED ADDRESS REGISTER
#define FLASH_CMD_WEAR 0xC5 #define FLASH_CMD_WEAR 0xC5 // WRITE EXTENDED ADDRESS REGISTER
#define FLASH_CMD_ENQUAD 0x35 #define FLASH_CMD_ENQUAD 0x35 // ENTER QUAD
#define FLASH_CMD_EXQUAD 0xF5 #define FLASH_CMD_EXQUAD 0xF5 // EXIT QUAD
#define FLASH_CMD_ROTPA 0x4B // READ OTP ARRAY
#define FLASH_CMD_POTPA 0x42 // PROGRAM OTP ARRAY
/*MXIC Special command*/ /*MXIC Special command*/
#define FLASH_CMD_RDCR 0x15 //read configurate register #define FLASH_CMD_RDCR 0x15 //read configurate register
@ -122,6 +125,9 @@ enum _SPIC_BIT_MODE_ {
#define FLASH_CMD_RDSCUR 0x2B // read security register #define FLASH_CMD_RDSCUR 0x2B // read security register
#define FLASH_CMD_WRSCUR 0x2F // write security register #define FLASH_CMD_WRSCUR 0x2F // write security register
/* EON Special command*/
#define FLASH_CMD_EOTPM 0x3A // Enter OTP Mode (3Ah)
//#endif //#endif
#if 0 #if 0
#if FLASH_MXIC_MX25L4006E #if FLASH_MXIC_MX25L4006E

View file

@ -202,7 +202,6 @@ void __attribute__((section(".hal.ram.text"))) RtlBootToSram(void) {
SpicInitRtl8195A(1, 1); // InitBaudRate 1, SpicBitMode 1 SpicInitRtl8195A(1, 1); // InitBaudRate 1, SpicBitMode 1
SpicFlashInitRtl8195A(1); // SpicBitMode 1 SpicFlashInitRtl8195A(1); // SpicBitMode 1
DBG_8195A("===== Enter Image 1.5 ====\nImg2 Sign: %s, InfaStart @ 0x%08x\n", DBG_8195A("===== Enter Image 1.5 ====\nImg2 Sign: %s, InfaStart @ 0x%08x\n",
&__image2_validate_code__, __image2_entry_func__); &__image2_validate_code__, __image2_entry_func__);
if (strcmp((const char * )&__image2_validate_code__, "RTKWin")) { if (strcmp((const char * )&__image2_validate_code__, "RTKWin")) {
@ -313,7 +312,7 @@ void __attribute__((section(".hal.ram.text"))) PreProcessForVendor(void) {
HalDelayUs(1000); HalDelayUs(1000);
int sdr_enable = 0; int sdr_enable = 0;
#ifdef CONFIG_SDR_EN #ifdef CONFIG_SDR_EN
if ((chip_id + 5) > 2) { if (chip_id > CHIP_ID_8711AF) {
SdrCtrlInit(); SdrCtrlInit();
sdr_enable = 1; sdr_enable = 1;
} }
@ -335,7 +334,9 @@ void __attribute__((section(".hal.ram.text"))) PreProcessForVendor(void) {
SpicReadIDRtl8195A(); SpicReadIDRtl8195A();
SpicFlashInitRtl8195A(SpicDualBitMode); // SpicBitMode 1 SpicFlashInitRtl8195A(SpicDualBitMode); // SpicBitMode 1
} }
// if (sdr_enable) SdrControllerInit(); #ifdef CONFIG_SDR_EN
if (sdr_enable) SdrControllerInit();
#endif
if (flash_enable) { if (flash_enable) {
u32 img1size = (*(u16 *) (SPI_FLASH_BASE + 0x18)) << 10; // size in 1024 bytes u32 img1size = (*(u16 *) (SPI_FLASH_BASE + 0x18)) << 10; // size in 1024 bytes
if (img1size == 0 || img1size >= 0x3FFFC00) if (img1size == 0 || img1size >= 0x3FFFC00)

View file

@ -273,15 +273,15 @@ typedef enum
/* 0x2C */ /* 0x2C */
typedef enum typedef enum
{ {
BASE_CLK = 0x00, BASE_CLK = 0x00, // 41.6 MHz
BASE_CLK_DIVIDED_BY_2 = 0x01, BASE_CLK_DIVIDED_BY_2 = 0x01, // 20.8 MHz
BASE_CLK_DIVIDED_BY_4 = 0x02, BASE_CLK_DIVIDED_BY_4 = 0x02, // 10.4 MHz
BASE_CLK_DIVIDED_BY_8 = 0x04, BASE_CLK_DIVIDED_BY_8 = 0x04, // 5.2 MHZ
BASE_CLK_DIVIDED_BY_16 = 0x08, BASE_CLK_DIVIDED_BY_16 = 0x08, // 2.6 MHz
BASE_CLK_DIVIDED_BY_32 = 0x10, BASE_CLK_DIVIDED_BY_32 = 0x10, // 1.3 MHz
BASE_CLK_DIVIDED_BY_64 = 0x20, BASE_CLK_DIVIDED_BY_64 = 0x20, // 650 kHz
BASE_CLK_DIVIDED_BY_128 = 0x40, BASE_CLK_DIVIDED_BY_128 = 0x40, // 325 kHz
BASE_CLK_DIVIDED_BY_256 = 0x80 BASE_CLK_DIVIDED_BY_256 = 0x80 // 162 kHz
}SD_CLK_DIVISOR; }SD_CLK_DIVISOR;
typedef enum typedef enum

View file

@ -41,7 +41,7 @@ HalGdmaChBlockSetingRtl8195a_Patch(
//4 1) Check chanel is avaliable //4 1) Check chanel is avaliable
if (HAL_GDMAX_READ32(GdmaIndex, REG_GDMA_CH_EN) & ChEn) { if (HAL_GDMAX_READ32(GdmaIndex, REG_GDMA_CH_EN) & ChEn) {
//4 Disable Channel //4 Disable Channel
DBG_GDMA_WARN("Channel had used; Disable Channel!!!!\n"); DBG_GDMA_WARN("Channel had used; Disable Channel!\n");
HalGdmaChDisRtl8195a(Data); HalGdmaChDisRtl8195a(Data);

View file

@ -221,7 +221,7 @@ HalPcmIsrEnAndDisRtl8195a (
IN VOID *Data IN VOID *Data
) )
{ {
/* #ifdef CONFIG_PCM_EN
PHAL_GDMA_ADAPTER pHalGdmaAdapter = (PHAL_GDMA_ADAPTER) Data; PHAL_GDMA_ADAPTER pHalGdmaAdapter = (PHAL_GDMA_ADAPTER) Data;
u32 IsrMask, Addr, IsrCtrl; u32 IsrMask, Addr, IsrCtrl;
u8 IsrTypeIndex = 0; u8 IsrTypeIndex = 0;
@ -243,7 +243,7 @@ HalPcmIsrEnAndDisRtl8195a (
} }
} }
*/ #endif
return _TRUE; return _TRUE;
} }
@ -254,14 +254,14 @@ HalPcmDumpRegRtl8195a (
IN VOID *Data IN VOID *Data
) )
{ {
/* #ifdef CONFIG_PCM_EN
PHAL_GDMA_ADAPTER pHalGdmaAdapter = Data; PHAL_GDMA_ADAPTER pHalGdmaAdapter = Data;
HAL_GDMAX_WRITE32(pHalGdmaAdapter->GdmaIndex, HAL_GDMAX_WRITE32(pHalGdmaAdapter->GdmaIndex,
REG_GDMA_CH_EN, REG_GDMA_CH_EN,
(HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, REG_GDMA_CH_EN)| (HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, REG_GDMA_CH_EN)|
(pHalGdmaAdapter->ChEn)) (pHalGdmaAdapter->ChEn))
); );
*/ #endif
return _TRUE; return _TRUE;
} }
@ -270,16 +270,18 @@ HalPcmRtl8195a (
IN VOID *Data IN VOID *Data
) )
{ {
/* PHAL_GDMA_ADAPTER pHalGdmaAdapter = (PHAL_GDMA_ADAPTER) Data; #ifdef CONFIG_PCM_EN
PHAL_GDMA_ADAPTER pHalGdmaAdapter = (PHAL_GDMA_ADAPTER) Data;
HAL_GDMAX_WRITE32(pHalGdmaAdapter->GdmaIndex, HAL_GDMAX_WRITE32(pHalGdmaAdapter->GdmaIndex,
REG_GDMA_CH_EN, REG_GDMA_CH_EN,
(HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, REG_GDMA_CH_EN)& (HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, REG_GDMA_CH_EN)&
~(pHalGdmaAdapter->ChEn)) ~(pHalGdmaAdapter->ChEn))
); );
*/ #endif
return _TRUE; return _TRUE;
} }
/*
#ifdef CONFIG_PCM_EN
u8 u8
HalGdmaChIsrCleanRtl8195a ( HalGdmaChIsrCleanRtl8195a (
IN VOID *Data IN VOID *Data
@ -354,6 +356,6 @@ HalGdmaChCleanAutoDstRtl8195a (
HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, (REG_GDMA_CH_CFG + pHalGdmaAdapter->ChNum*REG_GDMA_CH_OFF))); HAL_GDMAX_READ32(pHalGdmaAdapter->GdmaIndex, (REG_GDMA_CH_CFG + pHalGdmaAdapter->ChNum*REG_GDMA_CH_OFF)));
} }
*/ #endif // CONFIG_PCM_EN

View file

@ -14,8 +14,7 @@
extern _LONG_CALL_ extern _LONG_CALL_
HAL_Status HalSsiInitRtl8195a(VOID *Adaptor); HAL_Status HalSsiInitRtl8195a(VOID *Adaptor);
extern _LONG_CALL_ //extern _LONG_CALL_ u32 HalGetCpuClk(VOID);
u32 HalGetCpuClk(VOID);
VOID _SsiReadInterruptRtl8195a(VOID *Adapter) VOID _SsiReadInterruptRtl8195a(VOID *Adapter)

View file

@ -1228,10 +1228,7 @@ RtkADCReceive(
return _EXIT_FAILURE; return _EXIT_FAILURE;
} }
extern u32 //extern u32 HalDelayUs(IN u32 us);
HalDelayUs(
IN u32 us
);
u32 u32
RtkADCReceiveBuf( RtkADCReceiveBuf(

View file

@ -56,4 +56,14 @@ HAL_RESET_REASON HalGetResetCause(void)
return HAL_PERI_ON_READ32(REG_SYS_DSLP_TIM_CTRL); return HAL_PERI_ON_READ32(REG_SYS_DSLP_TIM_CTRL);
} }
u8 HalGetChipId(void) {
u8 chip_id = CHIP_ID_8195AM;
#if CONFIG_DEBUG_LOG > 3
if (HALEFUSEOneByteReadROM(HAL_SYS_CTRL_READ32(REG_SYS_EFUSE_CTRL), 0xF8, &chip_id, L25EOUTVOLTAGE) != 1)
DBG_MISC_INFO("Get Chip ID Failed\r");
#else
HALEFUSEOneByteReadROM(HAL_SYS_CTRL_READ32(REG_SYS_EFUSE_CTRL), 0xF8, &chip_id, L25EOUTVOLTAGE);
#endif
return chip_id;
}

View file

@ -8,6 +8,7 @@
*/ */
#include "platform_autoconf.h"
#include "hal_pcm.h" #include "hal_pcm.h"
#ifdef CONFIG_PCM_EN #ifdef CONFIG_PCM_EN

View file

@ -30,6 +30,7 @@ void HalJtagPinOff(void)
HalPinCtrlRtl8195A(JTAG, 0, 0); HalPinCtrlRtl8195A(JTAG, 0, 0);
} }
#if RTL8710_DEF_PIN_ON #if RTL8710_DEF_PIN_ON
//----- GpioIcFunChk //----- GpioIcFunChk
@ -45,7 +46,7 @@ u8 GpioIcFunChk(IN u32 chip_pin, IN u8 Operation)
if (tst & 0xEF) result = 1; if (tst & 0xEF) result = 1;
else { else {
result = tst & 0x10; result = tst & 0x10;
if(tst & 0x10) { // RTL8710AF ? if(result) { // RTL8710AF ?
if (chip_pin - 1 <= 2) result = 0; // PA_1, PA_2, PA_3 if (chip_pin - 1 <= 2) result = 0; // PA_1, PA_2, PA_3
else { else {
result = chip_pin - PC_5; // PC_5 result = chip_pin - PC_5; // PC_5

View file

@ -4,12 +4,17 @@
* RTL8710/11 pvvx 12/2016 * RTL8710/11 pvvx 12/2016
*/ */
#include "rtl8195a.h" #include "rtl8195a.h"
#ifdef CONFIG_SDIO_HOST_EN
#include "sd.h" #include "sd.h"
#include "sdio_host.h" #include "sdio_host.h"
#include "hal_sdio_host.h" #include "hal_sdio_host.h"
#include "rtl8195a_sdio_host.h" #include "rtl8195a_sdio_host.h"
#include "hal_pinmux.h" #include "hal_pinmux.h"
//#ifdef RTL8710AF
#include "hal_gpio.h"
#include "PinNames.h"
#include "hal_gpio.h"
//#endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Function declarations // Function declarations
@ -107,4 +112,17 @@ void HalSdioHostOpInit(void *Data) {
phsha->HalSdioHostErase = &HalSdioHostEraseRtl8195a; phsha->HalSdioHostErase = &HalSdioHostEraseRtl8195a;
phsha->HalSdioHostGetWriteProtect = &HalSdioHostGetWriteProtectRtl8195a; phsha->HalSdioHostGetWriteProtect = &HalSdioHostGetWriteProtectRtl8195a;
phsha->HalSdioHostSetWriteProtect = &HalSdioHostSetWriteProtectRtl8195a; phsha->HalSdioHostSetWriteProtect = &HalSdioHostSetWriteProtectRtl8195a;
//#ifdef RTL8710AF
if(HalGetChipId() != CHIP_ID_8195AM) {
GPIOState[0] &= ~((1 << 8) - 1);
{
for (int i = 0; i <= 6; i++)
HAL_GPIO_PullCtrl(i, PullNone);
HAL_GPIO_PullCtrl(PA_6, PullDown);
HAL_GPIO_PullCtrl(PA_7, PullDown);
} }
}
//#endif
}
#endif // CONFIG_SDIO_HOST_EN

View file

@ -1047,7 +1047,7 @@ MemTest(
} // MemTest } // MemTest
#if defined ( __ICCARM__ ) //#if defined ( __ICCARM__ )
u8 IsSdrPowerOn( u8 IsSdrPowerOn(
VOID VOID
) )
@ -1058,7 +1058,7 @@ u8 IsSdrPowerOn(
return 1; return 1;
} }
} }
#endif //#endif
#else // ifndef CONFIG_SDR_EN #else // ifndef CONFIG_SDR_EN

View file

@ -22,8 +22,8 @@ extern void xPortPendSVHandler( void ) __attribute__ (( naked ));
#endif #endif
extern void xPortSysTickHandler( void ); extern void xPortSysTickHandler( void );
extern void vPortSVCHandler( void ); extern void vPortSVCHandler( void );
extern u32 HalGetCpuClk(VOID); //extern unsigned int HalGetCpuClk(void);
extern _LONG_CALL_ u32 HalDelayUs(u32 us); //extern _LONG_CALL_ u32 HalDelayUs(u32 us);
extern COMMAND_TABLE UartLogRomCmdTable[]; extern COMMAND_TABLE UartLogRomCmdTable[];
extern HAL_TIMER_OP HalTimerOp; extern HAL_TIMER_OP HalTimerOp;

View file

@ -13,6 +13,7 @@ del hal_log_uart.o
del hal_pinmux.o del hal_pinmux.o
del hal_misc.o del hal_misc.o
del startup.o del startup.o
rem del hal_spi_flash_ram.o
arm-none-eabi-ar.exe ru ..\%libname%_new.a *.o arm-none-eabi-ar.exe ru ..\%libname%_new.a *.o
cd .. cd ..
rd /q /s %libname%.lib rd /q /s %libname%.lib

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -6,7 +6,7 @@ SDK_PATH = RTL00_SDKV35a/
#OPENOCD_PATH = d:/MCU/OpenOCD/bin/# + or set in PATH #OPENOCD_PATH = d:/MCU/OpenOCD/bin/# + or set in PATH
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_PATH ?= flasher/ FLASHER_PATH ?= flasher/
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V610a/ JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612f/
#--------------------------- #---------------------------
# Default # Default
#--------------------------- #---------------------------