OSDN Git Service

(none)
authorryuz <ryuz>
Mon, 6 Nov 2006 10:59:36 +0000 (10:59 +0000)
committerryuz <ryuz>
Mon, 6 Nov 2006 10:59:36 +0000 (10:59 +0000)
14 files changed:
aplfw/build/h8/ae-3069-lan/ch38/gmake.mak
aplfw/build/h8/ae-3069-lan/sample.c
aplfw/driver/renesas/scidrv.c
aplfw/system/command.h [new file with mode: 0755]
aplfw/system/file.c
aplfw/system/file.h
aplfw/system/process.h
aplfw/system/shell.c [new file with mode: 0755]
kernel/build/common/gmake.inc
kernel/build/win/win32/vc60/hosv4a.dsp
kernel/include/core/dsp.h
kernel/include/core/sys.h
kernel/source/core/toq/sig_toq.c
kernel/source/object/inh/end_inh.c

index 895fd14..4c824e8 100755 (executable)
@@ -41,12 +41,13 @@ OBJS = $(OBJS_DIR)/vcttbl.obj               \
        $(OBJS_DIR)/memory.obj          \
        $(OBJS_DIR)/mempol.obj          \
        $(OBJS_DIR)/stmbuf.obj          \
-       $(OBJS_DIR)/ne2000drv.obj       \
        $(OBJS_DIR)/scihal.obj          \
        $(OBJS_DIR)/scidrv.obj          \
        $(OBJS_DIR)/scifile.obj         \
+       $(OBJS_DIR)/shell.obj           \
        $(OBJS_DIR)/dbgprt.obj          \
 
+#       $(OBJS_DIR)/ne2000drv.obj      \
 
 
 
@@ -63,6 +64,7 @@ all: mkdir_objs mk_kernel $(TARGET).abs
 
 $(TARGET).abs: $(OBJS) $(STD_LIBS) $(OS_LIBS)
        echo rom D=R                         > $(OBJS_DIR)/subcmd.txt
+       echo -OPtimize                      >> $(OBJS_DIR)/subcmd.txt
        echo list $(TARGET).map             >> $(OBJS_DIR)/subcmd.txt
        echo -Input=$(OBJS) | sed "s/ /,/g" >> $(OBJS_DIR)/subcmd.txt
        echo -LIB=$(OS_LIBS),$(STD_LIBS)    >> $(OBJS_DIR)/subcmd.txt
@@ -87,6 +89,9 @@ mkdir_objs:
 clean:
        rm -f $(OBJS) $(TARGET) ../kernel_cfg.c ../kernel_id.h
 
+clean_kernel:
+       make -C $(OS_DIR)/kernel/build/h8/h8300ha/ch38 -f gmake.mak clean
+
 $(OBJS_DIR)/sample.obj: sample.c ../kernel_id.h
 
 ../kernel_cfg.c ../kernel_id.h: ../system.cfg
index 28d1431..0da3b94 100755 (executable)
@@ -4,7 +4,7 @@
  * @file  sample.c
  * @brief %jp{サンプルプログラム}%en{Sample program}
  *
- * @version $Id: sample.c,v 1.1 2006-11-05 16:11:07 ryuz Exp $
+ * @version $Id: sample.c,v 1.2 2006-11-06 10:59:35 ryuz Exp $
  *
  * Copyright (C) 1998-2006 by Project HOS
  * http://sourceforge.jp/projects/hos/
@@ -31,7 +31,7 @@ void Sample_Initialize(VP_INT exinf)
        System_Initialize(g_SystemHeap, sizeof(g_SystemHeap));
 }
 
