mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
add boot (startup RAM only!)
This commit is contained in:
parent
6278f73e47
commit
bf4fb5d560
30 changed files with 905 additions and 1509 deletions
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
//======================================================
|
||||
#define LOGUART_STACK_SIZE 400 // USE_MIN_STACK_SIZE modify from 512 to 128
|
||||
#define CONSOLE_PRIORITY 1
|
||||
#define CONSOLE_PRIORITY 0
|
||||
//======================================================
|
||||
#include "rtl8195a.h"
|
||||
#include "rtl_bios_data.h"
|
||||
|
|
|
|||
|
|
@ -29,25 +29,28 @@ speed.
|
|||
#include "queue.h"
|
||||
#include "user/playerconfig.h"
|
||||
|
||||
#include "osdep_api.h"
|
||||
#include "i2s_api.h"
|
||||
#include "driver/i2s_freertos.h"
|
||||
|
||||
#define USE_RTL_I2S_API 0 // speed
|
||||
|
||||
PI2S_OBJS pi2s[MAX_I2S_OBJS]; // I2S0, I2S1
|
||||
xSemaphoreHandle I2sTxSema;
|
||||
|
||||
// i2s interrupt callback
|
||||
static void i2s_test_tx_complete(void *data, char *pbuf)
|
||||
{
|
||||
#if I2S_DEBUG_LEVEL > 1
|
||||
i2s_t *i2s_obj = (i2s_t *)data;
|
||||
int idx = i2s_obj->InitDat.I2SIdx;
|
||||
#if I2S_DEBUG_LEVEL > 1
|
||||
int reg = HAL_I2S_READ32(idx, REG_I2S_TX_PAGE0_OWN);
|
||||
reg |= HAL_I2S_READ32(idx, REG_I2S_TX_PAGE1_OWN);
|
||||
reg |= HAL_I2S_READ32(idx, REG_I2S_TX_PAGE2_OWN);
|
||||
reg |= HAL_I2S_READ32(idx, REG_I2S_TX_PAGE3_OWN);
|
||||
if(!(reg & BIT_PAGE_I2S_OWN_BIT)) pi2s[idx]->underrunCnt++;
|
||||
#endif
|
||||
if(!idx) xSemaphoreGive(I2sTxSema);
|
||||
}
|
||||
|
||||
void i2sClose(int mask) {
|
||||
|
|
@ -68,7 +71,10 @@ void i2sClose(int mask) {
|
|||
}
|
||||
vPortFree(pi2s[i]);
|
||||
pi2s[i] = NULL;
|
||||
if(i==0) HalPinCtrlRtl8195A(JTAG, 0, 1);
|
||||
if(i==0) {
|
||||
vSemaphoreDelete(I2sTxSema);
|
||||
HalPinCtrlRtl8195A(JTAG, 0, 1);
|
||||
}
|
||||
DBG_8195A("I2S%d: Closed.\n", i);
|
||||
}
|
||||
}
|
||||
|
|
@ -121,6 +127,8 @@ int i2sInit(int mask, int bufsize, int word_len) { // word_len = WL_16b or WL_24
|
|||
if(i == 0) {
|
||||
HalPinCtrlRtl8195A(JTAG, 0, 0);
|
||||
i2s_init(pi2s_obj, I2S0_SCLK_PIN, I2S0_WS_PIN, I2S0_SD_PIN);
|
||||
// Create a Semaphone
|
||||
RtlInitSema(&I2sTxSema, 1);
|
||||
}
|
||||
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);
|
||||
|
|
@ -185,11 +193,12 @@ u32 i2sPushPWMSamples(u32 sample) {
|
|||
while(pi2s_cur->currDMABuff == NULL){
|
||||
#if USE_RTL_I2S_API
|
||||
pi2s_cur->currDMABuff = i2s_get_tx_page(&pi2s_cur->i2s_obj);
|
||||
if(pi2s_cur->currDMABuff == NULL) vTaskDelay(I2S_DMA_PAGE_WAIT_MS_MIN);
|
||||
if(pi2s_cur->currDMABuff == NULL) RtlDownSema(&I2sTxSema);
|
||||
#else
|
||||
u8 page_idx = HalI2SGetTxPage((VOID*)I2SAdapter->pInitDat);
|
||||
if(page_idx < I2S_DMA_PAGE_NUM) pi2s_cur->currDMABuff = ((u32 *)I2SAdapter->TxPageList[page_idx]);
|
||||
else vTaskDelay(I2S_DMA_PAGE_WAIT_MS_MIN);
|
||||
else xSemaphoreTake(I2sTxSema, portMAX_DELAY);
|
||||
// RtlDownSema(&I2sTxSema);
|
||||
#endif
|
||||
pi2s_cur->currDMABuffPos = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void fATWS(int argc, char *argv[]){
|
|||
void fATST(void){
|
||||
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
|
||||
#if 0 //CONFIG_DEBUG_LOG > 1
|
||||
dump_mem_block_list();
|
||||
tcm_heap_dump();
|
||||
#endif;
|
||||
|
|
@ -139,6 +139,19 @@ void fATST(void){
|
|||
}
|
||||
vPortFree(cBuffer);
|
||||
#endif
|
||||
#if defined(configUSE_TRACE_FACILITY) && (configUSE_TRACE_FACILITY == 1) && (configUSE_STATS_FORMATTING_FUNCTIONS == 1)
|
||||
{
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
void fATWC(int argc, char *argv[]){
|
||||
|
|
|
|||
|
|
@ -36,11 +36,9 @@
|
|||
|
||||
#define DEBUG_MAIN_LEVEL 1
|
||||
|
||||
//Priorities of the reader and the decoder thread. Higher = higher prio. (ESP8266!)
|
||||
//#define PRIO_READER (configMAX_PRIORITIES - 2) // (tskIDLE_PRIORITY + PRIORITIE_OFFSET)
|
||||
//#define PRIO_MAD (PRIO_READER - 1) // PRIO_READER + n; (TCPIP_THREAD_PRIO = (configMAX_PRIORITIES - 2))
|
||||
#define PRIO_MAD (tskIDLE_PRIORITY + 1 + PRIORITIE_OFFSET)
|
||||
#define PRIO_READER (PRIO_MAD + 7) // max 11 ?
|
||||
//Priorities of the reader and the decoder thread. Higher = higher prio.
|
||||
#define PRIO_MAD (tskIDLE_PRIORITY + 3 + PRIORITIE_OFFSET)
|
||||
#define PRIO_READER (PRIO_MAD + 1)
|
||||
|
||||
|
||||
#define mMIN(a, b) ((a < b)? a : b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue