update -Wall -Werror

This commit is contained in:
pvvx 2017-09-07 02:26:00 +03:00
parent 2c29a376ba
commit 7cb9553f73
102 changed files with 3686 additions and 3504 deletions

View file

@ -85,18 +85,14 @@ extern uint32_t SystemCoreClock;
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define configUSE_STACK_TCM_HEAP 1 // RTL871xAx/RTL8195Ax Stack priority used TCM HEAP
#define configUSE_STACK_TCM_HEAP 5 // RTL871xAx/RTL8195Ax Stack priority used TCM HEAP
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ( ( uint32_t ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
#ifdef CONFIG_UVC
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 110 * 1024 ) ) // use HEAP5
#else
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 90 * 1024 ) ) // use HEAP5
#endif
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 90 * 1024 ) ) // use HEAP5
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
@ -112,10 +108,11 @@ extern uint32_t SystemCoreClock;
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configGENERATE_RUN_TIME_STATS 1
#if configGENERATE_RUN_TIME_STATS
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //( ulHighFrequencyTimerTicks = 0UL )
@ -137,8 +134,8 @@ extern uint32_t SystemCoreClock;
#if (__IASMARM__ != 1)
extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
extern void freertos_pre_sleep_processing(uint32_t *expected_idle_time);
extern void freertos_post_sleep_processing(uint32_t *expected_idle_time);
extern int freertos_ready_to_sleep();
/* Enable tickless power saving. */
@ -164,7 +161,7 @@ extern int freertos_ready_to_sleep();
#define traceLOW_POWER_IDLE_END(); } while (0);
/* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
#define configUSE_WAKELOCK_PMU 1
#define configUSE_WAKELOCK_PMU 1
#endif // #if (__IASMARM__ != 1)
@ -210,4 +207,6 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
//#define RTK_MODE_TIMER
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#endif /* FREERTOS_CONFIG_H */

View file

@ -8,8 +8,8 @@
#ifndef _INC_FEEP_CONFIG_H_
#define _INC_FEEP_CONFIG_H_
#define FEEP_ID_WIFI_CFG 0x5730 // id:'0W', type: struct wlan_fast_reconnect
#define FEEP_ID_WIFI_AP_CFG 0x5731 // id:'1W', type: struct rtw_wifi_config_t
//#define FEEP_ID_WIFI_CFG 0x5730 // id:'0W', type: struct wlan_fast_reconnect
//#define FEEP_ID_WIFI_AP_CFG 0x5731 // id:'1W', type: struct rtw_wifi_config_t
#define FEEP_ID_UART_CFG 0x5530 // id:'0U', type: UART_LOG_CONF
#define FEEP_ID_LWIP_CFG 0x4C30 // id:'0L', type: struct atcmd_lwip_conf
#define FEEP_ID_DHCP_CFG 0x4430 // id:'0D', type: struct

View file

@ -167,6 +167,7 @@ a lot of data that needs to be copied, this should be set high. */
* LWIP_AUTOIP==1: Enable AUTOIP module.
*/
#define LWIP_AUTOIP 0 //Realtek modified (0->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
@ -184,6 +185,7 @@ a lot of data that needs to be copied, this should be set high. */
/* Support Multicast */
#define LWIP_IGMP 1
extern __attribute__ ((long_call)) unsigned int Rand(void);
#define LWIP_RAND() Rand()

View file

@ -8,7 +8,9 @@
/* #undef EXPERIMENTAL */
/* Define to disable debugging assertions. */
#ifndef NDEBUG
#define NDEBUG
#endif
/* Define to optimize for accuracy over speed. */
/* #undef OPT_ACCURACY */

View file

@ -74,8 +74,8 @@ struct mad_frame {
mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
#define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
#define MAD_NSBSAMPLES(header) \
((header)->layer == MAD_LAYER_I ? 12 : \
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))

View file