-
+int Shell_InputTty(HANDLE hTty, char *pszBuf, int iBufSize);
 
 void Sample_Startup(VP_INT exinf)
 {
@@ -43,7 +43,7 @@ void Sample_Startup(VP_INT exinf)
        
        /* システム初期化 */
        System_Initialize(g_SystemHeap, sizeof(g_SystemHeap));
-
+       
        /* SCIデバドラ生成 */
        SciDrv_Create(&g_SciDrv[0], (void *)0xffffb0, 52, 20000000L, 64);       /* SCI0 */
        SciDrv_Create(&g_SciDrv[1], (void *)0xffffb8, 56, 20000000L, 64);       /* SCI1 */
@@ -54,28 +54,36 @@ void Sample_Startup(VP_INT exinf)
        devinf.ObjSize    = sizeof(C_SCIFILE);
        devinf.pParam     = &g_SciDrv[0];
        SysFile_AddDevice("/dev", &devinf);
-
+       
        /* SCI1 を /dev/com1 に登録 */
        strcpy(devinf.szName, "com1");
        devinf.pfncCreate = SciFile_Create;
        devinf.ObjSize    = sizeof(C_SCIFILE);
        devinf.pParam     = &g_SciDrv[1];
        SysFile_AddDevice("/dev", &devinf);
-
-
+       
+       
        /*************************/
        /*     ちょいテスト      *
        /*************************/
        {
                HANDLE hFile;
                char c;
+               char buf[256];
                
                hFile = File_Open("/dev/com1", FILE_MODE_READ | FILE_MODE_WRITE);
+               
+               File_PutString(hFile, "Hello!\r\n");
+               
+               Shell_InputTty(hFile, buf, sizeof(buf));
+               
                for ( ; ; )
                {
-                       File_Read(hFile, &c, 1);        /* 1文字読み込み */
-                       c += 1;                                         /* 1文字ずらす */
-                       File_Write(hFile, &c, 1);       /* 1文字書き込み */
+                       c = File_GetChar(hFile);
+                       
+                       File_PrintHexByte(hFile, c);
+                       File_PutChar(hFile, '\r');
+                       File_PutChar(hFile, '\n');
                }
        }
 }
index 2de6da9..7572122 100755 (executable)
@@ -158,10 +158,10 @@ void SciDrv_IsrRecv(void *pParam)
        {
                StreamBuf_SendChar(&self->StmBuf, c);
        }
-       
        SysEvt_Set(self->hEvtRecv);
 }
 
+
 /* 送信エンプティー */
 void SciDrv_IsrSend(void *pParam)
 {
@@ -173,6 +173,7 @@ void SciDrv_IsrSend(void *pParam)
        SysEvt_Set(self->hEvtSend);
 }
 
+
 /* 送信終了 */
 void SciDrv_IsrSendEnd(void *pParam)
 {
diff --git a/aplfw/system/command.h b/aplfw/system/command.h
new file mode 100755 (executable)
index 0000000..63fb40f
--- /dev/null
@@ -0,0 +1,46 @@
+/** 
+ *  Hyper Operating System  Application Framework
+ *
+ * @file  handle.h
+ * @brief %jp{ハンドルオブジェクト}
+ *
+ * Copyright (C) 2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+/* コマンドのようなものを登録できるようにしてみるてすと */
+
+
+#ifndef __HOS__command_h__
+#define __HOS__command_h__
+
+
+#define COMMAND_MAX_NAME       32
+
+
+/* コマンド情報 */
+typedef struct t_command_cmdinf
+{
+       char szName[COMMAND_MAX_NAME];
+       int (*pfncMain)(int argc, char *argv[], void *pParam);
+       void *pParam;
+} T_COMMAND_CMDINF;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Command_AddCommand(const T_COMMAND_CMDINF *pCmdInf);      /* コマンドを登録する */
+void Command_Execute(const char *pszCommand);                          /* コマンドを実行する */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __HOS__handle_h__ */
+
+
+/* end of file */
index fc4f6e5..015af8f 100755 (executable)
@@ -12,7 +12,8 @@
 #include <stdio.h>
 #include <string.h>
 #include "file.h"
-#include "sysapi.h"
+#include "system/sysapi.h"
+#include "system/memory.h"
 
 
 #define FILE_MAX_DEVICE                16
@@ -162,5 +163,128 @@ FILESIZE File_Read(HANDLE hFile, void *pBuf, FILESIZE Size)
 }
 
 
