Removed explicit copying of defaults.

It's the very purpose of the DATA segment to consolidate all items that potentially need to be copied from ROM to RAM. So there's no need to / point in doing that on a per-item-base.
This commit is contained in:
Oliver Schmidt 2014-04-27 19:17:48 +02:00
parent 3af8fadbef
commit 09c718b74f
8 changed files with 13 additions and 57 deletions

View File

@ -17,6 +17,5 @@ SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
IP65_DEFAULTS: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
}

View File

@ -18,6 +18,5 @@ SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw;
IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss;
}

View File

@ -19,6 +19,5 @@ SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw;
IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss;
}

View File

@ -32,7 +32,6 @@ WIZNET_DATA_REG = WIZNET_BASE+3
.import arp_init
.import ip_init
.import cfg_init
.importzp eth_dest
.importzp eth_src
@ -168,7 +167,6 @@ eth_init:
; inputs: none
; outputs: carry flag is set if there was an error, clear otherwise
w5100_ip65_init:
jsr cfg_init ; copy default values (including MAC address) to RAM
jsr eth_init
bcc @ok

View File

@ -4,16 +4,12 @@
.include "../inc/common.i"
.export cfg_mac
.export cfg_mac_default
.export cfg_ip
.export cfg_netmask
.export cfg_gateway
.export cfg_dns
.export cfg_tftp_server
.export cfg_get_configuration_ptr
.export cfg_init
.export cfg_default_drive
.export cfg_size
.export dhcp_server
.import copymem
@ -21,6 +17,19 @@
.importzp copy_dest
.data
cfg_mac: .byte $00, $80, $10, $00, $51, $00 ; mac address to be assigned to local machine
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)
; cfg_gateway: .byte 0, 0, 0, 0 ; ip address of router on local network (will be overwritten if dhcp_init is called)
cfg_gateway: .byte 192, 168, 1, 1 ; ip address of router on local network (will be overwritten if dhcp_init is called)
cfg_dns: .byte 0, 0, 0, 0 ; ip address of dns server to use (will be overwritten if dhcp_init is called)
dhcp_server: .byte 0, 0, 0, 0 ; will be set address of dhcp server that configuration was obtained from
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
@ -35,45 +44,6 @@ cfg_get_configuration_ptr:
clc
rts
; copy the IP stack defaults (probably stored in ROM) to the running values in RAM
; inputs: none
; outputs: AX = pointer to IP configuration.
cfg_init:
ldax #cfg_mac_default
stax copy_src
ldax #cfg_mac
stax copy_dest
ldax #cfg_size
jmp copymem
.segment "IP65_DEFAULTS"
cfg_mac_default: .byte $00, $80, $10, $00, $51, $00 ; mac address to be assigned to local machine
cfg_ip_default: .byte 192, 168, 1, 64 ; ip address of local machine (will be overwritten if dhcp_init is called)
; cfg_ip_default: .byte 0, 0, 0, 0 ; ip address of local machine (will be overwritten if dhcp_init is called)
cfg_netmask_default: .byte 255, 255, 255, 0 ; netmask of local network (will be overwritten if dhcp_init is called)
; cfg_gateway_default: .byte 0, 0, 0, 0 ; ip address of router on local network (will be overwritten if dhcp_init is called)
cfg_gateway_default: .byte 192, 168, 1, 1 ; ip address of router on local network (will be overwritten if dhcp_init is called)
cfg_dns_default: .byte 0, 0, 0, 0 ; ip address of dns server to use (will be overwritten if dhcp_init is called)
dhcp_server_default: .byte 0, 0, 0, 0 ; will be set address of dhcp server that configuration was obtained from
cfg_tftp_server_default: .byte $ff, $ff, $ff, $ff ; ip address of server to send tftp requests to (can be a broadcast address)
cfg_default_drive_default: .byte 8
cfg_end_defaults:
cfg_size=cfg_end_defaults-cfg_mac_default+1
.bss
cfg_mac: .res 6 ; mac address to be assigned to local machine
cfg_ip: .res 4 ; ip address of local machine (will be overwritten if dhcp_init is called)
cfg_netmask: .res 4 ; netmask of local network (will be overwritten if dhcp_init is called)
cfg_gateway: .res 4 ; ip address of router on local network (will be overwritten if dhcp_init is called)
cfg_dns: .res 4 ; ip address of dns server to use (will be overwritten if dhcp_init is called)
dhcp_server: .res 4 ; will be set address of dhcp server that configuration was obtained from
cfg_tftp_server: .res 4 ; ip address of server to send tftp requests to (can be a broadcast address)
cfg_default_drive: .res 1
; -- LICENSE FOR config.s --

View File

@ -16,8 +16,6 @@
.export ip65_error
.import cfg_init
.import eth_init
.import timer_init
.import arp_init
@ -77,7 +75,6 @@ ip65_random_word:
; inputs: none
; outputs: none
ip65_init:
jsr cfg_init ; copy default values (including MAC address) to RAM
jsr eth_init ; initialize ethernet driver
bcc @ok

View File

@ -11,7 +11,6 @@ SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
IP65_DEFAULTS: load = RAM, type = rw,define = yes, optional=yes;
BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes; # must sit just below stack
ZPSAVE: load = RAM, type = bss;

View File

@ -1,6 +1,5 @@
.export _libnet_init
.export _libnet_get_config
.export _libnet_MAC
.import cfg_init
.import cfg_ip
@ -8,11 +7,7 @@
.import ip65_init
.import dhcp_init
.import ip65_error
.import cfg_mac_default
.import cfg_mac
.import cfg_size
_libnet_MAC = cfg_mac_default
; load A/X macro
.macro ldax arg