📄 mk_outp.c
字号:
/*+MHDR*/
/*
# clearcase: CmicroRel2.3
+------------------------------------------------------------------------------+
| Modulname : MK_OUTP.C |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| Description : |
| This Module exports functions which represent |
| |
| - the SDL-Output-Symbol. |
| - a non SDL-like Broadcast mechanism |
| |
| In order to scale the Cmicro Kernel, more than one C-function representing |
| SDL-Output is available. |
| |
| For scaling facilities see manual. |
| |
| M1 Errormessages, which are routed to the ErrorHandler |
| -------------------------------------------------------- |
| ERR_N_SEND_TO_NULLPID Errorcheck is conditionally compiled |
| ERR_N_PID_INDEX Errorcheck is conditionally compiled |
| ERR_N_NO_REC_AVAIL Errorcheck is conditionally compiled |
| ERR_N_xOutEnv |
| |
| M2 Exported functions of this module : |
| -------------------------------------------------------- |
| ... xmk_SendSimple ( xmk_T_SIGNAL sig, argument list depends on defines )|
| ... xmk_Send ( xmk_T_SIGNAL sig, argument list depends on defines )|
| xPID xmk_Determine_Receiver ( unsigned char proc_type ) |
| |
| M3 Static functions of this module : |
| -------------------------------------------------------- |
| - none - |
| |
+------------------------------------------------------------------------------+
*/
/*-MHDR*/
/*
+------------------------------------------------------------------------------+
| |
| Copyright by Telelogic AB 1993 - 1998 |
| Copyright by S&P Media GmbH Germany 1993 - 1998 |
| |
| This Program is owned by Telelogic and is protected by national |
| copyright laws and international copyright treaties. Telelogic |
| grants you the right to use this Program on one computer or in |
| one local computer network at any one time. |
| Under this License you may only modify the source code for the purpose |
| of adapting it to your environment. You must reproduce and include |
| any copyright and trademark notices on all copies of the source code. |
| You may not use, copy, merge, modify or transfer the Program except as |
| provided in this License. |
| Telelogic does not warrant that the Program will meet your |
| requirements or that the operation of the Program will be |
| uninterrupted and error free. You are solely responsible that the |
| selection of the Program and the modification of the source code |
| will achieve your intended results and that the results are actually |
| obtained. |
| |
+------------------------------------------------------------------------------+
*/
#ifndef __MK_OUTP_C_
#define __MK_OUTP_C_
/*+IMPORT*/
/*==================== I M P O R T =========================================*/
#include "ml_typw.h"
/*-------------------- Variables -----------------------------------------*/
#ifndef NO_GLOBAL_VARS
/* Modified by GBU,990518 */
extern XCONST XPDTBL xmk_ROM_ptr xPDTBL[MAX_SDL_PROCESS_TYPES+1];
#ifdef XMK_ADD_REALTIME_PLAY
extern xmk_T_TIME xmk_StartupTime ;
#endif
#endif
/*============================================================================*/
/*-IMPORT*/
/*+MGG*/
/*==================== V A L U E S O F T H I S M O D U L E =============*/
/*-------------------- Constants, Macros ----------------------------------*/
/*
** Have to differentiate between output for
** timer or ordinary SDL signal
*/
#define OUTPUT_IS_NOT_A_TIMER (sig > MAX_SDL_TIMER_TYPES)
#define OUTPUT_IS_A_TIMER (sig <= MAX_SDL_TIMER_TYPES)
/*
** Make xmk_Send functions using a return value or not
** This is only necessary for some testing purposes.
** The functions performs all possible error checks and
** calls the ErrorHandler() appropriately ...
*/
#define XMK_USE_NO_RET_VAL
#ifdef XMK_USE_NO_RET_VAL
/*
** xmk_Send returns no value
*/
#define RETDCL void
#define RETURN(val) return
#else
/*
** xmk_Send returns a value
*/
#define RETDCL int
#define RETURN(val) return (val)
#endif
#ifdef XMK_ADD_PRINTF_ADDITIONAL
#define STDOUT_WRITE_SIG(sig) \
PRINTF (("xmk_Send()#Signal-ID : %d\n", sig));
#ifdef XMK_USE_SIGNAL_PRIORITIES
#define STDOUT_WRITE_PRIO(prio) \
PRINTF (("xmk_Send()#Signal-Prio: %d\n", prio));
#else
#define STDOUT_WRITE_PRIO(prio)
#endif
#define STDOUT_WRITE_SEND(send) \
xxmonPID ("xmk_Send()#Sender :", send);
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
#define STDOUT_WRITE_REC(rec) \
xxmonPID ("xmk_Send()#Receiver :", rec);
#else
#define STDOUT_WRITE_REC(rec)
#endif
#ifdef XMK_USED_SIGNAL_WITH_PARAMS
#define STDOUT_WRITE_DATA(len,pdata) \
PRINTF (("xmk_Send()#Signal-len : %d\n", len)); \
if (len != 0) \
{ \
PRINTF (("xmk_Send()#Signal with parameters\n")); \
xxmonhexasc (STDOUT,"Unformatted Parameterarea:\n", "", pdata, (int) len); \
} \
else \
{ \
PRINTF (("xmk_Send()#Signal w/o parameters\n")); \
}
#else
#define STDOUT_WRITE_DATA(len,pdata)
#endif
#endif /* ... XMK_ADD_PRINTF_ADDITIONAL */
/*
** Automatic and manual scaling possibilities
** -- internal definitions --
*/
#ifdef XMK_USE_SIGNAL_PRIORITIES
#define XCOND_PRIO(prio) prio
#else
#define XCOND_PRIO(prio) XMK_DUMMYPRIO
#endif
#ifdef XMK_USE_SIGNAL_TIME_STAMP
#define XCOND_TIMESTAMP(stamp) stamp
#else
#define XCOND_TIMESTAMP(stamp) 0
#endif
#ifdef XMK_USED_SIGNAL_WITH_PARAMS
#define XCOND_DATA_LEN(data_len) data_len
#define XCOND_DATA(p_data) p_data
#else
#define XCOND_DATA_LEN(data_len) 0
#define XCOND_DATA(p_data) (void *) NULL
#endif
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
#define XCOND_RECEIVER(Receiver) Receiver
#else
#define XCOND_RECEIVER(Receiver) xRouteSignal(sig)
#endif
/*
** Switch off any error check
*/
#ifdef XMK_USE_NO_ERR_CHECK
#define ErrorHandler(errnum)
#endif
/*-------------------- Typedefinitions ----------------------------------*/
/*-------------------- Functions ------------------------------------------*/
/*-------------------- Variables -----------------------------------------*/
/*============================================================================*/
/*-MGG*/
#ifdef XMK_USE_xmk_SendSimple
/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
| Functionname : xmk_SendSimple |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| Description : |
| This is a quite simple SDL-Output Function, which needs only 2 Parameters |
| if called. Most SDL-Systems consist of a lot of "normal" Signals without |
| any Parameters and no priority. In most cases it makes sense to use |
| this simple Function, but if signal priorities are defined, these get lost. |
| |
| The Signal is put into the linked list of Signals by using a default- |
| Priority. |
| |
| Parameter : sig - Signal's code |
| Receiver - PID of the receiver-process |
| |
| Return : - |
| |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/
/*+FDEF E*/
#ifndef XNOPROTO
/*
** Use ANSI Style
*/
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
void xmk_SendSimple ( xmk_T_SIGNAL sig, xPID Receiver )
#else
void xmk_SendSimple ( xmk_T_SIGNAL sig )
#endif
#else
/*
** Use K/R Style
*/
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
void xmk_SendSimple ( sig, Receiver )
xmk_T_SIGNAL sig;
xPID Receiver;
#else
void xmk_SendSimple ( sig )
xmk_T_SIGNAL sig;
#endif
#endif
/*-FDEF E*/
{
#ifdef XMK_ADD_PRINTF_OUTPUT
XMK_FUNCTION("xmk_SendSimple");
#endif
#ifdef XMK_USE_SIGNAL_PRIORITIES
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
/*
** A receiver PID is stored in each signal header ...
*/
XMK_SF (sig, xDefaultPrioSignal, 0, (void *) NULL, Receiver);
#else
/*
** No receiver PID is stored in any signal header ...
*/
XMK_SF (sig, xDefaultPrioSignal, 0, (void *) NULL, 0);
#endif
#else
#ifdef XMK_USE_RECEIVER_PID_IN_SIGNAL
/*
** A receiver PID is stored in each signal header ...
*/
XMK_SF (sig, XMK_DUMMYPRIO, 0, (void *) NULL, Receiver);
#else
/*
** No receiver PID is stored in any signal header ...
*/
XMK_SF (sig, XMK_DUMMYPRIO, 0, (void *) NULL, 0);
#endif
#endif /* ...XMK_USE_SIGNAL_PRIORITIES*/
#ifdef XMK_ADD_PRINTF_OUTPUT
XMK_TRACE_EXIT("xmk_SendSimple");
#endif
} /* END OF FUNCTION */
#endif /* ... XMK_USE_xmk_SendSimple */
/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
| Functionname : xmk_Send |
| Author : S&P Media GmbH Germany |
+------------------------------------------------------------------------------+
| |
| Description : |
| This function represents the basic SDL-Output-function with all necessary |
| parameters. The <signal-instance> to be created is put into the |
| <input-port> of the receiving process. |
| Normally, signals are transferred by using a signalheader plus an area of |
| fixed length containing the <signal-parameter>. If the length of parameters |
| for a signal exceeds the length of this "default"-area, a memory block |
| is allocated for the signal-parameters to be transferred. |
| If there is not enough memory, the ErrorHandler is called. |
| |
| Conditionally compiled error-Check : |
| If the receiver-PID is a NULL-PID, the ErrorHandler is called. |
| |
| Parameter : sig - signal's code |
| prio - signal's priority |
| data_len - number of bytes of the signal's parameter |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -