Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/.cproject
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/.cproject	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/.cproject	(revision 364)
@@ -22,5 +22,5 @@
 			<storageModule moduleId="com.renesas.cdt.managedbuild.core.toolchainInfo">
 				<option id="toolchain.id" value="gcc-arm-embedded"/>
-				<option id="toolchain.version" value="5.4.1.20160919"/>
+				<option id="toolchain.version" value="6.3.1.20170620"/>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -59,5 +59,5 @@
 							<option id="com.renesas.cdt.managedbuild.gcc.rz.option.warnStack.368389066" name="Warn if stack size exceeds the limit (-Wstack-usage) (H')" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.warnStack" useByScannerDiscovery="false" value="100" valueType="string"/>
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.601068640" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
-							<builder buildPath="${workspace_loc:/asp3_dcre}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.1149515652" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="false" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
+							<builder buildPath="${workspace_loc:/asp3_dcre}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.1149515652" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
 							<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler.519851149" name="Cross ARM GNU Assembler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler">
 								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.279657327" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@@ -127,5 +127,5 @@
 			<storageModule moduleId="com.renesas.cdt.managedbuild.core.toolchainInfo">
 				<option id="toolchain.id" value="gcc-arm-embedded"/>
-				<option id="toolchain.version" value="5.4.1.20160919"/>
+				<option id="toolchain.version" value="6.3.1.20170620"/>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/Debug/Makefile
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/Debug/Makefile	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/Debug/Makefile	(revision 364)
@@ -56,9 +56,9 @@
 SRCLANG = c
 ifeq ($(SRCLANG),c)
-	LIBS = -lmusl
+	LIBS = $(SRCDIR)/../musl-1.1.18/Debug/libmusl.a
 endif
 ifeq ($(SRCLANG),c++)
 	USE_CXX = true
-	CXXLIBS = -lstdc++ -lmusl
+	CXXLIBS = -lstdc++ $(SRCDIR)/../musl-1.1.18/Debug/libmusl.a
 	CXXRTS = cxxrt.o newlibrt.o
 endif
@@ -150,4 +150,6 @@
 endif
 
+TINETDIR = 
+
 #
 #  mbedサービスの定義
@@ -171,5 +173,5 @@
 CDEFS := $(CDEFS) 
 INCLUDES := -I. -I$(SRCDIR)/include $(INCLUDES) -I$(SRCDIR)
-LDFLAGS := $(LDFLAGS) -Wl,-Map=$(OBJNAME).map,--cref -L$(SRCDIR)/../musl-1.1.18/Debug
+LDFLAGS := $(LDFLAGS) -L.
 LIBS := $(LIBS) $(CXXLIBS)
 CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
@@ -192,10 +194,9 @@
 endif
 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o time.o
-APPL_CFLAGS := $(APPL_CFLAGS)
+APPL_CFLAGS := $(APPL_CFLAGS) -nostdinc
 ifdef APPLDIRS
 	INCLUDES := $(INCLUDES) $(foreach dir,$(APPLDIRS),-I$(dir))
 endif
 
-TINETDIR = 
 ifdef TINETDIR
 	#
@@ -335,4 +336,5 @@
 vpath %.cfg $(APPL_DIRS)
 vpath %.cdl $(APPL_DIRS)
+vpath %.bin $(APPL_DIRS)
 
 #
@@ -341,5 +343,5 @@
 KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
 SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS) $(HIDDEN_OBJS)
-APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
+APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS) $(APPL_BINOBJS)
 ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
 											$(END_OBJS) $(HIDDEN_OBJS)
