This commit is contained in:
pvvx 2017-03-03 20:16:46 +03:00
parent 5e40d9d461
commit 6278f73e47
20 changed files with 2557 additions and 2579 deletions

View file

@ -1288,25 +1288,20 @@ void fATFO(void *arg) {
}
}
// Mem info
void fATST(void *arg) {
extern void dump_mem_block_list(void); // heap_5.c
//DBG_INFO_MSG_ON(_DBG_TCM_HEAP_); // On Debug TCM MEM
#if DEBUG_AT_USER_LEVEL > 1
printf("ATST: Mem info:\n");
#endif
// vPortFree(pvPortMalloc(4)); // Init RAM heap
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
#if CONFIG_DEBUG_LOG > 1
dump_mem_block_list();
u32 saved = ConfigDebugInfo;
DBG_INFO_MSG_ON(_DBG_TCM_HEAP_); // On Debug TCM MEM
tcm_heap_dump();
ConfigDebugInfo = saved;
#endif;
printf("\n");
#if (configGENERATE_RUN_TIME_STATS == 1)
char *cBuffer = pvPortMalloc(512);
if (cBuffer != NULL) {
vTaskGetRunTimeStats((char *) cBuffer);
if(cBuffer != NULL) {
vTaskGetRunTimeStats((char *)cBuffer);
printf("%s", cBuffer);
}
vPortFree(cBuffer);

View file

@ -459,7 +459,8 @@ void fATWx(void *arg){
ip = LwIP_GetIP(&xnetif[i]);
gw = LwIP_GetGW(&xnetif[i]);
#endif
printf("\nWIFI %s Status: Running\n==============================\n", ifname[i]);
printf("\nWIFI %s Status: Running\n", ifname[i]);
printf("==============================\n");
rltk_wlan_statistic(i);
@ -478,7 +479,8 @@ void fATWx(void *arg){
at_printf("%d.%d.%d.%d,", ip[0], ip[1], ip[2], ip[3]);
at_printf("%d.%d.%d.%d", gw[0], gw[1], gw[2], gw[3]);
#endif
printf("Interface (%s)\n==============================\n", ifname[i]);
printf("\nInterface (%s)\n", ifname[i]);
printf("==============================\n");
printf("\tMAC => %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) ;
printf("\tIP => %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
printf("\tGW => %d.%d.%d.%d\n", gw[0], gw[1], gw[2], gw[3]);
@ -494,7 +496,8 @@ void fATWx(void *arg){
client_info.count = AP_STA_NUM;
wifi_get_associated_client_list(&client_info, sizeof(client_info));
printf("Associated Client List:\n==============================\n");
printf("Associated Client List:\n");
printf("==============================\n");
if(client_info.count == 0)
printf("Client Num: 0\n", client_info.count);
@ -530,7 +533,8 @@ void fATWx(void *arg){
mac = LwIP_GetMAC(&xnetif[i]);
ip = LwIP_GetIP(&xnetif[i]);
gw = LwIP_GetGW(&xnetif[i]);
printf("Interface ethernet\n==============================\n");
printf("\nInterface ethernet\n");
printf("==============================\n");
printf("\tMAC => %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) ;
printf("\tIP => %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
printf("\tGW => %d.%d.%d.%d\n", gw[0], gw[1], gw[2], gw[3]);
@ -542,9 +546,14 @@ void fATWx(void *arg){
#if defined(configUSE_TRACE_FACILITY) && (configUSE_TRACE_FACILITY == 1) && (configUSE_STATS_FORMATTING_FUNCTIONS == 1)
{
signed char pcWriteBuffer[1024];
vTaskList((char*)pcWriteBuffer);
printf("Task List:\n%s\n", pcWriteBuffer);
char * pcWriteBuffer = malloc(1024);
if(pcWriteBuffer) {
vTaskList((char*)pcWriteBuffer);
printf("\nTask List:\n");
printf("==============================\n");
printf("Name\t Status Priority HighWaterMark TaskNumber\n%s\n", pcWriteBuffer);
free(pcWriteBuffer);
}
}
#endif

View file

@ -13,7 +13,7 @@
#endif
#ifdef CONFIG_WOWLAN_DEV_NT96658
#define WOW_WIFI_IN_PIN PE_4 //JTAG pin, so JTAG must be disable before using this pin as wakeup pin
#define WOW_WIFI_IN_PIN PE_4 // JTAG pin, so JTAG must be disable before using this pin as wakeup pin
#define WOW_TRIGGER_INTERVAL 500
#elif defined(CONFIG_WOWLAN_DEV_OV788)
#define WOW_WIFI_IN_PIN PD_5

View file

@ -10,54 +10,52 @@
#ifndef WPS_DEFS_H
#define WPS_DEFS_H
/* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
#define WPS_DH_GROUP (5)
#define WPS_UUID_LEN (16)
#define WPS_NONCE_LEN (16)
#define WPS_AUTHENTICATOR_LEN (8)
#define WPS_AUTHKEY_LEN (32)
#define WPS_KEYWRAPKEY_LEN (16)
#define WPS_EMSK_LEN (32)
#define WPS_PSK_LEN (16)
#define WPS_SECRET_NONCE_LEN (16)
#define WPS_HASH_LEN (32)
#define WPS_KWA_LEN (8)
#define WPS_MGMTAUTHKEY_LEN (32)
#define WPS_MGMTENCKEY_LEN (16)
#define WPS_MGMT_KEY_ID_LEN (16)
#define WPS_OOB_DEVICE_PASSWORD_MIN_LEN (16)
#define WPS_OOB_DEVICE_PASSWORD_LEN (32)
#define WPS_OOB_PUBKEY_HASH_LEN (20)
#define WPS_DH_GROUP (5)
#define WPS_UUID_LEN (16)
#define WPS_NONCE_LEN (16)
#define WPS_AUTHENTICATOR_LEN (8)
#define WPS_AUTHKEY_LEN (32)
#define WPS_KEYWRAPKEY_LEN (16)
#define WPS_EMSK_LEN (32)
#define WPS_PSK_LEN (16)
#define WPS_SECRET_NONCE_LEN (16)
#define WPS_HASH_LEN (32)
#define WPS_KWA_LEN (8)
#define WPS_MGMTAUTHKEY_LEN (32)
#define WPS_MGMTENCKEY_LEN (16)
#define WPS_MGMT_KEY_ID_LEN (16)
#define WPS_OOB_DEVICE_PASSWORD_MIN_LEN (16)
#define WPS_OOB_DEVICE_PASSWORD_LEN (32)
#define WPS_OOB_PUBKEY_HASH_LEN (20)
/* Attribute Types */
enum wps_attribute {
ATTR_AP_CHANNEL = 0x1001,
ATTR_ASSOC_STATE = 0x1002,
ATTR_AUTH_TYPE = 0x1003,
ATTR_AUTH_TYPE_FLAGS = 0x1004,
ATTR_AUTH_TYPE_FLAGS = 0x1004,
ATTR_AUTHENTICATOR = 0x1005,
ATTR_CONFIG_METHODS = 0x1008,
ATTR_CONFIG_METHODS = 0x1008,
ATTR_CONFIG_ERROR = 0x1009,
ATTR_CONFIRM_URL4 = 0x100a,
ATTR_CONFIRM_URL6 = 0x100b,
ATTR_CONN_TYPE = 0x100c,
ATTR_CONN_TYPE_FLAGS = 0x100d,
ATTR_CRED = 0x100e,
ATTR_CONN_TYPE_FLAGS = 0x100d,
ATTR_CRED = 0x100e,
ATTR_ENCR_TYPE = 0x100f,
ATTR_ENCR_TYPE_FLAGS = 0x1010,
ATTR_ENCR_TYPE_FLAGS = 0x1010,
ATTR_DEV_NAME = 0x1011,
ATTR_DEV_PASSWORD_ID = 0x1012,
ATTR_DEV_PASSWORD_ID = 0x1012,
ATTR_E_HASH1 = 0x1014,
ATTR_E_HASH2 = 0x1015,
ATTR_E_SNONCE1 = 0x1016,
ATTR_E_SNONCE2 = 0x1017,
ATTR_ENCR_SETTINGS = 0x1018,
ATTR_ENROLLEE_NONCE = 0x101a,
ATTR_ENROLLEE_NONCE = 0x101a,
ATTR_FEATURE_ID = 0x101b,
ATTR_IDENTITY = 0x101c,
ATTR_IDENTITY_PROOF = 0x101d,
ATTR_IDENTITY_PROOF = 0x101d,
ATTR_KEY_WRAP_AUTH = 0x101e,
ATTR_KEY_ID = 0x101f,
ATTR_MAC_ADDR = 0x1020,
@ -67,8 +65,8 @@ enum wps_attribute {
ATTR_MODEL_NUMBER = 0x1024,
ATTR_NETWORK_INDEX = 0x1026,
ATTR_NETWORK_KEY = 0x1027,
ATTR_NETWORK_KEY_INDEX = 0x1028,
ATTR_NEW_DEVICE_NAME = 0x1029,
ATTR_NETWORK_KEY_INDEX = 0x1028,
ATTR_NEW_DEVICE_NAME = 0x1029,
ATTR_NEW_PASSWORD = 0x102a,
ATTR_OOB_DEVICE_PASSWORD = 0x102c,
ATTR_OS_VERSION = 0x102d,
@ -78,11 +76,11 @@ enum wps_attribute {
ATTR_PUBLIC_KEY = 0x1032,
ATTR_RADIO_ENABLE = 0x1033,
ATTR_REBOOT = 0x1034,
ATTR_REGISTRAR_CURRENT = 0x1035,
ATTR_REGISTRAR_CURRENT = 0x1035,
ATTR_REGISTRAR_ESTABLISHED = 0x1036,
ATTR_REGISTRAR_LIST = 0x1037,
ATTR_REGISTRAR_LIST = 0x1037,
ATTR_REGISTRAR_MAX = 0x1038,
ATTR_REGISTRAR_NONCE = 0x1039,
ATTR_REGISTRAR_NONCE = 0x1039,
ATTR_REQUEST_TYPE = 0x103a,
ATTR_RESPONSE_TYPE = 0x103b,
ATTR_RF_BANDS = 0x103c,
@ -90,11 +88,11 @@ enum wps_attribute {
ATTR_R_HASH2 = 0x103e,
ATTR_R_SNONCE1 = 0x103f,
ATTR_R_SNONCE2 = 0x1040,
ATTR_SELECTED_REGISTRAR = 0x1041,
ATTR_SELECTED_REGISTRAR = 0x1041,
ATTR_SERIAL_NUMBER = 0x1042,
ATTR_WPS_STATE = 0x1044,
ATTR_SSID = 0x1045,
ATTR_TOTAL_NETWORKS = 0x1046,
ATTR_SSID = 0x1045,
ATTR_TOTAL_NETWORKS = 0x1046,
ATTR_UUID_E = 0x1047,
ATTR_UUID_R = 0x1048,
ATTR_VENDOR_EXT = 0x1049,
@ -108,40 +106,40 @@ enum wps_attribute {
ATTR_KEY_LIFETIME = 0x1051,
ATTR_PERMITTED_CFG_METHODS = 0x1052,
ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
ATTR_PRIMARY_DEV_TYPE = 0x1054,
ATTR_PRIMARY_DEV_TYPE = 0x1054,
ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
ATTR_PORTABLE_DEV = 0x1056,
ATTR_AP_SETUP_LOCKED = 0x1057,
ATTR_APPLICATION_EXT = 0x1058,
ATTR_AP_SETUP_LOCKED = 0x1057,
ATTR_APPLICATION_EXT = 0x1058,
ATTR_EAP_TYPE = 0x1059,
ATTR_IV = 0x1060,
ATTR_KEY_PROVIDED_AUTO = 0x1061,
ATTR_802_1X_ENABLED = 0x1062,
ATTR_IV = 0x1060,
ATTR_KEY_PROVIDED_AUTO = 0x1061,
ATTR_802_1X_ENABLED = 0x1062,
ATTR_APPSESSIONKEY = 0x1063,
ATTR_WEPTRANSMITKEY = 0x1064,
ATTR_REQUESTED_DEV_TYPE = 0x106a,
ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
ATTR_WEPTRANSMITKEY = 0x1064,
ATTR_REQUESTED_DEV_TYPE = 0x106a,
ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
};
#define WPS_VENDOR_ID_WFA 14122
/* WFA Vendor Extension subelements */
enum {
WFA_ELEM_VERSION2 = 0x00,
WFA_ELEM_AUTHORIZEDMACS = 0x01,
WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
WFA_ELEM_VERSION2 = 0x00,
WFA_ELEM_AUTHORIZEDMACS = 0x01,
WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
};
/* Device Password ID */
enum wps_dev_password_id {
DEV_PW_DEFAULT = 0x0000,
DEV_PW_USER_SPECIFIED = 0x0001,
DEV_PW_DEFAULT = 0x0000,
DEV_PW_USER_SPECIFIED = 0x0001,
DEV_PW_MACHINE_SPECIFIED = 0x0002,
DEV_PW_REKEY = 0x0003,
DEV_PW_PUSHBUTTON = 0x0004,
DEV_PW_REGISTRAR_SPECIFIED = 0x0005
DEV_PW_REKEY = 0x0003,
DEV_PW_PUSHBUTTON = 0x0004,
DEV_PW_REGISTRAR_SPECIFIED = 0x0005
};
/* Message Type */
@ -159,9 +157,9 @@ enum wps_msg_type {
WPS_M6 = 0x0a,
WPS_M7 = 0x0b,
WPS_M8 = 0x0c,
WPS_WSC_ACK = 0x0d,
WPS_WSC_NACK = 0x0e,
WPS_WSC_DONE = 0x0f
WPS_WSC_ACK = 0x0d,
WPS_WSC_NACK = 0x0e,
WPS_WSC_DONE = 0x0f
};
/* Authentication Type Flags */
@ -184,24 +182,24 @@ enum wps_msg_type {
/* Configuration Error */
enum wps_config_error {
WPS_CFG_NO_ERROR = 0,
WPS_CFG_NO_ERROR = 0,
WPS_CFG_OOB_IFACE_READ_ERROR = 1,
WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
WPS_CFG_SIGNAL_TOO_WEAK = 5,
WPS_CFG_SIGNAL_TOO_WEAK = 5,
WPS_CFG_NETWORK_AUTH_FAILURE = 6,
WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
WPS_CFG_NO_DHCP_RESPONSE = 8,
WPS_CFG_FAILED_DHCP_CONFIG = 9,
WPS_CFG_IP_ADDR_CONFLICT = 10,
WPS_CFG_NO_DHCP_RESPONSE = 8,
WPS_CFG_FAILED_DHCP_CONFIG = 9,
WPS_CFG_IP_ADDR_CONFLICT = 10,
WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
WPS_CFG_ROGUE_SUSPECTED = 13,
WPS_CFG_DEVICE_BUSY = 14,
WPS_CFG_SETUP_LOCKED = 15,
WPS_CFG_MSG_TIMEOUT = 16,
WPS_CFG_REG_SESS_TIMEOUT = 17,
WPS_CFG_ROGUE_SUSPECTED = 13,
WPS_CFG_DEVICE_BUSY = 14,
WPS_CFG_SETUP_LOCKED = 15,
WPS_CFG_MSG_TIMEOUT = 16,
WPS_CFG_REG_SESS_TIMEOUT = 17,
WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18
};
@ -210,15 +208,15 @@ enum wps_config_error {
#define WPS_RF_50GHZ (0x02)
/* Config Methods */
#define WPS_CONFIG_USBA (0x0001)
#define WPS_CONFIG_ETHERNET (0x0002)
#define WPS_CONFIG_LABEL (0x0004)
#define WPS_CONFIG_DISPLAY (0x0008)
#define WPS_CONFIG_USBA (0x0001)
#define WPS_CONFIG_ETHERNET (0x0002)
#define WPS_CONFIG_LABEL (0x0004)
#define WPS_CONFIG_DISPLAY (0x0008)
#define WPS_CONFIG_EXT_NFC_TOKEN (0x0010)
#define WPS_CONFIG_INT_NFC_TOKEN (0x0020)
#define WPS_CONFIG_NFC_INTERFACE (0x0040)
#define WPS_CONFIG_PUSHBUTTON (0x0080)
#define WPS_CONFIG_KEYPAD (0x0100)
#define WPS_CONFIG_KEYPAD (0x0100)
#ifdef CONFIG_WPS2
#define WPS_CONFIG_VIRT_PUSHBUTTON (0x0280)
@ -242,11 +240,10 @@ enum wps_assoc_state {
WPS_ASSOC_NOT_ASSOC = 0,
WPS_ASSOC_CONN_SUCCESS = 1,
WPS_ASSOC_CFG_FAILURE = 2,
WPS_ASSOC_FAILURE = 3,
WPS_ASSOC_FAILURE = 3,
WPS_ASSOC_IP_FAILURE = 4
};
#define WPS_DEV_OUI_WFA (0x0050f204)
enum wps_dev_categ {
@ -265,7 +262,7 @@ enum wps_dev_categ {
enum wps_dev_subcateg {
WPS_DEV_COMPUTER_PC = 1,
WPS_DEV_COMPUTER_SERVER = 2,
WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
WPS_DEV_PRINTER_PRINTER = 1,
WPS_DEV_PRINTER_SCANNER = 2,
@ -275,11 +272,11 @@ enum wps_dev_subcateg {
WPS_DEV_STORAGE_NAS = 1,
WPS_DEV_NETWORK_INFRA_AP = 1,
WPS_DEV_NETWORK_INFRA_ROUTER = 2,
WPS_DEV_NETWORK_INFRA_SWITCH = 3,
WPS_DEV_NETWORK_INFRA_ROUTER = 2,
WPS_DEV_NETWORK_INFRA_SWITCH = 3,
WPS_DEV_DISPLAY_TV = 1,
WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
WPS_DEV_DISPLAY_TV = 1,
WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
WPS_DEV_DISPLAY_PROJECTOR = 3,
WPS_DEV_MULTIMEDIA_DAR = 1,
@ -290,21 +287,21 @@ enum wps_dev_subcateg {
WPS_DEV_GAMING_XBOX360 = 2,
WPS_DEV_GAMING_PLAYSTATION = 3,
WPS_DEV_PHONE_WINDOWS_MOBILE = 1
WPS_DEV_PHONE_WINDOWS_MOBILE = 1
};
/* Request Type */
enum wps_request_type {
WPS_REQ_ENROLLEE_INFO = 0,
WPS_REQ_ENROLLEE = 1,
WPS_REQ_REGISTRAR = 2,
WPS_REQ_ENROLLEE_INFO = 0,
WPS_REQ_ENROLLEE = 1,
WPS_REQ_REGISTRAR = 2,
WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
};
/* Response Type */
enum wps_response_type {
WPS_RESP_ENROLLEE_INFO = 0,
WPS_RESP_ENROLLEE_INFO = 0,
WPS_RESP_ENROLLEE = 1,
WPS_RESP_REGISTRAR = 2,
WPS_RESP_AP = 3

View file

@ -18,16 +18,16 @@
struct dev_credential {
u8 ssid[32]; /**< SSID */
size_t ssid_len; /**< Length of SSID */
u16 auth_type; /**< Authentication Type (WPS_AUTH_OPEN, .. flags) */
u16 encr_type; /**< Encryption Type (WPS_ENCR_NONE, .. flags) */
u8 key_idx; /**< Key index */
u8 key[65]; /**< Key */
size_t key_len; /**< Key length in octets */
u8 mac_addr[6]; /**< MAC address of the Credential receiver */
u16 auth_type; /**< Authentication Type (WPS_AUTH_OPEN, .. flags) */
u16 encr_type; /**< Encryption Type (WPS_ENCR_NONE, .. flags) */
u8 key_idx; /**< Key index */
u8 key[65]; /**< Key */
size_t key_len; /**< Key length in octets */
u8 mac_addr[6]; /**< MAC address of the Credential receiver */
const u8 *cred_attr; /**< Unparsed Credential attribute data (used only in cred_cb()).
This may be NULL, if not used. */
size_t cred_attr_len; /**< Length of cred_attr in octets */
u16 ap_channel; /**< AP channel */
u16 ap_channel; /**< AP channel */
};
typedef struct {

View file

@ -152,51 +152,6 @@ extern unsigned char dhcp_mode_sta;
#include "freertos/wrapper.h"
#include "skbuff.h"
//extern Rltk_wlan_t rltk_wlan_info[2];
void patch_rltk_wlan_deinit(void) {
uint8_t chk;
if (rltk_wlan_info[0].enable || rltk_wlan_info[0].enable) {
_adapter *ad = rltk_wlan_info[0].dev->priv;
ad->bSurpriseRemoved = 1;
rtw_wakeup_task(&ad->isrThread.task);
while (1) {
save_and_cli(); // = taskENTER_CRITICAL(); // = vPortEnterCritical()
rltk_wlan_info[0].enable = 0;
rltk_wlan_info[1].enable = 0;
chk = rltk_wlan_info[0].tx_busy + rltk_wlan_info[0].rx_busy
+ rltk_wlan_info[1].tx_busy + rltk_wlan_info[0].rx_busy;
restore_flags();
if (!chk)
break;
rtl_printf("[%s] Wait for TX/RX Busy (%d)\n", __func__, chk);
vTaskDelay(10);
}
while (1) {
if (!*(u32 *) (ad->isrThread.wakeup_sema) || ad->RxStop == 2)
break;
rtl_printf("[%s] Wait for RxStop\n", __func__);
vTaskDelay(10);
}
rtw_dev_remove(rltk_wlan_info);
rtw_drv_halt();
deinit_timer_wrapper();
rltk_wlan_info[0].enable = 0;
rltk_wlan_info[1].enable = 0;
rltk_wlan_info[0].dev = 0;
rltk_wlan_info[0].skb = 0;
rltk_wlan_info[0].tx_busy = 0;
rltk_wlan_info[0].rx_busy = 0;
rltk_wlan_info[0].enable = 0;
rltk_wlan_info[1].dev = 0;
rltk_wlan_info[1].skb = 0;
rltk_wlan_info[1].tx_busy = 0;
rltk_wlan_info[1].rx_busy = 0;
rltk_wlan_info[1].enable = 0;
//deinit_mem_monitor(NULL, NULL);
}
}
//------------------------------------------------------------------------end-patch//
static int wifi_connect_local(rtw_network_info_t *pWifi) {
int ret = 0;
@ -1056,8 +1011,7 @@ int wifi_off(void) {
wpas_wps_deinit();
#endif
info_printf("Deinitializing WIFI ...\n");
// extern void patch_rltk_wlan_deinit();
patch_rltk_wlan_deinit();
rltk_wlan_deinit();
while (1) {
if ((rltk_wlan_running(WLAN0_IDX) == 0)

View file

@ -774,7 +774,7 @@ int wext_add_custom_ie(const char *ifname, void *cus_ie, int ie_num) {
int cmd_len = sizeof("SetCusIE");
if (ie_num <= 0 || !cus_ie) {
#if CONFIG_DEBUG_LOG > 3
wext_printf("%s: wrong parameter!\n", __func__);
error_printf("%s: wrong parameter!\n", __func__);
#endif
} else {
memset(&iwr, 0, sizeof(iwr));
@ -807,7 +807,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index) {
int cmd_len = sizeof("UpdateIE");
if (ie_index <= 0 || !cus_ie) {
#if CONFIG_DEBUG_LOG > 3
wext_printf("%s: wrong parameter!\n", __func__);
error_printf("%s: wrong parameter!\n", __func__);
#endif
} else {
memset(&iwr, 0, sizeof(iwr));

View file

@ -381,8 +381,7 @@ typedef struct HeapRegion
* terminated by a HeapRegions_t structure that has a size of 0. The region
* with the lowest start address must appear first in the array.
*/
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
/*
* Map to the memory management routines required for the port.

View file

@ -202,24 +202,22 @@ HeapRegion_t xHeapRegions[] =
#endif
/*-----------------------------------------------------------*/
#if 1
/*
Dump xBlock list
*/
void dump_mem_block_list()
void dump_mem_block_list(void)
{
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
#if CONFIG_DEBUG_LOG > 1
// if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); // test code start
BlockLink_t *pxBlock = &xStart;
int count = 0;
DBG_8195A("RAM Heap Memory List:\n");
while(pxBlock->pxNextFreeBlock != NULL)
{
DBG_8195A(" [%d]=%p, %d\n", count++, pxBlock, pxBlock->xBlockSize);
pxBlock = pxBlock->pxNextFreeBlock;
DBG_8195A("RAM Free Heap Memory List:\n");
for(pxBlock = pxBlock->pxNextFreeBlock; pxBlock->pxNextFreeBlock != NULL; pxBlock = pxBlock->pxNextFreeBlock) {
DBG_8195A(" [%d]=%p, %d\n", ++count, pxBlock, pxBlock->xBlockSize);
}
}
#endif
}
void *pvPortMalloc( size_t xWantedSize )
{
@ -228,7 +226,6 @@ void *pvReturn = NULL;
/* Realtek test code start */
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
/* Realtek test code end */
/* The heap must be initialised before the first call to
@ -343,11 +340,14 @@ void *pvReturn = NULL;
{
mtCOVERAGE_TEST_MARKER();
}
traceMALLOC( pvReturn, xWantedSize );
}
( void ) xTaskResumeAll();
if(pvReturn == NULL) {
DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize, xFreeBytesRemaining);
} else {
// DBG_RAM_HEAP_INFO("ram_alloc:%p[%d]\n", pvReturn , xWantedSize);
}
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
{
if( pvReturn == NULL )
@ -410,6 +410,7 @@ BlockLink_t *pxLink;
{
mtCOVERAGE_TEST_MARKER();
}
// DBG_RAM_HEAP_INFO("ram_free:%p[%d]\n", pv , pxLink->xBlockSize);
}
}
@ -511,7 +512,7 @@ uint8_t *puc;
}
/*-----------------------------------------------------------*/
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
{
BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
uint8_t *pucAlignedHeap;

View file

@ -3488,6 +3488,14 @@ TCB_t *pxTCB;
#endif /* portCRITICAL_NESTING_IN_TCB */
/*-----------------------------------------------------------*/
char * sprintf_pcTaskName(char * buf, char * name)
{
int len = sprintf(buf, name);
if(len < configMAX_TASK_NAME_LEN) {
memset(buf + len, ' ', configMAX_TASK_NAME_LEN - len);
}
return buf + configMAX_TASK_NAME_LEN;
}
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
@ -3559,8 +3567,9 @@ TCB_t *pxTCB;
cStatus = 0x00;
break;
}
pcWriteBuffer = sprintf_pcTaskName( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName);
sprintf( pcWriteBuffer, "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
pcWriteBuffer += strlen( pcWriteBuffer );
}
@ -3654,12 +3663,7 @@ TCB_t *pxTCB;
else
ulDeltaRunTimeCounter = portCONFIGURE_STATS_PEROID_VALUE*ulStatsAsPercentage/100;
#endif
int cnt = sprintf( pcWriteBuffer, "%s", pxTaskStatusArray[ x ].pcTaskName);
pcWriteBuffer += cnt;
while(cnt < configMAX_TASK_NAME_LEN) {
cnt++;
*pcWriteBuffer++ = ' ';
}
pcWriteBuffer = sprintf_pcTaskName( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName);
if( ulStatsAsPercentage > 0UL )
{
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED

View file

@ -40,10 +40,10 @@ typedef struct Heap
void tcm_heap_init(void);
/// Allocate a chunk of memory of \a size bytes from the heap
void *tcm_heap_allocmem(int size);
// void *tcm_heap_allocmem(int size);
/// Free a chunk of memory of \a size bytes from the heap
void tcm_heap_freemem(void *mem, int size);
// void tcm_heap_freemem(void *mem, int size);
int tcm_heap_freeSpace(void);

View file

@ -24,7 +24,7 @@ __attribute__((section(".tcm.heap")))
HEAP_DEFINE_BUF(tcm_heap, TCM_HEAP_SIZE);
//unsigned char tcm_heap[TCM_HEAP_SIZE];
static int g_heap_inited=0;
static int g_heap_inited = 0;
static _lock tcm_lock;
extern void vPortSetExtFree( void (*free)( void *p ), uint32_t upper, uint32_t lower );
@ -55,28 +55,38 @@ void tcm_heap_init(void)
void tcm_heap_dump(void)
{
if(!g_heap_inited) tcm_heap_init();
#if CONFIG_DEBUG_LOG > 1
MemChunk *chunk, *prev;
struct Heap* h = &g_tcm_heap;
DBG_8195A("TCM Free List:\n");
int count = 0;
int free_mem;
DBG_8195A("TCM Free Heap Memory List:\n");
for (chunk = h->FreeList; chunk; chunk = chunk->next) {
DBG_8195A(" [%d]=%p, %d\n", ++count, chunk, chunk->size);
}
/*
for (prev = (MemChunk *)&h->FreeList, chunk = h->FreeList;
chunk;
prev = chunk, chunk = chunk->next)
{
DBG_8195A(" prev %x, chunk %x, size %d\n", prev, chunk, chunk->size);
DBG_8195A(" [%d]=%p, %d\n", ++count, chunk, chunk->size);
}
// DBG_8195A(" end %x\n", tcm_heap);
*/
#endif
}
void *tcm_heap_allocmem(int size)
static void *tcm_heap_allocmem(int size)
{
MemChunk *chunk, *prev;
struct Heap* h = &g_tcm_heap;
_irqL irqL;
DBG_TCM_INFO("allocmem(%d)\n", size);
rtw_enter_critical(&tcm_lock, &irqL);
if(!g_heap_inited) tcm_heap_init();
if(!g_heap_inited) tcm_heap_init();
/* Round size up to the allocation granularity */
size = ROUND_UP2(size, sizeof(MemChunk));
@ -98,46 +108,28 @@ void *tcm_heap_allocmem(int size)
{
/* Just remove this chunk from the free list */
prev->next = chunk->next;
#ifdef _DEBUG
memset(chunk, ALLOC_FILL_CODE, size);
#endif
rtw_exit_critical(&tcm_lock, &irqL);
//printf("----ALLOC1-----\n\r");
// tcm_heap_dump();
//printf("--------------\n\r");
return (void *)chunk;
}
else
{
/* Allocate from the END of an existing chunk */
chunk->size -= size;
#ifdef _DEBUG
memset((uint8_t *)chunk + chunk->size, ALLOC_FILL_CODE, size);
#endif
rtw_exit_critical(&tcm_lock, &irqL);
//printf("----ALLOC2-----\n\r");
// tcm_heap_dump();
//printf("--------------\n\r");
return (void *)((uint8_t *)chunk + chunk->size);
chunk = (MemChunk *)((uint8_t *)chunk + chunk->size);
}
#ifdef _DEBUG
memset(chunk, ALLOC_FILL_CODE, size);
#endif
rtw_exit_critical(&tcm_lock, &irqL);
DBG_TCM_HEAP_INFO("tcm_alloc:%p[%d]\n", chunk, size);
return (void *)chunk;
}
}
rtw_exit_critical(&tcm_lock, &irqL);
//printf("----ALLOC3-----\n\r");
DBG_TCM_WARN(ANSI_COLOR_MAGENTA "allocmem(%d): freeSpace(%d)!\n" ANSI_COLOR_RESET, size, tcm_heap_freeSpace());
// if (likely(ConfigDebugErr & _DBG_TCM_HEAP_)) {
// tcm_heap_dump();
// }
// tcm_heap_dump();
//printf("--------------\n\r");
DBG_TCM_HEAP_WARN("tcm_alloc(%d) - freeSpace(%d)!\n", size, tcm_heap_freeSpace());
return NULL; /* fail */
}
void tcm_heap_freemem(void *mem, int size)
static void tcm_heap_freemem(void *mem, int size)
{
MemChunk *prev;
//ASSERT(mem);
@ -146,7 +138,7 @@ void tcm_heap_freemem(void *mem, int size)
rtw_enter_critical(&tcm_lock, &irqL);
if(!g_heap_inited) tcm_heap_init();
// if(!g_heap_inited) tcm_heap_init();
#ifdef _DEBUG
memset(mem, FREE_FILL_CODE, size);
@ -216,10 +208,7 @@ void tcm_heap_freemem(void *mem, int size)
}
rtw_exit_critical(&tcm_lock, &irqL);
//printf("---FREE %x--\n\r", mem);
//tcm_heap_dump();
//printf("--------------\n\r");
DBG_TCM_HEAP_INFO("tcm_free:%p[%d]\n", mem, size);
}
int tcm_heap_freeSpace(void)
@ -293,7 +282,8 @@ void tcm_heap_free(void *mem)
}
}
#if 0
//----------- Tests -------------
static void alloc_test(int size, int test_len)
{
//Simple test
@ -352,5 +342,6 @@ int tcm_heap_testRun(void)
return 0;
}
#endif // tests
#endif

View file

@ -209,9 +209,9 @@ prvDiagSPrintf(
#define OTG_WARN_PREFIX "[OTG Wrn]"
#define OTG_INFO_PREFIX "[OTG Inf]"
#define TCM_ERR_PREFIX "[TCM Err]"
#define TCM_WARN_PREFIX "[TCM Wrn]"
#define TCM_INFO_PREFIX "[TCM Inf]"
#define HEAP_ERR_PREFIX "[HEAP Err]"
#define HEAP_WARN_PREFIX "[HEAP Wrn]"
#define HEAP_INFO_PREFIX "[HEAP Inf]"
#define FEEP_ERR_PREFIX "[FEEP Err]"
#define FEEP_WARN_PREFIX "[FEEP Wrn]"
@ -352,24 +352,24 @@ prvDiagSPrintf(
}while(0)
#define DBG_8195A_OTG(...) do{\
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_8195A_OTG_INFO(...) do{\
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_8195A_OTG_WARN(...) do{\
if (unlikely(ConfigDebugWarn & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
if (unlikely(ConfigDebugWarn & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_8195A_OTG_ERR(...) do{\
if (unlikely(ConfigDebugErr & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
if (unlikely(ConfigDebugErr & _DBG_USB_OTG_)) \
_DbgDump(OTG_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_8195A_OTG_LVL(LVL,...) do{\
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)){ \
@ -378,9 +378,18 @@ prvDiagSPrintf(
}\
}while(0)
#define DBG_TCM_ERR(...) do {\
if (likely(ConfigDebugErr & _DBG_TCM_HEAP_)) \
_DbgDump(TCM_ERR_PREFIX __VA_ARGS__);\
#define DBG_TCM_HEAP_ERR(...) do {\
if (likely(ConfigDebugErr & _DBG_TCM_HEAP_)){ \
_DbgDump(HEAP_ERR_PREFIX ANSI_COLOR_RED);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_RAM_HEAP_ERR(...) do {\
if (likely(ConfigDebugErr & _DBG_RAM_HEAP_)){ \
_DbgDump(HEAP_ERR_PREFIX ANSI_COLOR_RED);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_MISC_ERR(...) do {\
@ -425,7 +434,8 @@ prvDiagSPrintf(
#define DBG_8195A_OTG_WARN(...)
#define DBG_8195A_OTG_ERR(...)
#define DBG_TCM_ERR(...)
#define DBG_TCM_HEAP_ERR(...)
#define DBG_RAM_HEAP_ERR(...)
#define DBG_FEEP_ERR(...)
#endif // end of else of "#if CONFIG_DEBUG_ERROR"
@ -544,9 +554,18 @@ prvDiagSPrintf(
_DbgDump(TIMER_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_TCM_WARN(...) do {\
if (likely(ConfigDebugWarn & _DBG_TCM_HEAP_)) \
_DbgDump(TCM_WARN_PREFIX __VA_ARGS__);\
#define DBG_TCM_HEAP_WARN(...) do {\
if (likely(ConfigDebugWarn & _DBG_TCM_HEAP_)){ \
_DbgDump(HEAP_WARN_PREFIX ANSI_COLOR_MAGENTA);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_RAM_HEAP_WARN(...) do {\
if (likely(ConfigDebugWarn & _DBG_RAM_HEAP_)){ \
_DbgDump(HEAP_WARN_PREFIX ANSI_COLOR_MAGENTA);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_FEEP_WARN(...) do {\
@ -581,7 +600,8 @@ prvDiagSPrintf(
#define DBG_CRYPTO_WARN(...)
#define DBG_ADC_WARN(...)
#define DBG_DAC_WARN(...)
#define DBG_TCM_WARN(...)
#define DBG_TCM_HEAP_WARN(...)
#define DBG_RAM_HEAP_WARN(...)
#define DBG_FEEP_WARN(...)
#define DBG_MISC_WARN(...)
@ -704,9 +724,18 @@ prvDiagSPrintf(
_DbgDump(TIMER_PREFIX __VA_ARGS__);\
}while(0)
#define DBG_TCM_INFO(...) do {\
if (likely(ConfigDebugInfo & _DBG_TCM_HEAP_)) \
_DbgDump(TCM_INFO_PREFIX __VA_ARGS__);\
#define DBG_TCM_HEAP_INFO(...) do {\
if (likely(ConfigDebugInfo & _DBG_TCM_HEAP_)){\
_DbgDump(HEAP_INFO_PREFIX ANSI_COLOR_BLUE);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_RAM_HEAP_INFO(...) do {\
if (likely(ConfigDebugInfo & _DBG_RAM_HEAP_)){ \
_DbgDump(HEAP_INFO_PREFIX ANSI_COLOR_BLUE);\
_DbgDump(__VA_ARGS__ );\
_DbgDump(ANSI_COLOR_RESET);}\
}while(0)
#define DBG_FEEP_INFO(...) do {\
@ -741,7 +770,8 @@ prvDiagSPrintf(
#define DBG_CRYPTO_INFO(...)
#define DBG_ADC_INFO(...)
#define DBG_DAC_INFO(...)
#define DBG_TCM_INFO(...)
#define DBG_RAM_HEAP_INFO(...)
#define DBG_TCM_HEAP_INFO(...)
#define DBG_FEEP_INFO(...)
#define DBG_MISC_INFO(...)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -121,17 +121,15 @@ void fATWS(int argc, char *argv[]){
}
}
// Mem info
// Mem info
void fATST(void){
extern u8 __HeapLimit, __StackTop;
extern struct Heap g_tcm_heap;
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
#if CONFIG_DEBUG_LOG > 1
dump_mem_block_list();
u32 saved = ConfigDebugInfo;
DBG_INFO_MSG_ON(_DBG_TCM_HEAP_); // On Debug TCM MEM
tcm_heap_dump();
ConfigDebugInfo = saved;
#endif;
printf("\n");
#if (configGENERATE_RUN_TIME_STATS == 1)
char *cBuffer = pvPortMalloc(512);