1 /**
2  * @file os_common.h
3  * @author ALLWINNERTECH IOT WLAN Team
4  */
5 
6 /*
7  * Copyright (C) 2017 ALLWINNERTECH TECHNOLOGY CO., LTD. All rights reserved.
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *    1. Redistributions of source code must retain the above copyright
13  *       notice, this list of conditions and the following disclaimer.
14  *    2. Redistributions in binary form must reproduce the above copyright
15  *       notice, this list of conditions and the following disclaimer in the
16  *       documentation and/or other materials provided with the
17  *       distribution.
18  *    3. Neither the name of ALLWINNERTECH TECHNOLOGY CO., LTD. nor the names of
19  *       its contributors may be used to endorse or promote products derived
20  *       from this software without specific prior written permission.
21  *
22  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef _KERNEL_OS_FREERTOS_OS_COMMON_H_
36 #define _KERNEL_OS_FREERTOS_OS_COMMON_H_
37 
38 #include <stdint.h>
39 #include "compiler.h"
40 #include "FreeRTOS.h"
41 #include "projdefs.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Thread priority definition
49  */
50 typedef enum  {
51     OS_PRIORITY_IDLE            = 0,
52     OS_PRIORITY_LOW             = 1,
53     OS_PRIORITY_BELOW_NORMAL    = 2,
54     OS_PRIORITY_NORMAL          = 3,
55     OS_PRIORITY_ABOVE_NORMAL    = 4,
56     OS_PRIORITY_HIGH            = 5,
57     OS_PRIORITY_REAL_TIME       = 6
58 } OS_Priority;
59 
60 /**
61  * @brief OS status definition
62  */
63 typedef enum {
64     OS_OK           = 0,    /* success */
65     OS_FAIL         = -1,   /* general failure */
66     OS_E_NOMEM      = -2,   /* out of memory */
67     OS_E_PARAM      = -3,   /* invalid parameter */
68     OS_E_TIMEOUT    = -4,   /* operation timeout */
69     OS_E_ISR        = -5,   /* not allowed in ISR context */
70 } OS_Status;
71 
72 /** @brief Type definition of OS time */
73 typedef uint32_t OS_Time_t;
74 
75 #define OS_WAIT_FOREVER         0xffffffffU /* Wait forever timeout value */
76 #define OS_SEMAPHORE_MAX_COUNT  0xffffffffU /* Maximum count value for semaphore */
77 #define OS_INVALID_HANDLE       NULL        /* OS invalid handle */
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* _KERNEL_OS_FREERTOS_OS_COMMON_H_ */
84