revision 1077:136fc24d17ef
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1077:136fc24d17ef |
parent | 1076:18c164e8aec4 |
child | 1078:d8f1cf224e7e |
author | nkeynes |
date | Wed Oct 07 17:53:56 2009 +1000 (14 years ago) |
Create a host attachment for the SCIF serial port. By default, uses /dev/console
Add general fd listening to netutil, and rename to ioutil
Add SCIF update on port read/write - fixes KOS timing problems but needs to
be redone properly.
Add general fd listening to netutil, and rename to ioutil
Add SCIF update on port read/write - fixes KOS timing problems but needs to
be redone properly.
src/Makefile.am | view | annotate | diff | log | ||
src/Makefile.in | view | annotate | diff | log | ||
src/config.c | view | annotate | diff | log | ||
src/drivers/io_glib.c | view | annotate | diff | log | ||
src/drivers/io_osx.m | view | annotate | diff | log | ||
src/drivers/net_glib.c | view | annotate | diff | log | ||
src/drivers/net_osx.m | view | annotate | diff | log | ||
src/drivers/serial_unix.c | view | annotate | diff | log | ||
src/gdbserver.c | view | annotate | diff | log | ||
src/ioutil.c | view | annotate | diff | log | ||
src/ioutil.h | view | annotate | diff | log | ||
src/main.c | view | annotate | diff | log | ||
src/netutil.c | view | annotate | diff | log | ||
src/netutil.h | view | annotate | diff | log | ||
src/serial.h | view | annotate | diff | log | ||
src/sh4/scif.c | view | annotate | diff | log |
1.1 --- a/src/Makefile.am Mon Aug 03 08:41:11 2009 +10001.2 +++ b/src/Makefile.am Wed Oct 07 17:53:56 2009 +10001.3 @@ -44,7 +44,7 @@1.4 gettext.h mem.c mem.h sdram.c mmio.h watch.c \1.5 asic.c asic.h clock.h serial.h \1.6 syscall.c syscall.h bios.c dcload.c gdbserver.c \1.7 - netutil.c netutil.h lxpaths.c lxpaths.h \1.8 + ioutil.c ioutil.h lxpaths.c lxpaths.h \1.9 gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \1.10 gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \1.11 gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \1.12 @@ -69,6 +69,7 @@1.13 display.c display.h dckeysyms.h \1.14 drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \1.15 drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \1.16 + drivers/serial_unix.c \1.17 sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \1.18 hotkeys.c hotkeys.h1.19 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@1.20 @@ -101,14 +102,14 @@1.21 gtkui/gtk_win.c gtkui/gtkcb.c gtkui/gtk_cfg.c \1.22 gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \1.23 gtkui/gtk_ctrl.c gtkui/gtk_gd.c \1.24 - drivers/net_glib.c drivers/video_gtk.c1.25 + drivers/io_glib.c drivers/video_gtk.c1.26 endif1.28 if GUI_COCOA1.29 lxdream_SOURCES += cocoaui/cocoaui.m cocoaui/cocoaui.h cocoaui/cocoa_cfg.m \1.30 cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \1.31 cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m \1.32 - drivers/net_osx.m drivers/video_osx.m \1.33 + drivers/io_osx.m drivers/video_osx.m \1.34 drivers/mac_keymap.h drivers/mac_keymap.txt1.35 else1.36 lxdream_SOURCES += paths_unix.c
2.1 --- a/src/Makefile.in Mon Aug 03 08:41:11 2009 +10002.2 +++ b/src/Makefile.in Wed Oct 07 17:53:56 2009 +10002.3 @@ -55,12 +55,12 @@2.4 @GUI_GTK_TRUE@ gtkui/gtk_win.c gtkui/gtkcb.c gtkui/gtk_cfg.c \2.5 @GUI_GTK_TRUE@ gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \2.6 @GUI_GTK_TRUE@ gtkui/gtk_ctrl.c gtkui/gtk_gd.c \2.7 -@GUI_GTK_TRUE@ drivers/net_glib.c drivers/video_gtk.c2.8 +@GUI_GTK_TRUE@ drivers/io_glib.c drivers/video_gtk.c2.10 @GUI_COCOA_TRUE@am__append_5 = cocoaui/cocoaui.m cocoaui/cocoaui.h cocoaui/cocoa_cfg.m \2.11 @GUI_COCOA_TRUE@ cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \2.12 @GUI_COCOA_TRUE@ cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m \2.13 -@GUI_COCOA_TRUE@ drivers/net_osx.m drivers/video_osx.m \2.14 +@GUI_COCOA_TRUE@ drivers/io_osx.m drivers/video_osx.m \2.15 @GUI_COCOA_TRUE@ drivers/mac_keymap.h drivers/mac_keymap.txt2.17 @GUI_COCOA_FALSE@am__append_6 = paths_unix.c2.18 @@ -141,8 +141,8 @@2.19 am__lxdream_SOURCES_DIST = main.c version.c config.c config.h \2.20 lxdream.h dream.h gui.h cpu.h hook.h gettext.h mem.c mem.h \2.21 sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \2.22 - syscall.c syscall.h bios.c dcload.c gdbserver.c netutil.c \2.23 - netutil.h lxpaths.c lxpaths.h gdrom/ide.c gdrom/ide.h \2.24 + syscall.c syscall.h bios.c dcload.c gdbserver.c ioutil.c \2.25 + ioutil.h lxpaths.c lxpaths.h gdrom/ide.c gdrom/ide.h \2.26 gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \2.27 gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c \2.28 gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \2.29 @@ -166,9 +166,9 @@2.30 vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \2.31 drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \2.32 drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \2.33 - sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in \2.34 - sh4/sh4stat.in hotkeys.c hotkeys.h plugin.c plugin.h \2.35 - sh4/sh4x86.c xlat/x86/x86op.h xlat/x86/ia32abi.h \2.36 + drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \2.37 + sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h plugin.c \2.38 + plugin.h sh4/sh4x86.c xlat/x86/x86op.h xlat/x86/ia32abi.h \2.39 xlat/x86/amd64abi.h sh4/sh4trans.c sh4/sh4trans.h sh4/mmux86.c \2.40 x86dasm/x86dasm.c x86dasm/x86dasm.h x86dasm/i386-dis.c \2.41 x86dasm/dis-init.c x86dasm/dis-buf.c x86dasm/ansidecl.h \2.42 @@ -176,10 +176,10 @@2.43 x86dasm/sysdep.h gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c \2.44 gtkui/gtkcb.c gtkui/gtk_cfg.c gtkui/gtk_mmio.c \2.45 gtkui/gtk_debug.c gtkui/gtk_dump.c gtkui/gtk_ctrl.c \2.46 - gtkui/gtk_gd.c drivers/net_glib.c drivers/video_gtk.c \2.47 + gtkui/gtk_gd.c drivers/io_glib.c drivers/video_gtk.c \2.48 cocoaui/cocoaui.m cocoaui/cocoaui.h cocoaui/cocoa_cfg.m \2.49 cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \2.50 - cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m drivers/net_osx.m \2.51 + cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m drivers/io_osx.m \2.52 drivers/video_osx.m drivers/mac_keymap.h \2.53 drivers/mac_keymap.txt paths_unix.c drivers/video_gdk.c \2.54 drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.m \2.55 @@ -205,7 +205,7 @@2.56 @GUI_GTK_TRUE@ lxdream-gtk_dump.$(OBJEXT) \2.57 @GUI_GTK_TRUE@ lxdream-gtk_ctrl.$(OBJEXT) \2.58 @GUI_GTK_TRUE@ lxdream-gtk_gd.$(OBJEXT) \2.59 -@GUI_GTK_TRUE@ lxdream-net_glib.$(OBJEXT) \2.60 +@GUI_GTK_TRUE@ lxdream-io_glib.$(OBJEXT) \2.61 @GUI_GTK_TRUE@ lxdream-video_gtk.$(OBJEXT)2.62 @GUI_COCOA_TRUE@am__objects_4 = lxdream-cocoaui.$(OBJEXT) \2.63 @GUI_COCOA_TRUE@ lxdream-cocoa_cfg.$(OBJEXT) \2.64 @@ -214,7 +214,7 @@2.65 @GUI_COCOA_TRUE@ lxdream-cocoa_prefs.$(OBJEXT) \2.66 @GUI_COCOA_TRUE@ lxdream-cocoa_ctrl.$(OBJEXT) \2.67 @GUI_COCOA_TRUE@ lxdream-paths_osx.$(OBJEXT) \2.68 -@GUI_COCOA_TRUE@ lxdream-net_osx.$(OBJEXT) \2.69 +@GUI_COCOA_TRUE@ lxdream-io_osx.$(OBJEXT) \2.70 @GUI_COCOA_TRUE@ lxdream-video_osx.$(OBJEXT)2.71 @GUI_COCOA_FALSE@am__objects_5 = lxdream-paths_unix.$(OBJEXT)2.72 @VIDEO_OSMESA_TRUE@am__objects_6 = lxdream-video_gdk.$(OBJEXT)2.73 @@ -236,7 +236,7 @@2.74 lxdream-sdram.$(OBJEXT) lxdream-watch.$(OBJEXT) \2.75 lxdream-asic.$(OBJEXT) lxdream-syscall.$(OBJEXT) \2.76 lxdream-bios.$(OBJEXT) lxdream-dcload.$(OBJEXT) \2.77 - lxdream-gdbserver.$(OBJEXT) lxdream-netutil.$(OBJEXT) \2.78 + lxdream-gdbserver.$(OBJEXT) lxdream-ioutil.$(OBJEXT) \2.79 lxdream-lxpaths.$(OBJEXT) lxdream-ide.$(OBJEXT) \2.80 lxdream-gdimage.$(OBJEXT) lxdream-gdrom.$(OBJEXT) \2.81 lxdream-nrg.$(OBJEXT) lxdream-cdi.$(OBJEXT) \2.82 @@ -266,13 +266,14 @@2.83 lxdream-vmulist.$(OBJEXT) lxdream-display.$(OBJEXT) \2.84 lxdream-audio_null.$(OBJEXT) lxdream-video_null.$(OBJEXT) \2.85 lxdream-cd_mmc.$(OBJEXT) lxdream-video_gl.$(OBJEXT) \2.86 - lxdream-gl_fbo.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \2.87 - $(am__objects_1) $(am__objects_2) $(am__objects_3) \2.88 - $(am__objects_4) $(am__objects_5) $(am__objects_6) \2.89 - $(am__objects_7) $(am__objects_8) $(am__objects_9) \2.90 - $(am__objects_10) $(am__objects_11) $(am__objects_12) \2.91 - $(am__objects_13) $(am__objects_14) $(am__objects_15) \2.92 - $(am__objects_16) $(am__objects_17) $(am__objects_18)2.93 + lxdream-gl_fbo.$(OBJEXT) lxdream-serial_unix.$(OBJEXT) \2.94 + lxdream-hotkeys.$(OBJEXT) $(am__objects_1) $(am__objects_2) \2.95 + $(am__objects_3) $(am__objects_4) $(am__objects_5) \2.96 + $(am__objects_6) $(am__objects_7) $(am__objects_8) \2.97 + $(am__objects_9) $(am__objects_10) $(am__objects_11) \2.98 + $(am__objects_12) $(am__objects_13) $(am__objects_14) \2.99 + $(am__objects_15) $(am__objects_16) $(am__objects_17) \2.100 + $(am__objects_18)2.101 lxdream_OBJECTS = $(am_lxdream_OBJECTS)2.102 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \2.103 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \2.104 @@ -542,7 +543,7 @@2.105 lxdream_SOURCES = main.c version.c config.c config.h lxdream.h dream.h \2.106 gui.h cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \2.107 watch.c asic.c asic.h clock.h serial.h syscall.c syscall.h \2.108 - bios.c dcload.c gdbserver.c netutil.c netutil.h lxpaths.c \2.109 + bios.c dcload.c gdbserver.c ioutil.c ioutil.h lxpaths.c \2.110 lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h \2.111 gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c \2.112 gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c gdrom/ecc.h \2.113 @@ -567,14 +568,14 @@2.114 vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \2.115 drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \2.116 drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \2.117 - sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in \2.118 - sh4/sh4stat.in hotkeys.c hotkeys.h $(am__append_1) \2.119 - $(am__append_2) $(am__append_4) $(am__append_5) \2.120 - $(am__append_6) $(am__append_7) $(am__append_8) \2.121 - $(am__append_9) $(am__append_10) $(am__append_17) \2.122 - $(am__append_19) $(am__append_21) $(am__append_23) \2.123 - $(am__append_25) $(am__append_27) $(am__append_28) \2.124 - $(am__append_29) $(am__append_30)2.125 + drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \2.126 + sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h \2.127 + $(am__append_1) $(am__append_2) $(am__append_4) \2.128 + $(am__append_5) $(am__append_6) $(am__append_7) \2.129 + $(am__append_8) $(am__append_9) $(am__append_10) \2.130 + $(am__append_17) $(am__append_19) $(am__append_21) \2.131 + $(am__append_23) $(am__append_25) $(am__append_27) \2.132 + $(am__append_28) $(am__append_29) $(am__append_30)2.133 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@2.134 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@2.135 @BUILD_SH4X86_TRUE@test_testsh4x86_CPPFLAGS = @LXDREAMCPPFLAGS@2.136 @@ -798,6 +799,9 @@2.137 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-ide.Po@am__quote@2.138 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-input_lirc.Po@am__quote@2.139 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-intc.Po@am__quote@2.140 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-io_glib.Po@am__quote@2.141 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-io_osx.Po@am__quote@2.142 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-ioutil.Po@am__quote@2.143 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-joy_linux.Po@am__quote@2.144 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-kbd.Po@am__quote@2.145 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-lightgun.Po@am__quote@2.146 @@ -809,9 +813,6 @@2.147 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmu.Po@am__quote@2.148 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmux86.Po@am__quote@2.149 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mouse.Po@am__quote@2.150 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-net_glib.Po@am__quote@2.151 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-net_osx.Po@am__quote@2.152 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-netutil.Po@am__quote@2.153 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-nrg.Po@am__quote@2.154 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-osx_iokit.Po@am__quote@2.155 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-paths_osx.Po@am__quote@2.156 @@ -825,6 +826,7 @@2.157 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scene.Po@am__quote@2.158 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scif.Po@am__quote@2.159 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sdram.Po@am__quote@2.160 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-serial_unix.Po@am__quote@2.161 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4.Po@am__quote@2.162 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4core.Po@am__quote@2.163 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4dasm.Po@am__quote@2.164 @@ -1090,19 +1092,19 @@2.165 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.166 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdbserver.obj `if test -f 'gdbserver.c'; then $(CYGPATH_W) 'gdbserver.c'; else $(CYGPATH_W) '$(srcdir)/gdbserver.c'; fi`2.168 -lxdream-netutil.o: netutil.c2.169 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-netutil.o -MD -MP -MF "$(DEPDIR)/lxdream-netutil.Tpo" -c -o lxdream-netutil.o `test -f 'netutil.c' || echo '$(srcdir)/'`netutil.c; \2.170 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-netutil.Tpo" "$(DEPDIR)/lxdream-netutil.Po"; else rm -f "$(DEPDIR)/lxdream-netutil.Tpo"; exit 1; fi2.171 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netutil.c' object='lxdream-netutil.o' libtool=no @AMDEPBACKSLASH@2.172 +lxdream-ioutil.o: ioutil.c2.173 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-ioutil.o -MD -MP -MF "$(DEPDIR)/lxdream-ioutil.Tpo" -c -o lxdream-ioutil.o `test -f 'ioutil.c' || echo '$(srcdir)/'`ioutil.c; \2.174 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-ioutil.Tpo" "$(DEPDIR)/lxdream-ioutil.Po"; else rm -f "$(DEPDIR)/lxdream-ioutil.Tpo"; exit 1; fi2.175 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ioutil.c' object='lxdream-ioutil.o' libtool=no @AMDEPBACKSLASH@2.176 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.177 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-netutil.o `test -f 'netutil.c' || echo '$(srcdir)/'`netutil.c2.178 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-ioutil.o `test -f 'ioutil.c' || echo '$(srcdir)/'`ioutil.c2.180 -lxdream-netutil.obj: netutil.c2.181 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-netutil.obj -MD -MP -MF "$(DEPDIR)/lxdream-netutil.Tpo" -c -o lxdream-netutil.obj `if test -f 'netutil.c'; then $(CYGPATH_W) 'netutil.c'; else $(CYGPATH_W) '$(srcdir)/netutil.c'; fi`; \2.182 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-netutil.Tpo" "$(DEPDIR)/lxdream-netutil.Po"; else rm -f "$(DEPDIR)/lxdream-netutil.Tpo"; exit 1; fi2.183 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netutil.c' object='lxdream-netutil.obj' libtool=no @AMDEPBACKSLASH@2.184 +lxdream-ioutil.obj: ioutil.c2.185 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-ioutil.obj -MD -MP -MF "$(DEPDIR)/lxdream-ioutil.Tpo" -c -o lxdream-ioutil.obj `if test -f 'ioutil.c'; then $(CYGPATH_W) 'ioutil.c'; else $(CYGPATH_W) '$(srcdir)/ioutil.c'; fi`; \2.186 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-ioutil.Tpo" "$(DEPDIR)/lxdream-ioutil.Po"; else rm -f "$(DEPDIR)/lxdream-ioutil.Tpo"; exit 1; fi2.187 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ioutil.c' object='lxdream-ioutil.obj' libtool=no @AMDEPBACKSLASH@2.188 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.189 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-netutil.obj `if test -f 'netutil.c'; then $(CYGPATH_W) 'netutil.c'; else $(CYGPATH_W) '$(srcdir)/netutil.c'; fi`2.190 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-ioutil.obj `if test -f 'ioutil.c'; then $(CYGPATH_W) 'ioutil.c'; else $(CYGPATH_W) '$(srcdir)/ioutil.c'; fi`2.192 lxdream-lxpaths.o: lxpaths.c2.193 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-lxpaths.o -MD -MP -MF "$(DEPDIR)/lxdream-lxpaths.Tpo" -c -o lxdream-lxpaths.o `test -f 'lxpaths.c' || echo '$(srcdir)/'`lxpaths.c; \2.194 @@ -1930,6 +1932,20 @@2.195 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.196 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gl_fbo.obj `if test -f 'drivers/gl_fbo.c'; then $(CYGPATH_W) 'drivers/gl_fbo.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_fbo.c'; fi`2.198 +lxdream-serial_unix.o: drivers/serial_unix.c2.199 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-serial_unix.o -MD -MP -MF "$(DEPDIR)/lxdream-serial_unix.Tpo" -c -o lxdream-serial_unix.o `test -f 'drivers/serial_unix.c' || echo '$(srcdir)/'`drivers/serial_unix.c; \2.200 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-serial_unix.Tpo" "$(DEPDIR)/lxdream-serial_unix.Po"; else rm -f "$(DEPDIR)/lxdream-serial_unix.Tpo"; exit 1; fi2.201 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/serial_unix.c' object='lxdream-serial_unix.o' libtool=no @AMDEPBACKSLASH@2.202 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.203 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-serial_unix.o `test -f 'drivers/serial_unix.c' || echo '$(srcdir)/'`drivers/serial_unix.c2.204 +2.205 +lxdream-serial_unix.obj: drivers/serial_unix.c2.206 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-serial_unix.obj -MD -MP -MF "$(DEPDIR)/lxdream-serial_unix.Tpo" -c -o lxdream-serial_unix.obj `if test -f 'drivers/serial_unix.c'; then $(CYGPATH_W) 'drivers/serial_unix.c'; else $(CYGPATH_W) '$(srcdir)/drivers/serial_unix.c'; fi`; \2.207 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-serial_unix.Tpo" "$(DEPDIR)/lxdream-serial_unix.Po"; else rm -f "$(DEPDIR)/lxdream-serial_unix.Tpo"; exit 1; fi2.208 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/serial_unix.c' object='lxdream-serial_unix.obj' libtool=no @AMDEPBACKSLASH@2.209 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.210 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-serial_unix.obj `if test -f 'drivers/serial_unix.c'; then $(CYGPATH_W) 'drivers/serial_unix.c'; else $(CYGPATH_W) '$(srcdir)/drivers/serial_unix.c'; fi`2.211 +2.212 lxdream-hotkeys.o: hotkeys.c2.213 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-hotkeys.o -MD -MP -MF "$(DEPDIR)/lxdream-hotkeys.Tpo" -c -o lxdream-hotkeys.o `test -f 'hotkeys.c' || echo '$(srcdir)/'`hotkeys.c; \2.214 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-hotkeys.Tpo" "$(DEPDIR)/lxdream-hotkeys.Po"; else rm -f "$(DEPDIR)/lxdream-hotkeys.Tpo"; exit 1; fi2.215 @@ -2182,19 +2198,19 @@2.216 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.217 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gtk_gd.obj `if test -f 'gtkui/gtk_gd.c'; then $(CYGPATH_W) 'gtkui/gtk_gd.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_gd.c'; fi`2.219 -lxdream-net_glib.o: drivers/net_glib.c2.220 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-net_glib.o -MD -MP -MF "$(DEPDIR)/lxdream-net_glib.Tpo" -c -o lxdream-net_glib.o `test -f 'drivers/net_glib.c' || echo '$(srcdir)/'`drivers/net_glib.c; \2.221 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-net_glib.Tpo" "$(DEPDIR)/lxdream-net_glib.Po"; else rm -f "$(DEPDIR)/lxdream-net_glib.Tpo"; exit 1; fi2.222 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/net_glib.c' object='lxdream-net_glib.o' libtool=no @AMDEPBACKSLASH@2.223 +lxdream-io_glib.o: drivers/io_glib.c2.224 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-io_glib.o -MD -MP -MF "$(DEPDIR)/lxdream-io_glib.Tpo" -c -o lxdream-io_glib.o `test -f 'drivers/io_glib.c' || echo '$(srcdir)/'`drivers/io_glib.c; \2.225 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-io_glib.Tpo" "$(DEPDIR)/lxdream-io_glib.Po"; else rm -f "$(DEPDIR)/lxdream-io_glib.Tpo"; exit 1; fi2.226 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/io_glib.c' object='lxdream-io_glib.o' libtool=no @AMDEPBACKSLASH@2.227 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.228 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-net_glib.o `test -f 'drivers/net_glib.c' || echo '$(srcdir)/'`drivers/net_glib.c2.229 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-io_glib.o `test -f 'drivers/io_glib.c' || echo '$(srcdir)/'`drivers/io_glib.c2.231 -lxdream-net_glib.obj: drivers/net_glib.c2.232 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-net_glib.obj -MD -MP -MF "$(DEPDIR)/lxdream-net_glib.Tpo" -c -o lxdream-net_glib.obj `if test -f 'drivers/net_glib.c'; then $(CYGPATH_W) 'drivers/net_glib.c'; else $(CYGPATH_W) '$(srcdir)/drivers/net_glib.c'; fi`; \2.233 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-net_glib.Tpo" "$(DEPDIR)/lxdream-net_glib.Po"; else rm -f "$(DEPDIR)/lxdream-net_glib.Tpo"; exit 1; fi2.234 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/net_glib.c' object='lxdream-net_glib.obj' libtool=no @AMDEPBACKSLASH@2.235 +lxdream-io_glib.obj: drivers/io_glib.c2.236 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-io_glib.obj -MD -MP -MF "$(DEPDIR)/lxdream-io_glib.Tpo" -c -o lxdream-io_glib.obj `if test -f 'drivers/io_glib.c'; then $(CYGPATH_W) 'drivers/io_glib.c'; else $(CYGPATH_W) '$(srcdir)/drivers/io_glib.c'; fi`; \2.237 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-io_glib.Tpo" "$(DEPDIR)/lxdream-io_glib.Po"; else rm -f "$(DEPDIR)/lxdream-io_glib.Tpo"; exit 1; fi2.238 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/io_glib.c' object='lxdream-io_glib.obj' libtool=no @AMDEPBACKSLASH@2.239 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.240 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-net_glib.obj `if test -f 'drivers/net_glib.c'; then $(CYGPATH_W) 'drivers/net_glib.c'; else $(CYGPATH_W) '$(srcdir)/drivers/net_glib.c'; fi`2.241 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-io_glib.obj `if test -f 'drivers/io_glib.c'; then $(CYGPATH_W) 'drivers/io_glib.c'; else $(CYGPATH_W) '$(srcdir)/drivers/io_glib.c'; fi`2.243 lxdream-video_gtk.o: drivers/video_gtk.c2.244 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-video_gtk.o -MD -MP -MF "$(DEPDIR)/lxdream-video_gtk.Tpo" -c -o lxdream-video_gtk.o `test -f 'drivers/video_gtk.c' || echo '$(srcdir)/'`drivers/video_gtk.c; \2.245 @@ -2658,19 +2674,19 @@2.246 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.247 @am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o lxdream-paths_osx.obj `if test -f 'cocoaui/paths_osx.m'; then $(CYGPATH_W) 'cocoaui/paths_osx.m'; else $(CYGPATH_W) '$(srcdir)/cocoaui/paths_osx.m'; fi`2.249 -lxdream-net_osx.o: drivers/net_osx.m2.250 -@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT lxdream-net_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-net_osx.Tpo" -c -o lxdream-net_osx.o `test -f 'drivers/net_osx.m' || echo '$(srcdir)/'`drivers/net_osx.m; \2.251 -@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/lxdream-net_osx.Tpo" "$(DEPDIR)/lxdream-net_osx.Po"; else rm -f "$(DEPDIR)/lxdream-net_osx.Tpo"; exit 1; fi2.252 -@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/net_osx.m' object='lxdream-net_osx.o' libtool=no @AMDEPBACKSLASH@2.253 +lxdream-io_osx.o: drivers/io_osx.m2.254 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT lxdream-io_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-io_osx.Tpo" -c -o lxdream-io_osx.o `test -f 'drivers/io_osx.m' || echo '$(srcdir)/'`drivers/io_osx.m; \2.255 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/lxdream-io_osx.Tpo" "$(DEPDIR)/lxdream-io_osx.Po"; else rm -f "$(DEPDIR)/lxdream-io_osx.Tpo"; exit 1; fi2.256 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/io_osx.m' object='lxdream-io_osx.o' libtool=no @AMDEPBACKSLASH@2.257 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.258 -@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o lxdream-net_osx.o `test -f 'drivers/net_osx.m' || echo '$(srcdir)/'`drivers/net_osx.m2.259 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o lxdream-io_osx.o `test -f 'drivers/io_osx.m' || echo '$(srcdir)/'`drivers/io_osx.m2.261 -lxdream-net_osx.obj: drivers/net_osx.m2.262 -@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT lxdream-net_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-net_osx.Tpo" -c -o lxdream-net_osx.obj `if test -f 'drivers/net_osx.m'; then $(CYGPATH_W) 'drivers/net_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/net_osx.m'; fi`; \2.263 -@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/lxdream-net_osx.Tpo" "$(DEPDIR)/lxdream-net_osx.Po"; else rm -f "$(DEPDIR)/lxdream-net_osx.Tpo"; exit 1; fi2.264 -@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/net_osx.m' object='lxdream-net_osx.obj' libtool=no @AMDEPBACKSLASH@2.265 +lxdream-io_osx.obj: drivers/io_osx.m2.266 +@am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT lxdream-io_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-io_osx.Tpo" -c -o lxdream-io_osx.obj `if test -f 'drivers/io_osx.m'; then $(CYGPATH_W) 'drivers/io_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/io_osx.m'; fi`; \2.267 +@am__fastdepOBJC_TRUE@ then mv -f "$(DEPDIR)/lxdream-io_osx.Tpo" "$(DEPDIR)/lxdream-io_osx.Po"; else rm -f "$(DEPDIR)/lxdream-io_osx.Tpo"; exit 1; fi2.268 +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='drivers/io_osx.m' object='lxdream-io_osx.obj' libtool=no @AMDEPBACKSLASH@2.269 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.270 -@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o lxdream-net_osx.obj `if test -f 'drivers/net_osx.m'; then $(CYGPATH_W) 'drivers/net_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/net_osx.m'; fi`2.271 +@am__fastdepOBJC_FALSE@ $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -c -o lxdream-io_osx.obj `if test -f 'drivers/io_osx.m'; then $(CYGPATH_W) 'drivers/io_osx.m'; else $(CYGPATH_W) '$(srcdir)/drivers/io_osx.m'; fi`2.273 lxdream-video_osx.o: drivers/video_osx.m2.274 @am__fastdepOBJC_TRUE@ if $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) -MT lxdream-video_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-video_osx.Tpo" -c -o lxdream-video_osx.o `test -f 'drivers/video_osx.m' || echo '$(srcdir)/'`drivers/video_osx.m; \
3.1 --- a/src/config.c Mon Aug 03 08:41:11 2009 +10003.2 +++ b/src/config.c Wed Oct 07 17:53:56 2009 +10003.3 @@ -33,6 +33,7 @@3.4 #define MAX_ROOT_GROUPS 163.6 extern struct lxdream_config_group hotkeys_group;3.7 +extern struct lxdream_config_group serial_group;3.9 gboolean lxdream_load_config_file( const gchar *filename );3.10 gboolean lxdream_save_config_file( const gchar *filename );3.11 @@ -53,11 +54,6 @@3.12 { "quick state", NULL, CONFIG_TYPE_INTEGER, "0" },3.13 { NULL, CONFIG_TYPE_NONE }} };3.15 -static struct lxdream_config_group serial_group =3.16 - { "serial", NULL, NULL, NULL,3.17 - {{ "device", N_("Serial device"), CONFIG_TYPE_FILE, "/dev/ttyS1" },3.18 - { NULL, CONFIG_TYPE_NONE }} };3.19 -3.20 /**3.21 * Dummy group for controllers (handled specially)3.22 */
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/drivers/io_glib.c Wed Oct 07 17:53:56 2009 +10004.3 @@ -0,0 +1,85 @@4.4 +/**4.5 + * $Id$4.6 + *4.7 + * Glib-based networking support functions. Currently this is just for activity callbacks.4.8 + *4.9 + * Copyright (c) 2009 Nathan Keynes.4.10 + *4.11 + * This program is free software; you can redistribute it and/or modify4.12 + * it under the terms of the GNU General Public License as published by4.13 + * the Free Software Foundation; either version 2 of the License, or4.14 + * (at your option) any later version.4.15 + *4.16 + * This program is distributed in the hope that it will be useful,4.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of4.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4.19 + * GNU General Public License for more details.4.20 + */4.21 +4.22 +#include <assert.h>4.23 +#include <glib.h>4.24 +#include <stdlib.h>4.25 +#include "ioutil.h"4.26 +4.27 +struct io_glib_cbinfo {4.28 + io_callback_t callback;4.29 + guint sourceid;4.30 + void * cbdata;4.31 + void (*cbdealloc)(void *);4.32 +};4.33 +4.34 +static gboolean io_glib_callback( GIOChannel *source, GIOCondition cond, gpointer data )4.35 +{4.36 + struct io_glib_cbinfo *cbinfo = (struct io_glib_cbinfo *)data;4.37 + return cbinfo->callback( g_io_channel_unix_get_fd(source), cbinfo->cbdata);4.38 +}4.39 +4.40 +static void io_glib_release( void *data )4.41 +{4.42 + struct io_glib_cbinfo *cbinfo = (struct io_glib_cbinfo *)data;4.43 + if( cbinfo->cbdealloc ) {4.44 + cbinfo->cbdealloc( cbinfo->cbdata );4.45 + }4.46 + free(cbinfo);4.47 +}4.48 +4.49 +/**4.50 + * Register a TCP server socket listener on an already open (and listening)4.51 + * socket. The socket must not have been previously registered.4.52 + * @return TRUE on success, FALSE on failure.4.53 + *4.54 + * Defined in netutil.h4.55 + */4.56 +io_listener_t io_register_tcp_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void*) )4.57 +{4.58 + return io_register_listener( fd, callback, data, dealloc );4.59 +}4.60 +4.61 +io_listener_t io_register_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void *) )4.62 +{4.63 + struct io_glib_cbinfo *cbinfo = malloc( sizeof(struct io_glib_cbinfo) );4.64 + assert(cbinfo != NULL);4.65 +4.66 + cbinfo->callback = callback;4.67 + cbinfo->cbdata = data;4.68 + cbinfo->cbdealloc = dealloc;4.69 +4.70 + /**4.71 + * Note magic here: the watch creates an event source which holds a4.72 + * reference to the channel. We unref the channel so that the channel then4.73 + * is automatically released when the event source goes away.4.74 + */4.75 + GIOChannel *chan = g_io_channel_unix_new(fd);4.76 + g_io_channel_set_encoding( chan, NULL, NULL );4.77 + g_io_channel_set_buffered(chan, FALSE);4.78 + cbinfo->sourceid = g_io_add_watch_full( chan, 0, G_IO_IN, io_glib_callback, cbinfo, io_glib_release );4.79 + g_io_channel_unref( chan );4.80 + return cbinfo;4.81 +}4.82 +4.83 +4.84 +void io_unregister_listener( io_listener_t data )4.85 +{4.86 + struct io_glib_cbinfo *cbinfo = (struct io_glib_cbinfo *)data;4.87 + g_source_remove(cbinfo->sourceid);4.88 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00005.2 +++ b/src/drivers/io_osx.m Wed Oct 07 17:53:56 2009 +10005.3 @@ -0,0 +1,132 @@5.4 +/**5.5 + * $Id$5.6 + *5.7 + * OS X networking support functions. Currently this is just for activity callbacks.5.8 + *5.9 + * Copyright (c) 2009 Nathan Keynes.5.10 + *5.11 + * This program is free software; you can redistribute it and/or modify5.12 + * it under the terms of the GNU General Public License as published by5.13 + * the Free Software Foundation; either version 2 of the License, or5.14 + * (at your option) any later version.5.15 + *5.16 + * This program is distributed in the hope that it will be useful,5.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of5.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5.19 + * GNU General Public License for more details.5.20 + */5.21 +5.22 +#include <CoreFoundation/CoreFoundation.h>5.23 +#include "ioutil.h"5.24 +5.25 +struct io_osx_cbinfo {5.26 + int fd;5.27 + io_callback_t callback;5.28 + void * cbdata;5.29 + void (*cbdealloc)(void *);5.30 + void *fdRef;5.31 + CFRunLoopSourceRef sourceRef;5.32 +5.33 + struct io_osx_cbinfo *next;5.34 +};5.35 +5.36 +static struct io_osx_cbinfo *cbinfo_list = NULL;5.37 +5.38 +void io_unregister_callback( struct io_osx_cbinfo *cbinfo )5.39 +{5.40 + CFRunLoopRemoveSource( CFRunLoopGetCurrent(), cbinfo->sourceRef, kCFRunLoopCommonModes );5.41 + CFRelease(cbinfo->sourceRef);5.42 + cbinfo->sourceRef = NULL;5.43 + CFRelease(cbinfo->fdRef); /* Note this implicitly releases the cbinfo itself as well */5.44 +}5.45 +5.46 +static void io_osx_net_callback( CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *unused, void *data )5.47 +{5.48 + struct io_osx_cbinfo *cbinfo = (struct io_osx_cbinfo *)data;5.49 + if(!cbinfo->callback( CFSocketGetNative(s), cbinfo->cbdata) ) {5.50 + io_unregister_callback(cbinfo);5.51 + }5.52 +}5.53 +5.54 +static void io_osx_fd_callback( CFFileDescriptorRef f, CFOptionFlags type, void *data )5.55 +{5.56 + struct io_osx_cbinfo *cbinfo = (struct io_osx_cbinfo *)data;5.57 + if(!cbinfo->callback( CFFileDescriptorGetNativeDescriptor(f), cbinfo->cbdata) ) {5.58 + io_unregister_callback(cbinfo);5.59 + }5.60 +}5.61 +5.62 +static void io_osx_release( const void *data )5.63 +{5.64 + struct io_osx_cbinfo *cbinfo = (struct io_osx_cbinfo *)data;5.65 + if( cbinfo->cbdealloc != NULL ) {5.66 + cbinfo->cbdealloc(cbinfo->cbdata);5.67 + }5.68 + free( cbinfo );5.69 +}5.70 +5.71 +/**5.72 + * Register a TCP server socket listener on an already open (and listening)5.73 + * socket. The socket must not have been previously registered.5.74 + * @return TRUE on success, FALSE on failure.5.75 + *5.76 + * Defined in netutil.h5.77 + */5.78 +io_listener_t io_register_tcp_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void*) )5.79 +{5.80 + CFSocketContext socketContext;5.81 + struct io_osx_cbinfo *cbinfo = malloc( sizeof(struct io_osx_cbinfo) );5.82 + assert(cbinfo != NULL);5.83 +5.84 + cbinfo->callback = callback;5.85 + cbinfo->cbdata = data;5.86 + cbinfo->cbdealloc = dealloc;5.87 + socketContext.version = 0;5.88 + socketContext.info = cbinfo;5.89 + socketContext.retain = NULL;5.90 + socketContext.release = io_osx_release;5.91 + socketContext.copyDescription = NULL;5.92 +5.93 + CFSocketRef ref = CFSocketCreateWithNative( kCFAllocatorDefault, fd, kCFSocketReadCallBack,5.94 + io_osx_net_callback, &socketContext );5.95 + cbinfo->fdRef = ref;5.96 + cbinfo->sourceRef = CFSocketCreateRunLoopSource( kCFAllocatorDefault, ref, 0 );5.97 + CFRunLoopAddSource( CFRunLoopGetCurrent(), cbinfo->sourceRef, kCFRunLoopCommonModes );5.98 +5.99 + return cbinfo;5.100 +}5.101 +5.102 +/**5.103 + * Register a file descriptor listener on an already open (and listening)5.104 + * file descriptor. The file descriptor must not have been previously registered.5.105 + * @return TRUE on success, FALSE on failure.5.106 + *5.107 + */5.108 +io_listener_t io_register_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void *) )5.109 +{5.110 + CFFileDescriptorContext fdContext;5.111 + struct io_osx_cbinfo *cbinfo = malloc( sizeof(struct io_osx_cbinfo) );5.112 + assert(cbinfo != NULL);5.113 +5.114 + cbinfo->callback = callback;5.115 + cbinfo->cbdata = data;5.116 + cbinfo->cbdealloc = dealloc;5.117 + fdContext.version = 0;5.118 + fdContext.retain = NULL;5.119 + fdContext.info = cbinfo;5.120 + fdContext.release = io_osx_release;5.121 + fdContext.copyDescription = NULL;5.122 +5.123 + CFFileDescriptorRef ref = CFFileDescriptorCreate( kCFAllocatorDefault, fd, FALSE,5.124 + io_osx_fd_callback, &fdContext);5.125 + cbinfo->fdRef = ref;5.126 + cbinfo->sourceRef = CFFileDescriptorCreateRunLoopSource( kCFAllocatorDefault, ref, 0 );5.127 + CFRunLoopAddSource( CFRunLoopGetCurrent(), cbinfo->sourceRef, kCFRunLoopCommonModes );5.128 + return cbinfo;5.129 +}5.130 +5.131 +void io_unregister_listener( io_listener_t data )5.132 +{5.133 + struct io_osx_cbinfo *cbinfo = (struct io_osx_cbinfo *)data;5.134 + io_unregister_callback(cbinfo);5.135 +}
6.1 --- a/src/drivers/net_glib.c Mon Aug 03 08:41:11 2009 +10006.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00006.3 @@ -1,72 +0,0 @@6.4 -/**6.5 - * $Id$6.6 - *6.7 - * Glib-based networking support functions. Currently this is just for activity callbacks.6.8 - *6.9 - * Copyright (c) 2009 Nathan Keynes.6.10 - *6.11 - * This program is free software; you can redistribute it and/or modify6.12 - * it under the terms of the GNU General Public License as published by6.13 - * the Free Software Foundation; either version 2 of the License, or6.14 - * (at your option) any later version.6.15 - *6.16 - * This program is distributed in the hope that it will be useful,6.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of6.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6.19 - * GNU General Public License for more details.6.20 - */6.21 -6.22 -#include <assert.h>6.23 -#include <glib.h>6.24 -#include <stdlib.h>6.25 -#include "netutil.h"6.26 -6.27 -struct net_glib_cbinfo {6.28 - net_callback_t callback;6.29 - void * cbdata;6.30 - void (*cbdealloc)(void *);6.31 -};6.32 -6.33 -static gboolean net_glib_callback( GIOChannel *source, GIOCondition cond, gpointer data )6.34 -{6.35 - struct net_glib_cbinfo *cbinfo = (struct net_glib_cbinfo *)data;6.36 - return cbinfo->callback( g_io_channel_unix_get_fd(source), cbinfo->cbdata);6.37 -}6.38 -6.39 -static void net_glib_release( void *data )6.40 -{6.41 - struct net_glib_cbinfo *cbinfo = (struct net_glib_cbinfo *)data;6.42 - if( cbinfo->cbdealloc ) {6.43 - cbinfo->cbdealloc( cbinfo->cbdata );6.44 - }6.45 - free(cbinfo);6.46 -}6.47 -6.48 -/**6.49 - * Register a TCP server socket listener on an already open (and listening)6.50 - * socket. The socket must not have been previously registered.6.51 - * @return TRUE on success, FALSE on failure.6.52 - *6.53 - * Defined in netutil.h6.54 - */6.55 -gboolean net_register_tcp_listener( int fd, net_callback_t callback, void *data, void (*dealloc)(void*) )6.56 -{6.57 - struct net_glib_cbinfo *cbinfo = malloc( sizeof(struct net_glib_cbinfo) );6.58 - assert(cbinfo != NULL);6.59 -6.60 - cbinfo->callback = callback;6.61 - cbinfo->cbdata = data;6.62 - cbinfo->cbdealloc = dealloc;6.63 -6.64 - /**6.65 - * Note magic here: the watch creates an event source which holds a6.66 - * reference to the channel. We unref the channel so that the channel then6.67 - * is automatically released when the event source goes away.6.68 - */6.69 - GIOChannel *chan = g_io_channel_unix_new(fd);6.70 - g_io_channel_set_encoding( chan, NULL, NULL );6.71 - g_io_channel_set_buffered(chan, FALSE);6.72 - g_io_add_watch_full( chan, 0, G_IO_IN, net_glib_callback, cbinfo, net_glib_release );6.73 - g_io_channel_unref( chan );6.74 - return TRUE;6.75 -}
7.1 --- a/src/drivers/net_osx.m Mon Aug 03 08:41:11 2009 +10007.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00007.3 @@ -1,78 +0,0 @@7.4 -/**7.5 - * $Id$7.6 - *7.7 - * OS X networking support functions. Currently this is just for activity callbacks.7.8 - *7.9 - * Copyright (c) 2009 Nathan Keynes.7.10 - *7.11 - * This program is free software; you can redistribute it and/or modify7.12 - * it under the terms of the GNU General Public License as published by7.13 - * the Free Software Foundation; either version 2 of the License, or7.14 - * (at your option) any later version.7.15 - *7.16 - * This program is distributed in the hope that it will be useful,7.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of7.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7.19 - * GNU General Public License for more details.7.20 - */7.21 -7.22 -#include <CoreFoundation/CoreFoundation.h>7.23 -#include "netutil.h"7.24 -7.25 -struct net_osx_cbinfo {7.26 - net_callback_t callback;7.27 - void * cbdata;7.28 - void (*cbdealloc)(void *);7.29 - CFSocketRef sockRef;7.30 - CFRunLoopSourceRef sourceRef;7.31 -};7.32 -7.33 -static void net_osx_callback( CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *unused, void *data )7.34 -{7.35 - struct net_osx_cbinfo *cbinfo = (struct net_osx_cbinfo *)data;7.36 - if(!cbinfo->callback( CFSocketGetNative(s), cbinfo->cbdata) ) {7.37 - CFRunLoopRemoveSource( CFRunLoopGetCurrent(), cbinfo->sourceRef, kCFRunLoopCommonModes );7.38 - CFRelease(cbinfo->sourceRef);7.39 - cbinfo->sourceRef = NULL;7.40 - CFRelease(cbinfo->sockRef);7.41 - }7.42 -}7.43 -7.44 -static void net_osx_release( const void *data )7.45 -{7.46 - struct net_osx_cbinfo *cbinfo = (struct net_osx_cbinfo *)data;7.47 - if( cbinfo->cbdealloc != NULL ) {7.48 - cbinfo->cbdealloc(cbinfo->cbdata);7.49 - }7.50 - free( cbinfo );7.51 -}7.52 -7.53 -/**7.54 - * Register a TCP server socket listener on an already open (and listening)7.55 - * socket. The socket must not have been previously registered.7.56 - * @return TRUE on success, FALSE on failure.7.57 - *7.58 - * Defined in netutil.h7.59 - */7.60 -gboolean net_register_tcp_listener( int fd, net_callback_t callback, void *data, void (*dealloc)(void*) )7.61 -{7.62 - CFSocketContext socketContext;7.63 - struct net_osx_cbinfo *cbinfo = malloc( sizeof(struct net_osx_cbinfo) );7.64 - assert(cbinfo != NULL);7.65 -7.66 - cbinfo->callback = callback;7.67 - cbinfo->cbdata = data;7.68 - cbinfo->cbdealloc = dealloc;7.69 - socketContext.version = 0;7.70 - socketContext.info = cbinfo;7.71 - socketContext.retain = NULL;7.72 - socketContext.release = net_osx_release;7.73 - socketContext.copyDescription = NULL;7.74 -7.75 - cbinfo->sockRef = CFSocketCreateWithNative( kCFAllocatorDefault, fd, kCFSocketReadCallBack,7.76 - net_osx_callback, &socketContext );7.77 - cbinfo->sourceRef = CFSocketCreateRunLoopSource( kCFAllocatorDefault, cbinfo->sockRef, 0 );7.78 - CFRunLoopAddSource( CFRunLoopGetCurrent(), cbinfo->sourceRef, kCFRunLoopCommonModes );7.79 -7.80 - return TRUE;7.81 -}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00008.2 +++ b/src/drivers/serial_unix.c Wed Oct 07 17:53:56 2009 +10008.3 @@ -0,0 +1,188 @@8.4 +/**8.5 + * $Id$8.6 + *8.7 + * Host driver for a serial port attachment, that can be hooked to a character8.8 + * device, fifo or named pipe.8.9 + *8.10 + * Copyright (c) 2009 Nathan Keynes.8.11 + *8.12 + * This program is free software; you can redistribute it and/or modify8.13 + * it under the terms of the GNU General Public License as published by8.14 + * the Free Software Foundation; either version 2 of the License, or8.15 + * (at your option) any later version.8.16 + *8.17 + * This program is distributed in the hope that it will be useful,8.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of8.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8.20 + * GNU General Public License for more details.8.21 + */8.22 +8.23 +#include <stdio.h>8.24 +#include <stdlib.h>8.25 +#include <fcntl.h>8.26 +#include <sys/stat.h>8.27 +8.28 +#include "lxdream.h"8.29 +#include "config.h"8.30 +#include "ioutil.h"8.31 +#include "serial.h"8.32 +8.33 +8.34 +typedef struct serial_fd_device {8.35 + struct serial_device dev;8.36 + FILE *in;8.37 + FILE *out;8.38 + gboolean closeOnDestroy;8.39 + io_listener_t listener;8.40 +} *serial_fd_device_t;8.41 +8.42 +static void serial_fd_device_attach(serial_device_t dev);8.43 +static void serial_fd_device_detach(serial_device_t dev);8.44 +static void serial_fd_device_destroy(serial_device_t dev);8.45 +static void serial_fd_device_set_line_speed(struct serial_device *dev, uint32_t bps);8.46 +static void serial_fd_device_set_line_params(struct serial_device *dev, int flags);8.47 +static void serial_fd_device_receive_data(struct serial_device *dev, uint8_t value);8.48 +static gboolean serial_fd_device_transmit_data( int fd, void *dev);8.49 +8.50 +static gboolean serial_config_changed(void *data, struct lxdream_config_group *group, unsigned item,8.51 + const gchar *oldval, const gchar *newval);8.52 +8.53 +struct lxdream_config_group serial_group =8.54 + { "serial", serial_config_changed, NULL, NULL,8.55 + {{ "device", N_("Serial device"), CONFIG_TYPE_FILE, "/dev/console" },8.56 + { NULL, CONFIG_TYPE_NONE }} };8.57 +8.58 +void serial_init()8.59 +{8.60 + const gchar *name = serial_group.params[0].value;8.61 + if( name != NULL ) {8.62 + serial_device_t dev = serial_fd_device_new_filename(name);8.63 + if( dev != NULL ) {8.64 + serial_attach_device( dev );8.65 + }8.66 + }8.67 +}8.68 +8.69 +static gboolean serial_config_changed(void *data, struct lxdream_config_group *group, unsigned item,8.70 + const gchar *oldval, const gchar *newval)8.71 +{8.72 + if( item == 0 ) {8.73 + serial_destroy_device(serial_detach_device());8.74 + serial_device_t dev = serial_fd_device_new_filename(newval);8.75 + if( dev != NULL ) {8.76 + serial_attach_device( dev );8.77 + }8.78 + }8.79 +}8.80 +8.81 +8.82 +8.83 +serial_device_t serial_fd_device_new_filename( const gchar *filename )8.84 +{8.85 + FILE *out = fopen( filename, "w+" );8.86 + FILE *in;8.87 + struct stat st;8.88 +8.89 + if( out == NULL ) {8.90 + return NULL;8.91 + }8.92 +8.93 + if( fstat( fileno(out), &st ) != 0 ) {8.94 + fclose(out);8.95 + return NULL;8.96 + }8.97 +8.98 + if( S_ISCHR(st.st_mode) || S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode) ) {8.99 + in = out;8.100 + } else {8.101 + in = NULL;8.102 + }8.103 +8.104 + return (serial_device_t)serial_fd_device_new_file(in, out, TRUE);8.105 +}8.106 +8.107 +serial_device_t serial_fd_device_new_console()8.108 +{8.109 + return serial_fd_device_new_file( stdin, stdout, FALSE );8.110 +}8.111 +8.112 +serial_device_t serial_fd_device_new_file( FILE *in, FILE *out, gboolean closeOnDestroy )8.113 +{8.114 + if( in != NULL )8.115 + fcntl( fileno(in), F_SETFL, O_NONBLOCK );8.116 +8.117 + serial_fd_device_t dev = (serial_fd_device_t)malloc(sizeof(struct serial_fd_device));8.118 + if( dev == NULL ) {8.119 + if( closeOnDestroy ) {8.120 + if( in != NULL )8.121 + fclose(in);8.122 + if( out != NULL && out != in )8.123 + fclose(out);8.124 + }8.125 + return NULL;8.126 + }8.127 +8.128 + dev->dev.attach = serial_fd_device_attach;8.129 + dev->dev.detach = serial_fd_device_detach;8.130 + dev->dev.destroy = serial_fd_device_destroy;8.131 + dev->dev.set_line_speed = serial_fd_device_set_line_speed;8.132 + dev->dev.set_line_params = serial_fd_device_set_line_params;8.133 + dev->dev.receive_data = serial_fd_device_receive_data;8.134 + dev->in = in;8.135 + dev->out = out;8.136 + dev->closeOnDestroy = closeOnDestroy;8.137 + return (serial_device_t)dev;8.138 +}8.139 +8.140 +static void serial_fd_device_attach(serial_device_t dev)8.141 +{8.142 + serial_fd_device_t fddev = (serial_fd_device_t)dev;8.143 + if( fddev->in != NULL )8.144 + fddev->listener = io_register_listener( fileno(fddev->in), serial_fd_device_transmit_data, fddev, NULL );8.145 +}8.146 +8.147 +static void serial_fd_device_detach(serial_device_t dev)8.148 +{8.149 + serial_fd_device_t fddev = (serial_fd_device_t)dev;8.150 + if( fddev->in != NULL )8.151 + io_unregister_listener( fddev->listener );8.152 +}8.153 +8.154 +static void serial_fd_device_destroy(serial_device_t dev)8.155 +{8.156 + serial_fd_device_t fddev = (serial_fd_device_t)dev;8.157 + if( fddev->closeOnDestroy ) {8.158 + if( fddev->in != NULL )8.159 + fclose(fddev->in);8.160 + if( fddev->out != NULL && fddev->out != fddev->in )8.161 + fclose(fddev->out);8.162 + }8.163 + fddev->in = NULL;8.164 + fddev->out = NULL;8.165 + free(fddev);8.166 +}8.167 +static void serial_fd_device_set_line_speed(struct serial_device *dev, uint32_t bps)8.168 +{8.169 + /* Do nothing for now */8.170 +}8.171 +static void serial_fd_device_set_line_params(struct serial_device *dev, int flags)8.172 +{8.173 + /* Do nothing for now */8.174 +}8.175 +static void serial_fd_device_receive_data(struct serial_device *dev, uint8_t value)8.176 +{8.177 + serial_fd_device_t fddev = (serial_fd_device_t)dev;8.178 + if( fddev->out != NULL )8.179 + fputc( value, fddev->out );8.180 +}8.181 +8.182 +static gboolean serial_fd_device_transmit_data( int fd, void *dev )8.183 +{8.184 + serial_fd_device_t fddev = (serial_fd_device_t)dev;8.185 + char buf[4096];8.186 + size_t len = fread(buf, 1, sizeof(buf), fddev->in);8.187 + if( len > 0 ) {8.188 + serial_transmit_data(buf, len);8.189 + }8.190 + return TRUE;8.191 +}
9.1 --- a/src/gdbserver.c Mon Aug 03 08:41:11 2009 +10009.2 +++ b/src/gdbserver.c Wed Oct 07 17:53:56 2009 +10009.3 @@ -27,7 +27,7 @@9.4 #include <arpa/inet.h>9.5 #include "lxdream.h"9.6 #include "dreamcast.h"9.7 -#include "netutil.h"9.8 +#include "ioutil.h"9.9 #include "cpu.h"9.11 #define DEFAULT_BUFFER_SIZE 10249.12 @@ -495,7 +495,7 @@9.13 chan_serv->buf = malloc(1024);9.14 chan_serv->buf_size = 1024;9.15 chan_serv->buf_posn = 0;9.16 - net_register_tcp_listener( conn_fd, gdb_server_data_callback, chan_serv, gdb_server_free );9.17 + io_register_tcp_listener( conn_fd, gdb_server_data_callback, chan_serv, gdb_server_free );9.18 INFO( "GDB connected from %s", chan_serv->peer_name );9.19 }9.20 return TRUE;9.21 @@ -514,7 +514,7 @@9.22 */9.23 gboolean gdb_init_server( const char *interface, int port, cpu_desc_t cpu, gboolean mmu )9.24 {9.25 - int fd = net_create_server_socket( interface, port );9.26 + int fd = io_create_server_socket( interface, port );9.27 if( fd == -1 ) {9.28 return FALSE;9.29 }9.30 @@ -523,7 +523,7 @@9.31 server->cpu = cpu;9.32 server->mmu = mmu;9.33 server->fd = fd;9.34 - gboolean result = net_register_tcp_listener( fd, gdb_server_connect_callback, server, gdb_server_free );9.35 + gboolean result = io_register_tcp_listener( fd, gdb_server_connect_callback, server, gdb_server_free );9.36 INFO( "%s GDB server running on port %d", cpu->name, port );9.37 return result;9.38 }
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000010.2 +++ b/src/ioutil.c Wed Oct 07 17:53:56 2009 +100010.3 @@ -0,0 +1,54 @@10.4 +/**10.5 + * $Id$10.6 + *10.7 + * Network support functions10.8 + *10.9 + * Copyright (c) 2009 Nathan Keynes.10.10 + *10.11 + * This program is free software; you can redistribute it and/or modify10.12 + * it under the terms of the GNU General Public License as published by10.13 + * the Free Software Foundation; either version 2 of the License, or10.14 + * (at your option) any later version.10.15 + *10.16 + * This program is distributed in the hope that it will be useful,10.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of10.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10.19 + * GNU General Public License for more details.10.20 + */10.21 +10.22 +#include <string.h>10.23 +#include <unistd.h>10.24 +#include <sys/socket.h>10.25 +#include <netinet/in.h>10.26 +#include <arpa/inet.h>10.27 +#include <errno.h>10.28 +#include "ioutil.h"10.29 +10.30 +int io_create_server_socket(const char *interface, int port )10.31 +{10.32 + struct sockaddr_in sin;10.33 + int fd = socket(AF_INET, SOCK_STREAM, 0);10.34 + if( fd == -1 ) {10.35 + ERROR( "Failed to create TCP socket!" );10.36 + return -1;10.37 + }10.38 +10.39 + sin.sin_family = AF_INET;10.40 + sin.sin_addr.s_addr = 0;10.41 + sin.sin_port = htons(port);10.42 +10.43 + if( interface != NULL ) {10.44 + if( !inet_aton(interface, &sin.sin_addr) ) {10.45 + /* TODO: hostname lookup */10.46 + }10.47 + }10.48 +10.49 + if( bind( fd, (struct sockaddr *)&sin, sizeof(sin) ) != 0 ||10.50 + listen(fd, 5) != 0 ) {10.51 + close(fd);10.52 + ERROR( "Failed to bind port %d (%s)", port, strerror(errno) );10.53 + return -1;10.54 + }10.55 + return fd;10.56 +}10.57 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000011.2 +++ b/src/ioutil.h Wed Oct 07 17:53:56 2009 +100011.3 @@ -0,0 +1,67 @@11.4 +/**11.5 + * $Id$11.6 + *11.7 + * GDB RDP server stub - SH4 + ARM11.8 + *11.9 + * Copyright (c) 2009 Nathan Keynes.11.10 + *11.11 + * This program is free software; you can redistribute it and/or modify11.12 + * it under the terms of the GNU General Public License as published by11.13 + * the Free Software Foundation; either version 2 of the License, or11.14 + * (at your option) any later version.11.15 + *11.16 + * This program is distributed in the hope that it will be useful,11.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of11.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11.19 + * GNU General Public License for more details.11.20 + */11.21 +11.22 +#ifndef lxdream_netutil_H11.23 +#define lxdream_netutil_H 111.24 +11.25 +#include <netinet/in.h>11.26 +#include "lxdream.h"11.27 +11.28 +typedef void *io_listener_t;11.29 +11.30 +/**11.31 + * Construct a server socket listening on the given interface and port. If port11.32 + * is 0, a dynamic port will be bound instead.11.33 + * This method does not register a listener.11.34 + * @return newly created socket fd, or -1 on failure.11.35 + */11.36 +int io_create_server_socket(const char *interface, int port );11.37 +11.38 +/**11.39 + * Callback invoked when data is available from the remote peer, or when the peer11.40 + * connects/disconnects.11.41 + *11.42 + * @param fd file descriptor of the connected socket11.43 + * @param data data supplied when the callback was registered11.44 + * @return TRUE to maintain the connection, FALSE to immediately disconnected + close.11.45 + */11.46 +typedef gboolean (*io_callback_t)( int fd, void *data );11.47 +11.48 +/**11.49 + * Register a TCP server socket listener on an already open (and listening)11.50 + * socket. The socket must not have been previously registered.11.51 + * @return NULL on failure, otherwise an io listener handle.11.52 + *11.53 + * Note: Implementation is platform specific11.54 + */11.55 +io_listener_t io_register_tcp_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void*) );11.56 +11.57 +/**11.58 + * Register an I/O listener on an open file descriptor. The fd must not have11.59 + * been previously registered.11.60 + * @return TRUE on success, FALSE on failure.11.61 + */11.62 +io_listener_t io_register_listener( int fd, io_callback_t callback, void *data, void (*dealloc)(void *) );11.63 +11.64 +/**11.65 + * Unregister a socket that was previously registered with the system. This11.66 + * does not close the socket, but will remove any callbacks associated with the socket.11.67 + */11.68 +void io_unregister_listener( io_listener_t handle );11.69 +11.70 +#endif /* !lxdream_netutil_H */
12.1 --- a/src/main.c Mon Aug 03 08:41:11 2009 +100012.2 +++ b/src/main.c Wed Oct 07 17:53:56 2009 +100012.3 @@ -249,6 +249,7 @@12.4 }12.6 hotkeys_init();12.7 + serial_init();12.9 maple_reattach_all();12.10 INFO( "%s! ready...", APP_NAME );
13.1 --- a/src/netutil.c Mon Aug 03 08:41:11 2009 +100013.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000013.3 @@ -1,54 +0,0 @@13.4 -/**13.5 - * $Id$13.6 - *13.7 - * Network support functions13.8 - *13.9 - * Copyright (c) 2009 Nathan Keynes.13.10 - *13.11 - * This program is free software; you can redistribute it and/or modify13.12 - * it under the terms of the GNU General Public License as published by13.13 - * the Free Software Foundation; either version 2 of the License, or13.14 - * (at your option) any later version.13.15 - *13.16 - * This program is distributed in the hope that it will be useful,13.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of13.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13.19 - * GNU General Public License for more details.13.20 - */13.21 -13.22 -#include <string.h>13.23 -#include <unistd.h>13.24 -#include <sys/socket.h>13.25 -#include <netinet/in.h>13.26 -#include <arpa/inet.h>13.27 -#include <errno.h>13.28 -#include "netutil.h"13.29 -13.30 -int net_create_server_socket(const char *interface, int port )13.31 -{13.32 - struct sockaddr_in sin;13.33 - int fd = socket(AF_INET, SOCK_STREAM, 0);13.34 - if( fd == -1 ) {13.35 - ERROR( "Failed to create TCP socket!" );13.36 - return -1;13.37 - }13.38 -13.39 - sin.sin_family = AF_INET;13.40 - sin.sin_addr.s_addr = 0;13.41 - sin.sin_port = htons(port);13.42 -13.43 - if( interface != NULL ) {13.44 - if( !inet_aton(interface, &sin.sin_addr) ) {13.45 - /* TODO: hostname lookup */13.46 - }13.47 - }13.48 -13.49 - if( bind( fd, (struct sockaddr *)&sin, sizeof(sin) ) != 0 ||13.50 - listen(fd, 5) != 0 ) {13.51 - close(fd);13.52 - ERROR( "Failed to bind port %d (%s)", port, strerror(errno) );13.53 - return -1;13.54 - }13.55 - return fd;13.56 -}13.57 -
14.1 --- a/src/netutil.h Mon Aug 03 08:41:11 2009 +100014.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000014.3 @@ -1,58 +0,0 @@14.4 -/**14.5 - * $Id$14.6 - *14.7 - * GDB RDP server stub - SH4 + ARM14.8 - *14.9 - * Copyright (c) 2009 Nathan Keynes.14.10 - *14.11 - * This program is free software; you can redistribute it and/or modify14.12 - * it under the terms of the GNU General Public License as published by14.13 - * the Free Software Foundation; either version 2 of the License, or14.14 - * (at your option) any later version.14.15 - *14.16 - * This program is distributed in the hope that it will be useful,14.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of14.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14.19 - * GNU General Public License for more details.14.20 - */14.21 -14.22 -#ifndef lxdream_netutil_H14.23 -#define lxdream_netutil_H 114.24 -14.25 -#include <netinet/in.h>14.26 -#include "lxdream.h"14.27 -14.28 -/**14.29 - * Construct a server socket listening on the given interface and port. If port14.30 - * is 0, a dynamic port will be bound instead.14.31 - * This method does not register a listener.14.32 - * @return newly created socket fd, or -1 on failure.14.33 - */14.34 -int net_create_server_socket(const char *interface, int port );14.35 -14.36 -/**14.37 - * Callback invoked when data is available from the remote peer, or when the peer14.38 - * connects/disconnects.14.39 - *14.40 - * @param fd file descriptor of the connected socket14.41 - * @param data data supplied when the callback was registered14.42 - * @return TRUE to maintain the connection, FALSE to immediately disconnected + close.14.43 - */14.44 -typedef gboolean (*net_callback_t)( int fd, void *data );14.45 -14.46 -/**14.47 - * Register a TCP server socket listener on an already open (and listening)14.48 - * socket. The socket must not have been previously registered.14.49 - * @return TRUE on success, FALSE on failure.14.50 - *14.51 - * Note: Implementation is platform specific14.52 - */14.53 -gboolean net_register_tcp_listener( int fd, net_callback_t callback, void *data, void (*dealloc)(void*) );14.54 -14.55 -/**14.56 - * Unregister a socket that was previously registered with the system. This14.57 - * does not close the socket, but will remove any callbacks associated with the socket.14.58 - */14.59 -gboolean net_unregister_listener( int fd );14.60 -14.61 -#endif /* !lxdream_netutil_H */
15.1 --- a/src/serial.h Mon Aug 03 08:41:11 2009 +100015.2 +++ b/src/serial.h Wed Oct 07 17:53:56 2009 +100015.3 @@ -20,6 +20,8 @@15.5 #include <stdint.h>15.7 +#include "lxdream.h"15.8 +15.9 #ifdef __cplusplus15.10 extern "C" {15.11 #endif15.12 @@ -33,17 +35,44 @@15.13 #define SERIAL_2STOPBITS 0x0815.15 typedef struct serial_device {15.16 - void (*set_line_speed)(uint32_t bps);15.17 - void (*set_line_params)(int flags);15.18 - void (*receive_data)(uint8_t value);15.19 + void (*attach)(struct serial_device *dev);15.20 + void (*detach)(struct serial_device *dev);15.21 + void (*destroy)(struct serial_device *dev);15.22 + void (*set_line_speed)(struct serial_device *dev, uint32_t bps);15.23 + void (*set_line_params)(struct serial_device *dev, int flags);15.24 + void (*receive_data)(struct serial_device *dev, uint8_t value);15.25 } *serial_device_t;15.27 -void serial_attach_device( serial_device_t dev );15.28 -void serial_detach_device( );15.29 +serial_device_t serial_attach_device( serial_device_t dev );15.30 +serial_device_t serial_detach_device( );15.31 +serial_device_t serial_get_device( );15.32 +15.33 +/**15.34 + * Destroy a serial device.15.35 + */15.36 +void serial_destroy_device( serial_device_t dev );15.37 +15.39 void serial_transmit_data( char *data, int length );15.40 void serial_transmit_break( void );15.42 +/**15.43 + * Create a serial device on a host device identified by the given15.44 + * file (ie /dev/tty). If filename identifies a regular file, it is opened15.45 + * for output only.15.46 + */15.47 +serial_device_t serial_fd_device_new_filename( const gchar *filename );15.48 +15.49 +/**15.50 + * Create a serial device on the host console (stdin/stdout).15.51 + */15.52 +serial_device_t serial_fd_device_new_console();15.53 +15.54 +/**15.55 + * Create a serial device on a pair of file streams (in and out)15.56 + */15.57 +serial_device_t serial_fd_device_new_file( FILE *in, FILE *out, gboolean closeOnDestroy );15.58 +15.59 #ifdef __cplusplus15.60 }15.61 #endif
16.1 --- a/src/sh4/scif.c Mon Aug 03 08:41:11 2009 +100016.2 +++ b/src/sh4/scif.c Wed Oct 07 17:53:56 2009 +100016.3 @@ -28,7 +28,7 @@16.4 #include "serial.h"16.6 void SCIF_set_break(void);16.7 -16.8 +void SCIF_run_to(uint32_t nanosecs);16.9 /************************* External serial interface ************************/16.11 /**16.12 @@ -55,17 +55,41 @@16.13 serial_data_block_t serial_recvq_head = NULL, serial_recvq_tail = NULL;16.14 serial_device_t serial_device = NULL;16.16 -void serial_attach_device( serial_device_t dev )16.17 +serial_device_t serial_get_device( )16.18 {16.19 + return serial_device;16.20 +}16.21 +16.22 +serial_device_t serial_attach_device( serial_device_t dev )16.23 +{16.24 + serial_device_t olddev = serial_device;16.25 if( serial_device != NULL )16.26 serial_detach_device();16.27 serial_device = dev;16.28 + if( serial_device != NULL && serial_device->attach != NULL )16.29 + serial_device->attach(serial_device);16.30 + return olddev;16.31 }16.34 -void serial_detach_device( void )16.35 +serial_device_t serial_detach_device( void )16.36 {16.37 + serial_device_t dev = serial_device;16.38 + if( serial_device != NULL && serial_device->detach != NULL ) {16.39 + serial_device->detach(serial_device);16.40 + }16.41 serial_device = NULL;16.42 + return dev;16.43 +}16.44 +16.45 +void serial_destroy_device( serial_device_t dev )16.46 +{16.47 + if( dev != NULL ) {16.48 + if( serial_device == dev )16.49 + serial_detach_device();16.50 + if( dev->destroy )16.51 + dev->destroy(dev);16.52 + }16.53 }16.55 /**16.56 @@ -174,6 +198,7 @@16.58 uint32_t SCIF_tick_period = 0;16.59 uint32_t SCIF_tick_remainder = 0;16.60 +uint32_t SCIF_slice_cycle = 0;16.62 void SCIF_save_state( FILE *f )16.63 {16.64 @@ -445,7 +470,7 @@16.65 int baudrate = sh4_peripheral_freq / (32 * mult * (bbr+1) );16.67 if( serial_device != NULL && serial_device->set_line_speed != NULL )16.68 - serial_device->set_line_speed( baudrate );16.69 + serial_device->set_line_speed( serial_device, baudrate );16.71 SCIF_tick_period = sh4_peripheral_period * (32 * mult * (bbr+1));16.73 @@ -457,6 +482,7 @@16.75 MMIO_REGION_READ_FN( SCIF, reg )16.76 {16.77 + SCIF_run_to(sh4r.slice_cycle);16.78 reg &= 0xFFF;16.79 switch( reg ) {16.80 case SCFRDR2: /* Receive data */16.81 @@ -470,6 +496,7 @@16.83 MMIO_REGION_WRITE_FN( SCIF, reg, val )16.84 {16.85 + SCIF_run_to(sh4r.slice_cycle);16.86 uint32_t tmp;16.87 reg &= 0xFFF;16.88 switch( reg ) {16.89 @@ -482,7 +509,7 @@16.90 */16.91 val &= 0x007B;16.92 if( serial_device != NULL ) {16.93 - serial_device->set_line_params( val );16.94 + serial_device->set_line_params( serial_device, val );16.95 }16.96 tmp = MMIO_READ( SCIF, SCSMR2 );16.97 if( (tmp & 0x03) != (val & 0x03) ) {16.98 @@ -597,7 +624,7 @@16.99 int val = SCIF_sendq_dequeue();16.100 if( val != -1 && serial_device != NULL &&16.101 serial_device->receive_data != NULL ) {16.102 - serial_device->receive_data( val );16.103 + serial_device->receive_data( serial_device, val );16.104 }16.105 }16.107 @@ -632,11 +659,17 @@16.108 SCIF_update_line_speed();16.109 }16.111 -void SCIF_run_slice( uint32_t nanosecs )16.112 +void SCIF_run_to( uint32_t nanosecs )16.113 {16.114 - SCIF_tick_remainder += nanosecs;16.115 + SCIF_tick_remainder += nanosecs - SCIF_slice_cycle;16.116 while( SCIF_tick_remainder >= SCIF_tick_period ) {16.117 SCIF_tick_remainder -= SCIF_tick_period;16.118 SCIF_clock_tick();16.119 }16.120 }16.121 +16.122 +void SCIF_run_slice( uint32_t nanosecs )16.123 +{16.124 + SCIF_run_to(nanosecs);16.125 + SCIF_slice_cycle = 0;16.126 +}
.