@@ -387,5 +389,5 @@
 $(CFG1_OUT): $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
 	$(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
-						$(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS)
+						$(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
 
 cfg1_out.syms: $(CFG1_OUT)
@@ -416,4 +418,11 @@
 
 #
+#  並列makeのための依存関係の定義
+#
+$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
+$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
+														| offset.timestamp
+
+#
 #  特別な依存関係の定義
 #
@@ -424,7 +433,7 @@
 #
 $(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
-	$(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
+	$(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
 			$(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
-			$(ALL_LIBS) $(END_OBJS)
+			-Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
 
 #
@@ -597,4 +606,7 @@
 	$(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
 
+$(APPL_BINOBJS): %.o: %.bin
+	$(OBJCOPY) -B arm -I binary -O elf32-littlearm --rename-section .data=.rodata $< $*.o
+
 #
 #  デフォルトコンパイルルールを上書き
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/Makefile.config	(revision 364)
@@ -0,0 +1,55 @@
+#
+#   TOPPERS/ASP/FMP Kernel
+#       Toyohashi Open Platform for Embedded Real-Time Systems/
+#       Advanced Standard Profile Kernel
+#
+#   Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
+#                               Toyohashi Univ. of Technology, JAPAN
+#   Copyright (C) 2003-2008 by Ryosuke Takeuchi
+#                Platform Development Center RICOH COMPANY,LTD. JAPAN
+#   Copyright (C) 2015-2017 by TOPPERS PROJECT Educational Working Group.
+#
+#   上記著作権者は，以下の (1)～(4) の条件か，Free Software Foundation 
+#   によって公表されている GNU General Public License の Version 2 に記
+#   述されている条件を満たす場合に限り，本ソフトウェア（本ソフトウェア
+#   を改変したものを含む．以下同じ）を使用・複製・改変・再配布（以下，
+#   利用と呼ぶ）することを無償で許諾する．
+#   (1) 本ソフトウェアをソースコードの形で利用する場合には，上記の著作
+#       権表示，この利用条件および下記の無保証規定が，そのままの形でソー
+#       スコード中に含まれていること．
+#   (2) 本ソフトウェアを，ライブラリ形式など，他のソフトウェア開発に使
+#       用できる形で再配布する場合には，再配布に伴うドキュメント（利用
+#       者マニュアルなど）に，上記の著作権表示，この利用条件および下記
+#       の無保証規定を掲載すること．
+#   (3) 本ソフトウェアを，機器に組み込むなど，他のソフトウェア開発に使
+#       用できない形で再配布する場合には，次のいずれかの条件を満たすこ
+#       と．
+#     (a) 再配布に伴うドキュメント（利用者マニュアルなど）に，上記の著
+#         作権表示，この利用条件および下記の無保証規定を掲載すること．
+#     (b) 再配布の形態を，別に定める方法によって，TOPPERSプロジェクトに
+#         報告すること．
+#   (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+#       害からも，上記著作権者およびTOPPERSプロジェクトを免責すること．
+#
+#   本ソフトウェアは，無保証で提供されているものである．上記著作権者お
+#   よびTOPPERSプロジェクトは，本ソフトウェアに関して，その適用可能性も
+#   含めて，いかなる保証も行わない．また，本ソフトウェアの利用により直
+#   接的または間接的に生じたいかなる損害に関しても，その責任を負わない．
+#
+#  @(#) $Id$
+#
+ 
+#
+#  Makefile のプロセッサ依存 (adafruit st7735:LCD用)
+#
+
+#
+#  コンパイルオプション
+#
+INCLUDES := $(INCLUDES) -I$(SRCDIR)/gdic/adafruit_ssd1306
+
+#
+#  ADAFRUIT SSD1306 LCD DRIVER(GDIC)に関する定義
+#
+SYSSVC_DIRS := $(SYSSVC_DIRS):$(SRCDIR)/gdic/adafruit_ssd1306
+SYSSVC_COBJS := $(SYSSVC_COBJS) adafruit_ssd1306.o
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.c	(revision 364)
@@ -0,0 +1,701 @@
+/*********************************************************************
+This is a library for our Monochrome OLEDs based on SSD1306 drivers
+
+  Pick one up today in the adafruit shop!
+  ------> http://www.adafruit.com/category/63_98
+
+These displays use SPI to communicate, 4 or 5 pins are required to
+interface
+
+Adafruit invests time and resources providing this open source code,
+please support Adafruit and open-source hardware by purchasing
+products from Adafruit!
+
+Written by Limor Fried/Ladyada  for Adafruit Industries.
+BSD license, check license.txt for more information
+All text above, and the splash screen below must be included in any redistribution
+*********************************************************************/
+
+#include <string.h>
+#include <kernel.h>
+#include <t_syslog.h>
+#include <t_stdlib.h>
+#include <target_syssvc.h>
+#include <time.h>
+#include "syssvc/serial.h"
+#include "syssvc/syslog.h"
+#include "adafruit_ssd1306.h"
+
+#define HIGH 1
+#define LOW 0
+
+// the memory buffer for the LCD
+
+static uint8_t buffer[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x80, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
+0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFF,
+#if (SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH > 96*16)
+0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
+0x80, 0xFF, 0xFF, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x8C, 0x8E, 0x84, 0x00, 0x00, 0x80, 0xF8,
+0xF8, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x80,
+0x00, 0xE0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xC7, 0x01, 0x01,
+0x01, 0x01, 0x83, 0xFF, 0xFF, 0x00, 0x00, 0x7C, 0xFE, 0xC7, 0x01, 0x01, 0x01, 0x01, 0x83, 0xFF,
+0xFF, 0xFF, 0x00, 0x38, 0xFE, 0xC7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xC7, 0xFF, 0xFF, 0x00, 0x00,
+0x01, 0xFF, 0xFF, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x7F, 0xFF,
+0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0xFF,
+0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC7, 0xC7, 0x8F,
+0x8F, 0x9F, 0xBF, 0xFF, 0xFF, 0xC3, 0xC0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xFC,
+0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x00, 0x01, 0x03, 0x03, 0x03,
+0x03, 0x03, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01,
+0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00,
+0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03,
+0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+#if (SSD1306_LCDHEIGHT == 64)
+0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F,
+0x87, 0xC7, 0xF7, 0xFF, 0xFF, 0x1F, 0x1F, 0x3D, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0x7C, 0x7D, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x0F, 0x07, 0x00, 0x30, 0x30, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xC0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F,
+0x0F, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00,
+0x00, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xF0, 0xF8, 0x1C, 0x0E,
+0x06, 0x06, 0x06, 0x0C, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFC,
+0xFE, 0xFC, 0x00, 0x18, 0x3C, 0x7E, 0x66, 0xE6, 0xCE, 0x84, 0x00, 0x00, 0x06, 0xFF, 0xFF, 0x06,
+0x06, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x06, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0xC0, 0xF8,
+0xFC, 0x4E, 0x46, 0x46, 0x46, 0x4E, 0x7C, 0x78, 0x40, 0x18, 0x3C, 0x76, 0xE6, 0xCE, 0xCC, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x03,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
+0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0C,
+0x18, 0x18, 0x0C, 0x06, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0E, 0x0C, 0x18, 0x0C, 0x0F,
+0x07, 0x01, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00,
+0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x07,
+0x07, 0x0C, 0x0C, 0x18, 0x1C, 0x0C, 0x06, 0x06, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#endif
+#endif
+};
+
+void lcd_fastSPIwrite(LCD_Handler_t *lcd, uint8_t d);
+#define lcd_swap(a, b) { int16_t t = a; a = b; b = t; }
+
+// the most basic function, set a single pixel
+void lcd_drawPixel(LCD_Handler_t *lcd, int16_t x, int16_t y, uint16_t color) {
+	if ((x < 0) || (x >= lcd->_width) || (y < 0) || (y >= lcd->_height))
+		return;
+
+	// check rotation, move pixel around if necessary
+	switch (lcd->rotation) {
+	case 1:
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		break;
+	case 2:
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		break;
+	case 3:
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		break;
+	}
+
+	// x is which column
+	switch (color)
+	{
+	case WHITE:   buffer[x + (y / 8)*SSD1306_LCDWIDTH] |= (1 << (y & 7)); break;
+	case BLACK:   buffer[x + (y / 8)*SSD1306_LCDWIDTH] &= ~(1 << (y & 7)); break;
+	case INVERSE: buffer[x + (y / 8)*SSD1306_LCDWIDTH] ^= (1 << (y & 7)); break;
+	}
+}
+
+void lcd_init1(LCD_Handler_t *lcd, int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->cs, CS);
+	gpio_init(&lcd->rst, RST);
+	gpio_init(&lcd->dc, DC);
+	gpio_init(&lcd->sclk, SCLK);
+	gpio_init(&lcd->sid, SID);
+	lcd->hwSPI = false;
+}
+
+// constructor for hardware SPI - we indicate DataCommand, ChipSelect, Reset
+void lcd_init2(LCD_Handler_t *lcd, int8_t DC, int8_t RST, int8_t CS)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->dc, DC);
+	gpio_init(&lcd->rst, RST);
+	gpio_init(&lcd->cs, CS);
+	lcd->hwSPI = true;
+}
+
+// initializer for I2C - we only indicate the reset pin!
+void lcd_init3(LCD_Handler_t *lcd, int8_t reset)
+{
+	lcd->_width = SSD1306_LCDWIDTH;
+	lcd->_height = SSD1306_LCDHEIGHT;
+	gpio_init(&lcd->sclk, NC);
+	gpio_init(&lcd->dc, NC);
+	gpio_init(&lcd->cs, NC);
+	gpio_init(&lcd->sid, NC);
+	gpio_init(&lcd->rst, reset);
+}
+
+void lcd_begin(LCD_Handler_t *lcd, uint8_t vccstate, uint8_t i2caddr, bool_t reset) {
+	lcd->_vccstate = vccstate;
+	lcd->_i2caddr = i2caddr;
+
+	// set pin directions
+	if (lcd->sid.pin != NC) {
+		gpio_dir(&lcd->dc, PIN_OUTPUT);
+		gpio_dir(&lcd->cs, PIN_OUTPUT);
+		if (!lcd->hwSPI) {
+			// set pins for software-SPI
+			gpio_dir(&lcd->sid, PIN_OUTPUT);
+			gpio_dir(&lcd->sclk, PIN_OUTPUT);
+		}
+		if (lcd->hwSPI) {
+			spi_format(&lcd->spi, 8, 0, 0);
+			spi_master_write(&lcd->spi, 8000000);
+		}
+	}
+	else
+	{
+		// I2C Init
+		//i2c_begin(&lcd->i2c);
+#ifdef __SAM3X8E__
+		// Force 400 KHz I2C, rawr! (Uses pins 20, 21 for SDA, SCL)
+		TWI1->TWI_CWGR = 0;
+		TWI1->TWI_CWGR = ((VARIANT_MCK / (2 * 400000)) - 4) * 0x101;
+#endif
+	}
+	if ((reset) && (lcd->rst.pin != NC)) {
+		// Setup reset pin direction (used by both SPI and I2C)
+		gpio_dir(&lcd->rst, PIN_OUTPUT);
+		gpio_write(&lcd->rst, HIGH);
+		// VDD (3.3V) goes high at start, lets just chill for a ms
+		dly_tsk(1 * 1000);
+		// bring reset low
+		gpio_write(&lcd->rst, LOW);
+		// wait 10ms
+		dly_tsk(10 * 1000);
+		// bring out of reset
+		gpio_write(&lcd->rst, HIGH);
+		// turn on VCC (9V?)
+	}
+
+	// Init sequence
+	lcd_command(lcd, SSD1306_DISPLAYOFF);                    // 0xAE
+	lcd_command(lcd, SSD1306_SETDISPLAYCLOCKDIV);            // 0xD5
+	lcd_command(lcd, 0x80);                                  // the suggested ratio 0x80
+
+	lcd_command(lcd, SSD1306_SETMULTIPLEX);                  // 0xA8
+	lcd_command(lcd, SSD1306_LCDHEIGHT - 1);
+
+	lcd_command(lcd, SSD1306_SETDISPLAYOFFSET);              // 0xD3
+	lcd_command(lcd, 0x0);                                   // no offset
+	lcd_command(lcd, SSD1306_SETSTARTLINE | 0x0);            // line #0
+	lcd_command(lcd, SSD1306_CHARGEPUMP);                    // 0x8D
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x10);
+	}
+	else
+	{
+		lcd_command(lcd, 0x14);
+	}
+	lcd_command(lcd, SSD1306_MEMORYMODE);                    // 0x20
+	lcd_command(lcd, 0x00);                                  // 0x0 act like ks0108
+	lcd_command(lcd, SSD1306_SEGREMAP | 0x1);
+	lcd_command(lcd, SSD1306_COMSCANDEC);
+
+#if defined SSD1306_128_32
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x02);
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	lcd_command(lcd, 0x8F);
+
+#elif defined SSD1306_128_64
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x12);
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x9F);
+	}
+	else
+	{
+		lcd_command(lcd, 0xCF);
+	}
+
+#elif defined SSD1306_96_16
+	lcd_command(lcd, SSD1306_SETCOMPINS);                    // 0xDA
+	lcd_command(lcd, 0x2);   //ada x12
+	lcd_command(lcd, SSD1306_SETCONTRAST);                   // 0x81
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x10);
+	}
+	else
+	{
+		lcd_command(lcd, 0xAF);
+	}
+
+#endif
+
+	lcd_command(lcd, SSD1306_SETPRECHARGE);                  // 0xd9
+	if (vccstate == SSD1306_EXTERNALVCC)
+	{
+		lcd_command(lcd, 0x22);
+	}
+	else
+	{
+		lcd_command(lcd, 0xF1);
+	}
+	lcd_command(lcd, SSD1306_SETVCOMDETECT);                 // 0xDB
+	lcd_command(lcd, 0x40);
+	lcd_command(lcd, SSD1306_DISPLAYALLON_RESUME);           // 0xA4
+	lcd_command(lcd, SSD1306_NORMALDISPLAY);                 // 0xA6
+
+	lcd_command(lcd, SSD1306_DEACTIVATE_SCROLL);
+
+	lcd_command(lcd, SSD1306_DISPLAYON);//--turn on oled panel
+}
+
+
+void lcd_invertDisplay(LCD_Handler_t *lcd, uint8_t i) {
+	if (i) {
+		lcd_command(lcd, SSD1306_INVERTDISPLAY);
+	}
+	else {
+		lcd_command(lcd, SSD1306_NORMALDISPLAY);
+	}
+}
+
+void lcd_command(LCD_Handler_t *lcd, uint8_t c) {
+	if (lcd->sid.pin != NC)
+	{
+		// SPI
+		gpio_write(&lcd->cs, HIGH);
+		gpio_write(&lcd->dc, LOW);
+		gpio_write(&lcd->cs, LOW);
+		lcd_fastSPIwrite(lcd, c);
+		gpio_write(&lcd->cs, HIGH);
+	}
+	else
+	{
+		// I2C
+		uint8_t data[2] = { 0x00/* Co = 0, D/C = 0*/, c };
+		i2c_write(&lcd->i2c, lcd->_i2caddr, data, sizeof(data), 1);
+	}
+}
+
+// startscrollright
+// Activate a right handed scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrollright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_RIGHT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, 0XFF);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrollleft
+// Activate a right handed scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrollleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_LEFT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, 0XFF);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrolldiagright
+// Activate a diagonal scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrolldiagright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_SET_VERTICAL_SCROLL_AREA);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, SSD1306_LCDHEIGHT);
+	lcd_command(lcd, SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X01);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+// startscrolldiagleft
+// Activate a diagonal scroll for rows start through stop
+// Hint, the display is 16 rows tall. To scroll the whole display, run:
+// display.scrollright(0x00, 0x0F)
+void lcd_startscrolldiagleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop) {
+	lcd_command(lcd, SSD1306_SET_VERTICAL_SCROLL_AREA);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, SSD1306_LCDHEIGHT);
+	lcd_command(lcd, SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, start);
+	lcd_command(lcd, 0X00);
+	lcd_command(lcd, stop);
+	lcd_command(lcd, 0X01);
+	lcd_command(lcd, SSD1306_ACTIVATE_SCROLL);
+}
+
+void lcd_stopscroll(LCD_Handler_t *lcd) {
+	lcd_command(lcd, SSD1306_DEACTIVATE_SCROLL);
+}
+
+// Dim the display
+// dim = true: display is dimmed
+// dim = false: display is normal
+void lcd_dim(LCD_Handler_t *lcd, bool_t dim) {
+	uint8_t contrast;
+
+	if (dim) {
+		contrast = 0; // Dimmed display
+	}
+	else {
+		if (lcd->_vccstate == SSD1306_EXTERNALVCC) {
+			contrast = 0x9F;
+		}
+		else {
+			contrast = 0xCF;
+		}
+	}
+	// the range of contrast to too small to be really useful
+	// it is useful to dim the display
+	lcd_command(lcd, SSD1306_SETCONTRAST);
+	lcd_command(lcd, contrast);
+}
+
+void lcd_display(LCD_Handler_t *lcd) {
+	lcd_command(lcd, SSD1306_COLUMNADDR);
+	lcd_command(lcd, 0);   // Column start address (0 = reset)
+	lcd_command(lcd, SSD1306_LCDWIDTH - 1); // Column end address (127 = reset)
+
+	lcd_command(lcd, SSD1306_PAGEADDR);
+	lcd_command(lcd, 0); // Page start address (0 = reset)
+#if SSD1306_LCDHEIGHT == 64
+	lcd_command(lcd, 7); // Page end address
+#endif
+#if SSD1306_LCDHEIGHT == 32
+	lcd_command(lcd, 3); // Page end address
+#endif
+#if SSD1306_LCDHEIGHT == 16
+	lcd_command(lcd, 1); // Page end address
+#endif
+
+	if (lcd->sid.pin != NC)
+	{
+		// SPI
+		gpio_write(&lcd->cs, HIGH);
+		gpio_write(&lcd->dc, HIGH);
+		gpio_write(&lcd->cs, LOW);
+
+		for (uint16_t i = 0; i < (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8); i++) {
+			lcd_fastSPIwrite(lcd, buffer[i]);
+		}
+		gpio_write(&lcd->cs, HIGH);
+	}
+	else
+	{
+		// save I2C bitrate
+#ifdef TWBR
+		uint8_t twbrbackup = TWBR;
+		TWBR = 12; // upgrade to 400KHz!
+#endif
+		//Serial.println(TWBR, DEC);
+		//Serial.println(TWSR & 0x3, DEC);
+
+		// I2C
+		uint8_t data[17] = { 0x40, };
+		for (uint16_t i = 0; i < (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8); i+=16) {
+			// send a bunch of data in one xmission
+			memcpy(&data[1], &buffer[i], 16);
+			i2c_write(&lcd->i2c, lcd->_i2caddr, data, sizeof(data), 1);
+		}
+#ifdef TWBR
+		TWBR = twbrbackup;
+#endif
+	}
+}
+
+// clear everything
+void lcd_clearDisplay(LCD_Handler_t *lcd) {
+	memset(buffer, 0, (SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT / 8));
+}
+
+void lcd_fastSPIwrite(LCD_Handler_t *lcd, uint8_t d)
+{
+	if (lcd->hwSPI) {
+		spi_master_write(&lcd->spi, d);
+	}
+	else {
+		for (uint8_t bit = 0x80; bit; bit >>= 1) {
+			gpio_write(&lcd->sclk, LOW);
+			if (d & bit) gpio_write(&lcd->sid, HIGH);
+			else        gpio_write(&lcd->sid, LOW);
+			gpio_write(&lcd->sclk, HIGH);
+		}
+	}
+}
+
+void lcd_drawFastHLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color) {
+	bool_t bSwap = false;
+	switch (lcd->rotation) {
+	case 0:
+		// 0 degree rotation, do nothing
+		break;
+	case 1:
+		// 90 degree rotation, swap x & y for rotation, then invert x
+		bSwap = true;
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		break;
+	case 2:
+		// 180 degree rotation, invert x and y - then shift y around for height.
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		x -= (w - 1);
+		break;
+	case 3:
+		// 270 degree rotation, swap x & y for rotation, then invert y  and adjust y for w (not to become h)
+		bSwap = true;
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		y -= (w - 1);
+		break;
+	}
+
+	if (bSwap) {
+		lcd_drawFastVLineInternal(lcd, x, y, w, color);
+	}
+	else {
+		lcd_drawFastHLineInternal(lcd, x, y, w, color);
+	}
+}
+
+void lcd_drawFastHLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color) {
+	// Do bounds/limit checks
+	if (y < 0 || y >= lcd->_height) { return; }
+
+	// make sure we don't try to draw below 0
+	if (x < 0) {
+		w += x;
+		x = 0;
+	}
+
+	// make sure we don't go off the edge of the display
+	if ((x + w) > lcd->_width) {
+		w = (lcd->_width - x);
+	}
+
+	// if our width is now negative, punt
+	if (w <= 0) { return; }
+
+	// set up the pointer for  movement through the buffer
+	register uint8_t *pBuf = buffer;
+	// adjust the buffer pointer for the current row
+	pBuf += ((y / 8) * SSD1306_LCDWIDTH);
+	// and offset x columns in
+	pBuf += x;
+
+	register uint8_t mask = 1 << (y & 7);
+
+	switch (color)
+	{
+	case WHITE:         while (w--) { *pBuf++ |= mask; }; break;
+	case BLACK: mask = ~mask;   while (w--) { *pBuf++ &= mask; }; break;
+	case INVERSE:         while (w--) { *pBuf++ ^= mask; }; break;
+	}
+}
+
+void lcd_drawFastVLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color) {
+	bool_t bSwap = false;
+	switch (lcd->rotation) {
+	case 0:
+		break;
+	case 1:
+		// 90 degree rotation, swap x & y for rotation, then invert x and adjust x for h (now to become w)
+		bSwap = true;
+		lcd_swap(x, y);
+		x = lcd->_width - x - 1;
+		x -= (h - 1);
+		break;
+	case 2:
+		// 180 degree rotation, invert x and y - then shift y around for height.
+		x = lcd->_width - x - 1;
+		y = lcd->_height - y - 1;
+		y -= (h - 1);
+		break;
+	case 3:
+		// 270 degree rotation, swap x & y for rotation, then invert y
+		bSwap = true;
+		lcd_swap(x, y);
+		y = lcd->_height - y - 1;
+		break;
+	}
+
+	if (bSwap) {
+		lcd_drawFastHLineInternal(lcd, x, y, h, color);
+	}
+	else {
+		lcd_drawFastVLineInternal(lcd, x, y, h, color);
+	}
+}
+
+
+void lcd_drawFastVLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t __y, int16_t __h, uint16_t color) {
+
+	// do nothing if we're off the left or right side of the screen
+	if (x < 0 || x >= lcd->_width) { return; }
+
+	// make sure we don't try to draw below 0
+	if (__y < 0) {
+		// __y is negative, this will subtract enough from __h to account for __y being 0
+		__h += __y;
+		__y = 0;
+
+	}
+
+	// make sure we don't go past the height of the display
+	if ((__y + __h) > lcd->_height) {
+		__h = (lcd->_height - __y);
+	}
+
+	// if our height is now negative, punt
+	if (__h <= 0) {
+		return;
+	}
+
+	// this display doesn't need ints for coordinates, use local byte registers for faster juggling
+	register uint8_t y = __y;
+	register uint8_t h = __h;
+
+
+	// set up the pointer for fast movement through the buffer
+	register uint8_t *pBuf = buffer;
+	// adjust the buffer pointer for the current row
+	pBuf += ((y / 8) * SSD1306_LCDWIDTH);
+	// and offset x columns in
+	pBuf += x;
+
+	// do the first partial byte, if necessary - this requires some masking
+	register uint8_t mod = (y & 7);
+	if (mod) {
+		// mask off the high n bits we want to set
+		mod = 8 - mod;
+
+		// note - lookup table results in a nearly 10% performance improvement in fill* functions
+		// register uint8_t mask = ~(0xFF >> (mod));
+		static uint8_t premask[8] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
+		register uint8_t mask = premask[mod];
+
+		// adjust the mask if we're not going to reach the end of this byte
+		if (h < mod) {
+			mask &= (0XFF >> (mod - h));
+		}
+
+		switch (color)
+		{
+		case WHITE:   *pBuf |= mask;  break;
+		case BLACK:   *pBuf &= ~mask;  break;
+		case INVERSE: *pBuf ^= mask;  break;
+		}
+
+		// fast exit if we're done here!
+		if (h < mod) { return; }
+
+		h -= mod;
+
+		pBuf += SSD1306_LCDWIDTH;
+	}
+
+	// write solid bytes while we can - effectively doing 8 rows at a time
+	if (h >= 8) {
+		if (color == INVERSE) {          // separate copy of the code so we don't impact performance of the black/white write version with an extra comparison per loop
+			do {
+				*pBuf = ~(*pBuf);
+
+				// adjust the buffer forward 8 rows worth of data
+				pBuf += SSD1306_LCDWIDTH;
+
+				// adjust h & y (there's got to be a faster way for me to do this, but this should still help a fair bit for now)
+				h -= 8;
+			} while (h >= 8);
+		}
+		else {
+			// store a local value to work with
+			register uint8_t val = (color == WHITE) ? 255 : 0;
+
+			do {
+				// write our value in
+				*pBuf = val;
+
+				// adjust the buffer forward 8 rows worth of data
+				pBuf += SSD1306_LCDWIDTH;
+
+				// adjust h & y (there's got to be a faster way for me to do this, but this should still help a fair bit for now)
+				h -= 8;
+			} while (h >= 8);
+		}
+	}
+
+	// now do the final partial byte, if necessary
+	if (h) {
+		mod = h & 7;
+		// this time we want to mask the low bits of the byte, vs the high bits we did above
+		// register uint8_t mask = (1 << mod) - 1;
+		// note - lookup table results in a nearly 10% performance improvement in fill* functions
+		static uint8_t postmask[8] = { 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F };
+		register uint8_t mask = postmask[mod];
+		switch (color)
+		{
+		case WHITE:   *pBuf |= mask;  break;
+		case BLACK:   *pBuf &= ~mask;  break;
+		case INVERSE: *pBuf ^= mask;  break;
+		}
+	}
+}
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h	(revision 364)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h	(revision 364)
@@ -0,0 +1,160 @@
+/*********************************************************************
+This is a library for our Monochrome OLEDs based on SSD1306 drivers
+
+  Pick one up today in the adafruit shop!
+  ------> http://www.adafruit.com/category/63_98
+
+These displays use SPI to communicate, 4 or 5 pins are required to
+interface
+
+Adafruit invests time and resources providing this open source code,
+please support Adafruit and open-source hardware by purchasing
+products from Adafruit!
+
+Written by Limor Fried/Ladyada  for Adafruit Industries.
+BSD license, check license.txt for more information
+All text above, and the splash screen must be included in any redistribution
+*********************************************************************/
+#ifndef _Adafruit_SSD1306_H_
+#define _Adafruit_SSD1306_H_
+
+#include "gpio_api.h"
+#include "spi_api.h"
+#include "i2c_api.h"
+
+#define BLACK 0
+#define WHITE 1
+#define INVERSE 2
+
+#define SSD1306_I2C_ADDRESS   0x78  // 011110+SA0+RW - 0x78 or 0x7A
+// Address for 128x32 is 0x3C
+// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)
+
+/*=========================================================================
+	SSD1306 Displays
+	-----------------------------------------------------------------------
+	The driver is used in multiple displays (128x64, 128x32, etc.).
+	Select the appropriate display below to create an appropriately
+	sized framebuffer, etc.
+
+	SSD1306_128_64  128x64 pixel display
+
+	SSD1306_128_32  128x32 pixel display
+
+	SSD1306_96_16
+
+	-----------------------------------------------------------------------*/
+#define SSD1306_128_64
+//#define SSD1306_128_32
+//   #define SSD1306_96_16
+/*=========================================================================*/
+
+#if defined SSD1306_128_64 && defined SSD1306_128_32
+#error "Only one SSD1306 display can be specified at once in SSD1306.h"
+#endif
+#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
+#error "At least one SSD1306 display must be specified in SSD1306.h"
+#endif
+
+#if defined SSD1306_128_64
+#define SSD1306_LCDWIDTH                  128
+#define SSD1306_LCDHEIGHT                 64
+#endif
+#if defined SSD1306_128_32
+#define SSD1306_LCDWIDTH                  128
+#define SSD1306_LCDHEIGHT                 32
+#endif
+#if defined SSD1306_96_16
+#define SSD1306_LCDWIDTH                  96
+#define SSD1306_LCDHEIGHT                 16
+#endif
+
+#define SSD1306_SETCONTRAST 0x81
+#define SSD1306_DISPLAYALLON_RESUME 0xA4
+#define SSD1306_DISPLAYALLON 0xA5
+#define SSD1306_NORMALDISPLAY 0xA6
+#define SSD1306_INVERTDISPLAY 0xA7
+#define SSD1306_DISPLAYOFF 0xAE
+#define SSD1306_DISPLAYON 0xAF
+
+#define SSD1306_SETDISPLAYOFFSET 0xD3
+#define SSD1306_SETCOMPINS 0xDA
+
+#define SSD1306_SETVCOMDETECT 0xDB
+
+#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
+#define SSD1306_SETPRECHARGE 0xD9
+
+#define SSD1306_SETMULTIPLEX 0xA8
+
+#define SSD1306_SETLOWCOLUMN 0x00
+#define SSD1306_SETHIGHCOLUMN 0x10
+
+#define SSD1306_SETSTARTLINE 0x40
+
+#define SSD1306_MEMORYMODE 0x20
+#define SSD1306_COLUMNADDR 0x21
+#define SSD1306_PAGEADDR   0x22
+
+#define SSD1306_COMSCANINC 0xC0
+#define SSD1306_COMSCANDEC 0xC8
+
+#define SSD1306_SEGREMAP 0xA0
+
+#define SSD1306_CHARGEPUMP 0x8D
+
+#define SSD1306_EXTERNALVCC 0x1
+#define SSD1306_SWITCHCAPVCC 0x2
+
+// Scrolling #defines
+#define SSD1306_ACTIVATE_SCROLL 0x2F
+#define SSD1306_DEACTIVATE_SCROLL 0x2E
+#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
+#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
+#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
+#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
+#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
+
+typedef struct
+{
+	uint16_t                _width;		/* 幅ピクセル数 */
+	uint16_t				_height;	/* 高さピクセル数 */
+	int rotation;
+	int8_t _i2caddr, _vccstate;
+	gpio_t sid, sclk, dc, rst, cs;
+	bool_t hwSPI;
+	i2c_t i2c;
+	spi_t spi;
+} LCD_Handler_t;
+
+void lcd_init1(LCD_Handler_t *lcd, int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
+void lcd_init2(LCD_Handler_t *lcd, int8_t DC, int8_t RST, int8_t CS);
+//void lcd_init3(LCD_Handler_t *lcd, int8_t RST = -1);
+void lcd_init3(LCD_Handler_t *lcd, int8_t RST);
+
+//void lcd_begin(LCD_Handler_t *lcd, uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool_t reset = true);
+void lcd_begin(LCD_Handler_t *lcd, uint8_t switchvcc, uint8_t i2caddr, bool_t reset);
+void lcd_command(LCD_Handler_t *lcd, uint8_t c);
+
+void lcd_clearDisplay(LCD_Handler_t *lcd);
+void lcd_invertDisplay(LCD_Handler_t *lcd, uint8_t i);
+void lcd_display(LCD_Handler_t *lcd);
+
+void lcd_startscrollright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_startscrollleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+
+void lcd_startscrolldiagright(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_startscrolldiagleft(LCD_Handler_t *lcd, uint8_t start, uint8_t stop);
+void lcd_stopscroll(LCD_Handler_t *lcd);
+
+void lcd_dim(LCD_Handler_t *lcd, bool_t dim);
+
+void lcd_drawPixel(LCD_Handler_t *lcd, int16_t x, int16_t y, uint16_t color);
+
+void lcd_drawFastVLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color);
+void lcd_drawFastHLine(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color);
+
+void lcd_drawFastVLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t h, uint16_t color);
+void lcd_drawFastHLineInternal(LCD_Handler_t *lcd, int16_t x, int16_t y, int16_t w, uint16_t color);
+
+#endif /* _Adafruit_SSD1306_H_ */
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c	(revision 364)
@@ -354,4 +354,37 @@
 
 /*
+ *  LCDへのRGBデータ送信関数
+ */
+ER
+lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height)
+{
+	ER  ercd = E_OK;
+	int index, i;
+
+	if(width == 0 || height == 0)
+		return ercd;
+	if(hlcd->spi_lock != 0){
+		if((ercd = wai_sem(hlcd->spi_lock)) != E_OK)
+			return ercd;
+	}
+	rs_set(PORT_HIGH);
+	cs_set(PORT_LOW);
+	//dly_tsk(100/*us*/);
+	for(index=0; index < height; index++){
+		uint8_t *p = pbmp;
+		for (i = 0; i < width; i++){
+			spi_master_write(&hlcd->hspi, *p++);
+			spi_master_write(&hlcd->hspi, *p++);
+		}
+		pbmp -= width*2;
+	}
+	//dly_tsk(100/*us*/);
+	cs_set(PORT_HIGH);
+	if(hlcd->spi_lock != 0)
+		sig_sem(hlcd->spi_lock);
+	return ercd;
+}
+
+/*
  *  ST7735へのコマンドリスト送信
  */
