1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 package ti.uia.runtime
61
62 import xdc.runtime.Types;
63 import xdc.rov.ViewInfo;
64
65 @CustomHeader
66 module QueueDescriptor {
67
68 /*!
69 * @_nodoc
70 * ======== ModuleView ========
71 */
72 metaonly struct ModuleView {
73 Ptr mPtrToFirstDescriptor;
74 UInt mUpdateCount;
75 UInt16 is5555ifInitialized;
76 }
77
78 /*!
79 * @_nodoc
80 * ======== rovViewInfo ========
81 */
82 @Facet
83 metaonly config ViewInfo.Instance rovViewInfo =
84 ViewInfo.create({
85 viewMap: [['Module', {type: ViewInfo.MODULE,
86 viewInitFxn: 'viewInitModule',
87 structName: 'ModuleView'}
88 ]]
89 });
90
91 /*!
92 * ======== QueueType ========
93 * Type of Queue
94 */
95 enum QueueType {
96 QueueType_NONE = 0,
97 QueueType_TOHOST_CMD_CIRCULAR_BUFFER = 1,
98 QueueType_FROMHOST_CMD_CIRCULAR_BUFFER = 2,
99 QueueType_TOHOST_EVENT_CIRCULAR_BUFFER = 3,
100 QueueType_TOHOST_EVENT_OVERFLOW_BUFFER = 4,
101 QueueType_TOHOST_DATA_CIRCULAR_BUFFER = 5,
102 QueueType_FROMHOST_DATA_CIRCULAR_BUFFER = 6
103 };
104
105 /*!
106 * ======== Header ========
107 * Structure of the descriptor
108 *
109 * @field(structSize) Used for version control to determine if newer
110 * fields are available
111 * @field(next) Pointer to the next Header in the list
112 * @field(queueType) Identifies the type of queue and thus who owns
113 * the read and write pointers.
114 * @field(readPtr) Points to the next (word-aligned) byte to be
115 * read from the buffer
116 * @field(writePtr) Points to the next (word-aligned) byte to be
117 * written into
118 * @field(queueStartAdrs) Start address of the buffer (word-aligned)
119 * @field(queueSizeInMAUs) Queue Size in min. addressable units
120 * (buffer size must be word-aligned)
121 * @field(instanceId) 16b unique ID that identifies the instance of the module
122 * that owns this queue descriptor.
123 * b15=1 indicates that the logger was dynamically
124 * created. Corresponds to the logger instance Id
125 * in the rta.xml and uia.xml metadata and
126 * UIAPacket event packet header.
127 * @field(ownerModuleId) The module ID of the module that owns this
128 * queue descriptor
129 * @field(priority) The priority of the queue. 0 is normal priority.
130 * The higher the number, the higher the priority.
131 * Used to set the priority field of the UIAPacket
132 * event packet header.
133 * @field(numDroppedCtrAdrs) Points to the counter used to count the number
134 * of dropped events. NULL if no counter available.
135 */
136 struct Header {
137 Int structSize;
138 Header *next;
139 QueueType queueType;
140 Bits32 *readPtr;
141 Bits32 *writePtr;
142 Bits32 *queueStartAdrs;
143 SizeT queueSizeInMAUs;
144 UInt instanceId;
145 UInt ownerModuleId;
146 UInt priority;
147 Bits32 *numDroppedCtrAdrs;
148 };
149
150 /*!
151 * ======== addToList ========
152 * Function to add a descriptor to the global list.
153 *
154 * @param(pHdrToAdd) Descriptor to add
155 */
156 @DirectCall
157 Void addToList(QueueDescriptor.Header *pHdrToAdd);
158
159 160 161 162 163 164 165 166 167
168 metaonly UInt16 generateInstanceId();
169
170 /*!
171 * ======== initHeader ========
172 * Function initialize a descriptor
173 *
174 * @param(pHdr) Descriptor to initialize
175 * @param(start) Start address of the buffer
176 * @param(size) Size of the buffer
177 * @param(loggerModuleId) module ID of the logger that owns the buffer
178 * @param(loggerInstanceId) instance ID of the logger that owns the buffer
179 * @param(loggerPriority) priority of the logger that owns the buffer
180 * @param(type) Type of descriptor
181 */
182 @DirectCall
183 Void initHeader(QueueDescriptor.Header *pHdr, Ptr start,
184 SizeT size, UInt loggerModuleId, UInt loggerInstanceId,
185 UInt loggerPriority, QueueType type, Ptr pNumDroppedCtr);
186
187 /*!
188 * ======== removeFromList ========
189 * Function to remove a descriptor from the global list.
190 *
191 * @param(pHdrToRemove) Descriptor to remove
192 */
193 @DirectCall
194 Void removeFromList(QueueDescriptor.Header *pHdrToRemove);
195
196 internal:
197 metaonly config Int maxId = 0;
198
199 struct Module_State {
200 Ptr mPtrToFirstDescriptor;
201 UInt mUpdateCount;
202
203 204 205 206
207 UInt32 is5555ifInitialized;
208 };
209 }