gonzui


Format: Advanced Search

tkernel_2/include/tk/dbgspt.hbare sourcepermlink (0.02 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 TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      @(#)dbgspt.h (T-Kernel)
   17:  *
   18:  *      T-Kernel Debugger Support (Common parts)
   19:  */
   20: 
   21: #ifndef __TK_DBGSPT_H__
   22: #define __TK_DBGSPT_H__
   23: 
   24: #include <basic.h>
   25: #include <tk/typedef.h>
   26: #include <tk/syscall.h>
   27: 
   28: #include <tk/sysdepend/dbgspt_common.h>
   29: 
   30: #ifdef __cplusplus
   31: extern "C" {
   32: #endif
   33: 
   34: /*
   35:  * Object name information              td_ref_dsname, td_set_dsname
   36:  */
   37: #define TN_TSK 0x01
   38: #define TN_SEM 0x02
   39: #define TN_FLG 0x03
   40: #define TN_MBX 0x04
   41: #define TN_MBF 0x05
   42: #define TN_POR 0x06
   43: #define TN_MTX 0x07
   44: #define TN_MPL 0x08
   45: #define TN_MPF 0x09
   46: #define TN_CYC 0x0a
   47: #define TN_ALM 0x0b
   48: 
   49: /*
   50:  * Semaphore state information          td_ref_sem
   51:  */
   52: typedef struct td_rsem {
   53:         void   *exinf;           /* Extended information */
   54:         ID     wtsk;               /* Wait task ID */
   55:         INT    semcnt;            /* Current semaphore value */
   56: } TD_RSEM;
   57: 
   58: /*
   59:  * Event flag state information         td_ref_flg
   60:  */
   61: typedef struct td_rflg {
   62:         void   *exinf;           /* Extended information */
   63:         ID     wtsk;               /* Wait task ID */
   64:         UINT   flgptn;           /* Current event flag pattern */
   65: } TD_RFLG;
   66: 
   67: /*
   68:  * Mail box state information           td_ref_mbx
   69:  */
   70: typedef struct td_rmbx {
   71:         void   *exinf;           /* Extended information */
   72:         ID     wtsk;               /* Wait task ID */
   73:         T_MSG  *pk_msg; /* Next received message */
   74: } TD_RMBX;
   75: 
   76: /*
   77:  * Mutex state information              td_ref_mtx
   78:  */
   79: typedef struct td_rmtx {
   80:         void   *exinf;           /* Extended information */
   81:         ID     htsk;               /* Locking task ID */
   82:         ID     wtsk;               /* Lock wait task ID */
   83: } TD_RMTX;
   84: 
   85: /*
   86:  * Message buffer state information     td_ref_mbf
   87:  */
   88: typedef struct td_rmbf {
   89:         void   *exinf;           /* Extended information */
   90:         ID     wtsk;               /* Receive wait task ID */
   91:         ID     stsk;               /* Send wait task ID */
   92:         INT    msgsz;             /* Next received message size (byte) */
   93:         INT    frbufsz;   /* Free buffer size (byte) */
   94:         INT    maxmsz;            /* Maximum length of message (byte) */
   95: } TD_RMBF;
   96: 
   97: /*
   98:  * Rendezvous port state information    td_ref_por
   99:  */
  100: typedef struct td_rpor {
  101:         void   *exinf;           /* Extended information */
  102:         ID     wtsk;               /* Call wait task ID */
  103:         ID     atsk;               /* Receive wait task ID */
  104:         INT    maxcmsz;   /* Maximum length of call message (byte) */
  105:         INT    maxrmsz;   /* Maximum length of replay message (byte) */
  106: } TD_RPOR;
  107: 
  108: /*
  109:  * Fixed size memory pool state information     td_ref_mpf
  110:  */
  111: typedef struct td_rmpf {
  112:         void   *exinf;           /* Extended information */
  113:         ID     wtsk;               /* Wait task ID */
  114:         INT    frbcnt;            /* Number of free blocks */
  115: } TD_RMPF;
  116: 
  117: /*
  118:  * Variable size memory pool state information  td_ref_mpl
  119:  */
  120: typedef struct td_rmpl {
  121:         void   *exinf;           /* Extended information */
  122:         ID     wtsk;               /* Wait task ID */
  123:         INT    frsz;              /* Total size of free area (byte) */
  124:         INT    maxsz;             /* Size of maximum continuous
  125:                                    free area (byte) */
  126: } TD_RMPL;
  127: 
  128: /*
  129:  * Cycle handler state information      td_ref_cyc
  130:  */
  131: typedef struct td_rcyc {
  132:         void   *exinf;           /* Extended information */
  133:         RELTIM lfttim;         /* Remaining time until next handler startup */
  134:         UINT   cycstat;  /* Cycle handler status */
  135: } TD_RCYC;
  136: typedef struct td_rcyc_u {
  137:         void   *exinf;           /* Extended information */
  138:         RELTIM_U lfttim_u;     /* Remaining time until next handler startup */
  139:         UINT   cycstat;  /* Cycle handler status */
  140: } TD_RCYC_U;
  141: 
  142: /*
  143:  * Alarm handler state information      td_ref_alm
  144:  */
  145: typedef struct td_ralm {
  146:         void   *exinf;           /* Extended information */
  147:         RELTIM lfttim;         /* Remaining time until handler startup */
  148:         UINT   almstat;  /* Alarm handler status */
  149: } TD_RALM;
  150: typedef struct td_ralm_u {
  151:         void   *exinf;           /* Extended information */
  152:         RELTIM_U lfttim_u;     /* Remaining time until handler startup */
  153:         UINT   almstat;  /* Alarm handler status */
  154: } TD_RALM_U;
  155: 
  156: /*
  157:  * Subsystem state information          td_ref_ssy
  158:  */
  159: typedef struct td_rssy {
  160:         PRI    ssypri;            /* Subsystem priority */
  161:         INT    resblksz;  /* Resource management block size (byte) */
  162: } TD_RSSY;
  163: 
  164: /*
  165:  * Task state information               td_ref_tsk
  166:  */
  167: typedef struct td_rtsk {
  168:         void   *exinf;           /* Extended information */
  169:         PRI    tskpri;            /* Current priority */
  170:         PRI    tskbpri;   /* Base priority */
  171:         UINT   tskstat;  /* Task state */
  172:         UINT   tskwait;  /* Wait factor */
  173:         ID     wid;                /* Wait object ID */
  174:         INT    wupcnt;            /* Number of wakeup requests queuing */
  175:         INT    suscnt;            /* Number of SUSPEND request nests */
  176:         RELTIM slicetime;      /* Maximum continuous execution time
  177:                                    (millisecond) */
  178:         UINT   waitmask; /* Disabled wait factor */
  179:         UINT   texmask;  /* Enabled task exception */
  180:         UINT   tskevent; /* Occurring task event */
  181:         FP     task;               /* Task startup address */
  182:         INT    stksz;             /* User stack size (byte) */
  183:         INT    sstksz;            /* System stack size (byte) */
  184:         void   *istack;  /* User stack pointer initial value */
  185:         void   *isstack; /* System stack pointer initial value */
  186: } TD_RTSK;
  187: typedef struct td_rtsk_u {
  188:         void   *exinf;           /* Extended information */
  189:         PRI    tskpri;            /* Current priority */
  190:         PRI    tskbpri;   /* Base priority */
  191:         UINT   tskstat;  /* Task state */
  192:         UINT   tskwait;  /* Wait factor */
  193:         ID     wid;                /* Wait object ID */
  194:         INT    wupcnt;            /* Number of wakeup requests queuing */
  195:         INT    suscnt;            /* Number of SUSPEND request nests */
  196:         RELTIM_U slicetime_u;  /* Maximum continuous execution time (us) */
  197:         UINT   waitmask; /* Disabled wait factor */
  198:         UINT   texmask;  /* Enabled task exception */
  199:         UINT   tskevent; /* Occurring task event */
  200:         FP     task;               /* Task startup address */
  201:         INT    stksz;             /* User stack size (byte) */
  202:         INT    sstksz;            /* System stack size (byte) */
  203:         void   *istack;  /* User stack pointer initial value */
  204:         void   *isstack; /* System stack pointer initial value */
  205: } TD_RTSK_U;
  206: 
  207: /*
  208:  * Task exception state information             td_ref_tex
  209:  */
  210: typedef struct td_rtex {
  211:         UINT   pendtex;  /* Occurring task exception */
  212:         UINT   texmask;  /* Enabled task exception */
  213: } TD_RTEX;
  214: 
  215: /*
  216:  * Task statistics information          td_inf_tsk
  217:  */
  218: typedef struct td_itsk {
  219:         RELTIM stime;          /* Cumulative system execution time
  220:                                    (milliseconds) */
  221:         RELTIM utime;          /* Cumulative user execution time
  222:                                    (milliseconds) */
  223: } TD_ITSK;
  224: typedef struct td_itsk_u {
  225:         RELTIM_U stime_u;      /* Cumulative system execution time (us) */
  226:         RELTIM_U utime_u;      /* Cumulative user execution time (us) */
  227: } TD_ITSK_U;
  228: 
  229: /*
  230:  * System state information             td_ref_sys
  231:  */
  232: typedef struct td_rsys {
  233:         INT    sysstat;   /* System state */
  234:         ID     runtskid;   /* ID of task in execution state */
  235:         ID     schedtskid; /* ID of task that should be in
  236:                                    execution state */
  237: } TD_RSYS;
  238: 
  239: /*
  240:  * System call/extended SVC trace definition    td_hok_svc
  241:  */
  242: typedef struct td_hsvc {
  243:         FP     enter;              /* Hook routine before calling */
  244:         FP     leave;              /* Hook routine after calling */
  245: } TD_HSVC;
  246: 
  247: /*
  248:  * Task dispatch trace definition               td_hok_dsp
  249:  */
  250: typedef struct td_hdsp {
  251:         FP     exec;               /* Hook routine when starting execution */
  252:         FP     stop;               /* Hook routine when stopping execution */
  253: } TD_HDSP;
  254: 
  255: /*
  256:  * Exception/Interrupt trace definition                 td_hok_int
  257:  */
  258: typedef struct td_hint {
  259:         FP     enter;              /* Hook routine before calling handler */
  260:         FP     leave;              /* Hook routine after calling handler */
  261: } TD_HINT;
  262: 
  263: /* ------------------------------------------------------------------------ */
  264: 
  265: /*
  266:  * Definition for interface library automatic generation (mktdsvc)
  267:  */
  268: /*** DEFINE_TDSVC ***/
  269: 
  270: /* [BEGIN SYSCALLS] */
  271: 
  272: /* Refer each object usage state */
  273: IMPORT INT td_lst_tsk( ID list[], INT nent );
  274: IMPORT INT td_lst_sem( ID list[], INT nent );
  275: IMPORT INT td_lst_flg( ID list[], INT nent );
  276: IMPORT INT td_lst_mbx( ID list[], INT nent );
  277: IMPORT INT td_lst_mtx( ID list[], INT nent );
  278: IMPORT INT td_lst_mbf( ID list[], INT nent );
  279: IMPORT INT td_lst_por( ID list[], INT nent );
  280: IMPORT INT td_lst_mpf( ID list[], INT nent );
  281: IMPORT INT td_lst_mpl( ID list[], INT nent );
  282: IMPORT INT td_lst_cyc( ID list[], INT nent );
  283: IMPORT INT td_lst_alm( ID list[], INT nent );
  284: IMPORT INT td_lst_ssy( ID list[], INT nent );
  285: 
  286: /* Refer each object state */
  287: IMPORT ER td_ref_sem( ID semid, TD_RSEM *rsem );
  288: IMPORT ER td_ref_flg( ID flgid, TD_RFLG *rflg );
  289: IMPORT ER td_ref_mbx( ID mbxid, TD_RMBX *rmbx );
  290: IMPORT ER td_ref_mtx( ID mtxid, TD_RMTX *rmtx );
  291: IMPORT ER td_ref_mbf( ID mbfid, TD_RMBF *rmbf );
  292: IMPORT ER td_ref_por( ID porid, TD_RPOR *rpor );
  293: IMPORT ER td_ref_mpf( ID mpfid, TD_RMPF *rmpf );
  294: IMPORT ER td_ref_mpl( ID mplid, TD_RMPL *rmpl );
  295: IMPORT ER td_ref_cyc( ID cycid, TD_RCYC *rcyc );
  296: IMPORT ER td_ref_alm( ID almid, TD_RALM *ralm );
  297: IMPORT ER td_ref_ssy( ID ssid, TD_RSSY *rssy );
  298: 
  299: /* Refer task state */
  300: IMPORT ER td_ref_tsk( ID tskid, TD_RTSK *rtsk );
  301: IMPORT ER td_ref_tex( ID tskid, TD_RTEX *rtex );
  302: IMPORT ER td_inf_tsk( ID tskid, TD_ITSK *itsk, BOOL clr );
  303: IMPORT ER td_get_reg( ID tskid, T_REGS *regs, T_EIT *eit, T_CREGS *cregs );
  304: IMPORT ER td_set_reg( ID tskid, CONST T_REGS *regs, CONST T_EIT *eit, CONST T_CREGS *cregs );
  305: 
  306: /* Refer system state */
  307: IMPORT ER td_ref_sys( TD_RSYS *rsys );
  308: IMPORT ER td_get_tim( SYSTIM *tim, UINT *ofs );
  309: IMPORT ER td_get_otm( SYSTIM *tim, UINT *ofs );
  310: 
  311: /* Refer ready queue */
  312: IMPORT INT td_rdy_que( PRI pri, ID list[], INT nent );
  313: 
  314: /* Refer wait queue */
  315: IMPORT INT td_sem_que( ID semid, ID list[], INT nent );
  316: IMPORT INT td_flg_que( ID flgid, ID list[], INT nent );
  317: IMPORT INT td_mbx_que( ID mbxid, ID list[], INT nent );
  318: IMPORT INT td_mtx_que( ID mtxid, ID list[], INT nent );
  319: IMPORT INT td_smbf_que( ID mbfid, ID list[], INT nent );
  320: IMPORT INT td_rmbf_que( ID mbfid, ID list[], INT nent );
  321: IMPORT INT td_cal_que( ID porid, ID list[], INT nent );
  322: IMPORT INT td_acp_que( ID porid, ID list[], INT nent );
  323: IMPORT INT td_mpf_que( ID mpfid, ID list[], INT nent );
  324: IMPORT INT td_mpl_que( ID mplid, ID list[], INT nent );
  325: 
  326: /* Execution trace */
  327: IMPORT ER td_hok_svc( CONST TD_HSVC *hsvc );
  328: IMPORT ER td_hok_dsp( CONST TD_HDSP *hdsp );
  329: IMPORT ER td_hok_int( CONST TD_HINT *hint );
  330: 
  331: /* Object name */
  332: IMPORT ER td_ref_dsname( UINT type, ID id, UB *dsname );
  333: IMPORT ER td_set_dsname( UINT type, ID id, CONST UB *dsname );
  334: 
  335: /* T-Kernel 2.0 */
  336: IMPORT ER td_ref_cyc_u( ID cycid, TD_RCYC_U *rcyc_u );
  337: IMPORT ER td_ref_alm_u( ID almid, TD_RALM_U *ralm_u );
  338: IMPORT ER td_ref_tsk_u( ID tskid, TD_RTSK_U *rtsk_u );
  339: IMPORT ER td_inf_tsk_u( ID tskid, TD_ITSK_U *itsk_u, BOOL clr );
  340: IMPORT ER td_get_tim_u( SYSTIM_U *tim_u, UINT *ofs );
  341: IMPORT ER td_get_otm_u( SYSTIM_U *tim_u, UINT *ofs );
  342: 
  343: /* [END SYSCALLS] */
  344: 
  345: #ifdef __cplusplus
  346: }
  347: #endif
  348: #endif /* __TK_DBGSPT_H__ */