@@ -590,4 +623,12 @@
 	lcd_setAddrWindow(hlcd, x0, y0, x0+width-1, y0+height-1);
 	lcd_writedata3(hlcd, pbmp, width, height);
+}
+
+void
+lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp)
+{
+	lcd_setAddrWindow(hlcd, x0, y0, x0+w-1, y0+h-1);
+	pbmp += w * (h - 1) * 3;  
+	lcd_writedata3(hlcd, pbmp, w, h);
 }
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h	(revision 364)
@@ -59,4 +59,5 @@
 #endif
 
+#include <stdbool.h>
 #include "device.h"
 #include "pinmap.h"
@@ -145,4 +146,6 @@
 #ifndef TOPPERS_MACRO_ONLY
 
+typedef struct GFXfont GFXfont;
+
 /*
  *  LCDハンドラ構造体定義
@@ -153,4 +156,9 @@
 	uint16_t                _width;		/* 幅ピクセル数 */
 	uint16_t				_height;	/* 高さピクセル数 */
+	int16_t cursor_x, cursor_y;
+	uint16_t textcolor, textbgcolor;
+	uint8_t textsize, rotation;
+	bool wrap;
+	GFXfont *gfxFont;
 	uint8_t                 colstart;
 	uint8_t                 rowstart;
