gonzui


Format: Advanced Search

mtkernel_3/kernel/tkernel/misc_calls.cbare sourcepermlink (0.02 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    micro T-Kernel 3.00.01
    4:  *
    5:  *    Copyright (C) 2006-2020 by Ken Sakamura.
    6:  *    This software is distributed under the T-License 2.2.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by TRON Forum(http://www.tron.org) at 2020/05/29.
   10:  *
   11:  *----------------------------------------------------------------------
   12:  */
   13: 
   14: /*
   15:  *      misc_calls.c
   16:  *      Other System Calls
   17:  */
   18: 
   19: #include "kernel.h"
   20: #include "check.h"
   21: 
   22: 
   23: #ifdef USE_FUNC_TK_REF_SYS
   24: /*
   25:  * Refer system state
   26:  */
   27: SYSCALL ER tk_ref_sys( T_RSYS *pk_rsys )
   28: {
   29:         BOOL   b_qtsk;
   30: 
   31:         if ( in_indp() ) {
   32:                 pk_rsys->sysstat = TSS_INDP;
   33:         } else {
   34:                 BEGIN_DISABLE_INTERRUPT;
   35:                 b_qtsk = in_qtsk();   
   36:                 END_DISABLE_INTERRUPT;
   37:                 
   38:                 if ( b_qtsk ) {
   39:                         pk_rsys->sysstat = TSS_QTSK;
   40:                 } else {
   41:                         pk_rsys->sysstat = TSS_TSK;
   42:                 }
   43:                 if ( in_loc() ) {
   44:                         pk_rsys->sysstat |= TSS_DINT;
   45:                 }
   46:                 if ( in_ddsp() ) {
   47:                         pk_rsys->sysstat |= TSS_DDSP;
   48:                 }
   49:         }
   50:         pk_rsys->runtskid = ( knl_ctxtsk != NULL )? knl_ctxtsk->tskid: 0;
   51:         pk_rsys->schedtskid = ( knl_schedtsk != NULL )? knl_schedtsk->tskid: 0;
   52: 
   53:         return E_OK;
   54: }
   55: #endif /* USE_FUNC_TK_REF_SYS */
   56: 
   57: #ifdef USE_FUNC_TK_REF_VER
   58: /*
   59:  * Refer version information
   60:  *      If there is no kernel version information,
   61:  *      set 0 in each information. (Do NOT cause errors.)
   62:  */
   63: SYSCALL ER tk_ref_ver( T_RVER *pk_rver )
   64: {
   65:         pk_rver->maker = (UH)VER_MAKER;        /* OS manufacturer */
   66:         pk_rver->prid  = (UH)VER_PRID; /* OS identification number */
   67:         pk_rver->spver = (UH)VER_SPVER;        /* Specification version */
   68:         pk_rver->prver = (UH)VER_PRVER;        /* OS product version */
   69:         pk_rver->prno[0] = (UH)VER_PRNO1;      /* Product number */
   70:         pk_rver->prno[1] = (UH)VER_PRNO2;      /* Product number */
   71:         pk_rver->prno[2] = (UH)VER_PRNO3;      /* Product number */
   72:         pk_rver->prno[3] = (UH)VER_PRNO4;      /* Product number */
   73: 
   74:         return E_OK;
   75: }
   76: #endif /* USE_FUNC_TK_REF_VER */
   77: 
   78: /* ------------------------------------------------------------------------ */
   79: /*
   80:  *      Debugger support function
   81:  */
   82: #if USE_DBGSPT
   83: 
   84: #ifdef USE_FUNC_TD_REF_SYS
   85: /*
   86:  * Refer system state
   87:  */
   88: SYSCALL ER td_ref_sys( TD_RSYS *pk_rsys )
   89: {
   90:         BOOL   b_qtsk;
   91: 
   92:         if ( in_indp() ) {
   93:                 pk_rsys->sysstat = TSS_INDP;
   94:         } else {
   95:                 BEGIN_DISABLE_INTERRUPT;
   96:                 b_qtsk = in_qtsk();   
   97:                 END_DISABLE_INTERRUPT;
   98:                 
   99:                 if ( b_qtsk ) {
  100:                         pk_rsys->sysstat = TSS_QTSK;
  101:                 } else {
  102:                         pk_rsys->sysstat = TSS_TSK;
  103:                 }
  104:                 if ( in_loc() ) {
  105:                         pk_rsys->sysstat |= TSS_DINT;
  106:                 }
  107:                 if ( in_ddsp() ) {
  108:                         pk_rsys->sysstat |= TSS_DDSP;
  109:                 }
  110:         }
  111:         pk_rsys->runtskid = ( knl_ctxtsk != NULL )? knl_ctxtsk->tskid: 0;
  112:         pk_rsys->schedtskid = ( knl_schedtsk != NULL )? knl_schedtsk->tskid: 0;
  113: 
  114:         return E_OK;
  115: }
  116: #endif /* USE_FUNC_TD_REF_SYS */
  117: 
  118: #endif /* USE_DBGSPT */