blob: a7e4216ea87af8d9fbba2d738286efd9f69b03e7 [file] [log] [blame]
yang.li5664bb32022-01-12 15:50:17 +08001/*
2 * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: MIT
5 */
Xiaohu.Huang90570a32022-03-12 22:55:20 +08006#include <stdio.h>
Xiaohu.Huanged896772021-11-18 13:57:56 +08007#include "FreeRTOS.h"
8#include "task.h"
9#include "hw_business.h"
10#include "sw_business.h"
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080011
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080012int main(void)
13{
Xiaohu.Huanged896772021-11-18 13:57:56 +080014 printf("Starting AOCPU FreeRTOS\n");
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080015
Xiaohu.Huanged896772021-11-18 13:57:56 +080016 hw_business_process();
17 sw_business_process();
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080018
Xiaohu.Huanged896772021-11-18 13:57:56 +080019 printf("Starting task scheduler ...\n");
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080020 vTaskStartScheduler();
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080021 for (;;)
22
23 return 0;
24}
25
26void vApplicationIdleHook( void )
27{
Xiaohu.Huanged896772021-11-18 13:57:56 +080028 //printf("enter idle task\n");
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080029
30 //write_csr(mie, 1); // open mstatue.mie
31 //asm volatile ("wfi"); // enter low power mode
32}
33/*-----------------------------------------------------------*/
34void vApplicationMallocFailedHook( void );
35
36void vApplicationMallocFailedHook( void )
37{
38 /* The malloc failed hook is enabled by setting
39 configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
40
41 Called if a call to pvPortMalloc() fails because there is insufficient
42 free memory available in the FreeRTOS heap. pvPortMalloc() is called
43 internally by FreeRTOS API functions that create tasks, queues, software
44 timers, and semaphores. The size of the FreeRTOS heap is set by the
45 configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
46 //write(1,"malloc failed\n", 14);
47
Xiaohu.Huanged896772021-11-18 13:57:56 +080048 printf("vApplicationMallocFailedHook\n");
Xiaohu.Huang9696cbe2021-10-15 11:33:44 +080049 vPrintFreeListAfterMallocFail();
50 for ( ;; );
51}
52/*-----------------------------------------------------------*/
53
54void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName );
55
56void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName )
57{
58 ( void ) pcTaskName;
59 ( void ) xTask;
60
61 /* Run time stack overflow checking is performed if
62 configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
63 function is called if a stack overflow is detected. pxCurrentTCB can be
64 inspected in the debugger if the task name passed into this function is
65 corrupt. */
66 //write(1, "Stack Overflow\n", 15);
67 for ( ;; );
68}
69/*-----------------------------------------------------------*/