1 /*
2  * Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., 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 
16 /**
17  * @addtogroup Lockzhiner
18  *
19  * @file thread.h
20  */
21 
22 #ifndef LZ_HARDWARE_THREAD_H
23 #define LZ_HARDWARE_THREAD_H
24 
25 #define LZ_HARDWARE_THREAD_STACK_SIZE              0x1000
26 #define LZ_HARDWARE_THREAD_PRIO                    6
27 
28 typedef void (*ThreadFunc)(void *arg);
29 
30 /**
31  * @brief Create a thread.
32  *
33  *
34  *
35  * @param threadID Indicates the thread ID.
36  * @param func Indicates the thread callback function.
37  * @param arg Indicates input parameter of callback function.
38  * @param owner Indicates the owner process who create thread.
39  * @return Returns {@link LZ_HARDWARE_SUCCESS} if the thread is created successfully;
40  * returns {@link LZ_HARDWARE_FAILURE} otherwise. For details about other return values.
41  */
42 
43 int CreateThread(unsigned int *threadID, ThreadFunc func, void *arg, const char *owner);
44 
45 /**
46  * @brief Destroy a thread.
47  *
48  *
49  *
50  * @param threadID Indicates the thread ID.
51  * @return Returns {@link LZ_HARDWARE_SUCCESS} if the thread is destoried successfully;
52  * returns {@link LZ_HARDWARE_FAILURE} otherwise. For details about other return values, see the chip description.
53  */
54 
55 int DestroyThread(unsigned int threadID);
56 
57 #endif
58 
59