+int File_GetChar(HANDLE hFile)
+{
+       char c;
+       if ( File_Read(hFile, &c, 1) != 1 )
+       {
+               return FILE_EOF;
+       }
+       return c;
+}
+
+int File_GetString(HANDLE hFile, char *pszString, int iSize)
+{
+       int i;
+       int c;
+
+       for ( i = 0; i < iSize - 1; i++ )
+       {
+               c = File_GetChar(hFile);
+               if ( c == FILE_EOF )
+               {
+                       if ( i == 0 )
+                       {
+                               return FILE_EOF;
+                       }
+                       break;
+               }
+       
+               pszString[i] = c;
+
+               if ( c == '\n' )
+               {
+                       break;
+               }
+       }
+       pszString[i] = '\0';
+
+       return i;
+}
+
+
+int File_PutChar(HANDLE hFile, int c)
+{
+       char b;
+       b = (char)c;
+       if ( File_Write(hFile, &b, 1) == 1 )
+       {
+               return b;
+       }
+       return FILE_EOF;
+}
+
+
+int File_PutString(HANDLE hFile, const char *pszString)
+{
+       return File_Write(hFile, pszString, strlen(pszString));
+}
+
+
+int File_PrintFormatV(HANDLE hFile, const char *pszFormat, va_list argptr)
+{
+       char *pBuf;
+       int  iRet = 0;
+       
+       pBuf = (char *)Memory_Alloc(128);
+       if ( pBuf != NULL )
+       {
+/*             iRet = vsprintf(pBuf, pszFormat, argptr);       */      /* 肥大化するのでちと保留 */
+               if ( iRet > 0 )
+               {
+                       iRet = File_Write(hFile, pBuf, iRet);
+               }
+               Memory_Free(pBuf);
+       }
+
+       return iRet;
+}
+
+
+int File_PrintFormat(HANDLE hFile, const char *pszFormat, ...)
+{
+       va_list argptr;
+       int iRet;
+
+       va_start(argptr, pszFormat);
+       iRet = File_PrintFormatV(hFile, pszFormat, argptr);
+       va_end(argptr);
+
+       return iRet;
+}
+
+
+void File_PrintHexNibble(HANDLE hFile, unsigned char c)
+{
+       c &= 0xf;
+       if ( c < 10 )
+       {
+               c = c + '0';
+       }
+       else
+       {
+               c = c - 10 + 'a';
+       }
+       File_PutChar(hFile, c);
+}
+
+void File_PrintHexByte(HANDLE hFile, unsigned char ubData)
+{
+       File_PrintHexNibble(hFile, (unsigned char)(ubData >> 4));
+       File_PrintHexNibble(hFile, (unsigned char)(ubData >> 0));
+}
+
+void File_PrintHexHalfWord(HANDLE hFile, unsigned short uhData)
+{
+       File_PrintHexByte(hFile, (unsigned char)(uhData >> 8));
+       File_PrintHexByte(hFile, (unsigned char)(uhData >> 0));
+}
+
+void File_PrintHexWord(HANDLE hFile, unsigned long uwData)
+{
+       File_PrintHexHalfWord(hFile, (unsigned short)(uwData >> 16));
+       File_PrintHexHalfWord(hFile, (unsigned short)(uwData >> 0));
+}
+
 
 /* end of file */
index 2c0b41e..3122a28 100755 (executable)
@@ -13,6 +13,7 @@
 #define __HOS__file_h__
 
 
+#include <stdarg.h>
 #include "system/handle.h"
 
 #define FILE_MAX_PATH                          128                     /* パス名の最大値 */
@@ -118,6 +119,13 @@ FILEPOS  File_Seek(HANDLE hFile, FILEPOS Offset, int iOrign);
 FILESIZE File_Read(HANDLE hFile, void *pBuf, FILESIZE Size);
 FILESIZE File_Write(HANDLE hFile, const void *pData, FILESIZE Size);
 
+int      File_GetChar(HANDLE hFile);
+int      File_GetString(HANDLE hFile, char *pszString, int iSize);
+int      File_PutChar(HANDLE hFile, int c);
+int      File_PutString(HANDLE hFile, const char *pszString);
+int      File_PrintFormatV(HANDLE hFile, const char *pszFormat, va_list argptr);
+int      File_PrintFormat(HANDLE hFile, const char *pszFormat, ...);
+
 FILEERR  File_Sync(HANDLE hFile);
 FILEPOS  File_GetFileSize(HANDLE hFile);
 FILESIZE File_GetReadSize(HANDLE hFile);
