| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
GUI_X_FreeRTOS.c
Go to the documentation of this file.
1 /*********************************************************************
2 * SEGGER Microcontroller GmbH & Co. KG *
3 * Solutions for real time microcontroller applications *
4 **********************************************************************
5 * *
6 * (c) 1996 - 2012 SEGGER Microcontroller GmbH & Co. KG *
7 * *
8 * Internet: www.segger.com Support: support@segger.com *
9 * *
10 **********************************************************************
11
12 ** emWin V5.18 - Graphical user interface for embedded applications **
13 All Intellectual Property rights in the Software belongs to SEGGER.
14 emWin is protected by international copyright laws. Knowledge of the
15 source code may not be used to write a similar product. This file may
16 only be used in accordance with the following terms:
17
18 The software has been licensed to NXP Semiconductors USA, Inc. whose
19 registered office is situated at 1109 McKay Dr, M/S 76, San Jose,
20 CA 95131, USA solely for the purposes of creating libraries for
21 NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and
22 distributed under the terms and conditions of the NXP End User License
23 Agreement.
24 Full source code is available at: www.segger.com
25
26 We appreciate your understanding and fairness.
27 ----------------------------------------------------------------------
28 File : GUI_X_FreeRTOS.C
29 Purpose : Config / System dependent externals for GUI
30 ---------------------------END-OF-HEADER------------------------------
31 */
32
33 #include "GUI.h"
34
35 /* FreeRTOS include files */
36 #include "FreeRTOS.h"
37 #include "task.h"
38 #include "timers.h"
39 #include "semphr.h"
40
41 #include "board.h"
42
43 /*********************************************************************
44 *
45 * Global data
46 */
47 static xSemaphoreHandle xQueueMutex;
48 static xSemaphoreHandle xSemaTxDone;
49
50 /*********************************************************************
51 *
52 * Timing:
53 * GUI_X_GetTime()
54 * GUI_X_Delay(int)
55
56 Some timing dependent routines require a GetTime
57 and delay function. Default time unit (tick), normally is
58 1 ms.
59 */
60
61 int GUI_X_GetTime(void)
62 {
63 return ((int) xTaskGetTickCount());
64 }
65
66 void GUI_X_Delay(int ms)
67 {
68 vTaskDelay( ms );
69 }
70
71 /*********************************************************************
72 *
73 * GUI_X_Init()
74 *
75 * Note:
76 * GUI_X_Init() is called from GUI_Init is a possibility to init
77 * some hardware which needs to be up and running before the GUI.
78 * If not required, leave this routine blank.
79 */
80
81 void GUI_X_Init(void) {
82 }
83
84
85 /*********************************************************************
86 *
87 * GUI_X_ExecIdle
88 *
89 * Note:
90 * Called if WM is in idle state
91 */
92
93 void GUI_X_ExecIdle(void) {}
94
95 /*********************************************************************
96 *
97 * Multitasking:
98 *
99 * GUI_X_InitOS()
100 * GUI_X_GetTaskId()
101 * GUI_X_Lock()
102 * GUI_X_Unlock()
103 *
104 * Note:
105 * The following routines are required only if emWin is used in a
106 * true multi task environment, which means you have more than one
107 * thread using the emWin API.
108 * In this case the
109 * #define GUI_OS 1
110 * needs to be in GUIConf.h
111 */
112
113 /* Init OS */
114 void GUI_X_InitOS(void)
115 {
116 /* Create Mutex lock */
117 xQueueMutex = xSemaphoreCreateMutex();
118 configASSERT (xQueueMutex != NULL);
119
120 /* Queue Semaphore */
121 vSemaphoreCreateBinary( xSemaTxDone );
122 configASSERT ( xSemaTxDone != NULL );
123 }
124
125 void GUI_X_Unlock(void)
126 {
127 xSemaphoreGive( xQueueMutex );
128 }
129
130 void GUI_X_Lock(void)
131 {
132 xSemaphoreTake( xQueueMutex, portMAX_DELAY );
133 }
134
135 /* Get Task handle */
136 U32 GUI_X_GetTaskId(void)
137 {
138 return ((U32) xTaskGetCurrentTaskHandle());
139 }
140
141 void GUI_X_WaitEvent (void)
142 {
143 while( xSemaphoreTake(xSemaTxDone, portMAX_DELAY ) != pdTRUE );
144 }
145
146
147 void GUI_X_SignalEvent (void)
148 {
149 xSemaphoreGive( xSemaTxDone );
150 }
151
152 /*********************************************************************
153 *
154 * Logging: OS dependent
155
156 Note:
157 Logging is used in higher debug levels only. The typical target
158 build does not use logging and does therefor not require any of
159 the logging routines below. For a release build without logging
160 the routines below may be eliminated to save some space.
161 (If the linker is not function aware and eliminates unreferenced
162 functions automatically)
163
164 */
165
166 void GUI_X_Log (const char *s) { DEBUGOUT(s); }
167 void GUI_X_Warn (const char *s) { DEBUGOUT(s); }
168 void GUI_X_ErrorOut(const char *s) { DEBUGOUT(s); }
169
170 /*************************** End of file ****************************/