@@ -188,4 +196,5 @@
 extern ER lcd_writedata2(LCD_Handler_t *hlcd, uint16_t c, int cnt);
 extern ER lcd_writedata3(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
+extern ER lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
 
 extern void lcd_initB(LCD_Handler_t *hlcd);
@@ -198,4 +207,5 @@
 extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, uint16_t color);
 extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
+extern void lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp);
 extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/spi_api.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/spi_api.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/spi_api.h	(revision 364)
@@ -116,4 +116,22 @@
  */
 int  spi_master_write(spi_t *obj, int value);
+
+/** Write a block out in master mode and receive a value
+ *
+ *  The total number of bytes sent and received will be the maximum of
+ *  tx_length and rx_length. The bytes written will be padded with the
+ *  value 0xff.
+ *
+ * @param[in] obj        The SPI peripheral to use for sending
+ * @param[in] tx_buffer  Pointer to the byte-array of data to write to the device
+ * @param[in] tx_length  Number of bytes to write, may be zero
+ * @param[in] rx_buffer  Pointer to the byte-array of data to read from the device
+ * @param[in] rx_length  Number of bytes to read, may be zero
+ * @param[in] write_fill Default data transmitted while performing a read
+ * @returns
+ *      The number of bytes written and read from the device. This is
+ *      maximum of tx_length and rx_length.
+ */
+int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill);
 
 /** Check if a value is available to read
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.c	(revision 364)
@@ -44,5 +44,5 @@
 time_t __time32(time_t *timer)
 #else
-time_t time(time_t *timer)
+time_t get_time(time_t *timer)
 #endif
 
@@ -78,5 +78,5 @@
 }
 
-clock_t clock() {
+clock_t get_clock() {
     //_mutex->lock();
     clock_t t = us_ticker_read();
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c	(revision 364)
@@ -259,4 +259,19 @@
     while(!spi_tend(obj));
     return spi_read(obj);
+}
+
+int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length,
+                           char *rx_buffer, int rx_length, char write_fill) {
+    int total = (tx_length > rx_length) ? tx_length : rx_length;
+
+    for (int i = 0; i < total; i++) {
+        char out = (i < tx_length) ? tx_buffer[i] : write_fill;
+        char in = spi_master_write(obj, out);
+        if (i < rx_length) {
+            rx_buffer[i] = in;
+        }
+    }
+
+    return total;
 }
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/sample/Makefile
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/sample/Makefile	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/sample/Makefile	(revision 364)
@@ -417,5 +417,5 @@
 #
 $(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
-	$(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
+	$(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
 			$(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
 			$(ALL_LIBS) $(END_OBJS)
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/serial.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/serial.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/serial.h	(revision 364)
@@ -79,8 +79,13 @@
 extern ER		serial_opn_por(ID portid) throw();
 extern ER		serial_cls_por(ID portid) throw();
-extern ER_UINT	serial_rea_dat(ID portid, char *buf, uint_t len) throw();
+extern ER_UINT	serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout) throw();
 extern ER_UINT	serial_wri_dat(ID portid, const char *buf, uint_t len) throw();
 extern ER		serial_ctl_por(ID portid, uint_t ioctl) throw();
 extern ER		serial_ref_por(ID portid, T_SERIAL_RPOR *pk_rpor) throw();
+
+Inline ER_UINT	serial_rea_dat(ID portid, char *buf, uint_t len)
+{
+	return serial_trea_dat(portid, buf, len, TMO_FEVR);
+}
 
 /*
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialAdapter.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialAdapter.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialAdapter.c	(revision 364)
@@ -83,5 +83,5 @@
  */
 ER_UINT
