1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef TEST_SUITE_TASK_H 17 #define TEST_SUITE_TASK_H 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 22 #ifdef __cplusplus 23 #if __cplusplus 24 extern "C" { 25 #endif /* __cplusplus */ 26 #endif /* __cplusplus */ 27 28 #ifdef SUPPORT_AUDIO_LIEYIN_TOOL 29 #define CONFIG_TEST_SUITE_COMMAND_BUFFER_SIZE 512 30 #define TEST_SUITE_MSG_QUEUE_MAX_SIZE CONFIG_TEST_SUITE_COMMAND_BUFFER_SIZE 31 #else 32 #define TEST_SUITE_MSG_QUEUE_MAX_SIZE 128 33 #define CONFIG_TEST_SUITE_COMMAND_BUFFER_SIZE 300 34 #endif 35 36 /** 37 * @defgroup test_common_testsuite_task Task 38 * @ingroup test_common_testsuite 39 * @{ 40 */ 41 42 /** 43 * @if Eng 44 * @brief Write data to message queue. 45 * @param [in] buffer_addr data address. 46 * @param [in] buffer_size data size. 47 * @else 48 * @brief 将数据填给消息队列。 49 * @param [in] buffer_addr 数据地址。 50 * @param [in] buffer_size 数据大小。 51 * @endif 52 */ 53 int32_t test_suite_write_msgqueue(const uint8_t *buffer_addr, uint16_t buffer_size); 54 55 /** 56 * @if Eng 57 * @brief Create test suite task and message queue. 58 * @else 59 * @brief 创建测试套件任务及其消息队列。 60 * @endif 61 */ 62 void test_suite_task_init(void); 63 64 /** 65 * @if Eng 66 * @brief Destory test suite task and message queue. 67 * @else 68 * @brief 删除测试套件任务及其消息队列。 69 * @endif 70 */ 71 void test_suite_task_destroy(void); 72 73 /** 74 * @if Eng 75 * @brief Set test suite task status. 76 * @param [in] status test suite task status, false:running; true:exit. 77 * @else 78 * @brief 设置测试套件运行状态。 79 * @param [in] status 测试套件运行状态,false:运行中; true:退出。 80 * @endif 81 */ 82 void test_suite_task_set_exit(bool status); 83 84 /** 85 * @if Eng 86 * @brief Get test suite task status. 87 * @return test suite task status, false:running; true:exit. 88 * @else 89 * @brief 设置测试套件运行状态。 90 * @return 测试套件运行状态, false:运行中; true:退出。 91 * @endif 92 */ 93 bool test_suite_task_is_exit(void); 94 95 /** 96 * @if Eng 97 * @brief This function should be called in the main loop, if nonos. 98 * @else 99 * @brief 无OS的条件下,应该在主循环中调用该函数。 100 * @endif 101 */ 102 void test_suite_nonos_loop(void); 103 104 /** 105 * @if Eng 106 * @brief Write data to command queue. 107 * @param [in] buffer_addr data address. 108 * @param [in] buffer_size data size. 109 * @else 110 * @brief 将数据填给命令帧的消息队列。 111 * @param [in] buffer_addr 数据地址。 112 * @param [in] buffer_size 数据大小。 113 * @endif 114 */ 115 int32_t test_suite_write_cmd_queue(const uint8_t *buffer_addr, uint16_t buffer_size); 116 117 /** 118 * @if Eng 119 * @brief Receive data from command queue. 120 * @param [in] buffer_addr data address. 121 * @param [in] buffer_size data size. 122 * @else 123 * @brief 接收命令帧消息队列的数据。 124 * @param [in] buffer_addr 数据地址。 125 * @param [in] buffer_size 数据大小。 126 * @endif 127 */ 128 int32_t test_suite_receive_cmd_queue(char *buffer_addr, uint32_t *buffer_size); 129 130 /** 131 * @} 132 */ 133 134 #ifdef __cplusplus 135 #if __cplusplus 136 } 137 #endif /* __cplusplus */ 138 #endif /* __cplusplus */ 139 140 #endif 141