⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mk_user.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
/*+MHDR*/
/*
# clearcase: CmicroRel2.3


+------------------------------------------------------------------------------+
|  Modulname    : MK_USER.C                                                    |
|  Author       : S&P Media GmbH Germany                                       |
+------------------------------------------------------------------------------+
|                                                                              |
|  Description :                                                               |
|    This module contains functions, which are to be filled up by the user.    |
|                                                                              |
|    These are :                                                               |
|                                                                              |
|    1.Functions for the environment-handling                                  |
|      xInitEnv ()    - Only if the generated environment env.c is not used!   |
|      xInEnv   ()    - Only if the generated environment env.c is not used!   |
|      xOutEnv  ()    - Only if the generated environment env.c is not used!   |
|      xCloseEnv()    - Only if the generated environment env.c is not used!   |
|                                                                              |
|    2.Functions for central errorhandling                                     |
|      ErrorHandler ()                                                         |
|      xSDLOpError  ()                                                         |
|                                                                              |
|    3.Functions for the Cmicro Kernel (optional in order to optimize)         |
|      xRouteSignal ()                                                         |
|                                                                              |
|    4.Functions to trigger a hardware-Watchdog                                |
|      WatchdogTrigger ()                                                      |
|                                                                              |
+------------------------------------------------------------------------------+
*/
/*-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.                                                                   |
|                                                                              |
+------------------------------------------------------------------------------+
*/

/*+IMPORT*/
/*====================  I M P O R T  =========================================*/
#include "ml_typw.h"


#ifdef XSYSID 
  /* 
  ** CAUTION ! 
  ** ============ 
  ** This module cannot be used when partitioning is used. The reason 
  ** for this is that the functions of this module operate on global 
  ** variables and partitioned systems may preempt each other when 
  ** an Real Time Operating System is used. 
  ** However, users can use this module as a basis for implementing 
  ** their own environment function.  
  */ 
  #error "ERROR_in_mk_user_c_Module_cannot_be_used_for_Partitioning" 
#endif /* ... XSYSID */ 

#ifdef XMK_NO_GENERATED_ENV
  #error "It_is_recommended_to_include_the_file<systemname>.ifc_here_See_mk_user.c"
#endif

/*============================================================================*/
/*-IMPORT*/


/*+MGG*/
/*====================  V A L U E S  O F  T H I S   M O D U L E  =============*/

/*--------------------  Constants,  Macros  ----------------------------------*/

/*---+---------------------------------------------------------------
     Check automatically generated #ifdef
-------------------------------------------------------------------*/
#if defined(XMK_IFC_TIME) && defined(XMK_CFG_TIME)
  #if XMK_IFC_TIME != XMK_CFG_TIME
    /*
    ** If the following line is compiled/leads to an error during
    ** compilation, then the generated systemname.ifc file does not match with
    ** the generated sdl_cfg.h file. You should newly generate C code
    ** and be sure that each of the generated C files and the symbolfile
    ** is used appropriately
    */
    #error "ERROR_IllegalFileConfiguration_ifc_and_sdl_cfg_file_See_mk_user.c"
  #endif
#endif
 

/*--------------------  Typedefinitions     ----------------------------------*/

/*--------------------  Functions    -----------------------------------------*/

/*--------------------  Variables    -----------------------------------------*/
#ifndef NO_GLOBAL_VARS
  #ifdef XMK_ADD_CQUERY_ERROR
    xmk_T_ERR_NUM xmk_LastStoredError = 0;
  #endif
#endif

/*============================================================================*/
/*-MGG*/


#ifdef XMK_NO_GENERATED_ENV 

#ifdef XMK_USE_xInitEnv

/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
|  Functionname : xInitEnv                                                     |
|  Author       : S&P Media GmbH Germany                                       |
+------------------------------------------------------------------------------+
|                                                                              |
|  Description :                                                               |
|  This function is called by the Cmicro Kernel during initialization of the   |
|  SDL-System.                                                                 |
|                                                                              |
|  Parameter    : -                                                            |
|                                                                              |
|  Return       : -                                                            |
|                                                                              |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/

/*+FDEF E*/

#ifndef XNOPROTO
   /* ANSI - Style */
   void xInitEnv (void)
#else
   /* Kernighan-Ritchie-Style */
   void xInitEnv ()
#endif

