From c95574cff8039b0c54e154686a212892b1fe424e Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Mon, 28 Apr 2014 18:54:43 +0200
Subject: [PATCH] Removed libnet experiment.
---
libnet/Makefile | 52 ---------------------------
libnet/libnet.h | 47 ------------------------
libnet/libnet.s | 90 ----------------------------------------------
libnet/test_sntp.c | 60 -------------------------------
4 files changed, 249 deletions(-)
delete mode 100644 libnet/Makefile
delete mode 100644 libnet/libnet.h
delete mode 100644 libnet/libnet.s
delete mode 100644 libnet/test_sntp.c
diff --git a/libnet/Makefile b/libnet/Makefile
deleted file mode 100644
index 6950566..0000000
--- a/libnet/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-CC=cc65
-CL=cl65
-AS=ca65
-LD=ld65
-CFLAGS=-Oirs -t $(TARGET)
-AFLAGS=
-
-
-
-IP65LIB=../ip65/ip65.lib
-IP65TCPLIB=../ip65/ip65_tcp.lib
-C64RRNETLIB=../drivers/c64rrnet.lib
-C64WIZNETLIB=../drivers/c64wiznet.lib
-IP65WIZNETLIB=../ip65/ip65_wiznet.lib
-A2UTHERLIB=../drivers/a2uther.lib
-A2LANCEGSLIB=../drivers/a2lancegs.lib
-VIC20RRNETLIB=../drivers/vic20rrnet.lib
-LIBNET=libnet.o
-
-INCFILES=\
- ../inc/common.i\
- ../inc/commonprint.i\
- ../inc/net.i\
-
-all: \
- ip65 \
- drivers \
- libnet.o \
- test_sntp.prg \
-
-ip65:
- make -C ../ip65 all
-
-drivers:
- make -C ../drivers all
-
-%.o: %.s
- $(AS) $(AFLAGS) $<
-
-test_sntp.prg: test_sntp.c $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) $(LIBNET)
- $(CL) $< -m test_sntp.map -C c64libnet.cfg -o $@ $(LIBNET) $(IP65TCPLIB) $(C64RRNETLIB)
- $(CC) test_sntp.c #this just makes a asm listing to help debug
-
-
-
-clean:
- -rm -f *.o *.pg2 *.prg *.map
- -rm -f ip65test.dsk
-
-
-distclean: clean
- -rm -f *~
diff --git a/libnet/libnet.h b/libnet/libnet.h
deleted file mode 100644
index daf3350..0000000
--- a/libnet/libnet.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#ifndef _LIBNET_H
-#define _LIBNET_H
-
-
-/* IP configuration structure */
-typedef unsigned char u8;
-typedef unsigned char libnet_err_t;
-
-typedef struct ip_config {
- u8 ip_addr[4];
- u8 netmask[4];
- u8 gateway_addr[4];
- u8 dns_server_addr[4];
-} IP_CONFIG;
-
-
-#define LIBNET_USE_DHCP 0x0000
-
-extern libnet_err_t __fastcall__ libnet_init (IP_CONFIG* config_p);
-extern void __fastcall__ libnet_get_config (IP_CONFIG* config_p);
-extern char libnet_MAC[6];
-
-
-
-
-#define LIBNET_OK 0x00
-#define LIBNET_ERROR_PORT_IN_USE 0x80
-#define LIBNET_ERROR_TIMEOUT_ON_RECEIVE 0x81
-#define LIBNET_ERROR_TRANSMIT_FAILED 0x82
-#define LIBNET_ERROR_TRANSMISSION_REJECTED_BY_PEER 0x83
-#define LIBNET_ERROR_INPUT_TOO_LARGE 0x84
-#define LIBNET_ERROR_DEVICE_FAILURE 0x85
-#define LIBNET_ERROR_ABORTED_BY_USER 0x86
-#define LIBNET_ERROR_LISTENER_NOT_AVAILABLE 0x87
-#define LIBNET_ERROR_NO_SUCH_LISTENER 0x88
-#define LIBNET_ERROR_CONNECTION_RESET_BY_PEER 0x89
-#define LIBNET_ERROR_CONNECTION_CLOSED 0x8A
-#define LIBNET_ERROR_TOO_MANY_ERRORS 0x8B
-#define LIBNET_ERROR_FILE_ACCESS_FAILURE 0x90
-#define LIBNET_ERROR_MALFORMED_URL 0xA0
-#define LIBNET_ERROR_DNS_LOOKUP_FAILED 0xA1
-#define LIBNET_ERROR_OPTION_NOT_SUPPORTED 0xFE
-#define LIBNET_ERROR_FUNCTION_NOT_SUPPORTED 0xFF
-
-
-#endif
diff --git a/libnet/libnet.s b/libnet/libnet.s
deleted file mode 100644
index 1771ace..0000000
--- a/libnet/libnet.s
+++ /dev/null
@@ -1,90 +0,0 @@
-.export _libnet_init
-.export _libnet_get_config
-
-.import cfg_init
-.import cfg_ip
-.import copymem
-.import ip65_init
-.import dhcp_init
-.import ip65_error
-.import cfg_mac
-
-; load A/X macro
-.macro ldax arg
-.if (.match (.left (1, arg), #)) ; immediate mode
- lda #<(.right (.tcount (arg)-1, arg))
- ldx #>(.right (.tcount (arg)-1, arg))
-.else ; assume absolute or zero page
- lda arg
- ldx 1+(arg)
-.endif
-.endmacro
-
-; store A/X macro
-.macro stax arg
- sta arg
- stx 1+(arg)
-.endmacro
-
-NO_ERROR = $00
-
-.importzp copy_src
-.importzp copy_dest
-
-
-.code
-
-_libnet_init:
- sta copy_src
- stx copy_src+1
- beq @dhcp_request
- ldax #cfg_ip
- stax copy_dest
- ldax #$10 ; 4 items of config data
- jsr copymem
- jsr ip65_init
-@check_error:
- bcc @ok
- lda ip65_error
- rts
-@ok:
- lda #NO_ERROR
- rts
-
-@dhcp_request:
- jsr ip65_init
- jsr dhcp_init
- jmp @check_error
-
-_libnet_get_config:
- stax copy_dest
- ldax #cfg_ip
- stax copy_src
- ldax #$10 ; 4 items of config data
- jmp copymem
-
-
-.bss
-
-tmp_ax: .res 2
-
-
-
-; -- LICENSE FOR libnet.s --
-; The contents of this file are subject to the Mozilla Public License
-; Version 1.1 (the "License"); you may not use this file except in
-; compliance with the License. You may obtain a copy of the License at
-; http://www.mozilla.org/MPL/
-;
-; Software distributed under the License is distributed on an "AS IS"
-; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-; License for the specific language governing rights and limitations
-; under the License.
-;
-; The Original Code is libnet.
-;
-; The Initial Developer of the Original Code is Jonno Downes,
-; jonno@jamtronix.com.
-; Portions created by the Initial Developer are Copyright (C) 2012
-; Jonno DOwnes. All Rights Reserved.
-; -- LICENSE END --
diff --git a/libnet/test_sntp.c b/libnet/test_sntp.c
deleted file mode 100644
index 5f3207f..0000000
--- a/libnet/test_sntp.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include
-#include
-#include
-#include "libnet.h"
-
-/*
-#define SECONDS_IN_DAY 86400
-#define NTP_TO_UNIX = 2208988800 //((70 * 365 + 17) * 86400);
-struct tm* __fastcall__ sntp_timestamp_to_tm(unsigned long sntp_timestamp) {
- unsigned long epoch_timestamp=sntp_timestamp-NTP_TO_UNIX;
- return (gmtime(&epoch_timestamp));
-}
-int main (void)
-{
- unsigned long timestamp=0xd2b929e6;
- signed long utc_offset=-10;
- struct tm * _tm;
- timestamp+=(utc_offset*3600);
- _tm=sntp_timestamp_to_tm(timestamp);
- printf ("%02d:%02d:%02d\n",_tm->tm_hour,_tm->tm_min,_tm->tm_sec);
- puts (asctime(_tm));
- return EXIT_SUCCESS;
-}
-
-*/
-
-char * addr_to_s(u8* a) {
- static char buffer[16];
- sprintf(buffer,"%u.%u.%u.%u",a[0],a[1],a[2],a[3]);
- return(buffer);
-}
-void showconfig(void) {
- IP_CONFIG config_p;
- libnet_get_config(&config_p);
- printf ("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",libnet_MAC[0],libnet_MAC[1],
- libnet_MAC[2],libnet_MAC[3],
- libnet_MAC[4],libnet_MAC[5],);
- printf ("IP: %s\n",addr_to_s(config_p.ip_addr));
- printf ("NETMASK: %s\n",addr_to_s(config_p.netmask));
- printf ("GATEWAY: %s\n",addr_to_s(config_p.gateway_addr));
- printf ("DNS: %s\n",addr_to_s(config_p.dns_server_addr));
-}
-int main (void)
-{
- IP_CONFIG _default_config ={
- {1,2,3,4}, //IP address
- {255,255,255,0}, // netmask
- {192,168,1,1}, //default gateway
- {192,168,2,1}, // dns server
- };
-
- libnet_err_t ln_err;
-
-// ln_err=libnet_init(&_default_config);
- ln_err=libnet_init(LIBNET_USE_DHCP);
-
- printf("result: %02x\n",ln_err);
- showconfig();
- return EXIT_SUCCESS;
-}