Subversion Repositories Kolibri OS

Rev

Rev 593 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 593 Rev 907
Line 19... Line 19...
19
;;                                                              ;;
19
;;                                                              ;;
20
;;10.01.2007 Bugfix for checksum function from Paolo Franchetti ;;
20
;;10.01.2007 Bugfix for checksum function from Paolo Franchetti ;;
21
;;                                                              ;;
21
;;                                                              ;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 23... Line 23...
23
 
23
 
Line 24... Line 24...
24
$Revision: 593 $
24
$Revision: 907 $
25
 
25
 
26
 
26
 
Line 35... Line 35...
35
;
35
;
36
;*******************************************************************
36
;*******************************************************************
Line 37... Line 37...
37
 
37
 
38
uglobal
38
uglobal
39
StackCounters:
39
StackCounters:
40
  dumped_rx_count:    dd  0
40
  dumped_rx_count     dd  0
41
  arp_tx_count:       dd  0
41
  arp_tx_count:       dd  0
42
  arp_rx_count:       dd  0
42
  arp_rx_count:       dd  0
43
  ip_rx_count:	      dd  0
43
  ip_rx_count:	      dd  0
44
  ip_tx_count:	      dd  0
44
  ip_tx_count:	      dd  0
Line 45... Line 45...
45
endg
45
endg
46
 
46
 
47
; socket buffers
47
; socket buffers
Line 48... Line 48...
48
SOCKETBUFFSIZE	   equ	      4096  ; state + config + buffer.
48
SOCKETBUFFSIZE	   equ	      4096  ; state + config + buffer.
Line 49... Line 49...
49
SOCKETHEADERSIZE   equ	      76    ; thus 4096 - SOCKETHEADERSIZE bytes data
49
SOCKETHEADERSIZE   equ	      76+8+8  ; thus 4096 - SOCKETHEADERSIZE bytes data
50
 
50
 
51
NUM_SOCKETS	   equ	      16    ; Number of open sockets supported. Was 20
51
;NUM_SOCKETS        equ        16    ; Number of open sockets supported. Was 20
52
 
52
 
53
; IPBUFF status values
53
; IPBUFF status values
Line 54... Line 54...
54
BUFF_EMPTY	   equ	   0
54
BUFF_EMPTY	   equ	   0
Line 55... Line 55...
55
BUFF_RX_FULL	   equ	   1
55
BUFF_RX_FULL	   equ	   1
-
 
56
BUFF_ALLOCATED	   equ	   2
56
BUFF_ALLOCATED	   equ	   2
57
BUFF_TX_FULL	   equ	   3
57
BUFF_TX_FULL	   equ	   3
58
 
58
 
59
NUM_IPBUFFERS	   equ	   20	 ; buffers allocated for TX/RX
59
NUM_IPBUFFERS	   equ	   20	 ; buffers allocated for TX/RX
60
 
Line 92... Line 93...
92
 
93
 
Line 93... Line 94...
93
 
94
 
94
; TODO :: empty memory area
95
; TODO :: empty memory area
95
 
96
 
96
; Address of selected socket
97
; Address of selected socket
97
sktAddr 	     equ   stack_data + 32
98
;sktAddr              equ   stack_data + 32
98
; Parameter to checksum routine - data ptr
99
; Parameter to checksum routine - data ptr
99
checkAdd1	     equ   stack_data + 36
100
checkAdd1	     equ   stack_data + 36
Line 108... Line 109...
108
 
109
 
109
; holds the TCP/UDP pseudo header. SA|DA|0|prot|UDP len|
110
; holds the TCP/UDP pseudo header. SA|DA|0|prot|UDP len|
Line 110... Line 111...
110
pseudoHeader	     equ   stack_data + 50
111
pseudoHeader	     equ   stack_data + 50
111
 
112
 
112
; receive and transmit IP buffer allocation
113
; receive and transmit IP buffer allocation
113
sockets 	     equ   stack_data + 62
114
;sockets              equ   stack_data + 62
114
Next_free2	     equ   sockets + (SOCKETBUFFSIZE * NUM_SOCKETS)
115
Next_free2 equ stack_data + 62;Next_free2           equ   sockets + (SOCKETBUFFSIZE * NUM_SOCKETS)
115
; 1560 byte buffer for rx / tx ethernet packets
116
; 1560 byte buffer for rx / tx ethernet packets
116
Ether_buffer	     equ   Next_free2
117
Ether_buffer	     equ   Next_free2
117
Next_free3	     equ   Ether_buffer + 1518
118
Next_free3	     equ   Ether_buffer + 1518
Line 126... Line 127...
126
;                    equ    resendBuffer + ( IPBUFFSIZE * NUMRESENDENTRIES )
127
;                    equ    resendBuffer + ( IPBUFFSIZE * NUMRESENDENTRIES )
Line 127... Line 128...
127
 
128
 
-
 
129
 
128
 
130
 
-
 
131
;resendQ             equ     0x770000
Line -... Line 132...
-
 
132
;resendBuffer        equ     resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP        ; XTODO: validate size
-
 
133
resendBuffer	    equ     resendQ + ( 8 * NUMRESENDENTRIES ) ; for TCP
-
 
134
 
-
 
135
 
Line 129... Line 136...
129
 
136
uglobal
130
;resendQ             equ     0x770000
137
net_sockets_mutex dd 0
131
resendBuffer	    equ     resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP
138
net_sockets rd 2
132
 
139
endg
Line 149... Line 156...
149
; Below, the main network layer source code is included
156
; Below, the main network layer source code is included
150
;
157
;
151
include "queue.inc"
158
include "queue.inc"
152
include "eth_drv/ethernet.inc"
159
include "eth_drv/ethernet.inc"
153
include "ip.inc"
160
include "ip.inc"
154
include "icmp.inc"
-
 
155
include "tcp.inc"
-
 
156
include "udp.inc"
-
 
157
include "socket.inc"
161
include "socket.inc"
Line 158... Line 162...
158
 
162
 
159
;***************************************************************************
163
;***************************************************************************
160
;   Function
164
;   Function
Line 169... Line 173...
169
;***************************************************************************
173
;***************************************************************************
Line 170... Line 174...
170
 
174
 
171
stack_init:
175
stack_init:
172
	; Init two address spaces with default values
176
	; Init two address spaces with default values
-
 
177
	_memset_dw	stack_data_start, 0, 0x20000/4
173
	_memset_dw	stack_data_start, 0, 0x20000/4
178
	;_memset_dw      resendQ, 0xFFFFFFFF, NUMRESENDENTRIES   ; XTODO: validate size
Line 174... Line 179...
174
	_memset_dw	resendQ, 0xFFFFFFFF, NUMRESENDENTRIES
179
	_memset_dw	resendQ, 0xFFFFFFFF, NUMRESENDENTRIES * 2
175
 
180
 
Line 176... Line 181...
176
	; Queries initialization
181
	; Queries initialization
Line 929... Line 934...
929
    mul     ecx
934
    mul     ecx
930
    add     eax, IPbuffs
935
    add     eax, IPbuffs
931
    pop     edx
936
    pop     edx
Line 932... Line 937...
932
 
937
 
933
    push    eax 		    ; save address of IP data
-
 
934
 
938
    push    eax 		    ; save address of IP data
935
    ; Get the address of the callers data
939
    ; Get the address of the callers data
936
    mov     edi,[TASK_BASE]
940
    mov     edi,[TASK_BASE]
937
    add     edi,TASKDATA.mem_start
941
    add     edi,TASKDATA.mem_start
938
    add     edx,[edi]
942
    add     edx,[edi]
939
    mov     edi, edx
-
 
940
 
943
    mov     edi, edx
Line 941... Line 944...
941
    pop     eax
944
    pop     eax
942
 
945
 
943
    mov     ecx, 1500		; should get the actual number of bytes to write
946
    mov     ecx, 1500		; should get the actual number of bytes to write