force AT$QCDMG from command-line
[huawei.git] / AMSS / diagdiag_v.h
1 #ifndef DIAGDIAG_V_H\r
2 #define DIAGDIAG_V_H\r
3 /*==========================================================================\r
4 \r
5                       Diagnostic Packet Definitions\r
6 \r
7   Description: Packet definitions between the diagnostic subsystem\r
8   and the external device.\r
9 \r
10   !!! NOTE: All member structures of diag packets must be PACK.\r
11   \r
12   !!! WARNING: Each command code number is part of the externalized\r
13   diagnostic command interface.  This number *MUST* be assigned\r
14   by a member of QCT's tools development team.\r
15 \r
16 Copyright (c) 2001-2010 by QUALCOMM, Incorporated.  All Rights Reserved.\r
17 ===========================================================================*/\r
18 \r
19 /*===========================================================================\r
20 \r
21                             Edit History\r
22 \r
23   $Header: //source/qcom/qct/core/pkg/2H09/halcyon_modem/rel/LA2.0/AMSS/products/7x30/core/services/diag/LSM/common/src/diagdiag_v.h#1 $\r
24 \r
25 when       who     what, where, why\r
26 --------   ---     ----------------------------------------------------------\r
27 07/10/10   vs    Moved definitions of diagpeek/poke to public header\r
28 04/20/10   is    Remove support for DIAG_GET_PROPERTY_F, DIAG_PUT_PROPERTY_F,\r
29                             DIAG_GET_PERM_PROPERTY_F, and DIAG_PUT_PERM_PROPERTY_F.\r
30 04/05/10   JV      Added test cases for QSR messages in the stress test\r
31 03/02/10   JV      New command to enable/disable data aggregation\r
32 02/25/10   JV      New command to flush diagbuf.\r
33 12/15/09   JV      Mainlining code under the 'DEBUG_DIAG_TEST' feature\r
34 12/07/09   cahn    Added Delayed Response to DIAG Health.\r
35 11/12/09   cahn    Added variable length log types for DIAG stress test.\r
36 11/04/09   cahn    DIAG Health\r
37 09/20/09   sg      Added diagdiag_tbl_init prototype\r
38 09/15/09   cahn    Added loopback on individual processors.\r
39 09/10/09   JV      Added protptype for diagdiag_init().\r
40 08/05/09   JV      Removed the CUST_H featurization around the inclusion of \r
41                    customer.h.\r
42 07/31/09   JV      Merged Q6 diag code back to mainline\r
43 07/14/09   mad     Featurized includion of customer.h and feature.h.\r
44                    Featured out FEATURE_QUERY pkt/response.\r
45 06/11/09   JV      Added command code for Q6 stress test\r
46 05/07/09   vk      moved declerations into diagdiag.h that were being referred from \r
47                    there\r
48 01/14/09   vg      Fixed type added during the public and private headerfile\r
49                    split. \r
50 10/03/08   vg      Updated code to use PACK() vs. PACKED\r
51 05/17/05   as      Added Dual processor Diag support.\r
52 06/15/04   gr      Added support for getting and setting the event mask.\r
53 05/18/04   as      Removed support for DIAG_USER_CMD_F & DIAG_PERM_USER_CMD_F\r
54 01/07/03   djm     add RPC support for WCDMA_PLT\r
55 08/20/02   lad     Moved DIAG_DLOAD_F packet def to dloaddiag.h.\r
56                    Moved DIAG_SERIAL_CHG_F definition to diagcomm_sio.c.\r
57 01/28/02   as      Support for DIAG_LOG_ON_DEMAND_F (log on demand).\r
58 09/18/01   jal     Support for DIAG_CONTROL_F (mode reset/offline)\r
59 08/20/01   jal     Support for Diag packet: DIAG_TS_F (timestamp),\r
60                    DIAG_SPC_F (service programming code), DIAG_DLOAD_F\r
61                    (start downloader), DIAG_OUTP_F/DIAG_OUTPW_F (IO\r
62                    port byte/word output), DIAG_INP_F/DIAG_INPW_F (IO\r
63                    port byte/word input) \r
64 06/27/01   lad     Use of constants in message response packet.\r
65                    Added packet definition for DIAG_LOG_CONFIG_F.  This\r
66                    replaces extended logmask processing.\r
67                    Cleaned up DIAG_STREAMING_CONFIG_F and added subcmd to\r
68                    get diagbuf size.\r
69 04/06/01   lad     Added packet definitions for the following:\r
70                    Peek/Poke\r
71                    DIAG_STREAMING_CONFIG_F\r
72                    Debug messages\r
73                    Log services\r
74                    Event services\r
75 02/23/01   lad     Created file.\r
76 \r
77 ===========================================================================*/\r
78 \r
79 #include "comdef.h"\r
80 \r
81 #ifndef FEATURE_WINCE\r
82 #include "customer.h"\r
83 #include "feature.h"\r
84 #endif\r
85 \r
86 #include "diagcmd.h"\r
87 #include "diagpkt.h"\r
88 #include "log_codes.h"\r
89 #include "qw.h"\r
90 #include "diag.h"\r
91 #include "diagdiag.h"\r
92 #include "osal.h"\r
93 \r
94 /*===========================================================================\r
95 \r
96 PACKET   DIAG_BAD_CMD_F\r
97          DIAG_BAD_PARM_F\r
98          DIAG_BAD_LEN_F\r
99          DIAG_BAD_VOC_F\r
100          DIAG_BAD_MODE_F\r
101          DIAG_BAD_SPC_MODE_F\r
102 \r
103 PURPOSE  Sent by DMSS when it detects an erroneous packet from DM. Errors\r
104          include command code out of bounds, bad length...  Includes the\r
105          first DIAG_MAX_ERR bytes of the offending input packet.\r
106          Also includes when an nv_read/write is attempted before the correct\r
107          SPC has been entered.\r
108 \r
109 ============================================================================*/\r
110 \r
111 /* Prototype */\r
112 void diagdiag_init (void);\r
113 void diagdiag_tbl_init (void);\r
114 \r
115 /* -------------------------------------------------------------------------\r
116 ** Packet Definitions\r
117 ** ------------------------------------------------------------------------- */                           \r
118 #if defined(T_WINNT) || defined(FEATURE_WINCE)\r
119 #error code not present\r
120 #endif\r
121 \r
122 /*==========================================================================\r
123 \r
124 PACKET   DIAG_RPC_F\r
125 \r
126 PURPOSE  RPC Processing Request\r
127 \r
128 ============================================================================*/\r
129 DIAGPKT_REQ_DEFINE( DIAG_RPC_F )\r
130 \r
131   /* It's just the command code */\r
132   \r
133 DIAGPKT_REQ_END\r
134 \r
135 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_RPC_F )\r
136 \r
137 /*===========================================================================\r
138 \r
139 PACKET   DIAG_DIAG_VER_F\r
140 PURPOSE  Sent by DM to request the version of the diag\r
141 \r
142 ===========================================================================*/\r
143 DIAGPKT_REQ_DEFINE(DIAG_DIAG_VER_F)\r
144 DIAGPKT_REQ_END\r
145 \r
146 DIAGPKT_RSP_DEFINE(DIAG_DIAG_VER_F)\r
147   word ver;                    /* diag version */\r
148 DIAGPKT_RSP_END\r
149                \r
150 /*===========================================================================\r
151 \r
152 PACKET   DIAG_PASSWORD_F\r
153 PURPOSE  Sent by external device to enter the Security Password,\r
154          to then allow operations protected by security.  This response \r
155          indicates whether the correct Password was given or not.\r
156 \r
157 NOTE     If the incorrect password is entered, DIAG will POWER DOWN\r
158          the phone.\r
159 \r
160 ===========================================================================*/\r
161 #define DIAG_PASSWORD_SIZE 8\r
162 DIAGPKT_REQ_DEFINE(DIAG_PASSWORD_F)\r
163   byte password[DIAG_PASSWORD_SIZE];  /* The security password */\r
164 DIAGPKT_REQ_END\r
165 \r
166 DIAGPKT_RSP_DEFINE(DIAG_PASSWORD_F)\r
167   boolean password_ok;        /* TRUE if Security Password entered correctly */\r
168 DIAGPKT_RSP_END\r
169 \r
170 /* Logging Services */\r
171 \r
172 /*===========================================================================\r
173 \r
174 PACKET   DIAG_LOG_CONFIG_F\r
175 PURPOSE  Sent by the DM to set the equipment ID logging mask in the DMSS.  \r
176          This is necessary to use logging services with MS Equip ID != 1.\r
177 \r
178 !!!Note that the log mask is now sanely ordered LSB to MSB using little endian \r
179 32-bit integer arrays.  This is not the same way the mask was done in \r
180 DIAG_EXT_LOGMASK_F.\r
181 \r
182 TERMINOLOGY:\r
183   'equipment ID' - the 4-bit equipment identifier\r
184   'item ID' - the 12-bit ID that specifies the log item within this equip ID\r
185   'code' - the entire 16-bit log code (contains both equip and item ID)\r
186 \r
187 ===========================================================================*/\r
188 typedef enum {\r
189   LOG_CONFIG_DISABLE_OP = 0,\r
190   LOG_CONFIG_RETRIEVE_ID_RANGES_OP = 1, \r
191   LOG_CONFIG_RETRIEVE_VALID_MASK_OP = 2,\r
192   LOG_CONFIG_SET_MASK_OP = 3,\r
193   LOG_CONFIG_GET_LOGMASK_OP = 4\r
194 } log_config_command_ops_enum_type;\r
195 \r
196 /* Logging config return status types. \r
197  * (*) denotes applicable to all commands \r
198  */\r
199 typedef enum {\r
200   LOG_CONFIG_SUCCESS_S = 0,          /* Operation Sucessful */\r
201   LOG_CONFIG_INVALID_EQUIP_ID_S = 1, /* (*) Specified invalid equipment ID */\r
202   LOG_CONFIG_NO_VALID_MASK_S = 2     /* Valid mask not available for this ID */\r
203 } log_config_status_enum_type;\r
204 \r
205 /* Operation data */\r
206 /* DISABLE OP: LOG_CONFIG_DISAPLE_OP -no no supporting data */\r
207 \r
208 /* These member structures are not packed intentionally.  Each data member will \r
209  * align on a 32-bit boundary.\r
210  */\r
211 typedef PACK(struct) {\r
212   uint32 equip_id;\r
213 \r
214   uint32 last_item;\r
215 \r
216 } log_config_range_type;\r
217 \r
218 typedef PACK(struct) {\r
219   log_config_range_type code_range; /* range of log codes */\r
220   \r
221   byte mask[1]; /* Array of 8 bit masks of size (num_bits + 7) / 8 */\r
222 } log_config_mask_type;\r
223 \r
224 /* ID_RANGE_OP  response type */\r
225 typedef PACK(struct) {\r
226   uint32 last_item[16]; /* The last item for each of the 16 equip IDs */ \r
227 } log_config_ranges_rsp_type;\r
228 \r
229 /* VALID_MASK_OP request type */\r
230 typedef PACK(struct) {\r
231   uint32 equip_id;\r
232 } log_config_valid_mask_req_type;\r
233 \r
234 /* VALID_MASK_OP response type */\r
235 typedef log_config_mask_type log_config_valid_mask_rsp_type;\r
236 \r
237 /* SET_MASK_OP request type */\r
238 typedef log_config_mask_type log_config_set_mask_req_type;\r
239 \r
240 /* GET_MASK_OP response type */\r
241 typedef log_config_mask_type log_config_get_mask_rsp_type;\r
242 \r
243 /* SET_MASK_OP response type */\r
244 typedef log_config_mask_type log_config_set_mask_rsp_type;\r
245 \r
246 /* This is not packed.  We use uint32 which is always aligned */\r
247 typedef PACK(union) {\r
248   /* LOG_CONFIG_DISABLE_OP */\r
249   /* no additional data */\r
250 \r
251   /* LOG_CONFIG_RETRIEVE_ID_RANGES_OP */\r
252   /* no additional data */\r
253   \r
254   /* LOG_CONFIG_RETRIEVE_VALID_MASK_OP */\r
255   log_config_valid_mask_req_type valid_mask;\r
256 \r
257   /* LOG_CONFIG_SET_MASK_OP */\r
258   log_config_set_mask_req_type set_mask;\r
259 \r
260   /* LOG_CONFIG_GET_MASK_OP */\r
261   /* no additional data */\r
262 \r
263 } log_config_op_req_type;\r
264 \r
265 typedef PACK(union) {\r
266   /* LOG_CONFIG_DISABLE_OP */\r
267   /* no additional data */\r
268 \r
269   /* LOG_CONFIG_RETRIEVE_ID_RANGES_OP */\r
270   log_config_ranges_rsp_type ranges;\r
271   \r
272   /* LOG_CONFIG_RETRIEVE_VALID_MASK_OP */\r
273   log_config_valid_mask_rsp_type valid_mask;\r
274 \r
275   /* LOG_CONFIG_SET_MASK_OP */\r
276   log_config_set_mask_rsp_type set_mask;\r
277 \r
278   /* LOG_CONFIG_GET_MASK_OP */\r
279   log_config_get_mask_rsp_type get_mask;\r
280 \r
281 } log_config_op_rsp_type;\r
282 \r
283 \r
284 DIAGPKT_REQ_DEFINE(DIAG_LOG_CONFIG_F)\r
285 \r
286   byte pad[3]; /* Force following items to be on 32-bit boundary */\r
287 \r
288   uint32 operation;  /* See log_config_command_ops_enum_type */\r
289 \r
290   uint32 op_data[1]; /* Pointer to operation data */\r
291 \r
292 DIAGPKT_REQ_END\r
293 \r
294 DIAGPKT_RSP_DEFINE(DIAG_LOG_CONFIG_F)\r
295 \r
296   byte pad[3]; /* Force following items to be on 32-bit boundary */\r
297 \r
298   uint32 operation;  /* See log_config_command_ops_enum_type */\r
299 \r
300   uint32 status;\r
301 \r
302   uint32 op_data[1]; /* Pointer to operation data */\r
303 \r
304 DIAGPKT_RSP_END\r
305 \r
306 \r
307 /* Number of bits in a log mask.\r
308 */\r
309 #define DIAG_EXT_LOGMASK_NUM_BITS (LOG_1X_LAST_C & 0x0FFF)\r
310 \r
311 /* Max # of bytes in a valid log mask.\r
312 */\r
313 #define DIAG_EXT_LOGMASK_NUM_BYTES ((DIAG_EXT_LOGMASK_NUM_BITS / 8) + 1)\r
314 \r
315 /*===========================================================================\r
316 \r
317 PACKET   DIAG_EXT_LOGMASK_F\r
318 PURPOSE  Sent by the DM to set the logging mask in the DMSS.  This is\r
319          necessary for logmasks > 32 bits.\r
320 \r
321 ===========================================================================*/\r
322 DIAGPKT_REQ_DEFINE(DIAG_EXT_LOGMASK_F)\r
323   word  num_bits;                 /* Number of valid bits */\r
324   byte  mask[DIAG_EXT_LOGMASK_NUM_BYTES]; /* mask to use          */\r
325 DIAGPKT_REQ_END\r
326 \r
327 DIAGPKT_RSP_DEFINE(DIAG_EXT_LOGMASK_F)\r
328   word  num_valid_bits;                     /* Number of valid bits    */\r
329   byte  valid_mask[DIAG_EXT_LOGMASK_NUM_BYTES]; /* mask of valid log codes */\r
330 DIAGPKT_RSP_END\r
331 \r
332 /*===========================================================================\r
333 \r
334 PACKET   DIAG_LOG_F\r
335 PURPOSE  Encapsulates a log record.\r
336 \r
337 ===========================================================================*/\r
338 \r
339 typedef struct\r
340 {\r
341   uint8 cmd_code;\r
342   uint8 more;   /* Indicates how many log entries, not including the one \r
343                    returned with this packet, are queued up in the Mobile\r
344                    Station.  If DIAG_DIAGVER >= 8, this should be set to 0 */\r
345   uint16 len;   /* Indicates the length, in bytes, of the following log entry */\r
346   uint8 log[1]; /* Contains the log entry data. */\r
347 }\r
348 diag_log_rsp_type;\r
349 \r
350 \r
351 /* -------------------------------------------------------------------------\r
352 ** Legacy (but still supported) packet definitions for logging services.\r
353 ** ------------------------------------------------------------------------- */\r
354 /*===========================================================================\r
355 \r
356 PACKET   DIAG_LOGMASK_F\r
357 PURPOSE  Sent by the DM to set the 32-bit logging mask in the DMSS.\r
358          Note: this is the legacy logging mask format.\r
359 \r
360 ===========================================================================*/\r
361 DIAGPKT_REQ_DEFINE(DIAG_LOGMASK_F)\r
362   uint32 mask; /* 32-bit log mask  */\r
363 DIAGPKT_REQ_END\r
364 \r
365 DIAGPKT_RSP_DEFINE(DIAG_LOGMASK_F)\r
366 DIAGPKT_RSP_END\r
367 \r
368 #ifndef FEATURE_WINCE\r
369 /*===========================================================================\r
370 \r
371 PACKET   DIAG_FEATURE_QUERY_F\r
372 PURPOSE  Sent by external device to query the phone for a bit mask detailing\r
373          which phone features are turned on.\r
374 \r
375 ===========================================================================*/\r
376 DIAGPKT_REQ_DEFINE(DIAG_FEATURE_QUERY_F)\r
377 DIAGPKT_REQ_END\r
378 \r
379 DIAGPKT_RSP_DEFINE(DIAG_FEATURE_QUERY_F)\r
380   word feature_mask_size;                 /* Size of the following Mask */\r
381   byte feature_mask[FEATURE_MASK_LENGTH]; /* Space for the largest possible \r
382                                              feature mask */\r
383 DIAGPKT_RSP_END\r
384 #endif\r
385 \r
386 /*===========================================================================\r
387 \r
388 PACKET   DIAG_EVENT_REPORT_F\r
389 PURPOSE  Sent by the DM to configure static event reporting in the DMSS.\r
390 \r
391 ===========================================================================*/\r
392 /*--------------------------------------\r
393   Special bit flags in the event ID.\r
394 --------------------------------------*/\r
395 #define EVENT_PAY_LENGTH   0x3\r
396 #define EVENT_PAY_TWO_BYTE 0x2\r
397 #define EVENT_PAY_ONE_BYTE 0x1\r
398 #define EVENT_PAY_NONE     0x0\r
399 \r
400 /* Bitfields may not be ANSI, but all our compilers\r
401 ** recognize it and *should* optimize it.\r
402 ** Not that bit-packed structures are only as long as they need to be.\r
403 ** Even though we call it uint32, it is a 16 bit structure.\r
404 */\r
405 typedef struct\r
406 {\r
407   uint16 id              : 12;\r
408   uint16 reserved        : 1;\r
409   uint16 payload_len     : 2; /* payload length (0, 1, 2, see payload) */\r
410   uint16 time_trunc_flag : 1;\r
411 } event_id_type;\r
412 \r
413 typedef PACK(struct)\r
414 {\r
415   uint16 id; /* event_id_type id; */\r
416   qword ts;\r
417 \r
418 } event_type;\r
419 \r
420 /* Used in lieu of event_type if 'time_trunc_flag' is set in event_id_type */\r
421 typedef PACK(struct)\r
422 {\r
423   uint16 id; /* event_id_type id; */\r
424   uint16 trunc_ts;\r
425 } event_trunc_type;\r
426 \r
427 /* The event payload follows the event_type structure */\r
428 typedef struct\r
429 {\r
430   uint8 length;\r
431   uint8 payload[1]; /* 'length' bytes */\r
432 } event_payload_type;\r
433 \r
434 typedef PACK(struct)\r
435 {\r
436   uint16 id; /* event_id_type id; */\r
437   qword ts;\r
438   uint32 drop_cnt;\r
439 } event_drop_type;\r
440 \r
441 typedef struct\r
442 {\r
443   event_id_type id;\r
444   uint16 ts;\r
445   uint32 drop_cnt;\r
446 } event_drop_trunc_type;\r
447 \r
448 typedef struct\r
449 {\r
450   uint8 cmd_code;\r
451   uint8 enable;\r
452 //  uint16  watermark;   /* Maximum size (in bytes) of a event report         */ \r
453 //  uint16  stale_timer; /* Time (in ms) to allow event buffer to accumulate  */\r
454 \r
455 } event_cfg_req_type;\r
456 \r
457 typedef PACK(struct)\r
458 {\r
459   uint8  cmd_code;\r
460   uint16 length;\r
461 \r
462 } event_cfg_rsp_type;\r
463 \r
464 typedef PACK(struct)\r
465 {\r
466   uint8  cmd_code;\r
467   uint16 length;    /* Number of bytes to follow */\r
468   uint8  events[1]; /* Series of 'event_type' structures, 'length' bytes long */\r
469 } event_rpt_type;\r
470 \r
471 /*===========================================================================\r
472 \r
473 PACKET   DIAG_STREAMING_CONFIG_F\r
474 PURPOSE  Sent by the DM to configure and tweak streaming diag output services.\r
475 \r
476 ===========================================================================*/\r
477 typedef enum {\r
478   DIAG_READ_NICE_C  = 0, /* Read "Nice" values for LOG and MSG services */\r
479   DIAG_WRITE_NICE_C = 1, /* Write "Nice" values for LOG and MSG services */\r
480   DIAG_READ_PRI_C   = 2, /* Read "priority" values for LOG and MSG services */\r
481   DIAG_WRITE_PRI_C  = 3, /* Write "priority" values for LOG and MSG services */\r
482   DIAG_BUF_SIZE_C   = 4  /* Return size (in bytes) of output buffer */\r
483 \r
484 } diag_streaming_config_subcommand_enum_type;\r
485 \r
486 typedef PACK(struct) {\r
487     uint16 code; /* MSG_LVL value or Log code */\r
488 \r
489     int16  val;\r
490   \r
491 } diagpkt_streaming_config_entry_type;\r
492 \r
493 typedef PACK(struct) {\r
494 \r
495   /* Number of entries in the following array */\r
496   uint8 num_entries;\r
497 \r
498   /* # of log codes + 5 Message Levels is the number max $ in this array */\r
499   diagpkt_streaming_config_entry_type entry[1];\r
500 \r
501 } diagpkt_streaming_config_entry_list_type;\r
502 \r
503 \r
504 /*==========================================================================\r
505 \r
506 PACKET   DIAG_TS_F\r
507 \r
508 PURPOSE  Sent from the DM to the DMSS to request the IS-95/IS-2000 time.\r
509 \r
510 ============================================================================*/\r
511 DIAGPKT_REQ_DEFINE(DIAG_TS_F)\r
512 \r
513   /* It's just the command code */\r
514   \r
515 DIAGPKT_REQ_END\r
516 \r
517 DIAGPKT_RSP_DEFINE(DIAG_TS_F)\r
518   \r
519   qword ts;        /* Time Stamp */\r
520 \r
521 DIAGPKT_RSP_END\r
522 \r
523 #ifdef FEATURE_TECHNICS_DIAG\r
524 /*===========================================================================\r
525 \r
526 PACKET   diag_encrypt_test_req_type\r
527 \r
528 ID       DIAG_ENCRYPT_TEST_F\r
529 \r
530 PURPOSE  Sent by DM to cause a keypress input to the handset interface.\r
531 \r
532 RESPONSE Diag queues a keypress to hsi and echos the request packet.\r
533 \r
534 ===========================================================================*/\r
535 DIAGPKT_REQ_DEFINE( DIAG_ENCRYPT_TEST_F )\r
536 \r
537  byte mask;\r
538  byte data[16];\r
539 \r
540 DIAGPKT_REQ_END\r
541 \r
542 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_ENCRYPT_TEST_F )\r
543 \r
544 /*===========================================================================\r
545 \r
546 PACKET   diag_manufacture_test_req_type\r
547 \r
548 ID       DIAG_MANUFACTURE_TEST_F\r
549 \r
550 PURPOSE  Sent by DM to cause a keypress input to the handset interface.\r
551 \r
552 RESPONSE Diag queues a keypress to hsi and echos the request packet.\r
553 \r
554 ===========================================================================*/\r
555 DIAGPKT_REQ_DEFINE( DIAG_MANUFACTURE_TEST_F )\r
556 \r
557  byte mask;\r
558  byte data[100];\r
559 \r
560 DIAGPKT_REQ_END\r
561 \r
562 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_MANUFACTURE_TEST_F )\r
563 \r
564 /*===========================================================================\r
565 \r
566 PACKET   diag_manufacture_test_req_type\r
567 \r
568 ID       DIAG_FACTORY_TEST_F\r
569 \r
570 PURPOSE  Sent by DM to cause a keypress input to the handset interface.\r
571 \r
572 RESPONSE Diag queues a keypress to hsi and echos the request packet.\r
573 \r
574 ===========================================================================*/\r
575 DIAGPKT_REQ_DEFINE( DIAG_FACTORY_TEST_F )\r
576 \r
577  byte mask;\r
578  byte data[80];\r
579 \r
580 DIAGPKT_REQ_END\r
581 \r
582 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_FACTORY_TEST_F )\r
583 #endif\r
584 \r
585 /*==========================================================================\r
586 \r
587 PACKET   DIAG_OUTP_F\r
588 \r
589 PURPOSE  Request sent from the DM to the DMSS to send a byte to an\r
590          IO port\r
591 \r
592 ============================================================================*/\r
593 DIAGPKT_REQ_DEFINE( DIAG_OUTP_F )\r
594 \r
595   word port;                   /* number of port to output to */\r
596   byte data;                   /* data to write to port */\r
597 \r
598 DIAGPKT_REQ_END\r
599 \r
600 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_OUTP_F )\r
601   \r
602 \r
603 /*==========================================================================\r
604 \r
605 PACKET   DIAG_OUTPW_F\r
606 \r
607 PURPOSE  Request sent from the DM to the DMSS to send a 16-bit word to an\r
608          IO port\r
609 \r
610 ============================================================================*/\r
611 DIAGPKT_REQ_DEFINE( DIAG_OUTPW_F )\r
612 \r
613   word port;                   /* number of port to output to */\r
614   word data;                   /* data to write to port */\r
615 \r
616 DIAGPKT_REQ_END\r
617 \r
618 DIAGPKT_DEFINE_RSP_AS_REQ( DIAG_OUTPW_F )\r
619 \r
620   \r
621 \r
622 /*==========================================================================\r
623 \r
624 PACKET   DIAG_INP_F\r
625 \r
626 PURPOSE  Request sent from the DM to the DMSS to read a byte to an\r
627          IO port\r
628 \r
629 ============================================================================*/\r
630 DIAGPKT_REQ_DEFINE( DIAG_INP_F )\r
631 \r
632   word port;                   /* number of port to output to */\r
633 \r
634 DIAGPKT_REQ_END\r
635 \r
636 DIAGPKT_RSP_DEFINE( DIAG_INP_F )\r
637 \r
638   word port;                   /* number of port to output to */\r
639   byte data;                   /* data to write to port */\r
640 \r
641 DIAGPKT_REQ_END\r
642 \r
643 \r
644 /*==========================================================================\r
645 \r
646 PACKET   DIAG_INPW_F\r
647 \r
648 PURPOSE  Request sent from the DM to the DMSS to read a 16-bit word from an\r
649          IO port\r
650 \r
651 ============================================================================*/\r
652 DIAGPKT_REQ_DEFINE( DIAG_INPW_F )\r
653 \r
654   word port;                   /* number of port to output to */\r
655 \r
656 DIAGPKT_REQ_END\r
657 \r
658 DIAGPKT_RSP_DEFINE( DIAG_INPW_F )\r
659 \r
660   word port;                   /* number of port to output to */\r
661   word data;                   /* data to write to port */\r
662 \r
663 DIAGPKT_REQ_END\r
664 \r
665 \r
666 \r
667 /*==========================================================================\r
668 \r
669 PACKET   DIAG_LOG_ON_DEMAND_F\r
670 \r
671 PURPOSE  Request sent from the user to register a function pointer and \r
672          log_code with the diagnostic service for every log that needs \r
673          logging on demand support.\r
674          \r
675 ============================================================================*/\r
676 DIAGPKT_REQ_DEFINE( DIAG_LOG_ON_DEMAND_F )\r
677 \r
678    uint16 log_code;             /* The log_code to be sent */\r
679    \r
680 DIAGPKT_REQ_END\r
681 \r
682 \r
683 DIAGPKT_RSP_DEFINE( DIAG_LOG_ON_DEMAND_F )\r
684 \r
685   uint16 log_code;             /* The log_code sent */\r
686   uint8  status;               /* status returned from the function pointer */\r
687 \r
688 DIAGPKT_RSP_END\r
689 \r
690 /* Diagnostic extensions */\r
691 /*\r
692 ** The maximum number of properties and callback functions. These are not\r
693 ** used to determine the size of any data structure; they are used merely\r
694 ** to guard against infinite loops caused by corruption of the callback\r
695 ** and properties tables.\r
696 */\r
697 #define DIAG_MAX_NUM_PROPS 20\r
698 #define DIAG_MAX_NUM_FUNCS 20\r
699 \r
700 typedef void (*diag_cb_func_type) (\r
701                                    unsigned char  *data_ptr,\r
702                                    unsigned short  data_len,\r
703                                    unsigned char  *rsp_ptr,\r
704                                    unsigned short *rsp_len_ptr\r
705 );\r
706 \r
707 typedef struct\r
708 {\r
709    char             *name;\r
710    diag_cb_func_type address;\r
711 } diag_cb_struct_type;\r
712 \r
713 typedef struct\r
714 {\r
715    char *name;\r
716    void *address;\r
717 } diag_prop_struct_type;\r
718 \r
719 typedef enum\r
720 {\r
721   DIAG_EXTN_INVALID_GUID = 1,\r
722   DIAG_EXTN_INVALID_SIZE,\r
723   DIAG_EXTN_INVALID_ADDRESS,\r
724   DIAG_EXTN_INVALID_NAME,\r
725   DIAG_EXTN_INVALID_DATA\r
726 } diag_extn_err_type;\r
727 \r
728 /* Need to use PACKED not PACK() */\r
729 PACKED typedef unsigned long diag_guid_type[ 4 ];\r
730 \r
731 /*===========================================================================\r
732 \r
733 PACKET   DIAG_GET_GUID_F\r
734 \r
735 PURPOSE  Sent by the DM to retrieve the GUID (globally unique identifier)\r
736          for the current build. This is stored during the build process.\r
737 \r
738 ===========================================================================*/\r
739 DIAGPKT_REQ_DEFINE(DIAG_GET_GUID_F)\r
740 DIAGPKT_REQ_END\r
741 \r
742 DIAGPKT_RSP_DEFINE(DIAG_GET_GUID_F)\r
743   diag_guid_type guid;               /* Globally unique identifier  */\r
744 DIAGPKT_RSP_END\r
745 \r
746 #define DIAG_MAX_PROPERTY_NAME_SIZE 40\r
747 \r
748 // Required DIAG Health Definitions\r
749 #define MAX_VALUE_UINT32                4294967295UL   // Overflow\r
750 #define DIAGBUF_ALLOC_REQUEST_OTHER     0x0\r
751 #define DIAGBUF_ALLOC_REQUEST_LOG       0x1\r
752 #define DIAGBUF_ALLOC_REQUEST_MSG       0x2\r
753 #define DIAGBUF_ALLOC_REQUEST_DELAY     0x3\r
754 \r
755 \r
756 /*--------------------------------------------------------------------------\r
757   Command Codes between the Diagnostic Monitor and the mobile. These command \r
758   codes are used for stress testing.\r
759 ----------------------------------------------------------------------------*/\r
760 \r
761 #define DIAGDIAG_START_STRESS_TEST_MODEM_F     0x0000 \r
762 #define DIAGDIAG_CMD_REQUEST_F                 0x0001 \r
763 #define DIAGDIAG_ADD_EVENT_LISTENER_F          0x0002         \r
764 #define DIAGDIAG_REMOVE_EVENT_LISTENER_F       0x0003                \r
765 #define DIAGDIAG_ADD_LOG_LISTENER_F            0x0004           \r
766 #define DIAGDIAG_REMOVE_LOG_LISTENER_F         0x0005        \r
767 #define DIAGDIAG_START_STRESS_TEST_APPS_F      0x0006\r
768 #define DIAGDIAG_START_STRESS_TEST_QDSP_F      0x0007\r
769 // Processor Loopback Command Codes\r
770 #define DIAGDIAG_STRESS_TEST_SUBSYS_LOOPBACK_APP        0x0028 /* 40 */\r
771 #define DIAGDIAG_STRESS_TEST_SUBSYS_LOOPBACK_MODEM      0x0029 /* 41 */\r
772 #define DIAGDIAG_STRESS_TEST_SUBSYS_LOOPBACK_Q6         0x002A /* 42 */\r
773 // DIAG Health on APPs\r
774 #define DIAGDIAG_RESET_DROP_COUNT_LOG_APP      0x002B /* 43 */      \r
775 #define DIAGDIAG_GET_DROP_COUNT_LOG_APP        0x002C /* 44 */ \r
776 #define DIAGDIAG_RESET_DROP_COUNT_EVENT_APP    0x002D /* 45 */\r
777 #define DIAGDIAG_GET_DROP_COUNT_EVENT_APP      0x002E /* 46 */\r
778 #define DIAGDIAG_RESET_DROP_COUNT_F3_APP       0x002F /* 47 */\r
779 #define DIAGDIAG_GET_DROP_COUNT_F3_APP         0x0030 /* 48 */\r
780 #define DIAGDIAG_GET_ALLOC_COUNT_LOG_APP       0x0031 /* 49 */\r
781 #define DIAGDIAG_GET_ALLOC_COUNT_EVENT_APP     0x0032 /* 50 */\r
782 #define DIAGDIAG_GET_ALLOC_COUNT_F3_APP        0x0033 /* 51 */\r
783 #define DIAGDIAG_RESET_DROP_COUNT_DELAY_APP    0x0046 /* 70 */\r
784 #define DIAGDIAG_GET_DROP_COUNT_DELAY_APP      0x0047 /* 71 */\r
785 #define DIAGDIAG_GET_ALLOC_COUNT_DELAY_APP     0x0048 /* 72 */\r
786 // DIAG Health on MODEM                                                \r
787 #define DIAGDIAG_RESET_DROP_COUNT_LOG_MODEM    0x0034 /* 52 */\r
788 #define DIAGDIAG_GET_DROP_COUNT_LOG_MODEM      0x0035 /* 53 */\r
789 #define DIAGDIAG_RESET_DROP_COUNT_EVENT_MODEM  0x0036 /* 54 */\r
790 #define DIAGDIAG_GET_DROP_COUNT_EVENT_MODEM    0x0037 /* 55 */\r
791 #define DIAGDIAG_RESET_DROP_COUNT_F3_MODEM     0x0038 /* 56 */\r
792 #define DIAGDIAG_GET_DROP_COUNT_F3_MODEM       0x0039 /* 57 */\r
793 #define DIAGDIAG_GET_ALLOC_COUNT_LOG_MODEM     0x003A /* 58 */\r
794 #define DIAGDIAG_GET_ALLOC_COUNT_EVENT_MODEM   0x003B /* 59 */\r
795 #define DIAGDIAG_GET_ALLOC_COUNT_F3_MODEM      0x003C /* 60 */\r
796 #define DIAGDIAG_RESET_DROP_COUNT_DELAY_MODEM  0x0050 /* 80 */\r
797 #define DIAGDIAG_GET_DROP_COUNT_DELAY_MODEM    0x0051 /* 81 */\r
798 #define DIAGDIAG_GET_ALLOC_COUNT_DELAY_MODEM   0x0052 /* 82 */\r
799 // DIAG Health on QDSP6                                                \r
800 #define DIAGDIAG_RESET_DROP_COUNT_LOG_Q6       0x003D /* 61 */\r
801 #define DIAGDIAG_GET_DROP_COUNT_LOG_Q6         0x003E /* 62 */\r
802 #define DIAGDIAG_RESET_DROP_COUNT_EVENT_Q6     0x003F /* 63 */\r
803 #define DIAGDIAG_GET_DROP_COUNT_EVENT_Q6       0x0040 /* 64 */\r
804 #define DIAGDIAG_RESET_DROP_COUNT_F3_Q6        0x0041 /* 65 */\r
805 #define DIAGDIAG_GET_DROP_COUNT_F3_Q6          0x0042 /* 66 */\r
806 #define DIAGDIAG_GET_ALLOC_COUNT_LOG_Q6        0x0043 /* 67 */\r
807 #define DIAGDIAG_GET_ALLOC_COUNT_EVENT_Q6      0x0044 /* 68 */\r
808 #define DIAGDIAG_GET_ALLOC_COUNT_F3_Q6         0x0045 /* 69 */\r
809 #define DIAGDIAG_RESET_DROP_COUNT_DELAY_Q6     0x005A /* 90 */\r
810 #define DIAGDIAG_GET_DROP_COUNT_DELAY_Q6       0x005B /* 91 */\r
811 #define DIAGDIAG_GET_ALLOC_COUNT_DELAY_Q6      0x005C /* 92 */\r
812 \r
813 #define DIAG_FLUSH_BUFFER                      0x005D /* 93 */\r
814 #define DIAG_CHANGE_THRESHOLD                  0x005E /* 94 */\r
815 /* NOTE: Subsystem command codes 100-102 are used for the user-level app */\r
816 \r
817 /*==========================================================================\r
818 \r
819 PACKET   DIAGDIAG_STRESS_TEST\r
820 \r
821 PURPOSE  Request sent from the DM to the DMSS to stress test events.\r
822 \r
823 ============================================================================*/\r
824 typedef enum {\r
825   DIAGDIAG_STRESS_TEST_MSG = 0,\r
826   DIAGDIAG_STRESS_TEST_MSG_1 = 1,\r
827   DIAGDIAG_STRESS_TEST_MSG_2 = 2,\r
828   DIAGDIAG_STRESS_TEST_MSG_3 = 3,\r
829   DIAGDIAG_STRESS_TEST_MSG_4 = 4,\r
830   DIAGDIAG_STRESS_TEST_MSG_5 = 5,\r
831   DIAGDIAG_STRESS_TEST_MSG_6 = 6,\r
832   DIAGDIAG_STRESS_TEST_MSG_STR = 7,\r
833   DIAGDIAG_STRESS_TEST_MSG_PSEUDO_RANDOM = 8,\r
834   DIAGDIAG_STRESS_TEST_MSG_LOW = 9,\r
835   DIAGDIAG_STRESS_TEST_MSG_MED = 10,\r
836   DIAGDIAG_STRESS_TEST_MSG_HIGH = 11,\r
837   DIAGDIAG_STRESS_TEST_MSG_ERROR = 12,\r
838   DIAGDIAG_STRESS_TEST_MSG_FATAL = 13,\r
839   DIAGDIAG_STRESS_TEST_ERR = 14,\r
840   DIAGDIAG_STRESS_TEST_ERR_FATAL = 15,\r
841   DIAGDIAG_STRESS_TEST_LOG = 16,\r
842   DIAGDIAG_STRESS_TEST_EVENT_NO_PAYLOAD = 17,\r
843   DIAGDIAG_STRESS_TEST_EVENT_WITH_PAYLOAD = 18,\r
844   DIAGDIAG_STRESS_TEST_ERR_FATAL_ISR = 19, /* test panic mode from ISR */\r
845   DIAGDIAG_STRESS_TEST_CMD_REQ = 20,\r
846   /* Reserved space up to 39 */\r
847   DIAGDIAG_STRESS_TEST_LOG_64 = 40, \r
848   DIAGDIAG_STRESS_TEST_LOG_128 = 41,\r
849   DIAGDIAG_STRESS_TEST_LOG_256 = 42,\r
850   /* Log of 512 is test type 16 */\r
851   DIAGDIAG_STRESS_TEST_LOG_1K = 43,\r
852   DIAGDIAG_STRESS_TEST_LOG_2K = 44,\r
853   DIAGDIAG_STRESS_TEST_LOG_4K = 45,\r
854   DIAGDIAG_STRESS_TEST_LOG_6K = 46,\r
855   /* Test cases for QSR messages */\r
856   DIAGDIAG_STRESS_TEST_QSR_MSG = 47,\r
857   DIAGDIAG_STRESS_TEST_QSR_MSG_1 = 48,\r
858   DIAGDIAG_STRESS_TEST_QSR_MSG_2 = 49,\r
859   DIAGDIAG_STRESS_TEST_QSR_MSG_3 = 50,\r
860   DIAGDIAG_STRESS_TEST_QSR_MSG_4 = 51,\r
861   DIAGDIAG_STRESS_TEST_QSR_MSG_5 = 52,\r
862   DIAGDIAG_STRESS_TEST_QSR_MSG_6 = 53,\r
863   DIAGDIAG_STRESS_TEST_QSR_MSG_LOW = 54,\r
864   DIAGDIAG_STRESS_TEST_QSR_MSG_MED = 55,\r
865   DIAGDIAG_STRESS_TEST_QSR_MSG_HIGH = 56,\r
866   DIAGDIAG_STRESS_TEST_QSR_MSG_ERROR = 57,\r
867   DIAGDIAG_STRESS_TEST_QSR_MSG_FATAL = 58,\r
868   \r
869 } diag_stress_test_type_enum_type;\r
870 \r
871 typedef enum {\r
872   EXPLICIT_PRI = 0, /* Priority given by the user */\r
873   RELATIVE_PRI = 1  /* relative priority is relative to DIAG_PRI */\r
874 } diag_stress_pri_type_enum_type;\r
875 \r
876 typedef struct {\r
877   uint8 test_type;  /* Decides if it is log, msg or event*/\r
878   uint8 pri_type;   /* External or relative priority */\r
879   int16 pri;        /* Priority at which the task is created */\r
880 } diag_task_priority_type;\r
881 \r
882 typedef struct {\r
883   diag_task_priority_type priority; /* refer to diag_task_priority_type above*/\r
884   int num_iterations; /* the number of times the test_type should be called     */\r
885   int sleep_duration; /* Sleep time in milliseconds */  \r
886   int num_iterations_before_sleep; /*After NUM_ITERATIONS_BEFORE_SLEEP  iterations, sleep */\r
887 } diag_per_task_test_info;\r
888 \r
889 typedef struct {\r
890   diagpkt_subsys_header_type header; /* Sub System header */\r
891   int num_tasks;                     /* Number of tasks, to be started */\r
892   diag_per_task_test_info test[1];   /* Place holder for per task info */\r
893 } DIAGDIAG_STRESS_TEST_req_type;\r
894 \r
895 typedef DIAGDIAG_STRESS_TEST_req_type DIAGDIAG_STRESS_TEST_rsp_type;\r
896 \r
897 typedef struct {\r
898   uint16 pri_type;   /* External or relative priority */\r
899   int16  pri;        /* Priority at which the task is created */\r
900 } diag_priority_type;\r
901 \r
902 \r
903 /*==========================================================================\r
904 \r
905 PACKET   DIAGDIAG_CMD_REQUEST\r
906 \r
907 PURPOSE  Request sent from the DM to the DMSS to test command request.\r
908 ============================================================================*/\r
909 \r
910 typedef struct {\r
911   diagpkt_subsys_header_type header; /* Sub System header */\r
912   uint32 length;                     /* length of the packet */\r
913   diag_priority_type priority;\r
914   byte req[64];                      /* Packet sent */\r
915 } diagdiag_cmd_req_type;\r
916 \r
917 typedef diagdiag_cmd_req_type diagdiag_cmd_rsp_type;\r
918 \r
919 \r
920 /*==========================================================================\r
921 \r
922 PACKET   DIAGDIAG_LOG_EVENT_LISTENER\r
923 \r
924 PURPOSE  Request sent from the DM to the DMSS to test log and event listeners.\r
925                  This type is used for adding and removing log and event listeners.\r
926 ============================================================================*/\r
927 \r
928 typedef struct {\r
929   diagpkt_subsys_header_type header; /* Sub System header */\r
930   uint32 length;\r
931   uint32 id;      /* log code or event id */\r
932   uint32 param;   /* Will be printed by debug message */\r
933 } diag_log_event_listener_req_type;\r
934 \r
935 typedef diag_log_event_listener_req_type diag_log_event_listener_rsp_type;\r
936 \r
937 /* Functions required for DIAG Health */\r
938 void diagbuf_reset_drop_count_log( void );\r
939 uint32 diagbuf_get_drop_count_log( void );\r
940 void event_reset_drop_count_event( void );\r
941 uint32 event_get_drop_count_event( void );\r
942 void diagbuf_reset_drop_count_f3( void );\r
943 uint32 diagbuf_get_drop_count_f3( void );\r
944 uint32 diagbuf_get_alloc_count_log( void );\r
945 uint32 event_get_alloc_count_event( void );\r
946 uint32 diagbuf_get_alloc_count_f3( void );\r
947 void diagbuf_reset_drop_count_delay( void );\r
948 uint32 diagbuf_get_drop_count_delay( void );\r
949 uint32 diagbuf_get_alloc_count_delay( void );\r
950 \r
951 \r
952 /* Structures required for DIAG Health */\r
953 typedef struct {\r
954     diagpkt_subsys_header_type header;\r
955     uint32 drop_count;          // Also used for alloc_count\r
956 } diag_health_response_type;\r
957 \r
958 \r
959 /*==========================================================================\r
960 \r
961 PACKET   DIAG_EVENT_MASK_GET_F\r
962 \r
963 PURPOSE  Request sent from the DM to the DMSS to retrieve the event mask.\r
964 ============================================================================*/\r
965 \r
966 typedef struct {\r
967   diagpkt_header_type header;\r
968   uint8 pad;\r
969   uint16 reserved;\r
970 } event_mask_get_req_type;\r
971 \r
972 typedef struct {\r
973   diagpkt_header_type header;\r
974   uint8 error_code;\r
975   uint16 reserved;\r
976   uint16 numbits;         /* number of bits in the mask           */\r
977   unsigned char mask[1];  /* size of this field = (numbits + 7)/8 */\r
978 } event_mask_get_rsp_type;\r
979 \r
980 /*==========================================================================\r
981 \r
982 PACKET   DIAG_EVENT_MASK_SET_F\r
983 \r
984 PURPOSE  Request sent from the DM to the DMSS to set the event mask.\r
985 ============================================================================*/\r
986 \r
987 typedef struct {\r
988   diagpkt_header_type header;\r
989   uint8 pad;\r
990   uint16 reserved;\r
991   uint16 numbits;         /* number of bits in the mask           */\r
992   unsigned char mask[1];  /* size of this field = (numbits + 7)/8 */\r
993 } event_mask_set_req_type;\r
994 \r
995 typedef struct {\r
996   diagpkt_header_type header;\r
997   uint8 error_code;\r
998   uint16 reserved;\r
999   uint16 numbits;         /* number of bits in the mask           */\r
1000   unsigned char mask[1];  /* size of this field = (numbits + 7)/8 */\r
1001 } event_mask_set_rsp_type;\r
1002 \r
1003 typedef struct\r
1004 {\r
1005   diagpkt_subsys_header_type header;\r
1006   uint8 enable_aggregation;\r
1007   uint8 reserved1;\r
1008   uint16 reserved2;\r
1009 } diagdiag_change_threshold_req_type;\r
1010 \r
1011 \r
1012 typedef struct\r
1013 {\r
1014   diagpkt_subsys_header_type header;\r
1015 } diagdiag_change_threshold_rsp_type;\r
1016 \r
1017 /* Error codes for the above two packets.\r
1018  */\r
1019 #define EVENT_MASK_GENERAL_FAILURE 1\r
1020 #define EVENT_MASK_ARRAY_TOO_SMALL 2\r
1021 #define EVENT_MASK_ARRAY_TOO_BIG   3\r
1022 \r
1023 #if defined(T_WINNT) || defined(FEATURE_WINCE)\r
1024 #error code not present\r
1025 #endif\r
1026 \r
1027 extern osal_mutex_arg_t diagdiag_memop_tbl_mutex;\r
1028 \r
1029 #endif /*DIAGDIAG_V_H*/\r
1030 \r