@ -718,7 +718,7 @@ struct mad_stream {
enum mad_error error; /* error code (see above) */
};
enum {
enum _MAD_OPTION{
MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */

View file

@ -83,7 +83,7 @@ struct mad_stream {
enum mad_error error; /* error code (see above) */
};
enum {
enum e_MAD_OPTION_{
MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */

View file

@ -1,5 +1,5 @@
/*
*
* Automatically generated by make menuconfig: don't edit
*/
#define AUTOCONF_INCLUDED
@ -12,10 +12,11 @@
/*
* Target Platform Selection
*/
#define CONFIG_WITHOUT_MONITOR 1
#define CONFIG_USE_TCM_HEAP 1
#define configUSE_STACK_TCM_HEAP 5 // min priority use tcm ?
#define CONFIG_WITHOUT_MONITOR 1
#undef CONFIG_RTL8195A
#define CONFIG_RTL8195A 1
#undef CONFIG_FPGA
@ -134,8 +135,8 @@
#define CONFIG_CRYPTO_NORMAL 1
#undef CONFIG_CRYPTO_TEST
#define CONFIG_CRYPTO_MODULE 1
#define CONFIG_CRYPTO_STARTUP 0
#define CONFIG_MII_EN 1
#define CONFIG_CRYPTO_STARTUP 1
#define CONFIG_MII_EN 0 //1
#define CONFIG_PWM_EN 1
#define CONFIG_PWM_NORMAL 1
#undef CONFIG_PWM_TEST
@ -155,7 +156,7 @@
#undef CONFIG_SPIC_TEST
#define CONFIG_SPIC_MODULE 1
#define CONFIG_ADC_EN 1
//#define CONFIG_DAC_EN 1
#define CONFIG_DAC_EN 1
#define CONFIG_NOR_FLASH 1
#undef CONFIG_SPI_FLASH
#undef CONFIG_NAND_FLASH

View file

@ -8,7 +8,7 @@
#define __PLATFORM_OPTS_H__
/*For MP mode setting*/
#define SUPPORT_MP_MODE 1
#define SUPPORT_MP_MODE 0
/**
* For AT cmd Log service configurations
@ -39,7 +39,7 @@
* For FreeRTOS tickless configurations
*/
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 0 // In sleep mode, 0: close PLL clock, 1: reserve PLL clock
#define FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM 1 // In sleep mode, 1: suspend SDRAM, 0: no act
#define FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM 0 // In sleep mode, 1: suspend SDRAM, 0: no act
/******************************************************************************/
@ -53,6 +53,7 @@
/**
* For Wlan configurations
*/
#define CONFIG_WLAN 1
#if CONFIG_WLAN
#define CONFIG_LWIP_LAYER 1
@ -86,7 +87,7 @@
#endif
/* For Simple Link */
#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
#define CONFIG_INCLUDE_SIMPLE_CONFIG 0
/*For wowlan service settings*/
#define CONFIG_WOWLAN_SERVICE 0
@ -157,4 +158,15 @@
#define USE_FLASH_EEP 1
#define CONFIG_WLAN_CONNECT_CB 1
//#define CONFIG_FATFS_EN 1 // FatFs & SD
#ifdef CONFIG_FATFS_EN
// fatfs version
#define FATFS_R_10C
// fatfs disk interface
#define FATFS_DISK_USB 0
#define FATFS_DISK_SD 1
#undef CONFIG_SDIO_HOST_EN
#define CONFIG_SDIO_HOST_EN 1
#endif
#endif //__PLATFORM_OPTS_H__

View file

@ -1,114 +0,0 @@
/*
*
*
*/
#ifndef _INCLUDE_ESP_COMP_H_
#define _INCLUDE_ESP_COMP_H_
#include "platform_autoconf.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)
#endif
//#define os_timer_arm(a, b, c) rtl_timer_arm_new(a, b, c)
//#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
#define spi_flash_real_size() (1<<(flashobj.SpicInitPara.id[2]-1))
#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_

View file

@ -5,9 +5,9 @@
#ifndef _INC_RTL_LIBC_
#define _INC_RTL_LIBC_
//#undef malloc
#undef malloc
#define malloc(size) pvPortMalloc(size)
//#undef free
#undef free
#define free(pbuf) vPortFree(pbuf)
#define atoi(str) prvAtoi(str)

View file

@ -15,7 +15,7 @@
#define DEF_WIFI_COUNTRY RTW_COUNTRY_RU // Регион использования WiFi...
#define DEF_WIFI_TX_PWR RTW_TX_PWR_PERCENTAGE_25 // RTW_TX_PWR_PERCENTAGE_75 // RTW_TX_PWR_PERCENTAGE_100
#define DEF_WIFI_BGN RTW_NETWORK_BGN // rtw_network_mode_t
#define DEF_WIFI_ADAPTIVITY RTW_ADAPTIVITY_NORMAL // RTW_ADAPTIVITY_DISABLE/RTW_ADAPTIVITY_NORMAL/RTW_ADAPTIVITY_CARRIER_SENSE
#define DEF_WIFI_ADAPTIVITY RTW_ADAPTIVITY_DISABLE // RTW_ADAPTIVITY_NORMAL // RTW_ADAPTIVITY_DISABLE/RTW_ADAPTIVITY_NORMAL/RTW_ADAPTIVITY_CARRIER_SENSE
/* Опции загрузки конфигов по старту */
//#define DEF_LOAD_CFG 0 // старт в назначенном режиме по умолчанию
@ -33,7 +33,7 @@
RTW_SECURITY_WPA_TKIP_PSK - WPA Security
RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher
RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers */
#define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK // WEP security is NOT IMPLEMENTED. It is NOT SECURE!
#define DEF_AP_SECURITY RTW_ENCRYPTION_WPA2_MIXED // WEP security is NOT IMPLEMENTED. It is NOT SECURE!
#define DEF_AP_BEACON 100 // 100...6000 ms
#define DEF_AP_CHANNEL 1 // 1..14
#define DEF_AP_CHANNEL 1 // 1..14
@ -47,7 +47,7 @@
//==== Interface 1 - wlan1 = STA ==========
#define DEF_ST_SSID "HOMEAP" // Имя SSID AP (роутера) для присоединения по умолчанию (первый старт)
#define DEF_ST_PASSWORD "0123456789" // Пароль AP (роутера) для присоединения по умолчанию (первый старт)
#define DEF_ST_SECURITY RTW_SECURITY_WPA_WPA2_MIXED // Тип Security
#define DEF_ST_SECURITY RTW_ENCRYPTION_WPA2_MIXED // Тип Security
#define DEF_ST_BSSID { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } // If bssid set is not ff.ff.ff.ff.ff.ff,
#define DEF_ST_USE_BSSID 0 // station will connect to the router with both ssid[] and bssid[] matched.
#define DEF_ST_CHANNEL 1 // 1..14

View file

@ -32,6 +32,8 @@ speed.
#include "osdep_api.h"
#include "i2s_api.h"
#include "driver/i2s_freertos.h"
#include "rtl_lib.h"
#include "rtl8195a/rtl_libc.h"
#define USE_RTL_I2S_API 0 // speed
@ -103,7 +105,7 @@ int i2sInit(int mask, int bufsize, int word_len) { // word_len = WL_16b or WL_24
DBG_8195A("I2S%d: Not heap buffer %d bytes!\n", i, sizeof(i2s_t) + page_size * I2S_DMA_PAGE_NUM);
return 0;
}
rtl_memset(pi2s_new, 0, sizeof(i2s_t));
memset(pi2s_new, 0, sizeof(i2s_t));
u8 * i2s_tx_buf = (u8 *) pvPortMalloc(page_size * I2S_DMA_PAGE_NUM);
if (i2s_tx_buf == NULL) {
vPortFree(pi2s_new);
@ -135,12 +137,13 @@ int i2sInit(int mask, int bufsize, int word_len) { // word_len = WL_16b or WL_24
else i2s_init(pi2s_obj, I2S1_SCLK_PIN, I2S1_WS_PIN, I2S1_SD_PIN);
i2s_set_param(pi2s_obj, pi2s_obj->channel_num, pi2s_obj->sampling_rate, pi2s_obj->word_length);
i2s_set_dma_buffer(pi2s_obj, i2s_tx_buf, NULL, I2S_DMA_PAGE_NUM, page_size);
i2s_tx_irq_handler(pi2s_obj, i2s_test_tx_complete, (uint32_t)pi2s_obj);
i2s_tx_irq_handler(pi2s_obj, (i2s_irq_handler)i2s_test_tx_complete, (uint32_t)pi2s_obj);
// i2s_rx_irq_handler(pi2s_obj, (i == 0)? (i2s_irq_handler)i2s1_test_rx_complete : (i2s_irq_handler)i2s2_test_rx_complete, i); // TX only!
i2s_enable(pi2s_obj);
DBG_8195A("I2S%d: Alloc DMA buf %d bytes (%d x %d samples %d bits)\n", i, page_size * I2S_DMA_PAGE_NUM, I2S_DMA_PAGE_NUM, bufsize, (word_len == WL_16b)? 32 : 96);
}
}
return 1;
}
//Set the I2S sample rate, in HZ
@ -265,6 +268,7 @@ u32 i2sPushPWMSamples(u32 sample) {
}
}
portEXIT_CRITICAL();
return sample;
}
#endif

View file

@ -19,16 +19,16 @@
* $Id: synth.c,v 1.25 2004/01/23 09:41:33 rob Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
# include "global.h"
#include "global.h"
# include "fixed.h"
# include "frame.h"
# include "synth.h"
# include "string.h"
#include "fixed.h"
#include "frame.h"
#include "synth.h"
#include "string.h"
// #define SAVED_SAMPLE_BUFF_LEN 240000
// unsigned int saved_idx = 0;
@ -582,6 +582,7 @@ void synth_full(struct mad_synth *, struct mad_frame const *,
* NAME: synth->full()
* DESCRIPTION: perform full frequency PCM synthesis
*/
extern void render_sample_block(short int *short_sample_buff, int no_samples);
static
void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
unsigned int nch, unsigned int ns)
@ -608,7 +609,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
for (ch = 0; ch < nch; ++ch)
{
sbsample = &frame->sbsample[ch];
sbsample = (void *)&frame->sbsample[ch];
filter = &synth->filter[ch];
pcm1 = short_sample_buff[ch];
@ -732,7 +733,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
/* Render di un blocco */
if(nch < 2) memcpy(short_sample_buff[1], short_sample_buff[0], sizeof(short_sample_buff[0]));
render_sample_block(short_sample_buff, sizeof(short_sample_buff[0])/sizeof(short int));
render_sample_block((short int *) short_sample_buff, sizeof(short_sample_buff[0])/sizeof(short int));
phase = (phase + 1) % 16;
@ -745,11 +746,12 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
* DESCRIPTION: perform half frequency PCM synthesis
*/
static
void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
void synth_half(struct mad_synth *synth, struct mad_frame *frame,
unsigned int nch, unsigned int ns)
{
unsigned int phase, ch, s, sb, pe, po;
short int *pcm1, *pcm1v, *pcm2v;
// short int *pcm1;
short int *pcm1v, *pcm2v;
mad_fixed_t (*filter)[2][2][16][8];
mad_fixed_t (*sbsample)[36][32];
register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
@ -772,7 +774,8 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
{
sbsample = &frame->sbsample[ch];
filter = &synth->filter[ch];
pcm1 = pcm1v = short_sample_buff;
// pcm1 =
pcm1v = (short int *)short_sample_buff;
dct32((*sbsample)[s], phase >> 1,
(*filter)[0][phase & 1], (*filter)[1][phase & 1]);
@ -894,14 +897,15 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
/* Render di un blocco */
if(nch < 2) memcpy(short_sample_buff[1], short_sample_buff[0], sizeof(short_sample_buff[0]));
render_sample_block(short_sample_buff, sizeof(short_sample_buff[0])/sizeof(short int));
render_sample_block((short int *)short_sample_buff, sizeof(short_sample_buff[0])/sizeof(short int));
pcm1 = pcm1v + 8;
// pcm1 = pcm1v + 8;
phase = (phase + 1) % 16;
} /* for di blocco */
}
extern void set_dac_sample_rate(int rate, int chls);
/*
* NAME: synth->frame()
* DESCRIPTION: perform PCM synthesis of frame subband samples
@ -925,7 +929,7 @@ void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame)
if (frame->options & MAD_OPTION_HALFSAMPLERATE) {
synth->pcm.samplerate /= 2;
synth->pcm.length /= 2;
synth_frame = synth_half;
synth_frame = (void *)synth_half;
}
set_dac_sample_rate(synth->pcm.samplerate, nch);

View file

@ -41,7 +41,7 @@ LOCAL void fATST(int argc, char *argv[]) {
#if 0 //CONFIG_DEBUG_LOG > 1
dump_mem_block_list();
tcm_heap_dump();
#endif;
#endif
printf("\n");
#if (configGENERATE_RUN_TIME_STATS == 1)
char *cBuffer = pvPortMalloc(512);
@ -132,7 +132,7 @@ void dump_bytes(uint32 addr, int size)
while (size) {
if (symbs_line > size) symbs_line = size;
printf("%08X ", addr);
copy_align4_to_align1(buf, addr, symbs_line);
copy_align4_to_align1(buf, (void *)addr, symbs_line);
print_hex_dump(buf, symbs_line, ' ');
int i;
for(i = 0 ; i < symbs_line ; i++) {
@ -151,6 +151,7 @@ void dump_bytes(uint32 addr, int size)
//------------------------------------------------------------------------------
// Dump byte register
//------------------------------------------------------------------------------
extern _LONG_CALL_ u32 Strtoul(IN const u8 *nptr, IN u8 **endptr, IN u32 base);
LOCAL void fATSB(int argc, char *argv[])
{
int size = 16;

View file

@ -3,13 +3,16 @@
* FileName: user_main.c
*
*******************************************************************************/
#include "platform_autoconf.h"
#include "autoconf.h"
#include "rtl8195a/rtl_common.h"
#include "rtl8195a.h"
#include "hal_log_uart.h"
#include "FreeRTOS.h"
#include "task.h"
//#include "diag.h"
#include "diag.h"
#include "osdep_service.h"
#include "device_lock.h"
#include "semphr.h"
@ -33,6 +36,7 @@
#include "user/playerconfig.h"
#include "user/atcmd_user.h"
#include "main.h"
#include "flash_eep.h"
#include "wifi_api.h"
#include "rtl8195a/rtl_libc.h"
@ -88,7 +92,7 @@ LOCAL int mp3_cfg_read(void)
// Called by the NXP modifications of libmad. It passes us (for the mono synth)
// 32 16-bit samples.
void render_sample_block(short *short_sample_buff, int no_samples) {
void render_sample_block(short int *short_sample_buff, int no_samples) {
int i;
for (i = 0; i < no_samples; i++) {
int x = oversampling;
@ -122,6 +126,8 @@ void set_dac_sample_rate(int rate, int chls) {
oversampling = i2sSetRate(-1, rate);
}
extern int RamFifoLen(void);
static enum mad_flow input(struct mad_stream *stream) {
int n, i;
int rem; //, fifoLen;
@ -203,9 +209,9 @@ LOCAL void tskmad(void *pvParameters) {
sizeof(struct mad_stream) + sizeof(struct mad_frame) + sizeof(struct mad_synth) + READBUFSZ,
mad_bufs);
#endif
struct mad_stream *stream = mad_bufs;
struct mad_frame *frame = &mad_bufs[sizeof(struct mad_stream)];
struct mad_synth *synth = &mad_bufs[sizeof(struct mad_stream)
struct mad_stream *stream = (struct mad_stream *)mad_bufs;
struct mad_frame *frame = (struct mad_frame *) &mad_bufs[sizeof(struct mad_stream)];
struct mad_synth *synth = (struct mad_synth *) &mad_bufs[sizeof(struct mad_stream)
+ sizeof(struct mad_frame)];
readBuf = &mad_bufs[sizeof(struct mad_stream) + sizeof(struct mad_frame)
+ sizeof(struct mad_synth)];
@ -374,6 +380,8 @@ LOCAL int http_head_read(unsigned char *buf, int len, int ff) {
return ret;
}
extern void RamFifoClose(void);
//Reader task. This will try to read data from a TCP socket into the SPI fifo buffer.
LOCAL void tskreader(void *pvParameters) {
char wbuf[SOCK_READ_BUF];
@ -503,6 +511,8 @@ void connect_start(void) {
#endif
}
extern int tcm_heap_freeSpace(void);
extern void console_init(void);
/* RAM/TCM/Heaps info */
void ShowMemInfo(void)
{
@ -525,13 +535,15 @@ LOCAL void user_init_thrd(void) {
vTaskDelete(NULL);
}
extern void WDGStart(void);
extern int rtl_cryptoEngine_init(void);
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
int main(void)
{
#if DEBUG_MAIN_LEVEL > 3
ConfigDebugErr = -1;
@ -560,7 +572,7 @@ void main(void)
#endif
/* wlan & user_start intialization */
xTaskCreate(user_init_thrd, "user_init", 1024, NULL, tskIDLE_PRIORITY + 0 + PRIORITIE_OFFSET, NULL);
xTaskCreate((TaskFunction_t) user_init_thrd, "user_init", 1024, NULL, tskIDLE_PRIORITY + 0 + PRIORITIE_OFFSET, NULL);
/*Enable Schedule, Start Kernel*/
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
@ -600,7 +612,7 @@ LOCAL void fATWS(int argc, char *argv[]){
}
else if(argv[1][0] == 'S') { // strcmp(argv[1], "save") == 0
printf("%s: %s,%d\n", argv[0], mp3_serv.url, mp3_serv.port);
if(flash_write_cfg(&mp3_serv, ID_FEEP_MP3, strlen(mp3_serv.port) + strlen(mp3_serv.url)))
if(flash_write_cfg(&mp3_serv, ID_FEEP_MP3, sizeof(mp3_serv.port) + strlen((const char *)mp3_serv.url)))
printf("ATWS: saved\n", mp3_serv.url, mp3_serv.port);
return;
}

View file

@ -7,16 +7,22 @@
#include <autoconf.h>
#include "FreeRTOS.h"
#include "freertos_pmu.h"
#include "diag.h"
#include "wifi_api.h"
#include "wifi_conf.h"
#include "rtl8195a/rtl_libc.h"
#include "hal_platform.h"
#include "freertos_pmu.h"
#include "section_config.h"
#include "hal_diag.h"
#include "lwip/netif.h"
#include "wifi_api.h"
#include "wifi_conf.h"
#include "rtl8195a/rtl_libc.h"
#if CONFIG_WLAN_CONNECT_CB
extern void connect_close(void);
extern void connect_start(void);
#endif
extern struct netif xnetif[NET_IF_NUM];
@ -71,6 +77,7 @@ LOCAL void fATPN(int argc, char *argv[]){
else wifi_st_cfg.reconnect_pause = 5;
show_wifi_st_cfg();
#if CONFIG_WLAN_CONNECT_CB
extern void connect_close(void);
connect_close();
#endif
wifi_run(wifi_run_mode | RTW_MODE_STA);
@ -143,11 +150,13 @@ LOCAL void fATWR(int argc, char *argv[]){
#if CONFIG_WLAN_CONNECT_CB
// Close connections
LOCAL void fATOF(int argc, char *argv[]){
(void)argc; (void)argv;
connect_close();
}
// Open connections
LOCAL void fATON(int argc, char *argv[]){
(void)argc; (void)argv;
connect_start();
}
#endif
@ -168,6 +177,8 @@ LOCAL void fATWI(int argc, char *argv[]) {
wifi_cfg.mode = atoi(argv[2]);
}
}
#else
(void)argc; (void)argv;
#endif
rtw_wifi_setting_t Setting;
if((wifi_run_mode & RTW_MODE_AP)
@ -191,12 +202,19 @@ LOCAL void fATWI(int argc, char *argv[]) {
printf("\nWIFI ST config:\n");
printf(&str_rom_57ch3Dch0A[25]); // "================================\n"
show_wifi_st_cfg();
printf("\nWIFI AP clients:\n");
printf(&str_rom_57ch3Dch0A[25]); // "================================\n"
#if SDK_VER_NUM >= 0x4000
show_wifi_ap_clients();
#endif
printf("\n");
}
extern uint8_t rtw_power_percentage_idx;
extern int rltk_set_tx_power_percentage(rtw_tx_pwr_percentage_t power_percentage_idx);
LOCAL void fATWT(int argc, char *argv[]) {
void fATWT(int argc, char *argv[]) {
(void) argc; (void) argv;
if(argc > 1) {
int txpwr = atoi(argv[1]);
debug_printf("set tx power (%d)...\n", txpwr);
@ -209,7 +227,10 @@ LOCAL void fATWT(int argc, char *argv[]) {
//-- Test tsf (64-bits counts, 1 us step) ---
#include "hal_com_reg.h"
//#include "hal_com_reg.h"
#define WIFI_REG_BASE 0x40080000
#define REG_TSFTR 0x0560
#define REG_TSFTR1 0x0568 // HW Port 1 TSF Register
#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
@ -219,13 +240,15 @@ LOCAL uint64_t get_tsf(void)
return *((uint64_t *)(WIFI_REG_BASE + REG_TSFTR));
}
LOCAL void fATSF(int argc, char *argv[])
void fATSF(int argc, char *argv[])
{
(void) argc; (void) argv;
uint64_t tsf = get_tsf();
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
}
LOCAL void fATWP(int argc, char *argv[]) {
void fATWP(int argc, char *argv[]) {
(void) argc; (void) argv;
int x = 0;
if(argc > 1) {
x = atoi(argv[1]);
@ -244,9 +267,8 @@ LOCAL void fATWP(int argc, char *argv[]) {
printf("DTIM: %d\n", _wext_get_lps_dtim(0));
}
}
/* -------- WiFi Scan ------------------------------- */
LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
LOCAL rtw_result_t scan_result_handler(internal_scan_handler_t* ap_scan_result)
{
if (ap_scan_result) {
if(ap_scan_result->scan_cnt) {
@ -268,15 +290,16 @@ LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
record->SSID.val[record->SSID.len] = '\0';
printf("%s\n", record->SSID.val);
}
}
} else {
printf("Scan networks: None!\n");
}
return RTW_SUCCESS;
}
/* -------- WiFi Scan ------------------------------- */
LOCAL void fATSN(int argc, char *argv[])
void fATSN(int argc, char *argv[])
{
(void) argc; (void) argv;
api_wifi_scan(scan_result_handler);
}
@ -315,7 +338,7 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"P2P_DISCCONNECT", 0, cmd_p2p_disconnect, ": p2p disconnect"},
{"P2P_CONNECT", 0, cmd_p2p_connect, ": p2p connect"},
#endif
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
{"ATWR", 0, fATWR, "=[mode]: WIFI Mode: 0 - off, 1 - ST, 2 - AP, 3 - ST+AP"},
#if CONFIG_WLAN_CONNECT_CB
{"ATON", 0, fATON, ": Open connections"},
{"ATOFF", 0, fATOF, ": Close connections"},
@ -323,7 +346,7 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"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"},
{"ATSF", 0, fATSF, ": Get TSF value"},
#endif
// {"ATWP", 0, fATWP, "=[dtim]: 0 - WiFi ipc/lpc off, 1..10 - on + dtim"},
{"ATSN", 0, fATSN, ": Scan networks"}