1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 // Software and any modification/derivatives thereof.
18 // No right, ownership, or interest to MStar Software and any
19 // modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 // supplied together with third party`s software and the use of MStar
23 // Software may require additional licenses from third parties.
24 // Therefore, you hereby agree it is your sole responsibility to separately
25 // obtain any and all third party right and license necessary for your use of
26 // such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 // MStar`s confidential information and you agree to keep MStar`s
30 // confidential information in strictest confidence and not disclose to any
31 // third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 // kind. Any warranties are hereby expressly disclaimed by MStar, including
35 // without limitation, any warranties of merchantability, non-infringement of
36 // intellectual property rights, fitness for a particular purpose, error free
37 // and in conformity with any international standard. You agree to waive any
38 // claim against MStar for any loss, damage, cost or expense that you may
39 // incur related to your use of MStar Software.
40 // In no event shall MStar be liable for any direct, indirect, incidental or
41 // consequential damages, including without limitation, lost of profit or
42 // revenues, lost or damage of data, and unauthorized system use.
43 // You agree that this Section 4 shall still apply without being affected
44 // even if MStar Software has been modified by MStar in accordance with your
45 // request or instruction for your use, except otherwise agreed by both
46 // parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 // services in relation with MStar Software to you for your use of
50 // MStar Software in conjunction with your or your customer`s product
51 // ("Services").
52 // You understand and agree that, except otherwise agreed by both parties in
53 // writing, Services are provided on an "AS IS" basis and the warranty
54 // disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 // or otherwise:
58 // (a) conferring any license or right to use MStar name, trademark, service
59 // mark, symbol or any other identification;
60 // (b) obligating MStar or any of its affiliates to furnish any person,
61 // including without limitation, you and your customers, any assistance
62 // of any kind whatsoever, or any information; or
63 // (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 // of Taiwan, R.O.C., excluding its conflict of law rules.
67 // Any and all dispute arising out hereof or related hereto shall be finally
68 // settled by arbitration referred to the Chinese Arbitration Association,
69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 // Rules of the Association by three (3) arbitrators appointed in accordance
71 // with the said Rules.
72 // The place of arbitration shall be in Taipei, Taiwan and the language shall
73 // be English.
74 // The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 /**************************************************************************
79 * Copyright (c) 2008 MStar Semiconductor, Inc. All Rights Reserved.
80 * Licensed to TTP_CLIENT_NAME
81 **************************************************************************/
82 /** \file
83 * \ingroup PrdCBEcorePLFservicesFrHsl
84 * \ingroup ApiCBEcorePLFservicesFrHsl
85 * \brief This file contains initialisation and interrupt handling routines
86 * for the HSL.
87 */
88 #if defined (MSOS_TYPE_LINUX)
89
90 /*******************************************************************************
91 ** Includes
92 *******************************************************************************/
93 #include <stdio.h>
94 #include <stdlib.h>
95 #include <stdarg.h>
96 #include <assert.h>
97
98 #include "frhsl_ringbuffer.h"
99 #include "frhsl_cfg.h"
100 #include "frhsl_autotest.h"
101 #include "frhsl_RAWLOB.h"
102
103 #define M_KiTtiSetFilterType(nEWtYPE) \
104 { \
105 kiTtiStoredFilterType = nEWtYPE; \
106 if (kiTtiActiveFilterType != KI_FILTER_DISABLED) \
107 { \
108 kiTtiActiveFilterType = nEWtYPE; \
109 } \
110 }
111
112
113 typedef enum KiFilterTypeTag
114 {
115 KI_FILTER_NONE,
116 KI_FILTER_SET,
117 KI_FILTER_DISABLED
118
119 } KiFilterType;
120
121
122 static void KiTtiDestroyOldFilterMemory (void);
123 static MS_S8 ***kiTtiSetFilter = NULL;
124
125 static void *kiTtiFilterMemory = NULL;
126 static KiFilterType kiTtiStoredFilterType = KI_FILTER_NONE;
127 static KiFilterType kiTtiActiveFilterType = KI_FILTER_NONE;
128
129 /* This array stores instances of the HSL
130 * Pointers to elements are to be passed to all buffer and autotest functions
131 * in order to allow them to operate on a selected instance.
132 */
133 #define HSL_INSTANCES 2
134 stHslController gHSL[HSL_INSTANCES];
135
136 /*******************************************************************************
137 ** Defines
138 *******************************************************************************/
139
140 #define MS_ASSERT(_bool_) \
141 { \
142 if ( ! ( _bool_ ) ) \
143 { \
144 /* UTL_printf("ASSERT FAIL: %s %s %s %d\n", #_bool_, __FILE__, __PRETTY_FUNCTION__, __LINE__); */ \
145 } \
146 }
147
148
149 /*******************************************************************************
150 ** Global Data
151 *******************************************************************************/
152 /** \ingroup CfgCBEcorePLFdriversFrHsl
153 * \def FR_HSL_V2_FILTERED_LOG_POINT_COMMON_MSB
154 * Common MSB 2 bits for all filtered log points.
155 * Common MSB 2 bits for all filtered log points.
156 * All filtered log points will have the 2 most significant bits
157 * set.
158 */
159 #define FR_HSL_V2_FILTERED_LOG_POINT_COMMON_MSB ((MS_U16)0x4000)
160
161
162 /**
163 * \def FR_HSL_LAST_HARD_CODED_LOG_POINT
164 * Last log point ID which is used for special purposes in HSL.
165 * Last log point ID which is used for special purposes in HSL.
166 * All the log points from 0 to this value will have custom
167 * handling either on the target or PC side.
168 * set.
169 */
170 #define FR_HSL_LAST_HARD_CODED_LOG_POINT ((MS_U16)0x000F)
171
172 /** \ingroup CfgCBEcorePLFdriversFrHsl
173 * \def FR_HSL_V2_MAX_NUMBER_FILTER_LOG_POINTS
174 * Max number of log points for which run-time filtering can be applied
175 * Max number of log points for which run-time filtering can be applied. No more
176 * than this number of log points can have run-time filtering applied. The
177 * reason for this limit is linked to the size of the MS_U16 array which is used to
178 * maintain the enable/disable state for each such log point.
179 * This define must match the algorith used by Silox when getting a new log point
180 * ID. See GetNewLogId() is Silox source code.
181 */
182 #define FR_HSL_V2_MAX_NUMBER_FILTERED_LOG_POINTS ((MS_U16)1024*64)
183
184 /** \ingroup CfgCBEcorePLFdriversFrHsl
185 * \def FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE
186 * Max size of FrHslDynamicLogPointArray[].
187 * Max size of FrHslDynamicLogPointArray[].
188 */
189 #define FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE ((MS_U16)(FR_HSL_V2_MAX_NUMBER_FILTERED_LOG_POINTS/(8))) /* Factor of 8 for number of bits per byte */
190
191 #define FR_HSL_DYNAMIC_GROUP_ID_ARRAY_SIZE ((MS_U8)(HSL_GROUP_ID_MAX/(sizeof(MS_U8)*8)))
192
193 /** \ingroup CfgCBEcorePLFdriversFrHsl
194 * \def FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE
195 * Log point ID Mask for allowed range of filtered log point IDs
196 * Log point ID Mask for allowed range of filtered log point IDs
197 * This represents the allowed bits that can be set barred the common MSB
198 */
199 #define FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE ((MS_U16)(FR_HSL_V2_MAX_NUMBER_FILTERED_LOG_POINTS-1)) /* -1 to give 0x03FFF */
200
201 /** \ingroup CfgCBEcorePLFdriversFrHsl
202 * \def FR_HSL_V2_FILTERED_HEADER_LOG_POINT_ID_MASK
203 * Mask giving the allowed bits that can be set in a log point ID for which run-time filtering is applied.
204 * Mask giving the allowed bits that can be set in a log point ID for which run-time filtering is applied.
205 * This define must match the rule applied by Silox when creating a new log point. @ GetNewLogId().
206 */
207 #define FR_HSL_V2_FILTERED_HEADER_LOG_POINT_ID_MASK (FR_HSL_V2_FILTERED_LOG_POINT_COMMON_MSB | FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE)
208
GetBufferId(MS_U16 u16gId)209 MS_U8 GetBufferId(MS_U16 u16gId)
210 {
211 MS_U8 retval = 0;
212 if( (HSL_INSTANCES > 1 ) && (u16gId == HSL_DBG_SN_PROFILING))
213 {
214 retval = 1;
215 }
216 return retval;
217 }
218
219 /* macros */
220
221 /** IMPORTANT NOTE: Cannot have fprintf() present when function instrumentation is
222 * switched on. The reason is that function instrumentation uses HSL log points
223 * but the HSL processing will not be ready at the boot up, and many boot-up
224 * function will be instrumented and therefore flood the stderr with this message */
225 #define CHECK_INIT(hSL, value) \
226 if (FALSE == hSL->bInit) \
227 { \
228 return value; \
229 }
230
231
232 #define M_FrHslAllocateBufferSpace(bUFFER, bUFpTR, sIZE, bUFiNFO) \
233 if( !bufferAllocateWrite(bUFpTR, sIZE, &bUFiNFO) ) \
234 { \
235 return; \
236 } \
237 bUFFER = (MS_U8*)(bUFiNFO->u32bufferIndex);
238
239 #define M_FrHslFinalizeBufferWrite(hSL, bUFiNFO) \
240 bufferAcknowledgeWrite(hSL, bUFiNFO);
241
242 // [HSL_RAWLOB_LENGTH_OF_HEADER];
243 #define M_FrHsl0ByteMsg(hDR, hSL) \
244 { \
245 stListNode *s_dataInfo; \
246 MS_U8 *u8Buffer; \
247 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_HEADER, s_dataInfo); \
248 M_FrHslWriteSPMsgHeader(hDR, u8Buffer + HSL_RAWLOB_OFFSET_OF_MSG_TYPE, s_dataInfo->u32timestamp ); \
249 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
250 }
251
252 /** Write a N arguments message to HSL.
253 * Write a N arguments message to HSL.
254 * \param MS_U32 hDR = Message header word.
255 * \param MS_U16 aRG1 = First argument of the message.
256 *
257 */
M_FrHslNArgumentsMsg(MS_U32 u32Header,p_HslController _hsl,MS_U16 N,...)258 void M_FrHslNArgumentsMsg(MS_U32 u32Header, p_HslController _hsl, MS_U16 N, ...)
259 {
260 stListNode *s_dataInfo;
261 MS_U8 *u8Buffer;
262 MS_BOOL bSecondIDEnable;
263 MS_U16 u16FirstID;
264 MS_U8 u16PacketCounts; /* not including packet-count field itself*/
265 MS_U8 u8OffsetArg; /* offset of first data packet(0-th packet is the packet counts)*/
266
267 va_list vlist;
268
269 if (u32Header > FR_HSL_TRANSITION_ID)
270 {
271 bSecondIDEnable = TRUE;
272 u16FirstID = 0xFF00 | ( (u32Header >> 16) & 0x00FF);
273 u16PacketCounts = HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_SECOND_ID+N;
274 u8OffsetArg = HSL_RAWLOB_OFFSET_OF_PACKET(2);
275 }
276 else
277 {
278 bSecondIDEnable = FALSE;
279 u16FirstID = (MS_U16)u32Header;
280 u16PacketCounts = N;
281 u8OffsetArg = HSL_RAWLOB_OFFSET_OF_PACKET(1);
282 }
283 M_FrHslAllocateBufferSpace(u8Buffer, _hsl, HSL_RAWLOB_LENGTH_OF_VL_MSG(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+u16PacketCounts), s_dataInfo);
284 M_FrHslWriteVLMsgHeader(u16FirstID, u8Buffer+HSL_RAWLOB_OFFSET_OF_MSG_TYPE, s_dataInfo->u32timestamp);
285 M_FrHslWritePacketCounts(u16PacketCounts, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0));
286 if (bSecondIDEnable)
287 {
288 M_FrHslWritePayload(u32Header & FR_HSL_TRANSITION_ID, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1));
289 }
290 {
291 va_start(vlist, N);
292 MS_U32 i;
293 for ( i=0 ; i<N-1 ; i++)
294 {
295 M_FrHslWritePayload( (MS_U16)va_arg(vlist, unsigned int), u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2+i) );
296 }
297 M_FrHslWriteLastPayload( (MS_U16)va_arg(vlist, unsigned int), u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2+N-1) );
298 va_end(vlist);
299 }
300 M_FrHslFinalizeBufferWrite(_hsl, s_dataInfo);
301 }
302
303 /* IMPORTANT: The following macro is used for string output so calculates length from first null character */
304 #define M_FrHslMS_U8ArrayMsg(u16Id, hSL, parray) \
305 { \
306 MS_U16 cOUNTER=0; \
307 const MS_U16 *aRRAYpTR = (const MS_U16*)parray; \
308 const MS_U8 * cVal = (const MS_U8*) parray; \
309 MS_U16 sizeMsg = 0; \
310 MS_U8 remainder; \
311 MS_U16 wordSize; \
312 while(*cVal != '\0') \
313 {\
314 cVal++; \
315 ++sizeMsg; \
316 } \
317 /* Adding one for the terminating character */ \
318 ++sizeMsg; \
319 /* Getting the size as MS_U16 parts */ \
320 wordSize = (sizeMsg/2); \
321 remainder = sizeMsg%2; \
322 stListNode *s_dataInfo; \
323 MS_U8 *u8Buffer; \
324 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+wordSize+remainder), s_dataInfo); \
325 M_FrHslWriteVLMsgHeader(u16Id, u8Buffer+HSL_RAWLOB_OFFSET_OF_MSG_TYPE, s_dataInfo->u32timestamp); \
326 M_FrHslWritePacketCounts(wordSize+remainder, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
327 /* Write Data */ \
328 for (cOUNTER = 0; cOUNTER+1 < wordSize; cOUNTER++) \
329 { \
330 M_FrHslWritePayload(*aRRAYpTR, u8Buffer + HSL_RAWLOB_OFFSET_OF_PACKET(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+cOUNTER)); \
331 aRRAYpTR++; \
332 } \
333 if (remainder == 0) \
334 { \
335 if (0!=wordSize) \
336 { \
337 M_FrHslWriteLastPayload(*aRRAYpTR, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+wordSize-1)); \
338 } \
339 } \
340 else \
341 { \
342 if (0!=wordSize) \
343 { \
344 M_FrHslWritePayload(*aRRAYpTR, &u8Buffer[HSL_RAWLOB_OFFSET_OF_PACKET(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+wordSize-1)]); \
345 } \
346 /* Any remainder can only be the null char */ \
347 M_FrHslWriteLastPayload(0x0000, &u8Buffer[HSL_RAWLOB_OFFSET_OF_PACKET(HSL_RAWLOB_NUMBER_OF_PACKETS_FOR_PACKET_COUNTS+wordSize)]); \
348 } \
349 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
350 }
351
352
353 /** Write a message that is an array of MS_U16s.
354 * Write a message that is an array of MS_U16s.
355 * \param MS_U16 hDR = Message header word.
356 * \param MS_U16 nUM = Number of MS_U16s in the array.
357 * \param MS_U16 *aRRAY = Array of nUM MS_U16s.
358 */
359 #define M_FrHslMS_U16ArrayMsg(u16Id, hSL, u16length, parray) \
360 { \
361 MS_S16 cOUNTER; \
362 const MS_U16 *aRRAYpTR = (const MS_U16 *) parray; \
363 /* With this macro we need extra space for: 1 word for length field, 2 words for address field */ \
364 stListNode *s_dataInfo; \
365 MS_U8 *u8Buffer; \
366 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(1+2+u16length), s_dataInfo); \
367 M_FrHslWriteVLMsgHeader(u16Id, u8Buffer+HSL_RAWLOB_OFFSET_OF_MSG_TYPE, s_dataInfo->u32timestamp); \
368 /* +2 for Address */ \
369 M_FrHslWritePacketCounts(2+u16length, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
370 /* Write address */ \
371 M_FrHslWritePayload(((MS_U32)aRRAYpTR) >> 16, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1)); \
372 M_FrHslWritePayload(((MS_U32)aRRAYpTR) & 0xFFFF, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2)); \
373 /* Write Data */ \
374 for (cOUNTER = 0; cOUNTER < (MS_S16)(u16length - 1); cOUNTER++) \
375 { \
376 M_FrHslWritePayload(*aRRAYpTR, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(3+cOUNTER)); \
377 aRRAYpTR++; \
378 } \
379 if (u16length > 0)\
380 { \
381 M_FrHslWriteLastPayload(*aRRAYpTR, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(3+cOUNTER)); \
382 } \
383 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
384 }
385
386
387 /** Write a message that is an array of MS_U32s.
388 * Write a message that is an array of MS_U32s. The actual logging is done through 16 bit registers and so each 32 bit
389 * value is converted to two 16 bit words. The last 16 bit word is logged depending on the value of lASTwORDeMPTY.
390 * The macro is defined in accordance with the endianess of the DSP.
391 * \param MS_U16 hDR = Message header word.
392 * \param MS_U16 nUM = Number of MS_U32s in the array.
393 * \param MS_U32 *aRRAY = Array of nUM MS_U32s.
394 * \param MS_U16 lASTwORDeMPTY = Logging indicator for the last 16 bit word - if set to 1 the last 16 bit word is not logged.
395 */
396 #if (!defined(BYTE_ORDER) || (defined(BYTE_ORDER) && (BYTE_ORDER != BIG_ENDIAN)))
397 #define M_FrHslMS_U32ArrayMsg(u16Id, hSL, u16length, parray, lASTwORDeMPTY) \
398 { \
399 MS_U16 cOUNTER; \
400 const MS_U32 *aRRAYpTR = (const MS_U32 *) parray; \
401 MS_U16 tEMPdATA = 0; \
402 stListNode *s_dataInfo; \
403 MS_U8 *u8Buffer; \
404 if( lASTwORDeMPTY) \
405 { \
406 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(1+2+u16length*2-1), s_dataInfo); \
407 } \
408 else \
409 { \
410 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(1+2+u16length*2), s_dataInfo); \
411 } \
412 M_FrHslWriteVLMsgHeader(u16Id, u8Buffer, s_dataInfo->u32timestamp); \
413 if (lASTwORDeMPTY) \
414 { \
415 /* 2*nUM -1 +2 for Address */ \
416 M_FrHslWritePacketCounts((2*(u16length)) + 1, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
417 } \
418 else \
419 { \
420 /* 2*nUM +2 for Address */ \
421 M_FrHslWritePacketCounts((2*(u16length)) + 2, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
422 } \
423 /* Write address */ \
424 M_FrHslWritePayload(((MS_U32)aRRAYpTR) >> 16, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1)); \
425 M_FrHslWritePayload(((MS_U32)aRRAYpTR) & 0xFFFF, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2)); \
426 /* Write Data */ \
427 for (cOUNTER = 0; cOUNTER+1 < u16length ; cOUNTER++) \
428 { \
429 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) & 0xFFFF); \
430 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+cOUNTER*2)); \
431 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) >> 16 ); \
432 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+cOUNTER*2+1)); \
433 aRRAYpTR++; \
434 } \
435 if (lASTwORDeMPTY) \
436 { \
437 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) & 0xFFFF); \
438 M_FrHslWriteLastPayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2)); \
439 } \
440 else \
441 { \
442 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) & 0xFFFF); \
443 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2)); \
444 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) >> 16 ); \
445 M_FrHslWriteLastPayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2+1)); \
446 } \
447 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
448 }
449
450 #else
451
452 #define M_FrHslMS_U32ArrayMsg(u16Id, hSL, u16length, parray, lASTwORDeMPTY) \
453 { \
454 MS_U16 cOUNTER; \
455 MS_U32 *aRRAYpTR = (const MS_U32 *) parray; \
456 MS_U16 tEMPdATA = 0; \
457 stListNode *s_dataInfo; \
458 MS_U8 *u8Buffer; \
459 if( lASTwORDeMPTY) \
460 { \
461 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(1+2+u16length*2-1), s_dataInfo); \
462 } \
463 else \
464 { \
465 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(1+2+u16length*2), s_dataInfo); \
466 } \
467 M_FrHslWriteVLMsgHeader(u16Id, u8Buffer, s_dataInfo->u32timestamp); \
468 if (lASTwORDeMPTY) \
469 { \
470 /* 2*nUM -1 +2 for Address */ \
471 M_FrHslWritePacketCounts((2*(u16length)) + 1, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
472 } \
473 else \
474 { \
475 /* 2*nUM +2 for Address */ \
476 M_FrHslWritePacketCounts((2*(u16length)) + 2, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
477 } \
478 /* Write address */ \
479 M_FrHslWritePayload(((MS_U32)aRRAYpTR) >> 16, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1)); \
480 M_FrHslWritePayload(((MS_U32)aRRAYpTR) & 0xFFFF, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2)); \
481 /* Write Data */ \
482 for (cOUNTER = 0; cOUNTER+1 < u16length ; cOUNTER++) \
483 { \
484 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) >> 16 ); \
485 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+cOUNTER*2+1)); \
486 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) & 0xFFFF); \
487 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+cOUNTER*2)); \
488 aRRAYpTR++; \
489 } \
490 if (lASTwORDeMPTY) \
491 { \
492 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) >> 16 ); \
493 M_FrHslWriteLastPayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2)); \
494 } \
495 else \
496 { \
497 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) >> 16 ); \
498 M_FrHslWritePayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2)); \
499 tEMPdATA = (MS_U16) ((MS_U32)(*aRRAYpTR) & 0xFFFF); \
500 M_FrHslWriteLastPayload(tEMPdATA, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1+2+(u16length-1)*2+1)); \
501 } \
502 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
503 }
504
505 #endif
506
507 /** Write a message that is an instance of a C typedef
508 * Write a message that is an instance of a C typedef
509 * \param MS_U16 hDR = Message header word.
510 * \param MS_U16 nUM = Number of MS_U16s in the array. When oddBytePresent is TRUE, then this length accounts for it.
511 * \param oddBytePresent = A 1 to indicate that sizeof(type) is odd number of bytes.
512 * \param MS_U16 *parray = address to an instance of typedef to log
513 */
514 #define M_FrHslTypedefMsg(u16Id, hSL, u16length, oddBytePresent, parray) \
515 { \
516 MS_S16 cOUNTER; \
517 const MS_U16 *aRRAYpTR = (const MS_U16 *) parray; \
518 /* Buffer Allocation of words are an extra: 1 for length field, 2 for address */ \
519 stListNode *s_dataInfo; \
520 MS_U8 *u8Buffer; \
521 M_FrHslAllocateBufferSpace(u8Buffer, hSL, HSL_RAWLOB_LENGTH_OF_VL_MSG(3+u16length), s_dataInfo); \
522 M_FrHslWriteVLMsgHeader(u16Id, u8Buffer+HSL_RAWLOB_OFFSET_OF_MSG_TYPE, s_dataInfo->u32timestamp); \
523 /* Writing out the total length which includes 2 for Address */ \
524 M_FrHslWritePacketCounts(2+u16length, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(0)); \
525 /* Write address */ \
526 M_FrHslWritePayload(((MS_U32)aRRAYpTR) >> 16, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(1)); \
527 M_FrHslWritePayload(((MS_U32)aRRAYpTR) & 0xFFFF, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(2)); \
528 /* Write Data */ \
529 for (cOUNTER=0; cOUNTER < (MS_S16)(u16length - 1); cOUNTER++) \
530 { \
531 M_FrHslWritePayload(*aRRAYpTR, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(3+cOUNTER)); \
532 aRRAYpTR++; \
533 } \
534 /* For the last word, we need to check if oddBytePresent is set because we then need to only transfer one byte*/ \
535 if (oddBytePresent) \
536 { \
537 MS_U8 oddByte = *((const MS_U8*)aRRAYpTR); \
538 M_FrHslWriteLastPayload((MS_U16)oddByte, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(3+cOUNTER)); \
539 } \
540 else if (u16length > 0) \
541 { \
542 M_FrHslWriteLastPayload(*aRRAYpTR, u8Buffer+HSL_RAWLOB_OFFSET_OF_PACKET(3+cOUNTER)); \
543 } \
544 M_FrHslFinalizeBufferWrite(hSL, s_dataInfo); \
545 }
546
547
548 /*******************************************************************************
549 * Define : KI_MAX_ONE_BASE_SIG_BITMAP
550 * Group : GKI, Test Interface, Internals
551 * Description : This gives the maximum size of a packed signal bitmap (1 bit
552 * per signal, 8 signals per byte) for one base.
553 *******************************************************************************/
554 #define KI_MAX_ONE_BASE_SIG_BITMAP (0x100 / 8)
555
556
557 /*******************************************************************************
558 * Macro : M_KiTtiSetFilterType
559 * Group : GKI, Test Interface, Internals
560 * Parameter : KiFilterType nEWtYPE = The new filter type to be used.
561 * Returns : Nothing
562 * Description : This macro is used change the current filter type being used.
563 * This updates the stored type and the active type if
564 * necessary.
565 ******************************************************************************/
566 /* The following defines are dependent on log point IDs allocation
567 * made by silox.exe for supernova/sn_ui/utopia. */
568 #define FILTERED_LOG_POINT_ID_LOWER_RANGE (0x8000)
569 #define FILTERED_LOG_POINT_ID_UPPER_RANGE (0xAFFF)
570
571 /***************************************************************************
572 * Global variables (with default values at bootup for g_FrHslDrvConfig )
573 ***************************************************************************/
574
575 /** This is the dynamic log point filter array.
576 * This is the dynamic log point filter array.
577 * Any Array logging and
578 * 'filtered' printf log points (i.e. short log points) can be enabled/disabled
579 * individually and dynamically.
580 */
581 MS_U8 FrHslDynamicLogPointArray[FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE];
582 MS_BOOL FrHslDynamicGroupIdArray[HSL_GROUP_ID_MAX];
583
584 /** Function kept for backwards compatibility of the interface
585 * Assumes that there is only one instance of the HSL buffer
586 * available on the default port 6000.
587 */
FrHslInitialise(const MS_PHYADDR PhyAddr,const MS_U32 u32BufByteLen)588 MS_BOOL FrHslInitialise(const MS_PHYADDR PhyAddr, const MS_U32 u32BufByteLen)
589 {
590 MS_U32 params[] = {PhyAddr, u32BufByteLen, 6000};
591 return FrHslInitialiseMulti(1, params);
592 }
593
FrHslInitialiseMulti(MS_U8 _ICount,MS_U32 * _params)594 MS_BOOL FrHslInitialiseMulti(MS_U8 _ICount, MS_U32 *_params)
595 {
596 assert(_ICount <= HSL_INSTANCES);
597 stHslController *hsl=0;
598 MS_U8 instance;
599 MS_BOOL bHslInit = FALSE;
600
601 bHslInit = FrHslInitialiseBegin();
602
603 memset(FrHslDynamicLogPointArray, 0, FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE);
604
605 MS_U16 i;
606 for ( i = 0; i < HSL_GROUP_ID_MAX; i++)
607 {
608 FrHslDynamicGroupIdArray[i] = FALSE;
609 }
610
611 if( bHslInit )
612 {
613 bHslInit = FrHslV2InitialiseLogPointFiltering(); /* Apply compile time enabling/disabling of log points */
614 }
615
616 if( bHslInit )
617 {
618 bHslInit = FrHslV2InitialiseGroupIdFiltering(); /* Apply compile time enabling/disabling of group ids */
619 }
620
621 /* PARAMS: groups of 3
622 * - physical address
623 * - size
624 * - port
625 */
626 if( bHslInit )
627 {
628 for(instance = 0; bHslInit && (instance<_ICount); instance++)
629 {
630 hsl = &gHSL[instance];
631
632 hsl->u32Port = _params[instance*3+2];
633 hsl->u8Instance = instance;
634
635 hsl->logThreads[0].streamId = 0;
636 hsl->logThreads[0].threadId = 0;
637 hsl->logThreads[0].priority = 0;
638 hsl->logThreads[0].typeId = output_thread;
639 hsl->logThreads[0].funcPtr = bufferWriteThread;
640 hsl->logThreads[0].funcParam = hsl;
641
642 hsl->pendingWriteHead = 0;
643 hsl->pendingWriteLength = 0;
644
645 if (FALSE==hsl->bInit)
646 {
647 bHslInit = bufferInitialize(hsl, _params[instance*3+0], _params[instance*3+1]);
648
649 if( bHslInit )
650 {
651 bHslInit = FrHsl_AutoTest_Init(hsl);
652 }
653 else
654 {
655 bufferFinalize(hsl);
656 }
657
658 hsl->bInit = bHslInit;
659 }
660 }
661 }
662 bHslInit = FrHslInitialiseEnd();
663
664 if( bHslInit )
665 {
666 M_FrHslPrintf0 (0x085A, HSL_DBG_UTOPIA_ALL_DEBUG,"HSL framework initialised.");
667 printf ("HSL framework initialised.\n"); //message output for autotest to identify the hsl ready to get request
668 }
669
670 return bHslInit;
671 }
672
673
674 /** \ingroup ApiCBEcorePLFservicesFrHsl
675 * Enable a dynamically controllable logpoint.
676 * Enable a dynamically controllable logpoint.
677 */
FrHslDynamicLogPointEnable(const MS_U16 lgHdr)678 MS_BOOL FrHslDynamicLogPointEnable(const MS_U16 lgHdr /**< log header to enable */)
679 {
680 //CHECK_INIT(FALSE);
681
682 MS_U16 bitIndex, byteIndex, bitMask;
683
684 /* Find wordIndex and bitMask in logging array */
685 bitIndex = (lgHdr & FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE);
686 byteIndex = bitIndex >> 3;
687 bitIndex &= 7;
688 bitMask = (1 << bitIndex);
689
690 /* Set relevant bit in logging array */
691 FrHslDynamicLogPointArray[byteIndex] |= bitMask;
692
693 return TRUE;
694 }
695
696 /** \ingroup ApiCBEcorePLFservicesFrHsl
697 * Enable a dynamically controllable logpoint.
698 * Enable a dynamically controllable logpoint.
699 */
FrHslDynamicLogPointDisable(const MS_U16 lgHdr)700 MS_BOOL FrHslDynamicLogPointDisable(const MS_U16 lgHdr /**< log header to disable */)
701 {
702 //CHECK_INIT(FALSE);
703
704 MS_U16 bitIndex, byteIndex, bitMask;
705
706 /* Find wordIndex and bitMask in logging array */
707 bitIndex = (lgHdr & FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE);
708 byteIndex = bitIndex >> 3;
709 bitIndex &= 7;
710 bitMask = (1 << bitIndex);
711
712 /* Set relevant bit in logging array */
713 FrHslDynamicLogPointArray[byteIndex] &= ~bitMask;
714
715 return TRUE;
716 }
717
718
719 /** \ingroup ApiCBEcorePLFservicesFrHsl
720 * Enable all the dynamically controllable logpoints.
721 * Enable all the dynamically controllable logpoints.
722 */
FrHslDynamicLogPointEnableAll(void)723 MS_BOOL FrHslDynamicLogPointEnableAll(void)
724 {
725 //CHECK_INIT(FALSE);
726
727 memset(FrHslDynamicLogPointArray, 0xFF, FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE);
728
729 return TRUE;
730 }
731
732 /** \ingroup ApiCBEcorePLFservicesFrHsl
733 * Disable all the dynamically controllable logpoints.
734 * Disable all the dynamically controllable logpoints.
735 */
FrHslDynamicLogPointDisableAll(void)736 MS_BOOL FrHslDynamicLogPointDisableAll(void)
737 {
738 //CHECK_INIT(FALSE);
739
740 memset(FrHslDynamicLogPointArray, 0, FR_HSL_DYNAMIC_LOGGING_ARRAY_SIZE);
741
742 return TRUE;
743 }
744
FrHslDynamicLogGroupEnable(const MS_U16 groupId)745 MS_BOOL FrHslDynamicLogGroupEnable(const MS_U16 groupId /**< log header to enable */)
746 {
747 //CHECK_INIT(FALSE);
748
749 FrHslDynamicGroupIdArray[groupId] = TRUE;
750
751 return TRUE;
752 }
753
754 /** \ingroup
755 * Enable all the group.
756 */
FrHslDynamicLogGroupEnableAll(void)757 MS_BOOL FrHslDynamicLogGroupEnableAll(void)
758 {
759 //CHECK_INIT(FALSE);
760
761 MS_U16 wordIndex;
762 for (wordIndex = 0; wordIndex < HSL_GROUP_ID_MAX; wordIndex++)
763 {
764 FrHslDynamicGroupIdArray[wordIndex] = TRUE;
765 }
766
767 return true;
768 }
769
770 /** \ingroup ApiCBEcorePLFservicesFrHsl
771 * Enable a dynamically controllable group.
772 */
FrHslDynamicLogGroupDisable(const MS_U16 groupId)773 MS_BOOL FrHslDynamicLogGroupDisable(const MS_U16 groupId /**< log header to disable */)
774 {
775 //CHECK_INIT(FALSE);
776
777 FrHslDynamicGroupIdArray[groupId] = FALSE;
778
779 return TRUE;
780 }
781
782 /** \ingroup ApiCBEcorePLFservicesFrHsl
783 * Disable all the dynamically controllable group.
784 */
FrHslDynamicLogGroupDisableAll(void)785 MS_BOOL FrHslDynamicLogGroupDisableAll(void)
786 {
787 //CHECK_INIT(FALSE);
788
789 MS_U16 wordIndex;
790 for (wordIndex = 0; wordIndex < HSL_GROUP_ID_MAX; wordIndex++)
791 {
792 FrHslDynamicGroupIdArray[wordIndex] = FALSE;
793 }
794
795 return TRUE;
796 }
797
798 /** \ingroup ApiCBEcorePLFservicesFrHsl
799 * Enable/Disable single log point.
800 * Enable/Disable single log point.
801 */
FrHslV2ApplySingleLogPointFiltering(const MS_U16 lgHdr,const MS_BOOL enableState)802 MS_BOOL FrHslV2ApplySingleLogPointFiltering(const MS_U16 lgHdr, const MS_BOOL enableState)
803 {
804 //CHECK_INIT(FALSE);
805
806 //MS_ASSERT((lgHdr & ~FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE) == FR_HSL_V2_FILTERED_LOG_POINT_COMMON_MSB);
807
808 MS_BOOL bRet = FALSE;
809 if (enableState)
810 {
811 bRet = FrHslDynamicLogPointEnable(lgHdr);
812 }
813 else
814 {
815 bRet = FrHslDynamicLogPointDisable(lgHdr);
816 }
817
818 return bRet;
819 }
820
821
822 /** Apply compile time group id filtering */
FrHslV2InitialiseGroupIdFiltering(void)823 MS_BOOL FrHslV2InitialiseGroupIdFiltering(void)
824 {
825 FrHslDynamicGroupIdArray[HSL_DBG_UTOPIA_ALL_DEBUG] = TRUE;
826 FrHslDynamicGroupIdArray[HSL_DBG_MW_ALL_DEBUG] = FALSE;
827 FrHslDynamicGroupIdArray[HSL_DBG_SN_ALL_DEBUG] = FALSE;
828 FrHslDynamicGroupIdArray[HSL_DBG_UTOPIA_HSL_DEBUG] = FALSE;
829 FrHslDynamicGroupIdArray[HSL_DBG_SN_AUTO_TEST_DEBUG] = FALSE;
830 return TRUE;
831 }
832 /** \ingroup ApiCBEcorePLFservicesFrHsl
833 * Apply compile time enabling of log points.
834 * Apply compile time enabling of log points.
835 */
FrHslV2InitialiseLogPointFiltering(void)836 MS_BOOL FrHslV2InitialiseLogPointFiltering(void)
837 {
838
839 /*================ START OF AUTO-GENERATED CODE ===================
840 * The following is used to initialise FrHslDynamicLogPointArray[]
841 */
842
843 /* Herefollows an example of how to do compile time enabling of
844 log points via the define ENABLE_ESSENTIAL_LOG_POINTS.*/
845 /*
846 # if defined(ENABLE_ESSENTIAL_LOG_POINTS)
847 {
848 MS_U16 arrayEnableEssentialLogPoints[] =
849 {
850 0xC007,0xC00A,0xC024,0xC026,0xC036,0xC038,0xC03C,0xC040,
851 0xC041,0xC044,0xC049,0xC04B,0xC04E,0xC04F,0xC057,0xC05F
852 };
853 FrHslV2ApplyMultipleLogPointsFilter(arrayEnableEssentialLogPoints,sizeof(arrayEnableEssentialLogPoints)/sizeof(arrayEnableEssentialLogPoints[0]));
854 }
855
856 # endif *//* ENABLE_ESSENTIAL_LOG_POINTS */
857
858 /*================= END OF AUTO-GENERATED CODE ==================*/
859
860 /* Hereunder the user can enable/disable any filtered log points
861 * E.g. FrHslDynamicLogPointEnable(0xABCD); To enable just log point 0xABCD
862 * FrHslDynamicLogPointDisable(0xABCD); To disable just log point 0xABCD
863 */
864 //FrHslDynamicLogPointEnable(0x7FFF);
865
866 return TRUE;
867 }
868
FrHslFinalize(void)869 MS_BOOL FrHslFinalize(void)
870 {
871 int i=0;
872 stHslController *hsl;
873
874 for(i=0; i<HSL_INSTANCES; i++)
875 {
876 hsl = &gHSL[i];
877 CHECK_INIT(hsl, FALSE);
878
879 FrHsl_AutoTest_End(hsl);
880 bufferFinalize(hsl);
881
882 hsl->bInit = FALSE;
883 }
884 FrHslStop();
885 return TRUE;
886 }
887
888 #if 1 // remove these test functions later.
889 // Operation on FR_HSL_LAST_HARD_CODED_LOG_POINT added subsequent to this comment
890 // so ensure functionality is not broken before these functions are disabled.
891
892 /** Verifies if group id is filtered in or out. */
FrHslDynamicGroupIdTest(MS_U8 groupId)893 MS_BOOL FrHslDynamicGroupIdTest(MS_U8 groupId)
894 {
895 return FrHslDynamicGroupIdArray[groupId];
896 }
897
898 /** \ingroup ApiCBEcorePLFservicesFrHsl
899 * Test if a log point is enabled.
900 * Test if a log point is enabled - used internally in the logging macros
901 * Exception is made of the 'hardcoded' log points which should always be
902 * enabled.
903 * to decide whether to process with logging.
904 * \returns TRUE if log point is enabled.
905 */
FrHslDynamicLogPointTest(const MS_U16 lgHdr)906 MS_BOOL FrHslDynamicLogPointTest(const MS_U16 lgHdr /**< log header to test */)
907 {
908 MS_U16 bitIndex, byteIndex, bitMask;
909
910 if (lgHdr <= FR_HSL_LAST_HARD_CODED_LOG_POINT )
911 {
912 return TRUE; /* We ensure that such log points are allowed to be sent out. */
913 }
914
915 /* Find wordIndex and bitMask in logging array */
916 bitIndex = (lgHdr & FR_HSL_V2_FILTERED_LOG_POINT_ID_RANGE);
917 byteIndex = bitIndex >> 3;
918 bitIndex &= 7;
919 bitMask = (1 << bitIndex);
920
921 /* Set relevant bit in logging array */
922 if (FrHslDynamicLogPointArray[byteIndex] & bitMask)
923 return TRUE;
924 else
925 return FALSE;
926
927 }
928 #endif
929
FrHslCommand(p_HslController _hsl,CmdInfo * const pCmd)930 MS_BOOL FrHslCommand(p_HslController _hsl, CmdInfo* const pCmd)
931 {
932 CHECK_INIT(_hsl, FALSE);
933
934 return bufferProcessCommand(_hsl, pCmd);
935 }
936
937 /** Write a 0 argument message to HSL (just a message header, no data).
938 * Write a 0 argument message to HSL (just a message header, no data). Equivalent
939 * Equivalent to former LG_MES_0 macro.
940 * \param MS_U16 hDR = Autogenerated Log point ID.
941 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
942 */
M_FrHslPrintf0(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt)943 void M_FrHslPrintf0(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt)
944 {
945 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
946 CHECK_INIT(hsl,);
947 M_FrHsl0ByteMsg(u32Id, hsl);
948 }
949
950 /** Write a 1 argument message to HSL (just a message header, no data).
951 * Write a 1 argument message to HSL (just a message header, no data).
952 * Equivalent to former LG_MES_1 macro.
953 * \param MS_U16 hDR = Autogenerated Log point ID.
954 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
955 * \param MS_U16 aRG1 = argument value to log
956 */
M_FrHslPrintf1(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1)957 void M_FrHslPrintf1(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1)
958 {
959 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
960 CHECK_INIT(hsl,);
961 M_FrHslNArgumentsMsg(u32Id, hsl, 1, u16Arg1);
962 }
963
964 /** Write a 2 argument message to HSL (just a message header, no data).
965 * Write a 2 argument message to HSL (just a message header, no data).
966 * Equivalent to former LG_MES_2 macro.
967 * \param MS_U16 hDR = Autogenerated Log point ID.
968 * \param MS_U16 aRG1 = first argument value to log
969 * \param MS_U16 aRG2 = second argument value to log
970 */
M_FrHslPrintf2(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2)971 void M_FrHslPrintf2(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2)
972 {
973 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
974 CHECK_INIT(hsl,);
975 M_FrHslNArgumentsMsg(u32Id, hsl, 2, u16Arg1, u16Arg2);
976 }
977
978 /** Write a 3 argument message to HSL (just a message header, no data).
979 * Write a 3 argument message to HSL (just a message header, no data).
980 * Equivalent to former LG_MES_3 macro.
981 * \param MS_U16 hDR = Autogenerated Log point ID.
982 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
983 * \param MS_U16 aRG1 = first argument value to log
984 * \param MS_U16 aRG2 = second argument value to log
985 * \param MS_U16 aRG3 = third argument value to log
986 */
M_FrHslPrintf3(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3)987 void M_FrHslPrintf3(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3)
988 {
989 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
990 CHECK_INIT(hsl,);
991 M_FrHslNArgumentsMsg(u32Id, hsl, 3, u16Arg1, u16Arg2, u16Arg3);
992 }
993
994
995 /** Write a 4 argument message to HSL (just a message header, no data).
996 * Write a 4 argument message to HSL (just a message header, no data).
997 * Equivalent to former LG_MES_4 macro.
998 * \param MS_U16 hDR = Autogenerated Log point ID.
999 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1000 * \param MS_U16 aRG1 = first argument value to log
1001 * \param MS_U16 aRG2 = second argument value to log
1002 * \param MS_U16 aRG3 = third argument value to log
1003 * \param MS_U16 aRG4 = fourth argument value to log
1004 */
M_FrHslPrintf4(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4)1005 void M_FrHslPrintf4(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4)
1006 {
1007 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1008 CHECK_INIT(hsl,);
1009 M_FrHslNArgumentsMsg(u32Id, hsl, 4, u16Arg1, u16Arg2, u16Arg3, u16Arg4);
1010 }
1011
1012 /** Write a 5 argument message to HSL (just a message header, no data).
1013 * Write a 5 argument message to HSL (just a message header, no data).
1014 * \param MS_U16 hDR = Autogenerated Log point ID.
1015 * Equivalent to former LG_MES_5 macro.
1016 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1017 * \param MS_U16 aRG1 = first argument value to log
1018 * \param MS_U16 aRG2 = second argument value to log
1019 * \param MS_U16 aRG3 = third argument value to log
1020 * \param MS_U16 aRG4 = fourth argument value to log
1021 * \param MS_U16 aRG5 = fifth argument value to log
1022 */
M_FrHslPrintf5(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5)1023 void M_FrHslPrintf5(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5)
1024 {
1025 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1026 CHECK_INIT(hsl,);
1027 M_FrHslNArgumentsMsg(u32Id, hsl, 5, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5);
1028 }
1029
1030 /** Write a 6 argument message to HSL (just a message header, no data).
1031 * Write a 6 argument message to HSL (just a message header, no data).
1032 * \param MS_U16 hDR = Autogenerated Log point ID.
1033 * Equivalent to former LG_MES_6 macro.
1034 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1035 * \param MS_U16 aRG1 = first argument value to log
1036 * \param MS_U16 aRG2 = second argument value to log
1037 * \param MS_U16 aRG3 = third argument value to log
1038 * \param MS_U16 aRG4 = fourth argument value to log
1039 * \param MS_U16 aRG5 = fifth argument value to log
1040 * \param MS_U16 aRG6 = sixth argument value to log
1041 */
M_FrHslPrintf6(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6)1042 void M_FrHslPrintf6(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5, const MS_U16 u16Arg6)
1043 {
1044 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1045 CHECK_INIT(hsl,);
1046 M_FrHslNArgumentsMsg(u32Id, hsl, 6, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6);
1047 }
1048
1049
1050 /** Write a 7 argument message to HSL (just a message header, no data).
1051 * Write a 7 argument message to HSL (just a message header, no data).
1052 * \param MS_U16 hDR = Autogenerated Log point ID.
1053 * Equivalent to former LG_MES_6 macro.
1054 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1055 * \param MS_U16 aRG1 = first argument value to log
1056 * \param MS_U16 aRG2 = second argument value to log
1057 * \param MS_U16 aRG3 = third argument value to log
1058 * \param MS_U16 aRG4 = fourth argument value to log
1059 * \param MS_U16 aRG5 = fifth argument value to log
1060 * \param MS_U16 aRG6 = sixth argument value to log
1061 * \param MS_U16 aRG7 = seventh argument value to log
1062 */
M_FrHslPrintf7(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7)1063 void M_FrHslPrintf7(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1064 const MS_U16 u16Arg6, const MS_U16 u16Arg7)
1065 {
1066 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1067 CHECK_INIT(hsl,);
1068 M_FrHslNArgumentsMsg(u32Id, hsl, 7, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7);
1069 }
1070
1071 /** Write a 8 argument message to HSL (just a message header, no data).
1072 * Write a 8 argument message to HSL (just a message header, no data).
1073 * \param MS_U16 hDR = Autogenerated Log point ID.
1074 * Equivalent to former LG_MES_6 macro.
1075 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1076 * \param MS_U16 aRG1 = first argument value to log
1077 * \param MS_U16 aRG2 = second argument value to log
1078 * \param MS_U16 aRG3 = third argument value to log
1079 * \param MS_U16 aRG4 = fourth argument value to log
1080 * \param MS_U16 aRG5 = fifth argument value to log
1081 * \param MS_U16 aRG6 = sixth argument value to log
1082 * \param MS_U16 aRG7 = seventh argument value to log
1083 * \param MS_U16 aRG8 = eighth argument value to log
1084 */
M_FrHslPrintf8(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8)1085 void M_FrHslPrintf8(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1086 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8)
1087 {
1088 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1089 CHECK_INIT(hsl,);
1090 M_FrHslNArgumentsMsg(u32Id, hsl, 8, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8);
1091 }
1092
1093 /** Write a 9 argument message to HSL (just a message header, no data).
1094 * Write a 9 argument message to HSL (just a message header, no data).
1095 * \param MS_U16 hDR = Autogenerated Log point ID.
1096 * Equivalent to former LG_MES_6 macro.
1097 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1098 * \param MS_U16 aRG1 = first argument value to log
1099 * \param MS_U16 aRG2 = second argument value to log
1100 * \param MS_U16 aRG3 = third argument value to log
1101 * \param MS_U16 aRG4 = fourth argument value to log
1102 * \param MS_U16 aRG5 = fifth argument value to log
1103 * \param MS_U16 aRG6 = sixth argument value to log
1104 * \param MS_U16 aRG7 = seventh argument value to log
1105 * \param MS_U16 aRG8 = eighth argument value to log
1106 * \param MS_U16 aRG9 = nineth argument value to log
1107 */
M_FrHslPrintf9(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9)1108 void M_FrHslPrintf9(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1109 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9)
1110 {
1111 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1112 CHECK_INIT(hsl,);
1113 M_FrHslNArgumentsMsg(u32Id, hsl, 9, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9);
1114 }
1115
1116 /** Write a 10 argument message to HSL (just a message header, no data).
1117 * Write a 10 argument message to HSL (just a message header, no data).
1118 * \param MS_U16 hDR = Autogenerated Log point ID.
1119 * Equivalent to former LG_MES_6 macro.
1120 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1121 * \param MS_U16 aRG1 = first argument value to log
1122 * \param MS_U16 aRG2 = second argument value to log
1123 * \param MS_U16 aRG3 = third argument value to log
1124 * \param MS_U16 aRG4 = fourth argument value to log
1125 * \param MS_U16 aRG5 = fifth argument value to log
1126 * \param MS_U16 aRG6 = sixth argument value to log
1127 * \param MS_U16 aRG7 = seventh argument value to log
1128 * \param MS_U16 aRG8 = eighth argument value to log
1129 * \param MS_U16 aRG9 = nineth argument value to log
1130 * \param MS_U16 aRG10 = tenth argument value to log
1131 */
M_FrHslPrintf10(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10)1132 void M_FrHslPrintf10(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1133 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10)
1134 {
1135 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1136 CHECK_INIT(hsl,);
1137 M_FrHslNArgumentsMsg(u32Id, hsl, 10, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10);
1138 }
1139
1140 /** Write a 11 argument message to HSL (just a message header, no data).
1141 * Write a 11 argument message to HSL (just a message header, no data).
1142 * \param MS_U16 hDR = Autogenerated Log point ID.
1143 * Equivalent to former LG_MES_6 macro.
1144 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1145 * \param MS_U16 aRG1 = first argument value to log
1146 * \param MS_U16 aRG2 = second argument value to log
1147 * \param MS_U16 aRG3 = third argument value to log
1148 * \param MS_U16 aRG4 = fourth argument value to log
1149 * \param MS_U16 aRG5 = fifth argument value to log
1150 * \param MS_U16 aRG6 = sixth argument value to log
1151 * \param MS_U16 aRG7 = seventh argument value to log
1152 * \param MS_U16 aRG8 = eighth argument value to log
1153 * \param MS_U16 aRG9 = nineth argument value to log
1154 * \param MS_U16 aRG10 = tenth argument value to log
1155 * \param MS_U16 aRG11 = eleventh argument value to log
1156 */
M_FrHslPrintf11(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11)1157 void M_FrHslPrintf11(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1158 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1159 const MS_U16 u16Arg11)
1160 {
1161 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1162 CHECK_INIT(hsl,);
1163 M_FrHslNArgumentsMsg(u32Id, hsl, 11, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11);
1164 }
1165
1166 /** Write a 12 argument message to HSL (just a message header, no data).
1167 * Write a 12 argument message to HSL (just a message header, no data).
1168 * \param MS_U16 hDR = Autogenerated Log point ID.
1169 * Equivalent to former LG_MES_6 macro.
1170 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1171 * \param MS_U16 aRG1 = first argument value to log
1172 * \param MS_U16 aRG2 = second argument value to log
1173 * \param MS_U16 aRG3 = third argument value to log
1174 * \param MS_U16 aRG4 = fourth argument value to log
1175 * \param MS_U16 aRG5 = fifth argument value to log
1176 * \param MS_U16 aRG6 = sixth argument value to log
1177 * \param MS_U16 aRG7 = seventh argument value to log
1178 * \param MS_U16 aRG8 = eighth argument value to log
1179 * \param MS_U16 aRG9 = nineth argument value to log
1180 * \param MS_U16 aRG10 = tenth argument value to log
1181 * \param MS_U16 aRG11 = eleventh argument value to log
1182 * \param MS_U16 aRG12 = twelveth argument value to log
1183 */
M_FrHslPrintf12(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11,const MS_U16 u16Arg12)1184 void M_FrHslPrintf12(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1185 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1186 const MS_U16 u16Arg11 , const MS_U16 u16Arg12)
1187 {
1188 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1189 CHECK_INIT(hsl,);
1190 M_FrHslNArgumentsMsg(u32Id, hsl, 12, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11, u16Arg12);
1191 }
1192
1193 /** Write a 13 argument message to HSL (just a message header, no data).
1194 * Write a 13 argument message to HSL (just a message header, no data).
1195 * \param MS_U16 hDR = Autogenerated Log point ID.
1196 * Equivalent to former LG_MES_6 macro.
1197 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1198 * \param MS_U16 aRG1 = first argument value to log
1199 * \param MS_U16 aRG2 = second argument value to log
1200 * \param MS_U16 aRG3 = third argument value to log
1201 * \param MS_U16 aRG4 = fourth argument value to log
1202 * \param MS_U16 aRG5 = fifth argument value to log
1203 * \param MS_U16 aRG6 = sixth argument value to log
1204 * \param MS_U16 aRG7 = seventh argument value to log
1205 * \param MS_U16 aRG8 = eighth argument value to log
1206 * \param MS_U16 aRG9 = nineth argument value to log
1207 * \param MS_U16 aRG10 = tenth argument value to log
1208 * \param MS_U16 aRG11 = eleventh argument value to log
1209 * \param MS_U16 aRG12 = twelveth argument value to log
1210 * \param MS_U16 aRG13 = thirteenth argument value to log
1211 */
M_FrHslPrintf13(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11,const MS_U16 u16Arg12,const MS_U16 u16Arg13)1212 void M_FrHslPrintf13(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1213 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1214 const MS_U16 u16Arg11 , const MS_U16 u16Arg12, const MS_U16 u16Arg13)
1215 {
1216 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1217 CHECK_INIT(hsl,);
1218 M_FrHslNArgumentsMsg(u32Id, hsl, 13, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11, u16Arg12, u16Arg13);
1219 }
1220
1221 /** Write a 14 argument message to HSL (just a message header, no data).
1222 * Write a 14 argument message to HSL (just a message header, no data).
1223 * \param MS_U16 hDR = Autogenerated Log point ID.
1224 * Equivalent to former LG_MES_6 macro.
1225 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1226 * \param MS_U16 aRG1 = first argument value to log
1227 * \param MS_U16 aRG2 = second argument value to log
1228 * \param MS_U16 aRG3 = third argument value to log
1229 * \param MS_U16 aRG4 = fourth argument value to log
1230 * \param MS_U16 aRG5 = fifth argument value to log
1231 * \param MS_U16 aRG6 = sixth argument value to log
1232 * \param MS_U16 aRG7 = seventh argument value to log
1233 * \param MS_U16 aRG8 = eighth argument value to log
1234 * \param MS_U16 aRG9 = nineth argument value to log
1235 * \param MS_U16 aRG10 = tenth argument value to log
1236 * \param MS_U16 aRG11 = eleventh argument value to log
1237 * \param MS_U16 aRG12 = twelveth argument value to log
1238 * \param MS_U16 aRG13 = thirteenth argument value to log
1239 * \param MS_U16 aRG14 = fourteenth argument value to log
1240 */
M_FrHslPrintf14(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11,const MS_U16 u16Arg12,const MS_U16 u16Arg13,const MS_U16 u16Arg14)1241 void M_FrHslPrintf14(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1242 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1243 const MS_U16 u16Arg11 , const MS_U16 u16Arg12, const MS_U16 u16Arg13, const MS_U16 u16Arg14)
1244 {
1245 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1246 CHECK_INIT(hsl,);
1247 M_FrHslNArgumentsMsg(u32Id, hsl, 14, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11, u16Arg12, u16Arg13, u16Arg14);
1248 }
1249
1250 /** Write a 15 argument message to HSL (just a message header, no data).
1251 * Write a 15 argument message to HSL (just a message header, no data).
1252 * \param MS_U16 hDR = Autogenerated Log point ID.
1253 * Equivalent to former LG_MES_6 macro.
1254 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1255 * \param MS_U16 aRG1 = first argument value to log
1256 * \param MS_U16 aRG2 = second argument value to log
1257 * \param MS_U16 aRG3 = third argument value to log
1258 * \param MS_U16 aRG4 = fourth argument value to log
1259 * \param MS_U16 aRG5 = fifth argument value to log
1260 * \param MS_U16 aRG6 = sixth argument value to log
1261 * \param MS_U16 aRG7 = seventh argument value to log
1262 * \param MS_U16 aRG8 = eighth argument value to log
1263 * \param MS_U16 aRG9 = nineth argument value to log
1264 * \param MS_U16 aRG10 = tenth argument value to log
1265 * \param MS_U16 aRG11 = eleventh argument value to log
1266 * \param MS_U16 aRG12 = twelveth argument value to log
1267 * \param MS_U16 aRG13 = thirteenth argument value to log
1268 * \param MS_U16 aRG14 = fourteenth argument value to log
1269 * \param MS_U16 aRG15 = fifteenth argument value to log
1270 */
M_FrHslPrintf15(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11,const MS_U16 u16Arg12,const MS_U16 u16Arg13,const MS_U16 u16Arg14,const MS_U16 u16Arg15)1271 void M_FrHslPrintf15(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1272 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1273 const MS_U16 u16Arg11 , const MS_U16 u16Arg12, const MS_U16 u16Arg13, const MS_U16 u16Arg14, const MS_U16 u16Arg15)
1274 {
1275 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1276 CHECK_INIT(hsl,);
1277 M_FrHslNArgumentsMsg(u32Id, hsl, 15, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11, u16Arg12, u16Arg13, u16Arg14, u16Arg15);
1278 }
1279
1280 /** Write a 16 argument message to HSL (just a message header, no data).
1281 * Write a 16 argument message to HSL (just a message header, no data).
1282 * \param MS_U16 hDR = Autogenerated Log point ID.
1283 * Equivalent to former LG_MES_6 macro.
1284 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1285 * \param MS_U16 aRG1 = first argument value to log
1286 * \param MS_U16 aRG2 = second argument value to log
1287 * \param MS_U16 aRG3 = third argument value to log
1288 * \param MS_U16 aRG4 = fourth argument value to log
1289 * \param MS_U16 aRG5 = fifth argument value to log
1290 * \param MS_U16 aRG6 = sixth argument value to log
1291 * \param MS_U16 aRG7 = seventh argument value to log
1292 * \param MS_U16 aRG8 = eighth argument value to log
1293 * \param MS_U16 aRG9 = nineth argument value to log
1294 * \param MS_U16 aRG10 = tenth argument value to log
1295 * \param MS_U16 aRG11 = eleventh argument value to log
1296 * \param MS_U16 aRG12 = twelveth argument value to log
1297 * \param MS_U16 aRG13 = thirteenth argument value to log
1298 * \param MS_U16 aRG14 = fourteenth argument value to log
1299 * \param MS_U16 aRG15 = fifteenth argument value to log
1300 * \param MS_U16 aRG16 = sixteenth argument value to log
1301 */
M_FrHslPrintf16(const MS_U32 u32Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Arg1,const MS_U16 u16Arg2,const MS_U16 u16Arg3,const MS_U16 u16Arg4,const MS_U16 u16Arg5,const MS_U16 u16Arg6,const MS_U16 u16Arg7,const MS_U16 u16Arg8,const MS_U16 u16Arg9,const MS_U16 u16Arg10,const MS_U16 u16Arg11,const MS_U16 u16Arg12,const MS_U16 u16Arg13,const MS_U16 u16Arg14,const MS_U16 u16Arg15,const MS_U16 u16Arg16)1302 void M_FrHslPrintf16(const MS_U32 u32Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Arg1 , const MS_U16 u16Arg2, const MS_U16 u16Arg3, const MS_U16 u16Arg4, const MS_U16 u16Arg5,
1303 const MS_U16 u16Arg6, const MS_U16 u16Arg7 , const MS_U16 u16Arg8, const MS_U16 u16Arg9, const MS_U16 u16Arg10,
1304 const MS_U16 u16Arg11 , const MS_U16 u16Arg12, const MS_U16 u16Arg13, const MS_U16 u16Arg14, const MS_U16 u16Arg15, const MS_U16 u16Arg16)
1305 {
1306 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1307 CHECK_INIT(hsl,);
1308 M_FrHslNArgumentsMsg(u32Id, hsl, 16, u16Arg1, u16Arg2, u16Arg3, u16Arg4, u16Arg5, u16Arg6, u16Arg7, u16Arg8, u16Arg9, u16Arg10, u16Arg11, u16Arg12, u16Arg13, u16Arg14, u16Arg15, u16Arg16);
1309 }
1310
1311 /** Write a string message
1312 * Write a string message
1313 * \param MS_U16 hDR = Message header word.
1314 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1315 * \param MS_U16 *pDATA = Array of lENGTH MS_U16s.
1316 */
M_FrHslString(const MS_U16 u16Id,const MS_U16 u16GId,const char * u8Fmt,const void * pArray)1317 void M_FrHslString(const MS_U16 u16Id, const MS_U16 u16GId, const char* u8Fmt, const void* pArray)
1318 {
1319 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1320 CHECK_INIT(hsl,);
1321
1322 if ( NULL==pArray )
1323 {
1324 return;
1325 }
1326 M_FrHslMS_U8ArrayMsg(u16Id, hsl, pArray);
1327 }
1328
1329
1330 /** Write a message that is an array of MS_U16s.
1331 * Write a message that is an array of MS_U16s. Equivalent to former LG_MS_U16_DATA macro.
1332 * \param MS_U16 hDR = Message header word.
1333 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1334 * \param MS_U16 lENGTH = Number of MS_U16s in the array.
1335 * \param MS_U16 *pDATA = Array of lENGTH MS_U16s.
1336 */
M_FrHslArray16(const MS_U16 u16Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16length,const void * pArray)1337 void M_FrHslArray16(const MS_U16 u16Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16length, const void* pArray)
1338 {
1339 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1340 CHECK_INIT(hsl,);
1341
1342 if ( NULL==pArray )
1343 {
1344 return;
1345 }
1346 M_FrHslMS_U16ArrayMsg(u16Id, hsl, u16length, pArray);
1347 }
1348
1349 /** Write a message that is an array of MS_U32s. Filter applied at run time.
1350 * Write a message that is an array of MS_U32s. Filter applied at run time.
1351 * \param MS_U16 hDR = Message header word.
1352 * \param String fORMATsPECIFER = Format specifier string which resolves to nothing at compile time.
1353 * \param MS_U16 lENGTH = Number of MS_U32s in the array.
1354 * \param MS_U32 *pDATA = Array of lENGTH MS_U32s.
1355 * \param MS_U16 lASTwORDeMPTY = Logging indicator for the last 16 bit word - if set to 1 the last 16 bit word is not logged.
1356 */
M_FrHslArray32(const MS_U16 u16Id,const MS_U16 u16GId,const char * u8Fmt,const MS_U16 u16Length,const void * pArray,const MS_BOOL bLastWordEmpty)1357 void M_FrHslArray32(const MS_U16 u16Id, const MS_U16 u16GId, const char* u8Fmt, const MS_U16 u16Length, const void* pArray, const MS_BOOL bLastWordEmpty)
1358 {
1359 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1360 CHECK_INIT(hsl,);
1361
1362 if ( NULL==pArray )
1363 {
1364 return;
1365 }
1366 M_FrHslMS_U32ArrayMsg(u16Id, hsl, u16Length, pArray, bLastWordEmpty);
1367 }
1368
FrHslTypedefCall(const MS_U16 u16Id,const MS_U16 u16GId,const MS_U16 u16Length,const void * pArray,const MS_BOOL bOddBytePresent)1369 void FrHslTypedefCall(const MS_U16 u16Id, const MS_U16 u16GId, const MS_U16 u16Length, const void* pArray, const MS_BOOL bOddBytePresent)
1370 {
1371 p_HslController hsl = &gHSL[GetBufferId(u16GId)];
1372 CHECK_INIT(hsl,);
1373
1374 if ( NULL==pArray )
1375 {
1376 return;
1377 }
1378 M_FrHslTypedefMsg(u16Id, hsl, u16Length, bOddBytePresent, pArray);
1379 }
1380
1381
FrHslAddDynamicLibInfo(void * baseAddress,void * onLoadAddr,const char * libFileName)1382 MS_BOOL FrHslAddDynamicLibInfo(void* baseAddress, void* onLoadAddr, const char *libFileName)
1383 {
1384 int i = 0;
1385 MS_BOOL retVal = true;
1386
1387 if(gDynamicLibraryCount >= HSL_MAX_LIBRARY_COUNT)
1388 {
1389 retVal = false;
1390 return retVal;
1391 }
1392
1393 for(i=0; i<gDynamicLibraryCount && i<HSL_MAX_LIBRARY_COUNT; i++)
1394 {
1395 if(gDynamicLibraryInfo[i].base_address == baseAddress)
1396 {
1397 break;
1398 }
1399 }
1400 if( i < HSL_MAX_LIBRARY_COUNT )
1401 {
1402 strncpy(gDynamicLibraryInfo[gDynamicLibraryCount].name, libFileName, HSL_MAX_LIBRARY_NAME - 1);
1403 gDynamicLibraryInfo[gDynamicLibraryCount].base_address = baseAddress;
1404 gDynamicLibraryInfo[gDynamicLibraryCount].on_load_addr = onLoadAddr;
1405 gDynamicLibraryCount ++;
1406 }
1407 else
1408 {
1409 M_FrHslPrintf0 (0x0DF5, HSL_DBG_SN_PROFILING, "System profiling, dynamic library info table full!:");
1410 retVal = false;
1411 }
1412 M_FrHslTypedef (0x87D3, HSL_DBG_SN_PROFILING, "Dynamic library base address: %d", ST_LIBRARY_SHORT_INFO, &gDynamicLibraryInfo[i]);
1413 return retVal;
1414 }
1415
FrHslAddThreadInfo(const MS_U32 threadId,const char * threadName)1416 MS_BOOL FrHslAddThreadInfo(const MS_U32 threadId, const char* threadName)
1417 {
1418 int i = 0;
1419 MS_BOOL retVal = true;
1420 for(i=0; i<gThreadCount && i<HSL_MAX_THREAD_COUNT; i++)
1421 {
1422 if(gThreadInfo[i].thread_ID == threadId)
1423 {
1424 break;
1425 }
1426 }
1427 if(gThreadCount >= HSL_MAX_THREAD_COUNT)
1428 {
1429 retVal = false;
1430 return retVal;
1431
1432 }
1433 if( i < HSL_MAX_THREAD_COUNT )
1434 {
1435 strncpy(gThreadInfo[gThreadCount].thread_name, threadName, HSL_MAX_THREAD_NAME - 1);
1436 gThreadInfo[gThreadCount].thread_ID = threadId;
1437 gThreadCount ++;
1438 }
1439 else
1440 {
1441 M_FrHslPrintf0 (0x0E25, HSL_DBG_SN_PROFILING, "System profiling, thread name table full!:");
1442 retVal = false;
1443 }
1444 M_FrHslTypedef (0x8DA6, HSL_DBG_SN_PROFILING, "Thread name: %d", ST_THREAD_INFO, &gThreadInfo[i]);
1445 return retVal;
1446
1447 }
1448
1449 /*******************************************************************************
1450 * Function : KiAllocMemory
1451 * Group : GKI, Test Interface, Internals
1452 * Parameter : ptr
1453 * Returns : Nothing
1454 * Description : allocate any memory
1455 ******************************************************************************/
1456 #define KiAllocMemory(size, ptr) \
1457 { \
1458 *ptr = malloc(size); \
1459 }
1460
1461 /** Process a Sets filter matrix data structure.
1462 * This function converts the Sets Filter matrix structure as used by the
1463 * associated signal or when using a static filter to the run time structure.
1464 * A length is required by this function as the sets filter data is variable
1465 * length.
1466 * \param[in] signalData The sets filter matrix data.
1467 */
KiTtiProcessSetsFilter(const KiSetsFilterMatrix * signalData)1468 void KiTtiProcessSetsFilter(const KiSetsFilterMatrix * signalData)
1469 {
1470 MS_U32 dataSize;
1471 MS_U8 ** basePointer;
1472 MS_U8 * sigPointer;
1473 const MS_U8 * sourcePointer;
1474 MS_U32 counter;
1475 MS_U32 tempData;
1476 MS_U32 oldData;
1477 MS_U8 ** workPtr;
1478 MS_U8 * blankBase;
1479 const MS_U8 *bitmapPtr;
1480 MS_U8 *logPointArrayPtr;
1481 MS_U16 *setIndexes, *baseIndexes, setZeroBases, baseCounter;
1482
1483 if ((signalData->numSets > 0) && (signalData->numSets <= 0xFFFF))
1484 {
1485 setIndexes = malloc(sizeof(MS_U16) * signalData->numSets);
1486 }
1487 else
1488 {
1489 return;
1490 }
1491
1492 if ((signalData->numBases > 0) && (signalData->numBases <= 0xFF))
1493 {
1494 baseIndexes = malloc(sizeof(MS_U16) * signalData->numBases);
1495 }
1496 else
1497 {
1498 free(setIndexes);
1499 return;
1500 }
1501 /* Get rid of old memory */
1502 KiTtiDestroyOldFilterMemory();
1503
1504 /* Calculate how much memory is required for the matrix */
1505 /* This calculation is a bit pointless on a 32 bit target
1506 ** as the size of pointers should be 4. But it is needed
1507 ** for 64 bit targets */
1508 dataSize = (signalData->numSets * sizeof(MS_U8 **)) +
1509 (signalData->numBases * sizeof(MS_U8 *)) +
1510 (signalData->matrixSize -
1511 ((signalData->numSets * 4) +
1512 (signalData->numBases * 4))) +
1513 KI_MAX_ONE_BASE_SIG_BITMAP; /* For the blank base */
1514
1515 /* Allocate the required memory */
1516 KiAllocMemory (dataSize, (void **) &kiTtiSetFilter);
1517
1518 /* Using a ** rather than *** makes the following a bit tidier */
1519 workPtr = (MS_U8 **)kiTtiSetFilter;
1520 /* Set the blankBase address */
1521 blankBase = &(((MS_U8 *)kiTtiSetFilter)[dataSize - KI_MAX_ONE_BASE_SIG_BITMAP]);
1522 /* Make sure it is empty */
1523 memset(blankBase, 0, KI_MAX_ONE_BASE_SIG_BITMAP);
1524
1525 /* Fill in matrix, starting with set pointers */
1526 /* Point to the start of the base pointers */
1527 basePointer = &(workPtr[signalData->numSets]);
1528 /* Set indexes are at the start of the matrix */
1529 /* Coverity will produce error here.
1530 Even though, member matrix is defined as a static char array (of size 10), its actual size varies depending on how
1531 Genie builds the KiSetsFilterMatrix to be send to the target.
1532 Genie treats matrix as a pointer and sets the proper size of the matrix as it needs (can be 120 bytes for example).
1533 Genie sets the actual size in the "matrixSize" member (see typedef KiSetsFilterMatrixTag).
1534 When Genie sends the matrix to target using the KiSetsFilterMatrix struct, the matrix member has a dynamic size and it
1535 ("matrixSize" member) is carefully considered in the apiHSL.c implementation.
1536 All signals sent from the PC to the target can have a max signal size of 20000 Bytes. */
1537
1538 sourcePointer = signalData->matrix;
1539 for (counter = 0; (MS_U16)counter < signalData->numSets; counter++)
1540 {
1541 /* Reconstruct the base index from the input signal */
1542 tempData = (MS_U32)((sourcePointer[0] << 24) |
1543 (sourcePointer[1] << 16) |
1544 (sourcePointer[2] << 8) |
1545 sourcePointer[3]);
1546
1547 setIndexes[counter] = tempData;
1548
1549 /* Save the pointer to the first base in this set */
1550 workPtr[counter] = (MS_U8 *)&basePointer[tempData];
1551 /* Increment the sourcePointer */
1552 sourcePointer += 4;
1553 }
1554
1555 /* Now fill in base pointers */
1556 /* Point to the start of the signal bitmaps */
1557 sigPointer = (MS_U8 *)&(workPtr[signalData->numSets + signalData->numBases]);
1558 /* Set oldData to an invalid index */
1559 oldData = 0xFFFFFFFF;
1560
1561 for (/* deliberate */;
1562 counter < (signalData->numSets + signalData->numBases);
1563 counter++)
1564 {
1565 /* Reconstruct the signal bitmap index from the input signal */
1566 tempData = (MS_U32)((sourcePointer[0] << 24) |
1567 (sourcePointer[1] << 16) |
1568 (sourcePointer[2] << 8) |
1569 sourcePointer[3]);
1570
1571 baseIndexes[counter - signalData->numSets] = tempData;
1572
1573 /* Check for previous base being empty */
1574 if (oldData == tempData)
1575 { /* Previous base is empty so set to blank base to prevent
1576 ** invalid logging */
1577 workPtr[counter - 1] = blankBase;
1578 }
1579 /* Save the pointer to the first base in this set */
1580 workPtr[counter] = &(sigPointer[tempData]);
1581 /* Increment the sourcePointer */
1582 sourcePointer += 4;
1583 /* Remember this index */
1584 oldData = tempData;
1585 }
1586
1587 /* Now copy over the signal bit maps */
1588 /* sourcePointer now points to the place where we want to copy the
1589 ** signal bitmap from */
1590
1591 memcpy(sigPointer,
1592 sourcePointer,
1593 (size_t)(signalData->matrixSize - ((signalData->numSets * 4) + (signalData->numBases * 4))));
1594
1595 kiTtiFilterMemory = (void *)kiTtiSetFilter;
1596 M_KiTtiSetFilterType(KI_FILTER_SET);
1597
1598 //we copy the data from the bitmap to our flat array
1599 if (signalData->numSets == 1)
1600 //if we have only one set, signalData->numBases gives us total number of bases in set 0
1601 setZeroBases = signalData->numBases;
1602 else
1603 //setZeroBases = (index of set 1's bases) - (index of set 0's bases)
1604 setZeroBases = setIndexes[1] - setIndexes[0]; //typically, setIndexes[0] = 0
1605
1606 bitmapPtr = sourcePointer;
1607 counter = 0;
1608
1609 //iterate through the bases of set 0
1610 for (baseCounter = 0; baseCounter < setZeroBases; baseCounter++)
1611 {
1612 logPointArrayPtr = &FrHslDynamicLogPointArray[(baseCounter << 5)];
1613
1614 //itegrate through the signals of current base
1615 for (/* intentional */; (MS_U16)counter < baseIndexes[baseCounter]; counter++)
1616 {
1617 //counter is the index of signal bitmap byte
1618 *logPointArrayPtr = *bitmapPtr;
1619 ++logPointArrayPtr;
1620 ++bitmapPtr;
1621 }
1622 }//for
1623
1624 free(setIndexes);
1625 free(baseIndexes);
1626
1627 }
1628
1629 /*******************************************************************************
1630 * Function : KiFreeMemory
1631 * Group : GKI, Test Interface, Internals
1632 * Parameter : ptr
1633 * Returns : Nothing
1634 * Description : Free any memory
1635 ******************************************************************************/
1636 #define KiFreeMemory(ptr) \
1637 { \
1638 free(*ptr); \
1639 *ptr = NULL; \
1640 }
1641
1642
1643 /*******************************************************************************
1644 * Function : KiTtiDestroyOldFilterMemory
1645 * Group : GKI, Test Interface, Internals
1646 * Parameter : None
1647 * Returns : Nothing
1648 * Description : Free any memory allocated for the signal filter data.
1649 ******************************************************************************/
KiTtiDestroyOldFilterMemory(void)1650 static void KiTtiDestroyOldFilterMemory (void)
1651 {
1652 if (kiTtiFilterMemory != NULL)
1653 {
1654 /* Save stored filter type before setting it to NONE */
1655 KiFilterType destroyFilterType = kiTtiStoredFilterType;
1656
1657 /* Set the filter to none before destroying the memory to prevent
1658 ** logging while the filter is being changed. */
1659 M_KiTtiSetFilterType(KI_FILTER_NONE);
1660
1661 if (destroyFilterType == KI_FILTER_SET)
1662 {
1663 KiFreeMemory (&kiTtiFilterMemory);
1664 kiTtiSetFilter = NULL;
1665 }
1666 }
1667 }
1668
1669 #endif /* MSOS_TYPE_LINUX */
1670 /* END OF FILE */
1671