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
63 @CustomHeader
64 module QueueDescriptor {
65
66 /*!
67 * ======== QueueType ========
68 * Type of Queue
69 */
70 enum QueueType {
71 QueueType_NONE = 0,
72 QueueType_TOHOST_CMD_CIRCULAR_BUFFER = 1,
73 QueueType_FROMHOST_CMD_CIRCULAR_BUFFER = 2,
74 QueueType_TOHOST_EVENT_CIRCULAR_BUFFER = 3,
75 QueueType_TOHOST_EVENT_OVERFLOW_BUFFER = 4,
76 QueueType_TOHOST_DATA_CIRCULAR_BUFFER = 5,
77 QueueType_FROMHOST_DATA_CIRCULAR_BUFFER = 6
78 };
79
80 /*!
81 * ======== Header ========
82 * Structure of the descriptor
83 *
84 * @field(structSize) Used for version control to determine if newer
85 * fields are available
86 * @field(next) Pointer to the next Header in the list
87 * @field(queueType) Identifies the type of queue and thus who owns
88 * the read and write pointers.
89 * @field(readPtr) Points to the next (word-aligned) byte to be
90 * read from the buffer
91 * @field(writePtr) Points to the next (word-aligned) byte to be
92 * written into
93 * @field(queueStartAdrs) Start address of the buffer (word-aligned)
94 * @field(queueSizeInMAUs) Queue Size in min. addressable units
95 * (buffer size must be word-aligned)
96 * @field(instanceId) 16b unique ID that identifies the instance of the module
97 * that owns this queue descriptor.
98 * b15=1 indicates that the logger was dynamically
99 * created. Corresponds to the logger instance Id
100 * in the rta.xml and uia.xml metadata and
101 * UIAPacket event packet header.
102 * @field(ownerModuleId) The module ID of the module that owns this
103 * queue descriptor
104 * @field(priority) The priority of the queue. 0 is normal priority.
105 * The higher the number, the higher the priority.
106 * Used to set the priority field of the UIAPacket
107 * event packet header.
108 * @field(numDroppedCtrAdrs) Points to the counter used to count the number
109 * of dropped events. NULL if no counter available.
110 */
111 struct Header {
112 Int structSize;
113 Header *next;
114 QueueType queueType;
115 Bits32 *readPtr;
116 Bits32 *writePtr;
117 Bits32 *queueStartAdrs;
118 SizeT queueSizeInMAUs;
119 UInt instanceId;
120 UInt ownerModuleId;
121 UInt priority;
122 Bits32 *numDroppedCtrAdrs;
123 };
124
125 /*!
126 * ======== addToList ========
127 * Function to add a descriptor to the global list.
128 *
129 * @param(pHdrToAdd) Descriptor to add
130 */
131 @DirectCall
132 Void addToList(QueueDescriptor.Header *pHdrToAdd);
133
134 135 136 137 138 139 140 141 142
143 metaonly UInt16 generateInstanceId();
144
145 /*!
146 * ======== initHeader ========
147 * Function initialize a descriptor
148 *
149 * @param(pHdr) Descriptor to initialize
150 * @param(start) Start address of the buffer
151 * @param(size) Size of the buffer
152 * @param(loggerModuleId) module ID of the logger that owns the buffer
153 * @param(loggerInstanceId) instance ID of the logger that owns the buffer
154 * @param(loggerPriority) priority of the logger that owns the buffer
155 * @param(type) Type of descriptor
156 */
157 @DirectCall
158 Void initHeader(QueueDescriptor.Header *pHdr, Ptr start,
159 SizeT size, UInt loggerModuleId, UInt loggerInstanceId,
160 UInt loggerPriority, QueueType type, Ptr pNumDroppedCtr);
161
162 /*!
163 * ======== removeFromList ========
164 * Function to remove a descriptor from the global list.
165 *
166 * @param(pHdrToRemove) Descriptor to remove
167 */
168 @DirectCall
169 Void removeFromList(QueueDescriptor.Header *pHdrToRemove);
170
171 internal:
172 metaonly config Int maxId = 0;
173 }