STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
GUI_X_OS.c
Go to the documentation of this file.
1 /*********************************************************************
2 * Portions COPYRIGHT 2015 STMicroelectronics *
3 * Portions SEGGER Microcontroller GmbH & Co. KG *
4 * Solutions for real time microcontroller applications *
5 **********************************************************************
6 * *
7 * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
8 * *
9 * Internet: www.segger.com Support: support@segger.com *
10 * *
11 **********************************************************************
12 
13 ** emWin V5.28 - Graphical user interface for embedded applications **
14 All Intellectual Property rights in the Software belongs to SEGGER.
15 emWin is protected by international copyright laws. Knowledge of the
16 source code may not be used to write a similar product. This file may
17 only be used in accordance with the following terms:
18 
19 The software has been licensed to STMicroelectronics International
20 N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
21 les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
22 purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
23 troller products commercialized by Licensee only, sublicensed and dis_
24 tributed under the terms and conditions of the End User License Agree_
25 ment supplied by STMicroelectronics International N.V.
26 Full source code is available at: www.segger.com
27 
28 We appreciate your understanding and fairness.
29 ----------------------------------------------------------------------
30 File : GUI_X.C
31 Purpose : This file provides emWin Interface with FreeRTOS
32 ---------------------------END-OF-HEADER------------------------------
33 */
34 
54 /* Includes ------------------------------------------------------------------*/
55 
56 #include "GUI.h"
57 
58  /* FreeRTOS include files */
59 #include "cmsis_os.h"
60 
61 /*********************************************************************
62 *
63 * Global data
64 */
65 static osMutexId osMutex;
67 /*********************************************************************
68 *
69 * Timing:
70 * GUI_X_GetTime()
71 * GUI_X_Delay(int)
72 
73 Some timing dependent routines require a GetTime
74 and delay function. Default time unit (tick), normally is
75 1 ms.
76 */
77 
78 int GUI_X_GetTime(void)
79 {
80  return ((int) xTaskGetTickCount());
81 }
82 
83 void GUI_X_Delay(int ms)
84 {
85  vTaskDelay( ms );
86 }
87 
88 /*********************************************************************
89 *
90 * GUI_X_Init()
91 *
92 * Note:
93 * GUI_X_Init() is called from GUI_Init is a possibility to init
94 * some hardware which needs to be up and running before the GUI.
95 * If not required, leave this routine blank.
96 */
97 
98 void GUI_X_Init(void) {
99 }
100 
101 
102 /*********************************************************************
103 *
104 * GUI_X_ExecIdle
105 *
106 * Note:
107 * Called if WM is in idle state
108 */
109 
110 void GUI_X_ExecIdle(void) {}
111 
112 /*********************************************************************
113 *
114 * Multitasking:
115 *
116 * GUI_X_InitOS()
117 * GUI_X_GetTaskId()
118 * GUI_X_Lock()
119 * GUI_X_Unlock()
120 *
121 * Note:
122 * The following routines are required only if emWin is used in a
123 * true multi task environment, which means you have more than one
124 * thread using the emWin API.
125 * In this case the
126 * #define GUI_OS 1
127 * needs to be in GUIConf.h
128 */
129 
130 /* Init OS */
131 void GUI_X_InitOS(void)
132 {
133  /* Create Mutex lock */
134  osMutexDef(MUTEX);
135 
136  /* Create the Mutex used by the two threads */
137  osMutex = osMutexCreate(osMutex(MUTEX));
138 
139  /* Create Semaphore lock */
140  osSemaphoreDef(SEM);
141 
142  /* Create the Semaphore used by the two threads */
144 }
145 
146 void GUI_X_Unlock(void)
147 {
149 }
150 
151 void GUI_X_Lock(void)
152 {
154 }
155 
156 /* Get Task handle */
158 {
159  return ((U32) osThreadGetId());
160 }
161 
162 
163 void GUI_X_WaitEvent (void)
164 {
166 }
167 
168 
169 void GUI_X_SignalEvent (void)
170 {
172 }
173 
174 /*********************************************************************
175 *
176 * Logging: OS dependent
177 
178 Note:
179 Logging is used in higher debug levels only. The typical target
180 build does not use logging and does therefor not require any of
181 the logging routines below. For a release build without logging
182 the routines below may be eliminated to save some space.
183 (If the linker is not function aware and eliminates unreferenced
184 functions automatically)
185 
186 */
187 
188 void GUI_X_Log (const char *s) { }
189 void GUI_X_Warn (const char *s) { }
190 void GUI_X_ErrorOut(const char *s) { }
191 
192 /*************************** End of file ****************************/
void GUI_X_Log(const char *s)
Definition: GUI_X_OS.c:188
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
Definition: cmsis_os.c:223
void GUI_X_InitOS(void)
Definition: GUI_X_OS.c:131
void GUI_X_ExecIdle(void)
Definition: GUI_X_OS.c:110
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
Definition: cmsis_os.c:656
int GUI_X_GetTime(void)
Definition: GUI_X_OS.c:78
#define U32
Definition: Global.h:50
void GUI_X_Init(void)
Definition: GUI_X_OS.c:98
void GUI_X_Lock(void)
Definition: GUI_X_OS.c:151
#define osSemaphore(name)
Definition: cmsis_os.h:653
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait until a Mutex becomes available.
Definition: cmsis_os.c:570
osStatus osMutexRelease(osMutexId mutex_id)
Release a Mutex that was obtained by osMutexWait.
Definition: cmsis_os.c:610
void GUI_X_SignalEvent(void)
Definition: GUI_X_OS.c:169
TickType_t xTaskGetTickCount(void) PRIVILEGED_FUNCTION
Definition: tasks.c:1764
void GUI_X_Unlock(void)
Definition: GUI_X_OS.c:146
void GUI_X_ErrorOut(const char *s)
Definition: GUI_X_OS.c:190
#define osWaitForever
wait forever timeout value
Definition: cmsis_os.h:248
SemaphoreHandle_t osSemaphoreId
Definition: cmsis_os.h:313
SemaphoreHandle_t osMutexId
Definition: cmsis_os.h:309
U32 GUI_X_GetTaskId(void)
Definition: GUI_X_OS.c:157
#define osMutexDef(name)
Definition: cmsis_os.h:596
void GUI_X_Warn(const char *s)
Definition: GUI_X_OS.c:189
void GUI_X_WaitEvent(void)
Definition: GUI_X_OS.c:163
void vTaskDelay(const TickType_t xTicksToDelay) PRIVILEGED_FUNCTION
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
Definition: cmsis_os.c:680
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Mutex object.
Definition: cmsis_os.c:554
void GUI_X_Delay(int ms)
Definition: GUI_X_OS.c:83
#define osSemaphoreDef(name)
Definition: cmsis_os.h:645
#define osMutex(name)
Definition: cmsis_os.h:604