@@ -128,6 +136,8 @@ FILESIZE File_GetWriteBuf(HANDLE hFile, void **ppBuf);
 FILESIZE File_SendWriteBuf(HANDLE hFile, void *pBuf, long lSize);
 FILEERR  File_CanWriteBuf(HANDLE hFile, void *pBuf);
 
+
+
 /* システムAPI */
 void     SysFile_Initialize(void);                                                                                                     /* ファイルシステムの初期化 */
 FILEERR  SysFile_AddDevice(const char *pszPath, const T_SYSFILE_DEVINF *pDevInf);      /* デバイスファイルの追加 */
index 85a9b95..b12389a 100755 (executable)
@@ -29,6 +29,11 @@ typedef struct c_processobj
        int         iExitCode;                                          /* 終了コード */
        HANDLE          *pHandleList;                                   /* 所有するハンドルのリスト(終了時に開放) */
        char            szCurrentDir[FILE_MAX_PATH];    /* カレントディレクトリ */
+
+       struct c_processobj     *pParentProcess;                /* 親プロセス */
+       struct c_processobj     *pPrevProcess;                  /* 姉妹プロセス */
+       struct c_processobj     *pNextProcess;                  /* 姉妹プロセス */
+       struct c_processobj     *pChildProcess;                 /* 子プロセス */
 #endif
 } C_PROCESSOBJ;
 
diff --git a/aplfw/system/shell.c b/aplfw/system/shell.c
new file mode 100755 (executable)
index 0000000..daaa27d
--- /dev/null
@@ -0,0 +1,96 @@
+
+
+#include "system/file.h"
+#include "kernel.h"
+
+#define SHELL_TERM_COLUMN              80
+
+#define SHELL_STATE_NORMAL             0
+#define SHELL_STATE_ESC                        1
+#define SHELL_STATE_ARROW              2
+
+
+/* インタラクティブモードでのコマンド入力(とりあえずVT100互換しか考えない) */
+int Shell_InputTty(HANDLE hTty, char *pszBuf, int iBufSize)
+{
+       int iCurPos;                                            /* 画面上のカーソル位置 */
+       int iPos = 0;                                           /* 入力位置 */
+       int iLen = 0;                                           /* コマンドの長さ */
+       int iState = SHELL_STATE_NORMAL;
+       int c;
+
+       /* プロンプトを出す */
+       File_PutString(hTty, "% ");
+       iCurPos = 2;
+
+       for ( ; ; )
+       {
+               c = File_GetChar(hTty);
+               switch ( iState )
+               {
+               case SHELL_STATE_NORMAL:        /* 通常 */
+                       switch ( c )
+                       {
+                       case '\r':              /* 改行なら入力完了 */
+                               pszBuf[iLen] = '\0';
+                               File_PutString(hTty, "\r\n");
+                               return iLen;
+
+                       case '\x1b':    /* エアスケープ文字なら */
+                               iState = SHELL_STATE_ESC;
+                               break;
+
+                       default:                /* カーソル位置に文字設定 */
+                               pszBuf[iPos] = (char)c;
+                               if ( iLen == iPos )
+                               {
+                                       /* 末尾追加なら */
+                                       if ( iLen < iBufSize - 1)
+                                       {
+                                               File_PutChar(hTty, c);
+                                               iLen++;
+                                               iCurPos = (iCurPos + 1) % SHELL_TERM_COLUMN;
+                                               iPos++;
+                                       }
+                                       else
+                                       {
+                                               File_PutChar(hTty, '\b');
+                                       }
+                               }
+                               break;
+                       }
+                       break;
+
+               case SHELL_STATE_ESC:   /* エスケープ後続 */     
+                       switch ( c )
+                       {
+                       case '\x5b':
+                               iState = SHELL_STATE_ARROW;
+                               break;
+                       default:
+                               iState = SHELL_STATE_NORMAL;
+                       }
+                       break;
+
+               case SHELL_STATE_ARROW: /* 矢印 */    
+                       switch ( c )
+                       {
+                       case '\x41':    /* 上 */
+                               break;
+
+                       case '\x42':    /* 下 */
+                               break;
+                       
+                       case '\x43':    /* 右 */
+                               File_PutString(hTty, "\x1b[1C");        /* カーソル右 */
+                               break;
+                       
+                       case '\x44':    /* 左 */
+                               File_PutString(hTty, "\x1b[1D");        /* カーソル左 */
+                               break;
+                       }
+                       iState = SHELL_STATE_NORMAL;
+                       break;
+               }
+       }
+}
index c811cf6..c4c99d8 100755 (executable)
@@ -19,6 +19,7 @@ DSP_DIR     = $(CORE_DIR)/dsp
 QUE_DIR     = $(CORE_DIR)/que
 TOQ_DIR     = $(CORE_DIR)/toq
 HEP_DIR     = $(CORE_DIR)/hep
