DJI Payload SDK  1.5.3
psdk_arch_sys.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file psdk_arch_sys.h
4  * @version V1.5.0
5  * @date 2019/07/31
6  * @brief This file is a template containing the PSDK system wrapper function prototypes.
7  *
8  * @copyright (c) 2017-2018 DJI. All rights reserved.
9  *
10  * All information contained herein is, and remains, the property of DJI.
11  * The intellectual and technical concepts contained herein are proprietary
12  * to DJI and may be covered by U.S. and foreign patents, patents in process,
13  * and protected by trade secret or copyright law. Dissemination of this
14  * information, including but not limited to data and other proprietary
15  * material(s) incorporated within the information, in any form, is strictly
16  * prohibited without the express written consent of DJI.
17  *
18  * If you receive this source code without DJI’s authorization, you may not
19  * further disseminate the information, and you must immediately remove the
20  * source code and notify DJI of its removal. DJI reserves the right to pursue
21  * legal actions against you for any loss(es) or damage(s) caused by your
22  * failure to do so.
23  *
24  ******************************************************************************
25  */
26 
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef PSDK_ARCH_SYS_H
29 #define PSDK_ARCH_SYS_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Includes ------------------------------------------------------------------*/
36 #include "psdk_typedef.h"
37 
38 /** @addtogroup PSDK
39  * @{
40  */
41 
42 /** @addtogroup PSDK_Platform_Wrapper
43  * @{
44  */
45 
46 /* Exported constants --------------------------------------------------------*/
47 
48 /** @defgroup Exported_Constants Exported Constants
49  * @{
50  */
51 
52 #define PSDK_ARCH_USE_OS 1 /*!< Specifies whether user's application use operating system;
53  1 represents use operating system, 0 represents not use operating system. */
54 
55 /**
56  * @}
57  */
58 
59 /* Exported macros -----------------------------------------------------------*/
60 
61 /** @defgroup Exported_Macros Exported Macros
62  * @{
63  */
64 
65 /** @defgroup DBG_Printf_Function Log Print Function
66  * @{
67  */
68 
69 /**
70  * @brief Set printf function for log.
71  * @note If operating system is used, the function must be thread safe.
72  */
73 #define PSDK_DBG_PRINTF printf
74 
75 /**
76  * @}
77  */
78 
79 /** @defgroup Memory_Handle_Function Memory Handle Function
80  * @{
81  */
82 
83 /**
84  * @brief Set memory malloc function.
85  * @note If operating system is used, the function must be thread safe.
86  */
87 #define PSDK_MEM_MALLOC malloc
88 
89 /**
90  * @brief Set memory free function.
91  * @note If operating system is used, the function must be thread safe.
92  */
93 #define PSDK_MEM_FREE free
94 
95 /**
96  * @}
97  */
98 
99 /** @defgroup Mutex_ID_Type Mutex ID Type
100  * @{
101  */
102 
103 #define PSDK_MUTEX_T uint32_t /*!< Specifies mutex ID data type. */
105 /**
106  * @}
107  */
108 
109 /** @defgroup Semaphore_ID_Type Semaphore ID Type
110  * @{
111  */
112 
113 #define PSDK_SEMAPHORE_T uint32_t /*!< Specifies semaphore ID data type. */
115 /**
116  * @}
117  */
118 
119 /** @defgroup Get_Time_Interface Get Time Interface
120  * @{
121  */
122 
123 #define PSDK_GET_TIME_MS getSystimeMs /*!< Specifies get system time in milliseconds interface. */
125 /**
126  * @}
127  */
128 
129 /**
130  * @}
131  */
132 
133 /* Exported types ------------------------------------------------------------*/
134 /* Exported variables --------------------------------------------------------*/
135 /* Exported functions --------------------------------------------------------*/
136 
137 /** @defgroup Exported_Functions Exported Functions
138  * @{
139  */
140 
141 #if PSDK_ARCH_USE_OS
142 E_PsdkStat PsdkSys_MutexNew(PSDK_MUTEX_T *mutex);
143 E_PsdkStat PsdkSys_MutexDestroy(PSDK_MUTEX_T *mutex);
144 E_PsdkStat PsdkSys_MutexLock(PSDK_MUTEX_T *mutex);
145 E_PsdkStat PsdkSys_MutexUnlock(PSDK_MUTEX_T *mutex);
146 E_PsdkStat PsdkSys_SemaphoreNew(PSDK_SEMAPHORE_T *semaphore, uint32_t count);
147 E_PsdkStat PsdkSys_SemaphoreDestroy(PSDK_SEMAPHORE_T *semaphore);
148 E_PsdkStat PsdkSys_SemaphoreTimedWait(PSDK_SEMAPHORE_T *semaphore, uint32_t waitTime);
149 E_PsdkStat PsdkSys_SemaphorePost(PSDK_SEMAPHORE_T *semaphore);
150 #endif
151 
152 /**
153  * @}
154  */
155 
156 /* Private constants ---------------------------------------------------------*/
157 /* Private macros ------------------------------------------------------------*/
158 /* Private types -------------------------------------------------------------*/
159 /* Private variables ---------------------------------------------------------*/
160 /* Private functions ---------------------------------------------------------*/
161 
162 /**
163  * @}
164  */
165 
166 /**
167  * @}
168  */
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif //PSDK_ARCH_SYS_H
175 
176 /************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
#define PSDK_SEMAPHORE_T
Definition: psdk_arch_sys.h:114
E_PsdkStat PsdkSys_SemaphoreTimedWait(uint32_t *semaphore, uint32_t waitTime)
Wait the semaphore until token becomes available.
Definition: psdk_arch_sys.c:125
E_PsdkStat PsdkSys_SemaphoreNew(uint32_t *semaphore, uint32_t count)
Declare the semaphore container, initialize the semaphore, and create semaphore ID.
Definition: psdk_arch_sys.c:104
E_PsdkStat PsdkSys_MutexLock(uint32_t *mutex)
Acquire and lock the mutex when peripheral access is required.
Definition: psdk_arch_sys.c:82
E_PsdkStat PsdkSys_MutexDestroy(uint32_t *mutex)
Delete the created mutex.
Definition: psdk_arch_sys.c:72
E_PsdkStat PsdkSys_MutexNew(uint32_t *mutex)
Declare the mutex container, initialize the mutex, and create mutex ID.
Definition: psdk_arch_sys.c:62
E_PsdkStat PsdkSys_SemaphorePost(uint32_t *semaphore)
Release the semaphore token.
Definition: psdk_arch_sys.c:135
E_PsdkStat PsdkSys_SemaphoreDestroy(uint32_t *semaphore)
Delete the created semaphore.
Definition: psdk_arch_sys.c:114
#define PSDK_MUTEX_T
Definition: psdk_arch_sys.h:104
E_PsdkStat PsdkSys_MutexUnlock(uint32_t *mutex)
Unlock and release the mutex, when done with the peripheral access.
Definition: psdk_arch_sys.c:92