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/asp3_dcre
Files:
4 added
35 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/.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.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"/>
    6060                                                        <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"/>
    61                                                         <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"/>
     61                                                        <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"/>
    6262                                                        <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">
    6363                                                                <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"/>
     
    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">
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/Debug/Makefile

    r352 r364  
    5656SRCLANG = c
    5757ifeq ($(SRCLANG),c)
    58         LIBS = -lmusl
     58        LIBS = $(SRCDIR)/../musl-1.1.18/Debug/libmusl.a
    5959endif
    6060ifeq ($(SRCLANG),c++)
    6161        USE_CXX = true
    62         CXXLIBS = -lstdc++ -lmusl
     62        CXXLIBS = -lstdc++ $(SRCDIR)/../musl-1.1.18/Debug/libmusl.a
    6363        CXXRTS = cxxrt.o newlibrt.o
    6464endif
     
    150150endif
    151151
     152TINETDIR =
     153
    152154#
    153155#  mbedサービスの定義
     
    171173CDEFS := $(CDEFS)
    172174INCLUDES := -I. -I$(SRCDIR)/include $(INCLUDES) -I$(SRCDIR)
    173 LDFLAGS := $(LDFLAGS) -Wl,-Map=$(OBJNAME).map,--cref -L$(SRCDIR)/../musl-1.1.18/Debug
     175LDFLAGS := $(LDFLAGS) -L.
    174176LIBS := $(LIBS) $(CXXLIBS)
    175177CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
     
    192194endif
    193195APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o time.o
    194 APPL_CFLAGS := $(APPL_CFLAGS)
     196APPL_CFLAGS := $(APPL_CFLAGS) -nostdinc
    195197ifdef APPLDIRS
    196198        INCLUDES := $(INCLUDES) $(foreach dir,$(APPLDIRS),-I$(dir))
    197199endif
    198200
    199 TINETDIR =
    200201ifdef TINETDIR
    201202        #
     
    335336vpath %.cfg $(APPL_DIRS)
    336337vpath %.cdl $(APPL_DIRS)
     338vpath %.bin $(APPL_DIRS)
    337339
    338340#
     
    341343KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
    342344SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS) $(HIDDEN_OBJS)
    343 APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
     345APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS) $(APPL_BINOBJS)
    344346ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    345347                                                                                        $(END_OBJS) $(HIDDEN_OBJS)
     
    387389$(CFG1_OUT): $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
    388390        $(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
    389                                                 $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS)
     391                                                $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
    390392
    391393cfg1_out.syms: $(CFG1_OUT)
     
    416418
    417419#
     420#  並列makeのための依存関係の定義
     421#
     422$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
     423$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     424                                                                                                                | offset.timestamp
     425
     426#
    418427#  特別な依存関係の定義
    419428#
     
    424433#
    425434$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    426         $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     435        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
    427436                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    428                         $(ALL_LIBS) $(END_OBJS)
     437                        -Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
    429438
    430439#
     
    597606        $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    598607
     608$(APPL_BINOBJS): %.o: %.bin
     609        $(OBJCOPY) -B arm -I binary -O elf32-littlearm --rename-section .data=.rodata $< $*.o
     610
    599611#
    600612#  デフォルトコンパイルルールを上書き
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.c

    r352 r364  
    354354
    355355/*
     356 *  LCDへのRGBデータ送信関数
     357 */
     358ER
     359lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height)
     360{
     361        ER  ercd = E_OK;
     362        int index, i;
     363
     364        if(width == 0 || height == 0)
     365                return ercd;
     366        if(hlcd->spi_lock != 0){
     367                if((ercd = wai_sem(hlcd->spi_lock)) != E_OK)
     368                        return ercd;
     369        }
     370        rs_set(PORT_HIGH);
     371        cs_set(PORT_LOW);
     372        //dly_tsk(100/*us*/);
     373        for(index=0; index < height; index++){
     374                uint8_t *p = pbmp;
     375                for (i = 0; i < width; i++){
     376                        spi_master_write(&hlcd->hspi, *p++);
     377                        spi_master_write(&hlcd->hspi, *p++);
     378                }
     379                pbmp -= width*2;
     380        }
     381        //dly_tsk(100/*us*/);
     382        cs_set(PORT_HIGH);
     383        if(hlcd->spi_lock != 0)
     384                sig_sem(hlcd->spi_lock);
     385        return ercd;
     386}
     387
     388/*
    356389 *  ST7735へのコマンドリスト送信
    357390 */
     
    590623        lcd_setAddrWindow(hlcd, x0, y0, x0+width-1, y0+height-1);
    591624        lcd_writedata3(hlcd, pbmp, width, height);
     625}
     626
     627void
     628lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp)
     629{
     630        lcd_setAddrWindow(hlcd, x0, y0, x0+w-1, y0+h-1);
     631        pbmp += w * (h - 1) * 3; 
     632        lcd_writedata3(hlcd, pbmp, w, h);
    592633}
    593634
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/gdic/adafruit_st7735/adafruit_st7735.h

    r352 r364  
    5959#endif
    6060
     61#include <stdbool.h>
    6162#include "device.h"
    6263#include "pinmap.h"
     
    145146#ifndef TOPPERS_MACRO_ONLY
    146147
     148typedef struct GFXfont GFXfont;
     149
    147150/*
    148151 *  LCDハンドラ構造体定義
     
    153156        uint16_t                _width;         /* 幅ピクセル数 */
    154157        uint16_t                                _height;        /* 高さピクセル数 */
     158        int16_t cursor_x, cursor_y;
     159        uint16_t textcolor, textbgcolor;
     160        uint8_t textsize, rotation;
     161        bool wrap;
     162        GFXfont *gfxFont;
    155163        uint8_t                 colstart;
    156164        uint8_t                 rowstart;
     
    188196extern ER lcd_writedata2(LCD_Handler_t *hlcd, uint16_t c, int cnt);
    189197extern ER lcd_writedata3(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
     198extern ER lcd_writedata4(LCD_Handler_t *hlcd, uint8_t *pbmp, uint16_t width, uint16_t height);
    190199
    191200extern void lcd_initB(LCD_Handler_t *hlcd);
     
    198207extern void lcd_drawFastHLine(LCD_Handler_t *hlcd, int16_t x, int16_t y, int16_t w, uint16_t color);
    199208extern void lcd_drawBitmap(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, uint8_t *pbmp);
     209extern void lcd_drawImage(LCD_Handler_t *hlcd, uint16_t x0, uint16_t y0, int16_t w, int16_t h, uint8_t *pbmp);
    200210extern void lcd_invertDisplay(LCD_Handler_t *hlcd, bool_t i);
    201211
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/spi_api.h

    r352 r364  
    116116 */
    117117int  spi_master_write(spi_t *obj, int value);
     118
     119/** Write a block out in master mode and receive a value
     120 *
     121 *  The total number of bytes sent and received will be the maximum of
     122 *  tx_length and rx_length. The bytes written will be padded with the
     123 *  value 0xff.
     124 *
     125 * @param[in] obj        The SPI peripheral to use for sending
     126 * @param[in] tx_buffer  Pointer to the byte-array of data to write to the device
     127 * @param[in] tx_length  Number of bytes to write, may be zero
     128 * @param[in] rx_buffer  Pointer to the byte-array of data to read from the device
     129 * @param[in] rx_length  Number of bytes to read, may be zero
     130 * @param[in] write_fill Default data transmitted while performing a read
     131 * @returns
     132 *      The number of bytes written and read from the device. This is
     133 *      maximum of tx_length and rx_length.
     134 */
     135int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill);
    118136
    119137/** Check if a value is available to read
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.c

    r352 r364  
    4444time_t __time32(time_t *timer)
    4545#else
    46 time_t time(time_t *timer)
     46time_t get_time(time_t *timer)
    4747#endif
    4848
     
    7878}
    7979
    80 clock_t clock() {
     80clock_t get_clock() {
    8181    //_mutex->lock();
    8282    clock_t t = us_ticker_read();
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c

    r352 r364  
    259259    while(!spi_tend(obj));
    260260    return spi_read(obj);
     261}
     262
     263int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length,
     264                           char *rx_buffer, int rx_length, char write_fill) {
     265    int total = (tx_length > rx_length) ? tx_length : rx_length;
     266
     267    for (int i = 0; i < total; i++) {
     268        char out = (i < tx_length) ? tx_buffer[i] : write_fill;
     269        char in = spi_master_write(obj, out);
     270        if (i < rx_length) {
     271            rx_buffer[i] = in;
     272        }
     273    }
     274
     275    return total;
    261276}
    262277
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/sample/Makefile

    r352 r364  
    417417#
    418418$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    419         $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     419        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
    420420                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    421421                        $(ALL_LIBS) $(END_OBJS)
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/serial.h

    r359 r364  
    7979extern ER               serial_opn_por(ID portid) throw();
    8080extern ER               serial_cls_por(ID portid) throw();
    81 extern ER_UINT  serial_rea_dat(ID portid, char *buf, uint_t len) throw();
     81extern ER_UINT  serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout) throw();
    8282extern ER_UINT  serial_wri_dat(ID portid, const char *buf, uint_t len) throw();
    8383extern ER               serial_ctl_por(ID portid, uint_t ioctl) throw();
    8484extern ER               serial_ref_por(ID portid, T_SERIAL_RPOR *pk_rpor) throw();
     85
     86Inline ER_UINT  serial_rea_dat(ID portid, char *buf, uint_t len)
     87{
     88        return serial_trea_dat(portid, buf, len, TMO_FEVR);
     89}
    8590
    8691/*
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialAdapter.c

    r352 r364  
    8383 */
    8484ER_UINT
    85 serial_rea_dat(ID portid, char *buf, uint_t len)
     85serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout)
    8686{
    8787        if (sns_dpn()) {                                /* コンテキストのチェック */
     
    9292        }
    9393
    94         return(cSerialPort_read(portid - 1, buf, len));
     94        return(cSerialPort_read(portid - 1, buf, len, tmout));
    9595}
    9696
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPort.cdl

    r352 r364  
    5757        ER              open(void);
    5858        ER              close(void);
    59         ER_UINT read([out,size_is(length)] char *buffer, [in] uint_t length);
     59        ER_UINT read([out,size_is(length)] char *buffer, [in] uint_t length, [in] TMO tmout);
    6060        ER_UINT write([in,size_is(length)] const char *buffer, [in] uint_t length);
    6161        ER              control([in] uint_t ioControl);
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/syssvc/tSerialPortMain.c

    r359 r364  
    397397 */
    398398ER_UINT
    399 eSerialPort_read(CELLIDX idx, char *buffer, uint_t length)
     399eSerialPort_read(CELLIDX idx, char *buffer, uint_t length, TMO tmout)
    400400{
    401401        CELLCB  *p_cellcb;
     
    423423        while (reacnt < length) {
    424424                if (buffer_empty) {
    425                         SVC(rercd = cReceiveSemaphore_wait(),
    426                                                                                 gen_ercd_wait(rercd, p_cellcb));
     425                        rercd = cReceiveSemaphore_waitTimeout(tmout);
     426                        if (rercd == E_TMOUT)
     427                                return E_TMOUT;
     428                        if (rercd < 0) {
     429                                gen_ercd_wait(rercd, p_cellcb);
     430                                ercd = rercd;
     431                                goto error_exit;
     432                        }
    427433                }
    428434                SVC(rercd = serialPort_readChar(p_cellcb, &c), rercd);
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/Makefile.tinet

    r352 r364  
    9393               in_subr.o route_cfg.o
    9494TINET_CFG_COBJS := $(TINET_CFG_COBJS) tinet_cfg.o
     95TINET_CFG2_OUT_SRCS := $(TINET_CFG2_OUT_SRCS) tinet_cfg.h tinet_cfg.c
    9596
    9697#  IPv6
     
    328329
    329330        CFG_COBJS := $(CFG_COBJS) $(TINET_CFG_COBJS)
     331        CFG2_OUT_SRCS := $(CFG2_OUT_SRCS) $(TINET_CFG2_OUT_SRCS)
    330332
    331333        CLEAN_FILES := $(CLEAN_FILES) $(TINET_CFG_OUT) $(MAKE_TINET_LIB)
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/ethernet.h

    r352 r364  
    9898#endif  /* of #ifndef IF_ETHER_NIC_HDR_ALIGN */
    9999
    100 #if defined(__RX) || defined(_MSC_VER)
    101100#if defined(__RX)
    102101#pragma pack
    103 #else
     102#elif defined(_MSC_VER)
    104103#pragma pack(push, 1)
    105104#endif
     105
     106#if defined(__RX) || defined(_MSC_VER)
     107
    106108typedef struct t_ether_header {
    107109
     
    116118        uint16_t        type;
    117119        } T_ETHER_HDR;
    118 #if defined(__RX)
    119 #pragma packoption
    120 #else
    121 #pragma pack(pop)
    122 #endif
    123120
    124121#elif defined(TOPPERS_S810_CLG3_85)     /* of #if defined(__RX) */
     
    166163        uint8_t         lladdr[ETHER_ADDR_LEN];
    167164        } __attribute__((packed, aligned(2))) T_ETHER_ADDR;
     165
     166#if defined(__RX)
     167#pragma packoption
     168#elif defined(_MSC_VER)
     169#pragma pack(pop)
     170#endif
    168171
    169172/*
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_asp.cfg

    r352 r364  
    4141
    4242INCLUDE("net/net.cfg");
     43
     44#ifndef NOUSE_MPF_NET_BUF
    4345
    4446/*
     
    169171                });
    170172#endif  /* of #if defined(NUM_MPF_NET_BUF6_65536) && NUM_MPF_NET_BUF6_65536 > 0 */
     173
     174#endif
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/net/net_buf.c

    r352 r364  
    6868#include <netinet/tcp_var.h>
    6969
     70#ifndef NOUSE_MPF_NET_BUF
     71
    7072/*
    7173 *  関数
     
    226228#endif  /* of #if defined(NUM_MPF_NET_BUF_128) && NUM_MPF_NET_BUF_128 > 0 */
    227229
    228 #if defined(_IP4_CFG)
     230#if defined(_IP6_CFG)
     231
     232#if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
     233        {
     234                MPF_NET_BUF_CSEG,
     235                IF_HDR_SIZE + IP_HDR_SIZE + TCP_HDR_SIZE,
     236
     237#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
     238
     239                NUM_MPF_NET_BUF_CSEG,
     240
     241#endif  /* of #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF */
     242
     243                },
     244#endif  /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
     245
     246#endif  /* of #if defined(_IP6_CFG) */
    229247
    230248#if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0
     
    242260#endif  /* of #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0 */
    243261
    244 #endif  /* of #if defined(_IP4_CFG) */
     262#if defined(_IP4_CFG) && !defined(_IP6_CFG)
    245263
    246264#if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
     
    257275                },
    258276#endif  /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
     277
     278#endif  /* of #if defined(_IP4_CFG) && !defined(_IP6_CFG) */
    259279
    260280        };
     
    307327
    308328        while (1) {
    309                 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
     329                if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
    310330                        (*buf)->idix  = (uint8_t)ix;
    311331                        (*buf)->len   = (uint16_t)minlen;
     
    320340                        return error;
    321341                        }
    322                 else if (ix == 0 || net_buf_table[ix].size > maxlen)
     342                ix --;
     343                if (ix < 0 || net_buf_table[ix].size > maxlen)
    323344                        break;
    324                 ix --;
    325345                }
    326346
     
    351371
    352372        while (1) {
    353                 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf,
     373                if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf,
    354374                                      ix == sizeof(net_buf_table) / sizeof(T_NET_BUF_ENTRY) - 1 ? tmout : TMO_POL)) == E_OK) {
    355375                        (*buf)->idix  = (uint8_t)ix;
     
    359379                        (*buf)->conn_pos = 0;
    360380#endif
     381
    361382#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
    362383                        NET_COUNT_NET_BUF(net_buf_table[ix].allocs, 1);
     
    454475                /* 固定メモリプールに返す。*/
    455476
    456 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
    457                 net_buf_table[buf->idix].busies --;
    458 #endif
    459                 if ((error = rel_mpf((ID)net_buf_table[buf->idix].index, buf)) != E_OK) {
    460                         syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), buf->idix);
     477                int idix = buf->idix;
     478#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
     479                net_buf_table[idix].busies --;
     480#endif
     481                if ((error = rel_mpf((ID)net_buf_table[idix].index, buf)) != E_OK) {
     482                        syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), idix);
    461483                        }
    462484                }
     
    509531        return (uint_t)net_buf_table[0].size;
    510532        }
     533
     534#else
     535#include <stdlib.h>
     536
     537/*
     538 *  tget_net_buf_ex -- ネットワークバッファを獲得する(拡張機能)。
     539 */
     540
     541ER
     542tget_net_buf_ex (T_NET_BUF **buf, uint_t minlen, uint_t maxlen, ATR nbatr, TMO tmout)
     543{
     544        uint_t len = (minlen > maxlen) ? minlen : maxlen;
     545        *buf = (T_NET_BUF *)malloc(sizeof(T_NET_BUF) - sizeof(((T_NET_BUF *)0)->buf) + len);
     546        if (*buf == NULL)
     547                return E_NOMEM;
     548
     549        (*buf)->idix = 0;
     550        (*buf)->len = (uint16_t)len;
     551        (*buf)->flags = 0;
     552#ifdef IF_ETHER_MULTI_NIC
     553        (*buf)->conn_pos = 0;
     554#endif
     555
     556        return E_OK;
     557        }
     558
     559/*
     560 *  tget_net_buf -- ネットワークバッファを獲得する(互換)。
     561 */
     562
     563ER
     564tget_net_buf (T_NET_BUF **buf, uint_t len, TMO tmout)
     565{
     566        return tget_net_buf_ex(buf, len, len, NBA_SEARCH_ASCENT, tmout);
     567        }
     568
     569
     570/*
     571 * rel_net_buf -- ネットワークバッファを返却する。
     572 */
     573
     574ER
     575rel_net_buf (T_NET_BUF *buf)
     576{
     577        free(buf);
     578
     579        return E_OK;
     580        }
     581
     582
     583/*
     584 * net_buf_max_siz -- ネットワークバッファの最大サイズを返す。
     585 */
     586
     587uint_t
     588net_buf_max_siz (void)
     589{
     590        return (uint_t)IF_PDU_SIZE;
     591        }
     592
     593#endif
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dbg_cons.c

    r352 r364  
    666666                    "IX Expire State      MAC Address       IP Address\n");
    667667
    668         /* expire の単位は [ms]。*/
     668        /* expire の単位は [us]。*/
    669669        get_tim(&now);
    670670        cache = nd6_get_cache();
     
    705705                    "IX Expire MAC Address       IP Address\n");
    706706
    707         /* expire の単位は [ms]。*/
     707        /* expire の単位は [us]。*/
    708708        cache = arp_get_cache();
    709709        for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
     
    753753        WAI_NET_CONS_PRINTF();
    754754        get_tim(&now);
    755         cons_printf(portid, "ネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
     755        cons_printf(portid, "ネットワーク統計情報\t経過時間[us]\t%lu\t", now);
    756756        if (now > (1000 * 3600 * 24))
    757757                cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
     
    938938                }
    939939
    940         cons_printf(portid, "\nネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
     940        cons_printf(portid, "\nネットワーク統計情報\t経過時間[us]\t%lu\t", now);
    941941        if (now > (1000 * 3600 * 24))
    942942                cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
     
    10651065        WAI_NET_CONS_PRINTF();
    10661066        get_tim(&now);
    1067         cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t%u\n", now);
     1067        cons_printf(portid, "ネットワークバッファ情報\t経過時間[us]\t%u\n", now);
    10681068
    10691069#if NET_COUNT_ENABLE
     
    15771577        cons_printf(portid, " IP Address\n");
    15781578
    1579         /* expire の単位は [ms]。*/
     1579        /* expire の単位は [us]。*/
    15801580        get_tim(&now);
    15811581        dr = nd6_get_drl(&count);
     
    22982298
    22992299        cons_printf(portid, "ND:\n");
    2300         cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[ms]\n", TMO_ND6_RTR_SOL_DELAY);
    2301         cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[ms]\n", TMO_ND6_RTR_SOL_INTERVAL);
     2300        cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[us]\n", TMO_ND6_RTR_SOL_DELAY);
     2301        cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[us]\n", TMO_ND6_RTR_SOL_INTERVAL);
    23022302        cons_printf(portid, "  NUM_IP6_DAD_COUNT:        %5d\n",     NUM_IP6_DAD_COUNT);
    23032303        cons_printf(portid, "  NUM_ND6_CACHE_ENTRY:      %5d\n",     NUM_ND6_CACHE_ENTRY);
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.c

    r352 r364  
    20312031
    20322032                        /* 休止する。*/
    2033                         if (error == E_OK)
    2034                                 syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2033                        if (error == E_OK) {
     2034                                if (ct->fsm != DHCP4_FSM_SLEEP)
     2035                                        syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2036                        }
    20352037                        else {
    20362038                                syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(error));
     
    21582160
    21592161                        /* 休止する。*/
    2160                         if (ct->error == E_OK)
    2161                                 syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2162                        if (ct->error == E_OK) {
     2163                                if (ct->fsm != DHCP4_FSM_SLEEP)
     2164                                        syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2165                        }
    21622166                        else {
    21632167                                syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(ct->error));
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/wwws.c

    r352 r364  
    708708        len += put_str(cepid, srbuf, response);
    709709        get_tim(&finish);
    710         syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [ms]",
     710        syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [us]",
    711711                           cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
    712712        return E_OK;
     
    16091609
    16101610        get_tim(&finish);
    1611         syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [ms]",
     1611        syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [us]",
    16121612                           cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
    16131613        return E_OK;
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/icmp6.h

    r352 r364  
    291291typedef struct t_router_advert_hdr {
    292292        T_ICMP6_HDR     hdr;
    293         uint32_t        reachable;              /* [ms] 到達可能時間  */
    294         uint32_t        retransmit;             /* [ms] 近隣要請送信間隔        */
     293        uint32_t        reachable;              /* [us] 到達可能時間  */
     294        uint32_t        retransmit;             /* [us] 近隣要請送信間隔        */
    295295        /* この後にオプションが続く */
    296296        } __attribute__((packed, aligned(2))) T_ROUTER_ADVERT_HDR;
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in4_subr.c

    r352 r364  
    287287
    288288        /* IP ヘッダを設定する。*/
    289         if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK)
     289        if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK) {
     290                syscall(rel_net_buf(*nbuf));
     291                *nbuf = NULL;
    290292                return error;
     293                }
    291294
    292295        /* 4 オクテット境界までパディングで埋める。*/
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/in_itron.h

    r352 r364  
    6262#define TFN_TCP_ALL             (0)
    6363
    64 #define TEV_TCP_RCV_OOB         (-0x201)
     64#define TEV_TCP_RCV_OOB         (0x201)
    6565
    6666/* UDP 関係 */
     
    7575#define TFN_UDP_ALL             (0)
    7676
    77 #define TEV_UDP_RCV_DAT         (-0x221)
     77#define TEV_UDP_RCV_DAT         (0x221)
    7878
    7979/* 一般 */
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_input.c

    r352 r364  
    13641364        NTOHS(tcph->dport);
    13651365
     1366        /* SDU 長 より 緊急ポインタが大きい場合 */
     1367        if (tcph->urp > tcph->sum)
     1368                goto drop;
     1369
    13661370find_cep:
    13671371
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_output.c

    r352 r364  
    369369                tcph->flags |= TCP_FLG_URG;
    370370                }
    371         else
     371        else {
     372                tcph->urp = 0;
    372373                cep->snd_up  = cep->snd_una;
     374                }
    373375
    374376#endif  /* of #ifdef TCP_CFG_EXTENTIONS */
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/tcp_usrreq.c

    r352 r364  
    897897
    898898        /* tcp_rcv_buf の割当て長をリセットする。*/
    899         cep->rcv_buf_len = 0;
     899        cep->rcv_buf_len -= len;
    900900
    901901        /* 通信端点のロックを解除する。*/
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udp_var.h

    r352 r364  
    101101typedef ER      (*t_udp_callback)(ID cepid, FN fncd, void *p_parblk);
    102102
     103typedef struct t_udp_rcv_dat_para {
     104        uint_t          len;
     105        T_NET_BUF       *input;
     106        uint_t          off;
     107        union {
     108                T_IPV4EP rep4;
     109                T_IPV6EP rep6;
     110        };
     111        } T_UDP_RCV_DAT_PARA;
     112
    103113/*
    104114 *  UDP 通信端点
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_input.c

    r352 r364  
    7575{
    7676        T_UDP_HDR       *udph;
    77         uint_t          len;
     77        T_UDP_RCV_DAT_PARA para;
    7878
    7979        udph = (T_UDP_HDR *)(input->buf + off);
    80         len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
     80        para.len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
    8181
    8282        if (cep->rcv_tskid != TA_NULL) {        /* 非ノンブロッキングコールでペンディング中 */
     
    9898                /* データをバッファに移す。*/
    9999                memcpy(cep->rcv_data, GET_UDP_SDU(input, off),
    100                        (size_t)(len < cep->rcv_len ? len : cep->rcv_len));
     100                       (size_t)(para.len < cep->rcv_len ? para.len : cep->rcv_len));
    101101                syscall(rel_net_buf(input));
    102102
     
    104104
    105105#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    106                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)len);
     106                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)para.len);
    107107#else
    108                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&len);
     108                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&para.len);
    109109#endif
    110110                else
     
    121121
    122122#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    123                 (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)len);
     123                (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)para.len);
    124124#else
    125                 (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&len);
     125                para.input = input;
     126                para.off = off;
     127#if API_PROTO == API_PROTO_IPV4
     128                para.rep4.portno = ntohs(udph->sport);
     129                IN_COPY_TO_HOST(&para.rep4.ipaddr, input);
     130#else
     131                para.rep6.portno = ntohs(udph->sport);
     132                IN_COPY_TO_HOST(&para.rep6.ipaddr, input);
     133#endif
     134                (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&para.len);
    126135#endif
    127136                /*
     
    129138                 *  データを読み出さなかったことになるので、捨てる。
    130139                 */
    131                 if (cep->cb_netbuf != NULL)
    132                         syscall(rel_net_buf(cep->cb_netbuf));
     140                if (cep->cb_netbuf != NULL) {
     141                        if ((input->flags & NB_FLG_NOREL_IFOUT) == 0)
     142                                syscall(rel_net_buf(cep->cb_netbuf));
     143                        cep->cb_netbuf = NULL;
     144                        }
    133145                }
    134146        else {
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c

    r352 r364  
    411411                return E_NOEXS;
    412412#if defined(SUPPORT_INET6)
    413 #endif
    414 #if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
     413#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
    415414        switch (optname) {
    416415        case IP_MULTICAST_LOOP:
     
    488487                return E_NOEXS;
    489488#if defined(SUPPORT_INET6)
    490 #endif
    491 #if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
     489#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
    492490        switch (optname) {
    493491        case IP_MULTICAST_LOOP:
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet/udpn_usrreq_nblk.c

    r352 r364  
    122122
    123123#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    124                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)error);
     124                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)error);
    125125#else
    126                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&error);
     126                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)&error);
    127127#endif
    128128                else
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_subr.c

    r352 r364  
    369369
    370370        /* IPv6 ヘッダを設定する。*/
    371         if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK)
     371        if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK) {
     372                syscall(rel_net_buf(*nbuf));
     373                *nbuf = NULL;
    372374                return error;
     375                }
    373376
    374377        /* 4 オクテット境界までパディングで埋める。*/
     
    662665 *  in6_rtredirect -- ルーティング表にエントリを登録する。
    663666 *
    664  *    注意: 引数 tmo の単位は [ms]。
     667 *    注意: 引数 tmo の単位は [us]。
    665668 */
    666669
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/in6_var.h

    r352 r364  
    184184         * vltime と pltime は、追加/変更してからの相対時間
    185185         */
    186         uint32_t        vltime;         /* 有効時間 [ms]                    */
    187         uint32_t        pltime;         /* 推奨有効時間 [ms]          */
     186        uint32_t        vltime;         /* 有効時間 [us]                    */
     187        uint32_t        pltime;         /* 推奨有効時間 [us]          */
    188188        } __attribute__((packed, aligned(2)))T_IN6_ADDR_LIFETIME;
    189189
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.c

    r352 r364  
    353353                        if (nd6_cache[mix].hold != NULL) {
    354354                                syscall(rel_net_buf(nd6_cache[mix].hold));
     355                                nd6_cache[mix].hold = NULL;
    355356                                }
    356357                        fix = mix;
     
    562563                        if (ln->hold != NULL) {
    563564                                syscall(rel_net_buf(ln->hold));
     565                                ln->hold = NULL;
    564566                                }
    565567
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netinet6/nd6.h

    r352 r364  
    8181        T_NET_BUF       *hold;
    8282        TMO             tmout;
    83         SYSTIM          expire;         /* [ms] 有効時間が切れる時刻      */
     83        SYSTIM          expire;         /* [us] 有効時間が切れる時刻      */
    8484        T_IF_ADDR       ifaddr;
    8585        uint8_t         state;
     
    183183typedef struct t_def_router {
    184184        T_IN6_ADDR      addr;
    185         SYSTIM          expire;         /* [ms] 有効時間が切れる時刻      */
    186         uint32_t        lifetime;       /* [ms] 有効時間                    */
     185        SYSTIM          expire;         /* [us] 有効時間が切れる時刻      */
     186        uint32_t        lifetime;       /* [us] 有効時間                    */
    187187        uint16_t        plistmap;       /* プレフィックスマップ           */
    188188        uint8_t         flags;          /* ルータ通知のフラグ            */
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tcpip_sym.def

    r352 r364  
    1515TMO_UDP_OUTPUT
    1616TMO_ICMP_OUTPUT
     17TMO_IGMP_OUTPUT
    1718TMO_ND6_NS_OUTPUT
    1819TMO_ND6_NA_OUTPUT
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/tinet_asp.cfg

    r352 r364  
    7373INCLUDE("netinet/if_ether.cfg");
    7474INCLUDE("netinet/ip.cfg");
     75INCLUDE("netinet/ip_igmp.cfg");
    7576INCLUDE("netinet/tcp.cfg");
    7677INCLUDE("netinet/udp.cfg");
Note: See TracChangeset for help on using the changeset viewer.