+DPC_DIR     = $(CORE_DIR)/dpc
 
 SYSOBJ_DIR  = $(OBJ_DIR)/sys
 TSKOBJ_DIR  = $(OBJ_DIR)/tsk
@@ -31,7 +32,7 @@ ISROBJ_DIR  = $(OBJ_DIR)/isr
 TIMOBJ_DIR  = $(OBJ_DIR)/tim
 
 
-VPATH := $(VPATH):$(DSP_DIR):$(QUE_DIR):$(TOQ_DIR):$(HEP_DIR):$(SYSOBJ_DIR):$(TSKOBJ_DIR)
+VPATH := $(VPATH):$(DSP_DIR):$(QUE_DIR):$(TOQ_DIR):$(HEP_DIR):$(DPC_DIR):$(SYSOBJ_DIR):$(TSKOBJ_DIR)
 VPATH := $(VPATH):$(SEMOBJ_DIR):$(FLGOBJ_DIR):$(MBXOBJ_DIR):$(MPFOBJ_DIR):$(INHOBJ_DIR):$(ISROBJ_DIR):$(TIMOBJ_DIR)
 
 
@@ -60,6 +61,10 @@ CSRCS         += $(DSP_DIR)/ent_tsk.c                        \
                  $(HEP_DIR)/cre_hep.c                  \
                  $(HEP_DIR)/alc_hep.c                  \
                  $(HEP_DIR)/fre_hep.c                  \
+                 $(DPC_DIR)/dpc_fre.c                  \
+                 $(DPC_DIR)/dpc_rcv.c                  \
+                 $(DPC_DIR)/dpc_snd.c                  \
+                 $(DPC_DIR)/lev_svc.c                  \
                  $(SYSOBJ_DIR)/sta_knl.c               \
                  $(SYSOBJ_DIR)/get_tid.c               \
                  $(SYSOBJ_DIR)/loc_cpu.c               \
@@ -154,7 +159,9 @@ CORE_HEADERS   = $(INC_DIR)/core/adtq.h                     \
                  $(INC_DIR)/core/rdq.h                 \
                  $(INC_DIR)/core/sys.h                 \
                  $(INC_DIR)/core/tmq.h                 \
-                 $(INC_DIR)/core/toq.h
+                 $(INC_DIR)/core/toq.h                 \
+                 $(INC_DIR)/core/dpc.h
+
 
 TSKOBJ_HEADERS = $(INC_DIR)/object/tskobj.h
 
index 35bdf38..fe91442 100755 (executable)
@@ -152,6 +152,10 @@ SOURCE=..\..\..\..\include\core\core.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\..\..\include\core\dpc.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\..\..\include\core\dsp.h\r
 # End Source File\r
 # Begin Source File\r
@@ -430,6 +434,26 @@ SOURCE=..\..\..\..\source\core\tmq\sig_tmq.c
 SOURCE=..\..\..\..\source\core\adtq\snd_adtq.c\r
 # End Source File\r
 # End Group\r
+# Begin Group "dpc"\r
+\r
+# PROP Default_Filter ""\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\..\source\core\dpc\dpc_fre.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\..\source\core\dpc\dpc_rcv.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\..\source\core\dpc\dpc_snd.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\..\source\core\dpc\lev_svc.c\r
+# End Source File\r
+# End Group\r
 # End Group\r
 # Begin Group "object"\r
 \r
