W800_Smart_Watch/src/W800_SDK_v1.00.10/app/main.c

58 lines
1.6 KiB
C

/*****************************************************************************
*
* File Name : main.c
*
* Description: main
*
* Copyright (c) 2014 Winner Micro Electronic Design Co., Ltd.
* All rights reserved.
*
* Author : dave
*
* Date : 2014-6-14
*****************************************************************************/
#include "wm_include.h"
#include "FreeRTOS.h"
#include "task.h"
#include "app_common.h"
#include "lvgl.h"
#include "gfx_task.h"
#include "wm_gpio_afsel.h"
void user_task_main(void *param)
{
/* Creating the gfx task */
if(tls_os_task_create(&gfx_task_handle, "gfx_task", &(gfx_task), NULL, gfx_task_stack, GFX_STACK_SIZE_IN_BYTES, GFX_STACK_PRIORITY, 0 /*not used anyway*/) != TLS_OS_SUCCESS)
{
APP_LOG_ERROR("Failed to create GFX_TASK !");
}
uint32_t total_mem_size = (unsigned int)&__heap_end - (unsigned int)&__heap_start;
TickType_t time_ref = tls_os_get_time();
for(;;)
{
tls_sys_clk clk;
tls_sys_clk_get(&clk);
char *buf = tls_mem_alloc(800);
if(buf)
{
UBaseType_t writtenSize = vTaskList((char *)buf, 800);
APP_LOG_INFO("Available RAM (bytes)/Total RAM (bytes) : %u/%u"NEW_LINE
"FreeRTOS heap : %u/%u byte(s)"NEW_LINE
"Reset reason : %d"NEW_LINE
"Clk : apb(%u), cpu(%u), wlan(%u)"NEW_LINE
"Tasks (%lu) :"NEW_LINE,
tls_mem_get_avail_heapsize(), total_mem_size,
xPortGetFreeHeapSize(), configTOTAL_HEAP_SIZE,
tls_sys_get_reboot_reason(),
clk.apbclk, clk.cpuclk, clk.wlanclk,
writtenSize);
printf("\n%s", buf);
tls_mem_free(buf);
}
tls_os_time_delay_until(&time_ref, pdMS_TO_TICKS(5000));
}
}