⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ros33.c

📁 一个操作系统源代码 用于嵌入式设备 在Vc++环境下仿真 成功移植到多款处理器上
💻 C
字号:
////////////////////////////////////////////////////////////////////////////////
// File Name	:		Ros33.c
// Create Date	:		2001-6-13 am 09:02:31
// Written by	:		CYu
// Decription	:	
//------------------------------------------------------------------------------
// Copyright:   CNASIC Proprietary Material
//              Copyright (c) 2001, All Rights Reserved By:
//              National ASIC System Engineering Research Center (CNASIC) 
//				SouthEast University
//
//              DISTRIBUTION PROHIBITED without written authorization from CNASIC
//------------------------------------------------------------------------------
// Modification History
//
// 2001/10/31	by longn_qi		revise.
//
////////////////////////////////////////////////////////////////////////////////
/* System and Standard Header */
#include <string.h>
#include <kernel\ros33\itron.h>
#include <kernel\ros33\ros33.h>
#define _SIZE_T_DEFINED

/* Application Header */
#include "internal.h"

/* External Variable Definition */
READYQUEUE	aReadyQueue[MAX_TSKPRI+1];
TCB			aTcb[TSK_NUM+1];
FCB			aFcb[FLG_NUM+1];
MXCB		aMxcb[MLBX_NUM+1];
SMPHCB		aSmphcb[SMPH_NUM+1];
ID			idCurTask = 0;
UB			g_ubSysStat = 0;
UB			g_ubIntNestCnt = 0;
BOOL		isSystemStart;

/* Function Definition */
//------------------------------------------------------------------------------
// Function name  : sys_ini
// Description    :
// No return value
// No argument
// Remarks        :
// So also        :
//------------------------------------------------------------------------------
void sys_ini( void )
{
    int i;

	idCurTask = 0;
    memset( aTcb, 0, sizeof( aTcb ) );
    memset( aReadyQueue, 0, sizeof( aReadyQueue ) );
    memset( aFcb, 0, sizeof( aFcb ) );
    memset( aMxcb, 0, sizeof( aMxcb ) );

    g_ubIntNestCnt = 0;
    g_ubSysStat = 0;        // system status

    loc_cpu();
       
    // init semaphore 
    for(i = 0; i < SMPH_NUM; i++){
        aSmphcb[i].ubSmphMax = SMPH_CNT;
        aSmphcb[i].ubSmphCnt = SMPH_CNT;
    }

/*    // init message buffer 
    for(i = 0; i < MSGBUF_NUM; i++){
        mInitMember((T_NODE*)&(g_sMsgbufcb[i].pNxtTsk));
        mInitMember((T_NODE*)&(g_sMsgbufcb[i].pNxtSndTsk));
        g_sMsgbufcb[i].bufst = 0;   
        g_sMsgbufcb[i].bufend = 0;
        g_sMsgbufcb[i].head = 0;  
        g_sMsgbufcb[i].tail = 0;  
        g_sMsgbufcb[i].maxmsz = 0;
        g_sMsgbufcb[i].ubEmpty = 1;
    }

    // init variable memory pool 
    for(i = 0; i < MPLBLK_NUM; i++){
        mInitMember((T_NODE*)&(g_sMplcb[i].pNxtTsk));
        g_sMplcb[i].StartAlloc = 0;   
        g_sMplcb[i].EndAlloc = 0;
        g_sMplcb[i].NxtAlcp = 0;  
        g_sMplcb[i].TblPtr = 0;  
        g_sMplcb[i].ulRow = 0;
        g_sMplcb[i].ulBlksz = 0;
    }

    // init fixed memory pool 
    for(i = 0; i < MPFBLK_NUM; i++){
        mInitMember((T_NODE*)&(g_sMpfcb[i].pNxtTsk));
        g_sMpfcb[i].StartAlloc = 0;   
        g_sMpfcb[i].EndAlloc = 0;
        g_sMpfcb[i].NxtAlcp = 0;  
        g_sMpfcb[i].TblPtr = 0;  
        g_sMpfcb[i].ulRow = 0;
        g_sMpfcb[i].ulBlksz = 0;
    }

    // init cyclic handler control block 
    for(i = 0; i < CYCHNDR_NUM; i++){
        mInitMember((T_NODE*)&(g_sCycHndrcb[i].pNxtTimeHndr));
        g_sCycHndrcb[i].fpPC = 0;   
        g_sCycHndrcb[i].cycact = 0;
        g_sCycHndrcb[i].tmmode = 0;
        g_sCycHndrcb[i].Iniltime = 0;  
        g_sCycHndrcb[i].Iniutime = 0;  
        g_sCycHndrcb[i].ltime = 0;
        g_sCycHndrcb[i].utime = 0;
        g_sCycHndrcb[i].ubHndrStat = 0;
    }

    // init alarm handler control block 
    for(i = 0; i < ALMHNDR_NUM; i++){
        mInitMember((T_NODE*)&(g_sAlmHndrcb[i].pNxtTimeHndr));
        g_sAlmHndrcb[i].fpPC = 0;   
        g_sAlmHndrcb[i].cycact = 0;
        g_sAlmHndrcb[i].tmmode = 0;
        g_sAlmHndrcb[i].Iniltime = 0;  
        g_sAlmHndrcb[i].Iniutime = 0;  
        g_sAlmHndrcb[i].ltime = 0;
        g_sAlmHndrcb[i].utime = 0;
        g_sAlmHndrcb[i].ubHndrStat = 0;
    }
*/
    isSystemStart = FALSE;
    unl_cpu();
}

//------------------------------------------------------------------------------
// Function name  : sys_sta
// Description    :
// No return value
// No argument
// Remarks        :
// So also        :
//------------------------------------------------------------------------------
void sys_sta( void )
{
    isSystemStart = TRUE;
    ContextSwitch( );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -