Subversion Repositories Kolibri OS

Rev

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

Rev 1519 Rev 1527
Line 339... Line 339...
339
create_new_struct:
339
create_new_struct:
Line 340... Line 340...
340
 
340
 
341
	cmp	[devices], MAX_DEVICES
341
	cmp	[devices], MAX_DEVICES
Line 342... Line -...
342
	jge	.fail
-
 
343
 
342
	jge	.fail
344
	push	edx
-
 
345
	stdcall KernelAlloc, device.size
-
 
346
	pop	edx
-
 
347
	test	eax, eax
-
 
Line 348... Line 343...
348
	jz	.fail
343
 
349
	mov	ebx, eax
344
	allocate_and_clear ebx, device.size, .fail	; Allocate the buffer for device structure
350
 
345
 
351
	mov	[device.reset], reset
346
	mov	[device.reset], reset
Line 356... Line 351...
356
	mov	[device.name], my_service
351
	mov	[device.name], my_service
Line 357... Line 352...
357
 
352
 
Line 358... Line 353...
358
	ret
353
	ret
359
 
354
 
360
.fail:
355
  .fail:
361
	add	esp, 4
356
	add	esp, 4		; return to caller of 'hook'
Line 362... Line 357...
362
	or	eax, -1
357
	or	eax, -1
Line 676... Line 671...
676
;   Function
671
;   Function
677
;      transmit
672
;      transmit
678
; buffer in [esp+4], size in [esp+8], pointer to device struct in ebx
673
; buffer in [esp+4], size in [esp+8], pointer to device struct in ebx
679
;***************************************************************************
674
;***************************************************************************
Line 680... Line -...
680
 
-
 
681
; TODO: use a RING-buffer
-
 
682
 
675
 
683
align 4
676
align 4
Line 684... Line 677...
684
transmit:
677
transmit:
685
 
678
 
Line 725... Line 718...
725
	mov	eax, [esp + 8]			 ; Get packet size in eax
718
	mov	eax, [esp + 8]			 ; Get packet size in eax
Line 726... Line 719...
726
 
719
 
727
	add	dword [device.bytes_tx], eax
720
	add	dword [device.bytes_tx], eax
Line 728... Line -...
728
	adc	dword [device.bytes_tx + 4], 0
-
 
729
 
-
 
730
.finish:
-
 
731
	call	Kernelfree
-
 
732
	add	esp, 4
-
 
733
	xor	eax, eax
-
 
734
	ret
721
	adc	dword [device.bytes_tx + 4], 0
735
 
-
 
736
.err:
-
 
737
	call	Kernelfree
722
 
-
 
723
.err:
-
 
724
	or	eax, -1
738
	add	esp, 4
725
.finish:
-
 
726
	stdcall KernelFree, [esp+4]
Line 739... Line 727...
739
	or	eax, -1
727
	ret	8
740
	ret
728
 
741
 
729
 
Line 769... Line 757...
769
 
757
 
770
	loop	.nextdevice
758
	loop	.nextdevice
Line 771... Line -...
771
	ret
-
 
772
 
759
	ret
773
 
760
 
774
 
761
 
775
; looks like we've found a device wich received a packet..
762
; looks like we've found a device wich received a packet..
776
.rx:
763
.rx: