add boot (startup RAM only!)

This commit is contained in:
pvvx 2017-03-04 13:24:48 +03:00
parent 6278f73e47
commit bf4fb5d560
30 changed files with 905 additions and 1509 deletions

View file

@ -26,7 +26,27 @@
#include <platform/platform_stdlib.h>
#include "platform_opts.h"
#define WIFI_LOGO_CERTIFICATION_CONFIG 0 //for ping 10k test buffer setting
/**
* LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: randomize the local port for the first
* local TCP/UDP pcb (default==0). This can prevent creating predictable port
* numbers after booting a device.
*/
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
#define WIFI_LOGO_CERTIFICATION_CONFIG 1 //for ping 10k test buffer setting
/**
* MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
* instead of the lwip internal allocator. Can save code size if you
* already use it.
*/
#define MEM_LIBC_MALLOC 1
/**
* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
* speed and usage from interrupts!
*/
#define MEMP_MEM_MALLOC 1
/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
@ -124,34 +144,33 @@ a lot of data that needs to be copied, this should be set high. */
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
/* TCP receive window. */
#define TCP_WND (2*TCP_MSS)
#define TCP_WND (4*TCP_MSS) // (2*TCP_MSS)
/* ---------- ICMP options ---------- */
#define LWIP_ICMP 1
#define LWIP_ICMP 1
/* ---------- ARP options ----------- */
#define LWIP_ARP 1
#define LWIP_ARP 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
turning this on does currently not work. */
#define LWIP_DHCP 1
#define LWIP_DHCP 1
/* ---------- UDP options ---------- */
#define LWIP_UDP 1
#define UDP_TTL 255
#define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- DNS options ---------- */
#define LWIP_DNS 1
#define LWIP_DNS 1
/* ---------- UPNP options --------- */
#define LWIP_UPNP 0
/* Support Multicast */
#define LWIP_IGMP 1
#define LWIP_RAND() rand()
#define LWIP_IGMP 1
#define LWIP_RAND() Rand()
/* Support TCP Keepalive */
#define LWIP_TCP_KEEPALIVE 1
@ -209,8 +228,8 @@ a lot of data that needs to be copied, this should be set high. */
#endif
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
/*
@ -275,7 +294,7 @@ The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums
/**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/
#define LWIP_SOCKET 1
#define LWIP_SOCKET 1
/*
-----------------------------------
@ -285,20 +304,59 @@ The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums
#define LWIP_DEBUG 0
/*
---------------------------------
---------- OS options ----------
---------------------------------
*/
/**
* TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#define TCPIP_THREAD_STACKSIZE 1000
/**
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
* The queue size value itself is platform-dependent, but is passed to
* sys_mbox_new() when tcpip_init is called.
*/
#define TCPIP_MBOX_SIZE 6
/**
* DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
* NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
* to sys_mbox_new() when the recvmbox is created.
*/
#define DEFAULT_UDP_RECVMBOX_SIZE 6
/**
* DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
* NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
* to sys_mbox_new() when the recvmbox is created.
*/
#define DEFAULT_TCP_RECVMBOX_SIZE 6
/**
* DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
* NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
* to sys_mbox_new() when the recvmbox is created.
*/
#define DEFAULT_RAW_RECVMBOX_SIZE 6
/**
* DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
* The queue size value itself is platform-dependent, but is passed to
* sys_mbox_new() when the acceptmbox is created.
*/
#define DEFAULT_ACCEPTMBOX_SIZE 6
/**
* DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#define DEFAULT_THREAD_STACKSIZE 500
/**
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided

View file

@ -5,6 +5,10 @@
#define RTL8710AF
//#define RTL8711AM
/* Image1 on project */
#define PRESENT_IMAGE1
/* Image2 on project */
#define PRESENT_IMAGE2
/*
* Target Platform Selection
*/
@ -24,7 +28,7 @@
#define RTL8195A 1
/* 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000? Hz,
6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000? Hz */
#define CONFIG_CPU_CLK 0
#define CONFIG_CPU_CLK 1
//166.6MHZ - RUN/IDLE/SLP ~63/21/6.4 mA
//83.3MHZ - RUN/IDLE/SLP ~55/15/6.4 mA
//41.6MHZ - RUN/IDLE ~51/11 mA

View file

@ -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"

View file

@ -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;
}

View file

@ -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[]){

View file

@ -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)