From ae98e5c01d1615b7b1a74be31e4643064cb5a168 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Wed, 8 Jul 2015 16:05:19 +0200
Subject: [PATCH] Removed cfg_get_configuration_ptr.
cfg_get_configuration_ptr was introduced for NB64 - which is out of scope for this IP65.
---
inc/commonprint.i | 44 ++++++++++++++++-------------------------
inc/net.i | 2 --
ip65/config.s | 19 +-----------------
ip65/udp.s | 11 +++++++++++
test/cifs.s | 1 -
test/dns.s | 1 -
test/geturl.s | 1 -
test/parsequerystring.s | 1 -
test/parser.s | 1 -
test/ping.s | 1 -
test/sntp.s | 1 -
test/tftp.s | 1 -
12 files changed, 29 insertions(+), 55 deletions(-)
diff --git a/inc/commonprint.i b/inc/commonprint.i
index 66500c9..03bbdbf 100644
--- a/inc/commonprint.i
+++ b/inc/commonprint.i
@@ -33,6 +33,12 @@
.import eth_driver_name
.import eth_driver_io_base
.importzp copy_src
+.import cfg_mac
+.import cfg_ip
+.import cfg_netmask
+.import cfg_gateway
+.import cfg_dns
+.import dhcp_server
.import cfg_tftp_server
pptr = ptr1
@@ -107,45 +113,32 @@ print_ip_config:
ldax #mac_address_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- ; first 6 bytes of cfg_get_configuration_ptr is MAC address
+ ldax #cfg_mac
jsr print_mac
jsr print_cr
ldax #ip_address_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- adc #KPR_CFG_IP
- bcc :+
- inx
-: jsr print_dotted_quad
+ ldax #cfg_ip
+ jsr print_dotted_quad
jsr print_cr
ldax #netmask_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- adc #KPR_CFG_NETMASK
- bcc :+
- inx
-: jsr print_dotted_quad
+ ldax #cfg_netmask
+ jsr print_dotted_quad
jsr print_cr
ldax #gateway_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- adc #KPR_CFG_GATEWAY
- bcc :+
- inx
-: jsr print_dotted_quad
+ ldax #cfg_gateway
+ jsr print_dotted_quad
jsr print_cr
ldax #dns_server_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- adc #KPR_CFG_DNS_SERVER
- bcc :+
- inx
-: jsr print_dotted_quad
+ ldax #cfg_dns
+ jsr print_dotted_quad
jsr print_cr
ldax #tftp_server_msg
@@ -156,11 +149,8 @@ print_ip_config:
ldax #dhcp_server_msg
jsr print_ascii_as_native
- jsr cfg_get_configuration_ptr ; ax=base config, carry flag clear
- adc #KPR_CFG_DHCP_SERVER
- bcc :+
- inx
-: jsr print_dotted_quad
+ ldax #dhcp_server
+ jsr print_dotted_quad
jsr print_cr
rts
diff --git a/inc/net.i b/inc/net.i
index 30d6359..5437b61 100644
--- a/inc/net.i
+++ b/inc/net.i
@@ -11,8 +11,6 @@
.import dhcp_init
.import dhcp_server
-.import cfg_get_configuration_ptr
-
.ifdef A2_SLOT_SCAN
.import a2_set_slot
.endif
diff --git a/ip65/config.s b/ip65/config.s
index c53077e..ca342dd 100644
--- a/ip65/config.s
+++ b/ip65/config.s
@@ -11,12 +11,10 @@
.export dhcp_server
.export cfg_tftp_server
-.export cfg_get_configuration_ptr
-
.data
-cfg_mac: .byte $00, $80, $10, $00, $51, $00 ; mac address to be assigned to local machine
+cfg_mac: .byte $00, $80, $10, $00, $51, $00 ; mac address of local machine (will be overwritten if ip65_init is called)
cfg_ip: .byte 192, 168, 1, 64 ; ip address of local machine (will be overwritten if dhcp_init is called)
; cfg_ip: .byte 0, 0, 0, 0 ; ip address of local machine (will be overwritten if dhcp_init is called)
cfg_netmask: .byte 255, 255, 255, 0 ; netmask of local network (will be overwritten if dhcp_init is called)
@@ -27,21 +25,6 @@ dhcp_server: .byte 0, 0, 0, 0 ; will b
cfg_tftp_server: .byte $ff, $ff, $ff, $ff ; ip address of server to send tftp requests to (can be a broadcast address)
-.code
-
-; return a pointer to where the IP configuration is kept
-; this is really only useful for the NB65 API - for anything
-; linking directly against ip65, you would just import the
-; address of the individual configuration elements, rather
-; than use a base pointer+offsets to find each item.
-; inputs: none
-; outputs: AX = pointer to IP configuration.
-cfg_get_configuration_ptr:
- ldax #cfg_mac
- clc
- rts
-
-
; -- LICENSE FOR config.s --
; The contents of this file are subject to the Mozilla Public License
diff --git a/ip65/udp.s b/ip65/udp.s
index 794d327..b085fe9 100644
--- a/ip65/udp.s
+++ b/ip65/udp.s
@@ -16,6 +16,7 @@
.export udp_add_listener
.export udp_remove_listener
.export udp_send
+.export udp_send_internal
.export udp_callback
@@ -254,7 +255,17 @@ udp_send:
stax copy_dest
ldax udp_send_len
jsr copymem
+ ; now we can fall through into udp_send_internal
+; send udp packet with data at (udp_outp + udp_data)
+; inputs:
+; udp_send_dest: destination ip address (4 bytes)
+; udp_send_dest_port: destination port (2 bytes)
+; udp_send_src_port: source port (2 bytes)
+; udp_send_len: length of data to send (exclusive of any headers)
+; outputs:
+; carry flag is set if an error occured, clear otherwise
+udp_send_internal:
ldx #3 ; copy virtual header addresses
: lda udp_send_dest,x
sta udp_vh + udp_vh_dest,x ; set virtual header destination
diff --git a/test/cifs.s b/test/cifs.s
index 4543cb2..c85af11 100644
--- a/test/cifs.s
+++ b/test/cifs.s
@@ -4,7 +4,6 @@
.import exit_to_basic
-.import cfg_get_configuration_ptr
.import cifs_l1_encode
.import cifs_l1_decode
.import cifs_start
diff --git a/test/dns.s b/test/dns.s
index 8075cff..94e6792 100644
--- a/test/dns.s
+++ b/test/dns.s
@@ -8,7 +8,6 @@
.import dns_resolve
.import dns_ip
.import dns_status
-.import cfg_get_configuration_ptr
; keep LD65 happy
diff --git a/test/geturl.s b/test/geturl.s
index 8ab7bcc..5b6469c 100644
--- a/test/geturl.s
+++ b/test/geturl.s
@@ -4,7 +4,6 @@
.import print_a
.import get_key
-.import cfg_get_configuration_ptr
.import ascii_to_native
.import parser_init
.import parser_skip_next
diff --git a/test/parsequerystring.s b/test/parsequerystring.s
index a64d27f..593abe1 100644
--- a/test/parsequerystring.s
+++ b/test/parsequerystring.s
@@ -4,7 +4,6 @@
.import print_a
.import get_key
-.import cfg_get_configuration_ptr
.import ascii_to_native
.import http_parse_request
diff --git a/test/parser.s b/test/parser.s
index bdf6243..93bfec5 100644
--- a/test/parser.s
+++ b/test/parser.s
@@ -4,7 +4,6 @@
.import print_a
.import get_key
-.import cfg_get_configuration_ptr
.import ascii_to_native
.import parser_init
.import parser_skip_next
diff --git a/test/ping.s b/test/ping.s
index f68f387..6133a34 100644
--- a/test/ping.s
+++ b/test/ping.s
@@ -4,7 +4,6 @@
.import exit_to_basic
-.import cfg_get_configuration_ptr
.import copymem
.importzp copy_src
.importzp copy_dest
diff --git a/test/sntp.s b/test/sntp.s
index 640734e..6fca679 100644
--- a/test/sntp.s
+++ b/test/sntp.s
@@ -3,7 +3,6 @@
.include "../inc/net.i"
.import exit_to_basic
-.import cfg_get_configuration_ptr
.import dns_set_hostname
.import dns_resolve
.import dns_ip
diff --git a/test/tftp.s b/test/tftp.s
index ba1a1c7..5514ca3 100644
--- a/test/tftp.s
+++ b/test/tftp.s
@@ -4,7 +4,6 @@
.import exit_to_basic
-.import cfg_get_configuration_ptr
.import copymem
.importzp copy_src
.importzp copy_dest