1 /****************************************************************************
2 **
3 ** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include <qglobal.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define UV3_SOCKIF_VERS 229
35 #define SOCK_NDATA 32768
36 
37 // Socket commands.
38 enum UV_OPERATION {
39     // General commands:
40     UV_NULL_CMD = 0x0000,
41     UV_GEN_GET_VERSION = 0x0001,
42     UV_GEN_UI_UNLOCK = 0x0002,
43     UV_GEN_UI_LOCK = 0x0003,
44     UV_GEN_HIDE = 0x0004,
45     UV_GEN_SHOW = 0x0005,
46     UV_GEN_RESTORE = 0x0006,
47     UV_GEN_MINIMIZE = 0x0007,
48     UV_GEN_MAXIMIZE = 0x0008,
49     UV_GEN_EXIT = 0x0009,
50     UV_GEN_GET_EXTVERSION = 0x000A,
51     UV_GEN_CHECK_LICENSE = 0x000B,
52     UV_GEN_CPLX_COMPLETE = 0x000C,
53     UV_GEN_SET_OPTIONS = 0x000D,
54     // Project commands:
55     UV_PRJ_LOAD = 0x1000,
56     UV_PRJ_CLOSE = 0x1001,
57     UV_PRJ_ADD_GROUP = 0x1002,
58     UV_PRJ_DEL_GROUP = 0x1003,
59     UV_PRJ_ADD_FILE = 0x1004,
60     UV_PRJ_DEL_FILE = 0x1005,
61     UV_PRJ_BUILD = 0x1006,
62     UV_PRJ_REBUILD = 0x1007,
63     UV_PRJ_CLEAN = 0x1008,
64     UV_PRJ_BUILD_CANCEL = 0x1009,
65     UV_PRJ_FLASH_DOWNLOAD = 0x100A,
66     UV_PRJ_GET_DEBUG_TARGET = 0x100B,
67     UV_PRJ_SET_DEBUG_TARGET = 0x100C,
68     UV_PRJ_GET_OPTITEM = 0x100D,
69     UV_PRJ_SET_OPTITEM = 0x100E,
70     UV_PRJ_ENUM_GROUPS = 0x100F,
71     UV_PRJ_ENUM_FILES = 0x1010,
72     UV_PRJ_CMD_PROGRESS = 0x1011,
73     UV_PRJ_ACTIVE_FILES = 0x1012,
74     UV_PRJ_FLASH_ERASE = 0x1013,
75     UV_PRJ_GET_OUTPUTNAME = 0x1014,
76     UV_PRJ_ENUM_TARGETS = 0x1015,
77     UV_PRJ_SET_TARGET = 0x1016,
78     UV_PRJ_GET_CUR_TARGET = 0x1017,
79     UV_PRJ_SET_OUTPUTNAME = 0x1018,
80     // Debug commands:
81     UV_DBG_ENTER = 0x2000,
82     UV_DBG_EXIT = 0x2001,
83     UV_DBG_START_EXECUTION = 0x2002,
84     UV_DBG_RUN_TO_ADDRESS = 0x2102,
85     UV_DBG_STOP_EXECUTION = 0x2003,
86     UV_DBG_STATUS = 0x2004,
87     UV_DBG_RESET = 0x2005,
88     UV_DBG_STEP_HLL = 0x2006,
89     UV_DBG_STEP_HLL_N = 0x2106,
90     UV_DBG_STEP_INTO = 0x2007,
91     UV_DBG_STEP_INTO_N = 0x2107,
92     UV_DBG_STEP_INSTRUCTION = 0x2008,
93     UV_DBG_STEP_INSTRUCTION_N = 0x2108,
94     UV_DBG_STEP_OUT = 0x2009,
95     UV_DBG_CALC_EXPRESSION = 0x200A,
96     UV_DBG_MEM_READ = 0x200B,
97     UV_DBG_MEM_WRITE = 0x200C,
98     UV_DBG_TIME_INFO = 0x200D,
99     UV_DBG_SET_CALLBACK = 0x200E,
100     UV_DBG_VTR_GET = 0x200F,
101     UV_DBG_VTR_SET = 0x2010,
102     UV_DBG_SERIAL_GET = 0x2011,
103     UV_DBG_SERIAL_PUT = 0x2012,
104     UV_DBG_VERIFY_CODE = 0x2013,
105     UV_DBG_CREATE_BP = 0x2014,
106     UV_DBG_ENUMERATE_BP = 0x2015,
107     UV_DBG_CHANGE_BP = 0x2016,
108     UV_DBG_ENUM_SYMTP = 0x2017,
109     UV_DBG_ADR_TOFILELINE = 0x2018,
110     UV_DBG_ENUM_STACK = 0x2019,
111     UV_DBG_ENUM_VTR = 0x201A,
112     UV_DBG_UNUSED = 0x201B,
113     UV_DBG_ADR_SHOWCODE = 0x201C,
114     UV_DBG_WAKE = 0x201D,
115     UV_DBG_SLEEP = 0x201E,
116     UV_MSGBOX_MSG = 0x201F,
117     UV_DBG_EXEC_CMD = 0x2020,
118     UV_DBG_POWERSCALE_SHOWCODE = 0x2021,
119     UV_DBG_POWERSCALE_SHOWPOWER = 0x2022,
120     POWERSCALE_OPEN = 0x2023,
121     UV_DBG_EVAL_EXPRESSION_TO_STR = 0x2024,
122     UV_DBG_FILELINE_TO_ADR = 0x2025,
123     // Registers commands:
124     UV_DBG_ENUM_REGISTER_GROUPS = 0x2026,
125     UV_DBG_ENUM_REGISTERS = 0x2027,
126     UV_DBG_READ_REGISTERS = 0x2028,
127     UV_DBG_REGISTER_SET = 0x2029,
128     UV_DBG_DSM_READ = 0x202A,
129     UV_DBG_EVAL_WATCH_EXPRESSION = 0x202B,
130     UV_DBG_REMOVE_WATCH_EXPRESSION = 0x202D,
131     UV_DBG_ENUM_VARIABLES = 0x202E,
132     UV_DBG_VARIABLE_SET = 0x202F,
133     UV_DBG_ENUM_TASKS = 0x2030,
134     UV_DBG_ENUM_MENUS = 0x2031,
135     UV_DBG_MENU_EXEC = 0x2032,
136     UV_DBG_ITM_REGISTER = 0x2033,
137     UV_DBG_ITM_UNREGISTER = 0x2034,
138     UV_DBG_EVTR_REGISTER = 0x2035,
139     UV_DBG_EVTR_UNREGISTER = 0x2036,
140     UV_DBG_EVTR_GETSTATUS = 0x2037,
141     UV_DBG_EVTR_ENUMSCVDFILES = 0x2038,
142     // Responses/errors from uVision to client:
143     UV_CMD_RESPONSE = 0x3000,
144     // Asynchronous messages:
145     UV_ASYNC_MSG = 0x4000,
146     // Project asynchronous messages:
147     UV_PRJ_BUILD_COMPLETE = 0x5000,
148     UV_PRJ_BUILD_OUTPUT = 0x5001,
149     // Debug asynchronous messages:
150     UV_DBG_CALLBACK = 0x5002,
151     // Response to UV_DBG_ENUMERATE_BP:
152     UV_DBG_BP_ENUM_START = 0x5004,
153     UV_DBG_BP_ENUMERATED = 0x5005,
154     UV_DBG_BP_ENUM_END = 0x5006,
155     // Response to UV_PRJ_ENUM_GROUPS:
156     UV_PRJ_ENUM_GROUPS_START= 0x5007,
157     UV_PRJ_ENUM_GROUPS_ENU = 0x5008,
158     UV_PRJ_ENUM_GROUPS_END = 0x5009,
159     // Response to UV_PRJ_ENUM_FILES:
160     UV_PRJ_ENUM_FILES_START = 0x500A,
161     UV_PRJ_ENUM_FILES_ENU = 0x500B,
162     UV_PRJ_ENUM_FILES_END = 0x500C,
163     // Progress bar functions:
164     UV_PRJ_PBAR_INIT = 0x500D,
165     UV_PRJ_PBAR_STOP = 0x500E,
166     UV_PRJ_PBAR_SET = 0x500F,
167     UV_PRJ_PBAR_TEXT = 0x5010,
168     // Response to UV_DBG_ENUM_SYMTP:
169     UV_DBG_ENUM_SYMTP_START = 0x5011,
170     UV_DBG_ENUM_SYMTP_ENU = 0x5012,
171     UV_DBG_ENUM_SYMTP_END = 0x5013,
172     // Response to UV_DBG_ENUM_STACK:
173     UV_DBG_ENUM_STACK_START = 0x5014,
174     UV_DBG_ENUM_STACK_ENU = 0x5015,
175     UV_DBG_ENUM_STACK_END = 0x5016,
176     // Response to UV_DBG_ENUM_VTR:
177     UV_DBG_ENUM_VTR_START = 0x5017,
178     UV_DBG_ENUM_VTR_ENU = 0x5018,
179     UV_DBG_ENUM_VTR_END = 0x5019,
180     // Command window output:
181     UV_DBG_CMD_OUTPUT = 0x5020,
182     // Serial output:
183     UV_DBG_SERIAL_OUTPUT = 0x5120,
184     // Response to UV_PRJ_ENUM_TARGETS:
185     UV_PRJ_ENUM_TARGETS_START= 0x5021,
186     UV_PRJ_ENUM_TARGETS_ENU = 0x5022,
187     UV_PRJ_ENUM_TARGETS_END = 0x5023,
188     // Response to UV_DBG_ENUM_REGISTER_GROUPS:
189     UV_DBG_ENUM_REGISTER_GROUPS_START = 0x5024,
190     UV_DBG_ENUM_REGISTER_GROUPS_ENU = 0x5025,
191     UV_DBG_ENUM_REGISTER_GROUPS_END = 0x5026,
192     // Response to UV_DBG_ENUM_REGISTERS:
193     UV_DBG_ENUM_REGISTERS_START = 0x5027,
194     UV_DBG_ENUM_REGISTERS_ENU = 0x5028,
195     UV_DBG_ENUM_REGISTERS_END = 0x5029,
196     // Response to UV_DBG_ITM_REGISTER:
197     UV_DBG_ITM_OUTPUT = 0x5030,
198     // Response to UV_DBG_ENUM_VARIABLES:
199     UV_DBG_ENUM_VARIABLES_START = 0x5040,
200     UV_DBG_ENUM_VARIABLES_ENU = 0x5041,
201     UV_DBG_ENUM_VARIABLES_END = 0x5042,
202     // Response to UV_DBG_ENUM_TASKS:
203     UV_DBG_ENUM_TASKS_START = 0x5050,
204     UV_DBG_ENUM_TASKS_ENU = 0x5051,
205     UV_DBG_ENUM_TASKS_END = 0x5052,
206     // Response to UV_DBG_ENUM_MENUS:
207     UV_DBG_ENUM_MENUS_START = 0x5060,
208     UV_DBG_ENUM_MENUS_ENU = 0x5061,
209     UV_DBG_ENUM_MENUS_END = 0x5062,
210     // Response to UV_DBG_EVTR_REGISTER:
211     UV_DBG_EVTR_OUTPUT = 0x5063,
212     // Response to UV_DBG_EVTR_ENUMSCVDFILES:
213     UV_DBG_EVTR_ENUMSCVDFILES_START = 0x5064,
214     UV_DBG_EVTR_ENUMSCVDFILES_ENU = 0x5065,
215     UV_DBG_EVTR_ENUMSCVDFILES_END = 0x5066,
216     // Real-Time agent:
217     UV_RTA_MESSAGE = 0x6000,
218     UV_RTA_INCOMPATIBLE = 0x6001,
219     // Test definititions (for testing only):
220     UV_TST_1 = 0xFF00,
221     UV_TST_2 = 0xFF01,
222     UV_TST_3 = 0xFF02,
223     UV_TST_4 = 0xFF03,
224     UV_TST_5 = 0xFF04,
225     UV_TST_6 = 0xFF05,
226     UV_TST_7 = 0xFF06,
227     UV_TST_8 = 0xFF07,
228     UV_TST_9 = 0xFF08,
229     UV_TST_10 = 0xFF09
230 };
231 
232 // Socket status codes.
233 enum UV_STATUS {
234     UV_STATUS_SUCCESS = 0,
235     UV_STATUS_FAILED = 1,
236     UV_STATUS_NO_PROJECT = 2,
237     UV_STATUS_WRITE_PROTECTED = 3,
238     UV_STATUS_NO_TARGET = 4,
239     UV_STATUS_NO_TOOLSET = 5,
240     UV_STATUS_NOT_DEBUGGING = 6,
241     UV_STATUS_ALREADY_PRESENT = 7,
242     UV_STATUS_INVALID_NAME = 8,
243     UV_STATUS_NOT_FOUND = 9,
244     UV_STATUS_DEBUGGING = 10,
245     UV_STATUS_TARGET_EXECUTING = 11,
246     UV_STATUS_TARGET_STOPPED = 12,
247     UV_STATUS_PARSE_ERROR = 13,
248     UV_STATUS_OUT_OF_RANGE = 14,
249     UV_STATUS_BP_CANCELLED = 15,
250     UV_STATUS_BP_BADADDRESS = 16,
251     UV_STATUS_BP_NOTSUPPORTED = 17,
252     UV_STATUS_BP_FAILED = 18,
253     UV_STATUS_BP_REDEFINED = 19,
254     UV_STATUS_BP_DISABLED = 20,
255     UV_STATUS_BP_ENABLED = 21,
256     UV_STATUS_BP_CREATED = 22,
257     UV_STATUS_BP_DELETED = 23,
258     UV_STATUS_BP_NOTFOUND = 24,
259     UV_STATUS_BUILD_OK_WARNINGS = 25,
260     UV_STATUS_BUILD_FAILED = 26,
261     UV_STATUS_BUILD_CANCELLED = 27,
262     UV_STATUS_NOT_SUPPORTED = 28,
263     UV_STATUS_TIMEOUT = 29,
264     UV_STATUS_UNEXPECTED_MSG = 30,
265     UV_STATUS_VERIFY_FAILED = 31,
266     UV_STATUS_NO_ADRMAP = 32,
267     UV_STATUS_INFO = 33,
268     UV_STATUS_NO_MEM_ACCESS = 34,
269     UV_STATUS_FLASH_DOWNLOAD = 35,
270     UV_STATUS_BUILDING = 36,
271     UV_STATUS_HARDWARE = 37,
272     UV_STATUS_SIMULATOR = 38,
273     UV_STATUS_BUFFER_TOO_SMALL = 39,
274     UV_STATUS_EVTR_FAILED = 40,
275     UV_STATUS_END
276 };
277 
278 // Variant-types used in #TVAL.
279 enum VTT_TYPE {
280     VTT_void = 0,
281     VTT_bit = 1,
282     VTT_int8 = 2,
283     VTT_uint8 = 3,
284     VTT_int = 4,
285     VTT_uint = 5,
286     VTT_short = 6,
287     VTT_ushort = 7,
288     VTT_long = 8,
289     VTT_ulong = 9,
290     VTT_float = 10,
291     VTT_double = 11,
292     VTT_ptr = 12,
293     VTT_union = 13,
294     VTT_struct = 14,
295     VTT_func = 15,
296     VTT_string = 16,
297     VTT_enum = 17,
298     VTT_field = 18,
299     VTT_int64 = 19,
300     VTT_uint64 = 20,
301     VTT_end
302 };
303 
304 // View types.
305 enum UVMENUTYPES {
306     UVMENU_DEBUG = 0,
307     UVMENU_SYS_VIEW = 1,
308     UVMENU_PERI = 2,
309     UVMENU_RTX = 3,
310     UVMENU_CAN = 4,
311     UVMENU_AGDI = 5,
312     UVMENU_TOOLBOX = 6,
313     UVMENU_END
314 };
315 
316 // Stop reason.
317 enum STOPREASON {
318     STOPREASON_UNDEFINED = 0x0000,
319     STOPREASON_EXEC = 0x0001,
320     STOPREASON_READ = 0x0002,
321     STOPREASON_HIT_WRITE = 0x0004,
322     STOPREASON_HIT_COND = 0x0008,
323     STOPREASON_HIT_ESC = 0x0010,
324     STOPREASON_HIT_VIOLA = 0x0020,
325     STOPREASON_TIME_OVER = 0x0040,
326     STOPREASON_UNDEFINS = 0x0080,
327     STOPREASON_PABT = 0x0100,
328     STOPREASON_DABT = 0x0200,
329     STOPREASON_NONALIGN = 0x0400,
330     STOPREASON_END
331 };
332 
333 // View types.
334 enum MENUENUMTYPES {
335     MENU_INFO_ITEM = 1,
336     MENU_INFO_GROUP = 2,
337     MENU_INFO_GROUP_END = -2,
338     MENU_INFO_LIST_END = -1,
339     MENU_INFO_RESERVED = 3,
340     MENU_INFO_END = 4,
341 };
342 
343 // Build completion codes.
344 enum UVBUILDCODES {
345     UVBUILD_OK = 1,
346     UVBUILD_OK_WARNINGS = 2,
347     UVBUILD_ERRORS = 3,
348     UVBUILD_CANCELLED = 4,
349     UVBUILD_CLEANED = 5,
350     UVBUILD_CODES_END
351 };
352 
353 // Breakpoint type.
354 enum BKTYPE {
355     BRKTYPE_EXEC = 1,
356     BRKTYPE_READ = 2,
357     BRKTYPE_WRITE = 3,
358     BRKTYPE_READWRITE = 4,
359     BRKTYPE_COMPLEX = 5,
360     BRKTYPE_END
361 };
362 
363 // Breakpoint change operation.
364 enum CHG_TYPE {
365     CHG_KILLBP = 1,
366     CHG_ENABLEBP = 2,
367     CHG_DISABLEBP = 3,
368     CHG_END
369 };
370 
371 // Memory range type.
372 enum UV_MR {
373     UV_MR_NONE = 0,
374     UV_MR_ROM = 1,
375     UV_MR_RAM = 2,
376     UV_MR_END
377 };
378 
379 // Project option type.
380 enum OPTSEL {
381     OPT_LMISC = 1,
382     OPT_CMISC = 2,
383     OPT_AMISC = 3,
384     OPT_CINCL = 4,
385     OPT_AINCL = 5,
386     OPT_CDEF = 6,
387     OPT_ADEF = 7,
388     OPT_CUNDEF = 8,
389     OPT_AUNDEF = 9,
390     OPT_COPTIMIZE = 10,
391     OPT_CODEGEN = 11,
392     OPT_MEMRANGES = 12,
393     OPT_ASNMEMRANGES = 13,
394     OPT_UBCOMP1 = 14,
395     OPT_UBCOMP2 = 15,
396     OPT_UBBUILD1 = 16,
397     OPT_UBBUILD2 = 17,
398     OPT_UABUILD1 = 18,
399     OPT_UABUILD2 = 19,
400     OPT_UBEEP = 20,
401     OPT_USTARTDEB = 21,
402     OPT_END
403 };
404 
405 // Debug target type.
406 enum UV_TARGET {
407     UV_TARGET_HW = 0,
408     UV_TARGET_SIM = 1,
409     UV_TARGET_END
410 };
411 
412 // Progress bar control type.
413 enum PGCMD {
414     UV_PROGRESS_INIT = 1,
415     UV_PROGRESS_SETPOS = 2,
416     UV_PROGRESS_CLOSE = 3,
417     UV_PROGRESS_INITTXT = 4,
418     UV_PROGRESS_SETTEXT = 5,
419     UV_PROGRESS_END
420 };
421 
422 // Symbol enumeration type.
423 enum ENTPJOB {
424     UV_TPENUM_MEMBERS = 1,
425     UV_TPENUM_END
426 };
427 
428 // Event format.
429 enum EVFMT {
430     EVFMT_RAW = 1,
431     EVFMT_DEC = 2
432 };
433 
434 #pragma pack(1)
435 
436 // Socket options.
437 struct UVSOCK_OPTIONS {
438     quint32 extendedStack : 1;
439     quint32 : 31;
440 };
441 static_assert(sizeof(UVSOCK_OPTIONS) == 4, "UVSOCK_OPTIONS size is not 4 bytes");
442 
443 // Cycles and time data.
444 struct CYCTS {
445     quint64 timeCycles;
446     double timeStamp;
447 };
448 static_assert(sizeof(CYCTS) == 16, "CYCTS size is not 16 bytes");
449 
450 // String data.
451 struct SSTR {
452     qint32 length; // Including NULL terminator.
453     qint8 data[256]; // NULL terminated string.
454 };
455 static_assert(sizeof(SSTR) == 260, "SSTR size is not 260 bytes");
456 
457 // Virtual register (VTR) value.
458 struct TVAL {
459     VTT_TYPE type;
460     union {
461         qint8 sc;
462         quint8 uc;
463         qint16 s16;
464         quint16 u16;
465         qint32 s32;
466         quint32 u32;
467         qint64 s64;
468         quint64 u64;
469         int i;
470         float f;
471         double d;
472     } v;
473 };
474 static_assert(sizeof(TVAL) == 12, "TVAL size is not 12 bytes");
475 
476 // Virtual register (VTR) data or register data or expression
477 // to calculate or watch exprerssion to set/change.
478 struct VSET {
479     TVAL value;
480     SSTR name;
481 };
482 static_assert(sizeof(VSET) == 272, "VSET size is not 272 bytes");
483 
484 // Variable enumeration or variable data request.
485 struct IVARENUM {
486     qint32 id;
487     qint32 frame;
488     qint32 task;
489     quint32 count : 16;
490     quint32 changed : 1;
491     quint32 reseved : 15;
492 };
493 static_assert(sizeof(IVARENUM) == 16, "IVARENUM size is not 16 bytes");
494 
495 // Variable set request.
496 struct VARVAL {
497     IVARENUM variable;
498     SSTR value;
499 };
500 static_assert(sizeof(VARVAL) == 276, "VARVAL size is not 276 bytes");
501 
502 // Information about watch expression, variable or its member.
503 struct VARINFO {
504     qint32 id;
505     qint32 index;
506     qint32 count;
507     qint32 typeSize;
508     quint32 isEditable : 1;
509     quint32 isPointer : 1;
510     quint32 isFunction : 1;
511     quint32 isStruct : 1;
512     quint32 isUnion : 1;
513     quint32 isClass : 1;
514     quint32 isArray : 1;
515     quint32 isEnum : 1;
516     quint32 isAuto : 1;
517     quint32 isParam : 1;
518     quint32 isStatic : 1;
519     quint32 isGlobal : 1;
520     quint32 hasValue : 1;
521     quint32 reserved1 : 12;
522     quint32 hasType : 1;
523     quint32 hasName : 1;
524     quint32 hasQualified : 1;
525     quint32 reserved2 : 4;
526     SSTR value;
527     SSTR type;
528     SSTR name;
529     SSTR qualified;
530 };
531 static_assert(sizeof(VARINFO) == 1060, "VARINFO size is not 1060 bytes");
532 
533 // Menu enumeration data request.
534 struct MENUID {
535     qint32 menuType;
536     qint32 menuId;
537     quint32 reserved : 32;
538 };
539 static_assert(sizeof(MENUID) == 12, "MENUID size is not 12 bytes");
540 
541 // Menu enumeration information.
542 struct MENUENUM {
543     qint32 menuId;
544     qint32 menuType;
545     qint32 infoType;
546     quint32 isEnabled : 1;
547     quint32 reserved : 31;
548     SSTR menuLabel;
549 };
550 static_assert(sizeof(MENUENUM) == 276, "MENUENUM size is not 276 bytes");
551 
552 // Memory read or write data.
553 struct AMEM {
554     quint64 address;
555     quint32 bytesCount;
556     quint64 errorAddress;
557     quint32 errorCode;
558     quint8 bytes[1];
559 };
560 static_assert(sizeof(AMEM) == 25, "AMEM size is not 25 bytes");
561 
562 // Terminal I/O data.
563 struct SERIO {
564     quint16 channel;
565     quint16 itemMode;
566     quint32 itemsCount;
567     union {
568         quint8 bytes[1];
569         quint16 words[1];
570     } s;
571 };
572 static_assert(sizeof(SERIO) == 10, "SERIO size is not 10 bytes");
573 
574 // ITM channel booking or output data.
575 struct ITMOUT {
576     quint16 channel;
577     quint16 itemMode;
578     quint32 itemsCount;
579     union {
580         quint8 bytes[1];
581         quint16 words[1];
582     } s;
583 };
584 static_assert(sizeof(ITMOUT) == 10, "ITMOUT size is not 10 bytes");
585 
586 // Multiple string data.
587 struct PRJDATA {
588     quint32 length;
589     quint32 code;
590     qint8 names[1];
591 };
592 static_assert(sizeof(PRJDATA) == 9, "PRJDATA size is not 9 bytes");
593 
594 // Breakpoint parameter data (new).
595 struct BKPARM {
596     BKTYPE type;
597     quint32 count;
598     quint32 accessSize;
599     quint32 expressionLength;
600     quint32 commandLength;
601     qint8 expressionBuffer[1];
602 };
603 static_assert(sizeof(BKPARM) == 21, "BKPARM size is not 21 bytes");
604 
605 // Breakpoint parameter data (existing).
606 struct BKRSP {
607     BKTYPE type;
608     quint32 count;
609     quint32 isEnabled;
610     quint32 tickMark;
611     quint64 address;
612     quint32 expressionLength;
613     qint8 expressionBuffer[512];
614 };
615 static_assert(sizeof(BKRSP) == 540, "BKRSP size is not 540 bytes");
616 
617 // Breakpoint change data.
618 struct BKCHG {
619     CHG_TYPE type;
620     quint32 tickMark;
621     quint32 reserved[8];
622 };
623 static_assert(sizeof(BKCHG) == 40, "BKCHG size is not 40 bytes");
624 
625 // Project option data.
626 struct TRNOPT {
627     OPTSEL job;
628     quint32 targetIndex;
629     quint32 groupIndex;
630     quint32 fileIndex;
631     quint32 itemIndex;
632     qint8 buffer[3];
633 };
634 static_assert(sizeof(TRNOPT) == 23, "TRNOPT size is not 23 bytes");
635 
636 // Individual memory range data.
637 struct UV_MRANGE {
638     quint32 memoryType : 8;
639     quint32 defaultRamRange : 1;
640     quint32 defaultRomRange : 1;
641     quint32 zeroRamRange : 1;
642     quint32 reserved1 : 21;
643     quint32 reserved2[3];
644     quint64 rangeStartAddress;
645     quint64 rangeSize;
646 };
647 static_assert(sizeof(UV_MRANGE) == 32, "UV_MRANGE size is not 32 bytes");
648 
649 // Memory ranges data.
650 struct UV_MEMINFO {
651     quint32 rangesCount;
652     quint32 reserved[8];
653     UV_MRANGE range;
654 };
655 static_assert(sizeof(UV_MEMINFO) == 68, "UV_MEMINFO size is not 68 bytes");
656 
657 // Licensing data.
658 struct UVLICINFO {
659     quint32 license : 1;
660     quint32 reserved1 : 31;
661     quint32 reserved2[10];
662 };
663 static_assert(sizeof(UVLICINFO) == 44, "UVLICINFO size is not 44 bytes");
664 
665 // Target debugging data.
666 struct DBGTGTOPT {
667     quint32 targetType : 1;
668     quint32 reserved1 : 31;
669     quint32 reserved2[10];
670 };
671 static_assert(sizeof(DBGTGTOPT) == 44, "DBGTGTOPT size is not 44 bytes");
672 
673 // Progress bar control data.
674 struct PGRESS {
675     PGCMD job;
676     quint32 completionPercentage;
677     quint32 reserved[8];
678     qint8 label[1];
679 };
680 static_assert(sizeof(PGRESS) == 41, "PGRESS size is not 41 bytes");
681 
682 // Extended version data.
683 struct EXTVERS {
684     quint32 uvisionVersionIndex;
685     quint32 uvsockVersionIndex;
686     quint32 reserved[30];
687     qint8 buffer[3];
688 };
689 static_assert(sizeof(EXTVERS) == 131, "EXTVERS size is not 131 bytes");
690 
691 // Symbol enumeration data.
692 struct ENUMTPM {
693     ENTPJOB job;
694     quint32 memberOffset;
695     quint32 memberSize;
696     quint32 reserved[8];
697     qint8 memberName[512];
698 };
699 static_assert(sizeof(ENUMTPM) == 556, "ENUMTPM size is not 556 bytes");
700 
701 // Map address to file or line request data.
702 struct ADRMTFL {
703     quint32 isFullPath :  1;
704     quint32 reserved1 : 31;
705     quint64 address;
706     quint32 reserved2[7];
707 };
708 static_assert(sizeof(ADRMTFL) == 40, "ADRMTFL size is not 40 bytes");
709 
710 // Map address to file or line return data.
711 struct AFLMAP {
712     quint32 codeLineNumber;
713     quint64 codeAddress;
714     quint32 fileNameIndex;
715     quint32 functionNameIndex;
716     qint32 reserved[5];
717     qint8 fileName[1];
718 };
719 static_assert(sizeof(AFLMAP) == 41, "AFLMAP size is not 41 bytes");
720 
721 // Breakpoint reason data.
722 struct BPREASON {
723     quint32 reserved1;
724     quint32 reserved2;
725     quint32 length;
726     STOPREASON stopReason;
727     quint64 programCounterAddress;
728     quint64 reasonAddress;
729     qint32 breakpointNumber;
730     quint32 tickMark;
731     quint32 reserved3[4];
732 };
733 static_assert(sizeof(BPREASON) == 56, "BPREASON size is not 56 bytes");
734 
735 // Stack enumeration request data.
736 struct iSTKENUM {
737     quint32 isFull : 1;
738     quint32 hasExtended : 1;
739     quint32 onlyModified : 1;
740     quint32 reserved1 : 29;
741     quint32 task;
742     quint32 reserved2[6];
743 };
744 static_assert(sizeof(iSTKENUM) == 32, "iSTKENUM size is not 32 bytes");
745 
746 // Stack enumeration return data.
747 struct STACKENUM {
748     quint32 number;
749     quint64 currentAddress;
750     quint64 returnAddress;
751     quint32 variablesCount;
752     quint32 equalFramesCount;
753     quint32 totalFramesCount;
754     quint32 task;
755     quint32 reserved[3];
756 };
757 static_assert(sizeof(STACKENUM) == 48, "STACKENUM size is not 48 bytes");
758 
759 // Task list enumeration return data.
760 struct TASKENUM {
761     qint32 id;
762     quint64 entryAddress;
763     quint32 state : 8;
764     quint32 reserved : 24;
765     SSTR name;
766 };
767 static_assert(sizeof(TASKENUM) == 276, "TASKENUM size is not 276 bytes");
768 
769 // Register enumeration return data.
770 struct REGENUM {
771     quint16 groupIndex;
772     quint16 item;
773     qint8 name[16];
774     quint8 isPc : 1;
775     quint8 isChangable : 1;
776     quint8 reserved : 6;
777     qint8 value[32];
778 };
779 static_assert(sizeof(REGENUM) == 53, "REGENUM size is not 53 bytes");
780 
781 // Virtual register (VTR) enumeration request data.
782 struct iVTRENUM {
783     quint32 value : 1;
784     quint32 reserved : 31;
785     quint32 reserved2[7];
786 };
787 static_assert(sizeof(iVTRENUM) == 32, "iVTRENUM size is not 32 bytes");
788 
789 // Virtual register (VTR) enumeration return data.
790 struct AVTR {
791     quint32 useValue : 1;
792     quint32 type : 8;
793     quint32 isXtal : 1;
794     quint32 isClock : 1;
795     quint32 internalNumber : 16;
796     quint32 reserved1 : 5;
797     quint32 reserved2[7];
798     TVAL value;
799     qint8 name[1];
800 };
801 static_assert(sizeof(AVTR) == 45, "AVTR size is not 45 bytes");
802 
803 // Wake interval data.
804 struct iINTERVAL {
805     quint32 autoStart : 1;
806     quint32 useCycles : 1;
807     quint32 useIntervalCallback : 1;
808     quint32 reserved1 : 29;
809     float secondsCount;
810     qint64 cyclesCount;
811     quint32 reserved2[7];
812 };
813 static_assert(sizeof(iINTERVAL) == 44, "iINTERVAL size is not 44 bytes");
814 
815 // Show code in uVision request data.
816 struct iSHOWSYNC {
817     quint64 displayedCodeAddress;
818     quint32 displayDisassembly : 1;
819     quint32 displayCode : 1;
820     quint32 reserved1 : 1;
821     quint32 reserved2 : 1;
822     quint32 reserved3 : 28;
823     quint32 reserved4[7];
824 };
825 static_assert(sizeof(iSHOWSYNC) == 40, "iSHOWSYNC size is not 40 bytes");
826 
827 // Timestamp for power scale.
828 struct UVSC_PSTAMP {
829     quint64 codeAddress;
830     qint64 ticksCount;
831     double timeDelta;
832     double absoluteTime;
833     quint32 displaySyncError : 1;
834     quint32 reserved1 : 31;
835     quint32 reserved2[6];
836 };
837 static_assert(sizeof(UVSC_PSTAMP) == 60, "UVSC_PSTAMP size is not 60 bytes");
838 
839 // RAW event recorder.
840 struct RAW_EVENT {
841     quint32 type : 8;
842     quint32 reserved1 : 24;
843     quint64 eventNumber;
844     quint64 timeStamp;
845     quint32 restartId;
846     quint16 eventId;
847     quint16 payloadValuesCount;
848     quint8 multipleRecordsIndex;
849     quint8 eventContext;
850     quint8 recorderId;
851     quint8 hasOverflowL : 1;
852     quint8 hasReset : 1;
853     quint8 isValidId : 1;
854     quint8 lastEventRecord : 1;
855     quint8 isCompleteRecord : 1;
856     quint8 hasOverflowH : 1;
857     quint8 irqFlag : 1;
858     quint8 hasResume : 1;
859     quint32 payload[2];
860 };
861 static_assert(sizeof(RAW_EVENT) == 40, "RAW_EVENT size is not 40 bytes");
862 
863 // DEC event recorder.
864 struct DEC_EVENT {
865     quint32 type : 8;
866     quint32 reserved : 24;
867     quint64 eventNumber;
868     quint64 timeStamp;
869     qint8 text[1];
870 };
871 static_assert(sizeof(DEC_EVENT) == 21, "DEC_EVENT size is not 21 bytes");
872 
873 // Event package item.
874 struct EVTR_PACK {
875     quint16 many;
876     union {
877         qint8 data;
878         qint8 type;
879         RAW_EVENT raw;
880         DEC_EVENT dec;
881     };
882 };
883 static_assert(sizeof(EVTR_PACK) == 42, "EVTR_PACK size is not 42 bytes");
884 
885 // Event out item.
886 struct EVTROUT {
887     quint32 many;
888     quint32 reserved;
889     union {
890         qint8 data;
891         EVTR_PACK pack;
892     };
893 };
894 static_assert(sizeof(EVTROUT) == 50, "EVTROUT size is not 50 bytes");
895 
896 // Command execution request or response data.
897 struct EXECCMD {
898     quint32 useEcho : 1;
899     quint32 reserved1 : 31;
900     quint32 reserved2[7];
901     SSTR command;
902 };
903 static_assert(sizeof(EXECCMD) == 292, "EXECCMD size is not 292 bytes");
904 
905 // Path request data structure.
906 struct iPATHREQ {
907     quint32 useFullPath : 1;
908     quint32 reserved1 : 31;
909     quint32 reserved2[7];
910 };
911 static_assert(sizeof(iPATHREQ) == 32, "iPATHREQ size is not 32 bytes");
912 
913 //#pragma pack(1)  // ()
914 
915 // UVSOCK error response data.
916 struct UVSOCK_ERROR_RESPONSE {
917     quint32 reserved1;
918     quint32 reserved2;
919     quint32 length;
920     quint8 data[SOCK_NDATA - 20];
921 };
922 static_assert(sizeof(UVSOCK_ERROR_RESPONSE) == 32760, "UVSOCK_ERROR_RESPONSE size is not 32760 bytes");
923 
924 // UVSOCK command response or async message data format.
925 struct UVSOCK_CMD_RESPONSE {
926     UV_OPERATION command;
927     UV_STATUS status;
928     union {
929         UVSOCK_ERROR_RESPONSE error;
930         quint32 value;
931         CYCTS cycts;
932         AMEM amem;
933         SERIO serio;
934         ITMOUT itmout;
935         EVTROUT evtrout;
936         VSET vset;
937         BKRSP bkrsp;
938         TRNOPT trnopt;
939         SSTR sstr;
940         EXTVERS extvers;
941         ENUMTPM enumtpm;
942         AFLMAP aflmap;
943         BPREASON bpreason;
944         STACKENUM stackenum;
945         TASKENUM taskenum;
946         AVTR avtr;
947         UVLICINFO uvlicinfo;
948         DBGTGTOPT dbgtgtopt;
949         UVSC_PSTAMP uvpstamp;
950         REGENUM regenum;
951         VARINFO varinfo;
952         MENUENUM viewinfo;
953         qint8 strbuf[1];
954     };
955 };
956 static_assert(sizeof(UVSOCK_CMD_RESPONSE) == 32768, "UVSOCK_CMD_RESPONSE size is not 32768 bytes");
957 
958 // UVSOCK message data format.
959 union UVSOCK_CMD_DATA {
960     quint8 raw[SOCK_NDATA];
961     PRJDATA prjdata;
962     AMEM amem;
963     SERIO serio;
964     ITMOUT itmout;
965     EVTROUT evtrout;
966     VSET vset;
967     TRNOPT trnopt;
968     SSTR sstr;
969     BKPARM bkparm;
970     BKCHG bkchg;
971     DBGTGTOPT dbgtgtopt;
972     ADRMTFL adrmtfl;
973     iSHOWSYNC ishowsync;
974     iVTRENUM ivtrenum;
975     EXECCMD execcmd;
976     iPATHREQ ipathreq;
977     UVSC_PSTAMP uvpstamp;
978     iSTKENUM istkenum;
979     PGRESS pgress;
980     ENUMTPM enumtpm;
981     iINTERVAL iinterval;
982     quint32 value;
983     quint64 address;
984     UVSOCK_OPTIONS uvsockopt;
985     UVSOCK_CMD_RESPONSE cmdrsp;
986 };
987 static_assert(sizeof(UVSOCK_CMD_DATA) == 32768, "UVSOCK_CMD_DATA size is not 32768 bytes");
988 
989 // UVSOCK message format.
990 struct UVSOCK_CMD {
991     quint32 totalLength;
992     UV_OPERATION command;
993     quint32 dataLength;
994     quint64 cyclesCount;
995     double timeStamp;
996     quint32 id;
997     UVSOCK_CMD_DATA data;
998 };
999 static_assert(sizeof(UVSOCK_CMD) == 32800, "UVSOCK_CMD size is not 32800 bytes");
1000 
1001 #pragma pack()
1002 
1003 #ifdef __cplusplus
1004 }
1005 #endif
1006