mirror of
https://github.com/drasko/open-ameba.git
synced 2024-11-22 05:54:17 +00:00
update
This commit is contained in:
parent
30329bd439
commit
67ea7a663c
12 changed files with 2347 additions and 2303 deletions
|
@ -34,7 +34,7 @@ extern int inic_stop(void);
|
||||||
|
|
||||||
//#define sscanf _sscanf
|
//#define sscanf _sscanf
|
||||||
|
|
||||||
#define SHOW_PRIVATE_OUT 1 // =0 - off, = 1 On
|
#define SHOW_PRIVATE_OUT 0 // =0 - off, = 1 On
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -794,15 +794,16 @@ int wifi_disable_powersave(void) {
|
||||||
return wext_disable_powersave(WLAN0_NAME);
|
return wext_disable_powersave(WLAN0_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1 //Not ready
|
#if 0 //Not ready
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
int wifi_get_txpower(int *poweridx) {
|
int wifi_get_txpower(int *poweridx) {
|
||||||
int ret;
|
int ret;
|
||||||
char buf[11];
|
// char buf[11];
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
rtw_memset(buf, 0, sizeof(buf));
|
rtw_memset(buf, 0, sizeof(buf));
|
||||||
rtw_memcpy(buf, "txpower", 11);
|
rtw_memcpy(buf, "txpower", 11);
|
||||||
ret = wext_private_command_with_retval(WLAN0_NAME, buf, buf, 11);
|
ret = wext_private_command_with_retval(WLAN0_NAME, buf, buf, sizeof(buf));
|
||||||
#if SHOW_PRIVATE_OUT
|
#if SHOW_PRIVATE_OUT
|
||||||
rtl_printf("%s\n", buf);
|
rtl_printf("%s\n", buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,16 +10,15 @@ int iw_ioctl(const char * ifname, unsigned long request, struct iwreq * pwrq) {
|
||||||
memcpy(pwrq->ifr_name, ifname, 5);
|
memcpy(pwrq->ifr_name, ifname, 5);
|
||||||
int ret = rltk_wlan_control(request, (void *) pwrq);
|
int ret = rltk_wlan_control(request, (void *) pwrq);
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
if (ret < 0)
|
debug_printf("ioctl[%p, '%s', %02x %02x %02x %02x ...] = %d\n",
|
||||||
error_printf("ioctl[%p, '%s', %02x %02x %02x %02x ...] error (%d)!\n",
|
|
||||||
request, ifname, pwrq->u.name[0], pwrq->u.name[1],
|
request, ifname, pwrq->u.name[0], pwrq->u.name[1],
|
||||||
pwrq->u.name[2], pwrq->u.name[3], ret);
|
pwrq->u.name[2], pwrq->u.name[3], ret);
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_DEBUG_LOG > 4
|
#if CONFIG_DEBUG_LOG > 4
|
||||||
else
|
if (pwrq->u.data.length) {
|
||||||
debug_printf("ioctl[%p, '%s', %02x %02x %02x %02x ...] = %d\n",
|
extern void dump_bytes(uint32 addr, int size);
|
||||||
request, ifname, pwrq->u.name[0], pwrq->u.name[1],
|
dump_bytes(pwrq->u.data.pointer, pwrq->u.data.length);
|
||||||
pwrq->u.name[2], pwrq->u.name[3], ret);
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -118,8 +117,9 @@ int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr,
|
||||||
vPortFree(ext);
|
vPortFree(ext);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,9 @@ int wext_get_enc_ext(const char *ifname, __u16 *alg, __u8 *key_idx,
|
||||||
vPortFree(ext);
|
vPortFree(ext);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -358,19 +359,21 @@ int wext_get_tx_power(const char *ifname, __u8 *poweridx) {
|
||||||
vPortFree(para);
|
vPortFree(para);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1 // work ?
|
#if 0 // work ?
|
||||||
int wext_set_txpower(const char *ifname, int poweridx) {
|
int wext_set_txpower(const char *ifname, int poweridx) {
|
||||||
int ret;
|
int ret;
|
||||||
char buf[24];
|
char buf[32];
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
snprintf(buf, 24, "txpower patha=%d", poweridx);
|
// snprintf(buf, 24, "txpower patha=%d", poweridx);
|
||||||
|
snprintf(buf, sizeof(buf), "txpower patha=%d,pathb=%d", poweridx, poweridx);
|
||||||
ret = wext_private_command(ifname, buf, 0);
|
ret = wext_private_command(ifname, buf, 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -471,8 +474,9 @@ int wext_set_pscan_channel(const char *ifname, __u8 *ch, __u8 *pscan_config,
|
||||||
vPortFree(para);
|
vPortFree(para);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +517,7 @@ int wext_set_scan(const char *ifname, char *buf, __u16 buf_len, __u16 flags) {
|
||||||
memset(&iwr, 0, sizeof(iwr));
|
memset(&iwr, 0, sizeof(iwr));
|
||||||
#if 0 //for scan_with_ssid
|
#if 0 //for scan_with_ssid
|
||||||
if(buf)
|
if(buf)
|
||||||
memset(buf, 0, buf_len);
|
memset(buf, 0, buf_len);
|
||||||
#endif
|
#endif
|
||||||
iwr.u.data.pointer = buf;
|
iwr.u.data.pointer = buf;
|
||||||
iwr.u.data.flags = flags;
|
iwr.u.data.flags = flags;
|
||||||
|
@ -539,6 +543,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf_size = 128;
|
buf_size = 128;
|
||||||
|
|
||||||
if (strlen(cmd) >= buf_size)
|
if (strlen(cmd) >= buf_size)
|
||||||
buf_size = strlen(cmd) + 1; // 1 : '\0'
|
buf_size = strlen(cmd) + 1; // 1 : '\0'
|
||||||
buf = (char*) pvPortMalloc(buf_size);
|
buf = (char*) pvPortMalloc(buf_size);
|
||||||
|
@ -558,8 +563,9 @@ int wext_private_command_with_retval(const char *ifname, char *cmd,
|
||||||
vPortFree(buf);
|
vPortFree(buf);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -595,16 +601,18 @@ int wext_private_command(const char *ifname, char *cmd, int show_msg) {
|
||||||
ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
|
ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
|
||||||
if (ret >= 0 && show_msg && iwr.u.data.length) {
|
if (ret >= 0 && show_msg && iwr.u.data.length) {
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
if (iwr.u.data.length > buf_size)
|
if (iwr.u.data.length > buf_size) {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
info_printf("Private Message: %s\n", (char * ) iwr.u.data.pointer);
|
info_printf("Private Message: %s\n", (char * ) iwr.u.data.pointer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
vPortFree(buf);
|
vPortFree(buf);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -760,8 +768,9 @@ int wext_get_drv_ability(const char *ifname, __u32 *ability) {
|
||||||
vPortFree(buf);
|
vPortFree(buf);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -793,8 +802,9 @@ int wext_add_custom_ie(const char *ifname, void *cus_ie, int ie_num) {
|
||||||
vPortFree(para);
|
vPortFree(para);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -826,8 +836,9 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index) {
|
||||||
vPortFree(para);
|
vPortFree(para);
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else
|
else {
|
||||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -941,7 +952,9 @@ int wext_init_mac_filter(void) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else error_printf("%s: Can't malloc memory!\n", __func__);
|
else {
|
||||||
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -978,7 +991,9 @@ int wext_add_mac_filter(unsigned char* hwaddr) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
else error_printf("%s: Can't malloc memory!\n", __func__);
|
else {
|
||||||
|
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "ethernet_mii/ethernet_mii.h"
|
#include "ethernet_mii/ethernet_mii.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wlan_lib.h"
|
||||||
|
|
||||||
#include "flash_eep.h"
|
#include "flash_eep.h"
|
||||||
#include "feep_config.h"
|
#include "feep_config.h"
|
||||||
|
|
||||||
|
@ -187,11 +189,6 @@ rtw_result_t wifi_run_ap(void) {
|
||||||
if(wext_set_sta_num(wifi_ap_cfg.max_sta) != 0) { // Max number of STAs, should be 1..3, default is 3
|
if(wext_set_sta_num(wifi_ap_cfg.max_sta) != 0) { // Max number of STAs, should be 1..3, default is 3
|
||||||
error_printf("AP not set max connections %d!\n", wifi_ap_cfg.max_sta);
|
error_printf("AP not set max connections %d!\n", wifi_ap_cfg.max_sta);
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
if( wext_set_txpower(wlan_ap_name, wifi_cfg.tx_pwr) != RTW_SUCCESS){
|
|
||||||
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid,
|
ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid,
|
||||||
wifi_ap_cfg.security_type, //rtw_security_t ecurity_type,
|
wifi_ap_cfg.security_type, //rtw_security_t ecurity_type,
|
||||||
wifi_ap_cfg.password, //char *password,
|
wifi_ap_cfg.password, //char *password,
|
||||||
|
@ -293,11 +290,6 @@ rtw_result_t wifi_run_st(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn);
|
info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn);
|
||||||
/*
|
|
||||||
if( wext_set_txpower(wlan_st_name, wifi_cfg.tx_pwr) != RTW_SUCCESS){
|
|
||||||
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type,
|
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type,
|
||||||
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid),
|
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid),
|
||||||
strlen(wifi_st_cfg.password), -1, NULL);
|
strlen(wifi_st_cfg.password), -1, NULL);
|
||||||
|
@ -446,9 +438,12 @@ int wifi_run(rtw_mode_t mode) {
|
||||||
if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
|
if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
|
||||||
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
|
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
|
||||||
};
|
};
|
||||||
if(wifi_set_txpower(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
|
// extern uint8_t rtw_power_percentage_idx;
|
||||||
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
if(rtw_power_percentage_idx != wifi_cfg.tx_pwr) {
|
||||||
};
|
if(rltk_set_tx_power_percentage(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
|
||||||
|
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
||||||
|
};
|
||||||
|
}
|
||||||
debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode);
|
debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode);
|
||||||
// if(mode == wifi_mode)
|
// if(mode == wifi_mode)
|
||||||
{
|
{
|
||||||
|
@ -714,11 +709,44 @@ void fATWI(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fATWT(int argc, char *argv[]) {
|
||||||
|
if(argc > 1) {
|
||||||
|
int txpwr = atoi(argv[1]);
|
||||||
|
debug_printf("set tx power (%d)...\n", txpwr);
|
||||||
|
if(rltk_set_tx_power_percentage(txpwr) != RTW_SUCCESS) {
|
||||||
|
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("TX power = %d\n", rtw_power_percentage_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-- Test tsf (64-bits counts, 1 us step) ---
|
||||||
|
|
||||||
|
#include "hal_com_reg.h"
|
||||||
|
|
||||||
|
#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
|
||||||
|
#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
|
||||||
|
|
||||||
|
uint64_t get_tsf(void)
|
||||||
|
{
|
||||||
|
return *((uint64_t *)(WIFI_REG_BASE + REG_TSFTR));
|
||||||
|
}
|
||||||
|
|
||||||
|
void fATSF(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
uint64_t tsf = get_tsf();
|
||||||
|
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
|
||||||
|
}
|
||||||
|
|
||||||
MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
|
MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
|
||||||
{"ATPN", 1, fATPN, "=<SSID>[,password[,encryption[,auto-reconnect[,reconnect pause]]]: WIFI Connect to AP"},
|
{"ATPN", 1, fATPN, "=<SSID>[,password[,encryption[,auto-reconnect[,reconnect pause]]]: WIFI Connect to AP"},
|
||||||
{"ATPA", 1, fATPA, "=<SSID>[,password[,encryption[,channel[,hidden[,max connections]]]]]: Start WIFI AP"},
|
{"ATPA", 1, fATPA, "=<SSID>[,password[,encryption[,channel[,hidden[,max connections]]]]]: Start WIFI AP"},
|
||||||
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
|
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
|
||||||
{"ATON", 0, fATON, ": Open connections"},
|
{"ATON", 0, fATON, ": Open connections"},
|
||||||
{"ATOF", 0, fATOF, ": Close connections"},
|
{"ATOF", 0, fATOF, ": Close connections"},
|
||||||
{"ATWI", 0, fATWI, ": WiFi Info"}
|
{"ATWI", 0, fATWI, ": WiFi Info"},
|
||||||
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
|
{"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"},
|
||||||
|
{"ATSF", 0, fATSF, ": Test TSF value"},
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -437,6 +437,7 @@ prvDiagSPrintf(
|
||||||
#define DBG_TCM_HEAP_ERR(...)
|
#define DBG_TCM_HEAP_ERR(...)
|
||||||
#define DBG_RAM_HEAP_ERR(...)
|
#define DBG_RAM_HEAP_ERR(...)
|
||||||
#define DBG_FEEP_ERR(...)
|
#define DBG_FEEP_ERR(...)
|
||||||
|
#define DBG_MISC_ERR(...)
|
||||||
|
|
||||||
#endif // end of else of "#if CONFIG_DEBUG_ERROR"
|
#endif // end of else of "#if CONFIG_DEBUG_ERROR"
|
||||||
|
|
||||||
|
|
|
@ -730,7 +730,7 @@ SECTIONS
|
||||||
__image1_validate_code__ = 0x10000bdc; /* 8 bytes HalResetVsrV02(), HalResetVsr() */
|
__image1_validate_code__ = 0x10000bdc; /* 8 bytes HalResetVsrV02(), HalResetVsr() */
|
||||||
|
|
||||||
|
|
||||||
__ram_image_end__ = 0x10002100;
|
/* __ram_image_end__ = 0x10002100; */
|
||||||
|
|
||||||
/* End RAM data used in ROM */
|
/* End RAM data used in ROM */
|
||||||
|
|
||||||
|
|
|
@ -252,5 +252,5 @@ SECTIONS
|
||||||
{
|
{
|
||||||
KEEP(*(.loader.head*))
|
KEEP(*(.loader.head*))
|
||||||
}
|
}
|
||||||
ASSERT(__ram_image_end__ != 0x100020c0, "Error rom-bios-boot code & data!")
|
ASSERT(__ram_image_end__ == 0x100020c0, "Error rom-bios-boot code & data!")
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4521
build/obj/build.nmap
4521
build/obj/build.nmap
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue