Subversion Repositories Kolibri OS

Rev

Rev 2300 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2300 Rev 2305
Line 10... Line 10...
10
;;          GNU GENERAL PUBLIC LICENSE                          ;;
10
;;          GNU GENERAL PUBLIC LICENSE                          ;;
11
;;             Version 2, June 1991                             ;;
11
;;             Version 2, June 1991                             ;;
12
;;                                                              ;;
12
;;                                                              ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 14... Line 14...
14
 
14
 
Line 15... Line 15...
15
$Revision: 2300 $
15
$Revision: 2305 $
16
 
16
 
17
; The Queues implemented by these macros form a ring-buffer.
17
; The Queues implemented by these macros form a ring-buffer.
18
; The data to these queue's always looks like this:
18
; The data to these queue's always looks like this:
Line 22... Line 22...
22
; How these slots look like is up to you to chose, normally they should have at least a pointer to where the real data is.
22
; How these slots look like is up to you to chose, normally they should have at least a pointer to where the real data is.
23
; (you can see some examples below)
23
; (you can see some examples below)
Line 24... Line 24...
24
 
24
 
-
 
25
 
25
 
26
struct	queue
26
struct	queue
27
 
27
	.size		dd ?	; number of queued packets in this queue
28
	size	       dd ?    ; number of queued packets in this queue
28
	.w_ptr		dd ?	; current writing pointer in queue
29
	w_ptr	       dd ?    ; current writing pointer in queue
29
	.r_ptr		dd ?	; current reading pointer
30
	r_ptr	       dd ?    ; current reading pointer
Line 30... Line 31...
30
	.data:
31
 
Line 31... Line 32...
31
ends
32
ends
Line 50... Line 51...
50
 
51
 
51
	mov	edi, [ptr + queue.w_ptr]	; Current write pointer (FIFO!)
52
	mov	edi, [ptr + queue.w_ptr]	; Current write pointer (FIFO!)
52
	mov	ecx, entry_size/4		; Write the queue entry
53
	mov	ecx, entry_size/4		; Write the queue entry
Line 53... Line 54...
53
	rep	movsd				;
54
	rep	movsd				;
54
 
55
 
55
	lea	ecx, [size*entry_size+ptr+queue.data]
56
	lea	ecx, [size*entry_size+ptr+sizeof.queue]
Line 56... Line 57...
56
	cmp	edi, ecx			; entry size
57
	cmp	edi, ecx			; entry size
Line 75... Line 76...
75
	mov	esi, [ptr + queue.r_ptr]
76
	mov	esi, [ptr + queue.r_ptr]
76
	push	esi
77
	push	esi
Line 77... Line 78...
77
 
78
 
Line 78... Line 79...
78
	add	esi, entry_size
79
	add	esi, entry_size
79
 
80
 
80
	lea	ecx, [size*entry_size+ptr+queue.data]
81
	lea	ecx, [size*entry_size+ptr+sizeof.queue]
Line 81... Line 82...
81
	cmp	esi, ecx			; entry size
82
	cmp	esi, ecx			; entry size
Line 91... Line 92...
91
}
92
}
Line 92... Line 93...
92
 
93
 
Line 93... Line 94...
93
macro init_queue ptr {
94
macro init_queue ptr {
94
 
95
 
95
	mov	[ptr + queue.size] , 0
96
	mov	[ptr + queue.size] , 0
96
	lea	edi, [ptr + queue.data]
97
	lea	edi, [ptr + sizeof.queue]
97
	mov	[ptr + queue.w_ptr], edi
98
	mov	[ptr + queue.w_ptr], edi
98
	mov	[ptr + queue.r_ptr], edi
99
	mov	[ptr + queue.r_ptr], edi