gonzui


Format: Advanced Search

tkernel_2/include/tk/syscall.hbare sourcepermlink (0.10 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by T-Engine Forum at 2013/04/16.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: 
   16: /*
   17:  *      @(#)syscall.h (T-Kernel)
   18:  *
   19:  *      T-Kernel/OS (Common parts)
   20:  */
   21: 
   22: #ifndef __TK_SYSCALL_H__
   23: #define __TK_SYSCALL_H__
   24: 
   25: #include <basic.h>
   26: #include <tk/typedef.h>
   27: 
   28: #ifdef __cplusplus
   29: extern "C" {
   30: #endif
   31: 
   32: /* Task creation */
   33: #define TSK_SELF        0              /* Its own task specify */
   34: #define TPRI_INI        0              /* Specify priority at task startup */
   35: #define TPRI_RUN        0              /* Specify highest priority during
   36:                                            running */
   37: 
   38: #define TA_ASM          0x00000000U     /* Program by assembler */
   39: #define TA_HLNG         0x00000001U    /* Program by high level programming
   40:                                            language */
   41: #define TA_SSTKSZ       0x00000002U   /* Set system stack size */
   42: #define TA_USERSTACK    0x00000004U        /* Set user stack size */
   43: #define TA_TASKSPACE    0x00000008U        /* Specify task space */
   44: #define TA_RESID        0x00000010U    /* Specify resource group */
   45: #define TA_DSNAME       0x00000040U   /* Use object name */
   46: 
   47: #define TA_RNG0         0x00000000U    /* Execute by protection level 0 */
   48: #define TA_RNG1         0x00000100U    /* Execute by protection level 1 */
   49: #define TA_RNG2         0x00000200U    /* Execute by protection level 2 */
   50: #define TA_RNG3         0x00000300U    /* Execute by protection level 3 */
   51: 
   52: #define TA_COP0         0x00001000U    /* Use coprocessor (ID=0) */
   53: #define TA_COP1         0x00002000U    /* Use coprocessor (ID=1) */
   54: #define TA_COP2         0x00004000U    /* Use coprocessor (ID=2) */
   55: #define TA_COP3         0x00008000U    /* Use coprocessor (ID=3) */
   56: 
   57: /* Task state tskstat */
   58: #define TTS_RUN         0x00000001U    /* RUN */
   59: #define TTS_RDY         0x00000002U    /* READY */
   60: #define TTS_WAI         0x00000004U    /* WAIT */
   61: #define TTS_SUS         0x00000008U    /* SUSPEND */
   62: #define TTS_WAS         0x0000000cU    /* WAIT-SUSPEND */
   63: #define TTS_DMT         0x00000010U    /* DORMANT */
   64: #define TTS_NODISWAI    0x00000080U        /* Wait disable rejection state */
   65: 
   66: /* Wait factor tskwait */
   67: #define TTW_SLP         0x00000001U    /* Wait caused by wakeup wait */
   68: #define TTW_DLY         0x00000002U    /* Wait caused by task delay */
   69: #define TTW_SEM         0x00000004U    /* Semaphore wait */
   70: #define TTW_FLG         0x00000008U    /* Event flag wait */
   71: #define TTW_MBX         0x00000040U    /* Mail box wait */
   72: #define TTW_MTX         0x00000080U    /* Mutex wait */
   73: #define TTW_SMBF        0x00000100U    /* Message buffer send wait */
   74: #define TTW_RMBF        0x00000200U    /* Message buffer receive wait */
   75: #define TTW_CAL         0x00000400U    /* Rendezvous call wait */
   76: #define TTW_ACP         0x00000800U    /* Rendezvous accept wait */
   77: #define TTW_RDV         0x00001000U    /* Rendezvous end wait */
   78: #define TTW_MPF         0x00002000U    /* Fixed size memory pool wait */
   79: #define TTW_MPL         0x00004000U    /* Variable size memory pool wait */
   80: #define TTW_EV1         0x00010000U    /* Task event # 1 wait */
   81: #define TTW_EV2         0x00020000U    /* Task event # 2 wait */
   82: #define TTW_EV3         0x00040000U    /* Task event # 3 wait */
   83: #define TTW_EV4         0x00080000U    /* Task event # 4 wait */
   84: #define TTW_EV5         0x00100000U    /* Task event # 5 wait */
   85: #define TTW_EV6         0x00200000U    /* Task event # 6 wait */
   86: #define TTW_EV7         0x00400000U    /* Task event # 7 wait */
   87: #define TTW_EV8         0x00800000U    /* Task event # 8 wait */
   88: 
   89: #define TTX_SVC         0x80000000U    /* Extended SVC call disable
   90:                                            (tk_dis_wai) */
   91: 
   92: /* Semaphore generation */
   93: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
   94: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
   95:                                            order */
   96: #define TA_FIRST        0x00000000U    /* Give priority to task at head of
   97:                                            wait queue */
   98: #define TA_CNT          0x00000002U     /* Give priority to task whose
   99:                                            request counts is less */
  100: #define TA_DSNAME       0x00000040U   /* Use object name */
  101: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  102: 
  103: /* Mutex */
  104: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  105: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  106:                                            order */
  107: #define TA_INHERIT      0x00000002U  /* Priority inherited protocol */
  108: #define TA_CEILING      0x00000003U  /* Upper limit priority protocol */
  109: #define TA_DSNAME       0x00000040U   /* Use object name */
  110: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  111: 
  112: /* Event flag */
  113: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  114: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  115:                                            order */
  116: #define TA_WSGL         0x00000000U    /* Disable multiple tasks wait */
  117: #define TA_WMUL         0x00000008U    /* Enable multiple tasks wait */
  118: #define TA_DSNAME       0x00000040U   /* Use object name */
  119: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  120: 
  121: /* Event flag wait mode */
  122: #define TWF_ANDW        0x00000000U    /* AND wait */
  123: #define TWF_ORW         0x00000001U    /* OR wait */
  124: #define TWF_CLR         0x00000010U    /* All clear specify */
  125: #define TWF_BITCLR      0x00000020U  /* Only condition bit clear specify */
  126: 
  127: /* Mail box */
  128: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  129: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  130:                                            order */
  131: #define TA_MFIFO        0x00000000U    /* Manage messages by FIFO */
  132: #define TA_MPRI         0x00000002U    /* Manage messages by priority
  133:                                            order */
  134: #define TA_DSNAME       0x00000040U   /* Use object name */
  135: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  136: 
  137: /* Message buffer */
  138: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  139: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  140:                                            order */
  141: #define TA_DSNAME       0x00000040U   /* Use object name */
  142: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  143: 
  144: /* Rendezvous */
  145: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  146: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  147:                                            order */
  148: #define TA_DSNAME       0x00000040U   /* Use object name */
  149: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  150: 
  151: /* Handler */
  152: #define TA_ASM          0x00000000U     /* Program by assembler */
  153: #define TA_HLNG         0x00000001U    /* Program by high level programming
  154:                                            language */
  155: 
  156: /* Variable size memory pool */
  157: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  158: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  159:                                            order */
  160: #define TA_NORESIDENT   0x00000010U       /* Non resident */
  161: #define TA_DSNAME       0x00000040U   /* Use object name */
  162: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  163: #define TA_RNG0         0x00000000U    /* Protection level 0 */
  164: #define TA_RNG1         0x00000100U    /* Protection level 1 */
  165: #define TA_RNG2         0x00000200U    /* Protection level 2 */
  166: #define TA_RNG3         0x00000300U    /* Protection level 3 */
  167: 
  168: /* Fixed size memory pool */
  169: #define TA_TFIFO        0x00000000U    /* Manage wait task by FIFO */
  170: #define TA_TPRI         0x00000001U    /* Manage wait task by priority
  171:                                            order */
  172: #define TA_NORESIDENT   0x00000010U       /* Non-resident */
  173: #define TA_DSNAME       0x00000040U   /* Use object name */
  174: #define TA_NODISWAI     0x00000080U /* Wait disable rejection */
  175: #define TA_RNG0         0x00000000U    /* Protection level 0 */
  176: #define TA_RNG1         0x00000100U    /* Protection level 1 */
  177: #define TA_RNG2         0x00000200U    /* Protection level 2 */
  178: #define TA_RNG3         0x00000300U    /* Protection level 3 */
  179: 
  180: /* Cycle handler */
  181: #define TA_ASM          0x00000000U     /* Program by assembler */
  182: #define TA_HLNG         0x00000001U    /* Program by high level programming
  183:                                            language */
  184: #define TA_STA          0x00000002U     /* Cycle handler startup */
  185: #define TA_PHS          0x00000004U     /* Save cycle handler phase */
  186: #define TA_DSNAME       0x00000040U   /* Use object name */
  187: 
  188: #define TCYC_STP        0x00U          /* Cycle handler is not operating */
  189: #define TCYC_STA        0x01U          /* Cycle handler is operating */
  190: 
  191: /* Alarm handler address */
  192: #define TA_ASM          0x00000000U     /* Program by assembler */
  193: #define TA_HLNG         0x00000001U    /* Program by high level programming
  194:                                            language */
  195: #define TA_DSNAME       0x00000040U   /* Use object name */
  196: 
  197: #define TALM_STP        0x00U          /* Alarm handler is not operating */
  198: #define TALM_STA        0x01U          /* Alarm handler is operating */
  199: 
  200: /* System state */
  201: #define TSS_TSK         0x00U  /* During execution of task part(context) */
  202: #define TSS_DDSP        0x01U  /* During dispatch disable */
  203: #define TSS_DINT        0x02U  /* During Interrupt disable */
  204: #define TSS_INDP        0x04U  /* During execution of task independent part */
  205: #define TSS_QTSK        0x08U  /* During execution of semi-task part */
  206: 
  207: /* Power-saving mode */
  208: #define TPW_DOSUSPEND   1 /* Transit to suspend state */
  209: #define TPW_DISLOWPOW   2 /* Power-saving mode switch disable */
  210: #define TPW_ENALOWPOW   3 /* Power-saving mode switch enable */
  211: 
  212: #ifdef __cplusplus
  213: }
  214: #endif
  215: 
  216: /* System dependencies */
  217: #include <tk/sysdepend/syscall_common.h>
  218: 
  219: #ifdef __cplusplus
  220: extern "C" {
  221: #endif
  222: 
  223: /*
  224:  * Task creation information            tk_cre_tsk
  225:  */
  226: typedef struct t_ctsk {
  227:         void   *exinf;           /* Extended information */
  228:         ATR    tskatr;            /* Task attribute */
  229:         FP     task;               /* Task startup address */
  230:         PRI    itskpri;   /* Priority at task startup */
  231:         INT    stksz;             /* User stack size (byte) */
  232:         INT    sstksz;            /* System stack size (byte) */
  233:         void   *stkptr;          /* User stack pointer */
  234:         void   *uatb;            /* Task space page table */
  235:         INT    lsid;              /* Logical space ID */
  236:         ID     resid;              /* Resource ID */
  237:         UB     dsname[8];  /* Object name */
  238: #if TA_GP
  239:         void   *gp;              /* Global pointer (gp) */
  240: #endif
  241: } T_CTSK;
  242: 
  243: /*
  244:  * Task space information               tk_get_tsp, tk_set_tsp
  245:  */
  246: typedef struct t_tskspc {
  247:         void   *uatb;            /* Address of task space page table */
  248:         INT    lsid;              /* Logical space ID */
  249: } T_TSKSPC;
  250: 
  251: /*
  252:  * Task statistics information          tk_inf_tsk
  253:  */
  254: typedef struct t_itsk {
  255:         RELTIM stime;          /* Cumulative system execution time
  256:                                    (milliseconds) */
  257:         RELTIM utime;          /* Cumulative user execution time
  258:                                    (milliseconds) */
  259: } T_ITSK;
  260: typedef struct t_itsk_u {
  261:         RELTIM_U stime_u;      /* Cumulative system execution time (us) */
  262:         RELTIM_U utime_u;      /* Cumulative user execution time (us) */
  263: } T_ITSK_U;
  264: 
  265: /*
  266:  * Task state information               tk_ref_tsk
  267:  */
  268: typedef struct t_rtsk {
  269:         void   *exinf;           /* Extended information */
  270:         PRI    tskpri;            /* Current priority */
  271:         PRI    tskbpri;   /* Base priority */
  272:         UINT   tskstat;  /* Task state */
  273:         UINT   tskwait;  /* Wait factor */
  274:         ID     wid;                /* Wait object ID */
  275:         INT    wupcnt;            /* Number of wakeup requests queuing */
  276:         INT    suscnt;            /* Number of SUSPEND request nests */
  277:         RELTIM slicetime;      /* Maximum continuous execution time
  278:                                    (millisecond) */
  279:         UINT   waitmask; /* Disabled wait factor */
  280:         UINT   texmask;  /* Enabled task exception */
  281:         UINT   tskevent; /* Occurring task event */
  282: } T_RTSK;
  283: typedef struct t_rtsk_u {
  284:         void   *exinf;           /* Extended information */
  285:         PRI    tskpri;            /* Current priority */
  286:         PRI    tskbpri;   /* Base priority */
  287:         UINT   tskstat;  /* Task state */
  288:         UINT   tskwait;  /* Wait factor */
  289:         ID     wid;                /* Wait object ID */
  290:         INT    wupcnt;            /* Number of wakeup requests queuing */
  291:         INT    suscnt;            /* Number of SUSPEND request nests */
  292:         RELTIM_U slicetime_u;  /* Maximum continuous execution time (us) */
  293:         UINT   waitmask; /* Disabled wait factor */
  294:         UINT   texmask;  /* Enabled task exception */
  295:         UINT   tskevent; /* Occurring task event */
  296: } T_RTSK_U;
  297: 
  298: /*
  299:  * Task exception handler definition information        tk_def_tex
  300:  */
  301: typedef struct t_dtex {
  302:         ATR    texatr;            /* Task exception handler attribute */
  303:         FP     texhdr;             /* Task exception handler address */
  304: } T_DTEX;
  305: 
  306: /*
  307:  * Task exception state information             tk_ref_tex
  308:  */
  309: typedef struct t_rtex {
  310:         UINT   pendtex;  /* Occurring task exception */
  311:         UINT   texmask;  /* Enabled task exception */
  312: } T_RTEX;
  313: 
  314: /*
  315:  * Semaphore creation information               tk_cre_sem
  316:  */
  317: typedef struct t_csem {
  318:         void   *exinf;           /* Extended information */
  319:         ATR    sematr;            /* Semaphore attribute */
  320:         INT    isemcnt;   /* Semaphore initial count value */
  321:         INT    maxsem;            /* Semaphore maximum count value */
  322:         UB     dsname[8];  /* Object name */
  323: } T_CSEM;
  324: 
  325: /*
  326:  * Semaphore state information          tk_ref_sem
  327:  */
  328: typedef struct t_rsem {
  329:         void   *exinf;           /* Extended information */
  330:         ID     wtsk;               /* Wait task ID */
  331:         INT    semcnt;            /* Current semaphore value */
  332: } T_RSEM;
  333: 
  334: /*
  335:  * Mutex creation information           tk_cre_mtx
  336:  */
  337: typedef struct t_cmtx {
  338:         void   *exinf;           /* Extended information */
  339:         ATR    mtxatr;            /* Mutex attribute */
  340:         PRI    ceilpri;   /* Upper limit priority of mutex */
  341:         UB     dsname[8];  /* Object name */
  342: } T_CMTX;
  343: 
  344: /*
  345:  * Mutex state information              tk_ref_mtx
  346:  */
  347: typedef struct t_rmtx {
  348:         void   *exinf;           /* Extended information */
  349:         ID     htsk;               /* Locking task ID */
  350:         ID     wtsk;               /* Lock wait task ID */
  351: } T_RMTX;
  352: 
  353: /*
  354:  * Event flag creation information      tk_cre_flg
  355:  */
  356: typedef struct t_cflg {
  357:         void   *exinf;           /* Extended information */
  358:         ATR    flgatr;            /* Event flag attribute */
  359:         UINT   iflgptn;  /* Event flag initial value */
  360:         UB     dsname[8];  /* Object name */
  361: } T_CFLG;
  362: 
  363: /*
  364:  * Event flag state information         tk_ref_flg
  365:  */
  366: typedef struct t_rflg {
  367:         void   *exinf;           /* Extended information */
  368:         ID     wtsk;               /* Wait task ID */
  369:         UINT   flgptn;           /* Current event flag pattern */
  370: } T_RFLG;
  371: 
  372: /*
  373:  * Mail box creation information        tk_cre_mbx
  374:  */
  375: typedef struct t_cmbx {
  376:         void   *exinf;           /* Extended information */
  377:         ATR    mbxatr;            /* Mail box attribute */
  378:         UB     dsname[8];  /* Object name */
  379: } T_CMBX;
  380: 
  381: /*
  382:  * Mail box message header
  383:  */
  384: typedef struct t_msg {
  385:         void   *msgque[1];       /* Area for message queue */
  386: } T_MSG;
  387: 
  388: typedef struct t_msg_pri {
  389:         T_MSG  msgque;          /* Area for message queue */
  390:         PRI    msgpri;            /* Message priority */
  391: } T_MSG_PRI;
  392: 
  393: /*
  394:  * Mail box state information           tk_ref_mbx
  395:  */
  396: typedef struct t_rmbx {
  397:         void   *exinf;           /* Extended information */
  398:         ID     wtsk;               /* Wait task ID */
  399:         T_MSG  *pk_msg; /* Next received message */
  400: } T_RMBX;
  401: 
  402: /*
  403:  * Message buffer creation information  tk_cre_mbf
  404:  */
  405: typedef struct t_cmbf {
  406:         void   *exinf;           /* Extended information */
  407:         ATR    mbfatr;            /* Message buffer attribute */
  408:         INT    bufsz;             /* Message buffer size (byte) */
  409:         INT    maxmsz;            /* Maximum length of message (byte) */
  410:         UB     dsname[8];  /* Object name */
  411: } T_CMBF;
  412: 
  413: /*
  414:  * Message buffer state information     tk_ref_mbf
  415:  */
  416: typedef struct t_rmbf {
  417:         void   *exinf;           /* Extended information */
  418:         ID     wtsk;               /* Receive wait task ID */
  419:         ID     stsk;               /* Send wait task ID */
  420:         INT    msgsz;             /* Next received message size (byte) */
  421:         INT    frbufsz;   /* Free buffer size (byte) */
  422:         INT    maxmsz;            /* Maximum length of message (byte) */
  423: } T_RMBF;
  424: 
  425: /*
  426:  * Rendezvous port creation information tk_cre_por
  427:  */
  428: typedef struct t_cpor {
  429:         void   *exinf;           /* Extended information */
  430:         ATR    poratr;            /* Port attribute */
  431:         INT    maxcmsz;   /* Maximum length of call message (byte) */
  432:         INT    maxrmsz;   /* Maximum length of replay message (byte) */
  433:         UB     dsname[8];  /* Object name */
  434: } T_CPOR;
  435: 
  436: /*
  437:  * Rendezvous port state information    tk_ref_por
  438:  */
  439: typedef struct t_rpor {
  440:         void   *exinf;           /* Extended information */
  441:         ID     wtsk;               /* Call wait task ID */
  442:         ID     atsk;               /* Receive wait task ID */
  443:         INT    maxcmsz;   /* Maximum length of call message (byte) */
  444:         INT    maxrmsz;   /* Maximum length of replay message (byte) */
  445: } T_RPOR;
  446: 
  447: /*
  448:  * Interrupt handler definition information     tk_def_int
  449:  */
  450: typedef struct t_dint {
  451:         ATR    intatr;            /* Interrupt handler attribute */
  452:         FP     inthdr;             /* Interrupt handler address */
  453: #if TA_GP
  454:         void   *gp;              /* Global pointer (gp) */
  455: #endif
  456: } T_DINT;
  457: 
  458: /*
  459:  * Variable size memory pool creation information       tk_cre_mpl
  460:  */
  461: typedef struct t_cmpl {
  462:         void   *exinf;           /* Extended information */
  463:         ATR    mplatr;            /* Memory pool attribute */
  464:         INT    mplsz;             /* Size of whole memory pool (byte) */
  465:         UB     dsname[8];  /* Object name */
  466: } T_CMPL;
  467: 
  468: /*
  469:  * Variable size memory pool state information  tk_ref_mpl
  470:  */
  471: typedef struct t_rmpl {
  472:         void   *exinf;           /* Extended information */
  473:         ID     wtsk;               /* Wait task ID */
  474:         INT    frsz;              /* Total size of free area (byte) */
  475:         INT    maxsz;             /* Size of maximum continuous free area
  476:                                    (byte) */
  477: } T_RMPL;
  478: 
  479: /*
  480:  * Fixed size memory pool state information     tk_cre_mpf
  481:  */
  482: typedef struct t_cmpf {
  483:         void   *exinf;           /* Extended information */
  484:         ATR    mpfatr;            /* Memory pool attribute */
  485:         INT    mpfcnt;            /* Number of blocks in whole memory pool */
  486:         INT    blfsz;             /* Fixed size memory block size (byte) */
  487:         UB     dsname[8];  /* Object name */
  488: } T_CMPF;
  489: 
  490: /*
  491:  * Fixed size memory pool state information     tk_ref_mpf
  492:  */
  493: typedef struct t_rmpf {
  494:         void   *exinf;           /* Extended information */
  495:         ID     wtsk;               /* Wait task ID */
  496:         INT    frbcnt;            /* Number of free area blocks */
  497: } T_RMPF;
  498: 
  499: /*
  500:  * Cycle handler creation information   tk_cre_cyc
  501:  */
  502: typedef struct t_ccyc {
  503:         void   *exinf;           /* Extended information */
  504:         ATR    cycatr;            /* Cycle handler attribute */
  505:         FP     cychdr;             /* Cycle handler address */
  506:         RELTIM cyctim;         /* Cycle interval */
  507:         RELTIM cycphs;         /* Cycle phase */
  508:         UB     dsname[8];  /* Object name */
  509: #if TA_GP
  510:         void   *gp;              /* Global pointer (gp) */
  511: #endif
  512: } T_CCYC;
  513: typedef struct t_ccyc_u {
  514:         void   *exinf;           /* Extended information */
  515:         ATR    cycatr;            /* Cycle handler attribute */
  516:         FP     cychdr;             /* Cycle handler address */
  517:         RELTIM_U cyctim_u;     /* Cycle interval */
  518:         RELTIM_U cycphs_u;     /* Cycle phase */
  519:         UB     dsname[8];  /* Object name */
  520: #if TA_GP
  521:         void   *gp;              /* Global pointer (gp) */
  522: #endif
  523: } T_CCYC_U;
  524: 
  525: /*
  526:  * Cycle handler state information      tk_ref_cyc
  527:  */
  528: typedef struct t_rcyc {
  529:         void   *exinf;           /* Extended information */
  530:         RELTIM lfttim;         /* Remaining time until next handler startup */
  531:         UINT   cycstat;  /* Cycle handler status */
  532: } T_RCYC;
  533: typedef struct t_rcyc_u {
  534:         void   *exinf;           /* Extended information */
  535:         RELTIM_U lfttim_u;     /* Remaining time until next handler startup */
  536:         UINT   cycstat;  /* Cycle handler status */
  537: } T_RCYC_U;
  538: 
  539: /*
  540:  * Alarm handler creation information           tk_cre_alm
  541:  */
  542: typedef struct t_calm {
  543:         void   *exinf;           /* Extended information */
  544:         ATR    almatr;            /* Alarm handler attribute */
  545:         FP     almhdr;             /* Alarm handler address */
  546:         UB     dsname[8];  /* Object name */
  547: #if TA_GP
  548:         void   *gp;              /* Global pointer (gp) */
  549: #endif
  550: } T_CALM;
  551: 
  552: /*
  553:  * Alarm handler state information      tk_ref_alm
  554:  */
  555: typedef struct t_ralm {
  556:         void   *exinf;           /* Extended information */
  557:         RELTIM lfttim;         /* Remaining time until handler startup */
  558:         UINT   almstat;  /* Alarm handler state */
  559: } T_RALM;
  560: typedef struct t_ralm_u {
  561:         void   *exinf;           /* Extended information */
  562:         RELTIM_U lfttim_u;     /* Remaining time until handler startup */
  563:         UINT   almstat;  /* Alarm handler state */
  564: } T_RALM_U;
  565: 
  566: /*
  567:  * Version information          tk_ref_ver
  568:  */
  569: typedef struct t_rver {
  570:         UH     maker;              /* OS manufacturer */
  571:         UH     prid;               /* OS identification number */
  572:         UH     spver;              /* Specification version */
  573:         UH     prver;              /* OS product version */
  574:         UH     prno[4];    /* Product number, Product management
  575:                                    information */
  576: } T_RVER;
  577: 
  578: /*
  579:  * System state information             tk_ref_sys
  580:  */
  581: typedef struct t_rsys {
  582:         INT    sysstat;   /* System state */
  583:         ID     runtskid;   /* ID of task in execution state */
  584:         ID     schedtskid; /* ID of the task that should be the
  585:                                    execution state */
  586: } T_RSYS;
  587: 
  588: /*
  589:  * Subsystem definition information             tk_def_ssy
  590:  */
  591: typedef struct t_dssy {
  592:         ATR    ssyatr;            /* Subsystem attribute */
  593:         PRI    ssypri;            /* Subsystem priority */
  594:         FP     svchdr;             /* Extended SVC handler address */
  595:         FP     breakfn;    /* Break function address */
  596:         FP     startupfn;  /* Startup function address */
  597:         FP     cleanupfn;  /* Cleanup function address */
  598:         FP     eventfn;    /* Event function address */
  599:         INT    resblksz;  /* Resource management block size (byte) */
  600: #if TA_GP
  601:         void   *gp;              /* Global pointer (gp) */
  602: #endif
  603: } T_DSSY;
  604: 
  605: /*
  606:  * Subsystem state information          tk_ref_ssy
  607:  */
  608: typedef struct t_rssy {
  609:         PRI    ssypri;            /* Subsystem priority */
  610:         INT    resblksz;  /* Resource management block size (byte) */
  611: } T_RSSY;
  612: 
  613: /* ------------------------------------------------------------------------ */
  614: /*
  615:  * Definition for interface library automatic generation (mktksvc)
  616:  */
  617: /*** DEFINE_TKSVC ***/
  618: 
  619: /* [BEGIN SYSCALLS] */
  620: IMPORT ID tk_cre_tsk( CONST T_CTSK *pk_ctsk );
  621: IMPORT ER tk_del_tsk( ID tskid );
  622: IMPORT ER tk_sta_tsk( ID tskid, INT stacd );
  623: IMPORT void tk_ext_tsk( void );
  624: IMPORT void tk_exd_tsk( void );
  625: IMPORT ER tk_ter_tsk( ID tskid );
  626: IMPORT ER tk_dis_dsp( void );
  627: IMPORT ER tk_ena_dsp( void );
  628: IMPORT ER tk_chg_pri( ID tskid, PRI tskpri );
  629: IMPORT ER tk_chg_slt( ID tskid, RELTIM slicetime );
  630: IMPORT ER tk_rot_rdq( PRI tskpri );
  631: IMPORT ER tk_rel_wai( ID tskid );
  632: IMPORT ID tk_get_tid( void );
  633: IMPORT ER tk_get_tsp( ID tskid, T_TSKSPC *pk_tskspc );
  634: IMPORT ER tk_set_tsp( ID tskid, CONST T_TSKSPC *pk_tskspc );
  635: IMPORT ID tk_get_rid( ID tskid );
  636: IMPORT ID tk_set_rid( ID tskid, ID resid );
  637: IMPORT ER tk_get_reg( ID tskid, T_REGS *pk_regs, T_EIT *pk_eit, T_CREGS *pk_cregs );
  638: IMPORT ER tk_set_reg( ID tskid, CONST T_REGS *pk_regs, CONST T_EIT *pk_eit, CONST T_CREGS *pk_cregs );
  639: IMPORT ER tk_get_cpr( ID tskid, INT copno, T_COPREGS *pk_copregs );
  640: IMPORT ER tk_set_cpr( ID tskid, INT copno, CONST T_COPREGS *pk_copregs );
  641: IMPORT ER tk_inf_tsk( ID tskid, T_ITSK *pk_itsk, BOOL clr );
  642: IMPORT ER tk_ref_tsk( ID tskid, T_RTSK *pk_rtsk );
  643: IMPORT ER tk_def_tex( ID tskid, CONST T_DTEX *pk_dtex );
  644: IMPORT ER tk_ena_tex( ID tskid, UINT texptn );
  645: IMPORT ER tk_dis_tex( ID tskid, UINT texptn );
  646: IMPORT ER tk_ras_tex( ID tskid, INT texcd );
  647: IMPORT INT tk_end_tex( BOOL enatex );
  648: IMPORT ER tk_ref_tex( ID tskid, T_RTEX *pk_rtex );
  649: IMPORT ER tk_sus_tsk( ID tskid );
  650: IMPORT ER tk_rsm_tsk( ID tskid );
  651: IMPORT ER tk_frsm_tsk( ID tskid );
  652: IMPORT ER tk_slp_tsk( TMO tmout );
  653: IMPORT ER tk_wup_tsk( ID tskid );
  654: IMPORT INT tk_can_wup( ID tskid );
  655: IMPORT ER tk_sig_tev( ID tskid, INT tskevt );
  656: IMPORT INT tk_wai_tev( INT waiptn, TMO tmout );
  657: IMPORT INT tk_dis_wai( ID tskid, UINT waitmask );
  658: IMPORT ER tk_ena_wai( ID tskid );
  659: IMPORT ID tk_cre_sem( CONST T_CSEM *pk_csem );
  660: IMPORT ER tk_del_sem( ID semid );
  661: IMPORT ER tk_sig_sem( ID semid, INT cnt );
  662: IMPORT ER tk_wai_sem( ID semid, INT cnt, TMO tmout );
  663: IMPORT ER tk_ref_sem( ID semid, T_RSEM *pk_rsem );
  664: IMPORT ID tk_cre_mtx( CONST T_CMTX *pk_cmtx );
  665: IMPORT ER tk_del_mtx( ID mtxid );
  666: IMPORT ER tk_loc_mtx( ID mtxid, TMO tmout );
  667: IMPORT ER tk_unl_mtx( ID mtxid );
  668: IMPORT ER tk_ref_mtx( ID mtxid, T_RMTX *pk_rmtx );
  669: IMPORT ID tk_cre_flg( CONST T_CFLG *pk_cflg );
  670: IMPORT ER tk_del_flg( ID flgid );
  671: IMPORT ER tk_set_flg( ID flgid, UINT setptn );
  672: IMPORT ER tk_clr_flg( ID flgid, UINT clrptn );
  673: IMPORT ER tk_wai_flg( ID flgid, UINT waiptn, UINT wfmode, UINT *p_flgptn, TMO tmout );
  674: IMPORT ER tk_ref_flg( ID flgid, T_RFLG *pk_rflg );
  675: IMPORT ID tk_cre_mbx( CONST T_CMBX* pk_cmbx );
  676: IMPORT ER tk_del_mbx( ID mbxid );
  677: IMPORT ER tk_snd_mbx( ID mbxid, T_MSG *pk_msg );
  678: IMPORT ER tk_rcv_mbx( ID mbxid, T_MSG **ppk_msg, TMO tmout );
  679: IMPORT ER tk_ref_mbx( ID mbxid, T_RMBX *pk_rmbx );
  680: IMPORT ID tk_cre_mbf( CONST T_CMBF *pk_cmbf );
  681: IMPORT ER tk_del_mbf( ID mbfid );
  682: IMPORT ER tk_snd_mbf( ID mbfid, CONST void *msg, INT msgsz, TMO tmout );
  683: IMPORT INT tk_rcv_mbf( ID mbfid, void *msg, TMO tmout );
  684: IMPORT ER tk_ref_mbf( ID mbfid, T_RMBF *pk_rmbf );
  685: IMPORT ID tk_cre_por( CONST T_CPOR *pk_cpor );
  686: IMPORT ER tk_del_por( ID porid );
  687: IMPORT INT tk_cal_por( ID porid, UINT calptn, void *msg, INT cmsgsz, TMO tmout );
  688: IMPORT INT tk_acp_por( ID porid, UINT acpptn, RNO *p_rdvno, void *msg, TMO tmout );
  689: IMPORT ER tk_fwd_por( ID porid, UINT calptn, RNO rdvno, CONST void *msg, INT cmsgsz );
  690: IMPORT ER tk_rpl_rdv( RNO rdvno, CONST void *msg, INT rmsgsz );
  691: IMPORT ER tk_ref_por( ID porid, T_RPOR *pk_rpor );
  692: IMPORT ER tk_def_int( UINT dintno, CONST T_DINT *pk_dint );
  693: IMPORT void tk_ret_int( void );
  694: IMPORT ID tk_cre_mpl( CONST T_CMPL *pk_cmpl );
  695: IMPORT ER tk_del_mpl( ID mplid );
  696: IMPORT ER tk_get_mpl( ID mplid, INT blksz, void **p_blk, TMO tmout );
  697: IMPORT ER tk_rel_mpl( ID mplid, void *blk );
  698: IMPORT ER tk_ref_mpl( ID mplid, T_RMPL *pk_rmpl );
  699: IMPORT ID tk_cre_mpf( CONST T_CMPF *pk_cmpf );
  700: IMPORT ER tk_del_mpf( ID mpfid );
  701: IMPORT ER tk_get_mpf( ID mpfid, void **p_blf, TMO tmout );
  702: IMPORT ER tk_rel_mpf( ID mpfid, void *blf );
  703: IMPORT ER tk_ref_mpf( ID mpfid, T_RMPF *pk_rmpf );
  704: IMPORT ER tk_set_tim( CONST SYSTIM *pk_tim );
  705: IMPORT ER tk_get_tim( SYSTIM *pk_tim );
  706: IMPORT ER tk_get_otm( SYSTIM *pk_tim );
  707: IMPORT ER tk_dly_tsk( RELTIM dlytim );
  708: IMPORT ID tk_cre_cyc( CONST T_CCYC *pk_ccyc );
  709: IMPORT ER tk_del_cyc( ID cycid );
  710: IMPORT ER tk_sta_cyc( ID cycid );
  711: IMPORT ER tk_stp_cyc( ID cycid );
  712: IMPORT ER tk_ref_cyc( ID cycid, T_RCYC *pk_rcyc );
  713: IMPORT ID tk_cre_alm( CONST T_CALM *pk_calm );
  714: IMPORT ER tk_del_alm( ID almid );
  715: IMPORT ER tk_sta_alm( ID almid, RELTIM almtim );
  716: IMPORT ER tk_stp_alm( ID almid );
  717: IMPORT ER tk_ref_alm( ID almid, T_RALM *pk_ralm );
  718: IMPORT ER tk_ref_ver( T_RVER *pk_rver );
  719: IMPORT ER tk_ref_sys( T_RSYS *pk_rsys );
  720: IMPORT ER tk_def_ssy( ID ssid, CONST T_DSSY *pk_dssy );
  721: IMPORT ER tk_sta_ssy( ID ssid, ID resid, INT info );
  722: IMPORT ER tk_cln_ssy( ID ssid, ID resid, INT info );
  723: IMPORT ER tk_evt_ssy( ID ssid, INT evttyp, ID resid, INT info );
  724: IMPORT ER tk_ref_ssy( ID ssid, T_RSSY *pk_rssy );
  725: IMPORT ID tk_cre_res( void );
  726: IMPORT ER tk_del_res( ID resid );
  727: IMPORT ER tk_get_res( ID resid, ID ssid, void **p_resblk );
  728: IMPORT ER tk_set_pow( UINT powmode );
  729: 
  730: /* T-Kernel 2.0 */
  731: IMPORT ER tk_chg_slt_u( ID tskid, RELTIM_U slicetime_u );
  732: IMPORT ER tk_inf_tsk_u( ID tskid, T_ITSK_U *pk_itsk_u, BOOL clr );
  733: IMPORT ER tk_ref_tsk_u( ID tskid, T_RTSK_U *pk_rtsk_u );
  734: IMPORT ER tk_slp_tsk_u( TMO_U tmout_u );
  735: IMPORT INT tk_wai_tev_u( INT waiptn, TMO_U tmout_u );
  736: IMPORT ER tk_dly_tsk_u( RELTIM_U dlytim_u );
  737: IMPORT ER tk_wai_sem_u( ID semid, INT cnt, TMO_U tmout_u );
  738: IMPORT ER tk_wai_flg_u( ID flgid, UINT waiptn, UINT wfmode, UINT *p_flgptn, TMO_U tmout_u );
  739: IMPORT ER tk_rcv_mbx_u( ID mbxid, T_MSG **ppk_msg, TMO_U tmout_u );
  740: IMPORT ER tk_loc_mtx_u( ID mtxid, TMO_U tmout_u );
  741: IMPORT ER tk_snd_mbf_u( ID mbfid, CONST void *msg, INT msgsz, TMO_U tmout_u );
  742: IMPORT INT tk_rcv_mbf_u( ID mbfid, void *msg, TMO_U tmout_u );
  743: IMPORT INT tk_cal_por_u( ID porid, UINT calptn, void *msg, INT cmsgsz, TMO_U tmout_u );
  744: IMPORT INT tk_acp_por_u( ID porid, UINT acpptn, RNO *p_rdvno, void *msg, TMO_U tmout_u );
  745: IMPORT ER tk_get_mpl_u( ID mplid, INT blksz, void **p_blk, TMO_U tmout_u );
  746: IMPORT ER tk_get_mpf_u( ID mpfid, void **p_blf, TMO_U tmout_u );
  747: IMPORT ER tk_set_tim_u( SYSTIM_U tim_u );
  748: IMPORT ER tk_get_tim_u( SYSTIM_U *tim_u, UINT *ofs );
  749: IMPORT ER tk_get_otm_u( SYSTIM_U *tim_u, UINT *ofs );
  750: IMPORT ID tk_cre_cyc_u( CONST T_CCYC_U *pk_ccyc_u );
  751: IMPORT ER tk_ref_cyc_u( ID cycid, T_RCYC_U *pk_rcyc_u );
  752: IMPORT ER tk_sta_alm_u( ID almid, RELTIM_U almtim_u );
  753: IMPORT ER tk_ref_alm_u( ID almid, T_RALM_U *pk_ralm_u );
  754: 
  755: /* [END SYSCALLS] */
  756: 
  757: #ifdef __cplusplus
  758: }
  759: #endif
  760: 
  761: #endif /* __TK_SYSCALL_H__ */