📄 taskmain.c
字号:
/*******************************************************************************
*
* file name : main.c
*
* Copyright (C) SEIKO EPSON CORP. 2001
*
* This file implement PDA CELLULAR SYSTEM TASK
*
* Revision History
*
* 2001/05/23 Leon Zhong Start
* 2001/10/9 Pessia New taskmain()
********************************************************************************/
#include <string.h>
#include <kernel\ros33\ros33.h>
#include <sys\systsk.h>
#include <sys\taskdsp.h>
#include <sys\sysusr.h>
#include <sys\lmalloc.h>
#include <sys\systmr.h>
DWORD sys_stk[ STACK_SIZE ];
//DWORD tmr_stk[ STACK_SIZE ];
DWORD uart_stk[ STACK_SIZE ];
DWORD at_stk[ STACK_SIZE ];
DWORD idle_stk[ STACK_SIZE ];
extern BYTE array_memory[Heapsize];
extern void AsixTaskInit( void );
extern void StartService( TASKDESCRIPTIONLIST *desplst );
extern void InitialLCD( void );
extern void Idle( void );
extern void SysDevTableInit( void );
extern void Systask( void );
//extern void timer_task( void );
extern void UartServer( void );
extern void AtServer( void );
extern TASKDESCRIPTIONLIST TimerTskDespLst;
extern TASKDESCRIPTIONLIST UartServerDespLst;
extern TASKDESCRIPTIONLIST AtServerDespLst;
void idle_task( void )
{
while(1) {
#ifndef SIM_ON_PC
asm("halt");
#else
Idle();
#endif
}
}
void taskmain()
{
//int id;
memset( array_memory, 'e', Heapsize );
#if ENABLE_SYSMSG_STATISTIC
memset( gSysMsgSta, 0, sizeof(SYSMSG_STAT) * MLBX_NUM );
#endif
#if ENABLE_SYSFLG_STATISTIC
memset( gSysFlgSta, 0, sizeof(SYSFLG_STAT) * FLG_NUM );
#endif
#if ENABLE_SYSCALL_STATISTIC
memset( gSyscallSta, 0, sizeof(SYSCALL_STAT) * 63 );
#endif
sys_ini();
//timer_ini();
/* initial gloable arrays */
SysTcbTableInit();
/* Init table of device manage table */
// SysDevTableInit();
// Initial LCD
InitialLCD( );
/* create system and service task */
vcre_tsk( SYSTASK_ID, Systask, SYSTASK_PRI, (DWORD)&sys_stk[STACK_SIZE] );
gSysTcbTbl[SYSTASK_ID-1].status = DORMANT;
// vcre_tsk( TIMERTASK_ID, timer_task, TIMERTASK_PRI, (DWORD)&tmr_stk[STACK_SIZE] );
// gSysTcbTbl[TIMERTASK_ID-1].status = DORMANT;
// vcre_tsk( UARTSERVER_ID, UartServer, SERVICE_PRI, (DWORD)&uart_stk[STACK_SIZE] );
// gSysTcbTbl[UARTSERVER_ID-1].status = DORMANT;
vcre_tsk( ATSERVER_ID, AtServer, SERVICE_PRI, (DWORD)&at_stk[STACK_SIZE] );
gSysTcbTbl[ATSERVER_ID-1].status = DORMANT;
vcre_tsk( IDLETASK_ID, idle_task, IDLETASK_PRI, (DWORD)&idle_stk[STACK_SIZE] );
gSysTcbTbl[IDLETASK_ID-1].status = DORMANT;
/* create all application task and initial systcb table */
AsixTaskInit();
sta_tsk(IDLETASK_ID, 0); /* start idle task */
gSysTcbTbl[IDLETASK_ID-1].status = RUNNING;
sta_tsk(SYSTASK_ID, 0); /* start system task */
gSysTcbTbl[SYSTASK_ID-1].status = RUNNING;
// sta_tsk(TIMERTASK_ID, 0); /* start timer task */
// gSysTcbTbl[TIMERTASK_ID-1].status = RUNNING;
// sta_tsk(UARTSERVER_ID, 0); /* start uart service task */
// gSysTcbTbl[UARTSERVER_ID-1].status = RUNNING;
// sta_tsk(ATSERVER_ID, 0); /* start at service task */
// gSysTcbTbl[ATSERVER_ID-1].status = RUNNING;
StartService( &TimerTskDespLst ); // start timer task
StartService( &UartServerDespLst ); // start uart service task
StartService( &AtServerDespLst ); // start at service task
sys_sta();
}
/*********************************************
system timer interrupt
Set this function to inturrupt vector
16-bit Timer #5 compare B
*********************************************/
/*********************************************
16-bit Timer #5 compare B
system clock call by 1msec
*********************************************/
#ifndef SIM_ON_PC
void INT_16CMPB()
{
asm("xcall ent_int");
asm("pushn %r1"); // clear int factor flag
asm("xld.w %r1,0x40"); // TIMER16_5_IFLAG 0x00040284
asm("xld.w %r0,0x00040284");
asm("ld.w [%r0],%r1");
asm("popn %r1");
asm("xcall sys_clk");
asm("xcall ret_int");
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -