This commit is contained in:
pvvx 2016-12-05 11:48:41 +03:00
parent ad9b495d7e
commit 494a7e1b39
31 changed files with 391 additions and 851 deletions

View file

@ -28,7 +28,7 @@ ramdebug:
.PHONY: flashburn runram reset test readfullflash
flashburn:
JLinkGDB-WrFlash.bat build/bin/ram_all.bin
JLinkGDB-WrFlash.bat
#@$(MAKE) -f flasher.mk flashburn
runram:
@ -40,7 +40,8 @@ reset:
#@make -f flasher.mk reset
test:
@make -f flasher.mk test
JLink-RTL00ConsoleROM.bat
#@make -f flasher.mk test
readfullflash:
JLink-RdFullFlash.bat

View file

@ -10,6 +10,10 @@
#include "osdep_service.h"
#include "osdep_api.h"
#include "tcpip.h"
#include "lwip/tcp_impl.h"
#ifndef ATCMD_VER
#define ATVER_1 1
@ -2096,6 +2100,113 @@ int atcmd_lwip_restore_from_flash(void){
}
#endif
//------------------------------------------------------------ Add pvvx Lwip Info
/* Get one byte from the 4-byte address */
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
/* These are cast to u16_t, with the intent that they are often arguments
* to printf using the U16_F format from cc.h. */
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
ip4_addr2_16(ipaddr), \
ip4_addr3_16(ipaddr), \
ip4_addr4_16(ipaddr)
#define IPSTR "%d.%d.%d.%d"
extern const char * const tcp_state_str[];
/*
static const char * const tcp_state_str[] = {
"CLOSED",
"LISTEN",
"SYN_SENT",
"SYN_RCVD",
"ESTABLISHED",
"FIN_WAIT_1",
"FIN_WAIT_2",
"CLOSE_WAIT",
"CLOSING",
"LAST_ACK",
"TIME_WAIT"
};
*/
/******************************************************************************
* FunctionName : debug
* Parameters :
* Returns :
*******************************************************************************/
void print_udp_pcb(void)
{
struct udp_pcb *pcb;
bool prt_none = true;
rtl_printf("UDP pcbs:\n");
for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
rtl_printf("flg:%02x\t" IPSTR ":%d\t" IPSTR ":%d\trecv:%p\n", pcb->flags, IP2STR(&pcb->local_ip), pcb->local_port, IP2STR(&pcb->remote_ip), pcb->remote_port, pcb->recv );
prt_none = false;
}
if(prt_none) rtl_printf("none\n");
}
/******************************************************************************
* FunctionName : debug
* Parameters :
* Returns :
*******************************************************************************/
void print_tcp_pcb(void)
{
struct tcp_pcb *pcb;
rtl_printf("Active PCB states:\n");
bool prt_none = true;
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
prt_none = false;
}
if(prt_none) rtl_printf("none\n");
rtl_printf("Listen PCB states:\n");
prt_none = true;
for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) {
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
prt_none = false;
}
if(prt_none) rtl_printf("none\n");
rtl_printf("TIME-WAIT PCB states:\n");
prt_none = true;
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
prt_none = false;
}
if(prt_none) rtl_printf("none\n");
}
/******************************************************************************
* FunctionName : debug
* Parameters :
* Returns :
*******************************************************************************/
void print_netif(int inum)
{
rtl_printf("Net Info[%d]: " IPSTR, inum, IP2STR(&xnetif[inum].ip_addr));
rtl_printf(", " IPSTR ", " IPSTR "\n", IP2STR(&xnetif[inum].netmask), IP2STR(&xnetif[inum].gw));
}
/******************************************************************************
* FunctionName : debug
* Parameters :
* Returns :
*******************************************************************************/
//------------------------------------------------------------------------------
void fATPx(void *arg) // Info Lwip
{
printf("=== LwIP Info ===\n");
print_netif(0);
print_netif(1);
print_udp_pcb();
print_tcp_pcb();
}
//------------------------------------------------------------ Add pvvx end
#if CONFIG_TRANSPORT
log_item_t at_transport_items[ ] = {
#if ATCMD_VER == ATVER_1
@ -2124,6 +2235,7 @@ log_item_t at_transport_items[ ] = {
{"ATPU", fATPU,}, //transparent transmission mode
{"ATPL", fATPL,}, //lwip auto reconnect setting
#endif
{"ATP?", fATPx,}, //Lwip pcb Info
};
#if ATCMD_VER == ATVER_2

View file

@ -49,35 +49,45 @@ struct _dev_id2name {
u8 id;
u8 *name;
};
struct _dev_id2name dev_id2name[] = {
{0, "UART0"}, {1, "UART1"},{2, "UART2"},
{8, "SPI0"}, {9, "SPI1"}, {10, "SPI2"},
{15, "SPI0_MCS"},
{16, "I2C0"}, {17, "I2C1"}, {18, "I2C2"}, {19, "I2C3"},
{24, "I2S0"}, {25, "I2S1"},
{28, "PCM0"}, {29, "PCM1"},
{32, "ADC0"},
{36, "DAC0"}, {37, "DAC1"},
{64, "SDIOD"}, {65, "SDIOH"},
{66, "USBOTG"},
{88, "MII"},
{96, "WL_LED"},
{104,"WL_ANT0"}, {105,"WL_ANT1"},
{108,"WL_BTCOEX"}, {109,"WL_BTCMD"},
{112,"NFC"},
{160,"PWM0"}, {161,"PWM1"}, {162,"PWM2"}, {163,"PWM3"},
{164,"ETE0"}, {165,"ETE1"}, {166,"ETE2"}, {167,"ETE3"},
{168,"EGTIM"},
{196,"SPI_FLASH"},
{200,"SDR"},
{216,"JTAG"},
{217,"TRACE"},
{220,"LOG_UART"}, {221,"LOG_UART_IR"},
{224,"SIC"},
{225,"EEPROM"},
{226,"DEBUG"},
{UART0, "UART0"}, {UART1, "UART1"}, {UART2, "UART2"},
{SPI0, "SPI0"}, {SPI1, "SPI1"}, {SPI2, "SPI2"},
{SPI0_MCS, "SPI0_MCS"},
{I2C0, "I2C0"}, {I2C1, "I2C1"}, {I2C2, "I2C2"}, {I2C3, "I2C3"},
{I2S0, "I2S0"}, {I2S1, "I2S1"},
{PCM0, "PCM0"}, {PCM1, "PCM1"},
{ADC0, "ADC0"},
{DAC0, "DAC0"}, {DAC1, "DAC1"},
{SDIOD, "SDIOD"}, {SDIOH, "SDIOH"},
{USBOTG, "USBOTG"},
{MII, "MII"},
{WL_LED, "WL_LED"},
{WL_ANT0,"WL_ANT0"}, {WL_ANT1,"WL_ANT1"},
{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"
#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;
@ -105,14 +115,21 @@ void fATXX(void *arg)
}
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]);
}
#ifdef CONFIG_SDR_EN
extern s32 MemTest(u32 LoopCnt);
void fATSM(void *arg)
{
MemTest(1);
}
#endif
//-------- AT SYS commands ---------------------------------------------------------------
void fATSD(void *arg)
{
int argc = 0;
char *argv[MAX_ARGC] = {0};
SD_DeInit();
AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS, "[ATSD]: _AT_SYSTEM_DUMP_REGISTER_");
if(!arg){
AT_DBG_MSG(AT_FLAG_DUMP, AT_DBG_ALWAYS, "[ATSD] Usage: ATSD=REGISTER");
@ -123,22 +140,24 @@ void fATSD(void *arg)
CmdDumpWord(argc-1, (unsigned char**)(argv+1));
}
#if ATCMD_VER == ATVER_1
void fATSE(void *arg)
#if ATCMD_VER == ATVER_2
void fATXD(void *arg)
{
int argc = 0;
char *argv[MAX_ARGC] = {0};
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATSE]: _AT_SYSTEM_EDIT_REGISTER_");
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATXD]: _AT_SYSTEM_WRITE_REGISTER_");
if(!arg){
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATSE] Usage: ATSE=REGISTER[VALUE]");
AT_DBG_MSG(AT_FLAG_EDIT, AT_DBG_ALWAYS, "[ATXD] Usage: ATXD=REGISTER,VALUE");
return;
}
argc = parse_param(arg, argv);
if(argc == 3)
CmdWriteWord(argc-1, (unsigned char**)(argv+1));
}
#endif
#if ATCMD_VER == ATVER_1
void fATSC(void *arg)
{
@ -1232,6 +1251,7 @@ log_item_t at_sys_items[] = {
{"ATSX", fATSX,}, // uart xmodem upgrade
#endif
{"ATSD", fATSD,}, // Dump register
{"ATXD", fATXD,}, // Write register
#endif // end of #if ATCMD_VER == ATVER_1
// Following commands exist in two versions
@ -1240,6 +1260,9 @@ log_item_t at_sys_items[] = {
#endif
{"ATST", fATST}, // add pvvx: mem info
{"ATXX", fATXX}, // test
#ifdef CONFIG_SDR_EN
{"ATSM", fATSM} // memtest
#endif
};
#if ATCMD_VER == ATVER_2

View file

@ -1484,6 +1484,35 @@ void print_wlan_help(void *arg){
#elif ATCMD_VER == ATVER_2 // UART module at command
// wifi promisc
// Usage: ATWM=DURATION_SECONDS[with_len]
#ifdef CONFIG_PROMISC
void fATWM(void *arg){
int argc, error_no = 0;
char *argv[MAX_ARGC] = {0};
argv[0] = "wifi_promisc";
printf("[ATWM]: _AT_WLAN_PROMISC_\n");
if(!arg){
AT_DBG_MSG(AT_FLAG_WIFI, AT_DBG_ERROR,
"[ATWM]Usage: ATWM=DURATION_MSECONDS[with_len]\n");
#if CONFIG_INIC_CMD_RSP
inic_c2h_msg("ATWM", RTW_BADARG, NULL, 0);
#endif
error_no = 1;
goto exit;
}
if((argc = parse_param(arg, argv)) > 1){
cmd_promisc(argc, argv);
}
exit:
if(error_no==0)
at_printf("\r\n[ATWM] OK");
else
at_printf("\r\n[ATWM] ERROR:%d",error_no);
return;
}
#endif
//ATPA=<ssid>,<pwd>,<chl>,<hidden>[,<max_conn>]
void fATPA(void *arg)
{
@ -2470,6 +2499,86 @@ exit:
return;
}
//------------------------------------------------------------
#if CONFIG_ENABLE_P2P
void fATWG(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWG]: _AT_WLAN_P2P_START_\n");
argv[argc++] = "p2p_start";
cmd_wifi_p2p_start(argc, argv);
}
void fATWg(void *arg){
int argc = 0;
char *argv[4];
int ret =0;
printf("[ATWg]: _AT_WLAN_P2P_AUTO_GO_START_\n");
argv[argc++] = "p2p_auto_go_start";
ret = cmd_wifi_p2p_auto_go_start(argc, argv);
if(ret < 0)
printf("[ATWg]: Nothing to do. Please enter ATWG to initialize P2P.\n");
}
void fATWH(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWH]: _AT_WLAN_P2P_STOP_\n");
argv[argc++] = "p2p_stop";
cmd_wifi_p2p_stop(argc, argv);
}
void fATWJ(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWJ]: _AT_WLAN_P2P_CONNECT_\n");
argv[0] = "p2p_connect";
if(!arg){
printf("ATWc=[DEST_MAC,pbc/pin]\n");
return;
}
if((argc = parse_param(arg, argv)) > 1){
cmd_p2p_connect(argc, argv);
}
}
void fATWK(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWK]: _AT_WLAN_P2P_DISCONNECT_\n");
argv[argc++] = "p2p_disconnect";
cmd_p2p_disconnect(argc, argv);
}
void fATWN(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWN]: _AT_WLAN_P2P_INFO_\n");
argv[argc++] = "p2p_info";
cmd_p2p_info(argc, argv);
}
void fATWF(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWF]: _AT_WLAN_P2P_FIND_\n");
argv[argc++] = "p2p_find";
cmd_p2p_find(argc, argv);
}
void fATWL(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWL]: _AT_WLAN_P2P_LISTEN_\n");
argv[argc++] = "p2p_listen";
cmd_p2p_listen(argc, argv);
}
void fATWP(void *arg){
int argc = 0;
char *argv[4];
printf("[ATWP]: _AT_WLAN_P2P_PEERS_\n");
argv[argc++] = "p2p_peers";
cmd_p2p_peers(argc, argv);
}
#endif // CONFIG_ENABLE_P2P
//-----------------------------------------------------
void print_wlan_help(void *arg){
at_printf("\r\nWLAN AT COMMAND SET:");
at_printf("\r\n==============================");
@ -2693,9 +2802,23 @@ log_item_t at_wifi_items[ ] = {
{"ATPW", fATPW,}, // set Wifi mode
{"ATWD", fATWD,}, // WIFI disconnect
{"ATWS", fATWS,}, // WIFI scan
#if CONFIG_ENABLE_P2P
{"ATWG", fATWG,}, //p2p start
{"ATWH", fATWH,}, //p2p stop
{"ATWJ", fATWJ,}, //p2p connect
{"ATWK", fATWK,}, //p2p disconnect
{"ATWN", fATWN,}, //p2p info
{"ATWF", fATWF,}, //p2p find
{"ATWg", fATWg,}, //p2p auto go start
{"ATWL", fATWL,}, //p2p listen
{"ATWP", fATWP,}, //p2p peers
#endif
#ifdef CONFIG_PROMISC
{"ATWM", fATWM,}, // WIFI promisc Usage: ATWM=DURATION_SECONDS[with_len]
#endif
{"ATW?", fATWx,}, // WIFI Info
#if (CONFIG_INCLUDE_SIMPLE_CONFIG)
{"ATWQ", fATWQ,}, // wifi simpleconfig
{"ATWQ", fATWQ } // wifi simpleconfig
#endif // #if (CONFIG_INCLUDE_SIMPLE_CONFIG)
#endif // #if CONFIG_WLAN
#endif // end of #if ATCMD_VER == ATVER_1

View file

@ -1,304 +0,0 @@
/**
******************************************************************************
* @file lwipopts.h
* @author MCD Application Team
* @version V1.1.0
* @date 07-October-2011
* @brief lwIP Options Configuration.
* This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h
* and contains the lwIP configuration for the STM32F2x7 demonstration.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
#include <platform/platform_stdlib.h>
#include "platform_opts.h"
#define WIFI_LOGO_CERTIFICATION_CONFIG 0 //for ping 10k test buffer setting
/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory
* allocation and deallocation.
*/
#define SYS_LIGHTWEIGHT_PROT 1
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
should be used instead */
#define LWIP_COMPAT_MUTEX 1
#define ETHARP_TRUST_IP_MAC 0
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define ARP_QUEUEING 0
/**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities.
*/
#define NO_SYS 0
/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
byte alignment -> define MEM_ALIGNMENT to 2. */
#define MEM_ALIGNMENT 4
/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define MEM_SIZE (10*1024) //for ping 10k test
#else
#define MEM_SIZE (5*1024)
#endif
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
sends a lot of data out of ROM (or other static memory), this
should be set high. */
#define MEMP_NUM_PBUF 100
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */
#define MEMP_NUM_UDP_PCB 6
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */
#define MEMP_NUM_TCP_PCB 10
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 5
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
segments. */
#define MEMP_NUM_TCP_SEG 20
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 10
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define PBUF_POOL_SIZE 30 //for ping 10k test
#else
#define PBUF_POOL_SIZE 20
#endif
/* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.*/
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define IP_REASS_MAX_PBUFS 30 //for ping 10k test
#else
#define IP_REASS_MAX_PBUFS 10
#endif
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE 500
/* ---------- TCP options ---------- */
#define LWIP_TCP 1
#define TCP_TTL 255
/* Controls if TCP should queue segments that arrive out of
order. Define to 0 if your device is low on memory. */
#define TCP_QUEUE_OOSEQ 1
/* TCP Maximum segment size. */
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
/* TCP sender buffer space (bytes). */
#define TCP_SND_BUF (5*TCP_MSS)
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
/* TCP receive window. */
#define TCP_WND (2*TCP_MSS)
/* ---------- ICMP options ---------- */
#define LWIP_ICMP 1
/* ---------- ARP options ----------- */
#define LWIP_ARP 1
/* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */
#define LWIP_DHCP 1
/* ---------- UDP options ---------- */
#define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- DNS options ---------- */
#define LWIP_DNS 1
/* ---------- UPNP options --------- */
#define LWIP_UPNP 0
/* Support Multicast */
#define LWIP_IGMP 1
#define LWIP_RAND() rand()
/* Support TCP Keepalive */
#define LWIP_TCP_KEEPALIVE 1
/*LWIP_UART_ADAPTER==1: Enable LWIP_UART_ADAPTER when CONFIG_GAGENT is enabled,
because some GAGENT functions denpond on the following macro definitions.*/
#define LWIP_UART_ADAPTER 0
#if LWIP_UART_ADAPTER
#undef LWIP_SO_SNDTIMEO
#define LWIP_SO_SNDTIMEO 1
#undef SO_REUSE
#define SO_REUSE 1
#undef MEMP_NUM_NETCONN
#define MEMP_NUM_NETCONN 10
#undef TCP_WND
#define TCP_WND (4*TCP_MSS)
#define TCP_KEEPIDLE_DEFAULT 10000UL
#define TCP_KEEPINTVL_DEFAULT 1000UL
#define TCP_KEEPCNT_DEFAULT 10U
#endif
#if CONFIG_EXAMPLE_UART_ATCMD
#undef LWIP_SO_SNDTIMEO
#define LWIP_SO_SNDTIMEO 1
#undef SO_REUSE
#define SO_REUSE 1
#undef MEMP_NUM_NETCONN
#define MEMP_NUM_NETCONN 10
#undef MEMP_NUM_TCP_PCB
#define MEMP_NUM_TCP_PCB (MEMP_NUM_NETCONN)
#undef MEMP_NUM_UDP_PCB
#define MEMP_NUM_UDP_PCB (MEMP_NUM_NETCONN)
#undef TCP_WND
#define TCP_WND (4*TCP_MSS)
#define TCP_KEEPIDLE_DEFAULT 10000UL
#define TCP_KEEPINTVL_DEFAULT 1000UL
#define TCP_KEEPCNT_DEFAULT 10U
#define ERRNO 1
#endif
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
/*
--------------------------------------
---------- Checksum options ----------
--------------------------------------
*/
/*
The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
- To use this feature let the following define uncommented.
- To disable it and process by CPU comment the the checksum.
*/
//Do checksum by lwip - WLAN nic does not support Checksum offload
//#define CHECKSUM_BY_HARDWARE
#ifdef CHECKSUM_BY_HARDWARE
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 0
#else
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 1
#endif
/*
----------------------------------------------
---------- Sequential layer options ----------
----------------------------------------------
*/
/**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/
#define LWIP_NETCONN 1
/*
------------------------------------
---------- Socket options ----------
------------------------------------
*/
/**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/
#define LWIP_SOCKET 1
/*
-----------------------------------
---------- DEBUG options ----------
-----------------------------------
*/
#define LWIP_DEBUG 0
/*
---------------------------------
---------- OS options ----------
---------------------------------
*/
#define TCPIP_THREAD_STACKSIZE 1000
#define TCPIP_MBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_ACCEPTMBOX_SIZE 6
#define DEFAULT_THREAD_STACKSIZE 500
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
#endif /* __LWIPOPTS_H__ */
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

View file

@ -1,312 +0,0 @@
/**
******************************************************************************
* @file lwipopts.h
* @author MCD Application Team
* @version V1.1.0
* @date 07-October-2011
* @brief lwIP Options Configuration.
* This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h
* and contains the lwIP configuration for the STM32F2x7 demonstration.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
#include <platform/platform_stdlib.h>
#include "platform_opts.h"
#define WIFI_LOGO_CERTIFICATION_CONFIG 0 //for ping 10k test buffer setting
/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory
* allocation and deallocation.
*/
#define SYS_LIGHTWEIGHT_PROT 1
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
should be used instead */
#define LWIP_COMPAT_MUTEX 1
#define ETHARP_TRUST_IP_MAC 0
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define ARP_QUEUEING 0
/**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities.
*/
#define NO_SYS 0
/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
byte alignment -> define MEM_ALIGNMENT to 2. */
#define MEM_ALIGNMENT 4
/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define MEM_SIZE (10*1024) //for ping 10k test
#else
#define MEM_SIZE (5*1024)
#endif
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
sends a lot of data out of ROM (or other static memory), this
should be set high. */
#define MEMP_NUM_PBUF 100
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */
#define MEMP_NUM_UDP_PCB 6
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */
#define MEMP_NUM_TCP_PCB 10
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 5
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
segments. */
#define MEMP_NUM_TCP_SEG 20
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 10
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define PBUF_POOL_SIZE 30 //for ping 10k test
#else
#define PBUF_POOL_SIZE 20
#endif
/* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.*/
#if WIFI_LOGO_CERTIFICATION_CONFIG
#define IP_REASS_MAX_PBUFS 30 //for ping 10k test
#else
#define IP_REASS_MAX_PBUFS 10
#endif
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE 500
/* ---------- TCP options ---------- */
#define LWIP_TCP 1
#define TCP_TTL 255
/* Controls if TCP should queue segments that arrive out of
order. Define to 0 if your device is low on memory. */
#define TCP_QUEUE_OOSEQ 1
/* TCP Maximum segment size. */
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
/* TCP sender buffer space (bytes). */
#define TCP_SND_BUF (5*TCP_MSS)
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
/* TCP receive window. */
#define TCP_WND (2*TCP_MSS)
/* ---------- ICMP options ---------- */
#define LWIP_ICMP 1
/* ---------- ARP options ----------- */
#define LWIP_ARP 1
/* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */
#define LWIP_DHCP 1
/* ---------- UDP options ---------- */
#define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- DNS options ---------- */
#define LWIP_DNS 1
/* ---------- UPNP options --------- */
#define LWIP_UPNP 0
/* Support Multicast */
#define LWIP_IGMP 1
#define LWIP_RAND() rand()
/* Support TCP Keepalive */
#define LWIP_TCP_KEEPALIVE 1
/*LWIP_UART_ADAPTER==1: Enable LWIP_UART_ADAPTER when CONFIG_GAGENT is enabled,
because some GAGENT functions denpond on the following macro definitions.*/
#if CONFIG_EXAMPLE_UART_ADAPTER
#define LWIP_UART_ADAPTER 1
#else
#define LWIP_UART_ADAPTER 0
#endif
#if LWIP_UART_ADAPTER
#undef LWIP_SO_SNDTIMEO
#define LWIP_SO_SNDTIMEO 1
#undef SO_REUSE
#define SO_REUSE 1
#undef MEMP_NUM_NETCONN
#define MEMP_NUM_NETCONN 10
#undef TCP_WND
#define TCP_WND (4*TCP_MSS)
#define TCP_KEEPIDLE_DEFAULT 10000UL
#define TCP_KEEPINTVL_DEFAULT 1000UL
#define TCP_KEEPCNT_DEFAULT 10U
#endif
#if CONFIG_EXAMPLE_UART_ATCMD
#undef LWIP_SO_SNDTIMEO
#define LWIP_SO_SNDTIMEO 1
#undef SO_REUSE
#define SO_REUSE 1
#undef MEMP_NUM_NETCONN
#define MEMP_NUM_NETCONN 10
#undef MEMP_NUM_TCP_PCB
#define MEMP_NUM_TCP_PCB (MEMP_NUM_NETCONN)
#undef MEMP_NUM_UDP_PCB
#define MEMP_NUM_UDP_PCB (MEMP_NUM_NETCONN)
#undef TCP_WND
#define TCP_WND (4*TCP_MSS)
#define TCP_KEEPIDLE_DEFAULT 10000UL
#define TCP_KEEPINTVL_DEFAULT 1000UL
#define TCP_KEEPCNT_DEFAULT 10U
#define ERRNO 1
#endif
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
/*
--------------------------------------
---------- Checksum options ----------
--------------------------------------
*/
/*
The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
- To use this feature let the following define uncommented.
- To disable it and process by CPU comment the the checksum.
*/
//Do checksum by lwip - WLAN nic does not support Checksum offload
//#define CHECKSUM_BY_HARDWARE
#ifdef CHECKSUM_BY_HARDWARE
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 0
#else
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 1
#endif
/*
----------------------------------------------
---------- Sequential layer options ----------
----------------------------------------------
*/
/**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/
#define LWIP_NETCONN 1
/*
------------------------------------
---------- Socket options ----------
------------------------------------
*/
/**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/
#define LWIP_SOCKET 1
/*
-----------------------------------
---------- DEBUG options ----------
-----------------------------------
*/
#define LWIP_DEBUG 0
/*
---------------------------------
---------- OS options ----------
---------------------------------
*/
#define TCPIP_THREAD_STACKSIZE 1000
#define TCPIP_MBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_ACCEPTMBOX_SIZE 6
#define DEFAULT_THREAD_STACKSIZE 500
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
* by your system, set this to 0 and include <sys/time.h> in cc.h */
#if defined(_SYS__TIMEVAL_H_)
#define LWIP_TIMEVAL_PRIVATE 0
#endif
#endif /* __LWIPOPTS_H__ */
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

View file

@ -1,68 +0,0 @@
#ifndef MAIN_H
#define MAIN_H
#include <autoconf.h>
//#define CONFIG_WLAN 1
/* Header file declaration*/
void wlan_network();
/* Interactive Mode */
#define SERIAL_DEBUG_RX 1
#if defined(__ICCARM__)
static
#endif
char uart_buf[64];
/* WLAN and Netork */
#define STA_MODE_SSID "ap" /* Set SSID here */
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
#define AP_DEFAULT_CH 6
#define WLAN0_NAME "wlan0"
#define WLAN1_NAME "wlan1"
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
/*Static IP ADDRESS*/
#define IP_ADDR0 192
#define IP_ADDR1 168
#define IP_ADDR2 3
#define IP_ADDR3 80
/*NETMASK*/
#define NETMASK_ADDR0 255
#define NETMASK_ADDR1 255
#define NETMASK_ADDR2 255
#define NETMASK_ADDR3 0
/*Gateway Address*/
#define GW_ADDR0 192
#define GW_ADDR1 168
#define GW_ADDR2 3
#define GW_ADDR3 1
/*******************************************/
/*Static IP ADDRESS*/
#define AP_IP_ADDR0 192
#define AP_IP_ADDR1 168
#define AP_IP_ADDR2 43
#define AP_IP_ADDR3 1
/*NETMASK*/
#define AP_NETMASK_ADDR0 255
#define AP_NETMASK_ADDR1 255
#define AP_NETMASK_ADDR2 255
#define AP_NETMASK_ADDR3 0
/*Gateway Address*/
#define AP_GW_ADDR0 192
#define AP_GW_ADDR1 168
#define AP_GW_ADDR2 43
#define AP_GW_ADDR3 1
#endif

View file

@ -1,68 +0,0 @@
#ifndef MAIN_H
#define MAIN_H
#include <autoconf.h>
//#define CONFIG_WLAN 1
/* Header file declaration*/
void wlan_network();
/* Interactive Mode */
#define SERIAL_DEBUG_RX 1
#if defined(__ICCARM__)
static
#endif
extern char uart_buf[64];
/* WLAN and Netork */
#define STA_MODE_SSID "ap" /* Set SSID here */
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
#define AP_DEFAULT_CH 6
#define WLAN0_NAME "wlan0"
#define WLAN1_NAME "wlan1"
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
/*Static IP ADDRESS*/
#define IP_ADDR0 192
#define IP_ADDR1 168
#define IP_ADDR2 3
#define IP_ADDR3 80
/*NETMASK*/
#define NETMASK_ADDR0 255
#define NETMASK_ADDR1 255
#define NETMASK_ADDR2 255
#define NETMASK_ADDR3 0
/*Gateway Address*/
#define GW_ADDR0 192
#define GW_ADDR1 168
#define GW_ADDR2 3
#define GW_ADDR3 1
/*******************************************/
/*Static IP ADDRESS*/
#define AP_IP_ADDR0 192
#define AP_IP_ADDR1 168
#define AP_IP_ADDR2 43
#define AP_IP_ADDR3 1
/*NETMASK*/
#define AP_NETMASK_ADDR0 255
#define AP_NETMASK_ADDR1 255
#define AP_NETMASK_ADDR2 255
#define AP_NETMASK_ADDR3 0
/*Gateway Address*/
#define AP_GW_ADDR0 192
#define AP_GW_ADDR1 168
#define AP_GW_ADDR2 43
#define AP_GW_ADDR3 1
#endif

View file

@ -291,7 +291,7 @@ static void promisc_test(int duration, unsigned char len_used)
while(1) {
unsigned int current_time = xTaskGetTickCount();
if((current_time - start_time) < (duration * configTICK_RATE_HZ)) {
if((current_time - start_time) < (duration)) { // duration * configTICK_RATE_HZ
frame = retrieve_frame();
if(frame) {
@ -394,7 +394,7 @@ static void promisc_test_all(int duration, unsigned char len_used)
while(1) {
unsigned int current_time = xTaskGetTickCount();
if((current_time - start_time) < (duration * configTICK_RATE_HZ)) {
if((current_time - start_time) < (duration)) { // duration * configTICK_RATE_HZ
frame = retrieve_frame();
if(frame) {
@ -464,7 +464,7 @@ void cmd_promisc(int argc, char **argv)
else if((argc == 3) && ((duration = atoi(argv[1])) > 0) && (strcmp(argv[2], "with_len") == 0))
promisc_test(duration, 1);
else
printf("\n\rUsage: %s DURATION_SECONDS [with_len]", argv[0]);
printf("\n\rUsage: %s DURATION_MSECONDS [with_len]", argv[0]);
#if CONFIG_INIC_CMD_RSP
if(inic_frame)
vPortFree(inic_frame);

View file

@ -33,6 +33,7 @@ SD_RESULT SD_Init() {
if (sdio_sd_init() != 0) result = SD_INITERR;
else {
if (sdio_sd_getProtection() != 0) result = SD_PROTECTED;
RtlInitSema(&sdWSema, 0);
sdio_sd_hook_xfer_cmp_cb(sd_xfer_done_callback, 0);
sdio_sd_hook_xfer_err_cb(sd_xfer_err_callback, 0);
}
@ -63,6 +64,7 @@ SD_RESULT SD_SetCLK(SD_CLK CLK) {
result = sdio_sd_setClock(SD_CLK_5_2MHZ);
break;
default:
// DBG_SDIO_INFO("clk = %d ?\n", CLK);
return SD_ERROR;
}
if(result) return SD_ERROR;
@ -72,8 +74,7 @@ SD_RESULT SD_SetCLK(SD_CLK CLK) {
//----- SD_Status
SD_RESULT SD_Status() {
if (sdio_sd_isReady()) return SD_NODISK;
else if (sdio_sd_getProtection()) return SD_PROTECTED;
else return SD_OK;
else return sdio_sd_getProtection() != 0;
}
//----- SD_GetCID
@ -121,7 +122,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
if (rd_count) return SD_ERROR;
return SD_OK;
} else {
if (sdio_read_blocks(sector, buf, count) == 0) {
if (sdio_read_blocks(sector, data, count) == 0) {
if (RtlDownSemaWithTimeout(&sdWSema, 1000) == 1) return SD_OK;
DBG_SDIO_ERR("SD_ReadBlocks timeout\n");
}
@ -153,7 +154,7 @@ SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) {
vPortFree(buf);
if (wr_count == 0)
return SD_OK;
} else if (sdio_write_blocks(sector, buf, count) == 0) {
} else if (sdio_write_blocks(sector, data, count) == 0) {
if (RtlDownSemaWithTimeout(&sdWSema, 1000) == 1)
return SD_OK;
DBG_SDIO_ERR("SD_WriteBlocks timeout\n");

View file

@ -150,7 +150,7 @@ s8 sdio_read_blocks(u32 sector, u8 *buffer, u32 count) {
SdioHostAdapter.AdmaDescTbl = gAdmaTbls;
}
HAL_Status result = HalSdioHostOp.HalSdioHostReadBlocksDma(&SdioHostAdapter,
(uint64) sector * SIZE_BLOCK_ADMA, count);
(unsigned long long) sector * SIZE_BLOCK_ADMA, count);
if (result) {
DBG_SDIO_ERR("sdio_read_blocks fail(0x%02x)\n", result);
return -1;
@ -205,8 +205,8 @@ s8 sdio_write_blocks(uint32_t sector, const uint8_t *buffer, uint32_t count) {
}
SdioHostAdapter.AdmaDescTbl = gAdmaTbls;
}
HAL_Status result = HalSdioHostOp.HalSdioHostWriteBlocksDma(
&SdioHostAdapter, (uint64) sector * SIZE_BLOCK_ADMA, count);
HAL_Status result = HalSdioHostOp.HalSdioHostWriteBlocksDma(&SdioHostAdapter,
(unsigned long long) sector * SIZE_BLOCK_ADMA, count);
if (result) {
DBG_SDIO_ERR("write fail(0x%02x)\n", result);
return -1;

View file

@ -531,7 +531,6 @@ void uart_atcmd_main(void)
UART_LOG_CONF uartconf;
read_uart_atcmd_setting_from_system_data(&uartconf);
serial_init(&at_cmd_sobj, UART_TX, UART_RX);
serial_baud(&at_cmd_sobj,uartconf.BaudRate);
serial_format(&at_cmd_sobj, uartconf.DataBits, (SerialParity)uartconf.Parity, uartconf.StopBits);

View file

@ -12,10 +12,29 @@
#include "semphr.h"
#include "osdep_api.h"
#define UART_TX PA_4
#define UART_RX PA_0
#define UART_RTS PA_2
#define UART_CTS PA_1
#if 0// defined(RTL8710AF)
// RTL8710AF
#define UART_TX PA_4 // PC_3
#define UART_RX PA_0 // PC_0
#define UART_RTS PA_2 // PC_2
#define UART_CTS PA_1 // PC_1
#elif defined(RTL8711AM)
// RTL8711AM
#define UART_TX PA_7
#define UART_RX PA_6
#define UART_RTS PA_3
#define UART_CTS PA_5
#else
// RTL8711AM + RTL8710AF
#define UART_TX PC_3
#define UART_RX PC_0
#define UART_RTS PC_2
#define UART_CTS PC_1
#endif
#define KEY_ENTER 0xd
#define KEY_BS 0x8

View file

@ -173,7 +173,7 @@ typedef enum {
D13 = PA_5,
D14 = PB_9,
D15 = PB_8,
*/
// Generic signals namings
LED1 = PB_4,
@ -192,7 +192,7 @@ typedef enum {
SPI_SCK = PC_1,
SPI_CS = PC_0,
PWM_OUT = PD_4,
*/
// Not connected
NC = (uint32_t)0xFFFFFFFF
} PinName;

View file

@ -171,14 +171,19 @@ SRAM_BF_DATA_SECTION
#endif
static unsigned char ucHeap[configTOTAL_HEAP_SIZE];
extern void * __sdram_bss_end__; //, __ram_image1_text_end__, __ram_image2_text_start__;
#if defined(CONFIG_PLATFORM_8195A)
HeapRegion_t xHeapRegions[] =
{
{ (uint8_t*)0x10002300, 0x3D00 }, // Image1 recycle heap (15616 bytes)
{ (uint8_t*)0x10002300, 0x10006000 - 0x10002300 }, // Image1 recycle heap (__ram_image2_text_start__ - __ram_image1_text_end__)
{ ucHeap, sizeof(ucHeap) }, // Defines a block from ucHeap
#if 0
{ (uint8_t*)0x301b5000, 300*1024 }, // SDRAM heap
#endif
#ifdef CONFIG_SDR_EN
{ (uint8_t*)&__sdram_bss_end__, 0x80000 },
#endif
// { NULL, 0 }, // add SDRAM heap
{ NULL, 0 } // Terminates the array.
};
@ -222,7 +227,12 @@ void *pvReturn = NULL;
if(pxEnd == NULL)
{
#if defined(CONFIG_PLATFORM_8195A)
// xHeapRegions[0].pucStartAddress = __ram_image1_text_end__;
// xHeapRegions[0].xSizeInBytes = (u32)&__ram_image2_text_start__ - (u32)xHeapRegions[0].pucStartAddress;
xHeapRegions[1].xSizeInBytes = (u32)0x10070000 - (u32)xHeapRegions[1].pucStartAddress;
#ifdef CONFIG_SDR_EN
xHeapRegions[2].xSizeInBytes = (u32)0x30200000 - (u32)xHeapRegions[2].pucStartAddress;
#endif
#endif
vPortDefineHeapRegions( xHeapRegions );
}

View file

@ -14,7 +14,8 @@ typedef enum _RT_DEV_LOCK_E
{
RT_DEV_LOCK_EFUSE = 0,
RT_DEV_LOCK_FLASH = 1,
RT_DEV_LOCK_MAX = 2
RT_DEV_LOCK_CRYPTO = 2,
RT_DEV_LOCK_MAX = 3
}RT_DEV_LOCK_E;
void device_mutex_lock(RT_DEV_LOCK_E device);

View file

@ -54,7 +54,6 @@
#ifdef CONFIG_TIMER_MODULE
#include "hal_misc.h"
#define __Delay(t) HalDelayUs(t)
#else
static __inline__ u32 __Delay(u32 us)
@ -67,7 +66,7 @@ static __inline__ u32 __Delay(u32 us)
#define Mdelay(t) __Delay(t*1000)
#define Udelay(t) __Delay(t)
#undef ASSERT
#define ASSERT(_bool_) do { } while (0)
//#define panic_printk DiagPrintf

View file

@ -7,7 +7,7 @@
#define TCM_HEAP_SIZE (42*1024)
#define TCM_HEAP_SIZE (42*1024) // min size
// MAX_BACKUP_SIZE in hal_soc_ps_monitor = 129*4, 0x1FFFFFFC - 129*4 = 0x1FFFFD18 !
#define tcm_heap_size ((0x20000000 - (u32)&tcm_heap - 768 + sizeof(heap_buf_t) - 1)/sizeof(heap_buf_t))*sizeof(heap_buf_t)

View file

@ -346,7 +346,7 @@ typedef struct _SPDIO_AHB_DMA_CTRL {
#else
#if CONFIG_INIC_EN
//TX BD setting
#define SDIO_TX_BD_NUM 20 // Number of TX BD
#define SDIO_TX_BD_NUM 16 // Number of TX BD
#define SDIO_TX_BD_BUF_SIZE 1540 //1514+24
//#define SDIO_TX_PKT_NUM 1 // not used
@ -354,11 +354,11 @@ typedef struct _SPDIO_AHB_DMA_CTRL {
#define RX_BD_FREE_TH 5 // trigger the interrupt when free RX BD over this threshold
#define SDIO_RX_BD_BUF_SIZE 1540 //1514+24
#define MAX_RX_BD_BUF_SIZE 16380 // the Maximum size for a RX_BD point to, make it 4-bytes aligned
#define SDIO_RX_BD_NUM 32 // Number of RX BD, to make 32K of bus aggregation, it needs 22 RX_BD at least
#define SDIO_RX_PKT_NUM 128 // Number of RX packet handler
#define SDIO_RX_PKT_NUM 16 // Number of RX packet handler
#define MIN_RX_BD_SEND_PKT 2 /* the minum needed RX_BD to send a Packet to Host, we need 2:
one for RX_Desc, the other for payload */
#define SDIO_RX_BD_NUM (SDIO_RX_PKT_NUM*MIN_RX_BD_SEND_PKT) /*Number of RX BD,
to make 32K of bus aggregation, it needs 22 RX_BD at least*/
#else
#define SDIO_TX_BD_NUM 24 // Number of TX BD
#define SDIO_TX_BD_BUF_SIZE (2048+32) // the size of a TX BD pointed buffer, WLan header = 26 bytes

View file

@ -2,5 +2,6 @@ hal_common.c +
hal_efuse.c +
hal_misc.c +
hal_pinmux.c +
hal_sdio_host.c +
hal_soc_ps_monitor.c +
hal_spi_flash_ram.c +-

View file

@ -286,7 +286,7 @@ VOID HAL_FLASH_TEXT_SECTION SpicInitRefinedRtl8195A(IN u8 InitBaudRate, IN u8 Sp
TmpSpicInitPara.id[0] = SpicBitMode;
u32 CpuClkMode = (HAL_PERI_ON_READ32(REG_SYS_CLK_CTRL1)
>> BIT_SHIFT_PESOC_OCP_CPU_CK_SEL) & BIT_MASK_PESOC_OCP_CPU_CK_SEL; // v4 = (40000014 >> 4) & 7;
PSPIC_INIT_PARA pspicp = &SpicInitParaAllClk[CpuClkMode];
pspicp = &SpicInitParaAllClk[CpuClkMode];
if (!pspicp->Rsvd) {
SpicLoadInitParaFromClockRtl8195A(CpuClkMode, 1, &TmpSpicInitPara);
pspicp = &TmpSpicInitPara;
@ -313,14 +313,14 @@ VOID HAL_FLASH_TEXT_SECTION SpicInitRefinedRtl8195A(IN u8 InitBaudRate, IN u8 Sp
}
//----- SpicReadIDRtl8195A
//VOID HAL_FLASH_TEXT_SECTION SpicReadIDRtl8195A(VOID)
void SpicReadIDRtl8195A(SPIC_INIT_PARA SpicInitPara)
void HAL_FLASH_TEXT_SECTION SpicReadIDRtl8195A(VOID)
//void SpicReadIDRtl8195A(SPIC_INIT_PARA SpicInitPara)
{
u16 flash_type;
u8 flashtype;
u32 flash_id;
u32 flash_density;
SPIC_INIT_PARA spic_para = SpicInitPara;
SPIC_INIT_PARA spic_para;// = SpicInitPara;
// memset(&spic_para, 0, sizeof(not_used));
// spic_para = SpicInitPara;
DBG_SPIF_INFO("%s(0x%x)\n", "SpicReadIDRtl8195A", *((u32 *)spic_para));
@ -942,7 +942,7 @@ VOID SpicNVMCalLoad(u8 BitMode, u8 CpuClk)
if (BitMode == 166666666) {
40006120 |= 0x202u;
HAL_SPI_WRITE32(REG_SPIC_SSIENR, v4); // 40006008 = v4;
BitMode = SpicWaitBusyDoneRtl8195A(166666666);
SpicWaitBusyDoneRtl8195A();
}
}
v7 = *(u32 *) (8 * v2 - 0x67FF6F80);

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

@ -10,8 +10,8 @@ LFLAGS += -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-s
# LIBS
# -------------------------------------------------------------------
LIBS =
all: LIBS +=_platform_new _wlan _p2p _wps _rtlstd _websocket _xmodem m c nosys gcc
mp: LIBS +=_platform_new _wlan_mp _p2p _wps _rtlstd _websocket _xmodem m c nosys gcc
all: LIBS +=_platform_new _wlan _p2p _wps _rtlstd _websocket _sdcard _xmodem m c nosys gcc
mp: LIBS +=_platform_new _wlan_mp _p2p _wps _rtlstd _websocket _sdcard _xmodem m c nosys gcc
PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/gcc
LDFILE = rlx8195A-symbol-v03-img2.ld
BOOTS = sdk/component/soc/realtek/8195a/misc/bsp/image
@ -353,6 +353,9 @@ ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_log_uart.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_pinmux.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_misc.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/startup.c
ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sd.c
ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c
# COMPONENTS
ADD_SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/flash_eep.c
# -------------------------------------------------------------------