index fe08d9e..a78d1c6 100755 (executable)
@@ -4,7 +4,7 @@
  * @file  dsp.h
  * @brief %jp{タスクディスパッチャのヘッダファイル}%en{task dispatcher heder file}
  *
- * @version $Id: dsp.h,v 1.3 2006-09-03 15:10:01 ryuz Exp $
+ * @version $Id: dsp.h,v 1.4 2006-11-06 10:59:36 ryuz Exp $
  *
  * Copyright (C) 1998-2006 by Project HOS
  * http://sourceforge.jp/projects/hos/
@@ -37,7 +37,7 @@ void _kernel_dsp_rsm_tsk(_KERNEL_T_TSKHDL tskhdl);            /**< %jp{タスクをサス
 #endif
 
 
-#define _KERNEL_DSP_TSK()                      _kernel_dsp_tsk()                       /**< タスクディスパッチ実施 */
+#define _KERNEL_DSP_TSK()                              _kernel_dsp_tsk()                               /**< タスクスケジュール実行 */
 
 
 #if _KERNEL_SPT_SUS_TSK        /*  %jp{サスペンドありのモデルの場合} */
index 5a03563..5e30571 100755 (executable)
@@ -4,7 +4,7 @@
  * @file  knl_sys.h
  * @brief %en{system heder file}%jp{システム制御のヘッダファイル}
  *
- * @version $Id: sys.h,v 1.3 2006-09-10 14:54:26 ryuz Exp $
+ * @version $Id: sys.h,v 1.4 2006-11-06 10:59:36 ryuz Exp $
  *
  * Copyright (C) 1998-2006 by Project HOS
  * http://sourceforge.jp/projects/hos/
@@ -19,6 +19,7 @@
 #include "core/hep.h"
 #include "core/toq.h"
 #include "core/tmq.h"
+#include "core/dpc.h"
 
 
 /* %jp{システムの状態} */
@@ -39,6 +40,9 @@ typedef struct _kernel_t_proccb
        VP                                      sysstk;                         /**< %jp{システムコンテキストのスタック} */
        SIZE                            intstksz;                       /**< %jp{割り込みコンテキストのスタックサイズ} */
        VP                                      intstk;                         /**< %jp{割り込みコンテキストのスタック} */
+#if _KERNEL_SPT_DPC
+       UINT                svcnst;                             /**< %jp{サービスコールネストカウンタ} */
+#endif
 } _KERNEL_T_PROCCB;
 
 
@@ -49,6 +53,11 @@ typedef struct _kernel_t_syscb
        _KERNEL_T_TOQ           toq;                            /**< %jp{タイムアウトキュー}%en{timeout-queue} */
        _KERNEL_T_TMQ           tmq;                            /**< %jp{タイマキュー}%en{timer-queue} */
        _KERNEL_T_HEPCB         memhep;                         /**< %jp{カーネルメモリヒープ}%en{kernel heap-memory control block} */
+
+#if _KERNEL_SPT_DPC
+       _KERNEL_T_DPCCB         dpccb;                          /**< %jp{遅延プロシージャコール用メッセージキュー} */
+#endif
+
        _KERNEL_T_PROCCB        proccb[1];                      /**< %jp{プロセッサ制御情報}%en{processor control block} */
 } _KERNEL_T_SYSCB;
 
@@ -57,7 +66,6 @@ typedef struct _kernel_t_syscb
 extern _KERNEL_T_SYSCB _kernel_syscb;
 
 
-
 #define _KERNEL_SYS_INI_SYS()                          do {} while (0)
 
 #define _KERNEL_SYS_GET_RDQ()                          (&_kernel_syscb.rdq)
@@ -98,9 +106,28 @@ extern _KERNEL_T_SYSCB _kernel_syscb;
 #define _KERNEL_SYS_SNS_DPN()                          ((_kernel_syscb.proccb[0].stat != _KERNEL_TSS_TSK) ? TRUE : FALSE)
 
 
