📄 mk_queu.c
字号:
/*
** assign parameter State to signal's state
*/
(XMK_CURRENTSIGNAL)->SaveState = State ;
} /* END IF */
XMK_END_CRITICAL_PATH;
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_TestAndSetSaveState");
#endif
return( match ) ;
} /* END OF FUNCTION */
#endif /* XMK_USED_SAVE */
#if defined ( XMK_USED_SAVE ) && defined ( XMK_USE_EXPANDED_KERNEL )
/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
| Functionname : xmk_SaveSignalsOnly |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| Description : |
| This function tests whether there only are SAVE signals contained in |
| the queue. This can be used in integrations with operating systems. |
| |
| The function returns XMK_TRUE, if there are SAVE signals only in the |
| queue, otherwise it returns XMK_FALSE. |
| |
| Parameter : - |
| |
| Return : XMK_TRUE - SAVE-signals in the queue only |
| |
| XMK_FALSE - at least one not SAVE signal is in the queue |
| |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/
/*+FDEF E*/
#ifndef XNOPROTO
xmk_T_BOOL xmk_SaveSignalsOnly ( void )
#else
xmk_T_BOOL xmk_SaveSignalsOnly ( )
#endif
/*-FDEF E*/
{
X_REGISTER xmk_T_BOOL match = XMK_TRUE ;
X_REGISTER T_E_SIGNAL xmk_RAM_ptr xmk_RAM_ptr rover ;
xmk_T_STATE State;
#ifdef XMK_USE_PREEMPTIVE
X_REGISTER xmk_OPT_INT level;
#endif
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_FUNCTION("xmk_SaveSignalsOnly");
#endif
XMK_BEGIN_CRITICAL_PATH;
#ifdef XMK_USE_PREEMPTIVE
/*
** For all the priority levels
*/
for (level = 0; level < MAX_PRIO_LEVELS; level++)
{
match = XMK_TRUE;
rover = &Prio_Queue[level];
#else
rover = &xmk_Queue;
if ( *rover == (T_E_SIGNAL *) NULL )
{
match = XMK_FALSE;
}
#endif
/*
** While there are signals in the queue
** and all of them are saved
*/
while( ( *rover != (T_E_SIGNAL xmk_RAM_ptr) NULL ) && ( match ) )
{
/*
** Get signal receiver's state
*/
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
State = xmk_GetProcessState( (*rover)->Signal.rec);
#else
State = xmk_GetProcessState(xRouteSignal( (*rover)->Signal.signal ));
#endif
if ( State != XNOTEXISTENT)
{
/*
** Test if signal's save state equals receiver's State
*/
match = ( (*rover)->SaveState == State ) ;
/*
** Set signal pointer to next signal
*/
rover = &((*rover)->next);
}
else
{
/*
** A signal not being saved is found
** Here, the environment is receiver of the signal or
** an invalid receiver ID is given.
*/
match = XMK_FALSE;
} /* END IF */
} /* END WHILE */
#ifdef XMK_USE_PREEMPTIVE
if (! match)
break;
/*
** next priority level
*/
}
#endif
XMK_END_CRITICAL_PATH;
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_SaveSignalsOnly");
#endif
return( match ) ;
} /* END OF FUNCTION */
#endif /* XMK_USED_SAVE && XMK_USE_EXPANDED_KERNEL */
#ifdef XMK_USE_SDL_SYSTEM_STOP
/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
| Functionname : xmk_QueueEmpty |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| Description : |
| This function tests whether there is a signal remaining in the queue(s) |
| or not. |
| |
| The function returns XMK_TRUE, if there are no signals in the queue, but |
| returns XMK_FALSE if there is at least one signal in the queue. It does not |
| matter if the signal is a saved signal or not. When the Cmicro Kernel is |
| configured for preemption, all the queues of the different priority levels |
| are checked. |
| |
| Parameter : void |
| |
| Return : XMK_TRUE - There is no signal in any queue |
| XMK_FALSE - At least one signal is in any queue |
| |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/
/*+FDEF E*/
#ifndef XNOPROTO
xmk_T_BOOL xmk_QueueEmpty ( void )
#else
xmk_T_BOOL xmk_QueueEmpty ( )
#endif
/*-FDEF E*/
{
#ifdef XMK_USE_PREEMPTIVE
X_REGISTER xmk_OPT_INT i;
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_FUNCTION("xmk_QueueEmpty");
#endif
/*
** if there are no more signals on any prio-level
*/
for (i=0; i < MAX_PRIO_LEVELS; i++)
{
if (Prio_Queue[i] != (T_E_SIGNAL xmk_RAM_ptr) NULL)
{
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_QueueEmpty");
#endif
return ( XMK_FALSE );
}
}
#else
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_FUNCTION("xmk_QueueEmpty");
#endif
/*
** If the queue doesn't equal NULL there is a signal
*/
if (xmk_Queue != (T_E_SIGNAL xmk_RAM_ptr) NULL)
{
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_QueueEmpty");
#endif
return( XMK_FALSE );
}
#endif
/*
** No signal in any queue
*/
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_QueueEmpty");
#endif
return ( XMK_TRUE );
} /* END OF FUNCTION */
#endif /* XMK_USE_SDL_SYSTEM_STOP */
#if defined(XMK_USE_EXPANDED_KERNEL) || (defined(XMK_USE_DEBUGGING) && defined(XMK_ADD_CQUERY_QUEUE))
/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
| Functionname : xmk_QueryQueue |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| |
| Description : |
| The function evaluates the current SDL-Queue-State and returns some |
| information to the caller : |
| * information about the size of the Q (maximum amount of entries) |
| * information about traffic load, measured till now. |
| Users can directly use this to scale the Q. This information |
| is valuable in the case, where the maximum traffic load is reached |
| one time during execution) . |
| * Information about : How many entries are currently in the Q ? |
| * A pointer to the physical Address of the Q. |
| |
| Parameter : xmk_Q_STATE *qinfo |
| |
| Return : - |
| |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/
/*+FDEF E*/
#ifndef XNOPROTO
void xmk_QueryQueue ( xmk_T_CMD_QUERY_QUEUE_CNF xmk_RAM_ptr qinfo )
#else
void xmk_QueryQueue ( qinfo )
xmk_T_CMD_QUERY_QUEUE_CNF xmk_RAM_ptr qinfo;
#endif
/*-FDEF E*/
{
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_FUNCTION("xmk_QueryQueue");
#endif
qinfo->max_allowed_entries = XMK_MAX_SIGNALS ;
#if defined(XMK_ADD_PROFILE) || defined(XMK_ADD_CQUERY_QUEUE)
qinfo->max_counter = xmk_max_q_cnt ;
qinfo->howmany = xmk_act_q_cnt ;
#else
qinfo->max_counter = -1 ;
qinfo->howmany = -1 ;
#endif
#if defined(IARC51) || defined(KEIL_C51)
qinfo->address = (long)(int) xmk_SignalArrayVar ;
#else
qinfo->address = (long) xmk_SignalArrayVar ;
#endif
#ifdef XMK_ADD_PRINTF
PRINTF (("Q-STATE:max_allowed_entries=%d\n", qinfo->max_allowed_entries));
PRINTF (("Q-STATE:max_counter =%d\n", qinfo->max_counter ));
PRINTF (("Q-STATE:howmany =%d\n", qinfo->howmany ));
PRINTF (("Q-STATE:address (hex) =%x\n", qinfo->address ));
#endif
#ifdef XMK_ADD_PRINTF_QUEUE
XMK_TRACE_EXIT("xmk_QueryQueue");
#endif
}
/*
+------------------------------------------------------------------------------+
+---------------------------- End of function ---------------------------------+
+------------------------------------------------------------------------------+
*/
#endif /* ...defined(XMK_USE_EXPANDED_KERNEL) || (defined(XMK_USE_DEBUGGING) && defined(XMK_ADD_CQUERY_QUEUE)) */
#endif /* __ML_QUEU_C_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -