Subversion Repositories Kolibri OS

Rev

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

Rev 1251 Rev 1254
Line 8... Line 8...
8
;;                                                                  ;;
8
;;                                                                  ;;
9
;; Status: under construction                                       ;;
9
;; Status: under construction                                       ;;
10
;;                                                                  ;;
10
;;                                                                  ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 12... Line 12...
12
 
12
 
Line 13... Line 13...
13
; $Revision: 1251 $
13
; $Revision: 1254 $
Line 14... Line 14...
14
 
14
 
Line 1136... Line 1136...
1136
 
1136
 
1137
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1137
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1138
;;                                         ;;
1138
;;                                         ;;
1139
;; Transmit                                ;;
1139
;; Transmit                                ;;
1140
;;                                         ;;
1140
;;                                         ;;
1141
;; In: buffer pointer in [esp]             ;;
1141
;; In: buffer pointer in [esp+4]             ;;
1142
;;     size of buffer in [esp+4]           ;;
1142
;;     size of buffer in [esp+8]           ;;
1143
;;     pointer to device structure in ebx  ;;
1143
;;     pointer to device structure in ebx  ;;
1144
;;                                         ;;
1144
;;                                         ;;
Line 1145... Line 1145...
1145
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1145
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1146
 
1146
 
1147
align 4
1147
align 4
1148
transmit:
1148
transmit:
1149
	DEBUGF	1,"Transmitting packet, buffer:%x, size:%u\n",[esp],[esp+4]
1149
	DEBUGF	1,"Transmitting packet, buffer:%x, size:%u\n",[esp],[esp+4]
1150
	mov	eax, [esp]
1150
	mov	eax, [esp+4]
1151
	DEBUGF	1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
1151
	DEBUGF	1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
1152
	[eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
1152
	[eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
Line 1153... Line 1153...
1153
	[eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
1153
	[eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
1154
	[eax+13]:2,[eax+12]:2
1154
	[eax+13]:2,[eax+12]:2
1155
 
1155
 
1156
	cmp	dword [esp+4], 1514
1156
	cmp	dword [esp+8], 1514
Line 1157... Line 1157...
1157
	jg	.finish 			; packet is too long
1157
	jg	.finish 			; packet is too long
1158
	cmp	dword [esp+4], 60
1158
	cmp	dword [esp+8], 60
1159
	jl	.finish 			; packet is too short
1159
	jl	.finish 			; packet is too short
Line 1165... Line 1165...
1165
	add	edi, [ebx + device.tx_buffer]
1165
	add	edi, [ebx + device.tx_buffer]
1166
	add	eax, [ebx + device.tx_ring]
1166
	add	eax, [ebx + device.tx_ring]
1167
	test	byte [eax + buf_head.status + 1], 80h
1167
	test	byte [eax + buf_head.status + 1], 80h
1168
	jnz	.nospace
1168
	jnz	.nospace
1169
; descriptor is free, copy data
1169
; descriptor is free, copy data
1170
	mov	esi, [esp]
1170
	mov	esi, [esp+4]
1171
	mov	ecx, [esp+4]
1171
	mov	ecx, [esp+8]
1172
	mov	edx, ecx
1172
	mov	edx, ecx
1173
	shr	ecx, 2
1173
	shr	ecx, 2
1174
	and	edx, 3
1174
	and	edx, 3
1175
	rep	movsd
1175
	rep	movsd
1176
	mov	ecx, edx
1176
	mov	ecx, edx
1177
	rep	movsb
1177
	rep	movsb
1178
; set length
1178
; set length
1179
	mov	ecx, [esp+4]
1179
	mov	ecx, [esp+8]
1180
	neg	ecx
1180
	neg	ecx
1181
	mov	[eax + buf_head.length], cx
1181
	mov	[eax + buf_head.length], cx
1182
; put to transfer queue
1182
; put to transfer queue
1183
	mov	[eax + buf_head.status], 0x8300
1183
	mov	[eax + buf_head.status], 0x8300
Line 1193... Line 1193...
1193
	and	[ebx + device.cur_tx], 3
1193
	and	[ebx + device.cur_tx], 3
1194
	DEBUGF	2," - Packet Sent! "
1194
	DEBUGF	2," - Packet Sent! "
Line 1195... Line 1195...
1195
 
1195
 
1196
.finish:
1196
.finish:
1197
	DEBUGF	2," - Done!\n"
-
 
1198
 ;;;       call    KernelFree
-
 
1199
	add	esp, 4+4 ; pop (balance stack)
-
 
1200
 
1197
	DEBUGF	2," - Done!\n"
Line 1201... Line 1198...
1201
	ret
1198
	ret
1202
 
1199
 
1203
.nospace:
1200
.nospace:
1204
	DEBUGF	1, 'ERROR: no free transmit descriptors\n'
-
 
1205
; todo: maybe somehow notify the kernel about the error?
1201
	DEBUGF	1, 'ERROR: no free transmit descriptors\n'
Line 1206... Line 1202...
1206
	add	esp, 4+4
1202
; todo: maybe somehow notify the kernel about the error?