1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
100
101
102
103
106
107
108
109
111
112
113
114
116
117
118
119
120
121
122
123
124
125
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_queue.h"
...
...
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size)
{
TX_INTERRUPT_SAVE_AREA
UINT capacity;
UINT used_words;
TX_QUEUE *next_queue;
TX_QUEUE *previous_queue;
TX_MEMSET(queue_ptr, 0, (sizeof(TX_QUEUE)));
queue_ptr -> tx_queue_name = name_ptr;
queue_ptr -> tx_queue_message_size = message_size;
/* ... */
capacity = (UINT) (queue_size / ((ULONG) (((ULONG) message_size) * (sizeof(ULONG)))));
used_words = capacity * message_size;
/* ... */
queue_ptr -> tx_queue_start = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
queue_ptr -> tx_queue_end = TX_ULONG_POINTER_ADD(queue_ptr -> tx_queue_start, used_words);
/* ... */
queue_ptr -> tx_queue_read = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
queue_ptr -> tx_queue_write = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
/* ... */
queue_ptr -> tx_queue_available_storage = (UINT) capacity;
queue_ptr -> tx_queue_capacity = (UINT) capacity;
TX_DISABLE
queue_ptr -> tx_queue_id = TX_QUEUE_ID;
/* ... */
if (_tx_queue_created_count == TX_EMPTY)
{
_tx_queue_created_ptr = queue_ptr;
queue_ptr -> tx_queue_created_next = queue_ptr;
queue_ptr -> tx_queue_created_previous = queue_ptr;
}if (_tx_queue_created_count == TX_EMPTY) { ... }
else
{
next_queue = _tx_queue_created_ptr;
previous_queue = next_queue -> tx_queue_created_previous;
next_queue -> tx_queue_created_previous = queue_ptr;
previous_queue -> tx_queue_created_next = queue_ptr;
queue_ptr -> tx_queue_created_previous = previous_queue;
queue_ptr -> tx_queue_created_next = next_queue;
}else { ... }
_tx_queue_created_count++;
TX_QUEUE_CREATE_EXTENSION(queue_ptr)
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_QUEUE, queue_ptr, name_ptr, queue_size, message_size)
TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_CREATE, queue_ptr, message_size, TX_POINTER_TO_ULONG_CONVERT(queue_start), queue_size, TX_TRACE_QUEUE_EVENTS)
TX_EL_QUEUE_CREATE_INSERT
TX_RESTORE
return(TX_SUCCESS);
}{ ... }