mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
clean
This commit is contained in:
parent
bd42ffa334
commit
3904cfcf03
34 changed files with 3570 additions and 133 deletions
|
|
@ -618,7 +618,7 @@ void fATSx(void *arg)
|
|||
|
||||
#define ATCMD_VERSION "v2" //ATCMD MAJOR VERSION, AT FORMAT CHANGED
|
||||
#define ATCMD_SUBVERSION "2" //ATCMD MINOR VERSION, NEW COMMAND ADDED
|
||||
#define ATCMD_REVISION "1" //ATCMD FIX BUG REVISION
|
||||
#define ATCMD_REVISION "2" //ATCMD FIX BUG REVISION
|
||||
#define SDK_VERSION "v3.5" //SDK VERSION
|
||||
extern void sys_reset(void);
|
||||
void print_system_at(void *arg);
|
||||
|
|
|
|||
139
RTL00_SDKV35a/component/common/api/platform/esp_comp.h
Normal file
139
RTL00_SDKV35a/component/common/api/platform/esp_comp.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
#ifndef _INCLUDE_ESP_COMP_H_
|
||||
#define _INCLUDE_ESP_COMP_H_
|
||||
|
||||
#include "platform_autoconf.h"
|
||||
#include "flash_api.h"
|
||||
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#define DATA_IRAM_ATTR
|
||||
|
||||
#define os_printf(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_printf_plus(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
|
||||
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
|
||||
/*
|
||||
#define os_malloc pvPortMalloc
|
||||
#define os_zalloc pvPortZalloc
|
||||
#define os_calloc pvPortCalloc
|
||||
#define os_realloc pvPortRealloc
|
||||
*/
|
||||
#undef os_free
|
||||
#define os_free vPortFree
|
||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||
#undef os_realloc
|
||||
#define os_realloc pvPortReAlloc
|
||||
|
||||
|
||||
#define os_bzero rtl_bzero
|
||||
#define os_delay_us wait_us // HalDelayUs
|
||||
//#define os_install_putc1 rtl_install_putc1
|
||||
//#define os_install_putc2 rtl_install_putc2
|
||||
//#define os_intr_lock rtl_intr_lock
|
||||
//#define os_intr_unlock rtl_intr_unlock
|
||||
//#define os_isr_attach rtl_isr_attach
|
||||
//#define os_isr_mask rtl_isr_mask
|
||||
//#define os_isr_unmask rtl_isr_unmask
|
||||
#define os_memcmp rtl_memcmp
|
||||
#define os_memcpy rtl_memcpy
|
||||
#define ets_memcpy rtl_memcpy
|
||||
#define os_memmove rtl_memmove
|
||||
#define os_memset rtl_memset
|
||||
#define os_putc rtl_putc
|
||||
//#define os_str2macaddr rtl_str2macaddr
|
||||
//#define os_strcat strcat
|
||||
#define os_strchr rtl_strchr
|
||||
#define os_strrchr rtl_strrchr
|
||||
#define os_strcmp rtl_strcmp
|
||||
#define os_strcpy rtl_strcpy
|
||||
#define os_strlen rtl_strlen
|
||||
#define os_strncmp rtl_strncmp
|
||||
#define os_strncpy rtl_strncpy
|
||||
#define os_strstr rtl_strstr
|
||||
#define os_random Rand
|
||||
//extern uint32 phy_get_rand(void);
|
||||
#define system_get_os_print() 1
|
||||
|
||||
#ifdef USE_US_TIMER
|
||||
#define os_timer_arm_us(a, b, c) rtl_timer_arm_new(a, b, c, 0)
|
||||
#endif
|
||||
|
||||
|
||||
//#define os_timer_arm(a, b, c) rtl_timer_arm_new(a, b, c, 1)
|
||||
//#define os_timer_disarm rtl_timer_disarm
|
||||
//#define os_timer_init rtl_timer_init
|
||||
//#define os_timer_setfn rtl_timer_setfn
|
||||
|
||||
//#define os_timer_done rtl_timer_done
|
||||
//#define os_timer_handler_isr rtl_timer_handler_isr
|
||||
|
||||
//#define os_update_cpu_frequency rtl_update_cpu_frequency
|
||||
|
||||
//#define os_sprintf ets_sprintf
|
||||
/*
|
||||
typedef struct{
|
||||
uint32_t deviceId; //+00
|
||||
uint32_t chip_size; //+04 chip size in byte
|
||||
uint32_t block_size; //+08
|
||||
uint32_t sector_size; //+0c
|
||||
uint32_t page_size; //+10
|
||||
uint32_t status_mask; //+14
|
||||
} SpiFlashChip;
|
||||
|
||||
typedef enum {
|
||||
SPI_FLASH_RESULT_OK,
|
||||
SPI_FLASH_RESULT_ERR,
|
||||
SPI_FLASH_RESULT_TIMEOUT
|
||||
} SpiFlashOpResult;
|
||||
|
||||
extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
||||
*/
|
||||
|
||||
// include "flash_api.h"
|
||||
#define spi_flash_real_size() flash_get_size(&flashobj)
|
||||
#define Cache_Read_Disable() SpicDisableRtl8195A()
|
||||
#define Cache_Read_Enable(a, b, c) flash_turnon()
|
||||
|
||||
#define spi_flash_get_id() ((flashobj.SpicInitPara.id[0] << 16) | (flashobj.SpicInitPara.id[1]<<8) | flashobj.SpicInitPara.id[2])
|
||||
//SpiFlashOpResult spi_flash_read_status(uint32_t * sta);
|
||||
//SpiFlashOpResult spi_flash_write_status(uint32_t sta);
|
||||
#define spi_flash_erase_sector(sec) flash_erase_sector(&flashobj, (sec)<<12)
|
||||
#define spi_flash_write(faddr, pbuf, size) flash_stream_write(&flashobj, faddr, size, (uint8_t *)pbuf)
|
||||
#define spi_flash_read(faddr, pbuf, size) flash_stream_read(&flashobj, faddr, size, (uint8_t *)pbuf)
|
||||
#define spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
||||
|
||||
|
||||
#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"
|
||||
|
||||
/* CONFIG_DEBUG_LOG:
|
||||
=0 Off all diag/debug msg,
|
||||
=1 Only errors,
|
||||
=2 errors + warning, (default)
|
||||
=3 errors + warning + info,
|
||||
=4 errors + warning + info + debug,
|
||||
=5 full */
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
#define DEBUGSOO (CONFIG_DEBUG_LOG - 1)
|
||||
#elif CONFIG_DEBUG_LOG > 1
|
||||
#define DEBUGSOO 2
|
||||
#else
|
||||
#define DEBUGSOO CONFIG_DEBUG_LOG
|
||||
#endif
|
||||
|
||||
#endif // _INCLUDE_ESP_COMP_H_
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
#include "lwip/udp.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip_netconf.h"
|
||||
#include "rtl8195a/esp_comp.h"
|
||||
#include "platform/esp_comp.h"
|
||||
|
||||
#define NETBIOS_CODE_ATTR
|
||||
#define NETBIOS_DATA_ATTR
|
||||
|
|
|
|||
|
|
@ -85,10 +85,8 @@
|
|||
#include "webserver.h"
|
||||
#include "wlan_intf.h"
|
||||
|
||||
|
||||
#define CONFIG_READ_FLASH 1
|
||||
|
||||
|
||||
#ifdef CONFIG_READ_FLASH
|
||||
|
||||
#ifndef CONFIG_PLATFORM_8195A
|
||||
|
|
@ -104,7 +102,14 @@
|
|||
|
||||
#else
|
||||
#include "flash_api.h"
|
||||
#include "flash_eep.h"
|
||||
#include "feep_config.h"
|
||||
#include "device_lock.h"
|
||||
|
||||
#ifndef FEEP_ID_WIFI_AP_CFG
|
||||
#define FEEP_ID_WIFI_AP_CFG 0x5731
|
||||
#endif
|
||||
|
||||
#define DATA_SECTOR AP_SETTING_SECTOR
|
||||
#define BACKUP_SECTOR (0x00008000)
|
||||
|
||||
|
|
@ -542,13 +547,40 @@ int StoreApInfo()
|
|||
|
||||
void LoadWifiConfig()
|
||||
{
|
||||
|
||||
|
||||
flash_t flash;
|
||||
|
||||
rtw_wifi_config_t local_config;
|
||||
uint32_t address;
|
||||
local_config.boot_mode = 0;
|
||||
#ifdef USE_FLASH_EEP
|
||||
if(flash_read_cfg((uint8_t *)(&local_config), FEEP_ID_WIFI_AP_CFG, sizeof(rtw_wifi_config_t)) >= sizeof(rtw_wifi_config_t)) {
|
||||
printf("%s: Read from FLASH!\n", __FUNCTION__);
|
||||
printf("%s: local_config.boot_mode=0x%x\n", __FUNCTION__, local_config.boot_mode);
|
||||
printf("%s: local_config.ssid=%s\n", __FUNCTION__, local_config.ssid);
|
||||
printf("%s: local_config.channel=%d\n", __FUNCTION__, local_config.channel);
|
||||
printf("%s: local_config.security_type=%d\n", __FUNCTION__, local_config.security_type);
|
||||
printf("%s: local_config.password=%s\n", __FUNCTION__, local_config.password);
|
||||
}
|
||||
if(local_config.boot_mode == 0x77665502) {
|
||||
wifi_setting.mode = RTW_MODE_AP;
|
||||
if(local_config.ssid_len > 32)
|
||||
local_config.ssid_len = 32;
|
||||
memcpy(wifi_setting.ssid, local_config.ssid, local_config.ssid_len);
|
||||
wifi_setting.ssid[local_config.ssid_len] = '\0';
|
||||
wifi_setting.channel = local_config.channel;
|
||||
if(local_config.security_type == 1)
|
||||
wifi_setting.security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||
else
|
||||
wifi_setting.security_type = RTW_SECURITY_OPEN;
|
||||
if(local_config.password_len > 32)
|
||||
local_config.password_len = 32;
|
||||
memcpy(wifi_setting.password, local_config.password, local_config.password_len);
|
||||
wifi_setting.password[local_config.password_len] = '\0';
|
||||
}
|
||||
else {
|
||||
LoadWifiSetting();
|
||||
}
|
||||
|
||||
#else
|
||||
flash_t flash;
|
||||
uint32_t address;
|
||||
address = DATA_SECTOR;
|
||||
|
||||
|
||||
|
|
@ -560,6 +592,7 @@ void LoadWifiConfig()
|
|||
flash_stream_read(&flash, address, sizeof(rtw_wifi_config_t),(uint8_t *)(&local_config));
|
||||
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
||||
|
||||
|
||||
printf("\r\nLoadWifiConfig(): local_config.boot_mode=0x%x\n", local_config.boot_mode);
|
||||
printf("\r\nLoadWifiConfig(): local_config.ssid=%s\n", local_config.ssid);
|
||||
printf("\r\nLoadWifiConfig(): local_config.channel=%d\n", local_config.channel);
|
||||
|
|
@ -587,12 +620,29 @@ void LoadWifiConfig()
|
|||
{
|
||||
LoadWifiSetting();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int StoreApInfo()
|
||||
{
|
||||
|
||||
#ifdef USE_FLASH_EEP
|
||||
rtw_wifi_config_t wifi_config;
|
||||
// clean wifi_config first
|
||||
memset(&wifi_config, 0x00, sizeof(rtw_wifi_config_t));
|
||||
wifi_config.boot_mode = 0x77665502;
|
||||
memcpy(wifi_config.ssid, wifi_setting.ssid, strlen((char*)wifi_setting.ssid));
|
||||
wifi_config.ssid_len = strlen((char*)wifi_setting.ssid);
|
||||
wifi_config.security_type = wifi_setting.security_type;
|
||||
if(wifi_setting.security_type !=0)
|
||||
wifi_config.security_type = 1;
|
||||
else
|
||||
wifi_config.security_type = 0;
|
||||
memcpy(wifi_config.password, wifi_setting.password, strlen((char*)wifi_setting.password));
|
||||
wifi_config.password_len= strlen((char*)wifi_setting.password);
|
||||
wifi_config.channel = wifi_setting.channel;
|
||||
printf("\n\rWritting boot mode 0x77665502 and Wi-Fi setting to flash ...");
|
||||
flash_write_cfg((uint8_t *)(&wifi_config), FEEP_ID_WIFI_AP_CFG, sizeof(wifi_config));
|
||||
#else
|
||||
flash_t flash;
|
||||
|
||||
rtw_wifi_config_t wifi_config;
|
||||
|
|
@ -659,11 +709,14 @@ int StoreApInfo()
|
|||
//flash_stream_read(&flash, address, sizeof(rtw_wifi_config_t),data);
|
||||
//printf("\n\r Base + 0x000FF000 +4 wifi config = %s",data[4]);
|
||||
//printf("\n\r Base + 0x000FF000 +71 wifi channel = %d",data[71]);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EraseApinfo(){
|
||||
int EraseApinfo() {
|
||||
#ifdef USE_FLASH_EEP
|
||||
flash_write_cfg(NULL, FEEP_ID_WIFI_AP_CFG, 0);
|
||||
#else
|
||||
flash_t flash;
|
||||
uint32_t address;
|
||||
|
||||
|
|
@ -671,6 +724,7 @@ int EraseApinfo(){
|
|||
device_mutex_lock(RT_DEV_LOCK_FLASH);
|
||||
flash_erase_sector(&flash, address);
|
||||
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue