📄 ext_work.c
字号:
/*
* Copyright 1994-2002 The MathWorks, Inc.
*
* File: ext_work.c $Revision: 1.9 $
*
* Abstract:
*
*/
/* modifications: (FW-02-03)
*
* (1) deleted unused conditional code sections (VXWORKS)
* (2) removed unused functions rtExtModePauseIfNeeded & rt_ExtModeCheckInit()
* (3) removed unused functions rt_ExtModeParseArgs() and all ERT functions
*
*/
#include <stdio.h>
#include <string.h> /* optional for strcmp */
#include <stdlib.h> /* for exit() */
#include "tmwtypes.h"
#include "simstruc_types.h"
#include "ext_share.h"
#include "updown.h"
#include "ext_svr.h"
#include "ext_svr_transport.h"
#include "ext_work.h"
// debug only (see: rtExtModeOneStep)
//#include "mc_signal.h"
int_T volatile startModel = FALSE;
TargetSimStatus volatile modelStatus = TARGET_STATUS_WAITING_TO_START;
#ifdef ERASE
/* Function ====================================================================
* Pause the process (w/o hogging the cpu) until receive step message (which
* means the startModel flag moves to true) or until we are no longer
* in the paused state. The message/upload server must continue to process
* events (otherwise the host would not be able to communicate with the target).
*/
void rtExtModePauseIfNeeded(RTWExtModeInfo *ei,
boolean_T *stopReqPtr)
{
while((modelStatus == TARGET_STATUS_PAUSED) &&
!startModel && !(*stopReqPtr)) {
/* this is currently an empty function call... (FW-02-03) */
rt_ExtModeSleep(0L, 375000L);
rt_MsgServerWork(ei,stopReqPtr);
rt_UploadServerWork();
}
startModel = FALSE; /* reset to FALSE - if we were stepped we want to
* stop again next time we get
* back here.
*/
} /* end rtExtModePauseIfNeeded */
#endif
/* Function ====================================================================
* Pause the process (w/o hogging the cpu) until receive start message
* from the host. The message/upload server must continue to process
* events (otherwise the host would not be able to communicate with the target).
*/
void rtExtModeWaitForStartMsg(RTWExtModeInfo *ei,
boolean_T *stopReqPtr)
{
/*
* Pause until receive model start message.
*/
//blinky(100000);
if (ExtWaitForStartMsg()) {
//blinky(100000);
while(!startModel && !(*stopReqPtr)) {
/* this is currently an empty function call... (FW-02-03) */
rt_ExtModeSleep(0L, 375000L);
(void)rt_MsgServerWork(ei,stopReqPtr);
//blinky(10000);
(void)rt_UploadServerWork();
}
}
if (modelStatus != TARGET_STATUS_PAUSED) {
modelStatus = TARGET_STATUS_RUNNING;
} else {
/* leave in pause mode */
}
}
void rtExtModeOneStep(RTWExtModeInfo *ei,
boolean_T *stopReqPtr)
{
/*
* In a multi-tasking environment, this would be removed from the base rate
* and called as a "background" task.
*/
(void)rt_MsgServerWork(ei,stopReqPtr);
(void)rt_UploadServerWork();
#ifdef ERASE
#ifdef LCDUSE4ERRORS
dispLCD_uint(n_onesteps++, "OneStep: ", 1);
#endif
#endif
}
void rtExtModeUpload(int_T tid, real_T taskTime)
{
UploadBufAddTimePoint(tid, taskTime);
}
void rtExtModeCheckEndTrigger(void)
{
UploadCheckEndTrigger();
}
void rtExtModeUploadCheckTrigger(void)
{
UploadCheckTrigger();
}
void rtExtModeShutdown(void)
{
(void)rt_ExtModeShutdown();
}
/* [EOF] ext_work.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -