FreeRTOSConfig.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (c) 2022 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef FREERTOS_CONFIG_H
  8. #define FREERTOS_CONFIG_H
  9. /*
  10. * Application specific definitions.
  11. *
  12. * These definitions should be adjusted for your particular hardware and
  13. * application requirements.
  14. *
  15. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
  16. * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
  17. *
  18. * See http://www.freertos.org/a00110.html.
  19. */
  20. #include "board.h"
  21. #if (portasmHAS_MTIME == 0)
  22. #define configMTIME_BASE_ADDRESS (0)
  23. #define configMTIMECMP_BASE_ADDRESS (0)
  24. #else
  25. #define configMTIME_BASE_ADDRESS (HPM_MCHTMR_BASE)
  26. #define configMTIMECMP_BASE_ADDRESS (HPM_MCHTMR_BASE + 8UL)
  27. #endif
  28. /* When USE_SYSCALL_INTERRUPT_PRIORITY is set, interrupts whose priority is higher than configMAX_SYSCALL_INTERRUPT_PRIORITY
  29. will not be delayed by anything FreeRTOS do. */
  30. #if defined (USE_SYSCALL_INTERRUPT_PRIORITY) && USE_SYSCALL_INTERRUPT_PRIORITY
  31. #ifndef configMAX_SYSCALL_INTERRUPT_PRIORITY
  32. #define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
  33. #endif
  34. #endif
  35. #define configUSE_PREEMPTION 1
  36. #define configCPU_CLOCK_HZ ((uint32_t) 24000000)
  37. #define configTICK_RATE_HZ ((TickType_t) 1000)
  38. #define configMAX_PRIORITIES (32)
  39. #define configMINIMAL_STACK_SIZE (256)
  40. #define configMAX_TASK_NAME_LEN 16
  41. #define configUSE_16_BIT_TICKS 0
  42. #define configIDLE_SHOULD_YIELD 0
  43. #define configUSE_APPLICATION_TASK_TAG 0
  44. #define configGENERATE_RUN_TIME_STATS 0
  45. #define configUSE_COUNTING_SEMAPHORES 1
  46. #define configUSE_MUTEXES 1
  47. /* Memory allocation definitions. */
  48. #define configSUPPORT_STATIC_ALLOCATION 1
  49. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  50. #ifndef configTOTAL_HEAP_SIZE
  51. #define configTOTAL_HEAP_SIZE ((size_t) (64 * 1024))
  52. #endif
  53. /* Hook function definitions. */
  54. #define configUSE_IDLE_HOOK 0
  55. #define configUSE_TICK_HOOK 0
  56. #define configCHECK_FOR_STACK_OVERFLOW 0
  57. #define configUSE_RECURSIVE_MUTEXES 1
  58. #define configUSE_MALLOC_FAILED_HOOK 0
  59. #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
  60. /* Run time and task stats gathering definitions. */
  61. #define configGENERATE_RUN_TIME_STATS 0
  62. #define configUSE_TRACE_FACILITY 1
  63. #define configUSE_STATS_FORMATTING_FUNCTIONS 0
  64. /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
  65. #define INCLUDE_vTaskPrioritySet 1
  66. #define INCLUDE_uxTaskPriorityGet 1
  67. #define INCLUDE_vTaskDelete 1
  68. #define INCLUDE_vTaskCleanUpResources 1
  69. #define INCLUDE_vTaskSuspend 1
  70. #define INCLUDE_vTaskDelayUntil 1
  71. #define INCLUDE_vTaskDelay 1
  72. #define INCLUDE_xTaskGetCurrentTaskHandle 1
  73. #define INCLUDE_xTimerPendFunctionCall 1
  74. #define INCLUDE_eTaskGetState 1
  75. #define INCLUDE_xTaskAbortDelay 1
  76. #define INCLUDE_xTaskGetHandle 1
  77. #define INCLUDE_xSemaphoreGetMutexHolder 1
  78. /* Co-routine definitions. */
  79. #define configUSE_CO_ROUTINES 0
  80. #define configMAX_CO_ROUTINE_PRIORITIES 2
  81. /* Software timer definitions. */
  82. #define configUSE_TIMERS 1
  83. #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
  84. #define configTIMER_QUEUE_LENGTH 4
  85. #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE)
  86. /* Task priorities.*/
  87. #ifndef uartPRIMARY_PRIORITY
  88. #define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
  89. #endif
  90. /* Normal assert() semantics without relying on the provision of an assert.h header file. */
  91. #define configASSERT(x) if ((x) == 0) { taskDISABLE_INTERRUPTS(); __asm volatile("ebreak"); for (;;); }
  92. /*
  93. * The size of the global output buffer that is available for use when there
  94. * are multiple command interpreters running at once (for example, one on a UART
  95. * and one on TCP/IP). This is done to prevent an output buffer being defined by
  96. * each implementation - which would waste RAM. In this case, there is only one
  97. * command interpreter running.
  98. */
  99. /*
  100. * The buffer into which output generated by FreeRTOS+CLI is placed. This must
  101. * be at least big enough to contain the output of the task-stats command, as the
  102. * example implementation does not include buffer overlow checking.
  103. */
  104. #define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096
  105. #define configINCLUDE_QUERY_HEAP_COMMAND 1
  106. /* This file is included from assembler files - make sure C code is not included in assembler files. */
  107. #ifndef __ASSEMBLER__
  108. void vAssertCalled(const char *pcFile, unsigned long ulLine);
  109. void vConfigureTickInterrupt(void);
  110. void vClearTickInterrupt(void);
  111. void vPreSleepProcessing(unsigned long uxExpectedIdleTime);
  112. void vPostSleepProcessing(unsigned long uxExpectedIdleTime);
  113. #endif /* __ASSEMBLER__ */
  114. /****** Hardware/compiler specific settings. *******/
  115. /*
  116. * The application must provide a function that configures a peripheral to
  117. * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()
  118. * in FreeRTOSConfig.h to call the function.
  119. */
  120. #define configSETUP_TICK_INTERRUPT() vConfigureTickInterrupt()
  121. #define configCLEAR_TICK_INTERRUPT() vClearTickInterrupt()
  122. /*
  123. * The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros
  124. * allow the application writer to add additional code before and after the MCU is
  125. * placed into the low power state respectively. The empty implementations
  126. * provided in this demo can be extended to save even more power.
  127. */
  128. #define configPRE_SLEEP_PROCESSING(uxExpectedIdleTime) vPreSleepProcessing(uxExpectedIdleTime);
  129. #define configPOST_SLEEP_PROCESSING(uxExpectedIdleTime) vPostSleepProcessing(uxExpectedIdleTime);
  130. /* Compiler specifics. */
  131. #define fabs(x) __builtin_fabs(x)
  132. /* Enable Hardware Stack Protection and Recording mechanism. */
  133. #define configHSP_ENABLE 0
  134. /* Record the highest address of stack. */
  135. #if (configHSP_ENABLE == 1 && configRECORD_STACK_HIGH_ADDRESS != 1)
  136. #define configRECORD_STACK_HIGH_ADDRESS 1
  137. #endif
  138. #endif /* FREERTOS_CONFIG_H */