mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
update -Wall -Werror
This commit is contained in:
parent
2c29a376ba
commit
7cb9553f73
102 changed files with 3686 additions and 3504 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue