Changeset 387 for asp3_tinet_ecnl_rx
- Timestamp:
- May 22, 2019, 4:09:18 PM (4 years ago)
- Location:
- asp3_tinet_ecnl_rx/trunk
- Files:
-
- 11 added
- 98 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/Debug/Makefile
r374 r387 198 198 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 199 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 200 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o200 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 202 202 203 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/DebugCitrus/Makefile
r374 r387 198 198 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 199 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 200 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o200 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 202 202 203 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/DebugEther/Makefile
r374 r387 198 198 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 199 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 200 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o200 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 202 202 203 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/main.c
r374 r387 66 66 #include "ffarch.h" 67 67 #include "ff.h" 68 #include "core/ntshell.h"69 #include "core/ntlibc.h"70 68 #include <stdio.h> 71 69 #include "usrcmd.h" 72 #include "util/ntopt.h"73 #include "socket_stub.h"74 70 #include "gpio_api.h" 75 71 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app2_light/Debug/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app2_light/DebugCitrus/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app2_light/DebugEther/Makefile
r374 r387 187 187 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 188 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o189 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 191 191 192 192 # -
asp3_tinet_ecnl_rx/trunk/app2_light/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app2_light/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/Debug/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/DebugCitrus/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/DebugEther/Makefile
r374 r387 187 187 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 188 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o189 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 191 191 192 192 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app4_aircon/Debug/Makefile
r376 r387 195 195 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 196 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 197 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o197 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 199 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 200 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/DebugCitrus/Makefile
r376 r387 195 195 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 196 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 197 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o197 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 199 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 200 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/DebugEther/Makefile
r376 r387 193 193 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 194 194 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 195 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o195 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 197 197 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 198 198 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app4_aircon/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/Debug/Makefile
r374 r387 195 195 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 196 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 197 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o197 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 199 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 200 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/DebugCitrus/Makefile
r374 r387 195 195 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 196 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 197 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o197 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 199 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 200 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/DebugEther/Makefile
r374 r387 193 193 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 194 194 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 195 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o195 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 197 197 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 198 198 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/Debug/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/DebugCitrus/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/DebugEther/Makefile
r374 r387 187 187 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 188 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o189 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 191 191 192 192 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/Debug/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/DebugCitrus/Makefile
r374 r387 189 189 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 190 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o191 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 193 193 194 194 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/DebugEther/Makefile
r374 r387 187 187 APPLDIRS := $(APPLDIRS) $(SRCDIR)/$(TINETDIR)/netapp 188 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o189 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o stdio_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 191 191 192 192 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/src/main.c
r374 r387 65 65 #include "ffarch.h" 66 66 #include "ff.h" 67 #include "core/ntshell.h"68 #include "core/ntlibc.h"69 67 #include <stdio.h> 70 68 #include "usrcmd.h" 71 #include "util/ntopt.h"72 #include "socket_stub.h"73 69 #include "gpio_api.h" 74 70 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/arch/rx630_gcc/prc_kernel_impl.c
r378 r387 236 236 } 237 237 #endif /* OMIT_DEFAULT_EXC_HANDLER */ 238 239 void _start_c(char * const*args);240 241 void242 _sta_ker()243 {244 static const char *const args[] = {245 (char *)1,246 "asp3",247 0,248 // envp249 "TZ=JST-9",250 0,251 // auxv252 0253 };254 _start_c(args);255 }256 257 //#include <errno.h>258 #define ENOSYS 38259 260 __attribute__((weak))261 long SYS_poll()262 {263 return -ENOSYS;264 }265 266 __attribute__((weak))267 long SYS_open()268 {269 return -ENOSYS;270 }271 272 __attribute__((weak))273 long SYS_set_tid_address()274 {275 return 0;//-ENOSYS;276 }277 278 __attribute__((weak))279 long SYS_gettid()280 {281 return 0;//-ENOSYS;282 }283 284 __attribute__((weak))285 long SYS_rt_sigprocmask()286 {287 return 0;//-ENOSYS;288 }289 290 __attribute__((weak))291 long SYS_mmap2()292 {293 return 0;//-ENOSYS;294 }295 296 __attribute__((weak))297 long SYS_tkill()298 {299 return 0;//-ENOSYS;300 }301 302 __attribute__((weak))303 void SYS_exit_group()304 {305 ext_ker();306 }307 308 __attribute__((weak))309 void SYS_exit()310 {311 ext_ker();312 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/mbed/hal/spi_api.h
r374 r387 34 34 35 35 #define SPI_FILL_WORD (0xFFFF) 36 #define SPI_FILL_CHAR (0xFF) 36 37 37 38 #if DEVICE_SPI_ASYNCH -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/mbed/target/mbed_api.c
r374 r387 1349 1349 { 1350 1350 //return probe_int(obj->rxi_intno); 1351 return (sil_reb_mem(SCI_SSR(obj->base_address)) & RIE) != 0U;1351 return true; 1352 1352 } 1353 1353 … … 1355 1355 { 1356 1356 //return probe_int(obj->tei_intno); 1357 return (sil_reb_mem(SCI_SSR(obj->base_address)) & TE IE) != 0U;1357 return (sil_reb_mem(SCI_SSR(obj->base_address)) & TEND) != 0U; 1358 1358 } 1359 1359 … … 1394 1394 { 1395 1395 int no = SCI_NUM(obj->base_address); 1396 bool_t lock = sense_lock(); 1397 1398 if (!lock) 1399 loc_cpu(); 1396 1400 1397 1401 sci_irq_info[no].handler = handler; 1398 1402 sci_irq_info[no].id = id; 1403 1404 if (!lock) 1405 unl_cpu(); 1399 1406 } 1400 1407 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/syssvc/tlsf/tlsf.c
r374 r387 6 6 #include <string.h> 7 7 #include <stdio.h> 8 #include <t_syslog.h> 8 9 9 10 #include "tlsf.h" … … 887 888 { 888 889 (void)user; 889 printf("\t%p %s size: %x (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, block_from_ptr(ptr));890 syslog(LOG_NOTICE, "\t%p %s size: %x (%p)", ptr, used ? "used" : "free", (unsigned int)size, block_from_ptr(ptr)); 890 891 } 891 892 … … 976 977 if (((ptrdiff_t)mem % ALIGN_SIZE) != 0) 977 978 { 978 printf("tlsf_add_pool: Memory must be aligned by %u bytes.\n",979 syslog(LOG_NOTICE, "tlsf_add_pool: Memory must be aligned by %u bytes.", 979 980 (unsigned int)ALIGN_SIZE); 980 981 return 0; … … 984 985 { 985 986 #if defined (TLSF_64BIT) 986 printf("tlsf_add_pool: Memory size must be between 0x%x and 0x%x00 bytes.\n",987 syslog(LOG_NOTICE, "tlsf_add_pool: Memory size must be between 0x%x and 0x%x00 bytes.", 987 988 (unsigned int)(pool_overhead + block_size_min), 988 989 (unsigned int)((pool_overhead + block_size_max) / 256)); 989 990 #else 990 printf("tlsf_add_pool: Memory size must be between %u and %u bytes.\n",991 syslog(LOG_NOTICE, "tlsf_add_pool: Memory size must be between %u and %u bytes.", 991 992 (unsigned int)(pool_overhead + block_size_min), 992 993 (unsigned int)(pool_overhead + block_size_max)); … … 1056 1057 if (rv) 1057 1058 { 1058 printf("test_ffs_fls: %x ffs/fls tests failed.\n", rv);1059 syslog(LOG_NOTICE, "test_ffs_fls: %x ffs/fls tests failed.", rv); 1059 1060 } 1060 1061 return rv; … … 1073 1074 if (((tlsfptr_t)mem % ALIGN_SIZE) != 0) 1074 1075 { 1075 printf("tlsf_create: Memory must be aligned to %u bytes.\n",1076 syslog(LOG_NOTICE, "tlsf_create: Memory must be aligned to %u bytes.", 1076 1077 (unsigned int)ALIGN_SIZE); 1077 1078 return 0; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/Makefile.target
r374 r387 25 25 # システムサービスに関する定義 26 26 # 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed 28 SYSSVC_COBJS := $(SYSSVC_COBJS) 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed $(SRCDIR)/syssvc/tlsf 28 SYSSVC_COBJS := $(SYSSVC_COBJS) musl_adapter.o tlsf.o 29 29 30 30 # -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target.cdl
r337 r387 60 60 * ターゲット依存のセルタイプの定義 61 61 */ 62 import(" tPutLogGRCitrus.cdl");62 import("syssvc/tPutLogSIOPort.cdl"); 63 63 import("tSIOPortGRCitrus.cdl"); 64 64 … … 72 72 * 低レベル出力の組み上げ記述 73 73 */ 74 cell tPutLog GRCitrusPutLogTarget {74 cell tPutLogSIOPort PutLogTarget { 75 75 /* SIOドライバとの結合 */ 76 76 cSIOPort = SIOPortTarget1.eSIOPort; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_kernel.cfg
r337 r387 5 5 */ 6 6 INCLUDE("target_timer.cfg") 7 INCLUDE("syssvc/musl_adapter.cfg") -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_kernel_impl.c
r374 r387 54 54 #ifdef TOPPERS_OMIT_TECS 55 55 #include "serial_api.h" 56 #include "target_syssvc.h" 56 57 #endif 57 58 … … 83 84 * シリアルポートの設定 84 85 */ 85 serial_init(&log_serial, P20, P21);86 serial_init(&log_serial, STDIO_UART_TX, STDIO_UART_RX); 86 87 serial_baud(&log_serial, UART_BAUDRATE); 87 88 serial_format(&log_serial, 8, ParityNone, 1); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.c
r374 r387 3 3 * Toyohashi Open Platform for Embedded Real-Time Systems/ 4 4 * Advanced Standard Profile Kernel 5 * 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 * Toyohashi Univ. of Technology, JAPAN 8 * Copyright (C) 2003-2004 by Naoki Saito 9 * Nagoya Municipal Industrial Research Institute, JAPAN 10 * Copyright (C) 2003-2004 by Platform Development Center 11 * RICOH COMPANY,LTD. JAPAN 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 14 * 5 * 6 * Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory 7 * Graduate School of Information Science, Nagoya Univ., JAPAN 8 * 15 9 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 16 10 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 … … 35 29 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 36 30 * 免責すること. 37 * 31 * 38 32 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 39 33 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 … … 41 35 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 42 36 * の責任を負わない. 43 * 37 * 44 38 * @(#) $Id$ 45 39 */ 46 40 47 41 /* 48 * RX630 UART用シリアルI/Oモジュール 49 */ 50 #include "kernel_impl.h" 51 #include <sil.h> 42 * シリアルインタフェースドライバのターゲット依存部(GR-CITRUS用) 43 */ 44 45 #include "gr_citrus.h" 46 #include <t_stddef.h> 47 #include <t_syslog.h> 48 #include <errno.h> 49 #include <unistd.h> 50 #include <fcntl.h> 51 #include <termios.h> 52 52 #include "target_serial.h" 53 #include "hal/serial_api.h" 54 #include "target_syssvc.h" 55 #include "syssvc/serial.h" 56 57 /* 58 * シリアルI/Oポート初期化ブロックの定義 53 #include "syssvc/siofd.h" 54 55 /* 56 * SIOポート初期化ブロックの定義 59 57 */ 60 58 typedef struct sio_port_initialization_block { 61 PinName tx; 62 PinName rx; 59 char *path; /* ファイルのパス名 */ 63 60 } SIOPINIB; 64 61 65 62 /* 66 * シリアルI/Oポート管理ブロックの定義63 * SIOポート管理ブロックの定義 67 64 */ 68 65 struct sio_port_control_block { 69 const SIOPINIB *p_siopinib; 70 intptr_t exinf; 71 bool_t openflag; 72 serial_t serial; 66 const SIOPINIB *p_siopinib; /* SIOポート初期化ブロック */ 67 intptr_t exinf; /* 拡張情報 */ 68 bool_t opened; /* オープン済みフラグ */ 69 struct termios saved_term; /* 元の端末制御情報 */ 70 71 int_t read_fd; /* 読出し用ファイルディスクリプタ */ 72 bool_t rcv_flag; /* 受信文字バッファ有効フラグ */ 73 char rcv_buf; /* 受信文字バッファ */ 74 bool_t rcv_rdy; /* 受信通知コールバック許可フラグ */ 75 76 int_t write_fd; /* 書込み用ファイルディスクリプタ */ 77 bool_t snd_flag; /* 送信文字バッファ有効フラグ */ 78 char snd_buf; /* 送信文字バッファ */ 79 bool_t snd_rdy; /* 送信通知コールバック許可フラグ */ 73 80 }; 74 81 75 82 /* 76 * シリアルI/Oポート管理ブロックのエリア 77 */ 78 SIOPCB siopcb_table[TNUM_PORT]; 79 80 static const SIOPINIB siopinib_table[TNUM_SIOP] = 81 { 82 { P20, P21 }, 83 #if TNUM_SIOP > 1 84 { P50, P52 }, 85 #endif 86 #if TNUM_SIOP > 2 87 { P32, P33 }, 88 #endif 89 #if TNUM_SIOP > 3 90 { PC7, PC6 }, 91 #endif 92 #if TNUM_SIOP > 4 93 { P26, P30 }, 94 #endif 95 #if TNUM_SIOP > 5 96 { PB5, P25 }, 97 #endif 98 #if TNUM_SIOP > 6 99 { PA0, PC2 }, 100 #endif 83 * SIOポート初期化ブロック 84 */ 85 const SIOPINIB siopinib_table[TNUM_SIOP] = { 86 { NULL } 101 87 }; 102 88 103 89 /* 104 * シリアルI/OポートIDから管理ブロックを取り出すためのマクロ 105 */ 106 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 107 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 108 #define get_siopinib(siopid) (&(siopinib_table[INDEX_SIOP(siopid)])) 109 110 static void mbed_serial_irq_handler(uint32_t id, SerialIrq event); 90 * SIOポート管理ブロックのエリア 91 */ 92 SIOPCB siopcb_table[TNUM_SIOP]; 93 94 /* 95 * SIOポートIDから管理ブロックを取り出すためのマクロ 96 */ 97 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 98 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 111 99 112 100 /* … … 120 108 121 109 /* 122 * シリアルI/Oポート管理ブロックの初期化110 * SIOポート管理ブロックの初期化 123 111 */ 124 for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) { 112 for (i = 0; i < TNUM_SIOP; i++) { 113 p_siopcb = &(siopcb_table[i]); 125 114 p_siopcb->p_siopinib = &(siopinib_table[i]); 126 p_siopcb->openflag = false; 127 } 128 } 129 130 /* 131 * シリアルI/Oポートのオープン 115 p_siopcb->opened = false; 116 } 117 } 118 119 /* 120 * SIOドライバの終了処理 121 */ 122 void 123 sio_terminate(intptr_t exinf) 124 { 125 uint_t i; 126 127 /* 128 * オープンされているSIOポートのクローズ 129 */ 130 for (i = 0; i < TNUM_SIOP; i++) { 131 sio_cls_por(&(siopcb_table[i])); 132 } 133 } 134 135 /* 136 * SIOポートのオープン 132 137 */ 133 138 SIOPCB * 134 139 sio_opn_por(ID siopid, intptr_t exinf) 135 140 { 136 SIOPCB *p_siopcb = NULL; 137 ER ercd; 138 serial_t *serial; 139 140 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 141 return NULL; 141 SIOPCB *p_siopcb; 142 const SIOPINIB *p_siopinib; 143 int_t fd; 144 struct termios term; 145 142 146 p_siopcb = get_siopcb(siopid); 143 144 if (p_siopcb->openflag) 145 return NULL; 146 p_siopcb->openflag = true; 147 p_siopcb->exinf = exinf; 148 149 serial = &p_siopcb->serial; 150 serial_init(serial, p_siopcb->p_siopinib->tx, p_siopcb->p_siopinib->rx); 151 serial_baud(serial, UART_BAUDRATE); 152 serial_format(serial, 8, ParityNone, 1); 153 154 serial_irq_handler(serial, mbed_serial_irq_handler, siopid); 155 156 return p_siopcb; 157 } 158 159 /* 160 * シリアルI/Oポートのクローズ 147 p_siopinib = p_siopcb->p_siopinib; 148 149 if (!(p_siopcb->opened)) { 150 if (p_siopinib->path != NULL) { 151 fd = siofd_open(p_siopinib->path, O_RDWR, 0777); 152 assert(fd >= 0); 153 p_siopcb->read_fd = fd; 154 p_siopcb->write_fd = fd; 155 } 156 else { 157 fd = STDIN_FILENO; /* 標準入出力を使う */ 158 p_siopcb->read_fd = STDIN_FILENO; 159 p_siopcb->write_fd = STDOUT_FILENO; 160 } 161 siofd_fcntl(fd, F_SETOWN, getpid()); 162 siofd_fcntl(fd, F_SETFL, (O_NONBLOCK | O_ASYNC)); 163 164 siofd_tcgetattr(fd, &(p_siopcb->saved_term)); 165 term = p_siopcb->saved_term; 166 term.c_lflag &= ~(ECHO | ICANON); 167 siofd_tcsetattr(fd, TCSAFLUSH, &term); 168 169 p_siopcb->exinf = exinf; 170 p_siopcb->rcv_flag = false; 171 p_siopcb->rcv_rdy = false; 172 p_siopcb->snd_flag = false; 173 p_siopcb->snd_rdy = false; 174 p_siopcb->opened = true; 175 } 176 return(p_siopcb); 177 } 178 179 /* 180 * SIOポートのクローズ 161 181 */ 162 182 void 163 183 sio_cls_por(SIOPCB *p_siopcb) 164 184 { 165 ER ercd; 166 serial_t *serial = &p_siopcb->serial; 167 168 /* 169 * デバイス依存のクローズ処理. 170 */ 171 serial_free(serial); 172 p_siopcb->openflag = false; 173 } 174 175 /* 176 * シリアルI/Oポートへの文字送信 185 int_t fd; 186 187 if (p_siopcb->opened) { 188 fd = p_siopcb->read_fd; 189 siofd_tcsetattr(fd, TCSAFLUSH, &(p_siopcb->saved_term)); 190 siofd_fcntl(fd, F_SETFL, 0); 191 192 if (p_siopcb->p_siopinib->path != NULL) { 193 siofd_close(p_siopcb->read_fd); 194 } 195 196 p_siopcb->opened = false; 197 } 198 } 199 200 /* 201 * SIOの割込みサービスルーチン 202 */ 203 bool_t 204 sio_isr_snd(ID siopid) 205 { 206 SIOPCB *p_siopcb = get_siopcb(siopid); 207 int_t n; 208 209 if (p_siopcb->snd_flag) { 210 if ((n = siofd_write(p_siopcb->write_fd, &(p_siopcb->snd_buf), 1)) > 0) { 211 p_siopcb->snd_flag = false; 212 if (p_siopcb->snd_rdy) { 213 sio_irdy_snd(p_siopcb->exinf); 214 return p_siopcb->snd_rdy; 215 } 216 } 217 } 218 219 return false; 220 } 221 222 /* 223 * SIOの割込みサービスルーチン 224 */ 225 bool_t 226 sio_isr_rcv(ID siopid, char c) 227 { 228 SIOPCB *p_siopcb = get_siopcb(siopid); 229 230 if (!p_siopcb->rcv_flag) { 231 p_siopcb->rcv_buf = c; 232 p_siopcb->rcv_flag = true; 233 if (p_siopcb->rcv_rdy) { 234 sio_irdy_rcv(p_siopcb->exinf); 235 return p_siopcb->rcv_rdy; 236 } 237 } 238 239 return false; 240 } 241 242 /* 243 * SIOポートへの文字送信 177 244 */ 178 245 bool_t 179 246 sio_snd_chr(SIOPCB *p_siopcb, char c) 180 247 { 181 serial_t *serial = &p_siopcb->serial; 182 if (!serial_writable(serial)) 183 return false; 184 serial_putc(serial, c); 185 return true; 186 } 187 188 /* 189 * シリアルI/Oポートからの文字受信 248 int_t n; 249 250 if (!p_siopcb->snd_flag) { 251 if ((n = siofd_write(p_siopcb->write_fd, &c, 1)) > 0) { 252 return(true); 253 } 254 else { 255 assert(n < 0 && errno == EAGAIN); 256 p_siopcb->snd_flag = true; 257 p_siopcb->snd_buf = c; 258 return(true); 259 } 260 } 261 else { 262 return(false); 263 } 264 } 265 266 /* 267 * SIOポートからの文字受信 190 268 */ 191 269 int_t 192 270 sio_rcv_chr(SIOPCB *p_siopcb) 193 271 { 194 serial_t *serial = &p_siopcb->serial; 195 if (!serial_readable(serial)) 196 return -1; 197 return serial_getc(serial); 198 } 199 200 /* 201 * シリアルI/Oポートからのコールバックの許可 272 char c; 273 int_t n; 274 275 if (p_siopcb->rcv_flag) { 276 p_siopcb->rcv_flag = false; 277 return((int_t)(uint8_t)(p_siopcb->rcv_buf)); 278 } 279 else if ((n = siofd_read(p_siopcb->read_fd, &c, 1)) > 0) { 280 return((int_t)(uint8_t) c); 281 } 282 else { 283 assert(n < 0 && errno == EAGAIN); 284 return(-1); 285 } 286 } 287 288 /* 289 * SIOポートからのコールバックの許可 202 290 */ 203 291 void 204 292 sio_ena_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 205 293 { 206 serial_t *serial = &p_siopcb->serial;207 294 switch (cbrtn) { 208 295 case SIO_RDY_SND: 209 serial_irq_set(serial, TxIrq, true);296 p_siopcb->snd_rdy = true; 210 297 break; 211 298 case SIO_RDY_RCV: 212 serial_irq_set(serial, RxIrq, true);299 p_siopcb->rcv_rdy = true; 213 300 break; 214 301 } … … 216 303 217 304 /* 218 * シリアルI/Oポートからのコールバックの禁止305 * SIOポートからのコールバックの禁止 219 306 */ 220 307 void 221 308 sio_dis_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 222 309 { 223 serial_t *serial = &p_siopcb->serial;224 310 switch (cbrtn) { 225 311 case SIO_RDY_SND: 226 serial_irq_set(serial, TxIrq, false);312 p_siopcb->snd_rdy = false; 227 313 break; 228 314 case SIO_RDY_RCV: 229 serial_irq_set(serial, RxIrq, false);315 p_siopcb->rcv_rdy = false; 230 316 break; 231 317 } 232 318 } 233 234 /*235 * シリアルI/Oポートからの送信可能コールバック236 */237 void238 serial_irdy_snd(SIOPCB *p_siopcb)239 {240 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/241 sio_irdy_snd(p_siopcb->exinf);242 }243 244 /*245 * シリアルI/Oポートからの受信通知コールバック246 */247 void248 serial_irdy_rcv(SIOPCB *p_siopcb)249 {250 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/251 sio_irdy_rcv(p_siopcb->exinf);252 }253 254 /*255 * SIOの割込みハンドラ256 */257 void258 mbed_serial_irq_handler(uint32_t siopid, SerialIrq event)259 {260 SIOPCB *p_siopcb;261 262 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0]))))263 return;264 p_siopcb = get_siopcb(siopid);265 266 if (!p_siopcb->openflag)267 return;268 269 switch (event) {270 case TxIrq:271 serial_irdy_snd(p_siopcb);272 break;273 case RxIrq:274 serial_irdy_rcv(p_siopcb);275 break;276 }277 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.cfg
r374 r387 4 4 5 5 #include <target_serial.h> 6 6 //INCLUDE("unix_sigio.cfg"); 7 7 ATT_INI({ TA_NULL, 0, sio_initialize }); 8 8 ATT_TER({ TA_NULL, 0, sio_terminate }); 9 //CRE_ISR( ISR_SIO, { TA_NULL, 0, INTNO_SIGIO, sio_isr, ISRPRI_SIO }); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.h
r374 r387 4 4 * Advanced Standard Profile Kernel 5 5 * 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 * Toyohashi Univ. of Technology, JAPAN 8 * Copyright (C) 2003-2004 by Naoki Saito 9 * Nagoya Municipal Industrial Research Institute, JAPAN 10 * Copyright (C) 2003-2004 by Platform Development Center 11 * RICOH COMPANY,LTD. JAPAN 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 6 * Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory 7 * Graduate School of Information Science, Nagoya Univ., JAPAN 14 8 * 15 9 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 46 40 47 41 /* 48 * シリアル I/Oデバイス(SIO)ドライバ(GR-CITRUS用)42 * シリアルインタフェースドライバのターゲット依存部(GR-CITRUS用) 49 43 */ 50 44 … … 53 47 54 48 #include "gr_citrus.h" 55 #include "serial_api.h"49 #include <t_stddef.h> 56 50 57 #define SIO_RDY_SND 1 58 #define SIO_RDY_RCV 2 51 /* 52 * SIOポート数の定義 53 */ 54 //#define TNUM_SIOP 1 /* サポートするSIOポートの数 */ 55 56 /* 57 * SIO割込みを登録するための定義 58 */ 59 #define ISRPRI_SIO 1 /* SIOの割込みサービスルーチンのISR優先度 */ 59 60 60 61 #ifndef TOPPERS_MACRO_ONLY 61 62 62 typedef struct sio_port_control_block SIOPCB; 63 /* 64 * SIOポート管理ブロックの定義 65 */ 66 typedef struct sio_port_control_block SIOPCB; 67 68 /* 69 * コールバックルーチンの識別番号 70 */ 71 #define SIO_RDY_SND 1U /* 送信可能コールバック */ 72 #define SIO_RDY_RCV 2U /* 受信通知コールバック */ 63 73 64 74 /* … … 68 78 69 79 /* 70 * シリアルI/Oポートのオープン 80 * SIOドライバの終了処理 81 */ 82 extern void sio_terminate(intptr_t exinf); 83 84 /* 85 * SIOポートのオープン 71 86 */ 72 87 extern SIOPCB *sio_opn_por(ID siopid, intptr_t exinf); 73 88 74 89 /* 75 * シリアルI/Oポートのクローズ90 * SIOポートのクローズ 76 91 */ 77 92 extern void sio_cls_por(SIOPCB *p_siopcb); 78 93 79 94 /* 80 * シリアルI/Oポートへの文字送信 95 * SIOの割込みサービスルーチン 96 */ 97 extern bool_t sio_isr_snd(ID siopid); 98 99 /* 100 * SIOの割込みサービスルーチン 101 */ 102 extern bool_t sio_isr_rcv(ID siopid, char c); 103 104 /* 105 * SIOポートへの文字送信 81 106 */ 82 107 extern bool_t sio_snd_chr(SIOPCB *siopcb, char c); 83 108 84 109 /* 85 * シリアルI/Oポートからの文字受信110 * SIOポートからの文字受信 86 111 */ 87 112 extern int_t sio_rcv_chr(SIOPCB *siopcb); 88 113 89 114 /* 90 * シリアルI/Oポートからのコールバックの許可115 * SIOポートからのコールバックの許可 91 116 */ 92 117 extern void sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn); 93 118 94 119 /* 95 * シリアルI/Oポートからのコールバックの禁止120 * SIOポートからのコールバックの禁止 96 121 */ 97 122 extern void sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn); 98 123 99 124 /* 100 * シリアルI/Oポートからの送信可能コールバック125 * SIOポートからの送信可能コールバック 101 126 */ 102 127 extern void sio_irdy_snd(intptr_t exinf); 103 128 104 129 /* 105 * シリアルI/Oポートからの受信通知コールバック130 * SIOポートからの受信通知コールバック 106 131 */ 107 132 extern void sio_irdy_rcv(intptr_t exinf); 108 133 109 110 134 #endif /* TOPPERS_MACRO_ONLY */ 111 135 #endif /* TOPPERS_TARGET_SERIAL_H */ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_syssvc.h
r374 r387 80 80 #define TARGET_NAME "GR-CITRUS" 81 81 82 82 #ifdef TOPPERS_OMIT_TECS 83 83 /* 84 84 * システムログの低レベル出力のための文字出力 … … 87 87 */ 88 88 extern void target_fput_log( char c ); 89 89 #endif 90 90 91 91 /* … … 94 94 */ 95 95 #ifdef PRC_COPYRIGHT 96 #define 96 #define TARGET_COPYRIGHT PRC_COPYRIGHT 97 97 #endif /* PRC_COPYRIGHT */ 98 98 … … 101 101 * シリアルポート数の定義 102 102 */ 103 #define 103 #define TNUM_PORT UINT_C( 2 ) 104 104 105 105 /* 106 106 * 使用するシリアルポートID 107 107 */ 108 #define 108 #define SIO_PORTID UINT_C( 1 ) 109 109 110 110 #define LOGTASK_PORTID SIO_PORTID -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_timer.c
r364 r387 398 398 */ 399 399 if (probe_int(INTNO_TIMER1)) { 400 if 400 if(local_cnt < 0x8000) 401 401 local_eut += 1; 402 402 } 403 403 404 404 time = (((HRTCNT)local_eut * CMCOR_PERIOD) + (HRTCNT)local_cnt) / USEC_CONVERT_VALUE; 405 405 #ifdef _MSC_VER 406 // シミュレーションではタイマーが戻らないよう調整 407 if (time < current_hrtcnt) 408 time = current_hrtcnt + ((HRTCNT)local_cnt / USEC_CONVERT_VALUE); 409 #endif 406 410 return time; 407 411 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/Makefile.target
r374 r387 25 25 # システムサービスに関する定義 26 26 # 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed 28 SYSSVC_COBJS := $(SYSSVC_COBJS) 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed $(SRCDIR)/syssvc/tlsf 28 SYSSVC_COBJS := $(SYSSVC_COBJS) musl_adapter.o tlsf.o 29 29 30 30 # -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target.cdl
r337 r387 60 60 * ターゲット依存のセルタイプの定義 61 61 */ 62 import(" tPutLogGRSakura.cdl");62 import("syssvc/tPutLogSIOPort.cdl"); 63 63 import("tSIOPortGRSakura.cdl"); 64 64 … … 72 72 * 低レベル出力の組み上げ記述 73 73 */ 74 cell tPutLog GRSakuraPutLogTarget {74 cell tPutLogSIOPort PutLogTarget { 75 75 /* SIOドライバとの結合 */ 76 76 cSIOPort = SIOPortTarget1.eSIOPort; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_kernel.cfg
r337 r387 5 5 */ 6 6 INCLUDE("target_timer.cfg") 7 INCLUDE("syssvc/musl_adapter.cfg") -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_kernel_impl.c
r374 r387 54 54 #ifdef TOPPERS_OMIT_TECS 55 55 #include "serial_api.h" 56 #include "target_syssvc.h" 56 57 #endif 57 58 … … 86 87 * シリアルポートの設定 87 88 */ 88 serial_init(&log_serial, P20, P21);89 serial_init(&log_serial, STDIO_UART_TX, STDIO_UART_RX); 89 90 serial_baud(&log_serial, UART_BAUDRATE); 90 91 serial_format(&log_serial, 8, ParityNone, 1); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.c
r374 r387 3 3 * Toyohashi Open Platform for Embedded Real-Time Systems/ 4 4 * Advanced Standard Profile Kernel 5 * 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 * Toyohashi Univ. of Technology, JAPAN 8 * Copyright (C) 2003-2004 by Naoki Saito 9 * Nagoya Municipal Industrial Research Institute, JAPAN 10 * Copyright (C) 2003-2004 by Platform Development Center 11 * RICOH COMPANY,LTD. JAPAN 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 14 * 5 * 6 * Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory 7 * Graduate School of Information Science, Nagoya Univ., JAPAN 8 * 15 9 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 16 10 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 … … 35 29 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 36 30 * 免責すること. 37 * 31 * 38 32 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 39 33 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 … … 41 35 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 42 36 * の責任を負わない. 43 * 37 * 44 38 * @(#) $Id$ 45 39 */ 46 40 47 41 /* 48 * RX630 UART用シリアルI/Oモジュール 49 */ 50 #include "kernel_impl.h" 51 #include <sil.h> 42 * シリアルインタフェースドライバのターゲット依存部(GR-SAKURA用) 43 */ 44 45 #include "gr_sakura.h" 46 #include <t_stddef.h> 47 #include <t_syslog.h> 48 #include <errno.h> 49 #include <unistd.h> 50 #include <fcntl.h> 51 #include <termios.h> 52 52 #include "target_serial.h" 53 #include "hal/serial_api.h" 54 #include "target_syssvc.h" 55 #include "syssvc/serial.h" 56 57 /* 58 * シリアルI/Oポート初期化ブロックの定義 53 #include "syssvc/siofd.h" 54 55 /* 56 * SIOポート初期化ブロックの定義 59 57 */ 60 58 typedef struct sio_port_initialization_block { 61 PinName tx; 62 PinName rx; 59 char *path; /* ファイルのパス名 */ 63 60 } SIOPINIB; 64 61 65 62 /* 66 * シリアルI/Oポート管理ブロックの定義63 * SIOポート管理ブロックの定義 67 64 */ 68 65 struct sio_port_control_block { 69 const SIOPINIB *p_siopinib; 70 intptr_t exinf; 71 bool_t openflag; 72 serial_t serial; 66 const SIOPINIB *p_siopinib; /* SIOポート初期化ブロック */ 67 intptr_t exinf; /* 拡張情報 */ 68 bool_t opened; /* オープン済みフラグ */ 69 struct termios saved_term; /* 元の端末制御情報 */ 70 71 int_t read_fd; /* 読出し用ファイルディスクリプタ */ 72 bool_t rcv_flag; /* 受信文字バッファ有効フラグ */ 73 char rcv_buf; /* 受信文字バッファ */ 74 bool_t rcv_rdy; /* 受信通知コールバック許可フラグ */ 75 76 int_t write_fd; /* 書込み用ファイルディスクリプタ */ 77 bool_t snd_flag; /* 送信文字バッファ有効フラグ */ 78 char snd_buf; /* 送信文字バッファ */ 79 bool_t snd_rdy; /* 送信通知コールバック許可フラグ */ 73 80 }; 74 81 75 82 /* 76 * シリアルI/Oポート管理ブロックのエリア 77 */ 78 SIOPCB siopcb_table[TNUM_PORT]; 79 80 static const SIOPINIB siopinib_table[TNUM_SIOP] = 81 { 82 { P20, P21 }, 83 #if TNUM_SIOP > 1 84 { P32, P33 }, 85 #endif 86 #if TNUM_SIOP > 2 87 { P50, P52 }, 88 #endif 89 #if TNUM_SIOP > 3 90 { P23, P25 }, 91 #endif 92 #if TNUM_SIOP > 4 93 { PC3, PC2 }, 94 #endif 95 #if TNUM_SIOP > 5 96 { PC7, PC6 }, 97 #endif 98 #if TNUM_SIOP > 6 99 { P26, P30 }, 100 #endif 83 * SIOポート初期化ブロック 84 */ 85 const SIOPINIB siopinib_table[TNUM_SIOP] = { 86 { NULL } 101 87 }; 102 88 103 89 /* 104 * シリアルI/OポートIDから管理ブロックを取り出すためのマクロ 105 */ 106 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 107 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 108 #define get_siopinib(siopid) (&(siopinib_table[INDEX_SIOP(siopid)])) 109 110 static void mbed_serial_irq_handler(uint32_t id, SerialIrq event); 90 * SIOポート管理ブロックのエリア 91 */ 92 SIOPCB siopcb_table[TNUM_SIOP]; 93 94 /* 95 * SIOポートIDから管理ブロックを取り出すためのマクロ 96 */ 97 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 98 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 111 99 112 100 /* … … 120 108 121 109 /* 122 * シリアルI/Oポート管理ブロックの初期化110 * SIOポート管理ブロックの初期化 123 111 */ 124 for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) { 112 for (i = 0; i < TNUM_SIOP; i++) { 113 p_siopcb = &(siopcb_table[i]); 125 114 p_siopcb->p_siopinib = &(siopinib_table[i]); 126 p_siopcb->openflag = false; 127 } 128 } 129 130 /* 131 * シリアルI/Oポートのオープン 115 p_siopcb->opened = false; 116 } 117 } 118 119 /* 120 * SIOドライバの終了処理 121 */ 122 void 123 sio_terminate(intptr_t exinf) 124 { 125 uint_t i; 126 127 /* 128 * オープンされているSIOポートのクローズ 129 */ 130 for (i = 0; i < TNUM_SIOP; i++) { 131 sio_cls_por(&(siopcb_table[i])); 132 } 133 } 134 135 /* 136 * SIOポートのオープン 132 137 */ 133 138 SIOPCB * 134 139 sio_opn_por(ID siopid, intptr_t exinf) 135 140 { 136 SIOPCB *p_siopcb = NULL; 137 ER ercd; 138 serial_t *serial; 139 140 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 141 return NULL; 141 SIOPCB *p_siopcb; 142 const SIOPINIB *p_siopinib; 143 int_t fd; 144 struct termios term; 145 142 146 p_siopcb = get_siopcb(siopid); 143 144 if (p_siopcb->openflag) 145 return NULL; 146 p_siopcb->openflag = true; 147 p_siopcb->exinf = exinf; 148 149 serial = &p_siopcb->serial; 150 serial_init(serial, p_siopcb->p_siopinib->tx, p_siopcb->p_siopinib->rx); 151 serial_baud(serial, UART_BAUDRATE); 152 serial_format(serial, 8, ParityNone, 1); 153 154 serial_irq_handler(serial, mbed_serial_irq_handler, siopid); 155 156 return p_siopcb; 157 } 158 159 /* 160 * シリアルI/Oポートのクローズ 147 p_siopinib = p_siopcb->p_siopinib; 148 149 if (!(p_siopcb->opened)) { 150 if (p_siopinib->path != NULL) { 151 fd = siofd_open(p_siopinib->path, O_RDWR, 0777); 152 assert(fd >= 0); 153 p_siopcb->read_fd = fd; 154 p_siopcb->write_fd = fd; 155 } 156 else { 157 fd = STDIN_FILENO; /* 標準入出力を使う */ 158 p_siopcb->read_fd = STDIN_FILENO; 159 p_siopcb->write_fd = STDOUT_FILENO; 160 } 161 siofd_fcntl(fd, F_SETOWN, getpid()); 162 siofd_fcntl(fd, F_SETFL, (O_NONBLOCK | O_ASYNC)); 163 164 siofd_tcgetattr(fd, &(p_siopcb->saved_term)); 165 term = p_siopcb->saved_term; 166 term.c_lflag &= ~(ECHO | ICANON); 167 siofd_tcsetattr(fd, TCSAFLUSH, &term); 168 169 p_siopcb->exinf = exinf; 170 p_siopcb->rcv_flag = false; 171 p_siopcb->rcv_rdy = false; 172 p_siopcb->snd_flag = false; 173 p_siopcb->snd_rdy = false; 174 p_siopcb->opened = true; 175 } 176 return(p_siopcb); 177 } 178 179 /* 180 * SIOポートのクローズ 161 181 */ 162 182 void 163 183 sio_cls_por(SIOPCB *p_siopcb) 164 184 { 165 ER ercd; 166 serial_t *serial = &p_siopcb->serial; 167 168 /* 169 * デバイス依存のクローズ処理. 170 */ 171 serial_free(serial); 172 p_siopcb->openflag = false; 173 } 174 175 /* 176 * シリアルI/Oポートへの文字送信 185 int_t fd; 186 187 if (p_siopcb->opened) { 188 fd = p_siopcb->read_fd; 189 siofd_tcsetattr(fd, TCSAFLUSH, &(p_siopcb->saved_term)); 190 siofd_fcntl(fd, F_SETFL, 0); 191 192 if (p_siopcb->p_siopinib->path != NULL) { 193 siofd_close(p_siopcb->read_fd); 194 } 195 196 p_siopcb->opened = false; 197 } 198 } 199 200 /* 201 * SIOの割込みサービスルーチン 202 */ 203 bool_t 204 sio_isr_snd(ID siopid) 205 { 206 SIOPCB *p_siopcb = get_siopcb(siopid); 207 int_t n; 208 209 if (p_siopcb->snd_flag) { 210 if ((n = siofd_write(p_siopcb->write_fd, &(p_siopcb->snd_buf), 1)) > 0) { 211 p_siopcb->snd_flag = false; 212 if (p_siopcb->snd_rdy) { 213 sio_irdy_snd(p_siopcb->exinf); 214 return p_siopcb->snd_rdy; 215 } 216 } 217 } 218 219 return false; 220 } 221 222 /* 223 * SIOの割込みサービスルーチン 224 */ 225 bool_t 226 sio_isr_rcv(ID siopid, char c) 227 { 228 SIOPCB *p_siopcb = get_siopcb(siopid); 229 230 if (!p_siopcb->rcv_flag) { 231 p_siopcb->rcv_buf = c; 232 p_siopcb->rcv_flag = true; 233 if (p_siopcb->rcv_rdy) { 234 sio_irdy_rcv(p_siopcb->exinf); 235 return p_siopcb->rcv_rdy; 236 } 237 } 238 239 return false; 240 } 241 242 /* 243 * SIOポートへの文字送信 177 244 */ 178 245 bool_t 179 246 sio_snd_chr(SIOPCB *p_siopcb, char c) 180 247 { 181 serial_t *serial = &p_siopcb->serial; 182 if (!serial_writable(serial)) 183 return false; 184 serial_putc(serial, c); 185 return true; 186 } 187 188 /* 189 * シリアルI/Oポートからの文字受信 248 int_t n; 249 250 if (!p_siopcb->snd_flag) { 251 if ((n = siofd_write(p_siopcb->write_fd, &c, 1)) > 0) { 252 return(true); 253 } 254 else { 255 assert(n < 0 && errno == EAGAIN); 256 p_siopcb->snd_flag = true; 257 p_siopcb->snd_buf = c; 258 return(true); 259 } 260 } 261 else { 262 return(false); 263 } 264 } 265 266 /* 267 * SIOポートからの文字受信 190 268 */ 191 269 int_t 192 270 sio_rcv_chr(SIOPCB *p_siopcb) 193 271 { 194 serial_t *serial = &p_siopcb->serial; 195 if (!serial_readable(serial)) 196 return -1; 197 return serial_getc(serial); 198 } 199 200 /* 201 * シリアルI/Oポートからのコールバックの許可 272 char c; 273 int_t n; 274 275 if (p_siopcb->rcv_flag) { 276 p_siopcb->rcv_flag = false; 277 return((int_t)(uint8_t)(p_siopcb->rcv_buf)); 278 } 279 else if ((n = siofd_read(p_siopcb->read_fd, &c, 1)) > 0) { 280 return((int_t)(uint8_t) c); 281 } 282 else { 283 assert(n < 0 && errno == EAGAIN); 284 return(-1); 285 } 286 } 287 288 /* 289 * SIOポートからのコールバックの許可 202 290 */ 203 291 void 204 292 sio_ena_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 205 293 { 206 serial_t *serial = &p_siopcb->serial;207 294 switch (cbrtn) { 208 295 case SIO_RDY_SND: 209 serial_irq_set(serial, TxIrq, true);296 p_siopcb->snd_rdy = true; 210 297 break; 211 298 case SIO_RDY_RCV: 212 serial_irq_set(serial, RxIrq, true);299 p_siopcb->rcv_rdy = true; 213 300 break; 214 301 } … … 216 303 217 304 /* 218 * シリアルI/Oポートからのコールバックの禁止305 * SIOポートからのコールバックの禁止 219 306 */ 220 307 void 221 308 sio_dis_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 222 309 { 223 serial_t *serial = &p_siopcb->serial;224 310 switch (cbrtn) { 225 311 case SIO_RDY_SND: 226 serial_irq_set(serial, TxIrq, false);312 p_siopcb->snd_rdy = false; 227 313 break; 228 314 case SIO_RDY_RCV: 229 serial_irq_set(serial, RxIrq, false);315 p_siopcb->rcv_rdy = false; 230 316 break; 231 317 } 232 318 } 233 234 /*235 * シリアルI/Oポートからの送信可能コールバック236 */237 void238 serial_irdy_snd(SIOPCB *p_siopcb)239 {240 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/241 sio_irdy_snd(p_siopcb->exinf);242 }243 244 /*245 * シリアルI/Oポートからの受信通知コールバック246 */247 void248 serial_irdy_rcv(SIOPCB *p_siopcb)249 {250 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/251 sio_irdy_rcv(p_siopcb->exinf);252 }253 254 /*255 * SIOの割込みハンドラ256 */257 void258 mbed_serial_irq_handler(uint32_t siopid, SerialIrq event)259 {260 SIOPCB *p_siopcb;261 262 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0]))))263 return;264 p_siopcb = get_siopcb(siopid);265 266 if (!p_siopcb->openflag)267 return;268 269 switch (event) {270 case TxIrq:271 serial_irdy_snd(p_siopcb);272 break;273 case RxIrq:274 serial_irdy_rcv(p_siopcb);275 break;276 }277 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.cfg
r374 r387 4 4 5 5 #include <target_serial.h> 6 6 //INCLUDE("unix_sigio.cfg"); 7 7 ATT_INI({ TA_NULL, 0, sio_initialize }); 8 8 ATT_TER({ TA_NULL, 0, sio_terminate }); 9 //CRE_ISR( ISR_SIO, { TA_NULL, 0, INTNO_SIGIO, sio_isr, ISRPRI_SIO }); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.h
r374 r387 4 4 * Advanced Standard Profile Kernel 5 5 * 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 * Toyohashi Univ. of Technology, JAPAN 8 * Copyright (C) 2003-2004 by Naoki Saito 9 * Nagoya Municipal Industrial Research Institute, JAPAN 10 * Copyright (C) 2003-2004 by Platform Development Center 11 * RICOH COMPANY,LTD. JAPAN 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 6 * Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory 7 * Graduate School of Information Science, Nagoya Univ., JAPAN 14 8 * 15 9 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 46 40 47 41 /* 48 * シリアル I/Oデバイス(SIO)ドライバ(GR-SAKURA用)42 * シリアルインタフェースドライバのターゲット依存部(GR-SAKURA用) 49 43 */ 50 44 … … 53 47 54 48 #include "gr_sakura.h" 55 #include "serial_api.h"49 #include <t_stddef.h> 56 50 57 #define SIO_RDY_SND 1 58 #define SIO_RDY_RCV 2 51 /* 52 * SIOポート数の定義 53 */ 54 //#define TNUM_SIOP 1 /* サポートするSIOポートの数 */ 55 56 /* 57 * SIO割込みを登録するための定義 58 */ 59 #define ISRPRI_SIO 1 /* SIOの割込みサービスルーチンのISR優先度 */ 59 60 60 61 #ifndef TOPPERS_MACRO_ONLY 61 62 62 typedef struct sio_port_control_block SIOPCB; 63 /* 64 * SIOポート管理ブロックの定義 65 */ 66 typedef struct sio_port_control_block SIOPCB; 67 68 /* 69 * コールバックルーチンの識別番号 70 */ 71 #define SIO_RDY_SND 1U /* 送信可能コールバック */ 72 #define SIO_RDY_RCV 2U /* 受信通知コールバック */ 63 73 64 74 /* … … 68 78 69 79 /* 70 * シリアルI/Oポートのオープン 80 * SIOドライバの終了処理 81 */ 82 extern void sio_terminate(intptr_t exinf); 83 84 /* 85 * SIOポートのオープン 71 86 */ 72 87 extern SIOPCB *sio_opn_por(ID siopid, intptr_t exinf); 73 88 74 89 /* 75 * シリアルI/Oポートのクローズ90 * SIOポートのクローズ 76 91 */ 77 92 extern void sio_cls_por(SIOPCB *p_siopcb); 78 93 79 94 /* 80 * シリアルI/Oポートへの文字送信 95 * SIOの割込みサービスルーチン 96 */ 97 extern bool_t sio_isr_snd(ID siopid); 98 99 /* 100 * SIOの割込みサービスルーチン 101 */ 102 extern bool_t sio_isr_rcv(ID siopid, char c); 103 104 /* 105 * SIOポートへの文字送信 81 106 */ 82 107 extern bool_t sio_snd_chr(SIOPCB *siopcb, char c); 83 108 84 109 /* 85 * シリアルI/Oポートからの文字受信110 * SIOポートからの文字受信 86 111 */ 87 112 extern int_t sio_rcv_chr(SIOPCB *siopcb); 88 113 89 114 /* 90 * シリアルI/Oポートからのコールバックの許可115 * SIOポートからのコールバックの許可 91 116 */ 92 117 extern void sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn); 93 118 94 119 /* 95 * シリアルI/Oポートからのコールバックの禁止120 * SIOポートからのコールバックの禁止 96 121 */ 97 122 extern void sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn); 98 123 99 124 /* 100 * シリアルI/Oポートからの送信可能コールバック125 * SIOポートからの送信可能コールバック 101 126 */ 102 127 extern void sio_irdy_snd(intptr_t exinf); 103 128 104 129 /* 105 * シリアルI/Oポートからの受信通知コールバック130 * SIOポートからの受信通知コールバック 106 131 */ 107 132 extern void sio_irdy_rcv(intptr_t exinf); 108 133 109 110 134 #endif /* TOPPERS_MACRO_ONLY */ 111 135 #endif /* TOPPERS_TARGET_SERIAL_H */ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_syssvc.h
r374 r387 80 80 #define TARGET_NAME "GR-SAKURA" 81 81 82 82 #ifdef TOPPERS_OMIT_TECS 83 83 /* 84 84 * システムログの低レベル出力のための文字出力 … … 87 87 */ 88 88 extern void target_fput_log( char c ); 89 89 #endif 90 90 91 91 /* … … 94 94 */ 95 95 #ifdef PRC_COPYRIGHT 96 #define 96 #define TARGET_COPYRIGHT PRC_COPYRIGHT 97 97 #endif /* PRC_COPYRIGHT */ 98 98 … … 101 101 * シリアルポート数の定義 102 102 */ 103 #define 103 #define TNUM_PORT UINT_C( 2 ) 104 104 105 105 /* 106 106 * 使用するシリアルポートID 107 107 */ 108 #define 108 #define SIO_PORTID UINT_C( 1 ) 109 109 110 110 #define LOGTASK_PORTID SIO_PORTID -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_timer.c
r364 r387 403 403 404 404 time = (((HRTCNT)local_eut * CMCOR_PERIOD) + (HRTCNT)local_cnt) / USEC_CONVERT_VALUE; 405 405 #ifdef _MSC_VER 406 // シミュレーションではタイマーが戻らないよう調整 407 if (time < current_hrtcnt) 408 time = current_hrtcnt + ((HRTCNT)local_cnt / USEC_CONVERT_VALUE); 409 #endif 406 410 return time; 407 411 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.tab.rb
r374 r387 277 277 @@n_warning += 1 278 278 locale = @@current_locale[ @@generator_nest ] 279 Console.puts " warning: #{locale[0]}: line #{locale[1]}#{msg}"279 Console.puts "#{locale[0]}:#{locale[1]}: warning: #{msg}" 280 280 end 281 281 … … 284 284 @@n_info += 1 285 285 locale = @@current_locale[ @@generator_nest ] 286 Console.puts " info: #{locale[0]}: line #{locale[1]}#{msg}"286 Console.puts "#{locale[0]}:#{locale[1]}: info: #{msg}" 287 287 end 288 288 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.y.rb
r374 r387 1040 1040 1041 1041 if locale then 1042 Console.puts " error: #{locale[0]}: line #{locale[1]}#{msg}"1042 Console.puts "#{locale[0]}:#{locale[1]}: error: #{msg}" 1043 1043 else 1044 1044 Console.puts "error: #{msg}" … … 1050 1050 @@n_warning += 1 1051 1051 locale = @@current_locale[ @@generator_nest ] 1052 Console.puts " warning: #{locale[0]}: line #{locale[1]}#{msg}"1052 Console.puts "#{locale[0]}:#{locale[1]}: warning: #{msg}" 1053 1053 end 1054 1054 … … 1057 1057 @@n_info += 1 1058 1058 locale = @@current_locale[ @@generator_nest ] 1059 Console.puts " info: #{locale[0]}: line #{locale[1]}#{msg}"1059 Console.puts "#{locale[0]}:#{locale[1]}: info: #{msg}" 1060 1060 end 1061 1061 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/in_itron.h
r364 r387 131 131 extern ER_UINT udp6_snd_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout); 132 132 extern ER_UINT udp6_rcv_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout); 133 extern ER udp6_can_cep(ID cepid, FN fncd); 133 134 134 135 /* 【拡張機能】 */ … … 139 140 extern ER udp_cre_cep (ID cepid, T_UDP_CCEP *pk_ccep); 140 141 142 extern ER udp6_del_cep(ID cepid); 143 extern ER udp6_set_opt(ID cepid, int_t optname, void *optval, int_t optlen); 144 extern ER udp6_get_opt(ID cepid, int_t optname, void *optval, int_t optlen); 141 145 extern ER udp6_cre_cep (ID cepid, T_UDP6_CCEP *pk_ccep); 142 146 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/tcp_input.c
r364 r387 521 521 522 522 /* 相手のアドレスをコピーする。*/ 523 524 #if defined(_IP6_CFG) && defined(_IP4_CFG) 525 526 if (cep->flags & TCP_CEP_FLG_IPV4) { 527 (*cep->p_dstaddr4).ipaddr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]); 528 (*cep->p_dstaddr4).portno = cep->dstaddr.portno; 529 } 530 else 531 *cep->p_dstaddr = cep->dstaddr; 532 533 #else /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */ 534 523 535 *cep->p_dstaddr = cep->dstaddr; 536 537 #endif /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */ 524 538 525 539 if (IS_PTR_DEFINED(cep->callback)) { … … 847 861 848 862 /* 相手のアドレスをコピーする。*/ 863 864 #if defined(_IP6_CFG) && defined(_IP4_CFG) 865 866 if (cep->flags & TCP_CEP_FLG_IPV4) { 867 (*cep->p_dstaddr4).ipaddr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]); 868 (*cep->p_dstaddr4).portno = cep->dstaddr.portno; 869 } 870 else 871 *cep->p_dstaddr = cep->dstaddr; 872 873 #else /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */ 874 849 875 *cep->p_dstaddr = cep->dstaddr; 876 877 #endif /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */ 850 878 851 879 if (IS_PTR_DEFINED(cep->callback)) { -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/tcpn_usrreq.c
r337 r387 671 671 cep->p_myaddr4 = p_myaddr; 672 672 cep->p_dstaddr = NULL; 673 cep->p_myaddr = N ULL;673 cep->p_myaddr = NADR; 674 674 675 675 #else /* of #if API_PROTO == API_PROTO_IPV4 */ 676 676 677 677 cep->p_dstaddr4 = NULL; 678 cep->p_myaddr4 = N ULL;678 cep->p_myaddr4 = NADR; 679 679 cep->p_dstaddr = p_dstaddr; 680 680 cep->p_myaddr = p_myaddr; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/udp_output.c
r337 r387 182 182 #if defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0 183 183 184 for (ix = tmax_udp6_cepid; ix -- > 0; ) {184 for (ix = TNUM_UDP6_CEPID - 1; ix -- > 0; ) { 185 185 186 186 if (udp6_cep[ix].flags & UDP_CEP_FLG_POST_OUTPUT) { … … 194 194 #if defined(_IP4_CFG) && TNUM_UDP4_CEPID > 0 195 195 196 for (ix = tmax_udp4_cepid; ix -- > 0; ) {196 for (ix = TNUM_UDP4_CEPID - 1; ix -- > 0; ) { 197 197 198 198 if (udp4_cep[ix].flags & UDP_CEP_FLG_POST_OUTPUT) { -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/udp_subr.c
r337 r387 146 146 #define UDP_FIND_CEP udp6_find_cep 147 147 #define UDP_NOTIFY udp6_notify 148 #define TMAX_UDP_CEPID tmax_udp6_cepid148 #define TMAX_UDP_CEPID (TNUM_UDP6_CEPID - 1) 149 149 #define UDP_CEP udp6_cep 150 150 #define T_UDP_CEP T_UDP6_CEP … … 183 183 #define UDP_FIND_CEP udp4_find_cep 184 184 #define UDP_NOTIFY udp4_notify 185 #define TMAX_UDP_CEPID tmax_udp4_cepid185 #define TMAX_UDP_CEPID (TNUM_UDP4_CEPID - 1) 186 186 #define T_UDP_CEP T_UDP4_CEP 187 187 #define UDP_CEP udp4_cep -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c
r364 r387 308 308 else 309 309 error = UDP_ALLOC_PORT(cep, pk_ccep->myaddr.portno); 310 311 if (error == E_OK) { 312 313 /* UDP 通信端点生成情報をコピーする。*/ 314 cep->cepatr = pk_ccep->cepatr; /* 通信端点属性 */ 315 cep->myaddr.ipaddr = pk_ccep->myaddr.ipaddr; /* 自分のアドレス */ 316 cep->callback = (void*)pk_ccep->callback; /* コールバック */ 317 318 /* UDP 通信端点を生成済みにする。*/ 319 cep->flags |= UDP_CEP_FLG_VALID; 320 } 321 } 310 311 if (error == E_OK) { 312 /* UDP 通信端点生成情報をコピーする。*/ 313 cep->cepatr = pk_ccep->cepatr; /* 通信端点属性 */ 314 cep->myaddr.ipaddr = pk_ccep->myaddr.ipaddr; /* 自分のアドレス */ 315 cep->callback = (void*)pk_ccep->callback; /* コールバック */ 316 317 /* UDP 通信端点を生成済みにする。*/ 318 cep->flags |= UDP_CEP_FLG_VALID; 319 } 320 } 322 321 323 322 /* 通信端点のロックを解除する。*/ -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/Debug/Makefile
r374 r387 58 58 LIBS = $(SRCDIR)/../musl-1.1.18/Debug/libmusl.a \ 59 59 $(SRCDIR)/../btstack/Debug/libbtstack.a \ 60 $(SRCDIR)/../usbhost/Debug/libusbhost.a 60 $(SRCDIR)/../usbhost/Debug/libusbhost.a \ 61 $(SRCDIR)/../zlib-1.2.11/Debug/libzlib.a 61 62 endif 62 63 ifeq ($(SRCLANG),c++) … … 185 186 CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES) 186 187 187 APPLDIRS := $(APPLDIRS) ../../ntshell/ tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src188 APPL_COBJS := $(APPL_COBJS) ntshell_main.o fdtable.o io_stub.o ffarch.o diskio.o ff.o mmc_rspi.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.o188 APPLDIRS := $(APPLDIRS) ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 189 APPL_COBJS := $(APPL_COBJS) ntshell_main.o fdtable.o stdio_stub.o io_stub.o ffarch.o diskio.o ff.o mmc_rspi.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 189 190 190 191 # -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/main.c
r374 r387 54 54 #include "ffarch.h" 55 55 #include "ff.h" 56 #include "core/ntshell.h"57 #include "core/ntlibc.h"58 56 #include <stdio.h> 59 57 #include "usrcmd.h" 60 #include "util/ntopt.h"61 58 #include "gpio_api.h" 62 59 #include "usb_hbth.h" -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/main.cdl
r337 r387 22 22 * ターゲット依存部の取り込み 23 23 */ 24 import(" target.cdl");24 import("ntshell.cdl"); 25 25 26 26 /* -
asp3_tinet_ecnl_rx/trunk/curl-7.57.0/lib/curl_config.h
r364 r387 4 4 /* Location of default ca bundle */ 5 5 /* #undef CURL_CA_BUNDLE */ 6 #define CURL_CA_BUNDLE "0:/certs/ca-bundle.crt" 6 7 7 8 /* define "1" to use built in CA store of SSL library */ -
asp3_tinet_ecnl_rx/trunk/curl-7.57.0/lib/easy.c
r337 r387 166 166 #endif 167 167 168 #ifdef __c2__169 #define malloc musl_malloc170 #define free musl_free171 #define realloc musl_realloc172 #define calloc musl_calloc173 #endif174 175 168 #ifndef __SYMBIAN32__ 176 169 /* -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/include/bits/alltypes.h
r374 r387 1 #if defined(_MSC_VER) || defined(__c2__)2 #define asctime musl_asctime3 #define calloc musl_calloc4 #define clock musl_clock5 #define close musl_close6 #define execvp musl_execvp7 #define exit musl_exit8 #define fclose musl_fclose9 #define fdopen musl_fdopen10 #define fflush musl_fflush11 #define fma _musl_fma12 #define fgetc musl_fgetc13 #define fopen musl_fopen14 #define fprintf musl_fprintf15 #define fputc musl_fputc16 #define free musl_free17 #define fwrite musl_fwrite18 #define getcwd musl_getcwd19 #define localtime musl_localtime20 #define lseek musl_lseek21 #define malloc musl_malloc22 #define memmove musl_memmove23 #define open musl_open24 #define perror musl_perror25 #define printf musl_printf26 #define read musl_read27 #define realloc musl_realloc28 #define strftime musl_strftime29 #define strnlen musl_strnlen30 #define strtoul musl_strtoul31 #define time musl_time32 #define tzset musl_tzset33 #define unlink musl_unlink34 #define strncmp musl_strncmp35 #define strtol musl_strtol36 #define strchr musl_strchr37 #endif38 1 #ifdef _MSC_VER 39 2 #define __builtin_va_list char * -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/include/math.h
r364 r387 15 15 #define NAN __builtin_nanf("") 16 16 #define INFINITY __builtin_inff() 17 #el if !defined(_MSC_VER)17 #else 18 18 #define NAN (0.0f/0.0f) 19 19 #define INFINITY 1e5000f 20 #else21 #define _HUGE_ENUF 1e+30022 #define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))23 #define NAN ((float)(INFINITY * 0.0F))24 20 #endif 25 21 -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/include/stddef.h
r337 r387 11 11 #define __NEED_size_t 12 12 #define __NEED_wchar_t 13 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L13 #if __STDC_VERSION__ >= 201112L || (defined(__cplusplus) && __cplusplus >= 201103L) 14 14 #define __NEED_max_align_t 15 15 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/locale/__lctrans.c
r337 r387 8 8 } 9 9 10 #ifndef __c2__11 10 weak_alias(dummy, __lctrans_impl); 12 #endif13 11 14 12 const char *__lctrans(const char *msg, const struct __locale_map *lm) -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/locale/__mo_lookup.c
r337 r387 4 4 static inline uint32_t swapc(uint32_t x, int c) 5 5 { 6 return c ? x>>24 | x>>8&0xff00 | x<<8&0xff0000 | x<<24: x;6 return c ? (x>>24) | (x>>8&0xff00) | (x<<8&0xff0000) | (x<<24) : x; 7 7 } 8 8 -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/locale/iconv.c
r337 r387 136 136 { 137 137 e &= 3; 138 return s[e]+0U<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3];138 return (s[e]+0U)<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3]; 139 139 } 140 140 … … 156 156 unsigned x = c - 128 - map[-1]; 157 157 x = legacy_chars[ map[x*5/4]>>2*x%8 | 158 map[x*5/4+1]<<8-2*x%8 & 1023];158 (map[x*5/4+1]<<(8-2*x%8) & 1023) ]; 159 159 return x ? x : c; 160 160 } … … 348 348 c += (0xa1-0x81); 349 349 d += 0xa1; 350 if (c >= 93 || c>=0xc6-0x81 && d>0x52)350 if (c >= 93 || (c>=0xc6-0x81 && d>0x52)) 351 351 goto ilseq; 352 352 if (d-'A'<26) d = d-'A'; -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/locale/locale_map.c
r337 r387 36 36 37 37 if (!*val) { 38 ( val = getenv("LC_ALL")) && *val||39 ( val = getenv(envvars[cat])) && *val||40 ( val = getenv("LANG")) && *val||38 ((val = getenv("LC_ALL")) && *val) || 39 ((val = getenv(envvars[cat])) && *val) || 40 ((val = getenv("LANG")) && *val) || 41 41 (val = "C.UTF-8"); 42 42 } -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/malloc/memalign.c
r337 r387 46 46 footer = ((size_t *)end)[-2]; 47 47 48 ((size_t *)mem)[-1] = header&7| new-mem;49 ((size_t *)new)[-2] = footer&7| new-mem;50 ((size_t *)new)[-1] = header&7| end-new;51 ((size_t *)end)[-2] = footer&7| end-new;48 ((size_t *)mem)[-1] = (header&7) | new-mem; 49 ((size_t *)new)[-2] = (footer&7) | new-mem; 50 ((size_t *)new)[-1] = (header&7) | end-new; 51 ((size_t *)end)[-2] = (footer&7) | end-new; 52 52 53 53 free(mem); -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/math/fma.c
r337 r387 70 70 if (d < 64) { 71 71 zlo = nz.m<<d; 72 zhi = nz.m>> 64-d;72 zhi = nz.m>>(64-d); 73 73 } else { 74 74 zlo = 0; … … 78 78 if (d == 0) { 79 79 } else if (d < 64) { 80 rlo = rhi<< 64-d | rlo>>d | !!(rlo<<64-d);80 rlo = rhi<<(64-d) | rlo>>d | !!(rlo<<(64-d)); 81 81 rhi = rhi>>d; 82 82 } else { … … 91 91 zlo = nz.m; 92 92 } else if (d < 64) { 93 zlo = nz.m>>d | !!(nz.m<< 64-d);93 zlo = nz.m>>d | !!(nz.m<<(64-d)); 94 94 } else { 95 95 zlo = 1; … … 123 123 d = a_clz_64(rhi)-1; 124 124 /* note: d > 0 */ 125 rhi = rhi<<d | rlo>> 64-d| !!(rlo<<d);125 rhi = rhi<<d | rlo>>(64-d) | !!(rlo<<d); 126 126 } else if (rlo) { 127 127 d = a_clz_64(rlo)-1; … … 174 174 /* only round once when scaled */ 175 175 d = 10; 176 i = ( rhi>>d | !!(rhi<< 64-d) ) << d;176 i = ( rhi>>d | !!(rhi<<(64-d)) ) << d; 177 177 if (sign) 178 178 i = -i; -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/network/lookup_name.c
r337 r387 11 11 #include <pthread.h> 12 12 #include <errno.h> 13 #include <resolv.h> 13 14 #include "lookup.h" 14 15 #include "stdio_impl.h" … … 185 186 if (dots >= conf.ndots || name[l-1]=='.') *search = 0; 186 187 188 /* Strip final dot for canon, fail if multiple trailing dots. */ 189 if (name[l-1]=='.') l--; 190 if (!l || name[l-1]=='.') return EAI_NONAME; 191 187 192 /* This can never happen; the caller already checked length. */ 188 193 if (l >= 256) return EAI_NONAME; … … 311 316 if (!cnt && !(flags & AI_NUMERICHOST)) { 312 317 cnt = name_from_hosts(buf, canon, name, family); 313 if ( !cnt) cnt = name_from_dns_search(buf, canon, name, family);318 if (cnt<=0) cnt = name_from_dns_search(buf, canon, name, family); 314 319 } 315 320 if (cnt<=0) return cnt ? cnt : EAI_NONAME; … … 352 357 * So far the label/precedence table cannot be customized. */ 353 358 for (i=0; i<cnt; i++) { 359 int family = buf[i].family; 354 360 int key = 0; 355 struct sockaddr_in6 sa , da= {361 struct sockaddr_in6 sa6 = { 0 }, da6 = { 356 362 .sin6_family = AF_INET6, 357 363 .sin6_scope_id = buf[i].scopeid, 358 364 .sin6_port = 65535 359 365 }; 360 if (buf[i].family == AF_INET6) { 361 memcpy(da.sin6_addr.s6_addr, buf[i].addr, 16); 366 struct sockaddr_in sa4 = { 0 }, da4 = { 367 .sin_family = AF_INET, 368 .sin_port = 65535 369 }; 370 void *sa, *da; 371 socklen_t salen, dalen; 372 if (family == AF_INET6) { 373 memcpy(da6.sin6_addr.s6_addr, buf[i].addr, 16); 374 da = &da6; dalen = sizeof da6; 375 sa = &sa6; salen = sizeof sa6; 362 376 } else { 363 memcpy( da.sin6_addr.s6_addr,377 memcpy(sa6.sin6_addr.s6_addr, 364 378 "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 365 memcpy(da.sin6_addr.s6_addr+12, buf[i].addr, 4); 366 } 367 const struct policy *dpolicy = policyof(&da.sin6_addr); 368 int dscope = scopeof(&da.sin6_addr); 379 memcpy(da6.sin6_addr.s6_addr+12, buf[i].addr, 4); 380 memcpy(da6.sin6_addr.s6_addr, 381 "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 382 memcpy(da6.sin6_addr.s6_addr+12, buf[i].addr, 4); 383 memcpy(&da4.sin_addr, buf[i].addr, 4); 384 da = &da4; dalen = sizeof da4; 385 sa = &sa4; salen = sizeof sa4; 386 } 387 const struct policy *dpolicy = policyof(&da6.sin6_addr); 388 int dscope = scopeof(&da6.sin6_addr); 369 389 int dlabel = dpolicy->label; 370 390 int dprec = dpolicy->prec; 371 391 int prefixlen = 0; 372 int fd = socket( AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP);392 int fd = socket(family, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP); 373 393 if (fd >= 0) { 374 if (!connect(fd, (void *)&da, sizeof da)) {394 if (!connect(fd, da, dalen)) { 375 395 key |= DAS_USABLE; 376 if (!getsockname(fd, (void *)&sa, 377 &(socklen_t){sizeof sa})) { 378 if (dscope == scopeof(&sa.sin6_addr)) 396 if (!getsockname(fd, sa, &salen)) { 397 if (family == AF_INET) memcpy( 398 sa6.sin6_addr.s6_addr+12, 399 &sa4.sin_addr, 4); 400 if (dscope == scopeof(&sa6.sin6_addr)) 379 401 key |= DAS_MATCHINGSCOPE; 380 if (dlabel == labelof(&sa .sin6_addr))402 if (dlabel == labelof(&sa6.sin6_addr)) 381 403 key |= DAS_MATCHINGLABEL; 382 prefixlen = prefixmatch(&sa .sin6_addr,383 &da .sin6_addr);404 prefixlen = prefixmatch(&sa6.sin6_addr, 405 &da6.sin6_addr); 384 406 } 385 407 } -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/process/vfork.c
r374 r387 15 15 } 16 16 17 #ifndef __c2__18 17 weak_alias(__vfork, vfork); 19 #else20 pid_t vfork(void)21 {22 return __vfork();23 }24 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/signal/sigaction.c
r374 r387 61 61 } 62 62 63 #ifndef __c2__64 63 weak_alias(__sigaction, sigaction); 65 #else66 int sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)67 {68 return __sigaction(sig, sa, old);69 }70 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/stdio/__stdio_write.c
r337 r387 32 32 iov[0].iov_len -= cnt; 33 33 } 34 return -1; 34 35 } -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/stdlib/strtol.c
r374 r387 57 57 } 58 58 59 #if defined(_MSC_VER) || defined(__c2__)60 weak_alias(musl_strtol, __strtol_internal);61 weak_alias(musl_strtoul, __strtoul_internal);62 #else63 59 weak_alias(strtol, __strtol_internal); 64 60 weak_alias(strtoul, __strtoul_internal); 65 #endif66 61 weak_alias(strtoll, __strtoll_internal); 67 62 weak_alias(strtoull, __strtoull_internal); -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/string/memrchr.c
r374 r387 10 10 } 11 11 12 #ifndef __c2__13 12 weak_alias(__memrchr, memrchr); 14 #else15 void *memrchr(const void *m, int c, size_t n)16 {17 return __memrchr(m, c, n);18 }19 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/string/strchrnul.c
r374 r387 24 24 } 25 25 26 #ifndef __c2__27 26 weak_alias(__strchrnul, strchrnul); 28 #else29 char *strchrnul(const char *s, int c)30 {31 return __strchrnul(s, c);32 }33 #endif -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ffarch.c
r374 r387 84 84 ret2 = get_tim(&now); 85 85 if (ret2 != E_OK){ 86 printf("[ffarch] get_tim error: %s",86 syslog(LOG_NOTICE, "[ffarch] get_tim error: %s", 87 87 itron_strerror(ret2)); 88 88 return; … … 98 98 ret = tslp_tsk(timer); 99 99 if ((ret != E_OK) && (ret != E_TMOUT)) { 100 printf("[ffarch] tslp_tsk error: %s %d",100 syslog(LOG_NOTICE, "[ffarch] tslp_tsk error: %s %d", 101 101 itron_strerror(ret), timer); 102 102 break; … … 105 105 ret2 = get_tim(&now); 106 106 if (ret2 != E_OK) { 107 printf("[ffarch] get_tim error: %s",107 syslog(LOG_NOTICE, "[ffarch] get_tim error: %s", 108 108 itron_strerror(ret2)); 109 109 break; … … 150 150 #endif 151 151 if (romdisk_init()) { 152 printf("ROM disk (0:) OK!\n");152 syslog(LOG_NOTICE, "ROM disk (0:) OK!"); 153 153 } 154 154 else { 155 printf("ROM disk (0:) NG!\n");155 syslog(LOG_NOTICE, "ROM disk (0:) NG!"); 156 156 } 157 157 } … … 303 303 case FFS_RETRY_WAIT: 304 304 if (ffarch_retry_count == 0) { 305 printf("SD card (1:) initialize tired...\n");305 syslog(LOG_NOTICE, "SD card (1:) initialize tired..."); 306 306 307 307 ffarch_state = FFS_IDLE; … … 315 315 /* SDカードが入れられた場合 */ 316 316 if (((mmc_rspi_prev_status & STA_NODISK) != 0) && ((mmc_rspi_status() & STA_NODISK) == 0)) { 317 printf("SD card initializing ...\n");317 syslog(LOG_NOTICE, "SD card initializing ..."); 318 318 319 319 Sd.FatFs.fs_type = 0; 320 320 if (SD_begin()) { 321 printf("SD card (1:) OK!\n");321 syslog(LOG_NOTICE, "SD card (1:) OK!"); 322 322 323 323 /* uploadディレクトリを作成しておく */ … … 329 329 } 330 330 else { 331 printf("SD card (1:) NG!\n");331 syslog(LOG_NOTICE, "SD card (1:) NG!"); 332 332 ffarch_state = FFS_RETRY_WAIT; 333 333 ffarch_timer = 1000 * 1000; … … 336 336 /* SDカードが抜かれた場合 */ 337 337 else if (((mmc_rspi_prev_status & STA_NODISK) == 0) && ((mmc_rspi_status() & STA_NODISK) != 0)) { 338 printf("SD card unmount\n");338 syslog(LOG_NOTICE, "SD card unmount"); 339 339 340 340 f_mount(&Sd.FatFs, "1:", 0); -
asp3_tinet_ecnl_rx/trunk/ntshell/ntshell/util/ntstdio.c
r337 r387 224 224 handle->xi = xi; 225 225 handle->xo = xo; 226 handle->outptr = 0;227 handle->len = 0;228 226 handle->pos = 0; 229 227 handle->option = option; … … 232 230 static void _putc(ntstdio_t *handle, char c) 233 231 { 234 if (handle->outptr) {235 if ((handle->pos + 1) >= handle->len)236 return;237 handle->outptr[handle->pos] = (unsigned char)c;238 handle->pos++;239 return;240 }241 242 232 if (handle->xo) { 243 233 handle->xo(handle, (unsigned char)c); … … 291 281 } 292 282 283 struct put_buf_t { 284 char *outptr; 285 int len; 286 }; 287 288 static void put_buf(struct ntstdio_t *handle, unsigned char c) 289 { 290 struct put_buf_t *put_buf = (struct put_buf_t *)handle->exinf; 291 if ((handle->pos + 1) >= put_buf->len) 292 return; 293 put_buf->outptr[handle->pos] = (char)c; 294 handle->pos++; 295 } 296 293 297 int ntstdio_snprintf(char *buf, int len, const char *fmt, ...) 294 298 { 295 299 int result; 296 300 ntstdio_t handle; 301 struct put_buf_t exinf; 297 302 va_list arp; 298 303 /* Switch destination for memory */ 304 handle.xo = put_buf; 299 305 handle.option = 0; 300 handle.outptr = buf;301 handle.len = len;302 306 handle.pos = 0; 307 handle.exinf = &exinf; 308 exinf.outptr = buf; 309 exinf.len = len; 310 303 311 va_start(arp, fmt); 304 312 result = xvprintf(&handle, fmt, arp); … … 306 314 307 315 /* Terminate output string with a \0 */ 308 handle.outptr[handle.pos] = '\0';316 buf[handle.pos] = '\0'; 309 317 return result; 310 318 } -
asp3_tinet_ecnl_rx/trunk/ntshell/ntshell/util/ntstdio.h
r374 r387 74 74 NTSTDIO_XI xi; 75 75 NTSTDIO_XO xo; 76 char *outptr;77 int len;78 76 int pos; 79 77 unsigned int option; -
asp3_tinet_ecnl_rx/trunk/ntshell/src/fdtable.c
r374 r387 44 44 #include "syssvc/syslog.h" 45 45 #include "target_syssvc.h" 46 #ifndef NTSHELL_NO_SOCKET 47 #include <tinet_defs.h> 48 #include <tinet_config.h> 49 #include <net/net.h> 50 #include <net/net_endian.h> 51 #include <netinet/in.h> 52 #include <netinet/in_itron.h> 53 #include <tinet_nic_defs.h> 54 #include <tinet_cfg.h> 55 #include <netinet/in_var.h> 56 #include <net/ethernet.h> 57 #include <net/if6_var.h> 58 #include <net/net.h> 59 #include <net/if_var.h> 60 #include <netinet/udp.h> 61 #include <netinet/udp_var.h> 62 #include <netinet/tcp.h> 63 #include <netinet/tcp_var.h> 64 #include <net/net_buf.h> 65 #endif 66 #include "ff.h" 67 #include "socket_stub.h" 46 #include "fdtable.h" 68 47 #include "kernel_cfg.h" 69 48 #include <string.h> … … 71 50 #include "hal/serial_api.h" 72 51 73 static int stdio_close(struct SHELL_FILE *fp); 74 static size_t stdio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 75 static size_t stdio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 76 static size_t stdin_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 77 static size_t stdout_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 78 static size_t stderr_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 79 static void stdio_delete(struct SHELL_FILE *fp); 80 81 static int sio_close(struct SHELL_FILE *fp); 82 static size_t sio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 83 static size_t sio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 84 static off_t sio_seek(struct SHELL_FILE *fp, off_t ofs, int org); 85 static int sio_ioctl(struct SHELL_FILE *fp, int req, void *arg); 86 static bool_t sio_readable(struct SHELL_FILE *fp); 87 static void sio_delete(struct SHELL_FILE *fp); 88 89 IO_TYPE IO_TYPE_STDIN = { stdio_close, stdin_read, stdio_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 90 IO_TYPE IO_TYPE_STDOUT = { stdio_close, stdio_read, stdout_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 91 IO_TYPE IO_TYPE_STDERR = { stdio_close, stdio_read, stderr_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 92 IO_TYPE IO_TYPE_SIO = { sio_close, sio_read, sio_write, sio_seek, sio_ioctl, sio_readable, sio_delete }; 93 ntstdio_t ntstdio; 52 #ifdef _DEBUG 53 static const char THIS_FILE[] = __FILE__; 54 #endif 55 56 extern IO_TYPE IO_TYPE_STDIN; 57 extern IO_TYPE IO_TYPE_STDOUT; 58 extern IO_TYPE IO_TYPE_STDERR; 94 59 95 60 static struct SHELL_FILE fd_table[8 * sizeof(FLGPTN)] = { 96 { 0, &IO_TYPE_STDIN, 0, .exinf = &ntstdio},97 { 1, &IO_TYPE_STDOUT, 0, .exinf = &ntstdio},98 { 2, &IO_TYPE_STDERR, 0,.exinf = &ntstdio},61 { STDIN_FILENO, &IO_TYPE_STDIN, 0 }, 62 { STDOUT_FILENO, &IO_TYPE_STDOUT, 0 }, 63 { STDERR_FILENO, &IO_TYPE_STDERR, 0 }, 99 64 }; 100 65 #define fd_table_count (sizeof(fd_table) / sizeof(fd_table[0])) 101 102 extern ntstdio_t ntstdio;103 serial_t stdio_uart;104 105 unsigned char ntstdio_xi(struct ntstdio_t *handle)106 {107 return serial_getc((serial_t *)handle->exinf);108 }109 110 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)111 {112 serial_putc((serial_t *)handle->exinf, c);113 }114 115 void sys_init(intptr_t exinf)116 {117 sys_tlsf_init();118 119 serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX);120 serial_baud(&stdio_uart, UART_BAUDRATE);121 serial_format(&stdio_uart, 8, ParityNone, 1);122 123 ntstdio_init(&ntstdio, NTSTDIO_OPTION_LINE_ECHO | NTSTDIO_OPTION_CANON | NTSTDIO_OPTION_LF_CRLF | NTSTDIO_OPTION_LF_CR, ntstdio_xi, ntstdio_xo);124 ntstdio.exinf = (void *)&stdio_uart;125 }126 127 int stdio_close(struct SHELL_FILE *fp)128 {129 return -EPERM;130 }131 132 size_t stdio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len)133 {134 return -EPERM;135 }136 137 size_t stdio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len)138 {139 return -EPERM;140 }141 142 size_t stdin_read(struct SHELL_FILE *fp, unsigned char *data, size_t len)143 {144 int i = 0;145 while (i < len) {146 int c = ntstdio_getc((struct ntstdio_t *)fp->exinf);147 data[i++] = c;148 if ((c == EOF) || (c == '\n'))149 break;150 }151 return i;152 }153 154 size_t stdout_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len)155 {156 for (int i = 0; i < len; i++) {157 ntstdio_putc((struct ntstdio_t *)fp->exinf, data[i]);158 }159 return len;160 }161 162 size_t stderr_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len)163 {164 for (int i = 0; i < len; i++) {165 ntstdio_putc((struct ntstdio_t *)fp->exinf, data[i]);166 }167 return len;168 }169 170 void stdio_delete(struct SHELL_FILE *fp)171 {172 }173 174 int sio_close(struct SHELL_FILE *fp)175 {176 return -EPERM;177 }178 179 size_t sio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len)180 {181 return -EPERM;182 }183 184 size_t sio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len)185 {186 return -EPERM;187 }188 189 off_t sio_seek(struct SHELL_FILE *fp, off_t ofs, int org)190 {191 return -EPERM;192 }193 194 int sio_ioctl(struct SHELL_FILE *fp, int request, void *arg)195 {196 switch (request) {197 case TIOCGWINSZ:198 return 0;199 case TCGETS:200 return sio_tcgetattr(fp->fd, (struct termios *)arg);201 case TCSETS + TCSANOW:202 case TCSETS + TCSADRAIN:203 case TCSETS + TCSAFLUSH:204 return sio_tcsetattr(fp->fd, request - TCSETS, (const struct termios *)arg);205 }206 207 return -EINVAL;208 }209 210 bool_t sio_readable(struct SHELL_FILE *fp)211 {212 return fp->readevt_w != fp->readevt_r;213 }214 215 void sio_delete(struct SHELL_FILE *fp)216 {217 free((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf);218 ((struct ntstdio_t *)fp->exinf)->exinf = NULL;219 free((struct ntstdio_t *)fp->exinf);220 fp->exinf = NULL;221 }222 66 223 67 struct SHELL_FILE *new_fp(IO_TYPE *type, int id, int writable) … … 247 91 if (ret < 0) { 248 92 syslog(LOG_ERROR, "sig_sem => %d", ret); 93 } 94 95 if (fp != NULL) { 96 FLGPTN flgptn = 0; 97 98 FD_SET(fp->fd, (fd_set *)&flgptn); 99 100 ret = clr_flg(FLG_SELECT_WAIT, ~flgptn); 101 if (ret != E_OK) { 102 syslog(LOG_ERROR, "clr_flg => %d", ret); 103 } 249 104 } 250 105 … … 442 297 } 443 298 444 /* TODO:コールバック化したい */445 void stdio_update_evts()446 {447 int fd = STDIN_FILENO;448 struct SHELL_FILE *fp = &fd_table[fd];449 FLGPTN flgptn = 0;450 451 if (serial_readable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) {452 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;453 454 FD_SET(fd, (fd_set *)&flgptn);455 }456 if (serial_writable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) {457 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++;458 459 FD_SET(fd, (fd_set *)&flgptn);460 }461 462 if (flgptn != 0) {463 set_flg(FLG_SELECT_WAIT, flgptn);464 }465 }466 467 /* TODO:コールバック化したい */468 void stdio_flgptn(FLGPTN *flgptn)469 {470 int fd = STDIN_FILENO;471 struct SHELL_FILE *fp = &fd_table[fd];472 *flgptn = 0;473 474 if (serial_readable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) {475 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;476 477 FD_SET(fd, (fd_set *)flgptn);478 }479 if (serial_writable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) {480 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++;481 482 FD_SET(fd, (fd_set *)flgptn);483 }484 }485 486 299 ER shell_get_evts(struct fd_events *evts, TMO tmout) 487 300 { 488 301 int count = 0; 489 302 SYSTIM prev, now; 303 FLGPTN flgptn; 490 304 491 305 get_tim(&prev); … … 493 307 for (;;) { 494 308 ER ret; 495 FLGPTN waitptn, flgptn,readfds = 0, writefds = 0;309 FLGPTN waitptn, readfds = 0, writefds = 0; 496 310 struct SHELL_FILE *fp = NULL; 497 498 stdio_update_evts();499 311 500 312 #ifndef NTSHELL_NO_SOCKET … … 506 318 fp = &fd_table[fd]; 507 319 508 #ifndef NTSHELL_NO_SOCKET509 320 if (FD_ISSET(fd, &evts->readfds)) { 510 321 if (fp->type->readable(fp)) { … … 517 328 } 518 329 } 519 #endif 330 520 331 if (FD_ISSET(fd, &evts->writefds)) { 521 if (fp-> writeevt_w == fp->writeevt_r) {332 if (fp->type->writable(fp)) { 522 333 FD_SET(fd, (fd_set *)&writefds); 523 334 count++; … … 549 360 return ret; 550 361 } 551 552 stdio_flgptn(&flgptn); 553 554 if (flgptn == 0) 555 return E_TMOUT; 556 } 557 flgptn &= waitptn; 558 559 /* 受け取ったフラグのみクリア */ 560 ret = clr_flg(FLG_SELECT_WAIT, ~flgptn); 561 if (ret != E_OK) { 562 syslog(LOG_ERROR, "clr_flg => %d", ret); 362 } 363 364 if (flgptn != 0) { 365 flgptn &= waitptn; 366 367 /* 受け取ったフラグのみクリア */ 368 ret = clr_flg(FLG_SELECT_WAIT, ~flgptn); 369 if (ret != E_OK) { 370 syslog(LOG_ERROR, "clr_flg => %d", ret); 371 } 563 372 } 564 373 565 374 count = 0; 566 375 for (int fd = 0; fd < fd_table_count; fd++) { 567 if (!FD_ISSET(fd, (fd_set *)&waitptn))568 continue;569 570 376 fp = &fd_table[fd]; 571 377 572 378 if (fp->readevt_w != fp->readevt_r) { 573 379 fp->readevt_r++; 574 FD_SET(fd, &evts->readfds); 380 if (FD_ISSET(fd, (fd_set *)&waitptn)) 381 FD_SET(fd, &evts->readfds); 575 382 count++; 576 383 } 577 384 if (fp->writeevt_w != fp->writeevt_r) { 578 385 fp->writeevt_r++; 579 fp->writable = 1; 580 } 581 if (fp->writable) { 582 FD_SET(fd, &evts->writefds); 386 if (FD_ISSET(fd, (fd_set *)&waitptn)) 387 FD_SET(fd, &evts->writefds); 583 388 count++; 584 389 } 585 390 if (fp->errorevt_w != fp->errorevt_r) { 586 391 fp->errorevt_r++; 587 FD_SET(fd, &evts->errorfds); 392 if (FD_ISSET(fd, (fd_set *)&waitptn)) 393 FD_SET(fd, &evts->errorfds); 588 394 count++; 589 395 } 590 396 } 591 397 592 if ( count > 0)398 if ((flgptn == 0) || (count > 0)) 593 399 break; 594 400 … … 596 402 597 403 SYSTIM elapse = now - prev; 598 if (elapse > tmout) 599 return E_TMOUT; 404 if (elapse > tmout) { 405 flgptn = 0; 406 break; 407 } 600 408 601 409 prev = now; … … 605 413 evts->count = count; 606 414 607 return E_OK;415 return (flgptn == 0) ? E_TMOUT : E_OK; 608 416 } 609 417 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/fdtable.h
r386 r387 38 38 #define SOCKET_STUB_H 39 39 40 struct addrinfo {41 int ai_flags;42 int ai_family;43 int ai_socktype;44 int ai_protocol;45 socklen_t ai_addrlen;46 struct sockaddr *ai_addr;47 char *ai_canonname;48 struct addrinfo *ai_next;49 };50 51 typedef uint16_t in_port_t;52 typedef uint32_t in_addr_t;53 struct in_addr { in_addr_t s_addr; };54 55 struct sockaddr_in {56 sa_family_t sin_family;57 in_port_t sin_port;58 struct in_addr sin_addr;59 uint8_t sin_zero[8];60 };61 62 struct in6_addr63 {64 union {65 uint8_t __s6_addr[16];66 uint16_t __s6_addr16[8];67 uint32_t __s6_addr32[4];68 } __in6_union;69 };70 //#define s6_addr __in6_union.__s6_addr71 //#define s6_addr16 __in6_union.__s6_addr1672 //#define s6_addr32 __in6_union.__s6_addr3273 74 struct sockaddr_in675 {76 sa_family_t sin6_family;77 in_port_t sin6_port;78 uint32_t sin6_flowinfo;79 struct in6_addr sin6_addr;80 uint32_t sin6_scope_id;81 };82 83 typedef struct socket_t {84 int family;85 int type;86 int protocol;87 int cepid;88 int repid;89 int backlog;90 unsigned int flags;91 union {92 struct sockaddr_in laddr4;93 struct sockaddr_in6 laddr6;94 };95 union {96 struct sockaddr_in raddr4;97 struct sockaddr_in6 raddr6;98 };99 int buf_size;100 unsigned char *buf;101 void *input;102 int len;103 } socket_t;104 105 struct SHELL_DIR {106 FATFS_DIR dir;107 struct dirent dirent;108 };109 110 40 typedef const struct io_type_s IO_TYPE; 111 41 … … 131 61 int (*ioctl)(struct SHELL_FILE *, int, void *); 132 62 bool_t (*readable)(struct SHELL_FILE *); 63 bool_t (*writable)(struct SHELL_FILE *); 133 64 void (*delete)(struct SHELL_FILE *); 134 65 }; … … 152 83 void clean_fd(); 153 84 154 void sys_tlsf_init(void);155 156 85 #endif // !SOCKET_STUB_H -
asp3_tinet_ecnl_rx/trunk/ntshell/src/io_stub.c
r374 r387 45 45 #include "syssvc/serial.h" 46 46 #include "syssvc/syslog.h" 47 #include " socket_stub.h"47 #include "fdtable.h" 48 48 #include "util/ntstdio.h" 49 49 #include "usrcmd.h" … … 51 51 #include "kernel_cfg.h" 52 52 #include "target_syssvc.h" 53 54 struct SHELL_DIR { 55 FATFS_DIR dir; 56 struct dirent dirent; 57 }; 53 58 54 59 int fresult2errno(FRESULT res) … … 85 90 static int file_ioctl(struct SHELL_FILE *fp, int req, void *arg); 86 91 static bool_t file_readable(struct SHELL_FILE *fp); 92 static bool_t file_writable(struct SHELL_FILE *fp); 87 93 static void file_delete(struct SHELL_FILE *fp); 88 94 … … 93 99 static int dir_ioctl(struct SHELL_FILE *fp, int req, void *arg); 94 100 static bool_t dir_readable(struct SHELL_FILE *fp); 101 static bool_t dir_writable(struct SHELL_FILE *fp); 95 102 static void dir_delete(struct SHELL_FILE *fp); 96 103 97 IO_TYPE IO_TYPE_FILE = { file_close, file_read, file_write, file_seek, file_ioctl, file_readable, file_ delete };98 IO_TYPE IO_TYPE_DIR = { dir_close, dir_read, dir_write, dir_seek, dir_ioctl, dir_readable, dir_ delete };104 IO_TYPE IO_TYPE_FILE = { file_close, file_read, file_write, file_seek, file_ioctl, file_readable, file_writable, file_delete }; 105 IO_TYPE IO_TYPE_DIR = { dir_close, dir_read, dir_write, dir_seek, dir_ioctl, dir_readable, dir_writable, dir_delete }; 99 106 100 107 int shell_open(const char *path, int flags, void *arg) … … 114 121 FRESULT res; 115 122 if ((res = f_opendir(dir, path)) != FR_OK) { 123 delete_fp(fp); 116 124 return fresult2errno(res); 117 125 } … … 165 173 } 166 174 175 delete_fp(fp); 167 176 return fresult2errno(res); 168 177 } … … 239 248 } 240 249 250 bool_t file_writable(struct SHELL_FILE *fp) 251 { 252 return fp->writable && (fp->writeevt_w == fp->writeevt_r); 253 } 254 241 255 void file_delete(struct SHELL_FILE *fp) 242 256 { … … 356 370 { 357 371 return shell_ioctl(fd, cmd, arg); 358 }359 360 extern IO_TYPE IO_TYPE_SIO;361 362 int sio_tcgetattr(int fd, struct termios *termios)363 {364 struct SHELL_FILE *fp = fd_to_fp(fd);365 if ((fp == NULL) || (fp->type != &IO_TYPE_SIO))366 return -EBADF;367 368 ntstdio_t *ntstdio = (ntstdio_t *)fp->exinf;369 370 memset(termios, 0, sizeof(*termios));371 372 if (ntstdio->option & NTSTDIO_OPTION_LINE_ECHO) {373 termios->c_lflag |= ECHO;374 }375 else {376 termios->c_lflag &= ~ECHO;377 }378 if (ntstdio->option & NTSTDIO_OPTION_CANON) {379 termios->c_lflag |= ICANON;380 }381 else {382 termios->c_lflag &= ~ICANON;383 }384 if (ntstdio->option & NTSTDIO_OPTION_LF_CR) {385 termios->c_iflag |= INLCR;386 }387 else {388 termios->c_iflag &= ~INLCR;389 }390 if (ntstdio->option & NTSTDIO_OPTION_LF_CRLF) {391 termios->c_oflag |= ONLCR;392 }393 else {394 termios->c_oflag &= ~ONLCR;395 }396 397 return 0;398 }399 400 int sio_tcsetattr(int fd, int optional_actions, const struct termios *termios)401 {402 struct SHELL_FILE *fp = fd_to_fp(fd);403 if ((fp == NULL) || (fp->type != &IO_TYPE_SIO))404 return -EBADF;405 406 ntstdio_t *ntstdio = (ntstdio_t *)fp->exinf;407 408 if (optional_actions == TCSANOW) {409 if (termios->c_lflag & ECHO) {410 ntstdio->option |= NTSTDIO_OPTION_LINE_ECHO;411 }412 else {413 ntstdio->option &= ~NTSTDIO_OPTION_LINE_ECHO;414 }415 if (termios->c_lflag & ICANON) {416 ntstdio->option |= NTSTDIO_OPTION_CANON;417 }418 else {419 ntstdio->option &= ~NTSTDIO_OPTION_CANON;420 }421 if (termios->c_iflag & INLCR) {422 ntstdio->option |= NTSTDIO_OPTION_LF_CR;423 }424 else {425 ntstdio->option &= ~NTSTDIO_OPTION_LF_CR;426 }427 if (termios->c_oflag & ONLCR) {428 ntstdio->option |= NTSTDIO_OPTION_LF_CRLF;429 }430 else {431 ntstdio->option &= ~NTSTDIO_OPTION_LF_CRLF;432 }433 return 0;434 }435 436 shell_abort();437 return 0;438 372 } 439 373 … … 688 622 } 689 623 624 bool_t dir_writable(struct SHELL_FILE *fp) 625 { 626 return false; 627 } 628 690 629 void dir_delete(struct SHELL_FILE *fp) 691 630 { … … 710 649 return 0; 711 650 } 712 713 #ifndef _MSC_VER714 extern uint32_t _HeapBase;715 extern uint32_t _HeapLimit;716 #else717 uint8_t _HeapBase[14 * 4096];718 #define _HeapLimit _HeapBase[sizeof(_HeapBase)]719 #endif720 721 void *shell_brk(void *addr)722 {723 if (addr == 0) {724 return (void *)(&_HeapBase);725 }726 if ((addr >= (void *)&_HeapBase) && (addr < (void *)&_HeapLimit)) {727 return addr;728 }729 return (void *)-1;730 }731 732 void *shell_mmap2(void *start, size_t length, int prot, int flags, int fd, off_t pgoffset)733 {734 if (fd != -1)735 return (void *)-EINVAL;736 737 if ((length >= 0) && (length <= sizeof(&_HeapBase))) {738 return &_HeapBase;739 }740 return (void *)-1;741 }742 743 int shell_mprotect(void *addr, size_t len, int prot)744 {745 //if ((addr >= (void *)&_HeapBase) && (addr + len < (void *)&_HeapLimit)) {746 return 0;747 //}748 //return -1;749 }750 751 #include "tlsf.h"752 753 static tlsf_t sys_tlsf;754 static pool_t sys_pool;755 756 void sys_tlsf_init(void)757 {758 sys_tlsf = tlsf_create(&_HeapBase);759 if (sys_tlsf == NULL)760 return;761 762 sys_pool = tlsf_add_pool(sys_tlsf, ((uint8_t *)&_HeapBase) + tlsf_size(), ((intptr_t)&_HeapLimit - (intptr_t)&_HeapBase) - tlsf_size());763 }764 765 void sys_fini(void)766 {767 tlsf_destroy(sys_tlsf);768 }769 770 void *malloc(size_t size)771 {772 void *result;773 wai_sem(SEM_MALLOC);774 result = tlsf_malloc(sys_tlsf, size);775 sig_sem(SEM_MALLOC);776 if (result == NULL)777 tlsf_check_pool(sys_pool);778 return result;779 }780 781 void *calloc(size_t size, size_t count)782 {783 void *result;784 wai_sem(SEM_MALLOC);785 result = tlsf_malloc(sys_tlsf, count * size);786 sig_sem(SEM_MALLOC);787 if (result != NULL)788 memset(result, 0, count * size);789 else790 tlsf_check_pool(sys_pool);791 return result;792 }793 794 void *realloc(void *ptr, size_t size)795 {796 void *result;797 wai_sem(SEM_MALLOC);798 result = tlsf_realloc(sys_tlsf, ptr, size);799 sig_sem(SEM_MALLOC);800 if (result == NULL)801 tlsf_check_pool(sys_pool);802 return result;803 }804 805 void free(void *ptr)806 {807 wai_sem(SEM_MALLOC);808 tlsf_free(sys_tlsf, ptr);809 sig_sem(SEM_MALLOC);810 }811 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/net_misc.c
r374 r387 95 95 96 96 get_tid(&nc->tskid); 97 printf("[NET MISC:%d,%d] started.", nc->tskid, (ID)exinf);97 syslog(LOG_NOTICE, "[NET MISC:%d,%d] started.", nc->tskid, (ID)exinf); 98 98 99 99 /* 初期化 */ … … 103 103 ret = get_tim(&time); 104 104 if (ret != E_OK) { 105 printf("[NET MISC,%d] get_tim error: %7lu,%s",105 syslog(LOG_NOTICE, "[NET MISC,%d] get_tim error: %7lu,%s", 106 106 nc->cepid, time / SYSTIM_HZ, itron_strerror(ret)); 107 107 return; … … 117 117 error = tslp_tsk(timer); 118 118 if ((error != E_OK) && (error != E_TMOUT)) { 119 printf("[NET MISC,%d] tslp_tsk error: %s %d",119 syslog(LOG_NOTICE, "[NET MISC,%d] tslp_tsk error: %s %d", 120 120 nc->cepid, itron_strerror(error), timer); 121 121 break; … … 124 124 ret = get_tim(&time); 125 125 if (ret != E_OK) { 126 printf("[NET MISC,%d] get_tim error: %s",126 syslog(LOG_NOTICE, "[NET MISC,%d] get_tim error: %s", 127 127 nc->cepid, itron_strerror(ret)); 128 128 break; -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntp_cli.c
r374 r387 277 277 } 278 278 279 printf("[NTP CLI,%d] recv time: %s .%09u\n",279 syslog(LOG_NOTICE, "[NTP CLI,%d] recv time: %s .%09u", 280 280 nc->cepid, nc->buf, tp.tv_nsec); 281 281 } … … 309 309 line = lookup_ipaddr(&nc->ipaddr6, NTP_SRV_URL, API_PROTO_IPV4); 310 310 if (line == NULL || !in6_is_addr_ipv4mapped(&nc->ipaddr6)) { 311 printf("[NTP CLI,%d] sleep %d.%03u[s], unknown host.",311 syslog(LOG_NOTICE, "[NTP CLI,%d] sleep %d.%03u[s], unknown host.", 312 312 nc->cepid, SLP_ITV / SYSTIM_HZ, SLP_ITV % SYSTIM_HZ); 313 313 nc->timer = SLP_ITV; … … 317 317 #else /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */ 318 318 if ((line = lookup_ipaddr(&nc->snd_rmt.ipaddr, NTP_SRV_URL, DEFAULT_API_PROTO)) == NULL) { 319 printf("[NTP CLI,%d] sleep %d.%03u[s], unknown host.",319 syslog(LOG_NOTICE, "[NTP CLI,%d] sleep %d.%03u[s], unknown host.", 320 320 nc->cepid, SLP_ITV / SYSTIM_HZ, SLP_ITV % SYSTIM_HZ); 321 321 nc->timer = SLP_ITV; … … 421 421 422 422 if ((error = udp_snd_dat(nc->cepid, &nc->snd_rmt, ntp, len, TMO_NBLK)) != E_WBLK) { 423 printf("[NTP CLI,%d] udp_snd_dat error: %s",423 syslog(LOG_NOTICE, "[NTP CLI,%d] udp_snd_dat error: %s", 424 424 nc->cepid, itron_strerror(error)); 425 425 return error; 426 426 } 427 427 else 428 syslog(LOG_DEBUG, "[NTP CLI,%d] udp_snd_dat: to: %s.%d \n",428 syslog(LOG_DEBUG, "[NTP CLI,%d] udp_snd_dat: to: %s.%d", 429 429 nc->cepid, ip2str(NULL, &nc->snd_rmt.ipaddr), nc->snd_rmt.portno); 430 430 … … 439 439 ret = get_tim(&time); 440 440 if (ret != E_OK) { 441 printf("[NTP CLI,%d] get_tim error: %s",441 syslog(LOG_NOTICE, "[NTP CLI,%d] get_tim error: %s", 442 442 nc->cepid, itron_strerror(ret)); 443 443 tp->tv_sec = 0; … … 459 459 ret = set_tim(time); 460 460 if (ret != E_OK) { 461 printf("[NTP CLI,%d] set_tim error: %s",461 syslog(LOG_NOTICE, "[NTP CLI,%d] set_tim error: %s", 462 462 nc->cepid, itron_strerror(ret)); 463 463 } … … 477 477 if (len < 0 && len != E_RLWAI) { 478 478 /* E_RLWAI 以外で、0 以下の場合は、エラーを意味している。*/ 479 printf("[NTP CLI,%d] callback error: %s, fncd: %s", nc->cepid,479 syslog(LOG_NOTICE, "[NTP CLI,%d] callback error: %s, fncd: %s", nc->cepid, 480 480 itron_strerror(len), in_strtfn(fncd)); 481 481 } … … 484 484 if ((len = udp_rcv_dat(nc->cepid, &nc->rcv_rmt, &nc->ntp_msg, len, TMO_POL)) < 0) 485 485 { 486 printf("[NTP CLI,%d] udp_rcv_dat error: %s", nc->cepid,486 syslog(LOG_NOTICE, "[NTP CLI,%d] udp_rcv_dat error: %s", nc->cepid, 487 487 itron_strerror(len)); 488 488 } … … 516 516 517 517 get_tid(&nc->tskid); 518 printf("[NTP CLI:%d,%d] started.", nc->tskid, (ID)exinf);518 syslog(LOG_NOTICE, "[NTP CLI:%d,%d] started.", nc->tskid, (ID)exinf); 519 519 520 520 /* 初期化 */ … … 523 523 ret = get_tim(&time); 524 524 if (ret != E_OK) { 525 printf("[NTP CLI,%d] get_tim error: %7lu,%s",525 syslog(LOG_NOTICE, "[NTP CLI,%d] get_tim error: %7lu,%s", 526 526 nc->cepid, time / SYSTIM_HZ, itron_strerror(ret)); 527 527 return; … … 537 537 error = tslp_tsk(timer); 538 538 if ((error != E_OK) && (error != E_TMOUT)) { 539 printf("[NTP CLI,%d] tslp_tsk error: %s %d",539 syslog(LOG_NOTICE, "[NTP CLI,%d] tslp_tsk error: %s %d", 540 540 nc->cepid, itron_strerror(error), timer); 541 541 break; … … 544 544 ret = get_tim(&time); 545 545 if (ret != E_OK) { 546 printf("[NTP CLI,%d] get_tim error: %s",546 syslog(LOG_NOTICE, "[NTP CLI,%d] get_tim error: %s", 547 547 nc->cepid, itron_strerror(ret)); 548 548 break; -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.c
r374 r387 49 49 #include "syssvc/syslog.h" 50 50 #include "target_syssvc.h" 51 #include "target_serial.h" 51 52 #include "kernel_cfg.h" 52 53 #include "ffarch.h" … … 58 59 #include "util/ntopt.h" 59 60 #include "ntshell_main.h" 60 #include " socket_stub.h"61 #include "fdtable.h" 61 62 62 63 char command[NTOPT_TEXT_MAXLEN]; … … 78 79 } 79 80 81 void stdio_open(ID portid); 80 82 static int usrcmd_ntopt_callback(long *args, void *extobj); 81 83 … … 86 88 void ntshell_task_init(ID portid) 87 89 { 88 s erial_ctl_por(portid, IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV);90 stdio_open(portid); 89 91 } 90 92 … … 95 97 { 96 98 ntshell_state = 1; 97 ntshell_exit_code = ntopt_parse(command, usrcmd_ntopt_callback, NULL); 99 100 if (setjmp(process_exit) == 0) { 101 ntshell_exit_code = ntopt_parse(command, usrcmd_ntopt_callback, NULL); 102 } 103 104 fflush(stdout); 105 clean_fd(); 106 98 107 ntshell_state = 2; 99 108 } … … 139 148 printf("Unknown command found.\n"); 140 149 141 clean_fd();142 143 150 return result; 144 151 } … … 285 292 } 286 293 287 struct sigaction sigtable[7]; 288 289 int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old) 290 { 291 struct sigaction *sat; 294 // musl-1.1.18\src\internal\ksigaction.h 295 struct k_sigaction { 296 void(*handler)(int); 297 unsigned long flags; 298 void(*restorer)(void); 299 unsigned mask[2]; 300 }; 301 302 struct k_sigaction sigtable[7]; 303 304 int shell_sigaction(int sig, const struct k_sigaction *__restrict sa, 305 struct k_sigaction *__restrict old, size_t size) 306 { 307 struct k_sigaction *sat; 292 308 293 309 switch(sig){ … … 318 334 319 335 if (old != NULL) 320 memcpy(old, sat, sizeof(struct sigaction));321 322 memcpy(sat, sa, sizeof(struct sigaction));336 memcpy(old, sat, offsetof(struct k_sigaction, mask) + size); 337 338 memcpy(sat, sa, offsetof(struct k_sigaction, mask) + size); 323 339 324 340 return 0; … … 368 384 } 369 385 386 int shell_nanosleep(const struct timespec *req, struct timespec *rem) 387 { 388 ER ret; 389 TMO tmo; 390 SYSTIM prev, now, diff; 391 392 if ((req == NULL) || (req->tv_nsec < 0) || (req->tv_nsec >= 1000000000)) 393 return -EINVAL; 394 395 get_tim(&prev); 396 397 tmo = req->tv_sec * 1000000 + req->tv_nsec / 1000; 398 ret = tslp_tsk(tmo); 399 if (ret == E_OK) { 400 if (rem != NULL) { 401 get_tim(&now); 402 diff = now - prev; 403 rem->tv_sec = diff / 1000000ll; 404 rem->tv_nsec = (diff - (rem->tv_sec * 1000000ll)) * 1000ll; 405 } 406 return 0; 407 } 408 else if (ret == E_TMOUT) { 409 if (rem != NULL) { 410 rem->tv_sec = 0; 411 rem->tv_nsec = 0; 412 } 413 return 0; 414 } 415 416 return -EFAULT; 417 } -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.cfg
r374 r387 46 46 CRE_FLG(FLG_SELECT_WAIT, { TA_WMUL, 0x00 }); 47 47 CRE_SEM(SEM_FILEDESC, { TA_TPRI, 1, 1 }); 48 CRE_SEM(SEM_MALLOC, { TA_TPRI, 1, 1 }); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/shellif.h
r374 r387 74 74 #define NCCS 32 75 75 76 #include < bits/fcntl.h>77 #include < bits/termios.h>78 #include < bits/stat.h>76 #include <fcntl.h> 77 #include <termios.h> 78 #include <sys/stat.h> 79 79 #include <sys/select.h> 80 80 #include <time.h> … … 85 85 #include <sys/utsname.h> 86 86 #include <dirent.h> 87 #include < bits/ioctl.h>88 #include < bits/errno.h>87 #include <sys/ioctl.h> 88 #include <errno.h> 89 89 #include <sys/socket.h> 90 90 #else … … 132 132 // time.h 133 133 #define CLOCK_REALTIME 0 134 int shell_nanosleep(const struct timespec *req, struct timespec *rem); 134 135 135 136 // dirent.h … … 177 178 // signal.h 178 179 int shell_sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict old); 179 int shell_sigaction(int sig, const struct sigaction *__restrict sa, struct sigaction *__restrict old); 180 struct k_sigaction; 181 int shell_sigaction(int sig, const struct k_sigaction *__restrict sa, 182 struct k_sigaction *__restrict old, size_t size); 180 183 // socket.h 181 184 int shell_socket(int, int, int); … … 197 200 // syslog.h 198 201 void vsyslog (int, const char *, va_list); 199 // termios.h200 int sio_tcgetattr (int, struct termios *);201 int sio_tcsetattr(int, int, const struct termios *);202 202 // fcntl.h 203 203 int shell_open(const char *, int, void *arg); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/socket_stub.c
r374 r387 62 62 #include <netinet/tcp_var.h> 63 63 #include <netapp/resolver.h> 64 extern const ID tmax_tcp_cepid; 65 #include "ff.h" 66 #include "socket_stub.h" 64 #include "fdtable.h" 67 65 #include "kernel_cfg.h" 68 66 67 #ifdef _DEBUG 68 static const char THIS_FILE[] = __FILE__; 69 #endif 70 69 71 #define SOCKET_TIMEOUT 2000000 72 73 struct addrinfo { 74 int ai_flags; 75 int ai_family; 76 int ai_socktype; 77 int ai_protocol; 78 socklen_t ai_addrlen; 79 struct sockaddr *ai_addr; 80 char *ai_canonname; 81 struct addrinfo *ai_next; 82 }; 83 84 typedef uint16_t in_port_t; 85 typedef uint32_t in_addr_t; 86 struct in_addr { in_addr_t s_addr; }; 87 88 struct sockaddr_in { 89 sa_family_t sin_family; 90 in_port_t sin_port; 91 struct in_addr sin_addr; 92 uint8_t sin_zero[8]; 93 }; 94 95 struct in6_addr 96 { 97 union { 98 uint8_t __s6_addr[16]; 99 uint16_t __s6_addr16[8]; 100 uint32_t __s6_addr32[4]; 101 } __in6_union; 102 }; 103 //#define s6_addr __in6_union.__s6_addr 104 //#define s6_addr16 __in6_union.__s6_addr16 105 //#define s6_addr32 __in6_union.__s6_addr32 106 107 struct sockaddr_in6 108 { 109 sa_family_t sin6_family; 110 in_port_t sin6_port; 111 uint32_t sin6_flowinfo; 112 struct in6_addr sin6_addr; 113 uint32_t sin6_scope_id; 114 }; 115 116 typedef struct socket_t { 117 int family; 118 int type; 119 int protocol; 120 int cepid; 121 int repid; 122 int backlog; 123 unsigned int flags; 124 union { 125 struct sockaddr_in laddr4; 126 struct sockaddr_in6 laddr6; 127 }; 128 union { 129 struct sockaddr_in raddr4; 130 struct sockaddr_in6 raddr6; 131 }; 132 int buf_size; 133 unsigned char *buf; 134 void *input; 135 int len; 136 } socket_t; 70 137 71 138 #define tcp6_cre_cep tcp_cre_cep … … 82 149 #define tcp6_set_opt tcp_set_opt 83 150 84 #define udp6_del_cep udp_del_cep85 #define udp6_get_opt udp_get_opt86 #define udp6_set_opt udp_set_opt87 88 151 #ifndef SUPPORT_INET6 89 152 … … 93 156 94 157 ER udp6_cre_cep (ID cepid, T_UDP6_CCEP *pk_ccep) { return E_SYS; } 158 ER udp6_del_cep (ID cepid) { return E_SYS; } 95 159 ER_UINT udp6_snd_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout) { return E_SYS; } 96 160 ER_UINT udp6_rcv_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout) { return E_SYS; } 161 ER udp6_set_opt (ID cepid, int_t optname, void *optval, int_t optlen) { return E_SYS; } 162 ER udp6_get_opt (ID cepid, int_t optname, void *optval, int_t optlen) { return E_SYS; } 97 163 98 164 const T_IN6_ADDR *in6_get_ifaddr (int_t index) { return NULL; } … … 111 177 static int tcp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg); 112 178 static bool_t tcp_fd_readable(struct SHELL_FILE *fp); 179 static bool_t tcp_fd_writable(struct SHELL_FILE *fp); 113 180 static void tcp_fd_delete(struct SHELL_FILE *fp); 114 181 … … 119 186 static int udp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg); 120 187 static bool_t udp_fd_readable(struct SHELL_FILE *fp); 188 static bool_t udp_fd_writable(struct SHELL_FILE *fp); 121 189 static void udp_fd_delete(struct SHELL_FILE *fp); 122 190 123 IO_TYPE IO_TYPE_TCP = { tcp_fd_close, tcp_fd_read, tcp_fd_write, tcp_fd_seek, tcp_fd_ioctl, tcp_fd_readable, tcp_fd_ delete };124 IO_TYPE IO_TYPE_UDP = { udp_fd_close, udp_fd_read, udp_fd_write, udp_fd_seek, udp_fd_ioctl, udp_fd_readable, udp_fd_ delete };191 IO_TYPE IO_TYPE_TCP = { tcp_fd_close, tcp_fd_read, tcp_fd_write, tcp_fd_seek, tcp_fd_ioctl, tcp_fd_readable, tcp_fd_writable, tcp_fd_delete }; 192 IO_TYPE IO_TYPE_UDP = { udp_fd_close, udp_fd_read, udp_fd_write, udp_fd_seek, udp_fd_ioctl, udp_fd_readable, udp_fd_writable, udp_fd_delete }; 125 193 126 194 typedef struct id_table_t { … … 185 253 186 254 #endif 255 256 void addrcpy(void *_dst, const void *_src, int len) 257 { 258 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 259 memcpy(_dst, _src, len); 260 #else 261 uint8_t *dst = (uint8_t *)_dst, *src = &((uint8_t *)_src)[len]; 262 while (src != _src) 263 *dst++ = *--src; 264 #endif 265 } 187 266 188 267 ID new_id(id_table_t *table, int count) … … 347 426 } 348 427 case SOCK_DGRAM: { 349 ID cepid = new_id(udp _cepid_table, udp_cepid_table_count);428 ID cepid = new_id(udp6_cepid_table, udp6_cepid_table_count); 350 429 if (cepid < 0) 351 430 return -ENOMEM; 352 431 353 T_UDP6_CCEP ccep = { 0, { ntohl(addr_in6->sin6_addr.__in6_union.__s6_addr), ntohs(addr_in6->sin6_port)}, (FP)socket_udp6_callback };432 T_UDP6_CCEP ccep = { 0, { { ntohl(addr_in6->sin6_addr.__in6_union.__s6_addr) }, ntohs(addr_in6->sin6_port)}, (FP)socket_udp6_callback }; 354 433 ret = udp6_cre_cep(cepid, &ccep); 355 434 if (ret != E_OK) { 356 delete_id(udp _cepid_table, udp_cepid_table_count, cepid);435 delete_id(udp6_cepid_table, udp6_cepid_table_count, cepid); 357 436 return -ENOMEM; 358 437 } … … 407 486 408 487 struct sockaddr_in6 *laddr = &socket->laddr6; 409 T_TCP6_CREP crep = { 0, { ntohl(laddr->sin6_addr.__in6_union.__s6_addr), ntohs(laddr->sin6_port)} };488 T_TCP6_CREP crep = { 0, { { ntohl(laddr->sin6_addr.__in6_union.__s6_addr) }, ntohs(laddr->sin6_port)} }; 410 489 ret = tcp6_cre_rep(repid, &crep); 411 490 if (ret != E_OK) { … … 423 502 } 424 503 425 int shell_connect(int fd, const struct sockaddr *addr, socklen_t len)504 int shell_connect(int fd, const struct sockaddr *addr, socklen_t alen) 426 505 { 427 506 SOCKET *fp = fd_to_fp(fd); … … 435 514 switch (socket->family) { 436 515 case AF_INET: { 437 if ( len < 8) {516 if (alen < sizeof(struct sockaddr_in)) { 438 517 return -EINVAL; 439 518 } … … 455 534 } 456 535 fp->handle = cepid; 536 fp->writable = 1; 457 537 socket->cepid = cepid; 458 538 } 459 539 struct sockaddr_in *laddr = &socket->laddr4; 460 540 struct sockaddr_in *raddr = &socket->raddr4; 461 memset(raddr, 0, sizeof(*raddr)); 462 memcpy(raddr, addr, len); 541 memcpy(raddr, addr, sizeof(struct sockaddr_in)); 463 542 T_IPV4EP lep = { ntohl(laddr->sin_addr.s_addr), ntohs(laddr->sin_port) }; 464 543 T_IPV4EP rep = { ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port) }; 465 544 ret = tcp_con_cep(socket->cepid, &lep, &rep, SOCKET_TIMEOUT); 466 if (ret < 0) { 545 if (ret == E_TMOUT) { 546 return -ETIMEDOUT; 547 } 548 else if (ret < 0) { 467 549 return -EHOSTUNREACH; 468 550 } … … 470 552 } 471 553 case AF_INET6: { 472 if ( len < 20) {554 if (alen < sizeof(struct sockaddr_in6)) { 473 555 return -EINVAL; 474 556 } … … 490 572 } 491 573 fp->handle = cepid; 574 fp->writable = 1; 492 575 socket->cepid = cepid; 493 576 } 494 577 struct sockaddr_in6 *laddr = &socket->laddr6; 495 578 struct sockaddr_in6 *raddr = &socket->raddr6; 496 memset(raddr, 0, sizeof(*raddr)); 497 memcpy(raddr, addr, len); 498 T_IPV6EP lep = { ntohl(laddr->sin6_addr.__in6_union.__s6_addr), ntohs(laddr->sin6_port) }; 499 T_IPV6EP rep = { ntohl(raddr->sin6_addr.__in6_union.__s6_addr), ntohs(raddr->sin6_port) }; 579 memcpy(raddr, addr, sizeof(struct sockaddr_in6)); 580 T_IPV6EP lep; 581 addrcpy(&lep.ipaddr, &laddr->sin6_addr, 16); 582 lep.portno = ntohs(laddr->sin6_port); 583 T_IPV6EP rep; 584 addrcpy(&rep.ipaddr, &raddr->sin6_addr, 16); 585 rep.portno = ntohs(raddr->sin6_port); 500 586 ret = tcp6_con_cep(socket->cepid, &lep, &rep, SOCKET_TIMEOUT); 501 if (ret < 0) { 587 if (ret == E_TMOUT) { 588 return -ETIMEDOUT; 589 } 590 else if (ret < 0) { 502 591 return -EHOSTUNREACH; 503 592 } … … 508 597 } 509 598 599 if (fp->writeevt_w != fp->writeevt_r) fp->writeevt_r++; 600 510 601 return 0; 511 602 } 512 603 513 int shell_accept(int fd, struct sockaddr *__restrict addr, socklen_t *__restrict len)604 int shell_accept(int fd, struct sockaddr *__restrict addr, socklen_t *__restrict alen) 514 605 { 515 606 SOCKET *lfp = fd_to_fp(fd); … … 550 641 } 551 642 fp->handle = cepid; 643 fp->writable = 1; 552 644 socket->cepid = cepid; 553 645 } … … 555 647 cepid = ((socket_t *)lfp->exinf)->cepid; 556 648 fp->handle = cepid; 649 fp->writable = 1; 557 650 lfp->handle = tmax_tcp_cepid + ((socket_t *)lfp->exinf)->repid; 558 651 ((socket_t *)lfp->exinf)->cepid = 0; … … 566 659 } 567 660 struct sockaddr_in *raddr = &socket->raddr4; 568 memset(raddr, 0, sizeof( *raddr));661 memset(raddr, 0, sizeof(struct sockaddr_in)); 569 662 raddr->sin_family = AF_INET; 570 663 raddr->sin_port = htons(rep.portno); 571 664 raddr->sin_addr.s_addr = htonl(rep.ipaddr); 572 665 573 if (addr != NULL && len != NULL) {574 int sz = * len;575 if (sz < 8) {666 if (addr != NULL && alen != NULL) { 667 int sz = *alen; 668 if (sz < sizeof(struct sockaddr_in)) { 576 669 return -EINVAL; 577 670 } 578 671 struct sockaddr_in *raddr = &socket->raddr4; 579 if (sz > sizeof( *raddr))580 sz = sizeof( *raddr);672 if (sz > sizeof(struct sockaddr_in)) 673 sz = sizeof(struct sockaddr_in); 581 674 memcpy(addr, raddr, sz); 582 * len = sizeof(*raddr);675 *alen = sz; 583 676 } 584 677 break; … … 603 696 } 604 697 fp->handle = cepid; 698 fp->writable = 1; 605 699 socket->cepid = cepid; 606 700 } … … 608 702 cepid = ((socket_t *)lfp->exinf)->cepid; 609 703 fp->handle = cepid; 704 fp->writable = 1; 610 705 lfp->handle = tmax_tcp6_cepid + ((socket_t *)lfp->exinf)->repid; 611 706 ((socket_t *)lfp->exinf)->cepid = 0; … … 613 708 ((socket_t *)lfp->exinf)->buf = 0; 614 709 } 615 T_IPV6EP rep = { 0, 0 };710 T_IPV6EP rep = { { 0 }, 0 }; 616 711 ret = tcp6_acp_cep(socket->cepid, socket->repid, &rep, TMO_FEVR); 617 712 if (ret < 0) { … … 619 714 } 620 715 struct sockaddr_in6 *raddr = &socket->raddr6; 621 memset(raddr, 0, sizeof( *raddr));716 memset(raddr, 0, sizeof(struct sockaddr_in6)); 622 717 raddr->sin6_family = AF_INET; 623 718 raddr->sin6_port = htons(rep.portno); 624 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 625 memcpy(raddr->sin6_addr.__in6_union.__s6_addr, rep.ipaddr.__u6_addr.__u6_addr8, 16); 626 #else 627 for (int i = 0; i < 16; i++) 628 raddr->sin6_addr.__in6_union.__s6_addr[i] = rep.ipaddr.__u6_addr.__u6_addr8[i]; 629 #endif 630 631 if (addr != NULL && len != NULL) { 632 int sz = *len; 633 if (sz < 8) { 719 addrcpy(&raddr->sin6_addr, &rep.ipaddr, 16); 720 721 if (addr != NULL && alen != NULL) { 722 int sz = *alen; 723 if (sz < sizeof(struct sockaddr_in6)) { 634 724 return -EINVAL; 635 725 } 636 726 struct sockaddr_in6 *raddr = &socket->raddr6; 637 if (sz > sizeof( *raddr))638 sz = sizeof( *raddr);727 if (sz > sizeof(struct sockaddr_in6)) 728 sz = sizeof(struct sockaddr_in6); 639 729 memcpy(addr, raddr, sz); 640 * len = sizeof(*raddr);730 *alen = sz; 641 731 } 642 732 break; … … 645 735 return -ENOPROTOOPT; 646 736 } 737 738 if (fp->writeevt_w != fp->writeevt_r) fp->writeevt_r++; 647 739 648 740 return fp->fd; … … 673 765 } 674 766 else { 767 int temp = len; 675 768 for (;;) { 676 769 ret = tcp_snd_dat(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 677 770 if (ret < 0) { 678 if (ret == E_TMOUT) 679 return -ETIME; 680 return -ECOMM; 771 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 681 772 } 682 773 len -= ret; … … 685 776 buf = (const void *)&((uint8_t *)buf)[ret]; 686 777 } 778 ret = temp; 687 779 } 688 780 break; 689 781 } 690 782 case SOCK_DGRAM: { 691 int sz = alen; 692 if ((addr == NULL) || (sz < 8)) { 783 if ((addr == NULL) || (alen < sizeof(struct sockaddr_in))) { 693 784 return -EINVAL; 694 785 } 695 786 struct sockaddr_in *raddr = &socket->raddr4; 696 memset(raddr, 0, sizeof(*raddr)); 697 memcpy(raddr, addr, sz); 787 memcpy(raddr, addr, sizeof(struct sockaddr_in)); 698 788 T_IPV4EP rep = { ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port) }; 699 789 ret = udp_snd_dat(socket->cepid, &rep, (void *)buf, len, 700 790 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 701 791 if (ret < 0) { 702 return (ret == E_TMOUT) ? -E TIME: -ECOMM;792 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 703 793 } 704 794 break; … … 721 811 } 722 812 else { 813 int temp = len; 723 814 for (;;) { 724 815 ret = tcp6_snd_dat(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 725 816 if (ret < 0) { 726 if (ret == E_TMOUT) 727 return -ETIME; 728 return -ECOMM; 817 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 729 818 } 730 819 len -= ret; … … 732 821 break; 733 822 buf = (const void *)&((uint8_t *)buf)[ret]; 734 } 823 } 824 ret = temp; 735 825 } 736 826 break; 737 827 } 738 828 case SOCK_DGRAM: { 739 int sz = alen; 740 if ((addr == NULL) || (sz < 8)) { 829 if ((addr == NULL) || (alen < sizeof(struct sockaddr_in6))) { 741 830 return -EINVAL; 742 831 } 743 832 struct sockaddr_in6 *raddr = &socket->raddr6; 744 memset(raddr, 0, sizeof(*raddr)); 745 memcpy(raddr, addr, sz); 746 T_IPV6EP rep = { ntohl(raddr->sin6_addr.__in6_union.__s6_addr), ntohs(raddr->sin6_port) }; 833 memcpy(raddr, addr, sizeof(struct sockaddr_in6)); 834 T_IPV6EP rep; 835 addrcpy(&rep.ipaddr, &raddr->sin6_addr, 16); 836 rep.portno = ntohs(raddr->sin6_port); 747 837 ret = udp6_snd_dat(socket->cepid, &rep, (void *)buf, len, 748 838 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 749 839 if (ret < 0) { 750 return (ret == E_TMOUT) ? -E TIME: -ECOMM;840 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 751 841 } 752 842 break; … … 758 848 return -ENOPROTOOPT; 759 849 } 850 851 if (fp->writeevt_w != fp->writeevt_r) fp->writeevt_r++; 760 852 761 853 return ret; … … 800 892 syslog(LOG_ERROR, "sig_sem => %d", ret); 801 893 } 802 ret = tcp_rcv_buf(socket->cepid, &socket->input, TMO_FEVR); 894 ret = tcp_rcv_buf(socket->cepid, &socket->input, 895 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 803 896 if (ret < 0) { 804 syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret); 805 return -ECOMM; 897 if ((socket->flags & O_NONBLOCK) == 0) 898 syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret); 899 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 806 900 } 807 901 rsz = ret; … … 858 952 if ((socket->flags & O_NONBLOCK) == 0) 859 953 syslog(LOG_ERROR, "udp_rcv_buf => %d", ret); 860 return (ret == E_TMOUT) ? -E TIME: -ECOMM;954 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 861 955 } 862 956 rsz = ret; … … 867 961 } 868 962 int sz = *alen; 869 memset(raddr, 0, sizeof(s ocket->raddr4));963 memset(raddr, 0, sizeof(struct sockaddr_in)); 870 964 raddr->sin_family = AF_INET; 871 965 raddr->sin_port = htons(rep.portno); 872 966 raddr->sin_addr.s_addr = htonl(rep.ipaddr); 873 if (sz > sizeof(s ocket->raddr4))874 sz = sizeof(s ocket->raddr4);967 if (sz > sizeof(struct sockaddr_in)) 968 sz = sizeof(struct sockaddr_in); 875 969 memcpy(addr, raddr, sz); 876 970 *alen = sz; … … 889 983 if ((addr != NULL) && (alen != NULL)) { 890 984 int sz = *alen; 891 if (sz > sizeof(s ocket->raddr4))892 sz = sizeof(s ocket->raddr4);985 if (sz > sizeof(struct sockaddr_in)) 986 sz = sizeof(struct sockaddr_in); 893 987 memcpy(addr, raddr, sz); 894 988 *alen = sz; … … 934 1028 syslog(LOG_ERROR, "sig_sem => %d", ret); 935 1029 } 936 ret = tcp6_rcv_buf(socket->cepid, &socket->input, TMO_FEVR); 1030 ret = tcp6_rcv_buf(socket->cepid, &socket->input, 1031 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 937 1032 if (ret < 0) { 938 syslog(LOG_ERROR, "tcp6_rcv_buf => %d", ret); 939 return -ECOMM; 1033 if ((socket->flags & O_NONBLOCK) == 0) 1034 syslog(LOG_ERROR, "tcp6_rcv_buf => %d", ret); 1035 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 940 1036 } 941 1037 rsz = ret; … … 986 1082 } 987 1083 988 T_IPV6EP rep = { 0, 0 };1084 T_IPV6EP rep = { { 0 }, 0 }; 989 1085 ret = udp6_rcv_dat(socket->cepid, &rep, buf, len, 990 1086 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); … … 992 1088 if ((socket->flags & O_NONBLOCK) == 0) 993 1089 syslog(LOG_ERROR, "udp6_rcv_buf => %d", ret); 994 return (ret == E_TMOUT) ? -E TIME: -ECOMM;1090 return (ret == E_TMOUT) ? -EAGAIN : -ECOMM; 995 1091 } 996 1092 rsz = ret; … … 1001 1097 } 1002 1098 int sz = *alen; 1003 memset(raddr, 0, sizeof(s ocket->raddr6));1099 memset(raddr, 0, sizeof(struct sockaddr_in6)); 1004 1100 raddr->sin6_family = AF_INET; 1005 1101 raddr->sin6_port = htons(rep.portno); 1006 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1007 memcpy(raddr->sin6_addr.__in6_union.__s6_addr, rep.ipaddr.__u6_addr.__u6_addr8, 16); 1008 #else 1009 for (int i = 0; i < 16; i++) 1010 raddr->sin6_addr.__in6_union.__s6_addr[i] = rep.ipaddr.__u6_addr.__u6_addr8[i]; 1011 #endif 1012 if (sz > sizeof(socket->raddr6)) 1013 sz = sizeof(socket->raddr6); 1102 addrcpy(&raddr->sin6_addr, &rep.ipaddr, 16); 1103 if (sz > sizeof(struct sockaddr_in6)) 1104 sz = sizeof(struct sockaddr_in6); 1014 1105 memcpy(addr, raddr, sz); 1015 1106 *alen = sz; … … 1028 1119 if ((addr != NULL) && (alen != NULL)) { 1029 1120 int sz = *alen; 1030 if (sz > sizeof(s ocket->raddr6))1031 sz = sizeof(s ocket->raddr6);1121 if (sz > sizeof(struct sockaddr_in6)) 1122 sz = sizeof(struct sockaddr_in6); 1032 1123 memcpy(addr, raddr, sz); 1033 1124 *alen = sz; … … 1054 1145 return -ENOPROTOOPT; 1055 1146 } 1147 1148 if (fp->readevt_w != fp->readevt_r) fp->readevt_r++; 1056 1149 1057 1150 return ret; … … 1427 1520 struct sockaddr_in6 laddr; 1428 1521 laddr.sin6_family = AF_INET; 1429 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1430 memcpy(laddr.sin6_addr.__in6_union.__s6_addr, laddr6->__u6_addr.__u6_addr8, 16); 1431 #else 1432 for (int i = 0; i < 16; i++) 1433 laddr.sin6_addr.__in6_union.__s6_addr[i] = laddr6->__u6_addr.__u6_addr8[i]; 1434 #endif 1522 addrcpy(&laddr.sin6_addr, laddr6, 16); 1435 1523 laddr.sin6_port = socket->laddr6.sin6_port; 1436 1524 *len = sizeof(struct sockaddr_in6); … … 1465 1553 delete_id(tcp_cepid_table, tcp_cepid_table_count, cepid); 1466 1554 if ((ret < 0) || (ret2 < 0)) { 1467 return (ret == E_TMOUT) ? -ETIME : -EINVAL;1555 return (ret == E_TMOUT) ? -ETIMEDOUT : -EIO; 1468 1556 } 1469 1557 } … … 1494 1582 delete_id(tcp6_cepid_table, tcp6_cepid_table_count, cepid); 1495 1583 if ((ret < 0) || (ret2 < 0)) { 1496 return (ret == E_TMOUT) ? -ETIME : -EINVAL;1584 return (ret == E_TMOUT) ? -ETIMEDOUT : -EIO; 1497 1585 } 1498 1586 } … … 1535 1623 int tcp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg) 1536 1624 { 1625 socket_t *socket = (socket_t *)fp->exinf; 1626 1627 switch (req) { 1628 case F_GETFL: 1629 return socket->flags; 1630 case F_SETFL: 1631 socket->flags = (unsigned int)arg; 1632 return 0; 1633 } 1634 1537 1635 return -EINVAL; 1538 1636 } … … 1571 1669 } 1572 1670 1671 bool_t tcp_fd_writable(struct SHELL_FILE *fp) 1672 { 1673 //socket_t *socket = (socket_t *)fp->exinf; 1674 1675 return /*fp->writable &&*/ (fp->writeevt_w == fp->writeevt_r); 1676 } 1677 1573 1678 void tcp_fd_delete(struct SHELL_FILE *fp) 1574 1679 { … … 1590 1695 return E_PAR; 1591 1696 1697 socket_t *socket = (socket_t *)fp->exinf; 1592 1698 int fd = fp->fd; 1593 1699 FD_SET(fd, (fd_set *)&flgptn); … … 1603 1709 syslog(LOG_ERROR, "wai_sem => %d", ret); 1604 1710 } 1605 socket_t *socket = (socket_t *)fp->exinf;1606 1711 socket->len += len; 1607 1712 ret = sig_sem(SEM_FILEDESC); … … 1670 1775 return E_PAR; 1671 1776 1777 socket_t *socket = (socket_t *)fp->exinf; 1672 1778 int fd = fp->fd; 1673 1779 FD_SET(fd, (fd_set *)&flgptn); … … 1683 1789 syslog(LOG_ERROR, "wai_sem => %d", ret); 1684 1790 } 1685 socket_t *socket = (socket_t *)fp->exinf;1686 1791 socket->len += len; 1687 1792 ret = sig_sem(SEM_FILEDESC); … … 1806 1911 } 1807 1912 1913 bool_t udp_fd_writable(struct SHELL_FILE *fp) 1914 { 1915 //socket_t *socket = (socket_t *)fp->exinf; 1916 1917 return fp->writable && (fp->writeevt_w == fp->writeevt_r); 1918 } 1919 1808 1920 void udp_fd_delete(struct SHELL_FILE *fp) 1809 1921 { … … 1849 1961 socket->input = udppara->input; 1850 1962 socket->buf = GET_UDP_SDU(udppara->input, udppara->off); 1851 memset(&socket->raddr4, 0, sizeof(s ocket->raddr4));1963 memset(&socket->raddr4, 0, sizeof(struct sockaddr_in)); 1852 1964 socket->raddr4.sin_family = AF_INET; 1853 1965 socket->raddr4.sin_port = htons(udppara->rep4.portno); … … 1932 2044 socket->input = udppara->input; 1933 2045 socket->buf = GET_UDP_SDU(udppara->input, udppara->off); 1934 memset(&socket->raddr6, 0, sizeof(s ocket->raddr6));2046 memset(&socket->raddr6, 0, sizeof(struct sockaddr_in6)); 1935 2047 socket->raddr6.sin6_family = AF_INET; 1936 2048 socket->raddr6.sin6_port = htons(udppara->rep6.portno); 1937 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1938 memcpy(socket->raddr6.sin6_addr.__in6_union.__s6_addr, udppara->rep6.ipaddr.__u6_addr.__u6_addr8, 16); 1939 #else 1940 for (int i = 0; i < 16; i++) 1941 socket->raddr6.sin6_addr.__in6_union.__s6_addr[i] = udppara->rep6.ipaddr.__u6_addr.__u6_addr8[i]; 1942 #endif 2049 addrcpy(&socket->raddr6.sin6_addr, &udppara->rep6.ipaddr, 16); 1943 2050 udppara->input->flags |= NB_FLG_NOREL_IFOUT; 1944 2051 ret = sig_sem(SEM_FILEDESC); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/syscall.c
r374 r387 300 300 } 301 301 302 long SYS_rt_sigaction(long a, long b, long c ) {303 return shell_sigaction((int)a, (const struct sigaction *)b, (struct sigaction *)c);302 long SYS_rt_sigaction(long a, long b, long c, long d) { 303 return shell_sigaction((int)a, (const struct k_sigaction *)b, (struct k_sigaction *)c, (size_t)d); 304 304 } 305 305 … … 388 388 } 389 389 390 long SYS_nanosleep(long a, long b) 391 { 392 return shell_nanosleep((const struct timespec *)a, (struct timespec *)b); 393 } 394 390 395 long SYS_dup() 391 396 {
Note:
See TracChangeset
for help on using the changeset viewer.