📄 cos12run.c
字号:
/* == IDENTIFICATION ========================================================== * * Copyright (C) 2005, Philips Semiconductors Nuernberg * * System : Vega Family * Component : FP and PP * Module : OS * Unit : Process Runner * File : cos12run.c * * @(#) %filespec: cos12run.c-VoIP.2 % *//* == HISTORY ========================================================= *//* * Name Date V. Action * -------------------------------------------------------------------- * tcmc_asb 24-Feb-2005 VoIP.2 For RTK start with p_os19_InitApplication * tcmc_ore 1-Feb-2005 VoIP.1 Add call to RTK for events in scheduler * tcmc_asa 06-Aug-2004 D75.1 made include of csys0reg.h conditional * tcmc_ore 13-Oct-2003 2 Same as version 14 in basic OS * tcmc_dbm 03-Oct-2003 14 Task 1628: mask OS_PRINTF on ARM * tcmc_ore 19-Feb-2003 13 PR183: Move GuardTimers to outside SystemActive * check, as now timers can be running and * SystemActive is 0 (see cdr17tim.c) * tcmc_ore 4-Feb-2003 12 re-add cos04msg.h include * tcmc_ore 31-Jan-2003 always check exception (even if !SystemActive) * tcmc_ore 12-Mar-2002 rearranged order of includes * tcmc_asa 21-Feb-2002 removed OS_LOG_STRING, now done in OS_PUT_xxx * tcmc_asa 02-Jul-2001 changed mmi_sim to p_su1_MMISim, code rework * tcmc_ore 29-Jun-2001 IdleMode call for FP too * tcmc_ore 29-Jun-2001 both schedulers must retrigger watchdog, to * allow for configurations where most processes * are high priority. On the other hand a stuck * low priority process can now only be detected * after the high priority queue is empty, but * this will always happen after some time. * tcmc_ore 02-May-2001 add check for stuck HPrio messages * tcmc_ore 26-Apr-2001 change bsd07ddl back to bsd09ddl * tcmc_ore 24-Apr-2001 MsgActive Flag not needed * tcmc_ore 20-Apr-2001 make OS preemptive * tcmc_asa 23-Jan-2001 corrected table access in p_OS12_ShowStateTable * tcmc_asa 19-Dec-2000 made compilable for SUN environment * tcmc_asa 06-Dec-2000 added #include "hsd07ddl.h" * tcmc_ore 13-Nov-2000 Created *//*MPM========================================================================== * * ABSTRACT: * * This file contains the code for the process runner of the OS i.e. the * scheduler and the dispatcher * * Global functions to be called by other modules: * ----------------------------------------------- * #if OS_DEBUG > 2 * - p_os12_ShowStateTable * #endif * * Module functions to be called by other units: * --------------------------------------------- * - p_os12_Scheduler * #ifdef OS_PRE_EMPTIVE * - p_os12_HPrioScheduler * #endif * * Unit functions to be called only by this unit: * ---------------------------------------------- * - p_os12_Dispatcher * *//* == DESIGN ================================================================== * * <explanation of general principles> */#define cos12_c/* == GLOBAL DECLARATIONS ======================================= */#include "cg0type.h"#ifndef __armextern void p_su15_MMISim( void );#ifdef SIM_FT_PT_CONextern void p_su10_DummyMac( void );#endif#include <stdio.h> /* FILE in cos07dbg.h */#endif /* ! __arm */#ifdef PT_MODULE# include "hsd09cnf.h"# include "hsd09ddl.h"#else# include "bsd09cnf.h"# include "bsd09ddl.h"#endif#ifndef UNIX# include "csys0reg.h"#endif#include "cos00int.h"#include "cos01dat.h"#include "cos02run.h"#include "cos04msg.h"#include "cos07dbg.h"#include "cos08trc.h"#include "cos09use.h"#include "cos03tim.h"/* == DEFINITION OF LOCAL CONSTANTS ======================================== *//* == DEFINITION OF LOCAL MACROS =========================================== *//* == DEFINITION OF LOCAL ENUMERATIONS ===================================== *//* == DECLARATION OF LOCAL TYPES =========================================== *//* == DECLARATION OF LOCAL DATA =========================================== *//* == DECLARATION OF LOCAL FUNCTION PROTOTYPES ============================= *//*MPF::p_os12_Dispatcher =================================================== *//* FUNCTIONAL DESCRIPTION: * * This procedure is called from the scheduler (either high or low priority) * when a message is found. This procedure sets up than the "environment * variable" G_st_os00_Act for the process to be called and calls the process * * GLOBALS * * - G_st_os00_Act * - G_u8_os09_StateTable[] * * PARAMETERS * #ifdef OS_PRE_EMPTIVE * u32_HPrio: 1: called from p_os12_HPrioScheduler; 0: otherwise * #else * None * #endif * * INTERFACE DECLARATION: */#ifdef OS_PRE_EMPTIVEvoid p_os12_Dispatcher(u32 u32_HPrio)#elsevoid p_os12_Dispatcher(void)#endif/*EMP ====================================================================== *//* == DESIGN =============================================================== *//* * Get the actual state of the receiver (given by global variables * ActProcess and ActInstance) from global state table. * Get procedure address of the receiver process from another table and * call it. * The process procedure must update the actual state variable. After return * the dispatcher stores this value in the global state table. *//* == STATEMENTS =========================================================== */{ u32 u32_StateIndex; /* local index variable into state table */#if OS_RUNTIME_CHECK_LEVEL >= 2 if(G_st_os00_Act.u8_Process > G_u8_os09_NrOfProcesses){ p_os19_RaiseException(OS09_EXC_ILL_PROC); return; }#endif OS00_DISABLE_SWITCH; u32_StateIndex = G_u8_os09_StateTableIndex[G_st_os00_Act.u8_Process] + G_st_os00_Act.u8_Instance; G_st_os00_Act.u8_State = G_u8_os09_StateTable[u32_StateIndex]; OS00_ENABLE_SWITCH;#if OS_DEBUG#ifndef __arm /* print current state: */ OS_LOG_COMMENT1; OS_PRINTF_1("---- %6u ---------------------------------------------------------\n", G_u16_os00_SystemTime); OS_LOG_STRING1; OS_LOG_COMMENT1; OS_PRINTF_6("%s %s = %d , --- PROCESS %s = %d , INST = %d \n", os_str_state, G_pu8_os09_StateNames[G_st_os00_Act.u8_Process][G_st_os00_Act.u8_State], G_st_os00_Act.u8_State, G_pu8_os09_ProcessNames[G_st_os00_Act.u8_Process], G_st_os00_Act.u8_Process, G_st_os00_Act.u8_Instance); OS_LOG_STRING1; OS_LOG_COMMENT1; OS_PRINTF_3("%s %s = %d \n", os_str_event, G_pu8_os09_EventNames[G_st_os00_Act.u8_Process][G_st_os00_Act.u8_Event], G_st_os00_Act.u8_Event); OS_LOG_STRING1;#endif#endif#ifdef OS_PRE_EMPTIVE p_os18_TracePSI(u32_HPrio);#else p_os18_TracePSI();#endif /* call process (transition) */ (*(G_pp_os09_ProcessCode[G_st_os00_Act.u8_Process])) ();#if OS_DEBUG#ifndef __arm /* print new state */ OS_LOG_COMMENT1; OS_PRINTF_3("%s %s = %d \n", os_str_new_state, G_pu8_os09_StateNames[G_st_os00_Act.u8_Process][G_st_os00_Act.u8_State], G_st_os00_Act.u8_State); OS_LOG_STRING1;#endif#endif#ifdef OS_PRE_EMPTIVE p_os18_TraceExit(u32_HPrio);#else p_os18_TraceExit();#endif /* store back state */ G_u8_os09_StateTable[u32_StateIndex] = G_st_os00_Act.u8_State;}/* == END OF p_os12_Dispatcher ============================================= *//*MPF::p_os12_Scheduler ==================================================== *//* FUNCTIONAL DESCRIPTION: * * This is the main (endless) loop of the system * * GLOBALS * - G_st_os00_RunControl * - G_u8_os00_SystemActive * PARAMETERS * * None * * INTERFACE DECLARATION: */void p_os12_Scheduler(void)/*EMP ====================================================================== *//* == DESIGN =============================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -