📄 systemtasks.c
字号:
/* **************************************************************************************
* Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: SystemTasks.c $
*
* Description:
* ============
* System-Tasks definition, allocation, and initialization.
*
* Log:
* ====
* $Revision: 11 $
* Last Modified by $Author: Kennyz $ at $Modtime: 03-12-22 22:41 $
****************************************************************************************
* Updates:
****************************************************************************************
* $Log: /SourceCode/I64_Customer/I64_OPV/Kernel/SystemTasks.c $
*
* 11 03-12-22 22:57 Kennyz
* Modified for UI task in GUI project.
*
* 10 10/10/03 8:58a Tomasp
* Fix wrong CORE stack pointer initialization
*
* 9 03-06-03 11:25 Jerryc
* change the core task stack bottom to be 0x4ff0.
*
* 8 03-04-17 11:57 Jerryc
* hard code the position of core task's stack for
* sharing reflasher burner APIS with capture_logo and store_ps_in_flash
* features.
*
* 18 23/04/02 9:26 Nirm
* - Added dependency in "Config.h".
*
* 17 4/02/02 7:38a Tomasp
* Removed double UI task initialization.
*
* 16 31/03/02 23:16 Nirm
* - Added installation of the Drive-Driver Task.
*
* 15 27/03/02 13:25 Nirm
* - System-Tasks creation and initialization.
**************************************************************************************** */
#include "Config.h" // Global Configuration - do not remove!
#include "Include\SysDefs.h"
#include "Kernel\Ker_API.h"
#include "Kernel\SystemTasks.h"
#include "Kernel\uITRON\RTOS.h"
#include "Playcore\Coremain\Coremain.h"
#ifdef _DEBUG
#include "Debug\dbgmain.h"
#endif
/////////////////////////////////////////////////////////////////////////////
// Constants and Enumerations
// Task Stacks
#define DEFAULT_STACK_SIZE 0x800 // Bytes
#ifdef D_OPV
#define CORE_STACK_SZ (DEFAULT_STACK_SIZE)
#else
#define CORE_STACK_SZ DEFAULT_STACK_SIZE
#endif // D_OPV
#ifdef D_OPV
#define UI_STACK_SZ (DEFAULT_STACK_SIZE)
#else
#define UI_STACK_SZ DEFAULT_STACK_SIZE
#endif // D_OPV
#ifdef _DEBUG
#define DEBUG_STACK_SZ (DEFAULT_STACK_SIZE / 2)
#endif
// Task Time-Slices (in ms)
#ifdef _DEBUG
#define DEBUG_TASK_SLICE_MS 2
#endif
#define CORE_TASK_SLICE_MS 6
#define UI_TASK_SLICE_MS 2
#define DRIVEDRIVER_TASK_SLICE_MS 4
/////////////////////////////////////////////////////////////////////////////
// Globals
// Task Stacks
#define MK_FP(seg,ofs) ((void __seg *)(seg) + (void __near *)(ofs))
//<<<Tomas.Pacha_1009_2003_A: Fix wrong CORE stack pointer initialization
#define CORE_STACK_BOTTOM MK_FP(0x0000, 0x5000)
//<<<Tomas.Pacha_1009_2003_A: Fix wrong CORE stack pointer initialization
static BYTE g_UI_Stack[UI_STACK_SZ];
#ifdef _DEBUG
static BYTE g_Debug_Stack[DEBUG_STACK_SZ];
#endif
/////////////////////////////////////////////////////////////////////////////
// Implementation
void Ker_createSystemTasks(void)
{
#ifdef _TIME_SLICE_
init_rtos((ID)DRIVEDRIVER_TASK_ID, (PRI)DRIVEDRIVER_TASK_PRIORITY,
(DRIVEDRIVER_TASK_SLICE_MS / RTOS_TICK_MS));
init_task((ID)CORE_TASK_ID, (T_CONTEXT *)CORE_STACK_BOTTOM, (FP)core_dispatch,
(PRI)CORE_TASK_PRIORITY, (CORE_TASK_SLICE_MS / RTOS_TICK_MS));
init_task((ID)UI_TASK_ID, (T_CONTEXT *)&g_UI_Stack[UI_STACK_SZ], (FP)ui_dispatch,
(PRI)UI_TASK_PRIORITY, (UI_TASK_SLICE_MS / RTOS_TICK_MS));
#ifdef _DEBUG
init_task((ID)DEBUG_TASK_ID, (T_CONTEXT *)&g_Debug_Stack[DEBUG_STACK_SZ],
(FP)debug_root_menu, (PRI)DEBUG_TASK_PRIORITY, (DEBUG_TASK_SLICE_MS / RTOS_TICK_MS));
#endif
#else
init_rtos((ID)DRIVEDRIVER_TASK_ID, (PRI)DRIVEDRIVER_TASK_PRIORITY);
init_task((ID)CORE_TASK_ID, (T_CONTEXT *)&g_Core_Stack[CORE_STACK_SZ], (FP)core_dispatch,
(PRI)CORE_TASK_PRIORITY);
init_task((ID)UI_TASK_ID, (T_CONTEXT *)&g_UI_Stack[UI_STACK_SZ], (FP)ui_dispatch,
(PRI)UI_TASK_PRIORITY);
#ifdef _DEBUG
init_task((ID)DEBUG_TASK_ID, (T_CONTEXT *)&g_Debug_Stack[DEBUG_STACK_SZ],
(FP)debug_root_menu, (PRI)DEBUG_TASK_PRIORITY);
#endif
#endif //_TIME_SLICE_
return;
}
void Ker_startSystemTasks(void)
{
sta_tsk((ID)CORE_TASK_ID, (INT)0);
sta_tsk((ID)UI_TASK_ID, (INT)0);
#ifdef _DEBUG
sta_tsk((ID)DEBUG_TASK_ID, (INT)0);
#endif
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -