1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CHRE_PLATFORM_FREERTOS_INIT_H_
18 #define CHRE_PLATFORM_FREERTOS_INIT_H_
19 
20 #include "FreeRTOS.h"
21 
22 namespace chre {
23 
24 /** @return the CHRE task priority being used. */
25 BaseType_t getChreTaskPriority();
26 
27 namespace freertos {
28 
29 /**
30  * This init function spawns a (non-privileged) FreeRTOS task that
31  * initializes the CHRE core, loads any static nanoapps, and starts
32  * the CHRE event loop.
33  * The task attribute constants are located in the corresponding init.cc
34  * source file, in case they need to be altered. The defaults chosen are:
35  * - Task Stack Depth: 8K Words
36  * - Task Priority: 1 (idle_task + 1)
37  *
38  * @return pdPASS on success, a FreeRTOS error code otherwise.
39  */
40 BaseType_t init();
41 
42 /**
43  * Delete the task spawned in the init function
44  */
45 void deinit();
46 
47 const char *getChreTaskName();
48 
49 }  // namespace freertos
50 }  // namespace chre
51 
52 #endif  // CHRE_PLATFORM_FREERTOS_INIT_H_
53