📄 guitask.lst
字号:
C51 COMPILER V8.05a GUITASK 04/11/2008 14:18:58 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUITASK
OBJECT MODULE PLACED IN guitask.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\guitask.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND P
-RINT(.\guitask.lst) OBJECT(guitask.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/GUI
4 * Universal graphic software for embedded applications
5 *
6 * (c) Copyright 2002, Micrium Inc., Weston, FL
7 * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
8 *
9 * 礐/GUI is protected by international copyright laws. Knowledge of the
10 * source code may not be used to write a similar product. This file may
11 * only be used in accordance with a license and should not be redistributed
12 * in any way. We appreciate your understanding and fairness.
13 *
14 ----------------------------------------------------------------------
15 File : GUITASK.C
16 Purpose : Saves/Restores task context with supported OSs.
17 It also uses a resource semaphore.
18
19 The following externals are used and should typically be defined
20 in GUI_X.c:
21
22 U32 GUI_X_GetTaskId();
23 void GUI_X_Unlock();
24 void GUI_X_Lock();
25
26 ----------------------------------------------------------------------
27 Version-Date---Author-Explanation
28 ----------------------------------------------------------------------
29 3.02a 020722 RS Use of macro GUI_DEBUG_ERROROUT_IF in order
30 to simplify th code.
31 3.02 020514 RS Avoided nested calls of GUI_X_Lock, GUI_X_Unlock
32 (because some RTOSes, such as CMX and u/C-OS
33 could not handle this easily)
34 3.00 010425 RS Cleanup for emWin Version 3.00
35 a) Dummy routines added to avoid link errors
36 in case some emWin modules are compiled with
37 different settings
38 1.00.01 990926 RS Fix in order to make sure init task has no
39 context of its own (_CurrentTaskNo =-1)
40 1.00.00 990918 RS Initial version for version control purposes.
41 This is a generic version which can be used with
42 both emWin b/w and emWin GSC; it is based on the
43 Context saver of emWin b/w.
44 ---------------------------END-OF-HEADER------------------------------
45 */
46
47 #include <stddef.h> /* needed for definition of NULL */
48 #include "gui\Core\GUI_Protected.h"
49 #include "gui\Core\GUIDEBUG.h"
50
51 /*********************************************************************
52 *
53 * Configuration defaults
54 *
C51 COMPILER V8.05a GUITASK 04/11/2008 14:18:58 PAGE 2
55 *********************************************************************
56 */
57
58 #ifndef GUI_MAXTASK
59 #define GUI_MAXTASK (4)
60 #endif
61
62 #if GUI_OS
/*********************************************************************
*
* Static data
*
*********************************************************************
*/
static struct {
U32 TaskID;
GUI_CONTEXT Context;
} _Save[GUI_MAXTASK];
static int _CurrentTaskNo = -1;
static int _EntranceCnt = 0;
static U32 _TaskIDLock = 0;
/*********************************************************************
*
* Static functions
*
*********************************************************************
*/
static int _GetTaskNo(void) {
int i;
for (i=0; i< GUI_MAXTASK; i++) {
U32 TaskId = GUI_X_GetTaskId();
if (_Save[i].TaskID == TaskId)
return i;
if (_Save[i].TaskID == 0) {
_Save[i].TaskID = TaskId;
return i;
}
}
GUI_DEBUG_ERROROUT("No Context available for task ... (increase GUI_MAXTASK)");
return 0;
}
/*********************************************************************
*
* Public functions
*
*********************************************************************
*/
void GUI_Unlock(void) {
if (--_EntranceCnt == 0) {
GUI_X_Unlock();
}
/* Test if _EntranceCnt is in reasonable range ... Not required in release builds */
GUI_DEBUG_ERROROUT_IF((_EntranceCnt < 0), "GUITASK.c: GUI_Unlock() _EntranceCnt underflow ");
}
C51 COMPILER V8.05a GUITASK 04/11/2008 14:18:58 PAGE 3
void GUI_Lock(void) {
if (_EntranceCnt == 0) {
GUI_X_Lock();
_TaskIDLock = GUI_X_GetTaskId(); /* Save task ID */
} else {
if (_TaskIDLock != GUI_X_GetTaskId()) {
GUI_X_Lock();
_TaskIDLock = GUI_X_GetTaskId(); /* Save task ID */
}
}
if (++_EntranceCnt == 1) {
int TaskNo = _GetTaskNo();
if (TaskNo != _CurrentTaskNo) {
/* Save data of current task */
if (_CurrentTaskNo>=0) { /* Make sure _CurrentTaskNo is valid */
_Save[_CurrentTaskNo].Context = GUI_Context;
}
/* Load data of this task */
GUI_Context = _Save[TaskNo].Context;
_CurrentTaskNo = TaskNo;
}
}
/* Test if _EntranceCnt is in reasonable range ... Not required in release builds */
GUI_DEBUG_ERROROUT_IF((_EntranceCnt>12), "GUITASK.c: GUI_Lock() _EntranceCnt overflow ");
}
void GUITASK_Init(void) {
int i;
_CurrentTaskNo =-1; /* Invalidate */
GUI_X_InitOS();
for (i=0; i<GUI_MAXTASK; i++) {
_Save[i].Context = GUI_Context;
}
}
#else
153
154 /*********************************************************************
155 *
156 * Dummy Kernel routines
157
158 The routines below are dummies in case configuration tells us not
159 to use any kernel. In this case the routines below should
160 not be required, but it can not hurt to have them. The linker
161 will eliminate them anyhow.
162
163 */
164
165 void GUI_Unlock(void) {}
166 void GUI_Lock(void) {}
167 void GUITASK_Init(void) {}
168 void GUITASK_StoreDefaultContext(void) {}
169
170 #endif
171
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 4 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
C51 COMPILER V8.05a GUITASK 04/11/2008 14:18:58 PAGE 4
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -