📄 midtask.c
字号:
/****************************************************************
** *
** FILE : MidTask.C *
** COPYRIGHT : (c) 2001 .Xiamen Yaxon NetWork CO.LTD *
** *
** *
** By : CCH 2002.1.15 *
****************************************************************/
#define MIDTASK_GLOBALS
#include "includes.h"
#include "tools.h"
#include "message.h"
#include "midtask.h"
#if EN_LCD > 0
#include "lcddrv.h"
#endif
#include "watchdog.h"
#define SIZE_MSGBUF 20
static OS_QMSG MsgBuf[SIZE_MSGBUF];
static OS_STK MidTaskStack[STACK_MIDTASK];
static INT8U wdgid;
/*
********************************************************************************
* Handler: MSG_MIDTASK_PHONEFREE
********************************************************************************
*/
static void HdlMsg_MIDTASK_PHONEFREE(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_PHONERING
********************************************************************************
*/
static void HdlMsg_MIDTASK_PHONERING(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_PHONECONNECT
********************************************************************************
*/
static void HdlMsg_MIDTASK_PHONECONNECT(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_STOPPHONE
********************************************************************************
*/
static void HdlMsg_MIDTASK_STOPPHONE(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_TESTALARMERFAILURE
********************************************************************************
*/
static void HdlMsg_MIDTASK_TESTALARMERFAILURE(void)
{
#if EN_LCD
InformLCD_CheckAlarmResult(); //yyy
#endif
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_TESTALARMERSUCCESS
********************************************************************************
*/
static void HdlMsg_MIDTASK_TESTALARMERSUCCESS(void)
{
#if EN_LCD
InformLCD_CheckAlarmResult(); //yyy
#endif
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_EXITMAINTAIN
********************************************************************************
*/
static void HdlMsg_MIDTASK_EXITMAINTAIN(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_RECORDALARM, LMsgPara = alarm type
********************************************************************************
*/
static void HdlMsg_MIDTASK_RECORDALARM(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_SENSORCHANGE, LMsgPara = sensor status HMsgPara = trigger status
********************************************************************************
*/
static void HdlMsg_MIDTASK_SENSORCHANGE(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_NOSIMCARD
********************************************************************************
*/
static void HdlMsg_MIDTASK_NOSIMCARD(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_NONETWORK
********************************************************************************
*/
static void HdlMsg_MIDTASK_NONETWORK(void)
{
}
/*
********************************************************************************
* Handler: MSG_MIDTASK_SEARCHNETWORK
********************************************************************************
*/
static void HdlMsg_MIDTASK_SEARCHNETWORK(void)
{
}
static FUNCENTRY_STRUCT functionentry[] = { MSG_MIDTASK_PHONEFREE, HdlMsg_MIDTASK_PHONEFREE,
MSG_MIDTASK_PHONERING, HdlMsg_MIDTASK_PHONERING,
MSG_MIDTASK_PHONECONNECT, HdlMsg_MIDTASK_PHONECONNECT,
MSG_MIDTASK_STOPPHONE, HdlMsg_MIDTASK_STOPPHONE,
MSG_MIDTASK_TESTALARMERFAILURE, HdlMsg_MIDTASK_TESTALARMERFAILURE,
MSG_MIDTASK_TESTALARMERSUCCESS, HdlMsg_MIDTASK_TESTALARMERSUCCESS,
MSG_MIDTASK_EXITMAINTAIN, HdlMsg_MIDTASK_EXITMAINTAIN,
MSG_MIDTASK_RECORDALARM, HdlMsg_MIDTASK_RECORDALARM,
MSG_MIDTASK_SENSORCHANGE, HdlMsg_MIDTASK_SENSORCHANGE,
MSG_MIDTASK_NOSIMCARD, HdlMsg_MIDTASK_NOSIMCARD,
MSG_MIDTASK_NONETWORK, HdlMsg_MIDTASK_NONETWORK,
MSG_MIDTASK_SEARCHNETWORK, HdlMsg_MIDTASK_SEARCHNETWORK
};
static void MidTask(void *pd)
{
pd = pd;
wdgid = ApplyWatchDogID();
for(;;) {
if (OSQPend(MidTaskMsgQue, 20, &MidCurMsg) == OS_NO_ERR) {
FindProcEntry(MidCurMsg.MsgID, functionentry, sizeof(functionentry)/sizeof(functionentry[0]));
}
ResetWatchDog(wdgid);
}
}
void CreateMidTask(void)
{
MidTaskMsgQue = OSQCreate(MsgBuf, sizeof(MsgBuf)/sizeof(MsgBuf[0]));
OSTaskCreate(MidTask, (void *)0, &MidTaskStack[STACK_MIDTASK], PRIO_MIDTASK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -