1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 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 #ifndef RTOS_H_ 16 #define RTOS_H_ 17 18 #include "rtos_ohos_al.h" 19 #include "task_al.h" 20 21 /// Definitions of the different FHOST task priorities 22 enum 23 { 24 TASK_PRIORITY_CONSOLE = RTOS_TASK_PRIORITY(1), 25 TASK_PRIORITY_TEST = RTOS_TASK_PRIORITY(1), 26 TASK_PRIORITY_BT_TASK = RTOS_TASK_PRIORITY(2), 27 TASK_PRIORITY_INTERSYS_TASK = RTOS_TASK_PRIORITY(2), 28 TASK_PRIORITY_ASIO = RTOS_TASK_PRIORITY(3), 29 TASK_PRIORITY_AUDIO = RTOS_TASK_PRIORITY(3), 30 TASK_PRIORITY_DSP = RTOS_TASK_PRIORITY(2), 31 TASK_PRIORITY_WIFI_VOICE = RTOS_TASK_PRIORITY(1), 32 TASK_PRIORITY_WIFI_TCPIP = RTOS_TASK_PRIORITY(3), 33 TASK_PRIORITY_WIFI_CNTRL = RTOS_TASK_PRIORITY(2), 34 TASK_PRIORITY_WIFI_IPC = RTOS_TASK_PRIORITY(4), 35 TASK_PRIORITY_WIFI_WPA = RTOS_TASK_PRIORITY(1), 36 TASK_PRIORITY_WIFI_TG_SEND = RTOS_TASK_PRIORITY(2), 37 TASK_PRIORITY_WIFI_PING_SEND = RTOS_TASK_PRIORITY(1), 38 TASK_PRIORITY_WIFI_IPERF = RTOS_TASK_PRIORITY(1), 39 TASK_PRIORITY_WIFI_SMARTCONF = RTOS_TASK_PRIORITY(2), 40 TASK_PRIORITY_WIFI_TX = RTOS_TASK_PRIORITY(4), 41 TASK_PRIORITY_CO_MAIN = RTOS_TASK_PRIORITY(2), 42 TASK_PRIORITY_WIFI_USER = RTOS_TASK_PRIORITY(1), 43 TASK_PRIORITY_USB_BT = RTOS_TASK_PRIORITY(2), 44 TASK_PRIORITY_MAX = RTOS_TASK_PRIORITY(5), 45 }; 46 47 typedef struct { 48 int priority; 49 int stack_size; 50 } rtos_task_cfg_st; 51 rtos_task_cfg_st get_task_cfg(uint8_t task_id); 52 53 /* 54 * FUNCTIONS 55 **************************************************************************************** 56 */ 57 58 /** 59 * Save user data that declared with PRIVATE_HOST_*(G3USER) 60 */ 61 void user_data_save(void); 62 63 /** 64 * Restore user data that declared with PRIVATE_HOST_*(G3USER) 65 */ 66 void user_data_restore(void); 67 68 /** 69 **************************************************************************************** 70 * @brief Main function of the RTOS 71 * 72 * Called after hardware initialization to create all RTOS tasks and start the scheduler. 73 **************************************************************************************** 74 */ 75 void rtos_main(void); 76 77 #endif // RTOS_H_ 78