-serial_rea_dat(ID portid, char *buf, uint_t len)
+serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout)
 {
 	if (sns_dpn()) {				/* コンテキストのチェック */
@@ -92,5 +92,5 @@
 	}
 
-	return(cSerialPort_read(portid - 1, buf, len));
+	return(cSerialPort_read(portid - 1, buf, len, tmout));
 }
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPort.cdl
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPort.cdl	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPort.cdl	(revision 364)
@@ -57,5 +57,5 @@
 	ER		open(void);
 	ER		close(void);
-	ER_UINT	read([out,size_is(length)] char *buffer, [in] uint_t length);
+	ER_UINT	read([out,size_is(length)] char *buffer, [in] uint_t length, [in] TMO tmout);
 	ER_UINT	write([in,size_is(length)] const char *buffer, [in] uint_t length);
 	ER		control([in] uint_t ioControl);
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPortMain.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPortMain.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPortMain.c	(revision 364)
@@ -397,5 +397,5 @@
  */
 ER_UINT
-eSerialPort_read(CELLIDX idx, char *buffer, uint_t length)
+eSerialPort_read(CELLIDX idx, char *buffer, uint_t length, TMO tmout)
 {
 	CELLCB	*p_cellcb;
@@ -423,6 +423,12 @@
 	while (reacnt < length) {
 		if (buffer_empty) {
-			SVC(rercd = cReceiveSemaphore_wait(),
-										gen_ercd_wait(rercd, p_cellcb));
+			rercd = cReceiveSemaphore_waitTimeout(tmout);
+			if (rercd == E_TMOUT)
+				return E_TMOUT;
+			if (rercd < 0) {
+				gen_ercd_wait(rercd, p_cellcb);
+				ercd = rercd;
+				goto error_exit;
+			}
 		}
 		SVC(rercd = serialPort_readChar(p_cellcb, &c), rercd);
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/Makefile.tinet
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/Makefile.tinet	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/Makefile.tinet	(revision 364)
@@ -93,4 +93,5 @@
                in_subr.o route_cfg.o
 TINET_CFG_COBJS := $(TINET_CFG_COBJS) tinet_cfg.o
+TINET_CFG2_OUT_SRCS := $(TINET_CFG2_OUT_SRCS) tinet_cfg.h tinet_cfg.c
 
 #  IPv6
@@ -328,4 +329,5 @@
 
 	CFG_COBJS := $(CFG_COBJS) $(TINET_CFG_COBJS)
+	CFG2_OUT_SRCS := $(CFG2_OUT_SRCS) $(TINET_CFG2_OUT_SRCS)
 
 	CLEAN_FILES := $(CLEAN_FILES) $(TINET_CFG_OUT) $(MAKE_TINET_LIB)
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/ethernet.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/ethernet.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/ethernet.h	(revision 364)
@@ -98,10 +98,12 @@
 #endif	/* of #ifndef IF_ETHER_NIC_HDR_ALIGN */
 
-#if defined(__RX) || defined(_MSC_VER)
 #if defined(__RX)
 #pragma pack
-#else
+#elif defined(_MSC_VER)
 #pragma pack(push, 1)
 #endif
+
+#if defined(__RX) || defined(_MSC_VER)
+
 typedef struct t_ether_header {
 
@@ -116,9 +118,4 @@
 	uint16_t	type;
 	} T_ETHER_HDR;
-#if defined(__RX)
-#pragma packoption
-#else
-#pragma pack(pop)
-#endif
 
 #elif defined(TOPPERS_S810_CLG3_85)	/* of #if defined(__RX) */
@@ -166,4 +163,10 @@
 	uint8_t		lladdr[ETHER_ADDR_LEN];
 	} __attribute__((packed, aligned(2))) T_ETHER_ADDR;
+
+#if defined(__RX)
+#pragma packoption
+#elif defined(_MSC_VER)
+#pragma pack(pop)
+#endif
 
 /*
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_asp.cfg
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_asp.cfg	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_asp.cfg	(revision 364)
@@ -41,4 +41,6 @@
 
 INCLUDE("net/net.cfg");
+
+#ifndef NOUSE_MPF_NET_BUF
 
 /*
@@ -169,2 +171,4 @@
 		});
 #endif	/* of #if defined(NUM_MPF_NET_BUF6_65536) && NUM_MPF_NET_BUF6_65536 > 0 */
+
+#endif
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_buf.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_buf.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_buf.c	(revision 364)
@@ -68,4 +68,6 @@
 #include <netinet/tcp_var.h>
 
+#ifndef NOUSE_MPF_NET_BUF
+
 /*
  *  関数
@@ -226,5 +228,21 @@
 #endif	/* of #if defined(NUM_MPF_NET_BUF_128) && NUM_MPF_NET_BUF_128 > 0 */
 
-#if defined(_IP4_CFG)
+#if defined(_IP6_CFG)
+
+#if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
+	{
+		MPF_NET_BUF_CSEG,
+		IF_HDR_SIZE + IP_HDR_SIZE + TCP_HDR_SIZE,
+
+#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
+
+		NUM_MPF_NET_BUF_CSEG,
+
+#endif	/* of #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF */
+
+		},
+#endif	/* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
+
+#endif	/* of #if defined(_IP6_CFG) */
 
 #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0
@@ -242,5 +260,5 @@
 #endif	/* of #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0 */
 
-#endif	/* of #if defined(_IP4_CFG) */
+#if defined(_IP4_CFG) && !defined(_IP6_CFG)
 
 #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
@@ -257,4 +275,6 @@
 		},
 #endif	/* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
+
+#endif	/* of #if defined(_IP4_CFG) && !defined(_IP6_CFG) */
 
 	};
@@ -307,5 +327,5 @@
 
 	while (1) {
-		if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
+		if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
 			(*buf)->idix  = (uint8_t)ix;
 			(*buf)->len   = (uint16_t)minlen;
@@ -320,7 +340,7 @@
 			return error;
 			}
-		else if (ix == 0 || net_buf_table[ix].size > maxlen)
+		ix --;
+		if (ix < 0 || net_buf_table[ix].size > maxlen)
 			break;
-		ix --;
 		}
 
@@ -351,5 +371,5 @@
 
 	while (1) {
-		if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf,
+		if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf,
 		                      ix == sizeof(net_buf_table) / sizeof(T_NET_BUF_ENTRY) - 1 ? tmout : TMO_POL)) == E_OK) {
 			(*buf)->idix  = (uint8_t)ix;
@@ -359,4 +379,5 @@
 			(*buf)->conn_pos = 0;
 #endif
+
 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
 			NET_COUNT_NET_BUF(net_buf_table[ix].allocs, 1);
@@ -454,9 +475,10 @@
 		/* 固定メモリプールに返す。*/
 
-#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
-		net_buf_table[buf->idix].busies --;
-#endif
-		if ((error = rel_mpf((ID)net_buf_table[buf->idix].index, buf)) != E_OK) {
-			syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), buf->idix);
+		int idix = buf->idix;
+#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
+		net_buf_table[idix].busies --;
+#endif
+		if ((error = rel_mpf((ID)net_buf_table[idix].index, buf)) != E_OK) {
+			syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), idix);
 			}
 		}
