LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 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 SYSTEME GmbH *
3 * Solutions for real time microcontroller applications *
4 **********************************************************************
5 * *
6 * (C) 1996 SEGGER Microcontroller Systeme GmbH *
7 * *
8 * Internet: www.segger.com Support: support@segger.com *
9 * *
10 **********************************************************************
11 
12 ----------------------------------------------------------------------
13 File : GUI_X.C
14 Purpose : Config / System dependent externals for GUI
15 ---------------------------END-OF-HEADER------------------------------
16 */
17 
18 #include "GUI.h"
19 
20 /* FreeRTOS include files */
21 #include "FreeRTOS.h"
22 #include "task.h"
23 #include "timers.h"
24 #include "semphr.h"
25 
26 #include "board.h"
27 
28 /*********************************************************************
29 *
30 * Global data
31 */
32 static xSemaphoreHandle xQueueMutex;
33 static xSemaphoreHandle xSemaTxDone;
34 
35 /*********************************************************************
36 *
37 * Timing:
38 * GUI_X_GetTime()
39 * GUI_X_Delay(int)
40 
41  Some timing dependent routines require a GetTime
42  and delay function. Default time unit (tick), normally is
43 1 ms.
44 */
45 
46 int GUI_X_GetTime(void)
47 {
48  return ((int) xTaskGetTickCount());
49 }
50 
51 void GUI_X_Delay(int ms)
52 {
53  vTaskDelay( ms );
54 }
55 
56 /*********************************************************************
57 *
58 * GUI_X_Init()
59 *
60 * Note:
61 * GUI_X_Init() is called from GUI_Init is a possibility to init
62 * some hardware which needs to be up and running before the GUI.
63 * If not required, leave this routine blank.
64 */
65 
66 void GUI_X_Init(void) {
67 }
68 
69 
70 /*********************************************************************
71 *
72 * GUI_X_ExecIdle
73 *
74 * Note:
75 * Called if WM is in idle state
76 */
77 
78 void GUI_X_ExecIdle(void) {}
79 
80 /*********************************************************************
81 *
82 * Multitasking:
83 *
84 * GUI_X_InitOS()
85 * GUI_X_GetTaskId()
86 * GUI_X_Lock()
87 * GUI_X_Unlock()
88 *
89 * Note:
90 * The following routines are required only if emWin is used in a
91 * true multi task environment, which means you have more than one
92 * thread using the emWin API.
93 * In this case the
94 * #define GUI_OS 1
95 * needs to be in GUIConf.h
96 */
97 
98 /* Init OS */
99 void GUI_X_InitOS(void)
100 {
101  /* Create Mutex lock */
102  xQueueMutex = xSemaphoreCreateMutex();
104 
105  /* Queue Semaphore */
106  vSemaphoreCreateBinary( xSemaTxDone );
108 }
109 
110 void GUI_X_Unlock(void)
111 {
112  xSemaphoreGive( xQueueMutex );
113 }
114 
115 void GUI_X_Lock(void)
116 {
117  xSemaphoreTake( xQueueMutex, portMAX_DELAY );
118 }
119 
120 /* Get Task handle */
121 U32 GUI_X_GetTaskId(void)
122 {
123  return ((U32) xTaskGetCurrentTaskHandle());
124 }
125 
126 void GUI_X_WaitEvent (void)
127 {
128  while( xSemaphoreTake(xSemaTxDone, portMAX_DELAY ) != pdTRUE );
129 }
130 
131 
132 void GUI_X_SignalEvent (void)
133 {
134  xSemaphoreGive( xSemaTxDone );
135 }
136 
137 /*********************************************************************
138 *
139 * Logging: OS dependent
140 
141 Note:
142  Logging is used in higher debug levels only. The typical target
143  build does not use logging and does therefor not require any of
144  the logging routines below. For a release build without logging
145  the routines below may be eliminated to save some space.
146  (If the linker is not function aware and eliminates unreferenced
147  functions automatically)
148 
149 */
150 
151 void GUI_X_Log (const char *s) { DEBUGOUT(s); }
152 void GUI_X_Warn (const char *s) { DEBUGOUT(s); }
153 void GUI_X_ErrorOut(const char *s) { DEBUGOUT(s); }
154 
155 /*************************** End of file ****************************/