gonzui


Format: Advanced Search

tkernel_2/kernel/tkernel/src/kernel.hbare sourcepermlink (0.01 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 2015/02/17.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: 
   16: /*
   17:  *      kernel.h (T-Kernel/OS)
   18:  *      T-Kernel Common Definition
   19:  */
   20: 
   21: #ifndef _KERNEL_
   22: #define _KERNEL_
   23: 
   24: #include <basic.h>
   25: #include <tk/typedef.h>
   26: #include <tk/errno.h>
   27: #include <tk/syscall.h>
   28: #include <tk/dbgspt.h>
   29: #include <sys/imalloc.h>
   30: #include <sys/queue.h>
   31: #include <libstr.h>
   32: 
   33: /*
   34:  * Kernel configuration file
   35:  */
   36: #include "config.h"
   37: #include "cpu_conf.h"
   38: #include "tkdev_conf.h"
   39: #include "isysconf.h"
   40: 
   41: #include "isyscall.h"
   42: 
   43: #define SYSCALL         EXPORT         /* Definition of system call */
   44: 
   45: #ifndef __tcb__
   46: #define __tcb__
   47: typedef struct task_control_block       TCB;
   48: #endif
   49: 
   50: /*
   51:  * Object lock
   52:  *      Locked task is the highest run priority.
   53:  *      Unable to nest lock.
   54:  */
   55: typedef struct objlock {
   56:         QUEUE          wtskq;          /* Wait task queue */
   57: } OBJLOCK;
   58: 
   59: Inline void InitOBJLOCK( OBJLOCK *loc )
   60: {
   61:         loc->wtskq.next = NULL;
   62: }
   63: IMPORT void LockOBJ( OBJLOCK *loc );
   64: IMPORT void UnlockOBJ( OBJLOCK *loc );
   65: 
   66: Inline BOOL isLockedOBJ( OBJLOCK *loc )
   67: {
   68:         return ( loc->wtskq.next != NULL )? TRUE: FALSE;
   69: }
   70: 
   71: /*
   72:  * Extended SVC lock
   73:  *      The priority does not change during lock.
   74:  *      Able to nest lock.
   75:  */
   76: typedef struct svclock {
   77:         QUEUE          wtskq;          /* Wait task queue */
   78:         struct svclock *locklist;      /* List during lock */
   79: } SVCLOCK;
   80: 
   81: Inline void InitSVCLOCK( SVCLOCK *loc )
   82: {
   83:         loc->wtskq.next = NULL;
   84: }
   85: IMPORT void LockSVC( SVCLOCK *loc );
   86: IMPORT void UnlockSVC( void );
   87: IMPORT void AllUnlockSVC( TCB *loctsk );
   88: 
   89: /*
   90:  * Maximum ID number of each object
   91:  *      1 - max_??? is valid ID.
   92:  */
   93: IMPORT ID       max_tskid;
   94: IMPORT ID       max_semid;
   95: IMPORT ID       max_flgid;
   96: IMPORT ID       max_mbxid;
   97: IMPORT ID       max_mbfid;
   98: IMPORT ID       max_porid;
   99: IMPORT ID       max_mtxid;
  100: IMPORT ID       max_mplid;
  101: IMPORT ID       max_mpfid;
  102: IMPORT ID       max_cycid;
  103: IMPORT ID       max_almid;
  104: IMPORT ID       max_ssyid;
  105: IMPORT ID       max_resid;
  106: 
  107: #define SYS_RESID       MIN_RESID     /* System resource ID */
  108: 
  109: /*
  110:  * Other system information
  111:  */
  112: IMPORT INT      default_sstksz;              /* Default system stack size */
  113: IMPORT PRI      max_ssypri;          /* Maximum subsystem priority */
  114: 
  115: /*
  116:  * CPU-dependent include file
  117:  */
  118: #include "cpu_status.h"
  119: 
  120: /*
  121:  * System initialization (each module)
  122:  */
  123: IMPORT ER task_initialize( void );
  124: IMPORT ER semaphore_initialize( void );
  125: IMPORT ER eventflag_initialize( void );
  126: IMPORT ER mailbox_initialize( void );
  127: IMPORT ER messagebuffer_initialize( void );
  128: IMPORT ER rendezvous_initialize( void );
  129: IMPORT ER mutex_initialize( void );
  130: IMPORT ER memorypool_initialize( void );
  131: IMPORT ER fix_memorypool_initialize( void );
  132: IMPORT ER cyclichandler_initialize( void );
  133: IMPORT ER alarmhandler_initialize( void );
  134: IMPORT ER subsystem_initialize( void );
  135: IMPORT ER resource_group_initialize( void );
  136: 
  137: /*
  138:  * Start/Exit system (tkstart.c)
  139:  */
  140: IMPORT void t_kernel_main( T_CTSK *inittask );
  141: IMPORT void t_kernel_exit( void );
  142: 
  143: /*
  144:  * Target system-dependent routine (cpu_init.c tkdev_init.c)
  145:  */
  146: IMPORT ER   cpu_initialize( void );
  147: IMPORT void cpu_shutdown( void );
  148: IMPORT ER   tkdev_initialize( void );
  149: IMPORT void tkdev_exit( void );
  150: 
  151: /*
  152:  * Mutex
  153:  */
  154: IMPORT void signal_all_mutex( TCB *tcb );
  155: IMPORT INT chg_pri_mutex( TCB *tcb, INT priority );
  156: 
  157: #endif /* _KERNEL_ */