yang.li | 5664bb3 | 2022-01-12 15:50:17 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | */ |
Xiaohu.Huang | 90570a3 | 2022-03-12 22:55:20 +0800 | [diff] [blame^] | 6 | #include <stdio.h> |
Xiaohu.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 7 | #include "FreeRTOS.h" |
| 8 | #include "task.h" |
| 9 | #include "hw_business.h" |
| 10 | #include "sw_business.h" |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 11 | |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 12 | int main(void) |
| 13 | { |
Xiaohu.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 14 | printf("Starting AOCPU FreeRTOS\n"); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 15 | |
Xiaohu.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 16 | hw_business_process(); |
| 17 | sw_business_process(); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 18 | |
Xiaohu.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 19 | printf("Starting task scheduler ...\n"); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 20 | vTaskStartScheduler(); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 21 | for (;;) |
| 22 | |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | void vApplicationIdleHook( void ) |
| 27 | { |
Xiaohu.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 28 | //printf("enter idle task\n"); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 29 | |
| 30 | //write_csr(mie, 1); // open mstatue.mie |
| 31 | //asm volatile ("wfi"); // enter low power mode |
| 32 | } |
| 33 | /*-----------------------------------------------------------*/ |
| 34 | void vApplicationMallocFailedHook( void ); |
| 35 | |
| 36 | void 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.Huang | ed89677 | 2021-11-18 13:57:56 +0800 | [diff] [blame] | 48 | printf("vApplicationMallocFailedHook\n"); |
Xiaohu.Huang | 9696cbe | 2021-10-15 11:33:44 +0800 | [diff] [blame] | 49 | vPrintFreeListAfterMallocFail(); |
| 50 | for ( ;; ); |
| 51 | } |
| 52 | /*-----------------------------------------------------------*/ |
| 53 | |
| 54 | void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ); |
| 55 | |
| 56 | void 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 | /*-----------------------------------------------------------*/ |