Ignore:
Timestamp:
Feb 1, 2019, 9:57:09 PM (5 years ago)
Author:
coas-nagasima
Message:

TINETとSocket APIなどを更新

Location:
asp3_tinet_ecnl_arm/trunk/app5_temp_sensor
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/.cproject

    r352 r364  
    2222                        <storageModule moduleId="com.renesas.cdt.managedbuild.core.toolchainInfo">
    2323                                <option id="toolchain.id" value="gcc-arm-embedded"/>
    24                                 <option id="toolchain.version" value="5.4.1.20160919"/>
     24                                <option id="toolchain.version" value="6.3.1.20170620"/>
    2525                        </storageModule>
    2626                        <storageModule moduleId="cdtBuildSystem" version="4.0.0">
     
    5959                                                        <option id="com.renesas.cdt.managedbuild.gcc.rz.option.warnStack.1852970779" 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"/>
    6060                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.852559143" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
    61                                                         <builder buildPath="${workspace_loc:/app5_temp_sensor}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.394642308" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="false" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
     61                                                        <builder buildPath="${workspace_loc:/app5_temp_sensor}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.394642308" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
    6262                                                        <tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler.589273516" name="Cross ARM GNU Assembler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler">
    6363                                                                <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.462582981" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
     
    127127                        <storageModule moduleId="com.renesas.cdt.managedbuild.core.toolchainInfo">
    128128                                <option id="toolchain.id" value="gcc-arm-embedded"/>
    129                                 <option id="toolchain.version" value="5.4.1.20160919"/>
     129                                <option id="toolchain.version" value="6.3.1.20170620"/>
    130130                        </storageModule>
    131131                        <storageModule moduleId="cdtBuildSystem" version="4.0.0">
     
    164164                                                        <option id="com.renesas.cdt.managedbuild.gcc.rz.option.warnStack.512694190" 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"/>
    165165                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1203540506" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
    166                                                         <builder buildPath="${workspace_loc:/app5_temp_sensor}/DebugEther" id="com.renesas.cdt.managedbuild.gcc.rz.builder.730173267" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="false" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
     166                                                        <builder buildPath="${workspace_loc:/app5_temp_sensor}/DebugEther" id="com.renesas.cdt.managedbuild.gcc.rz.builder.730173267" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
    167167                                                        <tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler.1443620921" name="Cross ARM GNU Assembler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler">
    168168                                                                <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1975708208" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/Debug/Makefile

    r352 r364  
    179179        CDEFS := -DTOPPERS_OMIT_TECS $(CDEFS)
    180180endif
    181 CDEFS := $(CDEFS) -DDHCP4_CLI_CFG -DUSE_PING -DUSE_RESOLVER -DUSE_NETAPP_SUBR -DECHONET_USE_MALLOC -DRamDisk=_binary_______ntshell_src_rom_fs_bin_start
     181CDEFS := $(CDEFS) -DDHCP4_CLI_CFG -DUSE_PING -DUSE_RESOLVER -DUSE_NETAPP_SUBR -DNOUSE_MPF_NET_BUF -DECHONET_USE_MALLOC -DRamDisk=_binary_______ntshell_src_rom_fs_bin_start
    182182INCLUDES := -I. -I$(SRCDIR)/include -I$(SRCDIR) \
    183183        -I$(SRCDIR)/../btstack/include \
     
    187187        -I$(SRCDIR)/../usbhost/src \
    188188        $(INCLUDES)
    189 LDFLAGS := $(LDFLAGS) -Wl,-Map=$(OBJNAME).map,--cref -L.
     189LDFLAGS := $(LDFLAGS) -L.
    190190LIBS := $(LIBS) $(CXXLIBS)
    191191CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
     
    198198APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o
    199199APPLDIRS := $(APPLDIRS) ../../ntshell/lcd
    200 APPL_COBJS := $(APPL_COBJS) draw_font.o misaki_font.o
     200APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o
     201APPL_CFLAGS := $(APPL_CFLAGS) -DSHNM12_FONT
    201202
    202203#
     
    223224endif
    224225
    225 
    226 #
    227 #  ネットワークサービスの定義
    228 #
    229 NO_USE_TINET_LIBRARY = true
    230 
    231 #  ネットワークインタフェースの選択、何れか一つ選択する。
    232 NET_IF = ether
    233 
    234 #  イーサネット・ディバイスドライバの選択
    235 NET_DEV = if_btusb
    236 
    237 #  ネットワーク層の選択
    238 #SUPPORT_INET6 = true
    239 SUPPORT_INET4 = true
    240 
    241 #  API に組込む機能の選択
    242 #API_CFG_IP4MAPPED_ADDR = true
    243 
    244 #  トランスポート層の選択
    245 SUPPORT_TCP = true
    246 SUPPORT_UDP = true
    247 
    248 # IGMPを有効に設定
    249 SUPPORT_IGMP = true
    250 
    251 #
    252 #  ネットワークサービスの Makefile のインクルード
    253 #
    254 include $(SRCDIR)/$(TINETDIR)/Makefile.tinet
     226ifdef TINETDIR
     227        #
     228        #  ネットワークサービスの定義
     229        #
     230        NO_USE_TINET_LIBRARY = true
     231
     232        #  ネットワークインタフェースの選択、何れか一つ選択する。
     233        NET_IF = ether
     234
     235        #  イーサネット・ディバイスドライバの選択
     236        NET_DEV = if_btusb
     237
     238        #  ネットワーク層の選択
     239        #SUPPORT_INET6 = true
     240        SUPPORT_INET4 = true
     241
     242        #  API に組込む機能の選択
     243        #API_CFG_IP4MAPPED_ADDR = true
     244
     245        #  トランスポート層の選択
     246        SUPPORT_TCP = true
     247        SUPPORT_UDP = true
     248
     249        # IGMPを有効に設定
     250        SUPPORT_IGMP = true
     251
     252        #
     253        #  ネットワークサービスの Makefile のインクルード
     254        #
     255        include $(SRCDIR)/$(TINETDIR)/Makefile.tinet
     256endif
    255257
    256258#
     
    285287#  コンフィギュレータに関する定義
    286288#
    287 CFG_TRB := -T $(TINET_ROOT)/tinet.trb:tcpip -T ../../ntshell/echonet/echonet.trb:echonet -T $(TARGETDIR)/target_kernel.trb:kernel
    288 CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
     289ifndef TINETDIR
     290  CFG_TRB := -T $(TARGETDIR)/target_kernel.trb
     291  CFG_TABS := --api-table $(SRCDIR)/kernel/kernel_api.def \
     292                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     293else
     294  CFG_TRB := -T $(TINET_ROOT)/tinet.trb:tcpip -T ../../ntshell/echonet/echonet.trb:echonet -T $(TARGETDIR)/target_kernel.trb:kernel
     295  CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
    289296                        --api-table ../../ntshell/echonet/echonet_api.def:echonet \
    290297                        --api-table $(SRCDIR)/kernel/kernel_api.def:kernel \
     
    292299                        --symval-table ../../ntshell/echonet/echonet_sym.def \
    293300                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     301endif
    294302CFG_ASMOBJS := $(CFG_ASMOBJS)
    295303CFG_COBJS := kernel_cfg.o echonet_cfg.o $(CFG_COBJS)
     
    437445
    438446#
     447#  並列makeのための依存関係の定義
     448#
     449$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
     450$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     451                                                                                                                | offset.timestamp
     452
     453#
    439454#  特別な依存関係の定義
    440455#
     
    445460#
    446461$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    447         $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     462        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
    448463                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    449464                        -Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/DebugEther/Makefile

    r352 r364  
    177177        CDEFS := -DTOPPERS_OMIT_TECS $(CDEFS)
    178178endif
    179 CDEFS := $(CDEFS) -DDHCP4_CLI_CFG -DUSE_PING -DUSE_RESOLVER -DUSE_NETAPP_SUBR -DECHONET_USE_MALLOC -DRamDisk=_binary_______ntshell_src_rom_fs_bin_start
     179CDEFS := $(CDEFS) -DDHCP4_CLI_CFG -DUSE_PING -DUSE_RESOLVER -DUSE_NETAPP_SUBR -DNOUSE_MPF_NET_BUF -DECHONET_USE_MALLOC -DRamDisk=_binary_______ntshell_src_rom_fs_bin_start
    180180INCLUDES := -I. -I$(SRCDIR)/include -I$(SRCDIR) \
    181181        -I$(SRCDIR)/../btstack/include \
     
    185185        -I$(SRCDIR)/../usbhost/src \
    186186        $(INCLUDES)
    187 LDFLAGS := $(LDFLAGS) -Wl,-Map=$(OBJNAME).map,--cref -L.
     187LDFLAGS := $(LDFLAGS) -L.
    188188LIBS := $(LIBS) $(CXXLIBS)
    189189CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
     
    196196APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o
    197197APPLDIRS := $(APPLDIRS) ../../ntshell/lcd
    198 APPL_COBJS := $(APPL_COBJS) draw_font.o misaki_font.o
     198APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o
     199APPL_CFLAGS := $(APPL_CFLAGS) -DSHNM12_FONT
    199200
    200201#
     
    221222endif
    222223
    223 
    224 #
    225 #  ネットワークサービスの定義
    226 #
    227 NO_USE_TINET_LIBRARY = true
    228 
    229 #  ネットワークインタフェースの選択、何れか一つ選択する。
    230 NET_IF = ether
    231 
    232 #  イーサネット・ディバイスドライバの選択
     224ifdef TINETDIR
     225        #
     226        #  ネットワークサービスの定義
     227        #
     228        NO_USE_TINET_LIBRARY = true
     229
     230        #  ネットワークインタフェースの選択、何れか一つ選択する。
     231        NET_IF = ether
     232
     233        #  イーサネット・ディバイスドライバの選択
    233234        NET_DEV = if_mbed
    234235
    235 #  ネットワーク層の選択
    236 #SUPPORT_INET6 = true
    237 SUPPORT_INET4 = true
    238 
    239 #  API に組込む機能の選択
    240 #API_CFG_IP4MAPPED_ADDR = true
    241 
    242 #  トランスポート層の選択
    243 SUPPORT_TCP = true
    244 SUPPORT_UDP = true
    245 
    246 # IGMPを有効に設定
    247 SUPPORT_IGMP = true
    248 
    249 #
    250 #  ネットワークサービスの Makefile のインクルード
    251 #
    252 include $(SRCDIR)/$(TINETDIR)/Makefile.tinet
     236        #  ネットワーク層の選択
     237        #SUPPORT_INET6 = true
     238        SUPPORT_INET4 = true
     239
     240        #  API に組込む機能の選択
     241        #API_CFG_IP4MAPPED_ADDR = true
     242
     243        #  トランスポート層の選択
     244        SUPPORT_TCP = true
     245        SUPPORT_UDP = true
     246
     247        # IGMPを有効に設定
     248        SUPPORT_IGMP = true
     249
     250        #
     251        #  ネットワークサービスの Makefile のインクルード
     252        #
     253        include $(SRCDIR)/$(TINETDIR)/Makefile.tinet
     254endif
    253255
    254256#
     
    283285#  コンフィギュレータに関する定義
    284286#
    285 CFG_TRB := -T $(TINET_ROOT)/tinet.trb:tcpip -T ../../ntshell/echonet/echonet.trb:echonet -T $(TARGETDIR)/target_kernel.trb:kernel
    286 CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
     287ifndef TINETDIR
     288  CFG_TRB := -T $(TARGETDIR)/target_kernel.trb
     289  CFG_TABS := --api-table $(SRCDIR)/kernel/kernel_api.def \
     290                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     291else
     292  CFG_TRB := -T $(TINET_ROOT)/tinet.trb:tcpip -T ../../ntshell/echonet/echonet.trb:echonet -T $(TARGETDIR)/target_kernel.trb:kernel
     293  CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
    287294                        --api-table ../../ntshell/echonet/echonet_api.def:echonet \
    288295                        --api-table $(SRCDIR)/kernel/kernel_api.def:kernel \
     
    290297                        --symval-table ../../ntshell/echonet/echonet_sym.def \
    291298                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     299endif
    292300CFG_ASMOBJS := $(CFG_ASMOBJS)
    293301CFG_COBJS := kernel_cfg.o echonet_cfg.o $(CFG_COBJS)
     
    435443
    436444#
     445#  並列makeのための依存関係の定義
     446#
     447$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
     448$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     449                                                                                                                | offset.timestamp
     450
     451#
    437452#  特別な依存関係の定義
    438453#
     
    443458#
    444459$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    445         $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     460        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
    446461                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    447462                        -Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/src/echonet_main.c

    r352 r364  
    11/*
    22 *  TOPPERS ECHONET Lite Communication Middleware
    3  * 
     3 *
    44 *  Copyright (C) 2014-2018 Cores Co., Ltd. Japan
    5  * 
     5 *
    66 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    77 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2626 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    2727 *      免責すること.
    28  * 
     28 *
    2929 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3030 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3232 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3333 *  の責任を負わない.
    34  * 
     34 *
    3535 *  @(#) $Id$
    3636 */
    3737
    38 /* 
     38/*
    3939 *  サンプルプログラム(1)の本体
    4040 */
     
    5555#include "adafruit_st7735.h"
    5656#include "draw_font.h"
     57#include <tinet_defs.h>
     58#include <tinet_config.h>
     59#include <netinet/in.h>
     60#include <netinet/in_var.h>
     61#include <net/ethernet.h>
     62#include <net/if_var.h>
     63
     64extern uint8_t mac_addr[6];
    5765
    5866/* TODO: メーカーコードを設定 */
     
    111119
    112120        /* サイズが1以外は受け付けない */
    113         if(size != 1)
     121        if (size != 1)
    114122                return 0;
    115123
    116124        *anno = *((uint8_t *)item->exinf) != *((uint8_t *)src);
    117125
    118         switch(*(uint8_t *)src){
     126        switch (*(uint8_t *)src) {
    119127        /* ONの場合 */
    120128        case 0x30:
     
    126134                data[1] = *(uint8_t *)src;
    127135                ret = ecn_brk_wai(data, sizeof(data));
    128                 if(ret != E_OK){
     136                if (ret != E_OK) {
    129137                        syslog(LOG_ERROR, "ecn_brk_wai");
    130138                        return 1;
     
    145153{
    146154        /* サイズが1以外は受け付けない */
    147         if(size != 1)
     155        if (size != 1)
    148156                return 0;
    149157
    150158        *anno = *((uint8_t *)item->exinf) != *((uint8_t *)src);
    151159
    152         switch(*(uint8_t *)src){
     160        switch (*(uint8_t *)src) {
    153161        /* 異常発生ありの場合 */
    154162        case 0x41:
     
    176184
    177185        /* サイズが2以外は受け付けない */
    178         if(size != 2)
     186        if (size != 2)
    179187                return 0;
    180188
    181189        value = (((uint8_t *)src)[0] << 8) | (((uint8_t *)src)[1] & 0xFF);
    182190
    183         if((value >= -2732) && (value <= 32766)){
     191        if ((value >= -2732) && (value <= 32766)) {
    184192                eobj->propertyE0 = value;
    185193                /* メインタスクに通知 */
    186194                data[0] = 0xE0;
    187195                ret = ecn_brk_wai(data, sizeof(data));
    188                 if(ret != E_OK){
     196                if (ret != E_OK) {
    189197                        syslog(LOG_ERROR, "ecn_brk_wai");
    190198                        return 2;
     
    192200        }
    193201        /* 上記以外は受け付けない */
    194         else{
     202        else {
    195203                return 0;
    196204        }
     
    199207}
    200208
    201 /* 
     209/*
    202210 * 温度計測値取得関数
    203211 */
     
    208216
    209217        /* サイズが2以外は受け付けない */
    210         if(size != 2)
     218        if (size != 2)
    211219                return 0;
    212220
     
    240248
    241249        ret2 = get_tim(&now);
    242         if (ret2 != E_OK){
     250        if (ret2 != E_OK) {
    243251                syslog(LOG_ERROR, "get_tim");
    244252                return;
    245253        }
    246254
    247         for(;;){
     255        for (;;) {
    248256                prev = now;
    249257
     
    253261                /* 応答電文待ち */
    254262                ret = ecn_trcv_esv(&esv, timer);
    255                 if ((ret != E_OK) && (ret != E_BRK) && (ret != E_TMOUT)){
     263                if ((ret != E_OK) && (ret != E_BRK) && (ret != E_TMOUT)) {
    256264                        syslog(LOG_ERROR, "ecn_trcv_esv");
    257265                        break;
     
    259267
    260268                ret2 = get_tim(&now);
    261                 if (ret2 != E_OK){
     269                if (ret2 != E_OK) {
    262270                        syslog(LOG_ERROR, "get_tim");
    263271                        break;
     
    274282                        /* 領域解放 */
    275283                        ret = ecn_rel_esv(esv);
    276                         if (ret != E_OK){
     284                        if (ret != E_OK) {
    277285                                syslog(LOG_ERROR, "ecn_rel_esv");
    278286                                break;
     
    283291                        /* 応答電文待ちの割り込みデータ取得 */
    284292                        ret = ecn_get_brk_dat(esv, brkdat, sizeof(brkdat), &len);
    285                         if (ret != E_OK){
     293                        if (ret != E_OK) {
    286294                                syslog(LOG_ERROR, "ecn_get_brk_dat");
    287295                                break;
     
    293301                        /* 領域解放 */
    294302                        ret = ecn_rel_esv(esv);
    295                         if (ret != E_OK){
     303                        if (ret != E_OK) {
    296304                                syslog(LOG_ERROR, "ecn_rel_esv");
    297305                                break;
     
    304312}
    305313
    306 bool_t started = false;
    307 
    308314void echonet_change_netif_link(uint8_t link_up, uint8_t up)
    309315{
     
    313319                return;
    314320
    315         if (up && !started) {
    316                 started = true;
    317 
    318                 /* ECHONETミドルウェアを起動 */
    319                 ret = ecn_sta_svc();
    320                 if (ret != E_OK)
    321                         return;
    322 
    323                 /* ECHONETミドルウェアを起動するのを待つ */
    324                 dly_tsk(100);
     321        if (up) {
     322                /* インスタンスリスト通知の送信 */
     323                ret = ecn_ntf_inl();
     324                if (ret != E_OK) {
     325                        syslog(LOG_ERROR, "ecn_ntf_inl");
     326                }
    325327        }
    326328
     
    328330        uint8_t data[2];
    329331        data[0] = 0x01;
    330         data[1] = up ? 0x01 : 0x02;
     332        data[1] = (up ? 0x01 : 0x02) | (link_up ? 0x10 : 0x20);
    331333        ret = ecn_brk_wai(data, sizeof(data));
    332334        if (ret != E_OK) {
     
    336338}
    337339
    338 enum main_state_t{
     340enum main_state_t {
     341        main_state_start,
    339342        main_state_idle,
    340343};
    341344
    342345int main_timer = TMO_FEVR;
    343 enum main_state_t main_state = main_state_idle;
     346enum main_state_t main_state = main_state_start;
    344347
    345348int main_lcd_timer = TMO_FEVR;
     
    386389        analogin_init(&joystick, P1_12);
    387390
    388         /* 10ms後にボタン状態を確認 */
    389         main_timer = 10 * 1000;
     391        /* ECHONETミドルウェアを起動するのを待つ */
     392        main_state = main_state_start;
     393        main_timer = 1000 * 1000;
    390394
    391395        /* ボタン状態読み込み */
     
    397401        spi_init(&lcd.hspi, P10_14, P10_15, P10_12, NC);
    398402        spi_format(&lcd.hspi, 8, 0, 0);
    399         spi_frequency(&lcd.hspi, 1000000);
     403        spi_frequency(&lcd.hspi, 4000000);
    400404
    401405        gpio_init_out(&lcd.cs_pin, P10_13);
     
    416420        main_lcd_timer = 1000 * 1000;
    417421
     422        /* メインタスクを起動 */
    418423        ER ret = act_tsk(MAIN_TASK);
    419424        if (ret != E_OK) {
     
    429434        int result = main_timer;
    430435
    431         if((result == TMO_FEVR)
    432                 || ((main_lcd_timer != TMO_FEVR) && (main_lcd_timer < result))){
     436        if ((result == TMO_FEVR)
     437                || ((main_lcd_timer != TMO_FEVR) && (main_lcd_timer < result))) {
    433438                result = main_lcd_timer;
    434439        }
     
    442447static void main_progress(int interval)
    443448{
    444         if(main_timer != TMO_FEVR){
     449        if (main_timer != TMO_FEVR) {
    445450                main_timer -= interval;
    446                 if(main_timer < 0){
     451                if (main_timer < 0) {
    447452                        main_timer = 0;
    448453                }
    449454        }
    450455
    451         if(main_lcd_timer != TMO_FEVR){
     456        if (main_lcd_timer != TMO_FEVR) {
    452457                main_lcd_timer -= interval;
    453                 if(main_lcd_timer < 0){
     458                if (main_lcd_timer < 0) {
    454459                        main_lcd_timer = 0;
    455460                }
     
    472477
    473478        ret = ecn_itr_ini(&enm, esv);
    474         if(ret != E_OK){
     479        if (ret != E_OK) {
    475480                syslog(LOG_ERROR, "ecn_itr_ini");
    476481                return;
    477482        }
    478483
    479         for(;;) {
    480                 while((ret = ecn_itr_nxt(&enm, &epc, &pdc, p_edt)) == E_OK) {
     484        for (;;) {
     485                while ((ret = ecn_itr_nxt(&enm, &epc, &pdc, p_edt)) == E_OK) {
    481486                        switch (epc) {
    482487                        case 0xE0:
    483                                 if(in_get && (esv->hdr.edata.esv == ESV_SET_GET_RES)){
     488                                if (in_get && (esv->hdr.edata.esv == ESV_SET_GET_RES)) {
    484489                                        check_response(pdc, p_edt);
    485490                                }
     
    487492                        }
    488493                }
    489                 if(ret != E_BOVR){
     494                if (ret != E_BOVR) {
    490495                        syslog(LOG_ERROR, "ecn_itr_nxt");
    491496                        break;
    492497                }
    493                 if(enm.is_eof)
     498                if (enm.is_eof)
    494499                        break;
    495500
     
    504509static void main_break_wait(uint8_t *brkdat, int32_t len)
    505510{
     511        char mac_text[30] = "mac: ";
     512        char ipaddr_text[30] = "ipadr: ";
     513        const T_IN4_ADDR *ip4_addr;
     514        int pos;
     515
    506516        if (brkdat[0] == 0x01) {
    507                 // Link up/down
     517                pos = str_macaddr(&mac_text[4], sizeof(mac_text) - 4, mac_addr, 0);
     518                mac_text[pos + 4] = '\0';
     519                lcd_drawString(&lcd, mac_text, X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 11), ST7735_BLACK, ST7735_WHITE);
     520
     521                ip4_addr = in4_get_ifaddr(0);
     522                pos = str_ipv4addr(&ipaddr_text[6], sizeof(ipaddr_text) - 6, ip4_addr, 0);
     523                ipaddr_text[pos + 6] = '\0';
     524                lcd_drawString(&lcd, ipaddr_text, X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 12), ST7735_BLACK, ST7735_WHITE);
    508525                return;
    509526        }
    510527
    511528        if ((len == 2) && (brkdat[0] == 0x80)) {
    512                 switch(brkdat[1]){
     529                switch (brkdat[1]) {
    513530                /* ONの場合 */
    514531                case 0x30:
     
    533550static void main_timeout()
    534551{
    535         if(main_timer == 0){
     552        if (main_timer == 0) {
    536553                main_ontimer();
    537554        }
    538555
    539         if(main_lcd_timer == 0){
     556        if (main_lcd_timer == 0) {
    540557                main_lcd_ontimer();
    541558        }
     
    543560
    544561#define main_ad_count 3
     562#define main_ad_table_count 64
    545563static int16_t main_ad_tempr[main_ad_count] = { 200, 200, 200 };
    546 static uint16_t main_ad_table[64];
    547 #define main_ad_table_count (sizeof(main_ad_table) / sizeof(main_ad_table[0]))
     564static uint16_t main_ad_table[main_ad_count][main_ad_table_count];
    548565static int main_ad_pos = 0;
    549566static uint32_t main_ad_avelage[main_ad_count];
     
    556573static void main_ontimer()
    557574{
     575        ER ret;
    558576        uint8_t btn;
    559577        uint16_t ad_value;
    560578        int16_t ad_tempr;
    561579
    562         switch(main_state){
     580        switch (main_state) {
     581        case main_state_start:
     582                /* ECHONETミドルウェアを起動 */
     583                ret = ecn_sta_svc();
     584                if (ret != E_OK) {
     585                        syslog(LOG_ERROR, "ecn_sta_svc");
     586                }
     587
     588                /* 10ms後にボタン状態を確認 */
     589                main_state = main_state_idle;
     590                main_timer = 10 * 1000;
     591                break;
    563592        case main_state_idle:
    564593                /* 10ms後にボタン状態を確認 */
     
    567596                /* ADCの変換結果取得 */
    568597                for (int i = 0; i < main_ad_count; i++) {
    569                         main_ad_avelage[i] -= main_ad_table[main_ad_pos];
     598                        main_ad_avelage[i] -= main_ad_table[i][main_ad_pos];
    570599                        ad_value = analogin_read_u16(&analogin[i]) >> 4;        // 16bit値取得->12bit
    571                         main_ad_table[main_ad_pos] = ad_value;
     600                        main_ad_table[i][main_ad_pos] = ad_value;
    572601                        main_ad_avelage[i] += ad_value;
    573602                }
    574603
    575604                main_ad_pos++;
    576                 if(main_ad_pos >= main_ad_table_count){
     605                if (main_ad_pos >= main_ad_table_count) {
    577606                        main_ad_pos = 0;
    578607                }
     
    586615                                }
    587616                                else {
     617                                        main_count[i] = 0;
    588618                                        main_ad_tempr[i] = ad_tempr;
    589619
     
    601631
    602632                /* ボタン1の処理 */
    603                 if((btn == BUTTON_LEFT) && !main_btn1_state){
     633                if ((btn == BUTTON_LEFT) && !main_btn1_state) {
    604634                        main_btn1_count++;
    605                         if(main_btn1_count > 10){
     635                        if (main_btn1_count > 10) {
    606636                                main_btn1_count = 0;
    607637                                main_btn1_state = true;
     
    610640                        }
    611641                }
    612                 else if((btn != BUTTON_LEFT) && main_btn1_state){
     642                else if ((btn != BUTTON_LEFT) && main_btn1_state) {
    613643                        main_btn1_count++;
    614                         if(main_btn1_count > 10){
     644                        if (main_btn1_count > 10) {
    615645                                main_btn1_count = 0;
    616646                                main_btn1_state = false;
     
    621651
    622652                /* ボタン2の処理 */
    623                 if((btn == BUTTON_RIGHT) && !main_btn2_state){
     653                if ((btn == BUTTON_RIGHT) && !main_btn2_state) {
    624654                        main_btn2_count++;
    625                         if(main_btn2_count > 10){
     655                        if (main_btn2_count > 10) {
    626656                                main_btn2_count = 0;
    627657                                main_btn2_state = true;
     
    630660                        }
    631661                }
    632                 else if((btn != BUTTON_RIGHT) && main_btn2_state){
     662                else if ((btn != BUTTON_RIGHT) && main_btn2_state) {
    633663                        main_btn2_count++;
    634                         if(main_btn2_count > 10){
     664                        if (main_btn2_count > 10) {
    635665                                main_btn2_count = 0;
    636666                                main_btn2_state = false;
     
    645675static void main_lcd_ontimer()
    646676{
    647         char temp1[] = "温度1:+00.0℃";
    648         char temp2[] = "温度2:+00.0℃";
    649         char humid[] = "湿度 :+00.0%";
     677        char temp1[] = "温度1:+000.0℃";
     678        char temp2[] = "温度2:+000.0℃";
     679        char humid[] = "湿度 :+000.0%";
    650680        char *btn_texts[] = { "none  ", "down  ", "left  ", "select", "up    ", "right " };
    651681        int temp, btn;
     
    653683        switch (main_lcd_state) {
    654684        case 0:
    655                 temp1[9] = (temperature_sensor1_data.propertyE0 >= 0) ? ' ' : '-';
     685                temp1[10] = (temperature_sensor1_data.propertyE0 >= 0) ? ' ' : '-';
    656686                temp = (temperature_sensor1_data.propertyE0 / 1000) % 10;
    657687                if (temp < 0)
    658688                        temp = -temp;
    659                 temp1[10] = '0' + temp;
     689                temp1[11] = '0' + temp;
    660690                temp = (temperature_sensor1_data.propertyE0 / 100) % 10;
    661691                if (temp < 0)
    662692                        temp = -temp;
    663                 temp1[11] = '0' + temp;
     693                temp1[12] = '0' + temp;
    664694                temp = (temperature_sensor1_data.propertyE0 / 10) % 10;
    665695                if (temp < 0)
    666696                        temp = -temp;
    667697                temp1[13] = '0' + temp;
    668                 lcd_drawString(&lcd, &temp1[9], X_LINE_HALF_TO_PIX(&lcd, 8) + 10, Y_ROW_TO_PIX(&lcd, main_lcd_state + 4) + 10, ST7735_BLACK, ST7735_WHITE);
     698                temp = (temperature_sensor1_data.propertyE0 / 1) % 10;
     699                if (temp < 0)
     700                        temp = -temp;
     701                temp1[15] = '0' + temp;
     702                lcd_drawString(&lcd, &temp1[10], X_LINE_HALF_TO_PIX(&lcd, 7), Y_ROW_TO_PIX(&lcd, main_lcd_state + 2), ST7735_BLACK, ST7735_WHITE);
    669703                main_lcd_state++;
    670704                break;
    671705        case 1:
    672                 temp2[9] = (temperature_sensor2_data.propertyE0 >= 0) ? ' ' : '-';
     706                temp2[10] = (temperature_sensor2_data.propertyE0 >= 0) ? ' ' : '-';
    673707                temp = (temperature_sensor2_data.propertyE0 / 1000) % 10;
    674708                if (temp < 0)
    675709                        temp = -temp;
    676                 temp2[10] = '0' + temp;
     710                temp2[11] = '0' + temp;
    677711                temp = (temperature_sensor2_data.propertyE0 / 100) % 10;
    678712                if (temp < 0)
    679713                        temp = -temp;
    680                 temp2[11] = '0' + temp;
     714                temp2[12] = '0' + temp;
    681715                temp = (temperature_sensor2_data.propertyE0 / 10) % 10;
    682716                if (temp < 0)
    683717                        temp = -temp;
    684718                temp2[13] = '0' + temp;
    685                 lcd_drawString(&lcd, &temp2[9], X_LINE_HALF_TO_PIX(&lcd, 8) + 10, Y_ROW_TO_PIX(&lcd, main_lcd_state + 4) + 10, ST7735_BLACK, ST7735_WHITE);
     719                temp = (temperature_sensor2_data.propertyE0 / 1) % 10;
     720                if (temp < 0)
     721                        temp = -temp;
     722                temp2[15] = '0' + temp;
     723                lcd_drawString(&lcd, &temp2[10], X_LINE_HALF_TO_PIX(&lcd, 7), Y_ROW_TO_PIX(&lcd, main_lcd_state + 2), ST7735_BLACK, ST7735_WHITE);
    686724                main_lcd_state++;
    687725                break;
    688726        case 2:
    689                 humid[9] = ' ';
    690                 temp = (humidity_sensor_data.propertyE0 / 1000) % 10;
    691                 humid[10] = '0' + temp;
     727                humid[10] = ' ';
     728                humid[11] = ' ';
    692729                temp = (humidity_sensor_data.propertyE0 / 100) % 10;
    693                 humid[11] = '0' + temp;
     730                humid[12] = '0' + temp;
    694731                temp = (humidity_sensor_data.propertyE0 / 10) % 10;
    695732                humid[13] = '0' + temp;
    696                 lcd_drawString(&lcd, &humid[9], X_LINE_HALF_TO_PIX(&lcd, 8) + 10, Y_ROW_TO_PIX(&lcd, main_lcd_state + 4) + 10, ST7735_BLACK, ST7735_WHITE);
     733                temp = (humidity_sensor_data.propertyE0 / 1) % 10;
     734                humid[15] = '0' + temp;
     735                lcd_drawString(&lcd, &humid[10], X_LINE_HALF_TO_PIX(&lcd, 7), Y_ROW_TO_PIX(&lcd, main_lcd_state + 2), ST7735_BLACK, ST7735_WHITE);
    697736                main_lcd_state++;
    698737                break;
     
    704743        case 6:
    705744                btn = main_read_button(&joystick);
    706                 lcd_drawString(&lcd, btn_texts[btn], X_LINE_TO_PIX(&lcd, 0) + 10, Y_ROW_TO_PIX(&lcd, 10) + 10, ST7735_BLACK, ST7735_WHITE);
     745                lcd_drawString(&lcd, btn_texts[btn], X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 9), ST7735_BLACK, ST7735_WHITE);
    707746                main_lcd_state++;
    708747                break;
     
    711750                break;
    712751        case 10:
    713                 lcd_drawString(&lcd, "温度湿度計", X_LINE_TO_PIX(&lcd, 9) + 10, Y_ROW_TO_PIX(&lcd, 0) + 10, ST7735_BLACK, ST7735_WHITE);
    714                 lcd_drawString(&lcd, temp1, X_LINE_TO_PIX(&lcd, 0) + 10, Y_ROW_TO_PIX(&lcd, 0 + 4) + 10, ST7735_BLACK, ST7735_WHITE);
    715                 lcd_drawString(&lcd, temp2, X_LINE_TO_PIX(&lcd, 0) + 10, Y_ROW_TO_PIX(&lcd, 1 + 4) + 10, ST7735_BLACK, ST7735_WHITE);
    716                 lcd_drawString(&lcd, humid, X_LINE_TO_PIX(&lcd, 0) + 10, Y_ROW_TO_PIX(&lcd, 2 + 4) + 10, ST7735_BLACK, ST7735_WHITE);
     752                lcd_drawString(&lcd, "温度湿度計", X_LINE_TO_PIX(&lcd, 5), Y_ROW_TO_PIX(&lcd, 0), ST7735_BLACK, ST7735_WHITE);
     753                lcd_drawString(&lcd, temp1, X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 0 + 2), ST7735_BLACK, ST7735_WHITE);
     754                lcd_drawString(&lcd, temp2, X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 1 + 2), ST7735_BLACK, ST7735_WHITE);
     755                lcd_drawString(&lcd, humid, X_LINE_TO_PIX(&lcd, 0), Y_ROW_TO_PIX(&lcd, 2 + 2), ST7735_BLACK, ST7735_WHITE);
    717756                main_lcd_state = 0;
    718757                break;
     
    755794        /* プロパティ設定電文作成 */
    756795        ret = ecn_esv_setc(&esv, eobj, 0xE0, 2, p_edt);
    757         if(ret != E_OK){
     796        if (ret != E_OK) {
    758797                syslog(LOG_ERROR, "ecn_esv_setc");
    759798                return;
     
    761800
    762801        /* 電文送信 */
    763         ecn_snd_esv(esv);
     802        ret = ecn_snd_esv(esv);
     803        if (ret != E_OK) {
     804                syslog(LOG_ERROR, "ecn_snd_esv");
     805        }
    764806}
    765807
     
    798840
    799841        /* 押されて戻った時に処理する */
    800         if(push)
     842        if (push)
    801843                return;
    802844
    803845        /* 温度計測値 */
    804846        main_tmpr -= 10;        /* - 1.0℃ */
    805         if(main_tmpr < -100)    /* -10.0℃までとする */
     847        if (main_tmpr < -100)   /* -10.0℃までとする */
    806848                main_tmpr = -100;
    807849
     
    811853        /* プロパティ値書き込み・読み出し要求電文作成 */
    812854        ret = ecn_esv_set_get(&esv, TEMP_SENSOR_02_EOBJ, 0xE0, 2, p_edt);
    813         if(ret != E_OK){
     855        if (ret != E_OK) {
    814856                syslog(LOG_ERROR, "ecn_esv_setc");
    815857                return;
     
    820862        /* 書き込みプロパティ追加 */
    821863        ret = ecn_add_edt(esv, 0x80, 1, p_edt);
    822         if(ret) {
     864        if (ret) {
    823865                syslog(LOG_ERROR, "ecn_add_edt");
    824866                goto error;
     
    827869        /* プロパティ値書き込み・読み出し要求電文作成:折り返し指定 */
    828870        ret = ecn_trn_set_get(esv, &trn_pos);
    829         if(ret) {
     871        if (ret) {
    830872                syslog(LOG_ERROR, "ecn_trn_set_get");
    831873                goto error;
     
    834876        /* 読み出しプロパティ追加 */
    835877        ret = ecn_add_epc(esv, 0xE0);
    836         if(ret) {
     878        if (ret) {
    837879                syslog(LOG_ERROR, "ecn_add_epc");
    838880                goto error;
     
    841883        /* プロパティ値書き込み・読み出し要求電文作成:終了指定 */
    842884        ret = ecn_end_set_get(esv, trn_pos);
    843         if(ret) {
     885        if (ret) {
    844886                syslog(LOG_ERROR, "ecn_end_set_get");
    845887                goto error;
     
    848890        /* 電文送信 */
    849891        ret = ecn_snd_esv(esv);
    850         if(ret != E_OK){
     892        if (ret != E_OK) {
    851893                syslog(LOG_ERROR, "ecn_snd_esv");
    852894        }
     
    855897        /* 領域解放 */
    856898        ret = ecn_rel_esv(esv);
    857         if (ret != E_OK){
     899        if (ret != E_OK) {
    858900                syslog(LOG_ERROR, "ecn_rel_esv");
    859901        }
     
    871913
    872914        /* 押されて戻った時に処理する */
    873         if(push)
     915        if (push)
    874916                return;
    875917
    876918        /* 温度計測値 */
    877919        main_tmpr += 10;        /* + 1.0℃ */
    878         if(main_tmpr > 400)     /* +40.0℃までとする */
     920        if (main_tmpr > 400)    /* +40.0℃までとする */
    879921                main_tmpr = 400;
    880922
     
    884926        /* プロパティ値書き込み・読み出し要求電文作成 */
    885927        ret = ecn_esv_set_get(&esv, TEMP_SENSOR_02_EOBJ, 0xE0, 2, p_edt);
    886         if(ret != E_OK){
     928        if (ret != E_OK) {
    887929                syslog(LOG_ERROR, "ecn_esv_setc");
    888930                return;
     
    893935        /* 書き込みプロパティ追加 */
    894936        ret = ecn_add_edt(esv, 0x80, 1, p_edt);
    895         if(ret) {
     937        if (ret) {
    896938                syslog(LOG_ERROR, "ecn_add_edt");
    897939                goto error;
     
    900942        /* プロパティ値書き込み・読み出し要求電文作成:折り返し指定 */
    901943        ret = ecn_trn_set_get(esv, &trn_pos);
    902         if(ret) {
     944        if (ret) {
    903945                syslog(LOG_ERROR, "ecn_trn_set_get");
    904946                goto error;
     
    907949        /* 読み出しプロパティ追加 */
    908950        ret = ecn_add_epc(esv, 0xE0);
    909         if(ret) {
     951        if (ret) {
    910952                syslog(LOG_ERROR, "ecn_add_epc");
    911953                goto error;
     
    914956        /* プロパティ値書き込み・読み出し要求電文作成:終了指定 */
    915957        ret = ecn_end_set_get(esv, trn_pos);
    916         if(ret) {
     958        if (ret) {
    917959                syslog(LOG_ERROR, "ecn_end_set_get");
    918960                goto error;
     
    921963        /* 電文送信 */
    922964        ret = ecn_snd_esv(esv);
    923         if(ret != E_OK){
     965        if (ret != E_OK) {
    924966                syslog(LOG_ERROR, "ecn_snd_esv");
    925967        }
     
    928970        /* 領域解放 */
    929971        ret = ecn_rel_esv(esv);
    930         if (ret != E_OK){
     972        if (ret != E_OK) {
    931973                syslog(LOG_ERROR, "ecn_rel_esv");
    932974        }
     
    938980static bool_t check_response(uint8_t pdc, uint8_t *p_edt)
    939981{
    940         if((pdc != 2)
     982        if ((pdc != 2)
    941983                || (p_edt[0] != ((uint16_t)main_tmpr) >> 8)
    942                 || (p_edt[1] != ((uint16_t)main_tmpr) & 0xFF))
    943         {
     984                || (p_edt[1] != ((uint16_t)main_tmpr) & 0xFF)) {
    944985                syslog(LOG_WARNING, "epc_set_get response NG");
    945986                return false;
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/src/main.c

    r359 r364  
    7979
    8080ID ws_api_mailboxid = MAIN_DATAQUEUE;
     81#ifndef NOUSE_MPF_NET_BUF
    8182ID ws_mempoolid = MPF_NET_BUF_256;
     83#endif
    8284
    8385#ifdef IF_ETHER_BTUSB
     
    111113static void main_timeout();
    112114
     115extern int ntshell_exit;
     116
    113117int uart_read(char *buf, int cnt, void *extobj)
    114118{
    115         return serial_rea_dat(SIO_PORTID, (char *)buf, cnt);
     119        struct main_t *obj = (struct main_t *)extobj;
     120        int result;
     121        ER ret;
     122        int timer;
     123
     124        obj->prev = obj->now;
     125
     126        /* タイマー取得 */
     127        timer = main_get_timer();
     128
     129        /* 待ち */
     130        ret = serial_trea_dat(SIO_PORTID, buf, cnt, timer);
     131        if ((ret < 0) && (ret != E_OK) && (ret != E_TMOUT)) {
     132                syslog(LOG_NOTICE, "tslp_tsk ret: %s %d", itron_strerror(ret), timer);
     133                ntshell_exit = 1;
     134                return -1;
     135        }
     136        result = (int)ret;
     137
     138        ret = get_tim(&obj->now);
     139        if (ret != E_OK) {
     140                syslog(LOG_NOTICE, "get_tim ret: %s", itron_strerror(ret));
     141                ntshell_exit = 1;
     142                return -1;
     143        }
     144
     145                        /* 時間経過 */
     146        int elapse = obj->now - obj->prev;
     147        main_progress(elapse);
     148
     149        /* タイムアウト処理 */
     150        main_timeout();
     151
     152        return result;
    116153}
    117154
     
    119156{
    120157        return serial_wri_dat(SIO_PORTID, buf, cnt);
    121 }
    122 
    123 unsigned char ntstdio_xi(struct ntstdio_t *handle)
    124 {
    125         char buf[1];
    126         if(serial_rea_dat(SIO_PORTID, buf, 1) != 1)
    127                 return -EIO;
    128         return buf[0];
    129 }
    130 
    131 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)
    132 {
    133         char buf[1];
    134         buf[0] = c;
    135         serial_wri_dat(SIO_PORTID, buf, 1);
    136158}
    137159
     
    150172        main_initialize();
    151173
    152         ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, NULL);
     174        ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, &main_obj);
    153175        ntshell_set_prompt(&ntshell, "NTShell>");
    154176        ntshell_execute(&ntshell);
     
    168190        ER ret;
    169191
    170         ntshell_task_init();
     192#ifdef TOPPERS_OMIT_TECS
     193        serial_opn_por(SIO_PORTID);
     194#endif
     195        serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV);
     196
     197        ntshell_task_init(uart_read, uart_write, &main_obj);
    171198
    172199        main_obj.timer = TMO_FEVR;
  • asp3_tinet_ecnl_arm/trunk/app5_temp_sensor/src/main.cfg

    r352 r364  
    5454INCLUDE("tinet/tinet_asp.cfg");
    5555INCLUDE("tinet_main.cfg");
    56 INCLUDE("netinet/ip_igmp.cfg");
    5756
    5857/* DHCP クライアント */
Note: See TracChangeset for help on using the changeset viewer.