+
+#if _KERNEL_SPT_DPC            /* %jp{遅延プロシージャコールの場合} */
+
+#define _KERNEL_ENTER_SVC()                                    do { _kernel_syscb.proccb[0].svcnst++; } while (0)
+#define _KERNEL_LEAVE_SVC()                                    do { _kernel_dpc_lev_svc(); } while (0)
+
+#define _KERNEL_SYS_LOC_DPC()                          do { _KERNEL_DIS_INT(); } while (0)
+#define _KERNEL_SYS_UNL_DPC()                          do { if (!(_KERNEL_SYS_GET_STST() & _KERNEL_TSS_DINT)){ _KERNEL_ENA_INT(); } } while (0)
+#define _KERNEL_SYS_SND_DPC(msg)                       _KERNEL_DPC_SND_MSG(&_kernel_syscb.dpccb, (msg))
+#define _KERNEL_SYS_RCV_DPC(p_msg)                     _KERNEL_DPC_RCV_MSG(&_kernel_syscb.dpccb, (p_msg))
+#define _KERNEL_SYS_RFR_DPC()                          _KERNEL_DPC_REF_FRE(&_kernel_syscb.dpccb)
+
+#define _KERNEL_SYS_REF_SVC()                          (_kernel_syscb.proccb[0].svcnst)
+#define _KERNEL_SYS_SET_SVC(x)                         do { _kernel_syscb.proccb[0].svcnst = (x); } while (0)
+
+#else                                  /* %jp{バズロック型の場合} */
+
 #define _KERNEL_ENTER_SVC()                                    do { _KERNEL_DIS_INT(); } while (0)
 #define _KERNEL_LEAVE_SVC()                                    do { if (!(_KERNEL_SYS_GET_STST() & _KERNEL_TSS_DINT)){ _KERNEL_ENA_INT(); } } while (0)
 
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
index f4e9467..d6889b0 100755 (executable)
@@ -4,7 +4,7 @@
  * @file  _tic_toq.c
  * @brief %jp{タスクをタイムアウトキューに追加}
  *
- * @version $Id: sig_toq.c,v 1.2 2006-10-08 05:30:35 ryuz Exp $
+ * @version $Id: sig_toq.c,v 1.3 2006-11-06 10:59:36 ryuz Exp $
  *
  * Copyright (C) 1998-2006 by Project HOS
  * http://sourceforge.jp/projects/hos/
@@ -57,7 +57,7 @@ void _kernel_sig_toq(
                _KERNEL_TSK_SET_ERCD(tcb, E_TMOUT);
                _KERNEL_DSP_WUP_TSK(tskhdl);
 
-               _KERNEL_DSP_TSK();                              /* %jp{遅延ディスパッチ予約を行う} */
+               _KERNEL_DSP_TSK();                      /* %jp{遅延ディスパッチ予約を行う} */
                
                /* %jp{キューから外す} */
                tskhdl_next = _KERNEL_TSK_GET_TOQNEXT(tcb);
index 465d1d1..237d1d5 100755 (executable)
@@ -4,7 +4,7 @@
  * @file  sta_inte.c
  * @brief %jp{割り込み処理開始}
  *
- * @version $Id: end_inh.c,v 1.1 2006-08-16 16:27:03 ryuz Exp $
+ * @version $Id: end_inh.c,v 1.2 2006-11-06 10:59:36 ryuz Exp $
  *
  * Copyright (C) 1998-2006 by Project HOS
  * http://sourceforge.jp/projects/hos/
@@ -16,7 +16,6 @@
 #include "object/inhobj.h"
 
 
-
 /** %jp{割り込み処理開始}
  * @return void
  */
@@ -24,6 +23,14 @@ void _kernel_end_inh(void)
 {
        _KERNEL_SYS_CLR_CTX();
        
+#if _KERNEL_SPT_DPC
+       /* サービスコール内での割り込みの場合ここではディスパッチしない */
+       if ( _KERNEL_SYS_REF_SVC() != 0 )
+       {
+               return;
+       }
+#endif
+       
        /* %jp{遅延しているディスパッチがあれば実施} */
        if ( _KERNEL_SYS_SNS_DLY() )
        {