@@ -509,2 +531,63 @@
 	return (uint_t)net_buf_table[0].size;
 	}
+
+#else
+#include <stdlib.h>
+
+/*
+ *  tget_net_buf_ex -- ネットワークバッファを獲得する（拡張機能）。
+ */
+
+ER
+tget_net_buf_ex (T_NET_BUF **buf, uint_t minlen, uint_t maxlen, ATR nbatr, TMO tmout)
+{
+	uint_t len = (minlen > maxlen) ? minlen : maxlen;
+	*buf = (T_NET_BUF *)malloc(sizeof(T_NET_BUF) - sizeof(((T_NET_BUF *)0)->buf) + len);
+	if (*buf == NULL)
+		return E_NOMEM;
+
+	(*buf)->idix = 0;
+	(*buf)->len = (uint16_t)len;
+	(*buf)->flags = 0;
+#ifdef IF_ETHER_MULTI_NIC
+	(*buf)->conn_pos = 0;
+#endif
+
+	return E_OK;
+	}
+
+/*
+ *  tget_net_buf -- ネットワークバッファを獲得する（互換）。
+ */
+
+ER
+tget_net_buf (T_NET_BUF **buf, uint_t len, TMO tmout)
+{
+	return tget_net_buf_ex(buf, len, len, NBA_SEARCH_ASCENT, tmout);
+	}
+
+
+/*
+ * rel_net_buf -- ネットワークバッファを返却する。
+ */
+
+ER
+rel_net_buf (T_NET_BUF *buf)
+{
+	free(buf);
+
+	return E_OK;
+	}
+
+
+/*
+ * net_buf_max_siz -- ネットワークバッファの最大サイズを返す。
+ */
+
+uint_t
+net_buf_max_siz (void)
+{
+	return (uint_t)IF_PDU_SIZE;
+	}
+
+#endif
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dbg_cons.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dbg_cons.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dbg_cons.c	(revision 364)
@@ -666,5 +666,5 @@
 	            "IX Expire State      MAC Address       IP Address\n");
 
-	/* expire の単位は [ms]。*/
+	/* expire の単位は [us]。*/
 	get_tim(&now);
 	cache = nd6_get_cache();
@@ -705,5 +705,5 @@
 	            "IX Expire MAC Address       IP Address\n");
 
-	/* expire の単位は [ms]。*/
+	/* expire の単位は [us]。*/
 	cache = arp_get_cache();
 	for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
@@ -753,5 +753,5 @@
 	WAI_NET_CONS_PRINTF();
 	get_tim(&now);
-	cons_printf(portid, "ネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
+	cons_printf(portid, "ネットワーク統計情報\t経過時間[us]\t%lu\t", now);
 	if (now > (1000 * 3600 * 24))
 		cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
@@ -938,5 +938,5 @@
 		}
 
-	cons_printf(portid, "\nネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
+	cons_printf(portid, "\nネットワーク統計情報\t経過時間[us]\t%lu\t", now);
 	if (now > (1000 * 3600 * 24))
 		cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
@@ -1065,5 +1065,5 @@
 	WAI_NET_CONS_PRINTF();
 	get_tim(&now);
-	cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t%u\n", now);
+	cons_printf(portid, "ネットワークバッファ情報\t経過時間[us]\t%u\n", now);
 
 #if NET_COUNT_ENABLE
@@ -1577,5 +1577,5 @@
 	cons_printf(portid, " IP Address\n");
 
-	/* expire の単位は [ms]。*/
+	/* expire の単位は [us]。*/
 	get_tim(&now);
 	dr = nd6_get_drl(&count);
@@ -2298,6 +2298,6 @@
 
 	cons_printf(portid, "ND:\n");
-	cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[ms]\n", TMO_ND6_RTR_SOL_DELAY);
-	cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[ms]\n", TMO_ND6_RTR_SOL_INTERVAL);
+	cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[us]\n", TMO_ND6_RTR_SOL_DELAY);
+	cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[us]\n", TMO_ND6_RTR_SOL_INTERVAL);
 	cons_printf(portid, "  NUM_IP6_DAD_COUNT:        %5d\n",     NUM_IP6_DAD_COUNT);
 	cons_printf(portid, "  NUM_ND6_CACHE_ENTRY:      %5d\n",     NUM_ND6_CACHE_ENTRY);
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.c	(revision 364)
@@ -2031,6 +2031,8 @@
 
 			/* 休止する。*/
-			if (error == E_OK)
-				syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
+			if (error == E_OK) {
+				if (ct->fsm != DHCP4_FSM_SLEEP)
+					syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
+			}
 			else {
 				syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(error));
@@ -2158,6 +2160,8 @@
 
 			/* 休止する。*/
-			if (ct->error == E_OK)
-				syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
+			if (ct->error == E_OK) {
+				if (ct->fsm != DHCP4_FSM_SLEEP)
+					syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
+			}
 			else {
 				syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(ct->error));
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/wwws.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/wwws.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/wwws.c	(revision 364)
@@ -708,5 +708,5 @@
 	len += put_str(cepid, srbuf, response);
 	get_tim(&finish);
-	syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [ms]",
+	syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [us]",
 	                   cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
 	return E_OK;
@@ -1609,5 +1609,5 @@
 
 	get_tim(&finish);
-	syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [ms]",
+	syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [us]",
 	                   cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
 	return E_OK;
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/icmp6.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/icmp6.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/icmp6.h	(revision 364)
@@ -291,6 +291,6 @@
 typedef struct t_router_advert_hdr {
 	T_ICMP6_HDR	hdr;
-	uint32_t	reachable;		/* [ms] 到達可能時間	*/
-	uint32_t	retransmit;		/* [ms] 近隣要請送信間隔	*/
+	uint32_t	reachable;		/* [us] 到達可能時間	*/
+	uint32_t	retransmit;		/* [us] 近隣要請送信間隔	*/
 	/* この後にオプションが続く */
 	} __attribute__((packed, aligned(2))) T_ROUTER_ADVERT_HDR;
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in4_subr.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in4_subr.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in4_subr.c	(revision 364)
@@ -287,6 +287,9 @@
 
 	/* IP ヘッダを設定する。*/
-	if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK)
+	if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK) {
+		syscall(rel_net_buf(*nbuf));
+		*nbuf = NULL;
 		return error;
+		}
 
 	/* 4 オクテット境界までパディングで埋める。*/
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in_itron.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in_itron.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in_itron.h	(revision 364)
@@ -62,5 +62,5 @@
 #define TFN_TCP_ALL		(0)
 
-#define TEV_TCP_RCV_OOB		(-0x201)
+#define TEV_TCP_RCV_OOB		(0x201)
 
 /* UDP 関係 */
