diff options
author | Don Dominic | 2021-04-08 05:24:25 -0500 |
---|---|---|
committer | Ankur | 2021-04-08 07:09:34 -0500 |
commit | 14ea6064018caa345a07cc05b67d262d93477980 (patch) | |
tree | c975bbd2bf20125a1316755e3d5332d7221dcfae | |
parent | 685a0718c956630158910a639a9299f51faf1e50 (diff) | |
download | pdk-14ea6064018caa345a07cc05b67d262d93477980.tar.gz pdk-14ea6064018caa345a07cc05b67d262d93477980.tar.xz pdk-14ea6064018caa345a07cc05b67d262d93477980.zip |
[PDK-9493] UART: Support FreeRTOS on R5 cores
- Enable UART FreeRTOS Unit Testapp for J721E/J7200/AM65xx all R5 cores
- Remove SYSBIOS Headers in test source files
- Replace SYBIOS calls with equivalent OSAL API's
- Tested an all mcu cores in j721e/j7200/am65xx
- Also verified tirtos UT on j721e mcu1_0 and mpu1_0
- UART DMA Migration will be followed after checkout of UDMA with FreeRTOS.
Signed-off-by: Don Dominic <a0486429@ti.com>
-rw-r--r-- | packages/ti/drv/uart/test/src/main_uart_test.c | 58 | ||||
-rw-r--r-- | packages/ti/drv/uart/uart_component.mk | 11 |
2 files changed, 30 insertions, 39 deletions
diff --git a/packages/ti/drv/uart/test/src/main_uart_test.c b/packages/ti/drv/uart/test/src/main_uart_test.c index f1537b8db..af3b84f97 100644 --- a/packages/ti/drv/uart/test/src/main_uart_test.c +++ b/packages/ti/drv/uart/test/src/main_uart_test.c | |||
@@ -38,17 +38,6 @@ | |||
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | #include <string.h> | 39 | #include <string.h> |
40 | 40 | ||
41 | #ifdef USE_BIOS | ||
42 | /* XDCtools Header files */ | ||
43 | #include <xdc/std.h> | ||
44 | #include <xdc/runtime/Error.h> | ||
45 | #include <xdc/runtime/System.h> | ||
46 | |||
47 | /* BIOS Header files */ | ||
48 | #include <ti/sysbios/BIOS.h> | ||
49 | #include <ti/sysbios/knl/Task.h> | ||
50 | #endif /* #ifdef USE_BIOS */ | ||
51 | |||
52 | /* CSL Header files */ | 41 | /* CSL Header files */ |
53 | #if defined(_TMS320C6X) | 42 | #if defined(_TMS320C6X) |
54 | #include <ti/csl/csl_chip.h> | 43 | #include <ti/csl/csl_chip.h> |
@@ -59,9 +48,7 @@ | |||
59 | /* OSAL Header files */ | 48 | /* OSAL Header files */ |
60 | #include <ti/osal/osal.h> | 49 | #include <ti/osal/osal.h> |
61 | 50 | ||
62 | #if defined (USE_BIOS) || defined (FREERTOS) | ||
63 | #include <ti/osal/TaskP.h> | 51 | #include <ti/osal/TaskP.h> |
64 | #endif | ||
65 | 52 | ||
66 | /* UART Header files */ | 53 | /* UART Header files */ |
67 | #include <ti/drv/uart/UART.h> | 54 | #include <ti/drv/uart/UART.h> |
@@ -1029,10 +1016,16 @@ Err: | |||
1029 | } | 1016 | } |
1030 | 1017 | ||
1031 | #if !defined(UART_API2_NOT_SUPPORTED) | 1018 | #if !defined(UART_API2_NOT_SUPPORTED) |
1032 | #ifdef USE_BIOS | 1019 | #if defined (USE_BIOS) || defined (FREERTOS) |
1020 | #if defined (__C7100__) | ||
1021 | #define APP_TSK_STACK_WRITE (16U * 1024U) | ||
1022 | #else | ||
1023 | #define APP_TSK_STACK_WRITE (8U * 1024U) | ||
1024 | #endif /* #if defined (__C7100__) */ | ||
1025 | static uint8_t gAppTskStackWrite[APP_TSK_STACK_WRITE] __attribute__((aligned(32))); | ||
1033 | /* Use a global variable to sync the read task and the write task */ | 1026 | /* Use a global variable to sync the read task and the write task */ |
1034 | volatile bool taskSyncFlag; | 1027 | volatile bool taskSyncFlag; |
1035 | Void UART_simultaneous_rw_write(UArg a0, UArg a1) | 1028 | void UART_simultaneous_rw_write(void *a0, void *a1) |
1036 | { | 1029 | { |
1037 | UART_Handle uart = (UART_Handle)a0; | 1030 | UART_Handle uart = (UART_Handle)a0; |
1038 | bool dmaMode = (bool)a1; | 1031 | bool dmaMode = (bool)a1; |
@@ -1060,8 +1053,6 @@ Void UART_simultaneous_rw_write(UArg a0, UArg a1) | |||
1060 | 1053 | ||
1061 | /* resume the read test task */ | 1054 | /* resume the read test task */ |
1062 | taskSyncFlag = true; | 1055 | taskSyncFlag = true; |
1063 | |||
1064 | Task_exit (); | ||
1065 | } | 1056 | } |
1066 | 1057 | ||
1067 | /* | 1058 | /* |
@@ -1086,10 +1077,9 @@ static bool UART_test_simultaneous_rw(bool dmaMode) | |||
1086 | UART_Params uartParams; | 1077 | UART_Params uartParams; |
1087 | uintptr_t addrScanPrompt, addrEchoPrompt; | 1078 | uintptr_t addrScanPrompt, addrEchoPrompt; |
1088 | UART_Transaction transaction; | 1079 | UART_Transaction transaction; |
1089 | Task_Handle writeTask; | 1080 | TaskP_Handle writeTask; |
1090 | Task_Params writeTaskParams; | 1081 | TaskP_Params writeTaskParams; |
1091 | Error_Block eb; | 1082 | bool ret = false; |
1092 | bool ret = false; | ||
1093 | 1083 | ||
1094 | /* UART SoC init configuration */ | 1084 | /* UART SoC init configuration */ |
1095 | UART_initConfig(dmaMode); | 1085 | UART_initConfig(dmaMode); |
@@ -1107,17 +1097,12 @@ static bool UART_test_simultaneous_rw(bool dmaMode) | |||
1107 | /* run the write teas when task is created */ | 1097 | /* run the write teas when task is created */ |
1108 | taskSyncFlag = true; | 1098 | taskSyncFlag = true; |
1109 | 1099 | ||
1110 | Error_init(&eb); | ||
1111 | |||
1112 | /* Initialize the task params */ | 1100 | /* Initialize the task params */ |
1113 | Task_Params_init(&writeTaskParams); | 1101 | TaskP_Params_init(&writeTaskParams); |
1114 | writeTaskParams.arg0 = (UArg)uart; | 1102 | writeTaskParams.arg0 = (void *)uart; |
1115 | writeTaskParams.arg1 = (UArg)dmaMode; | 1103 | writeTaskParams.arg1 = (void *)dmaMode; |
1116 | #if defined (__C7100__) | 1104 | writeTaskParams.stack = gAppTskStackWrite; |
1117 | writeTaskParams.stackSize = 1024*16; | 1105 | writeTaskParams.stacksize = sizeof (gAppTskStackWrite); |
1118 | #else | ||
1119 | writeTaskParams.stackSize = 1024*8; | ||
1120 | #endif | ||
1121 | /* | 1106 | /* |
1122 | * Set the write task priority to the default priority (1) | 1107 | * Set the write task priority to the default priority (1) |
1123 | * lower than the read task priority (2) | 1108 | * lower than the read task priority (2) |
@@ -1125,10 +1110,9 @@ static bool UART_test_simultaneous_rw(bool dmaMode) | |||
1125 | writeTaskParams.priority = 1; | 1110 | writeTaskParams.priority = 1; |
1126 | 1111 | ||
1127 | /* Create the UART write task */ | 1112 | /* Create the UART write task */ |
1128 | writeTask = Task_create((Task_FuncPtr)UART_simultaneous_rw_write, &writeTaskParams, &eb); | 1113 | writeTask = TaskP_create(UART_simultaneous_rw_write, &writeTaskParams); |
1129 | if (writeTask == NULL) | 1114 | if (writeTask == NULL) |
1130 | { | 1115 | { |
1131 | System_abort("Task create failed"); | ||
1132 | goto Err; | 1116 | goto Err; |
1133 | } | 1117 | } |
1134 | 1118 | ||
@@ -1172,6 +1156,8 @@ static bool UART_test_simultaneous_rw(bool dmaMode) | |||
1172 | Osal_delay(100); | 1156 | Osal_delay(100); |
1173 | } | 1157 | } |
1174 | taskSyncFlag = false; | 1158 | taskSyncFlag = false; |
1159 | /* Delete write task */ | ||
1160 | TaskP_delete(writeTask); | ||
1175 | 1161 | ||
1176 | UART_transactionInit(&transaction); | 1162 | UART_transactionInit(&transaction); |
1177 | transaction.buf = (void *)(uintptr_t)addrEchoPrompt; | 1163 | transaction.buf = (void *)(uintptr_t)addrEchoPrompt; |
@@ -1201,8 +1187,8 @@ Err: | |||
1201 | 1187 | ||
1202 | return (ret); | 1188 | return (ret); |
1203 | } | 1189 | } |
1204 | #endif | 1190 | #endif /* #if defined (USE_BIOS) || defined (FREERTOS) */ |
1205 | #endif | 1191 | #endif /* #if !defined(UART_API2_NOT_SUPPORTED) */ |
1206 | 1192 | ||
1207 | /* | 1193 | /* |
1208 | * ======== UART read cancel test ======== | 1194 | * ======== UART read cancel test ======== |
@@ -3127,7 +3113,7 @@ UART_Tests Uart_tests[] = | |||
3127 | {UART_test_read_write_cancel, true, UART_TEST_ID_DMA_CANCEL, "\r\n UART DMA read write cancel test, enter less than 16 chars"}, | 3113 | {UART_test_read_write_cancel, true, UART_TEST_ID_DMA_CANCEL, "\r\n UART DMA read write cancel test, enter less than 16 chars"}, |
3128 | #endif | 3114 | #endif |
3129 | {UART_test_read_write_cancel, false, UART_TEST_ID_CANCEL, "\r\n UART non-DMA read write cancel test, enter less than 16 chars"}, | 3115 | {UART_test_read_write_cancel, false, UART_TEST_ID_CANCEL, "\r\n UART non-DMA read write cancel test, enter less than 16 chars"}, |
3130 | #ifdef USE_BIOS | 3116 | #if defined (USE_BIOS) || defined (FREERTOS) |
3131 | #if !defined(UART_API2_NOT_SUPPORTED) | 3117 | #if !defined(UART_API2_NOT_SUPPORTED) |
3132 | #ifdef UART_DMA_ENABLE | 3118 | #ifdef UART_DMA_ENABLE |
3133 | {UART_test_simultaneous_rw, true, UART_TEST_ID_DMA_RW, "\r\n UART DMA simultaneous read write test "}, | 3119 | {UART_test_simultaneous_rw, true, UART_TEST_ID_DMA_RW, "\r\n UART DMA simultaneous read write test "}, |
diff --git a/packages/ti/drv/uart/uart_component.mk b/packages/ti/drv/uart/uart_component.mk index 21248f0d5..90041565f 100644 --- a/packages/ti/drv/uart/uart_component.mk +++ b/packages/ti/drv/uart/uart_component.mk | |||
@@ -68,6 +68,7 @@ ifeq ($(uart_component_make_include), ) | |||
68 | 68 | ||
69 | # under other list | 69 | # under other list |
70 | drvuart_BOARDLIST = am65xx_evm am65xx_idk j721e_sim j721e_evm j7200_evm am64x_evm tpr12_evm tpr12_qt awr294x_evm | 70 | drvuart_BOARDLIST = am65xx_evm am65xx_idk j721e_sim j721e_evm j7200_evm am64x_evm tpr12_evm tpr12_qt awr294x_evm |
71 | drvuart_freertos_BOARDLIST = am65xx_evm j721e_evm j7200_evm tpr12_evm | ||
71 | drvuart_dma_SOCLIST = tda2xx tda2px dra72x dra75x tda2ex tda3xx dra78x am574x am572x am571x k2h k2k k2l k2e k2g c6678 c6657 omapl137 omapl138 am437x am65xx j721e j7200 | 72 | drvuart_dma_SOCLIST = tda2xx tda2px dra72x dra75x tda2ex tda3xx dra78x am574x am572x am571x k2h k2k k2l k2e k2g c6678 c6657 omapl137 omapl138 am437x am65xx j721e j7200 |
72 | drvuart_SOCLIST = tda2xx tda2px dra72x dra75x tda2ex tda3xx dra78x am574x am572x am571x k2h k2k k2l k2e k2g c6678 c6657 am437x am335x omapl137 omapl138 am65xx j721e j7200 am64x tpr12 awr294x | 73 | drvuart_SOCLIST = tda2xx tda2px dra72x dra75x tda2ex tda3xx dra78x am574x am572x am571x k2h k2k k2l k2e k2g c6678 c6657 am437x am335x omapl137 omapl138 am65xx j721e j7200 am64x tpr12 awr294x |
73 | drvuart_tda2xx_CORELIST = ipu1_0 | 74 | drvuart_tda2xx_CORELIST = ipu1_0 |
@@ -92,13 +93,17 @@ drvuart_c6657_CORELIST = c66x | |||
92 | drvuart_am437x_CORELIST = a9host | 93 | drvuart_am437x_CORELIST = a9host |
93 | drvuart_am335x_CORELIST = a8host pru_0 pru_1 | 94 | drvuart_am335x_CORELIST = a8host pru_0 pru_1 |
94 | drvuart_am65xx_CORELIST = mpu1_0 mcu1_0 mcu1_1 | 95 | drvuart_am65xx_CORELIST = mpu1_0 mcu1_0 mcu1_1 |
96 | drvuart_am65xx_FREERTOS_CORELIST = mcu1_0 mcu1_1 | ||
95 | drvuart_j721e_CORELIST = $(DEFAULT_j721e_CORELIST) | 97 | drvuart_j721e_CORELIST = $(DEFAULT_j721e_CORELIST) |
96 | drvuart_j721e_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 mcu3_0 mcu3_1 | 98 | drvuart_j721e_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 mcu3_0 mcu3_1 |
99 | drvuart_j721e_FREERTOS_CORELIST = mcu1_0 mcu1_1 mcu2_0 mcu2_1 mcu3_0 mcu3_1 | ||
97 | drvuart_j7200_CORELIST = $(DEFAULT_j7200_CORELIST) | 100 | drvuart_j7200_CORELIST = $(DEFAULT_j7200_CORELIST) |
98 | drvuart_j7200_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 | 101 | drvuart_j7200_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 |
102 | drvuart_j7200_FREERTOS_CORELIST = mcu1_0 mcu1_1 mcu2_0 mcu2_1 | ||
99 | drvuart_am64x_CORELIST = $(DEFAULT_am64x_CORELIST) | 103 | drvuart_am64x_CORELIST = $(DEFAULT_am64x_CORELIST) |
100 | drvuart_am64x_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 | 104 | drvuart_am64x_CORELISTARM = mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 |
101 | drvuart_tpr12_CORELIST = mcu1_0 c66xdsp_1 | 105 | drvuart_tpr12_CORELIST = mcu1_0 c66xdsp_1 |
106 | drvuart_tpr12_FREERTOS_CORELIST = mcu1_0 c66xdsp_1 | ||
102 | drvuart_awr294x_CORELIST = mcu1_0 c66xdsp_1 | 107 | drvuart_awr294x_CORELIST = mcu1_0 c66xdsp_1 |
103 | 108 | ||
104 | ############################ | 109 | ############################ |
@@ -418,11 +423,11 @@ export UART_Freertos_TestApp_CORE_DEPENDENCY = no | |||
418 | export UART_Freertos_TestApp_MAKEFILE = -f makefile IS_FREERTOS=yes | 423 | export UART_Freertos_TestApp_MAKEFILE = -f makefile IS_FREERTOS=yes |
419 | UART_Freertos_TestApp_PKG_LIST = UART_Freertos_TestApp | 424 | UART_Freertos_TestApp_PKG_LIST = UART_Freertos_TestApp |
420 | UART_Freertos_TestApp_INCLUDE = $(UART_Freertos_TestApp_PATH) | 425 | UART_Freertos_TestApp_INCLUDE = $(UART_Freertos_TestApp_PATH) |
421 | export UART_Freertos_TestApp_BOARDLIST = tpr12_evm | 426 | export UART_Freertos_TestApp_BOARDLIST = $(drvuart_freertos_BOARDLIST) |
422 | export UART_Freertos_TestApp_$(SOC)_CORELIST = $(drvuart_$(SOC)_CORELIST) | 427 | export UART_Freertos_TestApp_$(SOC)_CORELIST = $(drvuart_$(SOC)_FREERTOS_CORELIST) |
423 | export UART_Freertos_TestApp_SBL_APPIMAGEGEN = yes | 428 | export UART_Freertos_TestApp_SBL_APPIMAGEGEN = yes |
424 | 429 | ||
425 | # UART unit test freertos app | 430 | # UART unit test freertos dma app |
426 | export UART_Freertos_DMA_TestApp_COMP_LIST = UART_Freertos_DMA_TestApp | 431 | export UART_Freertos_DMA_TestApp_COMP_LIST = UART_Freertos_DMA_TestApp |
427 | UART_Freertos_DMA_TestApp_RELPATH = ti/drv/uart/test | 432 | UART_Freertos_DMA_TestApp_RELPATH = ti/drv/uart/test |
428 | UART_Freertos_DMA_TestApp_PATH = $(PDK_UART_COMP_PATH)/test | 433 | UART_Freertos_DMA_TestApp_PATH = $(PDK_UART_COMP_PATH)/test |