94 lines
2.4 KiB
C
94 lines
2.4 KiB
C
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "am_mcu_apollo.h"
|
|
|
|
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
#include "queue.h"
|
|
#include "timers.h"
|
|
|
|
#include "wsf_types.h"
|
|
#include "wsf_os.h"
|
|
#include "wsf_trace.h"
|
|
#include "sys_typedef.h"
|
|
#include "task.h"
|
|
#include "task_display.h"
|
|
#include "display_api.h"
|
|
|
|
#define ENABLE_STATIC_PRINT false
|
|
extern uint32_t am_util_stdio_printf(const char *pcFmt, ...);
|
|
#define static_print_remind(...) am_util_stdio_printf(__VA_ARGS__)
|
|
#if ENABLE_STATIC_PRINT
|
|
#define static_print_info(...) am_util_stdio_printf(__VA_ARGS__)
|
|
#else
|
|
#define static_print_info(...)
|
|
#endif
|
|
|
|
static TaskHandle_t display_task_handle = NULL;
|
|
static QueueHandle_t display_task_msgqueue_handle = NULL;
|
|
|
|
void task_display_notify(uint32_t MsgId, uint32_t Data,void* buf,uint32_t buf_len)
|
|
{
|
|
BaseType_t HigherPriorityTaskWoken = pdFALSE;
|
|
TaskMessage_t Msg = {0};
|
|
|
|
if ( !(display_task_msgqueue_handle && display_task_handle) )
|
|
{
|
|
return;
|
|
}
|
|
|
|
Msg.uMessageID = MsgId;
|
|
Msg.uData = Data;
|
|
Msg.buffer = buf;
|
|
Msg.buf_len = buf_len;
|
|
if ( __get_IPSR() != 0 )
|
|
{
|
|
xQueueSendToBackFromISR(display_task_msgqueue_handle, &Msg, &HigherPriorityTaskWoken);
|
|
portYIELD_FROM_ISR(HigherPriorityTaskWoken);
|
|
}
|
|
else
|
|
{
|
|
xQueueSendToBack(display_task_msgqueue_handle, &Msg, pdMS_TO_TICKS(1000));
|
|
}
|
|
|
|
}
|
|
|
|
void task_display_entry(void *pvParameters)
|
|
{
|
|
TaskMessage_t Msg = {0};
|
|
static_print_remind("task_display_entry\r\n");
|
|
while (1)
|
|
{
|
|
if (xQueueReceive( display_task_msgqueue_handle, &Msg, portMAX_DELAY ) != pdPASS)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
switch (Msg.uMessageID)
|
|
{
|
|
case DISPLAY_MSG_DRAW_BUFF:
|
|
if(Msg.uData)
|
|
{
|
|
display_api_draw_dma((uint32_t*)Msg.buffer);
|
|
}
|
|
else
|
|
{
|
|
display_api_draw_dma((uint32_t*)disp_fream_buf);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void task_display_init(uint16_t stack_depth, uint16_t priority)
|
|
{
|
|
display_task_msgqueue_handle = xQueueCreate(16, sizeof(TaskMessage_t));
|
|
|
|
xTaskCreate(task_display_entry, "task_display_entry", stack_depth, 0, priority, &display_task_handle);
|
|
}
|