--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filecat.h
+ * @brief %jp{ファイル結合コマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__filecat_h__
+#define __HOS__filecat_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int FileCat_Main(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __HOS__filecat_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filecat_main.c
+ * @brief %jp{ファイル結合コマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "hosaplfw.h"
+#include "filecat.h"
+
+
+#define FILECAT_BUFSIZE 4096
+
+
+/* ファイル結合コマンド */
+int FileCat_Main(int argc, char *argv[])
+{
+ HANDLE hFile;
+ int i;
+ FILE_SIZE Size;
+ void *pBuf;
+
+ /* バッファ確保 */
+ pBuf = Memory_Alloc(FILECAT_BUFSIZE);
+ if ( pBuf == NULL )
+ {
+ return 1;
+ }
+
+ /* 結合 */
+ for ( i = 1; i < argc; i++ )
+ {
+ /* Open */
+ if ( (hFile = File_Open(argv[i], FILE_OPEN_READ | FILE_OPEN_EXIST)) == HANDLE_NULL )
+ {
+ continue;
+ }
+
+ /* 読み出し */
+ while ( (Size = File_Read(hFile, pBuf, FILECAT_BUFSIZE)) > 0 )
+ {
+ StdIo_Write(pBuf, Size);
+ }
+
+ /* Close */
+ File_Close(hFile);
+ }
+
+ /* バッファ開放 */
+ Memory_Free(pBuf);
+
+
+ return 0;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filelist.h
+ * @brief %jp{ファイルコピーコマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__filecopy_h__
+#define __HOS__filecopy_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int FileCopy_Main(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __HOS__filecopy_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filecopy_main.c
+ * @brief %jp{ファイルコピーコマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "hosaplfw.h"
+#include "filecopy.h"
+
+
+#define FILECOPY_BUFSIZE (4 * 1024)
+
+
+int FileCopy_Main(int argc, char *argv[])
+{
+ HANDLE hFileSrc;
+ HANDLE hFileDst;
+ void *pBuf;
+ FILE_SIZE Size;
+
+ /* 引数チェック */
+ if ( argc < 3 )
+ {
+ return 1;
+ }
+
+ /* バッファ確保 */
+ pBuf = Memory_Alloc(FILECOPY_BUFSIZE);
+ if ( pBuf == NULL )
+ {
+ return 1;
+ }
+
+ /* Open */
+ if ( (hFileSrc = File_Open(argv[1], FILE_OPEN_READ | FILE_OPEN_EXIST)) == HANDLE_NULL )
+ {
+ return 1;
+ }
+ if ( (hFileDst = File_Open(argv[2], FILE_OPEN_WRITE | FILE_OPEN_CREATE)) == HANDLE_NULL )
+ {
+ File_Close(hFileSrc);
+ return 1;
+ }
+
+
+ /* コピー */
+ while ( (Size = File_Read(hFileSrc, pBuf, FILECOPY_BUFSIZE)) > 0 )
+ {
+ File_Write(hFileDst, pBuf, Size);
+ }
+
+ /* Close */
+ File_Close(hFileSrc);
+ File_Close(hFileDst);
+
+ /* バッファ開放 */
+ Memory_Free(pBuf);
+
+ return 0;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filedump.h
+ * @brief %jp{ファイルダンプコマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__filedump_h__
+#define __HOS__filedump_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int FileDump_Main(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __HOS__filedump_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file filedump_main.c
+ * @brief %jp{ファイルダンプコマンド}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "hosaplfw.h"
+#include "filedump.h"
+
+#define FILEDUMP_BUFSIZE 4096
+
+
+int FileDump_Main(int argc, char *argv[])
+{
+ HANDLE hFile;
+ unsigned char *pubBuf;
+ unsigned long ulSize = 0x7fffffff;
+ unsigned long ulPos = 0;
+ int iReadSize;
+ int i;
+
+ /* 引数チェック */
+ if ( argc < 2 )
+ {
+ StdIo_PrintFormat(
+ "<usage>\n"
+ " %s filename [size] [offest]\n\n",
+ argv[0]
+ );
+ return 1;
+ }
+
+ /* コマンドライン解析 */
+ if ( argc >= 3 )
+ {
+ ulSize = (int)strtoul(argv[2], 0, 0);
+ }
+ if ( argc >= 4 )
+ {
+ ulPos = (int)strtoul(argv[3], 0, 0);
+ }
+
+
+ /* ファイルをを開く */
+ if ( (hFile = File_Open(argv[1], FILE_OPEN_READ)) == HANDLE_NULL )
+ {
+ return 1;
+ }
+ ulPos = File_Seek(hFile, ulPos, FILE_SEEK_SET);
+
+
+ /* バッファ確保 */
+ pubBuf = (unsigned char *)Memory_Alloc(FILEDUMP_BUFSIZE);
+ if ( pubBuf == NULL )
+ {
+ File_Close(hFile);
+ return 1;
+ }
+
+
+ while ( ulSize > 0 )
+ {
+ if ( ulSize > FILEDUMP_BUFSIZE )
+ {
+ iReadSize = FILEDUMP_BUFSIZE;
+ }
+ else
+ {
+ iReadSize = (int)ulSize;
+ }
+
+ iReadSize = File_Read(hFile, pubBuf, iReadSize);
+ if ( iReadSize <= 0 )
+ {
+ break;
+ }
+ ulSize -= iReadSize;
+
+ for ( i = 0; i < iReadSize; i++ )
+ {
+ if ( i % 16 == 0 )
+ {
+ StdIo_PrintFormat("%08lx: ", ulPos);
+ }
+ StdIo_PrintFormat("%02x ", pubBuf[i]);
+ ulPos++;
+ if ( i % 16 == 15 )
+ {
+ StdIo_PrintFormat("\n");
+ }
+ }
+ }
+ StdIo_PrintFormat("\n");
+
+
+ /* メモリ開放 */
+ Memory_Free(pubBuf);
+
+ /* ファイルを閉じる */
+ File_Close(hFile);
+
+ return 0;
+}
+
+
+/* end of file */
#endif
-#endif /* __HOS__filelist_h__
- */
+#endif /* __HOS__filelist_h__ */
/* end of file */
$(SYSAPI_DIR)/sysprc_exit.c \
$(SYSAPI_DIR)/sysprc_getcurrenthandle.c \
$(SYSAPI_DIR)/sysprc_start.c \
+ $(SYSAPI_DIR)/systim_getsystemtime.c \
$(SYSAPI_DIR)/systim_wait.c
CSRCS += $(MEMORY_DIR)/memory.c
+# Time
+TIME_DIR = $(APLFW_DIR)/system/time
+SRC_DIRS += $(TIME_DIR)
+CSRCS += $(TIME_DIR)/time_getsystemtime.c \
+ $(TIME_DIR)/time_wait.c
+
+
# Process
PROCESS_DIR = $(APLFW_DIR)/system/process
SRC_DIRS += $(PROCESS_DIR)
CSRCS += $(MEMPOL_DIR)/mempol.c
-# Stream Buffer
-STMBUF_DIR = $(APLFW_DIR)/library/container/stmbuf
-SRC_DIRS += $(STMBUF_DIR)
-CSRCS += $(STMBUF_DIR)/stmbuf.c
-
-
# Association Array
ASSOC_DIR = $(APLFW_DIR)/library/container/assoc
SRC_DIRS += $(ASSOC_DIR)
CSRCS += $(ASSOC_DIR)/assoc.c
+
# List
LIST_DIR = $(APLFW_DIR)/library/container/list
SRC_DIRS += $(LIST_DIR)
$(LIST_DIR)/list_remove.c
+# Stream Buffer
+STREAMBUF_DIR = $(APLFW_DIR)/library/container/streambuf
+SRC_DIRS += $(STREAMBUF_DIR)
+CSRCS += $(STREAMBUF_DIR)/streambuf_create.c \
+ $(STREAMBUF_DIR)/streambuf_getbuf.c \
+ $(STREAMBUF_DIR)/streambuf_sendbuf.c \
+ $(STREAMBUF_DIR)/streambuf_senddata.c \
+ $(STREAMBUF_DIR)/streambuf_sendchar.c \
+ $(STREAMBUF_DIR)/streambuf_recvbuf.c \
+ $(STREAMBUF_DIR)/streambuf_relbuf.c \
+ $(STREAMBUF_DIR)/streambuf_recvdata.c \
+ $(STREAMBUF_DIR)/streambuf_recvchar.c \
+ $(STREAMBUF_DIR)/streambuf_clear.c \
+ $(STREAMBUF_DIR)/streambuf_refdatasize.c \
+ $(STREAMBUF_DIR)/streambuf_reffreesize.c
+
+
+# Packet Buffer
+PACKETBUF_DIR = $(APLFW_DIR)/library/container/packetbuf
+SRC_DIRS += $(PACKETBUF_DIR)
+CSRCS += $(PACKETBUF_DIR)/packetbuf_create.c \
+ $(PACKETBUF_DIR)/packetbuf_getbuf.c \
+ $(PACKETBUF_DIR)/packetbuf_sendbuf.c \
+ $(PACKETBUF_DIR)/packetbuf_senddata.c \
+ $(PACKETBUF_DIR)/packetbuf_recvbuf.c \
+ $(PACKETBUF_DIR)/packetbuf_relbuf.c \
+ $(PACKETBUF_DIR)/packetbuf_recvdata.c \
+ $(PACKETBUF_DIR)/packetbuf_clear.c
+
+
# --------------------------------------------------
# Device Drivers
SRC_DIRS += $(FILELIST_DIR)
CSRCS += $(FILELIST_DIR)/filelist_main.c
+# File Cat
+FILECAT_DIR = $(APLFW_DIR)/application/filecmd/filecat
+SRC_DIRS += $(FILECAT_DIR)
+CSRCS += $(FILECAT_DIR)/filecat_main.c
+
+# File Copy
+FILECOPY_DIR = $(APLFW_DIR)/application/filecmd/filecopy
+SRC_DIRS += $(FILECOPY_DIR)
+CSRCS += $(FILECOPY_DIR)/filecopy_main.c
+
+# File Dump
+FILEDUMP_DIR = $(APLFW_DIR)/application/filecmd/filedump
+SRC_DIRS += $(FILEDUMP_DIR)
+CSRCS += $(FILEDUMP_DIR)/filedump_main.c
+
# Memory Dump
MEMDUMP_DIR = $(APLFW_DIR)/application/utility/memdump
SRC_DIRS += $(KEYTEST_DIR)
CSRCS += $(KEYTEST_DIR)/keytest_main.c
+# Time Command
+TIMECMD_DIR = $(APLFW_DIR)/application/utility/timecmd
+SRC_DIRS += $(TIMECMD_DIR)
+CSRCS += $(TIMECMD_DIR)/timecmd_main.c
+
# Ether Snoopt
ETHERSNOOP_DIR = $(APLFW_DIR)/application/netcmd/ethersnoop
#define AT91USART_US_CR 0x00 /* Control Register */
#define AT91USART_US_MR 0x04 /* Mode Register */
-#define AT91USART_US_IER 0x08 /* Interrupt Enable Register */
-#define AT91USART_US_IDR 0x0c /* Interrupt Disable Register */
-#define AT91USART_US_IMR 0x10 /* Interrupt Mask Register */
-#define AT91USART_US_CSR 0x14 /* Channel Status Register */
-#define AT91USART_US_RHR 0x18 /* Receiver Holding Register */
-#define AT91USART_US_THR 0x1c /* Transmitter Holding Register */
+#define AT91USART_US_IER 0x08 /* Interrupt Enable Register */
+#define AT91USART_US_IDR 0x0c /* Interrupt Disable Register */
+#define AT91USART_US_IMR 0x10 /* Interrupt Mask Register */
+#define AT91USART_US_CSR 0x14 /* Channel Status Register */
+#define AT91USART_US_RHR 0x18 /* Receiver Holding Register */
+#define AT91USART_US_THR 0x1c /* Transmitter Holding Register */
#define AT91USART_US_BRGR 0x20 /* Baud Rate Generator Register */
#define AT91USART_US_RTOR 0x24 /* Receiver Time-out Register */
#define AT91USART_US_TTGR 0x28 /* Transmitter Time-guard Register */
-#define AT91USART_US_RPR 0x30 /* Receive Pointer Register */
-#define AT91USART_US_RCR 0x34 /* Receive Counter Register */
-#define AT91USART_US_TPR 0x38 /* Transmit Pointer Register */
-#define AT91USART_US_TCR 0x3c /* Transmit Counter Register */
+#define AT91USART_US_RPR 0x30 /* Receive Pointer Register */
+#define AT91USART_US_RCR 0x34 /* Receive Counter Register */
+#define AT91USART_US_TPR 0x38 /* Transmit Pointer Register */
+#define AT91USART_US_TCR 0x3c /* Transmit Counter Register */
#define AT91USART_REG_WRITE(self, offset, val) do { *(unsigned long *)((char *)(self)->pRegBase + (offset)) = (val); } while(0)
#define AT91USART_REG_READ(self, offset) (*((unsigned long *)((char *)(self)->pRegBase + (offset))))
#include "system/sysapi/sysapi.h"
#include "system/file/chrdrv.h"
#include "pc16550hal.h"
-#include "library/container/stmbuf/stmbuf.h"
+#include "library/container/streambuf/streambuf.h"
/* PC16550用ドライバ制御部 */
void Pc16550Drv_Close(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
/* クローズ処理 */
if ( --self->iOpenCount == 0 )
}
/* ディスクリプタ削除 */
- ChrFile_Delete(pChrFile);
+ ChrFile_Delete(pFile);
SysMem_Free(pFileObj);
}
FILE_ERR Pc16550Drv_Flush(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_OK;
}
FILE_ERR Pc16550Drv_IoControl(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, int iFunc, void *pInBuf, FILE_SIZE InSize, const void *pOutBuf, FILE_SIZE OutSize)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_NG;
}
HANDLE Pc16550Drv_Open(C_DRVOBJ *pDrvObj, const char *pszPath, int iMode)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
self = (C_PC16550DRV *)pDrvObj;
/* create file descriptor */
- if ( (pChrFile = SysMem_Alloc(sizeof(*pChrFile))) == NULL )
+ if ( (pFile = SysMem_Alloc(sizeof(*pFile))) == NULL )
{
return HANDLE_NULL;
}
- ChrFile_Create(pChrFile, pDrvObj, NULL);
+ ChrFile_Create(pFile, pDrvObj, NULL);
/* オープン処理 */
SysInt_Enable(self->iIntNum);
}
- return (HANDLE)pChrFile;
+ return (HANDLE)pFile;
}
FILE_SIZE Pc16550Drv_Read(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, void *pBuf, FILE_SIZE Size)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
unsigned char *pubBuf;
FILE_SIZE i;
int c;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
pubBuf = (unsigned char *)pBuf;
{
while ( (c = StreamBuf_RecvChar(&self->StmBufRecv)) < 0 )
{
- if ( pChrFile->cReadMode == FILE_RMODE_BLOCKING )
+ if ( pFile->cReadMode == FILE_RMODE_BLOCKING )
{
/* ブロッキングなら受信イベントを待つ */
SysEvt_Wait(self->hEvtRecv);
FILE_POS Pc16550Drv_Seek(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, FILE_POS Offset, int iOrign)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_NG;
}
FILE_SIZE Pc16550Drv_Write(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, const void *pData, FILE_SIZE Size)
{
C_PC16550DRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
const unsigned char *pubBuf;
FILE_SIZE i;
int c;
/* upper cast */
- self = (C_PC16550DRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_PC16550DRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
pubBuf = (const unsigned char *)pData;
c = *pubBuf++;
while ( Pc16550Hal_SendChar(&self->Pc16550Hal, c) < 0 )
{
- if ( pChrFile->cWriteMode == FILE_WMODE_BLOCKING )
+ if ( pFile->cWriteMode == FILE_WMODE_BLOCKING )
{
/* ブロッキングなら送信割り込みを待つ */
Pc16550Hal_EnableInterrupt(&self->Pc16550Hal, PC16550HAL_IER_ERBFI | PC16550HAL_IER_ETBEI);
#include "system/sysapi/sysapi.h"
#include "system/file/chrdrv.h"
#include "scihal.h"
-#include "library/container/stmbuf/stmbuf.h"
+#include "library/container/streambuf/streambuf.h"
/* SCI用ドライバ制御部 */
FILE_ERR SciDrv_Flush(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj)
{
C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_SCIDRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_SCIDRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_OK;
}
FILE_ERR SciDrv_IoControl(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, int iFunc, void *pInBuf, FILE_SIZE InSize, const void *pOutBuf, FILE_SIZE OutSize)
{
C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_SCIDRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_SCIDRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_NG;
}
HANDLE SciDrv_Open(C_DRVOBJ *pDrvObj, const char *pszPath, int iMode)
{
C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
self = (C_SCIDRV *)pDrvObj;
/* create file descriptor */
- if ( (pChrFile = SysMem_Alloc(sizeof(*pChrFile))) == NULL )
+ if ( (pFile = SysMem_Alloc(sizeof(*pFile))) == NULL )
{
return HANDLE_NULL;
}
- ChrFile_Create(pChrFile, pDrvObj, NULL);
+ ChrFile_Create(pFile, pDrvObj, NULL);
/* オープン処理 */
if ( self->iOpenCount++ == 0 )
SciHal_EnableInterrupt(&self->SciHal, SCIHAL_INT_RIE);
}
- return (HANDLE)pChrFile;
+ return (HANDLE)pFile;
}
/** %jp{受信} */
FILE_SIZE SciDrv_Read(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, void *pBuf, FILE_SIZE Size)
{
- C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_SCIDRV *self;
+ C_CHRFILE *pFile;
unsigned char *pubBuf;
FILE_SIZE i;
int c;
/* upper cast */
- self = (C_SCIDRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_SCIDRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
pubBuf = (unsigned char *)pBuf;
{
while ( (c = StreamBuf_RecvChar(&self->StmBufRecv)) < 0 )
{
- if ( pChrFile->cReadMode == FILE_RMODE_BLOCKING )
+ if ( pFile->cReadMode == FILE_RMODE_BLOCKING )
{
/* ブロッキングなら受信イベントを待つ */
SysEvt_Wait(self->hEvtRecv);
FILE_POS SciDrv_Seek(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, FILE_POS Offset, int iOrign)
{
C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_CHRFILE *pFile;
/* upper cast */
- self = (C_SCIDRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_SCIDRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
return FILE_ERR_NG;
}
/** %jp{送信} */
FILE_SIZE SciDrv_Write(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, const void *pData, FILE_SIZE Size)
{
- C_SCIDRV *self;
- C_CHRFILE *pChrFile;
+ C_SCIDRV *self;
+ C_CHRFILE *pFile;
const unsigned char *pubBuf;
FILE_SIZE i;
int c;
/* upper cast */
- self = (C_SCIDRV *)pDrvObj;
- pChrFile = (C_CHRFILE *)pFileObj;
+ self = (C_SCIDRV *)pDrvObj;
+ pFile = (C_CHRFILE *)pFileObj;
pubBuf = (const unsigned char *)pData;
c = *pubBuf++;
while ( SciHal_SendChar(&self->SciHal, c) < 0 )
{
- if ( pChrFile->cWriteMode == FILE_WMODE_BLOCKING )
+ if ( pFile->cWriteMode == FILE_WMODE_BLOCKING )
{
/* ブロッキングなら送信割り込みを待つ */
SciHal_EnableInterrupt(&self->SciHal, SCIHAL_INT_TIE | SCIHAL_INT_RIE);
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+void TcpIp_Close(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj)
+{
+ C_TCPIP *self;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+}
+
+
+/* endof file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+void TcpIp_Delete(C_DRVOBJ *pDrvObj)
+{
+ C_TCPIP *self;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+
+ SysMtx_Delete(self->hMtxLock);
+ SysMtx_Delete(self->hMtxSend);
+
+
+ /* 親クラスデストラクタ呼び出し */
+ ChrDrv_Delete(&self->ChrDrv);
+}
+
+
+/* endof file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+FILE_ERR TcpIp_Flush(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj)
+{
+ return FILE_ERR_NG;
+}
+
+
+
+/* endof file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+FILE_ERR TcpIp_IoControl(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, int iFunc, void *pInBuf, FILE_SIZE InSize, const void *pOutBuf, FILE_SIZE OutSize)
+{
+ C_TCPIP *self;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+
+ return FILE_ERR_NG;
+}
+
+
+/* endof file */
#include "tcpip.h"
#include "system/file/chrfile.h"
-#include "library/container/stmbuf/stmbuf.h"
+#include "library/container/streambuf/streambuf.h"
#define TCP_FLAG_FIN 0x01
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file ipether.h
+ * @brief %jp{Ether上にIPプロトコルを実装(つまりMAC層近辺)}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "tcpip_local.h"
+
+
+HANDLE TcpIp_Open(C_DRVOBJ *pDrvObj, const char *pszPath, int iMode)
+{
+ C_TCPIP *self;
+ C_TCPIPFILE *pFile;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+
+ /* create file descriptor */
+ if ( (pFile = SysMem_Alloc(sizeof(C_TCPIPFILE))) == NULL )
+ {
+ return HANDLE_NULL;
+ }
+ ChrFile_Create(&pFile->ChrFile, pDrvObj, NULL);
+ StreamBuf_Create(&pFile->RecvBuf, TCPIPFILE_RECV_BUFSIZE, pFile->ubRecvBuf);
+ pFile->hEvtRecv = SysEvt_Create();
+
+ /* デバイスオープン処理 */
+ if ( self->iOpenCount++ == 0 )
+ {
+ }
+
+ /* オープン処理 */
+ if ( strncmp(pszPath, "udp:", 4) == 0 )
+ {
+ /* UDPポートオープン */
+ pFile->iType = TCPIPFILE_TYPE_UDP;
+ pFile->uhPortNum = (unsigned short)atoi(&pszPath[4]);
+
+ /* リストに登録 */
+ if ( self->pUdpHead == NULL )
+ {
+ pFile->pNext = pFile;
+ pFile->pPrev = pFile;
+ self->pUdpHead = pFile;
+ }
+ else
+ {
+ pFile->pNext = self->pUdpHead;
+ pFile->pPrev = pFile->pPrev;
+ pFile->pNext->pPrev = pFile;
+ pFile->pPrev->pNext = pFile;
+ }
+ }
+
+ return (HANDLE)pFile;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+/* IPパケット受信 */
+FILE_SIZE TcpIp_Read(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, void *pBuf, FILE_SIZE Size)
+{
+ C_TCPIP *self;
+ C_TCPIPFILE *pFile;
+ int iRecvSize;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+ pFile = (C_TCPIPFILE *)pFileObj;
+
+
+ if ( pFile->iType == TCPIPFILE_TYPE_UDP )
+ {
+ unsigned short uhUdpSize;
+
+ while ( StreamBuf_RefDataSize(&pFile->RecvBuf) < sizeof(uhUdpSize) + sizeof(T_TCPIP_ADDRESS) )
+ {
+ SysEvt_Wait(pFile->hEvtRecv);
+ }
+
+ StreamBuf_RecvData(&pFile->RecvBuf, &uhUdpSize, sizeof(uhUdpSize));
+ StreamBuf_RecvData(&pFile->RecvBuf, pBuf, sizeof(T_TCPIP_ADDRESS) + (uhUdpSize - 8));
+
+ iRecvSize = sizeof(T_TCPIP_ADDRESS) + (uhUdpSize - 8);
+ }
+
+ return iRecvSize;
+}
+
+
+/* endof file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "tcpip_local.h"
+
+
+FILE_POS TcpIp_Seek(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, FILE_POS Offset, int iOrign)
+{
+ return (-1);
+}
+
+
+
+/* endof file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file tcpip.h
+ * @brief %jp{TCP/IP プロトコル}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "hosaplfw.h"
+#include "tcpip_local.h"
+#include "library/algorithm/ipchecksum/ipchecksum.h"
+
+
+FILE_SIZE TcpIp_Write(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, const void *pData, FILE_SIZE Size)
+{
+ C_TCPIP *self;
+ C_TCPIPFILE *pFile;
+ C_IPCHECKSUM ics;
+ unsigned short uhSum;
+ unsigned char *pubSendBuf;
+ int iSendSize;
+
+ /* upper cast */
+ self = (C_TCPIP *)pDrvObj;
+ pFile = (C_TCPIPFILE *)pFileObj;
+
+
+ if ( pFile->iType == TCPIPFILE_TYPE_UDP )
+ {
+ const T_TCPIP_ADDRESS *pAddr;
+ const unsigned char *pubData;
+
+ pAddr = (const T_TCPIP_ADDRESS *)pData;
+ pubData = (const unsigned char *)pData + sizeof(T_TCPIP_ADDRESS);
+
+ // iSendSize =
+
+ SysMtx_Lock(self->hMtxSend);
+
+ pubSendBuf = self->ubSendBuf;
+
+ /******** IPヘッダ ********/
+
+ /* バージョン4, ヘッダ長 0x14 */
+ pubSendBuf[0] = 0x45;
+
+ /* 優先度, サービスタイプ */
+ pubSendBuf[1] = 0x00;
+
+ /* データ長 */
+ pubSendBuf[2] = iSendSize / 256;
+ pubSendBuf[3] = iSendSize % 256;
+
+ /* ID */
+ pubSendBuf[4] = self->uhPacketId / 256;
+ pubSendBuf[5] = self->uhPacketId % 256;
+ self->uhPacketId++;
+
+ /* フラグメント */
+ pubSendBuf[6] = 0x00;
+ pubSendBuf[7] = 0x00;
+
+ /* TTL */
+ pubSendBuf[8] = 0xff;
+
+ /* プロトコル */
+ pubSendBuf[9] = 0x17; /* UDP */
+
+ /* チェックサム */
+ pubSendBuf[10] = 0;
+ pubSendBuf[11] = 0;
+
+ /* 送信元IPアドレス */
+// memcpy(&pubSendBuf[12], self->ubMyIpAddr, 4);
+
+ /* 送信先IPアドレス */
+ memcpy(&pubSendBuf[16], &pAddr->ubAddress, 4);
+
+
+ /******** IPヘッダ ********/
+
+ /* 発信元ポート番号 */
+ IP_SET_HALFWORD(&pubSendBuf[20], pFile->uhPortNum);
+
+ /* 発信先ポート番号 */
+ IP_SET_HALFWORD(&pubSendBuf[22], pFile->uhPortNum);
+
+ /* データ長 */
+ IP_SET_HALFWORD(&pubSendBuf[24], Size - sizeof(T_TCPIP_ADDRESS) + 8);
+
+ /* チェックサム */
+ IP_SET_HALFWORD(&pubSendBuf[26], 0);
+
+ /* データ */
+ memcpy(&pubSendBuf[28], pubData, Size - sizeof(T_TCPIP_ADDRESS));
+
+ }
+
+ return Size;
+}
+
+
+/* endof file */
FATVOL_UINT SectorsPerCluster; /**< クラスタあたりのセクタ数 */
FATVOL_UINT BytesPerCluster; /**< クラスタサイズ */
FATVOL_UINT FatStartSector; /**< FATの開始セクタ番号 */
+ FATVOL_UINT SectorNum; /**< 総セクタ数 */
FATVOL_UINT SectorPerFat; /**< FATあたりのセクタ数 */
FATVOL_UINT FatNum; /**< FATの個数 */
FATVOL_UINT RootDirEntryNum; /**< ルートディレクトリのエントリ数 */
FATVOL_UINT RootDirSector; /**< ルートディレクトリのセクタ */
FATVOL_UINT Cluster0Sector; /**< クラスタ0のセクタ番号 */
- FATVOL_UINT MaxClusterNum; /**< 最大クラスタ番号 */
+ FATVOL_UINT ClusterNum; /**< 総クラスタ数 */
FATVOL_UINT RootDirCluster; /**< ルートディレクトリのクラスタ番号 */
unsigned char *pubFatBuf; /**< FATのバッファリングメモリ */
{
C_FATVOL *self;
C_FATFILE *pFile;
+
+ /* フラッシュしておく */
+ FatVol_Flush(pDrvObj, pFileObj);
/* upper cast */
self = (C_FATVOL *)pDrvObj;
pFile = (C_FATFILE *)pFileObj;
-
+
+
/* クローズ処理 */
if ( --self->iOpenCount == 0 )
{
}
/* ディスクリプタ削除 */
- SysMem_Free(pFile);
+ FatVol_FileDelete(self, pFile);
}
{
case FATVOL_TYPE_FAT12:
case FATVOL_TYPE_FAT16:
- self->BytesPerSector = ubBuf[0x0b] + ubBuf[0x0c] * 256; /**< セクタサイズ */
- self->SectorsPerCluster = ubBuf[0x0d]; /**< 1クラスタのセクタ数 */
- self->BytesPerCluster = self->BytesPerSector * self->SectorsPerCluster;
- /**< 1クラスタサイズ */
- self->RootDirEntryNum = ubBuf[0x11] + ubBuf[0x12] * 256; /**< ルートディレクトリ最大エントリ数 */
- self->FatStartSector = ubBuf[0x0e] + ubBuf[0x0f] * 256; /**< FATの開始セクタ番号 */
- self->SectorPerFat = ubBuf[0x16] + ubBuf[0x17] * 256; /**< FATあたりのセクタ数 */
- self->FatNum = ubBuf[0x10]; /**< FAT個数 */
+ self->BytesPerSector = ubBuf[0x0b] + (ubBuf[0x0c] << 8); /**< セクタサイズ */
+ self->SectorsPerCluster = ubBuf[0x0d]; /**< 1クラスタのセクタ数 */
+ self->FatStartSector = ubBuf[0x0e] + (ubBuf[0x0f] << 8); /**< FATの開始セクタ番号 */
+ self->RootDirEntryNum = ubBuf[0x11] + (ubBuf[0x12] << 8); /**< ルートディレクトリ最大エントリ数 */
+ self->SectorNum = ubBuf[0x13] + (ubBuf[0x14] << 8); /**< 総セクタ数 */
+ self->SectorPerFat = ubBuf[0x16] + (ubBuf[0x17] << 8); /**< FATあたりのセクタ数 */
+ self->FatNum = ubBuf[0x10]; /**< FAT個数 */
self->RootDirSector = self->FatStartSector + (self->SectorPerFat * self->FatNum);
- /**< ルートディレクトリ開始位置 */
+ /**< ルートディレクトリ開始位置 */
+
+ self->BytesPerCluster = self->BytesPerSector * self->SectorsPerCluster; /**< 1クラスタサイズ */
self->Cluster0Sector = self->RootDirSector
+ (((self->RootDirEntryNum * 32) + self->BytesPerSector - 1) / self->BytesPerSector)
- - (2 * self->SectorsPerCluster); /**< クラスタ0の開始セクタ */
-
+ - (2 * self->SectorsPerCluster); /**< クラスタ0の開始セクタ */
+ self->ClusterNum = (self->SectorNum - self->Cluster0Sector) / self->SectorsPerCluster;
+ /**< 総クラスタ数 */
self->RootDirCluster = 0xf0000000;
/* FATバッファ準備 */
return FATVOL_ERR_NG;
}
- /* 最大クラスタ番号算出 */
- switch ( self->iFatType )
- {
- case FATVOL_TYPE_FAT12:
- self->MaxClusterNum = (self->SectorPerFat * self->BytesPerSector) / 3 * 2;
- if ( self->MaxClusterNum >= 0x0ff7 )
- {
- self->MaxClusterNum = 0x0ff6;
- }
- break;
-
- case FATVOL_TYPE_FAT16:
- self->MaxClusterNum = (self->SectorPerFat * self->BytesPerSector) / 2;
- if ( self->MaxClusterNum >= 0xfff7 )
- {
- self->MaxClusterNum = 0xfff6;
- }
- break;
-
- case FATVOL_TYPE_FAT32:
- self->MaxClusterNum = (self->SectorPerFat * self->BytesPerSector) / 4;
- break;
- }
-
/* クラスタバッファ取得 */
self->iClusterBufNum = 8;
self->pClusterBuf = (T_FATVOL_CLUSTERBUF *)SysMem_Alloc(sizeof(T_FATVOL_CLUSTERBUF) * self->iClusterBufNum);
self = (C_FATVOL *)pDrvObj;
pFile = (C_FATFILE *)pFileObj;
+ /* クリティカルセクションに入る */
+ SysMtx_Lock(self->hMtx);
+
+ /* FATの書き出し */
+ FatVol_FlushFat(self);
+
+ /* バッファのフラッシュ */
+ FatVol_FlushClusterBuf(self);
+
+
+ /* クリティカルセクションを出る */
+ SysMtx_Unlock(self->hMtx);
+
return FILE_ERR_OK;
}
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file fatvol.c
+ * @brief %jp{FATボリューム用デバイスドライバ}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <string.h>
+#include "fatvol_local.h"
+
+
+void FatVol_FlushClusterBuf(C_FATVOL *self)
+{
+ int i;
+
+ for ( i = 0; i < self->iClusterBufNum; i++ )
+ {
+ if ( self->pClusterBuf[i].uiClusterNum != FATVOL_CLUSTER_ENDMARKER && self->pClusterBuf[i].iDirty )
+ {
+ FatVol_ClusterWrite(self, self->pClusterBuf[i].uiClusterNum, self->pClusterBuf[i].pubBuf);
+ self->pClusterBuf[i].iDirty = 0;
+ }
+ }
+}
+
+
+/* end of file */
}
}
}
-
+
/* 更新フラグクリア */
memset(self->pubFatDirty, 0, self->SectorPerFat);
}
{
int iIndex;
+ if ( uiCluster < 2 || uiCluster >= 0xfffffff7 )
+ {
+ return -1;
+ }
+
/* 既にバッファに居ないか探索 */
for ( iIndex = 0; iIndex < self->iClusterBufNum; iIndex++ )
{
+++ /dev/null
-/**
- * Hyper Operating System Application Framework
- *
- * @file fatvol.c
- * @brief %jp{FATボリューム用デバイスドライバ}
- *
- * Copyright (C) 2006-2007 by Project HOS
- * http://sourceforge.jp/projects/hos/
- */
-
-
-
-#include <stdio.h>
-#include "fatvol_local.h"
-
-
-FILE_POS FatVol_GetFileSize(HANDLE hDir, int iDirEntry)
-{
- unsigned char ubBuf[4];
-
- File_Seek(hDir, 32*iDirEntry+28, FILE_SEEK_SET);
- File_Read(hDir, ubBuf, 4);
-
- return ubBuf[0] + (ubBuf[1] << 8) + (ubBuf[2] << 16) + (ubBuf[3] << 24);
-}
-
-
-/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file fatvol.c
+ * @brief %jp{FATボリューム用デバイスドライバ}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "fatvol_local.h"
+
+
+/* 空きクラスタの獲得 */
+FATVOL_UINT FatVol_GetNewCluster(C_FATVOL *self)
+{
+ FATVOL_UINT uiCluster;
+
+ /* 空きクラスタ検索 */
+ for ( uiCluster = 2; uiCluster < self->ClusterNum; uiCluster++ )
+ {
+ if ( FatVol_GetNextCluster(self, uiCluster) == FATVOL_CLUSTER_FREE )
+ {
+ FatVol_SetNextCluster(self, uiCluster, FATVOL_CLUSTER_ENDMARKER);
+ return uiCluster;
+ }
+ }
+
+ /* 空き無し */
+ return FATVOL_CLUSTER_ENDMARKER;
+}
+
+
+/* end of file */
/* 0xf0000000 からルートディレクトリをマップ */
if ( uiCluster >= 0xf0000000 )
{
+ if ( uiCluster >= 0xf000001f )
+ {
+ return FATVOL_CLUSTER_ENDMARKER;
+ }
return uiCluster + 1;
}
/* 0xf0000000 からルートディレクトリをマップ */
if ( uiCluster >= 0xf0000000 )
{
+ if ( uiCluster >= 0xf000001f )
+ {
+ return FATVOL_CLUSTER_ENDMARKER;
+ }
return uiCluster + 1;
}
+ (self->pubFatBuf[uiCluster * 4 + 1] << 8)
+ (self->pubFatBuf[uiCluster * 4 + 2] << 16)
+ (self->pubFatBuf[uiCluster * 4 + 3] << 24);
+
+ if ( uiCluster >= 0xfffffff7 )
+ {
+ return FATVOL_CLUSTER_ENDMARKER;
+ }
+
break;
}
HANDLE FatVol_FileCreate(C_FATVOL *self, FATVOL_UINT uiStartCluster, FATVOL_UINT uiDirCluster, FATVOL_UINT uiDirEntryPos, FILE_POS FileSize, int iMode);
void FatVol_FileDelete(C_FATVOL *self, HANDLE hFile);
-FILE_POS FatVol_GetFileSize(HANDLE hDir, int iDirEntry);
-void FatVol_SetFileSize(HANDLE hDir, int iDirEntry, FILE_POS Size);
+void FatVol_SyncFileSize(C_FATVOL *self, C_FATFILE *pFile); /* サイズ同期 */
int FatVol_ClusterWrite(C_FATVOL *self, FATVOL_UINT uiCluster, const void *pBuf); /**< クラスタ書き込み */
int FatVol_ClusterRead(C_FATVOL *self, FATVOL_UINT uiCluster, void *pBuf); /**< クラスタ読み込み */
T_FATVOL_CLUSTERBUF *FatVol_GetClusterBuf(C_FATVOL *self, FATVOL_UINT uiCluster, int iRead);
void FatVol_RelClusterBuf(C_FATVOL *self, T_FATVOL_CLUSTERBUF *pClusterBuf, int iDirty);
+void FatVol_FlushClusterBuf(C_FATVOL *self);
+FATVOL_UINT FatVol_GetNewCluster(C_FATVOL *self);
FATVOL_UINT FatVol_GetNextCluster(C_FATVOL *self, FATVOL_UINT uiCluster);
void FatVol_SetNextCluster(C_FATVOL *self, FATVOL_UINT uiCluster, FATVOL_UINT uiNextCluster);
+void FatVol_FlushFat(C_FATVOL *self);
+
#ifdef __cplusplus
}
#include "fatvol_local.h"
+/* ファイルオープン */
HANDLE FatVol_Open(C_DRVOBJ *pDrvObj, const char *pszPath, int iMode)
{
C_FATVOL *self;
- FATVOL_UINT uiCluster;
+
HANDLE hFile;
- char szEntryName[8+1+3+1];
- int iEntryNameLen;
- char szName[8+1+3+1];
+
+
+ FATVOL_UINT uiDirStartCluster;
+ FATVOL_UINT uiDirCluster;
+ FATVOL_UINT uiDirEntryPos;
+
+ char szName[8+3];
int iNameLen;
- unsigned char ubAttr;
+
+ FATVOL_UINT uiFileCluster;
+ unsigned char ubFileAttr;
FILE_POS FileSize;
T_FATVOL_CLUSTERBUF *pClusterBuf;
unsigned char *pubBuf;
- FATVOL_UINT uiDirCluster;
- FATVOL_UINT uiDirEntryPos;
int iEntryHit;
- int i;
+ int i, j;
+
/* upper cast */
self = (C_FATVOL *)pDrvObj;
/* クリティカルセクションに入る */
SysMtx_Lock(self->hMtx);
+
/* ルートディレクトリを設定 */
- uiDirCluster = self->RootDirCluster;
- uiDirEntryPos = 0;
- if ( (pClusterBuf = FatVol_GetClusterBuf(self, uiDirCluster, 1)) == NULL )
- {
- SysMtx_Unlock(self->hMtx);
- return HANDLE_NULL;
- }
+ uiDirStartCluster = FATVOL_CLUSTER_ENDMARKER;
+ uiDirCluster = FATVOL_CLUSTER_ENDMARKER;
+ uiDirEntryPos = 0;
+ uiFileCluster = self->RootDirCluster;
+ ubFileAttr = 0x10;
+ FileSize = 0;
/* パス探索 */
for ( ; ; )
{
- /* 名前の部分を切り出し */
- for ( iNameLen = 0; iNameLen < sizeof(szName) && *pszPath != '\0'; pszPath++, iNameLen++ )
+ /* 区切りを読み飛ばす */
+ while ( pszPath[0] == '/' )
+ {
+ pszPath++;
+ }
+
+ /* 名前の部分を探索 */
+ for ( i = 0; pszPath[i] != '\0'; i++ )
{
/* パス区切りなら抜ける */
- if ( *pszPath == '/' )
+ if ( pszPath[i] == '/' )
{
- pszPath++;
break;
}
- szName[iNameLen] = *pszPath;
-
- /* 大文字に変換 */
- if ( szName[iNameLen] >= 'a' && szName[iNameLen] <= 'z' )
+ }
+ iNameLen = i;
+
+ /* ディレクトリ自身を指す場合 */
+ if ( iNameLen == 0 )
+ {
+ iEntryHit = 1;
+ break;
+ }
+
+ /* ディレクトリエントリ名を作成 */
+ for ( i = 0, j = 0; i < iNameLen && j < 8; i++, j++ )
+ {
+ if ( pszPath[i] == '.' )
{
- szName[iNameLen] -= ('a' - 'A');
+ break;
}
+ szName[j] = pszPath[i];
+ }
+ for ( ; j < 8; j++ )
+ {
+ szName[j] = 0x20;
+ }
+ if ( pszPath[i] != '.' && i < iNameLen ) /* ファイル名長すぎ */
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
}
- szName[iNameLen] = '\0';
-
- /* ディレクトリ自身を指す場合 */
- if ( iNameLen == 0 )
+ /* 拡張子 */
+ if ( pszPath[i] == '.' )
{
- /* ディレクトリを閉じる */
- FatVol_RelClusterBuf(self, pClusterBuf, 0);
+ i++;
+ }
+ for ( j = 0; i < iNameLen && j < 3; i++, j++ )
+ {
+ szName[8+j] = pszPath[i];
+ }
+ for ( ; j < 3; j++ )
+ {
+ szName[8+j] = 0x20;
+ }
+ if ( i < iNameLen ) /* 拡張子長すぎ */
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+
+
+ /* ポインタを進める */
+ pszPath += iNameLen;
- /* ディレクトリ指定があれば開く */
- if ( iMode & FILE_OPEN_DIR )
+
+ /* 文字変換 */
+ for ( i = 0; i < 8+3; i++ )
+ {
+ /* 大文字化 */
+ if ( szName[i] >= 'a' && szName[i] <= 'z')
{
- if ( (hFile = FatVol_FileCreate(self, uiDirCluster, FATVOL_CLUSTER_ENDMARKER, 0, 0, iMode)) != HANDLE_NULL )
- {
- self->iOpenCount++;
- SysMtx_Unlock(self->hMtx);
- return hFile;
- }
+ szName[i] -= ('a' - 'A');
}
-
- /* エラー終了 */
- SysMtx_Unlock(self->hMtx);
- return HANDLE_NULL;
}
+ if ( szName[0] == 0xe5 )
+ {
+ szName[0] = 0x05;
+ }
+
+ /* ディレクトリを開く */
+ uiDirStartCluster = uiFileCluster;
+ uiDirCluster = uiDirStartCluster;
+ uiDirEntryPos = 0;
+ if ( (pClusterBuf = FatVol_GetClusterBuf(self, uiDirCluster, 1)) == NULL )
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+
/* ディレクトリエントリを検索 */
iEntryHit = 0;
for ( ; ; )
{
/* ディレクトリエントリ位置 */
pubBuf = &pClusterBuf->pubBuf[uiDirEntryPos];
-
+
/* 0なら打ち切り */
if ( pubBuf[0] == 0x00 )
{
break;
}
- /* 名前部分取り出し */
- iEntryNameLen = 0;
- for ( i = 0; i < 8; i++ )
- {
- if ( pubBuf[0+i] == ' ' || pubBuf[0+i] == '\0' )
- {
- break;
- }
- szEntryName[iEntryNameLen++] = (char)pubBuf[0+i];
- }
- szEntryName[iEntryNameLen++] = '.';
- for ( i = 0; i < 3; i++ )
+ /* 名前比較 */
+ if ( memcmp(pubBuf, szName, 8+3) == 0 )
{
- if ( pubBuf[8+i] == ' ' || pubBuf[8+i] == '\0' )
+ /* 開始クラスタ取得 */
+ uiFileCluster = pubBuf[26] + (pubBuf[27] << 8);
+ if ( self->iFatType == FATVOL_TYPE_FAT32 )
{
- break;
+ uiFileCluster += (pubBuf[20] << 16) + (pubBuf[21] << 24);
}
- szEntryName[iEntryNameLen++] = (char)pubBuf[8+i];
- }
- szEntryName[iEntryNameLen] = '\0';
- if ( iEntryNameLen > 2 && szEntryName[iEntryNameLen-1] == '.' )
- {
- szEntryName[--iEntryNameLen] = '\0';
- }
-
- /* 名前比較 */
- if ( strcmp(szEntryName, szName) == 0 )
- {
+
+ /* 属性取得 */
+ ubFileAttr = pubBuf[11];
+
+ /* サイズ取得 */
+ FileSize = pubBuf[28] + (pubBuf[29] << 8) + (pubBuf[30] << 16) + (pubBuf[31] << 24);
+
iEntryHit = 1;
break;
}
}
}
- /* 見つからなければエラー */
- if ( !iEntryHit )
- {
- FatVol_RelClusterBuf(self, pClusterBuf, 0);
- SysMtx_Unlock(self->hMtx);
- return HANDLE_NULL;
- }
-
- /* 開始クラスタ取得 */
- uiCluster = pubBuf[26] + (pubBuf[27] << 8);
- if ( self->iFatType == FATVOL_TYPE_FAT32 )
- {
- uiCluster += (pubBuf[20] << 16) + (pubBuf[21] << 24);
- }
-
- /* 属性取得 */
- ubAttr = pubBuf[11];
-
- /* サイズ取得 */
- FileSize = pubBuf[28] + (pubBuf[29] << 8) + (pubBuf[30] << 16) + (pubBuf[31] << 24);
-
- /* 親ディレクトリを閉じる */
+ /* ディレクトリを閉じる */
FatVol_RelClusterBuf(self, pClusterBuf, 0);
-
- /* パス部分の解析が終わっていればここで抜ける */
- if ( *pszPath == '\0' )
+
+ /* これ以上開くサブディレクトリがなければ抜ける */
+ if ( !(iEntryHit && (ubFileAttr & 0x10)) )
{
break;
}
-
- /* サブディレクトリでなければエラー */
- if ( !(ubAttr & 0x10) )
+ }
+
+
+ /* パスをすべて探索できていなければNG */
+ if ( *pszPath != '\0' )
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+
+
+ /* ディレクトリに存在しない場合 */
+ if ( !iEntryHit )
+ {
+ /* 新規作成でなければエラー */
+ if ( !(iMode & FILE_OPEN_CREATE) )
{
SysMtx_Unlock(self->hMtx);
- return HANDLE_NULL;
+ return HANDLE_NULL;
}
- /* サブディレクトリを開く */
- uiDirCluster = uiCluster;
+
+ /* ディレクトリを開く */
+ uiDirCluster = uiDirStartCluster;
uiDirEntryPos = 0;
if ( (pClusterBuf = FatVol_GetClusterBuf(self, uiDirCluster, 1)) == NULL )
{
SysMtx_Unlock(self->hMtx);
return HANDLE_NULL;
}
+
+ /* 空き探索 */
+ for ( ; ; )
+ {
+ /* ディレクトリエントリ位置 */
+ pubBuf = &pClusterBuf->pubBuf[uiDirEntryPos];
+
+ /* 空き発見 */
+ if ( pubBuf[0] == 0xe5 || pubBuf[0] == 0x00 )
+ {
+ break;
+ }
+
+ /* シーク */
+ uiDirEntryPos += 32;
+ if ( uiDirEntryPos >= self->BytesPerCluster ) /* クラスタ越えなら */
+ {
+ FatVol_RelClusterBuf(self, pClusterBuf, 0);
+ uiDirCluster = FatVol_GetNextCluster(self, uiDirCluster);
+ if ( uiDirCluster == FATVOL_CLUSTER_ENDMARKER )
+ {
+ /* FAT32以外のルートディレクトリなら拡張不能 */
+ if ( self->iFatType != FATVOL_TYPE_FAT32 && uiDirCluster >= 0xf0000000 )
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+ if ( (uiFileCluster = FatVol_GetNewCluster(self)) == FATVOL_CLUSTER_ENDMARKER )
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+ FatVol_SetNextCluster(self, uiDirCluster, uiFileCluster);
+ uiDirCluster = uiFileCluster;
+ }
+ if ( (pClusterBuf = FatVol_GetClusterBuf(self, uiDirCluster, 1)) == NULL )
+ {
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+ uiDirEntryPos = 0;
+ }
+ }
+
+ /* 新規クラスタ作成 */
+ if ( (uiFileCluster = FatVol_GetNewCluster(self)) == FATVOL_CLUSTER_ENDMARKER )
+ {
+ FatVol_RelClusterBuf(self, pClusterBuf, 0);
+ SysMtx_Unlock(self->hMtx);
+ return HANDLE_NULL;
+ }
+ FatVol_SetNextCluster(self, uiFileCluster, FATVOL_CLUSTER_ENDMARKER);
+
+ memset(&pubBuf[0], 0, 32); /* 初期化 */
+ memcpy(&pubBuf[0], szName, 8+3); /* ファイル名 */
+ pubBuf[11] = (iMode & FILE_OPEN_DIR) ? 0x10 : 0x20; /* 属性 */
+ pubBuf[26] = ((uiFileCluster >> 0) & 0xff); /* 開始クラスタ */
+ pubBuf[27] = ((uiFileCluster >> 8) & 0xff);
+ pubBuf[20] = ((uiFileCluster >> 16) & 0xff);
+ pubBuf[21] = ((uiFileCluster >> 24) & 0xff);
+ FileSize = 0;
+ ubFileAttr = pubBuf[11];
+
+ /* ディレクトリを閉じる */
+ FatVol_RelClusterBuf(self, pClusterBuf, 1);
}
/* モードチェック */
- if ( iMode & FILE_OPEN_DIR )
+ if ( ((ubFileAttr & 0x10) && !(iMode & FILE_OPEN_DIR))
+ || (!(ubFileAttr & 0x10) && (iMode & FILE_OPEN_DIR)) )
{
SysMtx_Unlock(self->hMtx);
return HANDLE_NULL;
}
/* ファイルディスクリプタを作成 */
- hFile = FatVol_FileCreate(self, uiCluster, uiDirCluster, uiDirEntryPos, FileSize, iMode);
+ hFile = FatVol_FileCreate(self, uiFileCluster, uiDirCluster, uiDirEntryPos, FileSize, iMode);
if ( hFile != HANDLE_NULL )
{
self->iOpenCount++;
/* バッファ取得 */
if ( (pClusterBuf = FatVol_GetClusterBuf(self, uiCluster, 1)) == NULL )
{
- SysMtx_Unlock(self->hMtx);
break;
}
SysMtx_Unlock(self->hMtx);
SysMtx_Lock(self->hMtx);
}
-
+
/* クリティカルセクションを出る */
SysMtx_Unlock(self->hMtx);
case FATVOL_TYPE_FAT16:
/* FAT更新 */
- self->pubFatBuf[uiCluster * 2 + 0] = uiNextCluster % 256;
- self->pubFatBuf[uiCluster * 2 + 1] = uiNextCluster / 256;
+ self->pubFatBuf[uiCluster * 2 + 0] = ((uiNextCluster >> 0) & 0xff);
+ self->pubFatBuf[uiCluster * 2 + 1] = ((uiNextCluster >> 8) & 0xff);
/* 更新フラグ設定 */
self->pubFatDirty[(uiCluster * 2) / self->BytesPerSector] = 1;
case FATVOL_TYPE_FAT32:
/* FAT更新 */
- self->pubFatBuf[uiCluster * 2 + 0] = uiNextCluster % 256;
- self->pubFatBuf[uiCluster * 2 + 1] = (uiNextCluster / 256) % 256;
- self->pubFatBuf[uiCluster * 2 + 2] = (uiNextCluster / 256 / 256) % 256;
- self->pubFatBuf[uiCluster * 2 + 3] = (uiNextCluster / 256 / 256 / 256) % 256;
+ self->pubFatBuf[uiCluster * 2 + 0] = ((uiNextCluster >> 0) & 0xff);
+ self->pubFatBuf[uiCluster * 2 + 1] = ((uiNextCluster >> 8) & 0xff);
+ self->pubFatBuf[uiCluster * 2 + 2] = ((uiNextCluster >> 16) & 0xff);
+ self->pubFatBuf[uiCluster * 2 + 3] = ((uiNextCluster >> 24) & 0xff);
/* 更新フラグ設定 */
self->pubFatDirty[(uiCluster * 4) / self->BytesPerSector] = 1;
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file fatvol.c
+ * @brief %jp{FATボリューム用デバイスドライバ}
+ *
+ * Copyright (C) 2006-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include <stdio.h>
+#include "fatvol_local.h"
+
+
+/* サイズ同期 */
+void FatVol_SyncFileSize(C_FATVOL *self, C_FATFILE *pFile)
+{
+ T_FATVOL_CLUSTERBUF *pClusterBuf;
+ FILE_POS Size;
+
+ /* バッファ取得 */
+ if ( (pClusterBuf = FatVol_GetClusterBuf(self, pFile->uiDirCluster, 1)) == NULL )
+ {
+ return;
+ }
+
+ /* サイズ取得 */
+ Size = pClusterBuf->pubBuf[pFile->uiDirEntryPos + 28]
+ + (pClusterBuf->pubBuf[pFile->uiDirEntryPos + 29] << 8)
+ + (pClusterBuf->pubBuf[pFile->uiDirEntryPos + 30] << 16)
+ + (pClusterBuf->pubBuf[pFile->uiDirEntryPos + 31] << 24);
+
+ /* サイズ拡張 */
+ if ( pFile->FileSize > Size )
+ {
+ pClusterBuf->pubBuf[pFile->uiDirEntryPos + 28] = (pFile->FileSize >> 0) & 0xff;
+ pClusterBuf->pubBuf[pFile->uiDirEntryPos + 29] = (pFile->FileSize >> 8) & 0xff;
+ pClusterBuf->pubBuf[pFile->uiDirEntryPos + 30] = (pFile->FileSize >> 16) & 0xff;
+ pClusterBuf->pubBuf[pFile->uiDirEntryPos + 31] = (pFile->FileSize >> 24) & 0xff;
+
+ /* バッファ開放 */
+ FatVol_RelClusterBuf(self, pClusterBuf, 1);
+ }
+ else
+ {
+ pFile->FileSize = Size;
+
+ /* バッファ開放 */
+ FatVol_RelClusterBuf(self, pClusterBuf, 0);
+ }
+}
+
+
+/* end of file */
*/
-
+#include <string.h>
#include "fatvol_local.h"
/** %jp{書き込み} */
FILE_SIZE FatVol_Write(C_DRVOBJ *pDrvObj, C_FILEOBJ *pFileObj, const void *pData, FILE_SIZE Size)
{
- C_FATVOL *self;
- C_FATFILE *pFile;
+ C_FATVOL *self;
+ C_FATFILE *pFile;
+
+ FILE_SIZE ReqSize;
+ const unsigned char *pubData;
+ FATVOL_UINT uiNextCluster;
+ FATVOL_UINT uiCluster;
+ FATVOL_UINT i;
+ int iResizeFlag = 0;
+
/* upper cast */
self = (C_FATVOL *)pDrvObj;
pFile = (C_FATFILE *)pFileObj;
+
+ /* キャスト */
+ pubData = (const unsigned char *)pData;
+
+ /* サイズ0なら即時成功 */
+ if ( Size <= 0 )
+ {
+ return 0;
+ }
+
+ /* クリティカルセクションに入る */
+ SysMtx_Lock(self->hMtx);
/* モードチェック */
- if ( !(pFile->iMode & FILE_OPEN_WRITE) )
+ if ( !(pFile->iMode & FILE_OPEN_WRITE) || (pFile->iMode & FILE_OPEN_DIR) )
{
+ SysMtx_Unlock(self->hMtx);
return 0;
}
+
+ /* 書き込み要求量保存 */
+ ReqSize = Size;
+
+ /* ファイルポインタ位置のクラスタを検索 */
+ uiCluster = pFile->uiStartCluster;
+ for ( i = 0; pFile->FilePos >= (i + 1) * self->BytesPerCluster; i++ )
+ {
+ /* 次のクラスタを探す */
+ uiNextCluster = FatVol_GetNextCluster(self, uiCluster);
+ if ( uiNextCluster == FATVOL_CLUSTER_ENDMARKER )
+ {
+ /* 次クラスタが無ければ作る */
+ uiNextCluster = FatVol_GetNewCluster(self);
+ if ( uiNextCluster == FATVOL_CLUSTER_ENDMARKER )
+ {
+ return 0; /* ディスクフル */
+ }
+ FatVol_SetNextCluster(self, uiCluster, uiNextCluster);
+ }
+ uiCluster = uiNextCluster;
+ }
+
+ /* 書き出し */
+ while ( Size > 0 )
+ {
+ FILE_POS WriteStart;
+ FILE_SIZE WriteSize;
+ T_FATVOL_CLUSTERBUF *pClusterBuf;
+
+ /* 転送位置計算 */
+ WriteStart = (pFile->FilePos & (self->BytesPerCluster - 1));
+ WriteSize = self->BytesPerCluster - WriteStart;
+ if ( WriteSize > Size )
+ {
+ WriteSize = Size;
+ }
+
+ /* バッファ取得 */
+ if ( WriteStart == 0 && pFile->FilePos == pFile->FileSize )
+ {
+ pClusterBuf = FatVol_GetClusterBuf(self, uiCluster, 1); /* 完全新規の場合 */
+ }
+ else
+ {
+ pClusterBuf = FatVol_GetClusterBuf(self, uiCluster, 0); /* 部分更新の場合 */
+ }
+ if ( pClusterBuf == NULL )
+ {
+ break;
+ }
+
+ /* 転送 */
+ memcpy(&pClusterBuf->pubBuf[WriteStart], pubData, WriteSize);
+ /* バッファ開放 */
+ FatVol_RelClusterBuf(self, pClusterBuf, 1);
+
+
+ /* サイズ更新 */
+ pFile->FilePos += WriteSize;
+ pubData += WriteSize;
+ Size -= WriteSize;
+
+ /* ファイルサイズ更新 */
+ if ( pFile->FileSize < pFile->FilePos )
+ {
+ pFile->FileSize = pFile->FilePos;
+ iResizeFlag = 1;
+ }
+
+ /* 完了チェック */
+ if ( Size <= 0 )
+ {
+ break;
+ }
+
+ /* 次のクラスタを探す */
+ uiNextCluster = FatVol_GetNextCluster(self, uiCluster);
+ if ( uiNextCluster == FATVOL_CLUSTER_ENDMARKER )
+ {
+ /* 次クラスタが無ければ作る */
+ uiNextCluster = FatVol_GetNewCluster(self);
+ if ( uiNextCluster == FATVOL_CLUSTER_ENDMARKER )
+ {
+ break; /* ディスクフル */
+ }
+ FatVol_SetNextCluster(self, uiCluster, uiNextCluster);
+ }
+ uiCluster = uiNextCluster;
+
+ /* 一旦ロックを放す */
+ SysMtx_Unlock(self->hMtx);
+ SysMtx_Lock(self->hMtx);
+ }
+ /* ディレクトリテーブルのサイズ更新 */
+ if ( iResizeFlag && !(pFile->iMode & FILE_OPEN_DIR) )
+ {
+ FatVol_SyncFileSize(self, pFile);
+ }
+
+ /* クリティカルセクションを出る */
+ SysMtx_Unlock(self->hMtx);
- return 0;
+ return ReqSize - Size;
}
#include "system/handle/handle.h"
#include "system/memory/memory.h"
+#include "system/time/time.h"
#include "system/process/process.h"
#include "system/command/command.h"
#include "system/file/file.h"
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__packetbuf_h__
+#define __HOS__packetbuf_h__
+
+
+
+/* パケットバッファクラス構造体 */
+typedef struct c_packetbuf
+{
+ unsigned char *pubBuf; /**< バッファ領域の先頭アドレス */
+ unsigned int uiBufSize; /**< バッファ領域のサイズ */
+ volatile unsigned int uiReturnPoint; /**< バッファ折り返し位置 */
+ volatile unsigned int uiHead; /**< データの先頭 */
+ volatile unsigned int uiTail; /**< データの末尾 */
+} C_PACKETBUF;
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 生成/削除 */
+void PacketBuf_Create(C_PACKETBUF *self, unsigned int uiBufSize, void *pBuf); /**< コンストラクタ */
+#define PacketBuf_Delete(self) do {} while(0) /**< デストラクタ */
+
+/* パケット送信 */
+unsigned int PacketBuf_SendData(C_PACKETBUF *self, const void *pData, unsigned int uiSize); /**< データの送信 */
+unsigned int PacketBuf_GetBuf(C_PACKETBUF *self, void **ppBuf, unsigned int uiSize); /**< 送信用バッファの取得(省コピー) */
+void PacketBuf_SendBuf(C_PACKETBUF *self, unsigned int uiSize); /**< バッファ内のデータの送信(省コピー) */
+
+/* パケット受信 */
+unsigned int PacketBuf_RecvData(C_PACKETBUF *self, void *pBuf, unsigned int uiSize); /**< データの受信 */
+unsigned int PacketBuf_RecvBuf(C_PACKETBUF *self, void **ppBuf); /**< 受信したデータの入ったバッファの取得(省コピー) */
+void PacketBuf_RelBuf(C_PACKETBUF *self); /**< 受信用バッファの解放(省コピー) */
+
+/* 制御 */
+void PacketBuf_Clear(C_PACKETBUF *self); /**< バッファのクリア */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* __HOS__packetbuf_local_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include "packetbuf_local.h"
+
+
+/** バッファのクリア */
+void PacketBuf_Clear(C_PACKETBUF *self)
+{
+ self->uiHead = self->uiTail;
+}
+
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "packetbuf_local.h"
+
+
+
+/** コンストラクタ */
+void PacketBuf_Create(C_PACKETBUF *self, unsigned int uiBufSize, void *pBuf)
+{
+ /* メンバ変数の初期化 */
+ self->pubBuf = (unsigned char *)pBuf;
+ self->uiBufSize = uiBufSize;
+ self->uiReturnPoint = uiBufSize;
+ self->uiHead = 0;
+ self->uiTail = 0;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "packetbuf_local.h"
+
+
+
+/** 送信用バッファの取得(省コピー) */
+unsigned int PacketBuf_GetBuf(C_PACKETBUF *self, void **ppBuf, unsigned int uiSize)
+{
+ unsigned int uiAllocSize;
+
+ /* 割り当てサイズ計算 */
+ uiAllocSize = PACKETBUF_DATASIZE(uiSize) + sizeof(unsigned int);
+
+ /* 割り当て可能性チェック */
+ if ( self->uiTail >= self->uiHead )
+ {
+ if ( self->uiTail > self->uiBufSize - uiAllocSize )
+ {
+ /* 折り返し可能かチェック */
+ if ( self->uiHead <= uiAllocSize )
+ {
+ return 0; /* 割り当て不可 */
+ }
+
+ /* 折り返し */
+ self->uiReturnPoint = self->uiTail;
+ self->uiTail = 0;
+ }
+ }
+ else
+ {
+ if ( self->uiHead - self->uiTail <= uiAllocSize )
+ {
+ return 0; /* 割り当て不可 */
+ }
+ }
+
+ /* 割り当てたバッファを返す */
+ *ppBuf = (void *)(self->pubBuf + self->uiTail + sizeof(unsigned int));
+
+ return uiSize; /* 割り当てたサイズを返す */
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#ifndef __HOS__packetbuf_local_h__
+#define __HOS__packetbuf_local_h__
+
+
+#include "packetbuf.h"
+
+
+#define PACKETBUF_DATASIZE(len) ((len + sizeof(int) - 1) & (~sizeof(int) - 1)) /**< データの利用メモリ範囲設定 */
+
+
+
+#endif /* __HOS__packetbuf_local_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include "packetbuf_local.h"
+
+
+
+/** 受信したデータの入ったバッファの取得(省コピー) */
+unsigned int PacketBuf_RecvBuf(C_PACKETBUF *self, void **ppBuf)
+{
+ unsigned int uiSize;
+
+ if ( self->uiHead == self->uiTail )
+ {
+ return 0; /* データなし */
+ }
+
+ /* データサイズ取得 */
+ uiSize = *(unsigned int *)(self->pubBuf + self->uiHead);
+
+ /* バッファ位置設定 */
+ *ppBuf = (void *)(self->pubBuf + self->uiHead + sizeof(unsigned int));
+
+ return uiSize;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include <string.h>
+#include "packetbuf_local.h"
+
+
+
+/** データの受信 */
+unsigned int PacketBuf_RecvData(C_PACKETBUF *self, void *pBuf, unsigned int uiSize)
+{
+ void *pDataBuf;
+ unsigned int uiDataSize;
+
+ /* 受信バッファ取得 */
+ if ( (uiDataSize = PacketBuf_RecvBuf(self, &pDataBuf)) == 0)
+ {
+ return 0;
+ }
+
+ /* サイズチェック */
+ if ( uiDataSize > uiSize)
+ {
+ return 0;
+ }
+
+ /* バッファからデータ読み込み */
+ memcpy(pBuf, pDataBuf, uiDataSize);
+
+ /* バッファ解放 */
+ PacketBuf_RelBuf(self);
+
+ return uiDataSize;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include "packetbuf_local.h"
+
+
+/* 受信用バッファの解放(省コピー) */
+void PacketBuf_RelBuf(C_PACKETBUF *self)
+{
+ unsigned int uiSize;
+ unsigned int uiNextHead;
+
+ /* データサイズ取得 */
+ uiSize = *(unsigned int *)(self->pubBuf + self->uiHead);
+ uiSize = PACKETBUF_DATASIZE(uiSize) + sizeof(unsigned int);
+
+ /* 先頭位置更新 */
+ uiNextHead = self->uiHead + uiSize;
+ if ( self->uiTail < self->uiHead && uiNextHead >= self->uiReturnPoint )
+ {
+ uiNextHead = 0;
+ }
+ self->uiHead = uiNextHead;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "packetbuf_local.h"
+
+
+
+/** バッファ内のデータの送信(省コピー) */
+void PacketBuf_SendBuf(C_PACKETBUF *self, unsigned int uiSize)
+{
+ /* サイズの格納 */
+ *(unsigned int *)(self->pubBuf + self->uiTail) = uiSize;
+
+ /* 末尾位置の更新 */
+ self->uiTail += PACKETBUF_DATASIZE(uiSize);
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file packetbuf.h
+ * @brief %jp{パケットデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#include <string.h>
+#include "packetbuf_local.h"
+
+
+
+/** データの送信 */
+unsigned int PacketBuf_SendData(C_PACKETBUF *self, const void *pData, unsigned int uiSize)
+{
+ void *pBuf;
+
+ /* 送信バッファ取得 */
+ if ( PacketBuf_GetBuf(self, &pBuf, uiSize) < uiSize )
+ {
+ return 0;
+ }
+
+ /* バッファにデータ書き込み */
+ memcpy(pBuf, pData, uiSize);
+
+ /* バッファ送信 */
+ PacketBuf_SendBuf(self, uiSize);
+
+ return uiSize;
+}
+
+
+/* end of file */
+++ /dev/null
-#include <string.h>
-#include "stmbuf.h"
-
-
-/* バッファの生成 */
-void StreamBuf_Create(
- C_STREAMBUF *self, /* クラスポインタ */
- int bufsz, /* バッファに割り当てる領域の先頭番地 */
- void *buf) /* バッファに割り当てる領域のサイズ(バイト数) */
-{
- /* クラスメンバの初期化 */
- self->bufsz = bufsz;
- self->buf = buf;
- self->head = 0;
- self->tail = 0;
-}
-
-
-/* データの送信 */
-int StreamBuf_SendData(
- C_STREAMBUF *self, /* クラスポインタ */
- const void *data, /* 送信データ */
- int len) /* 送信データサイズ */
-{
- void *buf; /* バッファアドレス */
- int buf_len; /* バッファサイズ */
- int snd_len = 0; /* 送信サイズ */
-
- do
- {
- /* 送信バッファ取得 */
- if ( (buf_len = StreamBuf_GetBuf(self, &buf)) <= 0 )
- {
- break;
- }
-
- /* サイズ計算 */
- if ( buf_len > len )
- {
- buf_len = len;
- }
-
- /* 送信 */
- memcpy(buf, data, buf_len);
- StreamBuf_SendBuf(self, buf_len);
- len -= buf_len;
- snd_len += buf_len;
- data = (void *)((char *)data + buf_len);
- } while ( len > 0 );
-
- return snd_len; /* 送信サイズを返す */
-}
-
-
-/* 送信用バッファの取得(省コピー) */
-int StreamBuf_GetBuf(
- C_STREAMBUF *self, /* クラスポインタ */
- void **p_buf) /* 送信バッファ先頭番地の格納先 */
-{
- int head;
-
- *p_buf = (void *)(self->buf + self->tail); /* 送信バッファ先頭番地の格納 */
-
- head = self->head;
- if ( head > self->tail ) /* データがバッファ末尾で折り返されているか */
- {
- return head - self->tail - 1;
- }
- else
- {
- if ( head == 0 ) /* バッファ先頭にデータがあるか */
- {
- return self->bufsz - self->tail - 1; /* 先頭にデータがあるなら1バイト開ける */
- }
- else
- {
- return self->bufsz - self->tail;
- }
- }
-}
-
-
-/* バッファ内のデータの送信(省コピー) */
-void StreamBuf_SendBuf(
- C_STREAMBUF *self, /* クラスポインタ */
- int len) /* 送信サイズ */
-{
- int next_tail;
-
- /* サイズチェック */
- if ( len <= 0 )
- {
- return;
- }
-
- /* 次のポインタ位置計算 */
- next_tail = self->tail + len;
- if ( next_tail >= self->bufsz )
- {
- next_tail = 0;
- }
- self->tail = next_tail;
-}
-
-
-/* 1キャラクタの送信 */
-int StreamBuf_SendChar(
- C_STREAMBUF *self, /* クラスポインタ */
- int chr) /* 送信キャラクタ */
-{
- int next_tail;
-
- /* 次の位置を計算 */
- next_tail = self->tail + 1;
- if ( next_tail >= self->bufsz )
- {
- next_tail = 0;
- }
-
- /* バッファフルチェック */
- if ( next_tail == self->head )
- {
- return -1; /* 失敗 */
- }
-
- /* 1キャラクタ送信 */
- chr = (*(self->buf + self->tail) = (unsigned char)chr);
- self->tail = next_tail;
-
- return chr; /* 成功 */
-}
-
-
-/* データの受信 */
-int StreamBuf_RecvData(
- C_STREAMBUF *self, /* クラスポインタ */
- void *data, /* 受信データの格納先 */
- int len) /* 受信データの格納先のサイズ */
-{
- void *buf; /* バッファアドレス */
- int buf_len; /* バッファサイズ */
- int rcv_len = 0; /* 受信サイズ */
-
- do
- {
- /* 受信バッファ取得 */
- if ( (buf_len = StreamBuf_RecvBuf(self, &buf)) <= 0 )
- {
- break;
- }
-
- /* 受信サイズ計算 */
- if ( buf_len > len )
- {
- buf_len = len;
- }
-
- /* 受信 */
- memcpy(data, buf, buf_len);
- StreamBuf_RelBuf(self, buf_len);
- len -= buf_len;
- rcv_len += buf_len;
- data = (void *)((char *)data + buf_len);
- } while ( len > 0 );
-
- return rcv_len;
-}
-
-
-/* 受信用バッファの取得(省コピー) */
-int StreamBuf_RecvBuf(
- C_STREAMBUF *self, /* クラスポインタ */
- void **p_buf) /* 受信バッファ先頭番地の格納先 */
-{
- int tail;
-
- *p_buf = (void *)(self->buf + self->head); /* 受信バッファ先頭番地の格納 */
-
- tail = self->tail;
- if ( tail < self->head ) /* データがバッファ末尾で折り返されているか */
- {
- return self->bufsz - self->head; /* 折り返されていたらバッファ末尾まで */
- }
- else
- {
- return tail - self->head; /* 折り返されていなければデータ末尾まで */
- }
-}
-
-
-
-
-/* 受信用バッファの解放(省コピー) */
-void StreamBuf_RelBuf(
- C_STREAMBUF *self, /* クラスポインタ */
- int len) /* 解放するデータサイズ */
-{
- int next_head;
-
- /* データ先頭位置更新 */
- next_head = self->head + len;
- if ( next_head >= self->bufsz )
- {
- next_head = 0;
- }
- self->head = next_head;
-}
-
-
-
-/* 1キャラクタの受信 */
-int StreamBuf_RecvChar(
- C_STREAMBUF *self) /* クラスポインタ */
-{
- int next_head;
- int chr;
-
- /* バッファエンプティ−チェック */
- if ( self->head == self->tail )
- {
- return -1; /* 失敗 */
- }
-
- /* 1キャラクタ受信 */
- chr = *(self->buf + self->head);
-
- /* 次の位置を計算 */
- next_head = self->head + 1;
- if ( next_head >= self->bufsz )
- {
- next_head = 0;
- }
- self->head = next_head;
-
- return chr; /* 成功 */
-}
-
-
-/* バッファのクリア */
-void StreamBuf_ClearBuf(
- C_STREAMBUF *self) /* クラスポインタ */
-{
- self->head = self->tail;
-}
-
-
-int StreamBuf_RefDataSize(C_STREAMBUF *self)
-{
- int head;
- int tail;
-
- head = self->head;
- tail = self->tail;
-
- if ( head <= tail )
- {
- return tail - head;
- }
- else
- {
- return self->bufsz + tail - head;
- }
-}
-
-
-int StreamBuf_RefFreeSize(C_STREAMBUF *self)
-{
- return StreamBuf_RefMaxSize(self) - StreamBuf_RefDataSize(self);
-}
-
+++ /dev/null
-
-
-#ifndef __HOS__stmbuf_h__
-#define __HOS__stmbuf_h__
-
-
-/* ストリームバッファクラス */
-typedef struct c_streambuf
-{
- unsigned char *buf; /* バッファ領域の先頭アドレス */
- int bufsz; /* バッファ領域のサイズ */
- volatile int head; /* データの先頭 */
- volatile int tail; /* データの末尾 */
-} C_STREAMBUF;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 生成/削除 */
-void StreamBuf_Create(C_STREAMBUF *self, int bufsz, void *buf); /* バッファの生成 */
-#define StreamBuf_Delete(self) do {} while(0) /* バッファの削除 */
-
-/* データ送信 */
-int StreamBuf_SendData(C_STREAMBUF *self, const void *data, int len); /* データの送信 */
-int StreamBuf_GetBuf(C_STREAMBUF *self, void **p_buf); /* 送信用バッファの取得(省コピー) */
-void StreamBuf_SendBuf(C_STREAMBUF *self, int len); /* バッファ内のデータの送信(省コピー) */
-int StreamBuf_SendChar(C_STREAMBUF *self, int chr); /* 1キャラクタの送信 */
-
-/* データ受信 */
-int StreamBuf_RecvData(C_STREAMBUF *self, void *data, int len); /* データの受信 */
-int StreamBuf_RecvBuf(C_STREAMBUF *self, void **p_buf); /* 受信したデータの入ったバッファの取得(省コピー) */
-void StreamBuf_RelBuf(C_STREAMBUF *self, int len); /* 受信用バッファの解放(省コピー) */
-int StreamBuf_RecvChar(C_STREAMBUF *self); /* 1キャラクタの受信 */
-
-/* 制御 */
-void StreamBuf_ClearBuf(C_STREAMBUF *self); /* バッファのクリア */
-#define StreamBuf_RefMaxSize(self) ((self)->bufsz - 1) /* 最大格納可能サイズ参照 */
-#define StreamBuf_RefBufAddr(self) ((self)->buf)
-#define StreamBuf_RefBufSize(self) ((self)->bufsz)
-int StreamBuf_RefDataSize(C_STREAMBUF *self);
-int StreamBuf_RefFreeSize(C_STREAMBUF *self);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif /* __HOS__stmbuf_h__ */
-
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__streambuf_h__
+#define __HOS__streambuf_h__
+
+
+/* ストリームバッファクラス */
+typedef struct c_streambuf
+{
+ unsigned char *pubBuf; /**< バッファ領域の先頭アドレス */
+ unsigned int uiBufSize; /**< バッファ領域のサイズ */
+ volatile unsigned int uiHead; /**< データの先頭 */
+ volatile unsigned int uiTail; /**< データの末尾 */
+} C_STREAMBUF;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 生成/削除 */
+void StreamBuf_Create(C_STREAMBUF *self, unsigned int uiBufSize, void *pBuf); /**< コンストラクタ */
+#define StreamBuf_Delete(self) do {} while(0) /**< デストラクタ */
+
+/* データ送信 */
+unsigned int StreamBuf_SendData(C_STREAMBUF *self, const void *pData, unsigned int uiSize); /**< データの送信 */
+unsigned int StreamBuf_GetBuf(C_STREAMBUF *self, void **ppBuf); /**< 送信用バッファの取得(省コピー) */
+void StreamBuf_SendBuf(C_STREAMBUF *self, unsigned int uiSize); /**< バッファ内のデータの送信(省コピー) */
+int StreamBuf_SendChar(C_STREAMBUF *self, int c); /**< 1キャラクタの送信 */
+
+/* データ受信 */
+unsigned int StreamBuf_RecvData(C_STREAMBUF *self, void *pBuf, unsigned int uiSize); /**< データの受信 */
+unsigned int StreamBuf_RecvBuf(C_STREAMBUF *self, void **ppBuf); /**< 受信したデータの入ったバッファの取得(省コピー) */
+void StreamBuf_RelBuf(C_STREAMBUF *self, unsigned int uiSize); /**< 受信用バッファの解放(省コピー) */
+int StreamBuf_RecvChar(C_STREAMBUF *self); /**< 1キャラクタの受信 */
+
+/* 制御 */
+void StreamBuf_Clear(C_STREAMBUF *self); /**< バッファのクリア */
+unsigned int StreamBuf_RefDataSize(C_STREAMBUF *self); /**< バッファ空き容量の参照 */
+unsigned int StreamBuf_RefFreeSize(C_STREAMBUF *self);
+
+#define StreamBuf_RefMaxSize(self) ((self)->uiBufSize - 1) /**< 最大格納可能サイズ参照 */
+#define StreamBuf_RefBufAddr(self) ((void *)(self)->pubBuf) /**< バッファアドレスの参照 */
+#define StreamBuf_RefBufSize(self) ((self)->uiBufSize) /**< バッファ内データ量の参照 */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* __HOS__streambuf_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** バッファのクリア */
+void StreamBuf_Clear(C_STREAMBUF *self)
+{
+ self->uiHead = self->uiTail;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** コンストラクタ */
+void StreamBuf_Create(C_STREAMBUF *self, unsigned int uiBufSize, void *pBuf)
+{
+ /* クラスメンバの初期化 */
+ self->uiBufSize = uiBufSize;
+ self->pubBuf = (unsigned char *)pBuf;
+ self->uiHead = 0;
+ self->uiTail = 0;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+
+/** 送信用バッファの取得(省コピー) */
+unsigned int StreamBuf_GetBuf(C_STREAMBUF *self, void **ppBuf)
+{
+ unsigned int uiHead;
+
+ *ppBuf = (void *)(self->pubBuf + self->uiTail); /* 送信バッファ先頭番地の格納 */
+
+ uiHead = self->uiHead;
+ if ( uiHead > self->uiTail ) /* データがバッファ末尾で折り返されているか */
+ {
+ return uiHead - self->uiTail - 1;
+ }
+ else
+ {
+ if ( uiHead == 0 ) /* バッファ先頭にデータがあるか */
+ {
+ return self->uiBufSize - self->uiTail - 1; /* 先頭にデータがあるなら1バイト開ける */
+ }
+ else
+ {
+ return self->uiBufSize - self->uiTail;
+ }
+ }
+}
+
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __HOS__streambuf_local_h__
+#define __HOS__streambuf_local_h__
+
+
+#include "streambuf.h"
+
+
+#endif /* __HOS__streambuf_local_h__ */
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** 受信したデータの入ったバッファの取得(省コピー) */
+unsigned int StreamBuf_RecvBuf(C_STREAMBUF *self, void **ppBuf)
+{
+ unsigned int uiTail;
+
+ *ppBuf = (void *)(self->pubBuf + self->uiHead); /* 受信バッファ先頭番地の格納 */
+
+ uiTail = self->uiTail;
+ if ( uiTail < self->uiHead ) /* データがバッファ末尾で折り返されているか */
+ {
+ return self->uiBufSize - self->uiHead; /* 折り返されていたらバッファ末尾まで */
+ }
+ else
+ {
+ return uiTail - self->uiHead; /* 折り返されていなければデータ末尾まで */
+ }
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** 1キャラクタの受信 */
+int StreamBuf_RecvChar(C_STREAMBUF *self)
+{
+ unsigned int uiNextHead;
+ int c;
+
+ /* バッファエンプティ−チェック */
+ if ( self->uiHead == self->uiTail )
+ {
+ return -1; /* 失敗 */
+ }
+
+ /* 1キャラクタ受信 */
+ c = *(self->pubBuf + self->uiHead);
+
+ /* 次の位置を計算 */
+ uiNextHead = self->uiHead + 1;
+ if ( uiNextHead >= self->uiBufSize )
+ {
+ uiNextHead = 0;
+ }
+ self->uiHead = uiNextHead;
+
+ return c; /* 成功 */
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <string.h>
+#include "streambuf_local.h"
+
+
+
+/** データの受信 */
+unsigned int StreamBuf_RecvData(C_STREAMBUF *self, void *pBuf, unsigned int uiSize)
+{
+ void *pRecvBuf; /* バッファアドレス */
+ unsigned int uiBufSize; /* バッファサイズ */
+ unsigned int uiRecvSize = 0; /* 受信サイズ */
+
+ do
+ {
+ /* 受信バッファ取得 */
+ if ( (uiBufSize = StreamBuf_RecvBuf(self, &pRecvBuf)) <= 0 )
+ {
+ break;
+ }
+
+ /* 受信サイズ計算 */
+ if ( uiBufSize > uiSize )
+ {
+ uiBufSize = uiSize;
+ }
+
+ /* 受信 */
+ memcpy(pBuf, pRecvBuf, uiBufSize);
+ StreamBuf_RelBuf(self, uiBufSize);
+ uiSize -= uiBufSize;
+ uiRecvSize += uiBufSize;
+ pBuf = (void *)((char *)pBuf + uiBufSize);
+ } while ( uiSize > 0 );
+
+ return uiRecvSize;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+
+/** バッファ内データ量の参照 */
+unsigned int StreamBuf_RefDataSize(C_STREAMBUF *self)
+{
+ unsigned int uiHead;
+ unsigned int uiTail;
+
+ uiHead = self->uiHead;
+ uiTail = self->uiTail;
+
+ if ( uiHead <= uiTail )
+ {
+ return uiTail - uiHead;
+ }
+ else
+ {
+ return self->uiBufSize + uiTail - uiHead;
+ }
+}
+
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** バッファ空き容量の参照 */
+unsigned int StreamBuf_RefFreeSize(C_STREAMBUF *self)
+{
+ return StreamBuf_RefMaxSize(self) - StreamBuf_RefDataSize(self);
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** 受信用バッファの解放(省コピー) */
+void StreamBuf_RelBuf(C_STREAMBUF *self, unsigned int uiSize)
+{
+ unsigned int uiNextHead;
+
+ /* データ先頭位置更新 */
+ uiNextHead = self->uiHead + uiSize;
+ if ( uiNextHead >= self->uiBufSize )
+ {
+ uiNextHead = 0;
+ }
+ self->uiHead = uiNextHead;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/** バッファ内のデータの送信(省コピー) */
+void StreamBuf_SendBuf(C_STREAMBUF *self, unsigned int uiSize)
+{
+ unsigned int uiNextTail;
+
+ /* サイズチェック */
+ if ( uiSize == 0 )
+ {
+ return;
+ }
+
+ /* 次のポインタ位置計算 */
+ uiNextTail = self->uiTail + uiSize;
+ if ( uiNextTail >= self->uiBufSize )
+ {
+ uiNextTail = 0;
+ }
+ self->uiTail = uiNextTail;
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "streambuf_local.h"
+
+
+/* 1キャラクタの送信 */
+int StreamBuf_SendChar(C_STREAMBUF *self, int c)
+{
+ unsigned int uiNextTail;
+
+ /* 次の位置を計算 */
+ uiNextTail = self->uiTail + 1;
+ if ( uiNextTail >= self->uiBufSize )
+ {
+ uiNextTail = 0;
+ }
+
+ /* バッファフルチェック */
+ if ( uiNextTail == self->uiHead )
+ {
+ return -1; /* 失敗 */
+ }
+
+ /* 1キャラクタ送信 */
+ c = (*(self->pubBuf + self->uiTail) = (unsigned char)c);
+ self->uiTail = uiNextTail;
+
+ return c; /* 成功 */
+}
+
+
+/* end of file */
--- /dev/null
+/**
+ * Hyper Operating System Application Framework
+ *
+ * @file streambuf.h
+ * @brief %jp{ストリームデータ用バッファクラス}
+ *
+ * Copyright (C) 2002-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <string.h>
+#include "streambuf_local.h"
+
+
+/** データの送信 */
+unsigned int StreamBuf_SendData(C_STREAMBUF *self, const void *pData, unsigned int uiSize)
+{
+ void *pBuf; /* バッファアドレス */
+ unsigned int uiBufSize; /* バッファサイズ */
+ unsigned int uiSendSize = 0; /* 送信サイズ */
+
+ do
+ {
+ /* 送信バッファ取得 */
+ if ( (uiBufSize = StreamBuf_GetBuf(self, &pBuf)) <= 0 )
+ {
+ break;
+ }
+
+ /* サイズ計算 */
+ if ( uiBufSize > uiSize )
+ {
+ uiBufSize = uiSize;
+ }
+
+ /* データコピー */
+ memcpy(pBuf, pData, uiBufSize);
+
+ /* 送信 */
+ StreamBuf_SendBuf(self, uiBufSize);
+
+ /* ポインタ更新 */
+ pData = (void *)((char *)pData + uiBufSize);
+ uiSize -= uiBufSize;
+ uiSendSize += uiBufSize;
+ } while ( uiSize > 0 );
+
+
+ return uiSendSize; /* 送信サイズを返す */
+}
+
+
+/* end of file */
hCon = File_Open("/dev/con0", FILE_OPEN_READ | FILE_OPEN_WRITE);
+
/*************************/
/* コマンド登録 */
/*************************/
+
Command_AddCommand("hsh", Shell_Main);
Command_AddCommand("hello", Hello_Main);
Command_AddCommand("memdump", MemDump_Main);
Command_AddCommand("time", TimeCmd_Main);
Command_AddCommand("ethsnoop", EtherSnoop_Main);
+
+
/*************************/
/* システムプロセス起動 */
/*************************/
+
System_Boot(hTty, hCon, "hsh", 4096);
}
extern "C" {
#endif
+#define StdIo_Read(buf, len) File_Read(Process_GetStdIn(), (buf), (len));
#define StdIo_GetChar() File_GetChar(Process_GetStdIn());
#define StdIo_GetString(str) File_GetString(Process_GetStdIn(), (str));
+#define StdIo_Write(buf, len) File_Write(Process_GetStdIn(), (buf), (len));
#define StdIo_PutChar(c) File_PutChar(Process_GetStdOut(), (c));
#define StdIo_PutString(str) File_PutString(Process_GetStdOut(), (str));
int StdIo_PrintFormat(const char *pszFormat, ...);
for ( iLen =0; pszPath[iLen] != '\0' && pszPath[iLen] != '/'; iLen++ )
;
- if ( strncmp(pszPath, self->DevTable[i].szName, iLen) == 0 )
+ if ( strncmp(pszPath, self->DevTable[i].szName, iLen) == 0 && self->DevTable[i].szName[iLen] == '\0' )
{
break;
}
* Hyper Operating System Application Framework
*
* @file system.h
- * @brief %jp{ã\82·ã\82¹ã\83\86ã\83 ç\94¨APIå®\9a義}
+ * @brief %jp{ã\83»ã\82ã\83»ã\82±ã\83»ã\83\8bã\83»ç\8c©ã\83 APIã\83\88ã\83\81}
*
* Copyright (C) 2006 by Project HOS
* http://sourceforge.jp/projects/hos/
#include "sysapi_local.h"
-/* ã\82·ã\82¹ã\83\86ã\83 æ\99\82å\88»å\8f\96å¾\97 */
+/* ã\83»ã\82ã\83»ã\82±ã\83»ã\83\8bã\83»ç\8b\83è¾¼æ\83\85*/
TIME SysTim_GetSystemTime(void)
{
SYSTIM tim;
* Hyper Operating System Application Framework
*
* @file time.h
- * @brief %jp{時刻管理API定義}
+ * @brief %jp{サ込理APIトチ}
*
* Copyright (C) 2006-2007 by Project HOS
* http://sourceforge.jp/projects/hos/
#define __HOS__time_h__
-/* ã\82·ã\82¹ã\83\86ã\83 æ\99\82å\88»å\9e\8b */
+/* ã\83»ã\82ã\83»ã\82±ã\83»ã\83\8bã\83»ç\8b\83è¾¼*/
typedef long TIME_SYSTEM;
#ifdef __cplusplus
* Hyper Operating System Application Framework
*
* @file time.h
- * @brief %jp{時刻管理API定義}
+ * @brief %jp{サ込理APIトチ}
*
* Copyright (C) 2006-2007 by Project HOS
* http://sourceforge.jp/projects/hos/
#include "system/sysapi/sysapi.h"
-/* ã\82·ã\82¹ã\83\86ã\83 æ\99\82å\88»(èµ·å\8b\95ã\81\8bã\82\89ã\81®ã\83\9fã\83ªç§\92)ã\82\92å¾\97る */
+/* ã\83»ã\82ã\83»ã\82±ã\83»ã\83\8bã\83»ç\8b\83å\88»(ã\82ªã\83\83ã\83\8bã\83¼ã\80\81ã\82©ã\80\81鬢ã\83\9bã\83»ã\82\9cã\83»ã\83\86)ã\80\81る */
TIME_SYSTEM Time_GetSystemTime(void)
{
return SysTim_GetSystemTime();
* Hyper Operating System Application Framework
*
* @file time.h
- * @brief %jp{時刻管理API定義}
+ * @brief %jp{サ込理APIトチ}
*
* Copyright (C) 2006-2007 by Project HOS
* http://sourceforge.jp/projects/hos/
#include "system/sysapi/sysapi.h"
-/* 一定時刻待つ */
+/* ー込*/
void Time_Wait(TIME_SYSTEM Millisecond)
{
SysTim_Wait(Millisecond);
# Microsoft Developer Studio Project File - Name="h4acfg" - Package Owner=<4>\r
# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** \95Ò\8fW\82µ\82È\82¢\82Å\82\82¾\82³\82¢ **\r
+# ** \95ÿÿW\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ**\r
\r
# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
\r
CFG=h4acfg - Win32 Debug\r
-!MESSAGE \82±\82ê\82Í\97L\8cø\82ÈÒ²¸Ì§²Ù\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81B \82±\82ÌÌßÛ¼Þª¸Ä\82ðËÞÙÄÞ\82·\82é\82½\82ß\82É\82Í NMAKE \82ð\8eg\97p\82µ\82Ä\82\82¾\82³\82¢\81B\r
-!MESSAGE [Ò²¸Ì§²Ù\82Ì´¸½Îß°Ä] ºÏÝÄÞ\82ð\8eg\97p\82µ\82Ä\8eÀ\8ds\82µ\82Ä\82\82¾\82³\82¢\r
-!MESSAGE \r
+!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94Ð\89¶\96¥\89×\82ÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96Êàz\8eÜ\85¶ÿÿèÉ\9f×\92Ü\82ÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
+!MESSAGE [\99°\8cÊ\84Qÿÿ\96²\8c»\97Ý\88Â] \8dÍ\9fcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
!MESSAGE NMAKE /f "h4acfg.mak".\r
!MESSAGE \r
-!MESSAGE NMAKE \82Ì\8eÀ\8ds\8e\9e\82É\8d\\90¬\82ð\8ew\92è\82Å\82«\82Ü\82·\r
-!MESSAGE ºÏÝÄÞ ×²Ý\8fã\82ÅϸÛ\82Ì\90Ý\92è\82ð\92è\8b`\82µ\82Ü\82·\81B\97á:\r
+!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÍ\9fcÿÿ\9cQÿÿÿÿ\93n\8cÙ\82ÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
!MESSAGE \r
!MESSAGE NMAKE /f "h4acfg.mak" CFG="h4acfg - Win32 Debug"\r
!MESSAGE \r
-!MESSAGE \91I\91ð\89Â\94\\82ÈËÞÙÄÞ Ó°ÄÞ:\r
+!MESSAGE \91I\91ÿÿÿÿ\\82\94É\9f×\92Ü \9aO\92Ü:\r
!MESSAGE \r
!MESSAGE "h4acfg - Win32 Release" ("Win32 (x86) Console Application" \97p)\r
!MESSAGE "h4acfg - Win32 Debug" ("Win32 (x86) Console Application" \97p)\r
Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# \8cx\8d\90: \82±\82ÌÜ°¸½Íß°½ ̧²Ù \82ð\95Ò\8fW\82Ü\82½\82Í\8dí\8f\9c\82µ\82È\82¢\82Å\82\82¾\82³\82¢!\r
+# \8cx\8d\90: \82ÿÿ\96Ú\88¶\8flàOÿÿ\96¥\89× \82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
\r
###############################################################################\r
\r
# Microsoft Developer Studio Project File - Name="hosv4a" - Package Owner=<4>\r
# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** \95Ò\8fW\82µ\82È\82¢\82Å\82\82¾\82³\82¢ **\r
+# ** \95ÿÿW\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ**\r
\r
# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
\r
CFG=hosv4a - Win32 Debug\r
-!MESSAGE \82±\82ê\82Í\97L\8cø\82ÈÒ²¸Ì§²Ù\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81B \82±\82ÌÌßÛ¼Þª¸Ä\82ðËÞÙÄÞ\82·\82é\82½\82ß\82É\82Í NMAKE \82ð\8eg\97p\82µ\82Ä\82\82¾\82³\82¢\81B\r
-!MESSAGE [Ò²¸Ì§²Ù\82Ì´¸½Îß°Ä] ºÏÝÄÞ\82ð\8eg\97p\82µ\82Ä\8eÀ\8ds\82µ\82Ä\82\82¾\82³\82¢\r
-!MESSAGE \r
+!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94Ð\89¶\96¥\89×\82ÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96Êàz\8eÜ\85¶ÿÿèÉ\9f×\92Ü\82ÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
+!MESSAGE [\99°\8cÊ\84Qÿÿ\96²\8c»\97Ý\88Â] \8dÍ\9fcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
!MESSAGE NMAKE /f "hosv4a.mak".\r
!MESSAGE \r
-!MESSAGE NMAKE \82Ì\8eÀ\8ds\8e\9e\82É\8d\\90¬\82ð\8ew\92è\82Å\82«\82Ü\82·\r
-!MESSAGE ºÏÝÄÞ ×²Ý\8fã\82ÅϸÛ\82Ì\90Ý\92è\82ð\92è\8b`\82µ\82Ü\82·\81B\97á:\r
+!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÍ\9fcÿÿ\9cQÿÿÿÿ\93n\8cÙ\82ÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
!MESSAGE \r
!MESSAGE NMAKE /f "hosv4a.mak" CFG="hosv4a - Win32 Debug"\r
!MESSAGE \r
-!MESSAGE \91I\91ð\89Â\94\\82ÈËÞÙÄÞ Ó°ÄÞ:\r
+!MESSAGE \91I\91ÿÿÿÿ\\82\94É\9f×\92Ü \9aO\92Ü:\r
!MESSAGE \r
!MESSAGE "hosv4a - Win32 Release" ("Win32 (x86) Static Library" \97p)\r
!MESSAGE "hosv4a - Win32 Debug" ("Win32 (x86) Static Library" \97p)\r
Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# \8cx\8d\90: \82±\82ÌÜ°¸½Íß°½ ̧²Ù \82ð\95Ò\8fW\82Ü\82½\82Í\8dí\8f\9c\82µ\82È\82¢\82Å\82\82¾\82³\82¢!\r
+# \8cx\8d\90: \82ÿÿ\96Ú\88¶\8flàOÿÿ\96¥\89× \82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
\r
###############################################################################\r
\r
} _KERNEL_T_CTXCB;
+/** %jp{割込みコンテキスト制御ブロック} */
+typedef struct _kernel_t_ictxcb
+{
+ VP isp;
+ UB intcnt;
+} _KERNEL_T_ICTXCB;
+
+
+extern _KERNEL_T_ICTXCB _kernel_ictxcb; /**< %jp{割込みコンテキスト制御ブロック} */
+
+
#ifdef __cplusplus
extern "C" {
#endif
-#define _KERNEL_INI_PRC() _kernel_ini_prc() /**< %jp{プロセッサ固有の初期化} */
+#define _KERNEL_INI_PRC() _kernel_ini_prc() /**< %jp{プロセッサ固有の初期化} */
-#define _KERNEL_ENA_INT() _kernel_ena_int() /**< %jp{割り込み許可} */
-#define _KERNEL_DIS_INT() _kernel_dis_int() /**< %jp{割り込み禁止} */
-#define _KERNEL_WAI_INT() _kernel_wai_int() /**< %jp{割り込み待ち(アイドル時の処理)} */
+#define _KERNEL_INI_INT(stksz, stk) do { _kernel_ictxcb.isp = (VB *)(stk) + (stksz); } while (0) /**< %jp{割込み初期化} */
+#define _KERNEL_ENA_INT() _kernel_ena_int() /**< %jp{割り込み許可} */
+#define _KERNEL_DIS_INT() _kernel_dis_int() /**< %jp{割り込み禁止} */
+#define _KERNEL_WAI_INT() _kernel_wai_int() /**< %jp{割り込み待ち(アイドル時の処理)} */
#define _KERNEL_CRE_CTX(pk_ctxcb, stksz, stk, isp, entry, par1, par2) \
_kernel_cre_ctx((UW)(par1), (UW)(par2), (pk_ctxcb), (isp), (entry))
# Microsoft Developer Studio Project File - Name="sample" - Package Owner=<4>\r
# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** \95Ò\8fW\82µ\82È\82¢\82Å\82\82¾\82³\82¢ **\r
+# ** \95ÿÿW\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ**\r
\r
# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
\r
CFG=sample - Win32 Debug\r
-!MESSAGE \82±\82ê\82Í\97L\8cø\82ÈÒ²¸Ì§²Ù\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81B \82±\82ÌÌßÛ¼Þª¸Ä\82ðËÞÙÄÞ\82·\82é\82½\82ß\82É\82Í NMAKE \82ð\8eg\97p\82µ\82Ä\82\82¾\82³\82¢\81B\r
-!MESSAGE [Ò²¸Ì§²Ù\82Ì´¸½Îß°Ä] ºÏÝÄÞ\82ð\8eg\97p\82µ\82Ä\8eÀ\8ds\82µ\82Ä\82\82¾\82³\82¢\r
-!MESSAGE \r
+!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94Ð\89¶\96¥\89×\82ÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96Êàz\8eÜ\85¶ÿÿèÉ\9f×\92Ü\82ÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
+!MESSAGE [\99°\8cÊ\84Qÿÿ\96²\8c»\97Ý\88Â] \8dÍ\9fcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
!MESSAGE NMAKE /f "sample.mak".\r
!MESSAGE \r
-!MESSAGE NMAKE \82Ì\8eÀ\8ds\8e\9e\82É\8d\\90¬\82ð\8ew\92è\82Å\82«\82Ü\82·\r
-!MESSAGE ºÏÝÄÞ ×²Ý\8fã\82ÅϸÛ\82Ì\90Ý\92è\82ð\92è\8b`\82µ\82Ü\82·\81B\97á:\r
+!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÍ\9fcÿÿ\9cQÿÿÿÿ\93n\8cÙ\82ÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
!MESSAGE \r
!MESSAGE NMAKE /f "sample.mak" CFG="sample - Win32 Debug"\r
!MESSAGE \r
-!MESSAGE \91I\91ð\89Â\94\\82ÈËÞÙÄÞ Ó°ÄÞ:\r
+!MESSAGE \91I\91ÿÿÿÿ\\82\94É\9f×\92Ü \9aO\92Ü:\r
!MESSAGE \r
!MESSAGE "sample - Win32 Release" ("Win32 (x86) Console Application" \97p)\r
!MESSAGE "sample - Win32 Debug" ("Win32 (x86) Console Application" \97p)\r
Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# \8cx\8d\90: \82±\82ÌÜ°¸½Íß°½ ̧²Ù \82ð\95Ò\8fW\82Ü\82½\82Í\8dí\8f\9c\82µ\82È\82¢\82Å\82\82¾\82³\82¢!\r
+# \8cx\8d\90: \82ÿÿ\96Ú\88¶\8flàOÿÿ\96¥\89× \82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
\r
###############################################################################\r
\r
# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
\r
CFG=test_que - Win32 Debug\r
-!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94Ð\89¶\96¥\89×\82ÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96Êàz\8eÜ\85¶ÿÿèÉ\9f×\92Ü\82ÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
-!MESSAGE [\99°\8cÊ\84Qÿÿ\96²\8c»\97Ý\88Â] \8dÍ\9fcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
+!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94ÿÿÿÿÿÿÿÿÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96\95ÞzÜ\85ÿÿÿäÇ\9fÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
+!MESSAGE [\99ÿÿÿÿQÿÿ\96ÿÿÿÿÿÿÿÿ \8dÿÿcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
!MESSAGE NMAKE /f "test_que.mak".\r
!MESSAGE \r
-!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÍ\9fcÿÿ\9cQÿÿÿÿ\93n\8cÙ\82ÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
+!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÿÿcÿÿ\9cQÿÿÿÿ\93n\8cÿÿÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
!MESSAGE \r
!MESSAGE NMAKE /f "test_que.mak" CFG="test_que - Win32 Debug"\r
!MESSAGE \r
-!MESSAGE \91I\91ÿÿÿÿ\\82\94É\9f×\92Ü \9aO\92Ü:\r
+!MESSAGE \91I\91ÿÿÿÿ\\82\94ÿÿÿÿÿÿ\9aO\92ÿÿ\r
!MESSAGE \r
!MESSAGE "test_que - Win32 Release" ("Win32 (x86) Console Application" \97p)\r
!MESSAGE "test_que - Win32 Debug" ("Win32 (x86) Console Application" \97p)\r
Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# \8cx\8d\90: \82ÿÿ\96Ú\88¶\8flàOÿÿ\96¥\89× \82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
+# \8cx\8d\90: \82ÿÿ\96ÿÿÿÿlÿÿÿÿ\96ÿÿÿÿ\82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
\r
###############################################################################\r
\r
# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
\r
CFG=cmtcnv - Win32 Debug\r
-!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94Ð\89¶\96¥\89×\82ÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96Êàz\8eÜ\85¶ÿÿèÉ\9f×\92Ü\82ÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
-!MESSAGE [\99°\8cÊ\84Qÿÿ\96²\8c»\97Ý\88Â] \8dÍ\9fcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
+!MESSAGE \82ÿÿÿÿÿÿL\8cÿÿ\94ÿÿÿÿÿÿÿÿÿÿÿÿ \82ÿÿÿÿÿÿÿÿB \82ÿÿ\96\95ÞzÜ\85ÿÿÿäÇ\9fÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNMAKE \82ð\8eg\97p\82ÿÿÿÿÿÿÿÿÿÿÿÿB\r
+!MESSAGE [\99ÿÿÿÿQÿÿ\96ÿÿÿÿÿÿÿÿ \8dÿÿcÿÿð\8eg\97p\82ÿÿÄ\8eÿÿs\82ÿÿÿÿÿÿÿÿÿÿÿÿ!MESSAGE \r
!MESSAGE NMAKE /f "cmtcnv.mak".\r
!MESSAGE \r
-!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÍ\9fcÿÿ\9cQÿÿÿÿ\93n\8cÙ\82ÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
+!MESSAGE NMAKE \82Ì\8eÿÿs\8e\9e\82ÿÿ\\90ÿÿð\8ew\92ÿÿÿÿÿÿÿÿÿÿ!MESSAGE \8dÿÿcÿÿ\9cQÿÿÿÿ\93n\8cÿÿÿÿÿÿÿÿÿÿÿÿ`\82ÿÿÿÿÿÿB\97ÿÿ\r
!MESSAGE \r
!MESSAGE NMAKE /f "cmtcnv.mak" CFG="cmtcnv - Win32 Debug"\r
!MESSAGE \r
-!MESSAGE \91I\91ÿÿÿÿ\\82\94É\9f×\92Ü \9aO\92Ü:\r
+!MESSAGE \91I\91ÿÿÿÿ\\82\94ÿÿÿÿÿÿ\9aO\92ÿÿ\r
!MESSAGE \r
!MESSAGE "cmtcnv - Win32 Release" ("Win32 (x86) Console Application" \97p)\r
!MESSAGE "cmtcnv - Win32 Debug" ("Win32 (x86) Console Application" \97p)\r
Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# \8cx\8d\90: \82ÿÿ\96Ú\88¶\8flàOÿÿ\96¥\89× \82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
+# \8cx\8d\90: \82ÿÿ\96ÿÿÿÿlÿÿÿÿ\96ÿÿÿÿ\82ÿÿÿÿW\82ÿÿÿÿÿÿÿÿ\9c\82ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\r
\r
###############################################################################\r
\r