/*-FDEF E*/
{

  #ifdef XMK_ADD_PRINTF_USER
    XMK_FUNCTION("xInitEnv");
  #endif
  
  /*
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E
  */

      /* ........................................... */
      /* ... Init all interfaces+the environment ... */
      /* ... here .............................. ... */
      /* ........................................... */
  xInitEnv_is_not_filled_yet = 0;

  /* 
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E 
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E
  */ 

  #ifdef XMK_ADD_PRINTF_USER
    XMK_TRACE_EXIT("xInitEnv");
  #endif

} /* END OF FUNCTION */

#endif /* ... XMK_USE_xInitEnv */

#endif /* ... XMK_NO_GENERATED_ENV */
 

#ifdef XMK_NO_GENERATED_ENV 

#ifdef XMK_USE_xInEnv

/*+FHDR E*/
/*
+------------------------------------------------------------------------------+
|  Functionname : xInEnv                                                       |
|  Author       : S&P Media GmbH Germany                                       |
+------------------------------------------------------------------------------+
|                                                                              |
|  Description :                                                               |
|  This function is called by the Cmicro Kernel continuously to retrieve       |
|  signals polled from the Environment.                                        |
|                                                                              |
|  Use the Macro XMK_SEND_ENV() to send signals into the SDL system.           |
|                                                                              |
|  The use of xInEnv() is not absolutely necessary in the case, where          |
|  the Cmicro Kernel is scaled to preemption, and all external Events are      |
|  put into the SDL-System via an Interrupt Service Routine, which is to be    |
|  written by the user.                                                        |
|                                                                              |
|  Parameter    : -                                                            |
|                                                                              |
|  Return       : -                                                            |
|                                                                              |
+------------------------------------------------------------------------------+
*/
/*-FHDR E*/

/*+FDEF E*/

#ifndef XNOPROTO
   /* ANSI - Style */
   void xInEnv (void)
#else
   /* Kernighan-Ritchie-Style */
   void xInEnv ()
#endif

/*-FDEF E*/
{

  /*
  ** Define some temporary variables for XMK_SEND_ENV here ...
  */
  XMK_SEND_TMP_VARS

  #ifdef XMK_ADD_PRINTF_USER
    XMK_FUNCTION("xInEnv");
  #endif /* ... XMK_ADD_PRINTF_USER */

  #ifdef XMK_ADD_PRINTF_ADDITIONAL
    PRINTF (("Environment-Signale are not implemented (xInEnv).\n"));
    PRINTF (("(nothing was read from the environment)\n"));
  #endif /* ... XMK_ADD_PRINTF_USER */

  /*
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E 
  ** P L E A S E _ M O D I F Y _ T H E _ F O L L O W I N G _ C O D E
  **
  ** In the following the identifiers mean:
  ** sender-pid   : the environment use the macro ENV
  ** signal-id    : the pid of the signal. Get it from the file <systemname>.ifc
  ** priority     : in most cases the default priority xDefaultPrioSignal can be used here
  ** parameter-length  :  the length of the parameters in counted in characters
  **                      e.g. use sizeof()
  ** pointer-to-signal-parameters  :  the address of the parameters
  ** receiver-pid : the pid of the receiver process. Get it from the file sdl_cfg.h
  */
 
  if (i_got_a_signal_from_source1)
  {
     /* ........................................... */
     /* ... Set Signal-Parameters ................. */
     /* ........................................... */
     XMK_SEND_ENV(sender-pid,
                  signal-id,
                  priority,
                  parameter-length,
                  pointer-to-signal-parameters,
                  GLOBALPID(receiver-pid,0));

     #ifdef XMK_ADD_PRINTF_USER
           XMK_TRACE_EXIT("xInEnv");
     #endif

     return ;

  }
  else if (i_got_a_signal_from_source2)
  {

     /* ........................................... */
     /* ... Set Signal-Parameters ................. */
     /* ........................................... */
     XMK_SEND_ENV(sender-pid,
                  signal-id,
                  priority,
                  parameter-length,
                  pointer-to-signal-parameters,
                  GLOBALPID(receiver-pid,0));

     #ifdef XMK_ADD_PRINTF_USER
           XMK_TRACE_EXIT("xInEnv");
     #endif

     return ;
  }
  else
  {

     #ifdef XMK_ADD_PRINTF_USER
           XMK_TRACE_EXIT("xInEnv");
     #endif

     return;
  }

  /*
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E 
  ** P L E A S E _ M O D I F Y _ T H E _ P R E V I O U S _ C O D E 
  */

} /* END OF FUNCTION */

#endif /* ... XMK_USE_xInEnv */

#ifdef XMK_USE_xOutEnv

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -