[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MiNT-Net 0.0 , patch-001-tfs
Hello everyone,
here are some (unofficial, although i sent them to kay, too) patches
for MiNT-net. These will transform the device driver to xdd form,
which means MiNT >= 1.08 loads it when booting. The rest is some
rudimentary TurboC support for the lib and the test programs.
Have fun,
Thomas Schulze.
ts@uni-paderborn.de
--- /home/mint-net/net/makefile Mon Oct 25 21:48:52 1993
+++ net/makefile Wed Oct 27 11:47:02 1993
@@ -11,15 +11,24 @@
# only if you have applyed my patches for Fselect() or if a newer MiNT
# version implements this.
#
-# CPPFLAGS = -I../include -DNEW_SELECT
+# Commment out the definition of SELFINSTALL if you want an old style
+# device driver, ie a tos program. With SELFINSTALL you get sockdev.xdd
+# which MiNT will load while booting if its in /mint.
+#
+SELFINST = -DSELFINSTALL
+CPPFLAGS = -I../include -DNEW_SELECT $(SELFINST)
-CPPFLAGS = -I../include
+#CPPFLAGS = -I../include
CFLAGS = -Wall -mshort -O2 -fomit-frame-pointer
-SRCS = sockdev.c sockutil.c main.c intr.s
-OBJS = sockdev.o sockutil.o main.o intr.o
+SRCS = startup.s main.c sockdev.c sockutil.c intr.s
+OBJS = startup.o main.o sockdev.o sockutil.o intr.o
+ifeq ($(SELFINST), -DSELFINSTALL)
+DEVDRV = sockdev.xdd
+else
DEVDRV = sockdev.tos
+endif
SUBDIRS = unix
DOMAINS = unix/sock.a
@@ -33,12 +42,19 @@
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
sockdev: $(OBJS) $(DOMAINS)
+ifeq ($(SELFINST), -DSELFINSTALL)
+ $(LD) -s -o $(DEVDRV) $(OBJS) $(DOMAINS) -lgnu16
+else
$(CC) $(CFLAGS) $(OBJS) $(DOMAINS) -o $(DEVDRV)
+endif
toglclr -super $(DEVDRV)
chmod +x $(DEVDRV)
$(DOMAINS):
@for i in $(SUBDIRS); do $(MAKE) -C $$i; done;
+
+install: $(DEVDRV)
+ cp $(DEVDRV) /mint
clean:
rm -f $(OBJS)
--- /home/mint-net/net/main.c Mon Oct 25 17:17:30 1993
+++ net/main.c Wed Oct 27 13:04:12 1993
@@ -1,5 +1,7 @@
+#ifndef SELFINSTALL
#include <minimal.h>
#include <basepage.h>
+#endif
#include <osbind.h>
#include <mintbind.h>
#include "atarierr.h"
@@ -21,14 +23,37 @@
0
};
+void welcome (void);
-void
-welcome (void)
+#ifdef SELFINSTALL
+DEVDRV *
+initialize (struct kerinfo *ker)
{
- Cconws ("MiNT-Net 0.0, pre alpha test version\r\n");
- Cconws ("(w) 1993, Kay Roemer.\r\n");
-}
+ /* since mint-1.08 we have xdd's which are loaded when
+ * booting. so here are changes to make it work that way.
+ */
+ short i;
+ long res;
+
+ KERINFO = ker;
+
+ welcome();
+
+ res = d_cntl (DEV_INSTALL, sockdev_name, &sockdev_descr);
+
+ if (!res || res == EINVFN)
+ {
+ c_conws ("Unable to install net device!\r\n");
+ return (DEVDRV *) 0;
+ }
+
+ for (i = 0; init_func[i]; ++i) {
+ (*init_func[i]) ();
+ }
+ return (DEVDRV *) 1;
+}
+#else
int
main (argc, argv)
short argc;
@@ -50,3 +75,12 @@
/* NOTREACHED */
return 0;
}
+#endif
+
+void
+welcome (void)
+{
+ c_conws ("pMiNT-Net 0.0q, pre alpha test version\r\n");
+ c_conws ("(w) 1993, Kay Roemer.\r\n");
+}
+
--- /dev/null Wed Oct 27 17:26:04 1993
+++ net/startup.s Wed Oct 27 10:36:36 1993
@@ -0,0 +1,4 @@
+
+ jmp _initialize
+
+
--- /dev/null Wed Oct 27 17:26:06 1993
+++ lib/makefile.tcc Wed Oct 27 16:51:24 1993
@@ -0,0 +1,51 @@
+#
+# Makefile for the socket library.
+# modified by Thomas Schulze for use with TurboC
+#
+
+SHELL = /bin/sh
+
+# this is written to use my own tcc driver. its very experimental
+# and an awfull mess of hacks and tricks, so i will probably not
+# distribute it in the near future:-((
+
+CC = tcc -v
+LD = tcc -v -d
+
+#
+# if you define UNX2DOS, all path names specified by `struct sockaddr_un'
+# will be converted from unix style to dos style prior to passing them
+# to the OS. Note that this is time consuming, espacially for sendto().
+#
+CPPFLAGS = -I=..\\include -DUNX2DOS
+# -fabsolute-calls means use absolute calls inside modules when calling
+# functions. (means -P for TC users...)
+CFLAGS = -fabsolute-calls
+
+SRCS = socket.c socketpair.c bind.c listen.c connect.c accept.c \
+ recv.c send.c recvfrom.c sendto.c shutdown.c getsockname.c \
+ getpeername.c getsockopt.c setsockopt.c strerror.c perror.c
+
+OBJS = socket.o socketpair.o bind.o listen.o connect.o accept.o \
+ recv.o send.o recvfrom.o sendto.o shutdown.o getsockname.o \
+ getpeername.o getsockopt.o setsockopt.o strerror.o perror.o
+
+SOCKETLIB = socket.lib
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+all: lib
+
+lib: $(OBJS)
+ $(LD) -G -J -o $(SOCKETLIB) $(OBJS)
+
+clean:
+ rm -f $(OBJS) *.trg
+
+depend:
+ $(CC) -MM $(CPPFLAGS) *.c > depend
+
+ifeq (depend, $(wildcard depend))
+include depend
+endif
--- /dev/null Wed Oct 27 17:26:08 1993
+++ test/makefile.tcc Wed Oct 27 17:03:40 1993
@@ -0,0 +1,44 @@
+#
+# Makefile for the Mint-Net "test suite"
+#
+
+all: server client sockpair dgram dgramd speed speedd
+
+CC = tcc -v
+CFLAGS = -fabsolute-calls
+CPPFLAGS = -I=..\\lib
+LIBS = socket.lib
+
+server: server.o
+ $(CC) $(CFLAGS) server.o $(LIBS) -o server.ttp
+ chmod +x server.ttp
+
+client: client.o
+ $(CC) $(CFLAGS) client.o $(LIBS) -o client.ttp
+ chmod +x client.ttp
+
+speed: speed.o
+ $(CC) $(CFLAGS) speed.o $(LIBS) -o speed.ttp
+ chmod +x speed.ttp
+
+speedd: speedd.o
+ $(CC) $(CFLAGS) speedd.o $(LIBS) -o speedd.ttp
+ chmod +x speedd.ttp
+
+sockpair: sockpair.o
+ $(CC) $(CFLAGS) sockpair.o $(LIBS) -o sockpair.ttp
+ chmod +x sockpair.ttp
+
+dgram: dgram.o
+ $(CC) $(CFLAGS) dgram.o $(LIBS) -o dgram.ttp
+ chmod +x dgram.ttp
+
+dgramd: dgramd.o
+ $(CC) $(CFLAGS) dgramd.o $(LIBS) -o dgramd.ttp
+ chmod +x dgramd.ttp
+
+# No dependencies jet
+depend:
+
+clean:
+ rm -f *.o