@@ -75,5 +75,5 @@
 #define TFN_UDP_ALL		(0)
 
-#define TEV_UDP_RCV_DAT		(-0x221)
+#define TEV_UDP_RCV_DAT		(0x221)
 
 /* 一般 */
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_input.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_input.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_input.c	(revision 364)
@@ -1364,4 +1364,8 @@
 	NTOHS(tcph->dport);
 
+	/* SDU 長 より 緊急ポインタが大きい場合 */
+	if (tcph->urp > tcph->sum)
+		goto drop;
+
 find_cep:
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_output.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_output.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_output.c	(revision 364)
@@ -369,6 +369,8 @@
 		tcph->flags |= TCP_FLG_URG;
 		}
-	else
+	else {
+		tcph->urp = 0;
 		cep->snd_up  = cep->snd_una;
+		}
 
 #endif	/* of #ifdef TCP_CFG_EXTENTIONS */
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_usrreq.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_usrreq.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_usrreq.c	(revision 364)
@@ -897,5 +897,5 @@
 
 	/* tcp_rcv_buf の割当て長をリセットする。*/
-	cep->rcv_buf_len = 0;
+	cep->rcv_buf_len -= len;
 
 	/* 通信端点のロックを解除する。*/
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udp_var.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udp_var.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udp_var.h	(revision 364)
@@ -101,4 +101,14 @@
 typedef ER	(*t_udp_callback)(ID cepid, FN fncd, void *p_parblk);
 
+typedef struct t_udp_rcv_dat_para {
+	uint_t		len;
+	T_NET_BUF	*input;
+	uint_t		off;
+	union {
+		T_IPV4EP rep4;
+		T_IPV6EP rep6;
+	};
+	} T_UDP_RCV_DAT_PARA;
+
 /*
  *  UDP 通信端点
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_input.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_input.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_input.c	(revision 364)
@@ -75,8 +75,8 @@
 {
 	T_UDP_HDR	*udph;
-	uint_t		len;
+	T_UDP_RCV_DAT_PARA para;
 
 	udph = (T_UDP_HDR *)(input->buf + off);
-	len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
+	para.len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
 
 	if (cep->rcv_tskid != TA_NULL) {	/* 非ノンブロッキングコールでペンディング中 */
@@ -98,5 +98,5 @@
 		/* データをバッファに移す。*/
 		memcpy(cep->rcv_data, GET_UDP_SDU(input, off),
-		       (size_t)(len < cep->rcv_len ? len : cep->rcv_len));
+		       (size_t)(para.len < cep->rcv_len ? para.len : cep->rcv_len));
 		syscall(rel_net_buf(input));
 
@@ -104,7 +104,7 @@
 
 #ifdef TCP_CFG_NON_BLOCKING_COMPAT14
-			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)len);
+			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)para.len);
 #else
-			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&len);
+			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&para.len);
 #endif
 		else
@@ -121,7 +121,16 @@
 
 #ifdef TCP_CFG_NON_BLOCKING_COMPAT14
-		(*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)len);
+		(*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)para.len);
 #else
-		(*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&len);
+		para.input = input;
+		para.off = off;
+#if API_PROTO == API_PROTO_IPV4
+		para.rep4.portno = ntohs(udph->sport);
+		IN_COPY_TO_HOST(&para.rep4.ipaddr, input);
+#else
+		para.rep6.portno = ntohs(udph->sport);
+		IN_COPY_TO_HOST(&para.rep6.ipaddr, input);
+#endif
+		(*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&para.len);
 #endif
 		/*
@@ -129,6 +138,9 @@
 		 *  データを読み出さなかったことになるので、捨てる。
 		 */
-		if (cep->cb_netbuf != NULL)
-			syscall(rel_net_buf(cep->cb_netbuf));
+		if (cep->cb_netbuf != NULL) {
+			if ((input->flags & NB_FLG_NOREL_IFOUT) == 0)
+				syscall(rel_net_buf(cep->cb_netbuf));
+			cep->cb_netbuf = NULL;
+			}
 		}
 	else {
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c	(revision 364)
@@ -411,6 +411,5 @@
 		return E_NOEXS;
 #if defined(SUPPORT_INET6)
-#endif
-#if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
+#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
 	switch (optname) {
 	case IP_MULTICAST_LOOP:
@@ -488,6 +487,5 @@
 		return E_NOEXS;
 #if defined(SUPPORT_INET6)
-#endif
-#if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
+#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
 	switch (optname) {
 	case IP_MULTICAST_LOOP:
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq_nblk.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq_nblk.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq_nblk.c	(revision 364)
@@ -122,7 +122,7 @@
 
 #ifdef TCP_CFG_NON_BLOCKING_COMPAT14
-			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)error);
+			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)error);
 #else
-			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&error);
+			(*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)&error);
 #endif
 		else
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_subr.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_subr.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_subr.c	(revision 364)
@@ -369,6 +369,9 @@
 
 	/* IPv6 ヘッダを設定する。*/
-	if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK)
+	if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK) {
+		syscall(rel_net_buf(*nbuf));
+		*nbuf = NULL;
 		return error;
+		}
 
 	/* 4 オクテット境界までパディングで埋める。*/
@@ -662,5 +665,5 @@
  *  in6_rtredirect -- ルーティング表にエントリを登録する。
  *
- *    注意: 引数 tmo の単位は [ms]。
+ *    注意: 引数 tmo の単位は [us]。
  */
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_var.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_var.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_var.h	(revision 364)
@@ -184,6 +184,6 @@
 	 * vltime と pltime は、追加/変更してからの相対時間
 	 */
-	uint32_t	vltime;		/* 有効時間 [ms]			*/
-	uint32_t	pltime;		/* 推奨有効時間 [ms]		*/
+	uint32_t	vltime;		/* 有効時間 [us]			*/
+	uint32_t	pltime;		/* 推奨有効時間 [us]		*/
 	} __attribute__((packed, aligned(2)))T_IN6_ADDR_LIFETIME;
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.c	(revision 364)
@@ -353,4 +353,5 @@
 			if (nd6_cache[mix].hold != NULL) {
 				syscall(rel_net_buf(nd6_cache[mix].hold));
+				nd6_cache[mix].hold = NULL;
 				}
 			fix = mix;
@@ -562,4 +563,5 @@
 			if (ln->hold != NULL) {
 				syscall(rel_net_buf(ln->hold));
+				ln->hold = NULL;
 				}
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.h	(revision 364)
@@ -81,5 +81,5 @@
 	T_NET_BUF	*hold;
 	TMO		tmout;
-	SYSTIM		expire;		/* [ms] 有効時間が切れる時刻	*/
+	SYSTIM		expire;		/* [us] 有効時間が切れる時刻	*/
 	T_IF_ADDR	ifaddr;
 	uint8_t		state;
@@ -183,6 +183,6 @@
 typedef struct t_def_router {
 	T_IN6_ADDR	addr;
-	SYSTIM		expire;		/* [ms] 有効時間が切れる時刻	*/
-	uint32_t	lifetime;	/* [ms] 有効時間			*/
+	SYSTIM		expire;		/* [us] 有効時間が切れる時刻	*/
+	uint32_t	lifetime;	/* [us] 有効時間			*/
 	uint16_t	plistmap;	/* プレフィックスマップ		*/
 	uint8_t		flags;		/* ルータ通知のフラグ		*/
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tcpip_sym.def
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tcpip_sym.def	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tcpip_sym.def	(revision 364)
@@ -15,4 +15,5 @@
 TMO_UDP_OUTPUT
 TMO_ICMP_OUTPUT
+TMO_IGMP_OUTPUT
 TMO_ND6_NS_OUTPUT
 TMO_ND6_NA_OUTPUT
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tinet_asp.cfg
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tinet_asp.cfg	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tinet_asp.cfg	(revision 364)
@@ -73,4 +73,5 @@
 INCLUDE("netinet/if_ether.cfg");
 INCLUDE("netinet/ip.cfg");
+INCLUDE("netinet/ip_igmp.cfg");
 INCLUDE("netinet/tcp.cfg");
 INCLUDE("netinet/udp.cfg");
