1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
|
/*
* Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
*
* This software may be freely used, copied, modified, and distributed
* provided that the above copyright notice is preserved in all copies of the
* software.
*/
/* -*-C-*-
*
* $Revision$
* $Date$
*
*
*
* INTRODUCTION
* ------------
* The early RDP message definitions were held in an ARM Ltd "armdbg"
* source file. Since the relevant header files were not exported
* publicly as part of an ARM Ltd core tools release, it was a problem
* for developers manipulating the target side of the protocol.
*
* For Angel, this new (ANSI 'C' clean) header file defines the ADP
* protocol. The header should be useable by both host and target
* systems, thus avoiding problems that can arise from duplicate
* definitions. Care has been taken in the construction of this header
* file to avoid any host/target differences.
*
* MESSAGE FORMAT
* --------------
* Format of the "data" section of debug and boot agent messages. This is
* the standard ADP (Angel Debug Protocol) message format:
*
* unsigned32 reason - Main debug reason code.
* unsigned32 debugID - Information describing host debug world;
* - private to host and used in any target initiated
* messages.
* unsigned32 OSinfo1 \ Target OS information to identify process/thread
* unsigned32 OSinfo2 / memory/world, etc. These two fields are target
* defined.
* byte args[n] - Data for message "reason" code.
*
* NOTE: The message format is the same for single threaded debugging,
* except that the "OSinfo" fields should be -1 (0xFFFFFFFF). Even
* single-threaded debugging *MAY* have different host specified
* debugID values, so the Angel debug system will preserve the "debugID"
* information for replies, and the relevant asynchronous target-to-host
* messages. The "debugID" is defined by the host-end of the
* protocol, and is used by the host to ensure that messages are
* routed to the correct handler program/veneer.
*
* The reason there are two target specified "OSinfo" words is because
* thread identifiers may not be unique when processes/tasks have
* private virtual address spaces. It allows more flexibility when
* supporting multi-threaded or O/S aware debugging.
*
* NOTE: The reason that there is no "size" information, is that the
* message IDs themselves encode the format of any arguments. Also it
* would be a duplication of information used by the physical
* transport layer (which is distinct from this logical message
* layer). Any routing of messages through programs, hosts,
* etc. should be performed at the physical layer, or the boundaries
* between physical layers. i.e. packet received on socket in host,
* and transferred to serial packet for passing on down the line.
*
* NOTE: Pointers aren't passed in messages because they are dangerous in
* a multi-threaded environment.
*
* ADP REASON CODE
* ---------------
* The message reason codes contain some information that ties them to
* the channel and direction that the message will be used with. This
* will ensure that even if the message "#define name" is not
* completely descriptive, the message reason code is.
*
* b31 = direction. 0=Host-to-Target; 1=Target-to-Host;
* b30-28 = debug agent multi-threaded control (see below)
* b27-24 = reserved. should be zero.
* b23-16 = channelid. The fixed Angel channel number
* (see "channels.h").
* b15-0 = message reason code.
*
* It is unfortunate that to aid the error-checking capabilities of
* the Angel communications we have changed the message numbers from
* the original ARM Ltd RDP. However this also has benefits, in that
* the Angel work is meant to be a clean break.
*
* However, it isn't so bad since even though the numbers are
* different, the majority of the reason codes have exactly the same
* functionality as the original RDP messages.
*
* NOTES
* -----
* It would be ideal to use "rpcgen" (or some equivalent) to
* automatically maintain compatibility between the target and host
* ends of the protocol. However, ARM Ltd expressed that the message
* handling should be hand-coded, to avoid dependance on external
* tools.
*
* All other channels have undefined data formats and are purely
* application defined. The C library "_sys_" support will provide a
* veneer to perform message block operations as required.
*
* It is IMPLIED that all of the ADP messages will fit within the
* buffer DATASIZE. This has a minimum value, calculated from
* BUFFERMINSIZE.
*
* All messages are passed and received to the channel system in little
* endian order (ie. use little endian order when writing a word as
* a sequence of bytes within a message).
*
* A reply / acknowledgement to an ADP message is always sent and has the
* same reason code as the original except that the TtoH / HtoT bit is
* reversed. This makes it simple to check that the reply really
* is a reply to the message which was just sent! [Boot Channel messages
* also require that this protocol is used].
*/
#ifndef angel_adp_h
#define angel_adp_h
#include "chandefs.h"
/*
* Buffer minimum sizes
*/
/* the minimum target internal size */
#define ADP_BUFFER_MIN_SIZE (256)
/* a word is always reserved for internal use in the target */
#define ADP_BUFFER_MAX_INTERNAL (sizeof(word))
/* the minimum available data portion */
#define ADP_BUFFER_MIN_DATASIZE \
(ADP_BUFFER_MIN_SIZE - ADP_BUFFER_MAX_INTERNAL - CHAN_HEADER_SIZE)
/*
* the space taken up by the standard ADP header
* (reason, debugID, OSinfo1, OSinfo2)
*/
#define ADP_DEFAULT_HEADER_SIZE (4*sizeof(word))
/* 8bit ADP version identification */
#define ADPVSN (0x03)
/* This value can be used to identify the protocol version supported
* by target or host systems. This version number should only be
* changed if the protocol undergoes a non-backward compatible
* change. It should *NOT* be used to reflect extensions to the
* protocol. Such extensions can be added to the existing protocol
* version by allocating new reason codes, and by extending the
* ADP_Info message to identify new features.
*/
/* The following value is used in the OSinfo fields for
* single-threaded messages, or where the host wants to alter the
* global CPU state. NOTE: The "debugID" field should always be
* defined by the host, and returned in target initiated messages. The
* only exception to this rule is the ADP_Booted message at the
* start-of-day.
*/
#define ADP_HandleUnknown (-1)
/******************************************************************
*
* ADP reason code subfields
*
*/
/* The following bits are used to describe the basic direction of
* messages. This allows some extra checking of message validity to be
* performed, as well as providing a description of the message that
* may not be available in the "cpp" macro:
*/
#define HtoT ((unsigned)0 << 31) /* Host-to-Target message */
#define TtoH ((unsigned)1 << 31) /* Target-to-Host message */
/* The following bits are used to control how the target system
* executes whilst processing messages. This allows for O/S specific
* host-based debug programs to interrogate system structures whilst
* ensuring that the access is atomic within the constraints imposed
* by the target O/S.
*
* NOTE: That only the channel is inserted into the reason code
* automatically. Thus both direction and multi thread control bits
* must be added by the host / target.
*/
/* Disable FIQ whilst processing message */
#define DisableFIQ (1 << 30)
/* Disable IRQ whilst processing message */
#define DisableIRQ (1 << 29)
/* Disable O/S pre-emption whilst processing message */
#define DisablePreemption (1 << 28)
/* The channel identification number is held in the reason code as a
* check:
*/
#define ADPCHANNEL(b) (((b) & 0xFF) << 16)
/* The following macro constructs the reason code number, from the
* various fields - note that the direction is NOT inlcuded since
* this depends on whether the Host or Target system is including
* this file!
*/
#define ADPREASON(c,r) (ADPCHANNEL(c) | ((r) & 0xFFFF))
/* This macros is used when constructing manifests for sub-reason
* codes. At the moment it is identical to the main reason macro. If
* desired we could add a new bit that explicitly identifies the value
* as a sub-reason code, where the corresponding bit in the main
* message ID would be zero.
*/
#define ADPSUBREASON(c,r) (ADPCHANNEL(c) | ((r) & 0xFFFF))
/* All other undefined bits are reserved, and should be zero. */
/*****************************************************************
*
* channel_BOOT messages
*
*/
/* The BOOT agent only supports a few messages. They are used purely
* to control the "start-of-day" connection to a host program. All
* Angel systems with host communications *MUST* provide the BOOT
* agent, even if they don't have support for either the single- or
* multi-threaded debug agents.
*
* The way the BOOT channel will be used on startup will be as follows:
*
* a) Target board is powered up before host debugger is invoked
*
* After switching on the target and initialisation is completed the
* target will send an ADP_Booted or ADP_Reset message. The debugger
* has not been started yet so this message will not be received. In
* a serial world this makes it important that any buffers on the host
* side are flushed during initialisation of the debugger, and in an
* Ethernet world it makes it important that the target can cope with the
* message not being received.
*
* Eventually the Debugger will be started up and will send an
* ADP_Reboot or ADP_Reset request. The target will respond to this with
* an ADP_Reboot or ADP_Reset acknowldege and will then reboot, finally
* sending an ADP_Rebooted when it has done all it needs to do (very little
* in the case of ADP_Reset, but completely rebooting in the case of
* ADP_Reboot). Note that it is important that an ADP_Rebooted message is
* sent so that the Debugger does not attempt to send any data after it has
* made a request to ADP_Reboot and before it receives an ADP_Rebooted, as
* data can be lost be the target during this time.
*
* The target and host are now ready to start a debug session.
*
* b) Target board is powered up after host debugger is invoked
*
* The debugger will send an ADP_Reboot or ADP_Reset request, but will
* receive no reply until the target is powered up.
/ *
* When the target is powered up then it will send an ADP_Rebooted
* message to the debugger. The debugger should accept this message
* even though it has received no ADP_Reboot or ADP_Reset acknowldege message
* from the target.
*
* The target and host are now ready to start a debug session.
*
*
* If at any point during the bootup sequence and ADP messages are
* sent down the S_DBG channel then they should be responded to with a
* RDI_NotInitialised error. [This should never happen however].
*
* An ADP_Boot or ADP Rebooted message should be accepted at
* any point, since it is possible for a catastrophe to occur (such as
* disconnecteing the host and target during a debug message) which
* requires that one or other end be reset.
*
*/
/*
* A list of parameter types - for now just baud rate
*/
typedef enum ADP_Parameter {
AP_PARAMS_START = 0xC000,
AP_BAUD_RATE = AP_PARAMS_START,
/* extra parameters go in here */
#ifdef TEST_PARAMS
AP_CAFE_MENU, /* extra just for testing */
#endif
AP_PARAMS_END
} ADP_Parameter;
#define AP_NUM_PARAMS (AP_PARAMS_END - AP_PARAMS_START)
/*
* Parameter types should have associated semantics which can be represented
* within one word per parameter, or an associated enum for choices.
*
* AP_BAUD_RATE: the word contains the exact baud rate, eg. 9600, 38400.
*/
/* this is not strictly necessary, but it's an example */
typedef enum ADP_BaudRate {
AB_9600 = 9600,
AB_19200 = 19200,
AB_38400 = 38400,
AB_57600 = 57600,
AB_115200 = 115200
} ADP_BaudRate;
#define AB_NUM_BAUD_RATES 5 /* this is more useful, for sizing arrays */
/* This must be set to the max number of options per parameter type */
#define AP_MAX_OPTIONS (AB_NUM_BAUD_RATES)
#define ADP_Booted ADPREASON(CI_TBOOT,0)
/* This message is sent by the target after the Angel system has been
* initialised. This message also contains information describing the
* Angel world. The information can then be used to check that the
* target debug agent and source debugger are compatible.
*
* Message arguments:
* word Angel message default buffer size.
* word Angel message large buffer size (may be same as default)
* word Angel version ; inc. type (e.g. boot ROM) See (1)
* word ADP version. See (2)
* word ARM Architecture info See (3)
* word ARM CPU information ; including target endianness. See (4)
* word Target hardware status. See (5)
* word Number of bytes in banner message
* bytes Startup banner message (single-threaded readable
* descriptive text - NOT NULL terminated).
*
* Reply:
* word status
*
* 'status' returns RDIError_NoError for success, and otherwise
* indicates an error.
*/
/* Angel version word [Reference(1)] : */
/* Angel version number is a 16bit BCD value */
#define ADP_ANGELVSN_MASK (0x0000FFFF)
#define ADP_ANGELVSN_SHIFT (0)
/* Type of Angel system */
#define ADP_ANGELVSN_TYPE_MASK (0x00FF0000)
#define ADP_ANGELVSN_TYPE_SHIFT (16)
typedef enum {
ADP_AngelType_bootROM, /* Simple ROM system providing download capability */
ADP_AngelType_appROM, /* ROM based application */
ADP_AngelType_appDLOAD,/* Downloaded Angel based application */
ADP_AngelType_Last /* Unknown type. This typedef can be extended */
/* but if the host and target vsns differ */
/* Then one will spot that it dies not understand */
} ADP_Angel_Types ; /* this field and can whinge appropriately */
/* First unknown ADP_AngelType */
#define ADP_ANGELVSN_UNKTYPE_MASK (0xFF000000)
#define ADP_ANGELVSN_UNKYPE_SHIFT (24)
/* Currently only 8 bits are used in the word: */
/* ADP protocol supported by target [Reference (2)] */
#define ADP_ANGELVSN_ADP_MASK (0x000000FF)
#define ADP_ANGELVSN_ADP_SHIFT (0)
/* ARM Architecture info: [Reference (3)] */
/* ARM Architecture Verson of target CPU */
#define ADP_ARM_ARCH_VSN_MASK (0x000000FF)
#define ADP_ARM_ARCH_VSN_SHIFT (0)
/* Does the processor support the Thumb Instruction Set */
#define ADP_ARM_ARCH_THUMB (0x80000000)
/* Does the processor support Long Multiplies */
#define ADP_ARM_ARCH_LONGMUL (0x40000000)
/* All other flags are current undefined, and should be zero. */
/* The following flags describe the feature set of the processor: */
/* Set if cpu supports little-endian model [Reference (4)] */
#define ADP_CPU_LE (1 << 0)
/* Set if cpu supports big-endian model */
#define ADP_CPU_BE (1 << 1)
/* Set if processor has a cache */
#define ADP_CPU_CACHE (1 << 2)
/* Set if processor has a MMU */
#define ADP_CPU_MMU (1 << 3)
/* All other flags are current undefined, and should be zero. */
/* The following flags reflect current Target hardware status: */
/* [Reference (5)] */
/* 0 = no MMU or MMU off; 1 = MMU on */
#define ADP_CPU_MMUOn (1 << 29)
/* 0 = no cache or cache off; 1 = cache on */
#define ADP_CPU_CacheOn (1 << 30)
/* 0 = little-endian; 1 = big-endian */
#define ADP_CPU_BigEndian (1U << 31)
/* All other flags are current undefined, and should be zero. */
#ifdef LINK_RECOVERY
#define ADP_TargetResetIndication ADPREASON(CI_TBOOT, 1)
/*
* If parameter negotiation is enabled at the target, it configures itself
* to various likely parameter settings and sends this message at each
* configuration. The message describes the default settings, and after
* sending at each configuration the target sets itself to the defaults
* it has just broadcast, to await either an ack on TBOOT or a request
* or reset indication on HBOOT.
*
* If the host receives this message successfully, it should reset to the
* indicated parameters and send a reply.
*
* Message arguments:
* word status (always 0, makes body same as
* ADP_ParamNegotiate response)
* word n-parameters
* n-parameters * {
* word ADP_Parameter
* word parameter-value
* }
*
* Reply:
* - empty acknowledgement
*/
#endif /* def LINK_RECOVERY */
typedef enum ADP_Boot_Ack {
AB_NORMAL_ACK, /* will comply, immediate booted message */
AB_LATE_ACK, /* will comply, late startup */
AB_ERROR /* cannot comply */
} ADP_Boot_Ack;
/* If the host sets neither of these in the word sent on a Reset / Reboot
* then it doesn;t care about the endianess of the target
*/
#define ADP_BootHostFeature_LittleEnd 0x80000000
#define ADP_BootHostFeature_BigEnd 0x40000000
#define ADP_Reboot ADPREASON(CI_HBOOT,2)
/* This message is sent when the host wants the target system to be
* completely reset, back to the boot monitor Angel. This is the
* method of the host forcing a cold-reboot.
* Note that an acknowledgement message will be sent immediately and
* that this must be sent before the target can reset.
*
* The parameter to this function is a bitset of host supported
* features. (in fact the same as ADP_Reset below. This can be used by
* the target system to avoid using debug channel bandwidth raising
* messages that will be ignored by the host.
*
* Parameters:
* word host supported features (see above)
*
* Reply:
* word status, one of enum ADP_Boot_Ack above.
*
* Currently there are no such features defined, so the word indicating
* host supported features should be set to 0.
*/
#define ADP_Reset ADPREASON(CI_HBOOT,3)
/* This message is a request from the host, which should eventually
* result in the "ADP_Booted" message being sent by the target.
* Note that an acknowledgement message will be sent immediately and
* that this must be sent before the target can reset.
* This reset message is *ALWAYS* treated as a warm boot, with the target
* preserving as much state as possible.
*
* The parameter to this function is a bitset of host supported
* features. This can be used by the target system to avoid using
* debug channel bandwitdth raising messages that will be ignored by
* the host.
*
* Parameters:
* word host supported features (see above)
*
* Reply:
* word status, one of enum ADP_Boot_Ack above.
*
* Currently there are no such features defined, so the word indicating
* host supported features should be set to 0.
*/
#ifdef LINK_RECOVERY
#define ADP_HostResetIndication ADPREASON(CI_HBOOT, 4)
/*
* This is as for ADP_TargetResetIndication, but is sent by the host when
* it first starts up in case the target is listening at a non-default
* setting. Having sent at various configurations, the host then listens
* at the defaults it has just broadcast, to await either an ack on HBOOT
* or a reset indication on TBOOT.
*
* For arguments and reply, see ADP_TargetResetIndication.
*/
#endif /* def LINK_RECOVERY */
#define ADP_ParamNegotiate ADPREASON(CI_HBOOT, 5)
/*
* The host sends this messages to negotiate new parameters with the target.
* For each parameter the host specifies a range of possibilities, starting
* with the most favoured. All possible combinations of parameters
* must be valid.
*
* If the target can operate at a combination of the offered parameters,
* it will reply with the parameters it is willing to use. AFTER sending
* the reply, the target switches to this combination. On receiving the
* reply, the host will switch to the new combination and send a LinkCheck
* message (see below).
*
* If the target cannot operate at any combination of the offered parameters,
* it will reply with an error status.
*
* Message arguments:
* word n-parameter-blocks
* n-parameter-blocks * {
* word ADP_Parameter
* word n-options
* n-options * { word parameter-value }
* }
*
* Reply:
* word status
* if (status == RDIError_NoError) {
* word n-parameters
* n-parameters * {
* word ADP_Parameter
* word chosen-value
* }
* }
*/
#define ADP_LinkCheck ADPREASON(CI_HBOOT, 6)
/*
* This should be the first message that the host sends after a successful
* parameter negotiation. It is really just a 'ping'.
*
* Message arguments:
* - empty message
*
* Reply:
* - empty acknowledgement
*/
/********************************************************************
*
* CI_HADP messages
*
*/
#define ADP_HADPUnrecognised ADPREASON(CI_HADP,0)
/* This message is unusual in that it is normally sent in reply to
* another message which is not understood. This is an exception
* to the normal protocol which says that a reply must have the
* same base reason code as the original. There is a single reply
* parameter which is the reason code which was not understood.
*
* As well as being a reply this message can also be sent and will
* return as if this message were unrecognised!
*
* Parameters:
* none
*
* Reply:
* word reason code which was not recognised
*/
#define ADP_Info ADPREASON(CI_HADP,1)
/* This is the new ADP information message. It is used to interrogate
* the target debug agent. It provides information on the processor,
* as well as the state of the debug world. This allows the host to
* configure itself to the capabilities of the target.
*
* We try not to use feature bitsets, since we could quickly run out
* of known bits. Thus when the feature set is extended, this can be
* done in a couple of supported ways:
*
* If an undivided reason code is to be added (no reason subcodes)
* then add a new ADP_Info code which responds with a flag indicating
* whether that feature is supported by the target. If this has not
* even been implemented then the reply will be ADP_HADPUnrecognised
*
* If a reason code which is subdivided into reason subcodes is
* added then reason subcode 0 should be set aside to indicate
* whether the functionality of that reason code is supported
* by the target. If it is not even implemented then the reply will
* be ADP_Unrecognised.
*
* The first parameter to ADP_Info is a reason subcode, and subsequent
* parameters are defined by that subcode
*
* Parameters:
* word reason subcode
* other arguments as reason subcode determines.
*
* Reply:
* word reason subcode
* other argument as reason subcode determines
*/
/* ADP_Info reason subcodes: */
#define ADP_Info_NOP ADPSUBREASON(CI_HADP,0)
/* ADP_Info_NOP
* ------------
* Summary: This message is used to check for ADP_Info being supported.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' returns RDIError_NoError for success, non-zero indicates an error.
* If an error is returned then there is no handler for the ADP_Info
* message. The normal action will be to return an OK status.
*/
#define ADP_Info_Target ADPSUBREASON(CI_HADP,1)
/* ADP_Info_Target
* ---------------
* Summary:
* This reason code is used to interrogate target system details.
*
* Arguments:
* Send: ()
* Return: (word status, word bitset, word model)
*
* 'status' is RDIError_NoError to indicate OK, or non-zero to indicate
* some sort of error.
* 'bitset' is described in more detail below, and is mostly compatible
* with the old RDI/RDP system to avoid gratuitous changes to the debugger
* toolbox.
* 'model' is the target hardware ID word, as returned by the ADP_Booted
* message.
*
* NOTE: The minimum and maximum protocol levels are no longer supported.
* It is the Angel view that debugging complexity should be shifted to the
* host if at all possible. This means that the host debugger should
* always try to configure itself to the features available in the target
* debug agent. This can be done by checking individual messages, rather
* than by a blanket version number dictating the feature set.
*/
/* 'bitset':- */
/* Target speed in instructions per second = 10**(bits0..3). */
#define ADP_Info_Target_LogSpeedMask (0xF)
/* Target is running on [0 = emulator / 1 = hardware] */
#define ADP_Info_Target_HW (1 << 4)
/* Bits 5..10 are currently undefined and should be zero. */
/* Other bis are kept the same as the RDP in order to */
/* eliminate the need to change the position of some bits */
/* If set then the debug agent can be reloaded. */
#define ADP_Info_Target_CanReloadAgent (1 << 11)
/* Can request AngelBufferSize information. */
#define ADP_Info_Target_CanInquireBufferSize (1 << 12)
/* Bit 13 is no longer required as it inquired whether
* a special RDP Interrupt code was supported
*/
/* Debug agent can perform profiling. */
#define ADP_Info_Target_Profiling (1 << 14)
/* Debug agent can support Thumb code. */
#define ADP_Info_Target_Thumb (1 << 15)
/* Bit 16 was the communications channel check.
* This is always available on Angel systems.
*/
#define ADP_Info_Points ADPSUBREASON(CI_HADP,2)
/* ADP_Info_Points
* ---------------
* Summary: Returns a 32bit wide bitset of break- and watch-point
* features supported by the target debug agent.
*
* Arguments:
* Send: ()
* Return: (word status, word breakinfo)
*
* 'status' returns RDIError_NoError on success or non-zero to indicate
* some sort of error.
* 'breakinfo' is a 32bit wide bitset described in detail below. Note
* that only bits 1..12 are used.
*/
/* 'breakinfo':- */
/* Can trap on address equality. */
#define ADP_Info_Points_Comparison (1 << 0)
/* Can trap on address range. */
#define ADP_Info_Points_Range (1 << 1)
/* Can trap on 8bit memory reads. */
#define ADP_Info_Points_ReadByteWatch (1 << 2)
/* Can trap on 16bit memory reads. */
#define ADP_Info_Points_ReadHalfWatch (1 << 3)
/* Can trap on 32bit memory reads. */
#define ADP_Info_Points_ReadWordWatch (1 << 4)
/* Can trap on 8bit write accesses. */
#define ADP_Info_Points_WriteByteWatch (1 << 5)
/* Can trap on 16bit write accesses. */
#define ADP_Info_Points_WriteHalfWatch (1 << 6)
/* Can trap on 32bit write accesses. */
#define ADP_Info_Points_WriteWordWatch (1 << 7)
/* Like range, but based on address bitmask<. */
#define ADP_Info_Points_Mask (1 << 8)
/* Multi-threaded support only - thread specific breakpoints. */
#define ADP_Info_Points_ThreadBreak (1 << 9)
/* Multi-threaded support only - thread specific watchpoints. */
#define ADP_Info_Points_ThreadWatch (1 << 10)
/* Allows conditional breakpoints. */
#define ADP_Info_Points_Conditionals (1 << 11)
/* Break- and watch-points can be interrogated */
#define ADP_Info_Points_Status (1 << 12)
#define ADP_Info_Step ADPSUBREASON(CI_HADP,3)
/* ADP_Info_Step
* -------------
* Summary: Returns a 32bit wide bitmask of the single-stepping
* capabilities of the target debug agent.
*
* Arguments:
* Send: ()
* Return: (word status, word stepinfo)
*
* 'status' returns RDIError_NoError on success, or non-zero to indicate
* some kind of error.
* 'stepinfo' is a 32bit wide bitmask described in detail below. Note that
* only 3 bits are used.
*/
/* 'stepinfo':- */
/* Single-stepping of more than one instruction is possible. */
#define ADP_Info_Step_Multiple (1 << 0)
/* Single-stepping until next direct PC change is possible. */
#define ADP_Info_Step_PCChange (1 << 1)
/* Single-stepping of a single instruction is possible. */
#define ADP_Info_Step_Single (1 << 2)
#define ADP_Info_MMU ADPSUBREASON(CI_HADP,4)
/* ADP_Info_MMU
* ------------
* Summary: Returns information about the memory management system (if
* any).
*
* Arguments:
* Send: ()
* Return: (word status, word meminfo)
*
* 'status' returns RDIError_NoError to indicate success or non-zero to
* indicate some kind of error.
* 'meminfo' should be a 32bit unique ID, or zero if there is no MMU
* support on the target.
*/
#define ADP_Info_SemiHosting ADPSUBREASON(CI_HADP,5)
/* ADP_Info_SemiHosting
* --------------------
* Summary: This message is used to check whether semi-hosting info calls
* are available on the target.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' returns RDIError_NoError if semi-hosting info calls are available,
* non-zero otherwise.
*/
#define ADP_Info_CoPro ADPSUBREASON(CI_HADP,6)
/* ADP_Info_CoPro
* --------------
* Summary: This message checks whether CoProcessor info calls are
* supported.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' returns RDIError_NoError to indicate these facilities
* are supported, non-zero otherwise.
*/
#define ADP_Info_Cycles ADPSUBREASON(CI_HADP,7)
/* ADP_Info_Cycles
* ---------------
* Summary: Returns the number of instructions and cycles executed since
* the target was initialised.
*
* Arguments:
* Send: ()
* Return: (word status, word ninstr, word Scycles, word Ncycles,
* word Icycles, word Ccycles, word Fcycles)
*
* 'status' is RDIError_NoError to indicate success, or non-zero if there
* is no target support for gathering cycle count information.
* 'ninstr' is the number of instructions executed.
* 'Scycles' is the number of S-cycles executed.
* 'Ncycles' is the number of N-cycles executed.
* 'Icycles' is the number of I-cycles executed.
* 'Ccycles' is the number of C-cycles executed.
* 'Fcycles' is the number of F-cycles executed.
*/
#define ADP_Info_DescribeCoPro ADPSUBREASON(CI_HADP,8)
/* ADP_Info_DescribeCoPro
* ----------------------
* Summary: Describe the registers of a coprocessor. Use only if
* ADP_Info_CoPro return RDIError_NoError.
*
* Arguments:
* Send: Arguments of the form:
* (byte cpno, byte rmin, byte rmax, byte nbytes, byte access,
* byte cprt_r_b0, byte cprt_r_b1, byte cprt_w_b0, byte cprt_w_b1)
* And a terminating byte = 0xff. Must be within maximum buffer size.
* Return: (word status)
*
* 'cpno' is the number of the coprocessor to be described.
* 'rmin' is the bottom of a range of registers with the same description.
* 'rmax' is the top of a range of registers with the same description.
* 'nbytes' is the size of the register.
* 'access' describes access to the register and is described in more detail
* below.
*
* If bit 2 of access is set:-
* 'cprt_r0' provides bits 0 to 7, and
* 'cprt_r1' provides bits 16 to 23 of a CPRT instruction to read the
* register.
* 'cprt_w0' provides bits 0 to 7, and
* 'cprt_w1' provides bits 16 to 23 of a CPRT instruction to write the
* register.
*
* Otherwise, 'cprt_r0' provides bits 12 to 15, and 'cprt_r1' bit 22 of CPDT
* instructions to read and write the register ('cprt_w0' and 'cprt_w1' are
* junk).
*/
/* 'access':- */
/* Readable. */
#define ADP_Info_DescribeCoPro_Readable (1 << 0)
/* Writeable. */
#define ADP_Info_DescribeCoPro_Writeable (1 << 1)
/* Registers read or written via CPDT instructions (else CPRT) with this
bit set. */
#define ADP_Info_DescribeCoPro_CPDT (1 << 2)
#define ADP_Info_RequestCoProDesc ADPSUBREASON(CI_HADP,9)
/* ADP_Info_RequestCoProDesc
* -------------------------
* Summary: Requests a description of the registers of a coprocessor. Use
* only if ADP_Info_CoPro return RDIError_NoError.
*
* Arguments:
* Send: (byte cpno)
* Return: Arguments of the form:-
* (word status, byte rmin, byte rmax, byte nbytes, byte access)
* Followed by a terminating byte = 0xFF. Must be within maximum
* buffer size.
* 'cpno' is the number of the coprocessor to describe.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'rmin' is the bottom of a range of registers with the same description.
* 'rmax' is the top of a range of registers with the same description.
* 'nbytes' is the size in bytes of the register(s).
* 'access' is as above in ADP_Info_DescribeCoPro.
*/
#define ADP_Info_AngelBufferSize ADPSUBREASON(CI_HADP,10)
/* ADP_Info_AngelBufferSize
* ------------------------
* Summary: Returns the Angel buffer sizes.
*
* Arguments:
* Send: ()
* Return: (word status, word defaultsize, word maxsize)
*
* 'status' returns RDIError_NoError to indicate success or non-zero to
* indicate some kind of error.
* 'defaultsize' is the default Angel ADP buffer size in bytes. This is
* at least 256 bytes.
* 'maxsize' is the largest Angel ADP buffer size in bytes. This will be
* greater than or equal to defaultsize. The target will accept ADP messages
* of up to this length for download, etc.
*
* Was DownLoadSize in RDP/RDI world. This is the amount that the target
* should transmit in a single operation. This should now be the Angel
* buffer size. This information is also given in the ADP_Booted message.
*
* NOTE: The value returned should be the DATASIZE and *NOT* BUFFERDEFSIZE.
* This is needed to ensure that the transport protocol information
* can be wrapped around the data.
*/
#define ADP_Info_ChangeableSHSWI ADPSUBREASON(CI_HADP,11)
/* ADP_Info_ChangeableSHSWI
* ------------------------
* Summary: This message is used to check whether it is possible to change
* which SWI's are used for semihosting.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' returns RDIError_NoError if semi-hosting info calls are available,
* non-zero otherwise.
*/
#define ADP_Info_CanTargetExecute ADPSUBREASON(CI_HADP,12)
/* ADP_Info_CanTargetExecute
* -------------------------
* Summary: This message is used to see if the target is currently in
* an executable state. Typically this is called after the debugger
* initialises. If a non-error statis is returned then the user is
* allowed to 'go' immediately.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' returns RDIError_NoError if target is ready to execute.
* other values indicate why it cannot execute.
*/
#define ADP_Info_AgentEndianess ADPSUBREASON(CI_HADP,13)
/* ADP_Info_AgentEndianess
* -------------------------
* Summary: This message is used to determine the endianess of the
* debug agent
* Arguments:
* Send: ()
* Return: (word status)
*
* status should be RDIError_LittleEndian or RDIError_BigEndian
* any other value indicates the target does not support this
* request, so the debugger will have to make a best guess, which
* probably means only allow little endian loadagenting.
*/
#define ADP_Control ADPREASON(CI_HADP,2)
/* This message allows for the state of the debug agent to be
* manipulated by the host.
*/
/* The following are sub reason codes to ADP control, the first parameter
* is the sub reason code which defines the format of subsequent parameters.
*
* word sub reason code
*/
#define ADP_Ctrl_NOP ADPSUBREASON(CI_HADP,0)
/* ADP_Ctrl_NOP
* ------------
* Summary: This message is used to check that ADP_Ctrl messages are
* supported.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate ADP_Ctrl messages are
* supported, non-zero otherwise.
*/
#define ADP_Ctrl_VectorCatch ADPSUBREASON(CI_HADP,1)
/* ADP_Ctrl_VectorCatch
* --------------------
* Summary: Specifies which hardware exceptions should be reported to the
* debugger.
*
* Arguments:
* Send: (word bitmap)
* Return: (word status)
*
* 'bitmap' is a bit-mask of exceptions to be reported, described in more
* detail below. A set bit indicates that the exception should be
* reported to the debugger, a clear bit indicates that the corresponding
* exception vector should be taken.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
/* 'bitmap':- */
/* Reset(branch through zero). */
#define ADP_Ctrl_VectorCatch_BranchThroughZero (1 << 0)
/* Undefined Instruction. */
#define ADP_Ctrl_VectorCatch_UndefinedInstr (1 << 1)
/* Software Interrupt. */
#define ADP_Ctrl_VectorCatch_SWI (1 << 2)
/* Prefetch Abort. */
#define ADP_Ctrl_VectorCatch_PrefetchAbort (1 << 3)
/* Data Abort. */
#define ADP_Ctrl_VectorCatch_DataAbort (1 << 4)
/* Address Exception. */
#define ADP_Ctrl_VectorCatch_AddressException (1 << 5)
/* Interrupt Request. */
#define ADP_Ctrl_VectorCatch_IRQ (1 << 6)
/* Fast Interrupt Request. */
#define ADP_Ctrl_VectorCatch_FIQ (1 << 7)
/* Error. */
#define ADP_Ctrl_VectorCatch_Error (1 << 8)
#define ADP_Ctrl_PointStatus_Watch ADPSUBREASON(CI_HADP,2)
/* ADP_Ctrl_PointStatus_Watch
* --------------------------
* Summary: Returns the hardware resource number and the type of that
* resource when given a watchpoint handle. Should only be called if
* the value returned by ADP_Info_Points had ADP_Info_Points_Status set.
*
* Arguments:
* Send: (word handle)
* Return: (word status, word hwresource, word type)
*
* 'handle' is a handle to a watchpoint.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'hwresource' is the hardware resource number. !!!!!
* 'type' is the type of the resource.
*/
#define ADP_Ctrl_PointStatus_Break ADPSUBREASON(CI_HADP,3)
/* ADP_Ctrl_PointStatus_Break
* --------------------------
* Summary: Returns the hardware resource number and the type of that
* resource when given a breakpoint handle. Should only be called if
* the value returned by ADP_Info_Points had ADP_Info_Points_Status set.
*
* Arguments:
* Send: (word handle)
* Return: (word status, word hwresource, word type)
*
* 'handle' is a handle to a breakpoint.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'hwresource' is the hardware resource number.
* 'type' is the type of the resource.
*/
#define ADP_Ctrl_SemiHosting_SetState ADPSUBREASON(CI_HADP,4)
/* ADP_Ctrl_SemiHosting_SetState
* -----------------------------
* Summary: Sets whether or not semi-hosting is enabled.
*
* Arguments:
* Send: (word semihostingstate)
* Return: (word status)
*
* 'semihostingstate' sets semi-hosting to enabled if zero, otherwise
* it disables semi-hosting.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_GetState ADPSUBREASON(CI_HADP,5)
/* ADP_Ctrl_SemiHosting_GetState
* -----------------------------
* Summary: Reads whether or not semi-hosting is enabled.
*
* Arguments:
* Send: ()
* Return: (word status, word semihostingstate)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'semihostingstate' is zero if semi-hosting is enabled, non-zero otherwise.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_SetVector ADPSUBREASON(CI_HADP,6)
/* ADP_Ctrl_SemiHosting_SetVector
* ------------------------------
* Summary: Sets the semi-hosting vector.
*
* Arguments:
* Send: (word semihostingvector)
* Return: (word status)
*
* 'semihostingvector' holds the value the vector is to be set to.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_GetVector ADPSUBREASON(CI_HADP,7)
/* ADP_Ctrl_SemiHosting_GetVector
* ------------------------------
* Summary: Gets the value of the semi-hosting vector.
*
* Arguments:
* Send: ()
* Return: (word status, word semihostingvector)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'semihostingvector' holds the value of the vector.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_Log ADPSUBREASON(CI_HADP,8)
/* ADP_Ctrl_Log
* ------------
* Summary: Returns the logging state.
*
* Arguments:
* Send: ()
* Return: (word status, word logsetting)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'logsetting' is a bitmap specifying the level of logging desired,
* described in more detail below. The bits can be ORed together
*/
/* 'logsetting':- */
/* No logging. */
#define ADP_Ctrl_Log_NoLogging (0)
/* RDI level logging. */
#define ADP_Ctrl_Log_RDI (1 << 0)
/* ADP byte level logging. */
#define ADP_Ctrl_Log_ADP (1 << 1)
#define ADP_Ctrl_SetLog ADPSUBREASON(CI_HADP,9)
/* ADP_Ctrl_SetLog
* ---------------
* Summary: Sets the logging state.
*
* Arguments:
* Send: (word logsetting)
* Return: (word status)
*
* 'logsetting' is the same as in ADP_Ctrl_Log above.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_Ctrl_SemiHosting_SetARMSWI ADPSUBREASON(CI_HADP,10)
/* ADP_Ctrl_SemiHosting_SetARMSWI
* ------------------------------
* Summary: Sets the number of the ARM SWI used for semihosting
*
* Arguments:
* Send: (word ARM_SWI_number)
* Return: (word status)
*
* The debug agent will interpret ARM SWI's with the SWI number specified
* as semihosting SWI's.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: This should only be called if ADP_Info_ChangeableSHSWI didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_GetARMSWI ADPSUBREASON(CI_HADP,11)
/* ADP_Ctrl_SemiHosting_GetARMSWI
* ------------------------------
* Summary: Reads the number of the ARM SWI used for semihosting
*
* Arguments:
* Send: ()
* Return: (word status, word ARM_SWI_number)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* ARM_SWI_number is the SWI number which is used for semihosting.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_SetThumbSWI ADPSUBREASON(CI_HADP,12)
/* ADP_Ctrl_SemiHosting_SetThumbSWI
* --------------------------------
* Summary: Sets the number of the Thumb SWI used for semihosting
*
* Arguments:
* Send: (word Thumb_SWI_number)
* Return: (word status)
*
* The debug agent will interpret Thumb SWI's with the SWI number specified
* as semihosting SWI's.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: This should only be called if ADP_Info_ChangeableSHSWI didn't return
* an error.
*/
#define ADP_Ctrl_SemiHosting_GetThumbSWI ADPSUBREASON(CI_HADP,13)
/* ADP_Ctrl_SemiHosting_GetThumbSWI
* --------------------------------
* Summary: Reads the number of the Thumb SWI used for semihosting
*
* Arguments:
* Send: ()
* Return: (word status, word ARM_Thumb_number)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* Thumb_SWI_number is the SWI number which is used for semihosting.
*
* NOTE: This should only be called if ADP_Info_SemiHosting didn't return
* an error.
*/
#define ADP_Ctrl_Download_Supported ADPSUBREASON(CI_HADP,14)
/* ADP_Ctrl_Download_Supported
* ---------------------------
* Summary: Can configuration be downloaded?
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError if the configuration can be downloaded,
* non-zero otherwise.
*
* NOTE: Equivalent to RDIInfo_DownLoad.
*/
#define ADP_Ctrl_Download_Data ADPSUBREASON(CI_HADP,15)
/* ADP_Ctrl_Download_Data
* ----------------------
* Summary: Loads configuration data.
*
* Arguments:
* Send: (word nbytes, words data)
* Return: (word status)
*
* 'nbytes' is the number of *bytes* being sent.
* 'data' is the configuration data. NOTE: data must not cause the buffer
* size to exceed the maximum allowed buffer size.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDP_LoadConfigData. Should only be used if
* ADP_ICEM_AddConfig didn't return an error.
*/
#define ADP_Ctrl_Download_Agent ADPSUBREASON(CI_HADP,16)
/* ADP_Ctrl_Download_Agent
* -----------------------
* Summary: Prepares Debug Agent to receive configuration data which it
* should interpret as a new version of the Debug Agent code.
*
* Arguments:
* Send: (word loadaddress, word size)
* Return: (word status)
*
* 'loadaddress' is the address where the new Debug Agent code should be
* loaded.
* 'size' is the number of bytes of Debug Agent code to be loaded.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDP_LoadAgent. The data will be downloaded using
* ADP_Ctrl_Download_Data. The new agent is started with ADP_Ctrl_Start_Agent
*/
#define ADP_Ctrl_Start_Agent ADPSUBREASON(CI_HADP,17)
/* ADP_Ctrl_Start_Agent
* -----------------------
* Summary: Instruct Debug Agent to begin execution of new agent,
* which has been downloaded by ADP_Ctrl_Download_Agent.
*
* Arguments:
* Send: (word startaddress)
* Return: (word status)
*
* 'startaddress' is the address where the new Debug Agent code should be
* entered, and must satisfy:
* (loadaddress <= startaddress <= (loadaddress + size))
* where 'loadaddress' and 'size' were specified in the
* ADP_Ctrl_Download_Agent message.
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_Ctrl_SetTopMem ADPSUBREASON(CI_HADP,18)
/* ADP_Ctrl_SetTopMem
* ------------------
* Summary: Sets the top of memory for ICEman2 systems, so that the C Library
* can allocate the stack in the correct place on startup.
*
* Arguments:
* Send: (word mem_top)
* Return: (word status)
*
* This request should only be supported by ICEman2. Standard Angel systems
* should return an error (unrecognised is fine).
*/
#define ADP_Read ADPREASON(CI_HADP,3)
#define ADP_ReadHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
/* ADP_Read
* --------
* Summary: Request for a transer of memory contents from the target to the
* debugger.
*
* Arguments:
* Send: (word address, word nbytes)
* Return: (word status, word rnbytes [, bytes data])
*
* 'address' is the address from which memory transer should start.
* 'nbytes' is the number of bytes to transfer.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'rnbytes' holds the number of requested bytes NOT read (i.e. zero
* indicates success, non-zero indicates an error).
* 'data' is the number of bytes requested minus 'rnbytes'.
*/
#define ADP_Write ADPREASON(CI_HADP,4)
#define ADP_WriteHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
/* ADP_Write
* ---------
* Summary: Request for a transfer of memory contents from the debugger to
* the target.
*
* Arguments:
* Send: (word address, word nbytes, bytes data)
* Return: (word status [, word rnbytes])
*
* 'address' is the address from which memory transer should start.
* 'nbytes' is the number of bytes to transfer.
* 'data' holds the bytes to be transferred.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'rnbytes' holds the number of requested bytes NOT written (i.e. zero
* indicates success, non-zero indicates an error) if status indicated an
* error.
*/
#define ADP_CPUread ADPREASON(CI_HADP,5)
/* ADP_CPUread
* -----------
* Summary: This is a request to read values in the CPU.
*
* Arguments:
* Send: (byte mode, word mask)
* Return: (word status, words data)
*
* 'mode' defines the processor mode from which the transfer should be made.
* It is described in more detail below.
* 'mask' indicates which registers should be transferred. Setting a bit to
* one will cause the designated register to be transferred. The details
* of mask are specified below.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'data' holds the values of the registers on successful completion,
* otherwise it just holds rubbish. The lowest numbered register is
* transferred first. NOTE: data must not cause the buffer size to exceed
* the maximum allowed buffer size.
*/
/* 'mode':- */
/* The mode number is the same as the mode number used by an ARM; a value of
255 indicates the current mode. */
#define ADP_CPUmode_Current (255)
/* 26bit user mode. */
#define ADP_CPUread_26bitUser (0x0)
/* 26bit FIQ mode. */
#define ADP_CPUread_26bitFIQ (0x1)
/* 26bit IRQ mode. */
#define ADP_CPUread_26bitIRQ (0x2)
/* 26bit Supervisor mode. */
#define ADP_CPUread_26bitSVC (0x3)
/* 32bit user mode. */
#define ADP_CPUread_32bitUser (0x10)
/* 32bit FIQ mode. */
#define ADP_CPUread_32bitFIQ (0x11)
/* 32bit IRQ mode. */
#define ADP_CPUread_32bitIRQ (0x12)
/* 32bit Supervisor mode. */
#define ADP_CPUread_32bitSVC (0x13)
/* 32bit Abort mode. */
#define ADP_CPUread_32bitAbort (0x17)
/* 32bit Undefined mode. */
#define ADP_CPUread_32bitUndef (0x1B)
/* #32bit System mode - Added in Architecture 4 ARMs e.g.ARM7TDMI */
#define ADP_CPUread_32bitSystem (0x1F)
/* 'mask':- */
/* Request registers RO-R14. */
#define ADP_CPUread_RegsMask (0x7FFF)
/* Request Program Counter (including mode and flag bits in 26-bit modes. */
#define ADP_CPUread_PCmode (1 << 15)
/* Request Program Counter (without mode and flag bits in 26-bit modes. */
#define ADP_CPUread_PCnomode (1 << 16)
/* Requests the transfer of the CPSR */
#define ADP_CPUread_CPSR (1 << 17)
/* In processor modes with an SPSR(non-user modes), bit 19 requests its
transfer */
#define ADP_CPUread_SPSR (1 << 18)
#define ADP_CPUwrite ADPREASON(CI_HADP,6)
/* ADP_CPUwrite
* ------------
* Summary: This is a request to write values to the CPU.
*
* Arguments:
* Send: (byte mode, word mask, words data)
* Return: (word status)
*
* 'mode' defines the processor mode to which the transfer should be made.
* The mode number is the same as the mode number used by ARM; a value of
* 255 indicates the current mode. See ADP_CPUread above for more detail.
* 'mask' indicates which registers should be transferred. Setting a bit to
* one will cause the designated register to be transferred. The details
* of mask are specified above in ADP_CPUread.
* 'data' holds the values of the registers to be transferred. The first
* value is written to the lowest numbered register. NOTE: data must not
* cause the buffer size to exceed the maximum allowed buffer size.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_CPread ADPREASON(CI_HADP,7)
/* ADP_CPread
* ----------
* Summary: This message requests a co-processors internal state.
*
* Arguments:
* Send: (byte CPnum, word mask)
* Return: (word status, words data)
*
* 'CPnum' is the number of the co-processor to transfer values from.
* 'mask' specifies which registers to transfer and is co-processor
* specific.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'data' holds the registers specified in 'mask' if successful, otherwise
* just rubbish. The lowest numbered register is transferred first.
* NOTE: data must not cause the buffer size to exceed the maximum allowed
* buffer size.
*/
#define ADP_CPwrite ADPREASON(CI_HADP,8)
/* ADP_CPwrite
* -----------
* Summary: This message requests a write to a co-processors internal state.
*
* Arguments:
* Send: (byte CPnum, word mask, words data)
* Return: (word status)
*
* 'CPnum' is the number of the co-processor to transfer values to.
* 'mask' specifies which registers to transfer and is co-processor
* specific.
* 'data' holds the values to transfer to the registers specified in 'mask'.
* The first value is written to the lowest numbered register.
* NOTE: data must not cause the buffer size to exceed the maximum allowed
* buffer size.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_SetBreak ADPREASON(CI_HADP,9)
/* ADP_SetBreak
* ------------
* Summary: Sets a breakpoint.
*
* Arguments:
* Send: (word address, byte type [, word bound])
* Return: (word status, word pointhandle, word raddress, word rbound)
*
* 'address' is the address of the instruction to set the breakpoint on.
* 'type' specifies the sort of breakpoint and is described in more detail
* below.
* 'bound' is included if the least significant 4 bits of type are set to
* 5 or above (see below for more detail).
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'pointhandle' returns a handle to the breakpoint, it will be valid if bit
* 7 of 'type' is set. See below for more detail.
* 'raddress' is valid depending on 'type', see below for more detail.
* 'rbound' is valid depending on 'type', see below for more detail.
*/
/* 'type':- */
/* The least significant 4 bits define the sort of breakpoint to set:- */
/* Halt if the pc is equal to 'address'. */
#define ADP_SetBreak_EqualsAddress (0)
/* Halt if the pc is greater than 'address'. */
#define ADP_SetBreak_GreaterAddress (1)
/* Halt if the pc is greater than or equal to 'address'. */
#define ADP_SetBreak_GEqualsAddress (2)
/* Halt if the pc is less than 'address'. */
#define ADP_SetBreak_LessAddress (3)
/* Halt if the pc is less than or equal to 'address'. */
#define ADP_SetBreak_LEqualsAddress (4)
/* Halt if the pc is in the range from 'address' to 'bound' inclusive. */
#define ADP_SetBreak_Range (5)
/* Halt if the pc is not in the range from 'address' to 'bound' inclusive. */
#define ADP_SetBreak_NotRange (6)
/* Halt if (pc & 'bound') = 'address'. */
#define ADP_SetBreak_AndBound (7)
/* Bits 5,6 and 7 are used as follows :- */
/* If set this indicates that the breakpoint is on a 16bit (Thumb)
instruction rather than a 32bit (ARM) instruction. */
#define ADP_SetBreak_Thumb (1 << 4)
/* This requests that the breakpoint should be conditional (execution halts
only if the breakpointed instruction is executed, not if it is
conditionally skipped). If bit 5 is not set, execution halts whenever
the breakpointed instruction is reached (whether executed or skipped). */
#define ADP_SetBreak_Cond (1 << 5)
/* This requests a dry run: the breakpoint is not set and the 'raddress', and
if appropriate the 'rbound', that would be used, are returned (for
comparison and range breakpoints the address and bound used need not be
exactly as requested). A RDIError_NoError 'status' byte indicates that
resources are currently available to set the breakpoint, non-zero
indicates an error. RDIError_NoMorePoints indicates that the required
breakpoint resources are not currently available. */
#define ADP_SetBreak_DryRun (1 << 6)
/* If the request is successful, but there are no more breakpoint registers
(of the requested type), then the value RDIError_NoMorePoints is
returned. */
/* If a breakpoint is set on a location which already has a breakpoint, the
first breakpoint will be removed before the new breakpoint is set. */
#define ADP_ClearBreak ADPREASON(CI_HADP,10)
/* ADP_ClearBreak
* --------------
* Summary: Clears a breakpoint.
*
* Arguments:
* Send: (word pointhandle)
* Return: (word status)
*
* 'pointhandle' is a handle returned by a previous ADP_SetBreak.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_SetWatch ADPREASON(CI_HADP,11)
/* ADP_SetWatch
* ------------
* Summary: Sets a watchpoint.
*
* Arguments:
* Send: (word address, byte type, byte datatype [,word bound])
* Return: (word status, word pointhandle, word raddress, word rbound)
*
* 'address' is the address at which to set the watchpoint.
* 'type' is the type of watchpoint to set and is described in detail below.
* 'datatype' defines the sort of data access to watch for and is described
* in more detail below.
* 'bound' is included depending on the value of type (see description of
* type below).
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'pointhandle' is valid depending on the value of type (see description
* of type below).
* 'raddress' is valid depending on the value of type (see description
* of type below).
* 'rbound' is valid depending on the value of type (see description
* of type below).
*/
/* 'type':- */
/* The least significant 4 bits of 'type' define the sort of watchpoint to
set:- */
/* Halt on a data access to the address equal to 'address'. */
#define ADP_SetWatch_EqualsAddress (0)
/* Halt on a data access to an address greater than 'address'. */
#define ADP_SetWatch_GreaterAddress (1)
/* Halt on a data access to an address greater than or equal to 'address'. */
#define ADP_SetWatch_GEqualsAddress (2)
/* Halt on a data access to an address less than 'address'. */
#define ADP_SetWatch_LessAddress (3)
/* Halt on a data access to an address less than or equal to 'address'. */
#define ADP_SetWatch_LEqualsAddress (4)
/* Halt on a data access to an address in the range from 'address' to
'bound' inclusive. */
#define ADP_SetWatch_Range (5)
/* Halt on a data access to an address not in the range from 'address' to
'bound' inclusive. */
#define ADP_SetWatch_NotRange (6)
/* Halt if (data-access-address & 'bound')='address'. */
#define ADP_SetWatch_AndBound (7)
/* Bits 6 and 7 of 'type' also have further significance:-
NOTE: they must not be simulataneously set. */
/* Bit 6 of 'type' set: Requests a dry run: the watchpoint is not set and
the 'address' and, if appropriate, the 'bound', that would be used are
returned (for range and comparison watchpoints, the 'address' and 'bound'
used need not be exactly as requested). A RDIError_NoError status byte
indicates that resources are currently available to set the watchpoint;
RDIError_NoMorePoints indicates that the required watchpoint resources
are not currently available. */
/* Bit 7 of 'type' set: Requests that a handle should be returned for the
watchpoint by which it will be identified subsequently. If bit 7 is
set, a handle will be returned ('pointhandle'), whether or not the
request succeeds or fails (but, obviously, it will only be meaningful
if the request succeesd). */
/* 'datatype':- */
/* The 'datatype' argument defines the sort of data access to watch for,
values can be summed or ORed together to halt on any set of sorts of
memory access. */
/* Watch for byte reads. */
#define ADP_SetWatch_ByteReads (1)
/* Watch for half-word reads. */
#define ADP_SetWatch_HalfWordReads (2)
/* Watch for word reads. */
#define ADP_SetWatch_WordReads (4)
/* Watch for half-word reads. */
#define ADP_SetWatch_ByteWrites (8)
/* Watch for half-word reads. */
#define ADP_SetWatch_HalfWordWrites (16)
/* Watch for half-word reads. */
#define ADP_SetWatch_WordWrites (32)
/* On successful completion a RDIError_NoError 'status' byte is returned. On
unsuccessful completion, a non-zero error code byte is returned. If the
request is successful, but there are now no more watchpoint registers
(of the requested type), then the value RDIError_NoMorePoints is
returned. */
/* If a watchpoint is set on a location which already has a watchpoint, the
first watchpoint will be removed before the new watchpoint is set. */
#define ADP_ClearWatch ADPREASON(CI_HADP,12)
/* ADP_ClearWatch
* --------------
* Summary: Clears a watchpoint.
*
* Arguments:
* Send: (word pointhandle)
* Return: (word status)
*
* 'pointhandle' is a handle to a watchpoint returned by a previous
* ADP_SetWatch.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_Execute ADPREASON(CI_HADP,13)
/* ADP_Execute
* -----------
* Summary: This message requests that the target starts executing from
* the stored CPU state.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* The message will *ALWAYS* respond immediately with an ACK (unlike the
* old RDI definition, which allowed asynchronous message replies).
*
* Execution will stop when allowed system events occur. The host will
* be notified via a ADP_Stopped message (described below).
*/
#define ADP_Step ADPREASON(CI_HADP,14)
/* ADP_Step
* --------
* Summary: Execute 'ninstr' instructions.
*
* Arguments:
* Send: (word ninstr)
* Return: (word status)
*
* 'ninstr' is the number of instructions to execute, starting at the
* address currently loaded into the CPU program counter. If it is zero,
* the target should execute instructions upto the next instruction that
* explicitly alters the Program Counter. i.e. a branch or ALU operation
* with the PC as the destination.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* The ADP_Step function (unlike the earlier RDI system) will *ALWAYS*
* return an ACK immediately. A subsequent ADP_Stopped message will be
* delivered from the target to the host when the ADP_Step operation
* has completed.
*/
#define ADP_InterruptRequest ADPREASON(CI_HADP,15)
/* ADP_InterruptRequest
* --------------------
* Summary: Interrupt execution.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* On receiving this message the target should attempt to stop execution.
*/
#define ADP_HW_Emulation ADPREASON(CI_HADP,16)
/* ADP_HW_Emulation
* ----------------
* The first parameter to ADP_HW_Emulation is a Reason Subcode, and
* subsequent parameters are defined by that subcode
*
* word reason subcode
* other arguments as reason subcode determines
*
*/
/* ADP__HW_Emulation sub-reason codes: */
#define ADP_HW_Emul_Supported ADPSUBREASON(CI_HADP,0)
/* ADP_HW_Emul_Supported
* ---------------------
* Summary: Enquires whether calls to the next 4 messages are available
* (MemoryAccess, MemoryMap, Set_CPUspeed, ReadClock).
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate the messages are available,
* non-zero otherwise.
*
* NOTE: Equivalent to RDI_Info_Memory_Stats.
*/
#define ADP_HW_Emul_MemoryAccess ADPSUBREASON(CI_HADP,1)
/* ADP_HW_Emul_MemoryAccess
* ------------------------
* Summary: Get memory access information for memory block with specified
* handle.
*
* Arguments:
* Send: (word handle)
* Return: (word status, word nreads, word nwrites, word sreads,
* word swrites, word ns, word s)
*
* 'handle' is a handle to a memory block.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'nreads' is the number of non-sequential reads.
* 'nwrites' is the number of non-sequential writes.
* 'sreads' is the number of sequential reads.
* 'swrites' is the number of sequential writes.
* 'ns' is time in nano seconds.
* 's' is time in seconds.
*
* NOTE: Equivalent to RDIMemory_Access.
*/
#define ADP_HW_Emul_MemoryMap ADPSUBREASON(CI_HADP,2)
/* ADP_HW_Emul_MemoryMap
* ---------------------
* Summary: Sets memory characteristics.
*
* Arguments:
* Send: (word n,
Then 'n' sets of arguments of the form:-
word handle, word start, word limit, byte width,
byte access, word Nread_ns, word Nwrite_ns, word Sread_ns,
word Swrite_ns)
* Return: (word status)
*
* 'n' is the number of sets of arguments.
* 'handle' is a handle to the region.
* 'start' is the start of this region.
* 'limit' is the limit of this region.
* 'width' is the memory width, described in detail below.
* 'access' is described in detail below.
* 'Nread_ns' is the access time for N read cycles in nano seconds.
* 'Nwrite_ns' is the access time for N write cycles in nano seconds.
* 'Sread_ns' is the access time for S read cycles in nano seconds.
* 'Swrite_ns' is the access time for S write cycles in nano seconds.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* NOTE: Equivalent to RDIMemory_Map.
*/
/* 'width':- */
/* 8 bit memory width. */
#define ADP_HW_Emul_MemoryMap_Width8 (0)
/* 16 bit memory width. */
#define ADP_HW_Emul_MemoryMap_Width16 (1)
/* 32 bit memory width. */
#define ADP_HW_Emul_MemoryMap_Width32 (2)
/* 'access':- */
/* Bit 0 - read access. */
#define ADP_HW_Emul_MemoryMap_Access_Read (1 << 0)
/* Bit 1 - write access. */
#define ADP_HW_Emul_MemoryMap_Access_Write (1 << 1)
/* Bit 2 - latched 32 bit memory. */
#define ADP_HW_Emul_MemoryMap_Access_Latched (1 << 2)
#define ADP_HW_Emul_SetCPUSpeed ADPSUBREASON(CI_HADP,3)
/* ADP_HW_Emul_SetCPUSpeed
* -----------------------
* Summary: Sets the speed of the CPU.
*
* Arguments:
* Send: (word speed)
* Return: (word status)
*
* 'speed' is the CPU speed in nano seconds.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDISet_CPUSpeed.
*/
#define ADP_HW_Emul_ReadClock ADPSUBREASON(CI_HADP,4)
/* ADP_HW_Emul_ReadClock
* ---------------------
* Summary: Reads simulated time.
*
* Arguments:
* Send: ()
* Return: (word status, word ns, word s)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'ns' is time in nano seconds.
* 's' is time in seconds.
*
* NOTE: Equivalent to RDIRead_Clock.
*/
#define ADP_ICEbreakerHADP ADPREASON(CI_HADP,17)
/* The first parameter to ADP_ICEbreaker is a Reason Subcode, and
* subsequent parameters are defined by that subcode
*
* word reason subcode
* other arguments as reason subcode determines
*
*/
/* ADP_ICEbreaker sub-reason codes: */
#define ADP_ICEB_Exists ADPSUBREASON(CI_HADP,0)
/* ADP_ICEB_Exists
* ---------------
* Summary: Is there an ICEbreaker in the system?
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate there is an ICEbreaker,
* non-zero otherwise.
*/
#define ADP_ICEB_GetLocks ADPSUBREASON(CI_HADP,1)
/* ADP_ICEB_GetLocks
* -----------------
* Summary: Returns which ICEbreaker registers are locked.
*
* Arguments:
* Send: ()
* Return: (word status, word lockedstate)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'lockedstate' is a bitmap if the ICEbreaker registers locked against use
* by IceMan (because explicitly written by the user). Bit n represents
* hardware breakpoint n, and if set the register is locked.
*
* NOTE: Equivalent to RDIIcebreaker_GetLocks. Should only be used if
* ADP_ICEB_Exists didn't return an error.
*/
#define ADP_ICEB_SetLocks ADPSUBREASON(CI_HADP,2)
/* ADP_ICEB_SetLocks
* -----------------
* Summary: Sets which ICEbreaker registers are locked.
*
* Arguments:
* Send: (word lockedstate)
* Return: (word status)
*
* 'lockedstate' is the same as in ADP_ICEB_GetLocks above.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDIIcebreaker_SetLocks. Should only be used if
* ADP_ICEB_Exists didn't return an error.
*/
#define ADP_ICEB_CC_Exists ADPSUBREASON(CI_HADP,3)
/* ADP_ICEB_CC_Exists
* ------------------
* Summary: Is there an ICEbreaker Comms Channel?
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate there is a Comms Channel,
* non-zero otherwise.
*
* NOTE: Should only be used if ADP_ICEB_Exists didn't return an error.
*/
#define ADP_ICEB_CC_Connect_ToHost ADPSUBREASON(CI_HADP,4)
/* ADP_ICEB_CC_Connect_ToHost
* --------------------------
* Summary: Connect Comms Channel in ToHost direction.
*
* Arguments:
* Send: (byte connect)
* Return: (word status)
*
* 'connect' !!!!!
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDICommsChannel_ToHost. Should only be used if
* ADP_ICEB_CC_Exists didn't return an error.
*/
#define ADP_ICEB_CC_Connect_FromHost ADPSUBREASON(CI_HADP,5)
/* ADP_ICEB_CC_Connect_FromHost
* ----------------------------
* Summary: Connect Comms Channel in FromHost direction.
*
* Arguments:
* Send: (byte connect)
* Return: (word status)
*
* 'connect' is the same as in ADP_ICEB_CC_Connect_ToHost above.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDICommsChannel_FromHost. Should only be used if
* ADP_ICEB_CC_Exists didn't return an error.
*/
#define ADP_ICEman ADPREASON(CI_HADP,18)
/* The first parameter to ADP_ICEman is a Reason Subcode, and
* subsequent parameters are defined by that subcode
*
* word reason subcode
* other arguments as reason subcode determines
*
*/
/* ADP_ICEman sub-reason codes: */
#define ADP_ICEM_AddConfig ADPSUBREASON(CI_HADP,0)
/* ADP_ICEM_AddConfig
* ------------------
* Summary: Prepares target to receive configuration data block.
*
* Arguments:
* Send: (word nbytes)
* Return: (word status)
*
* 'nbytes' is the number of bytes in the configuration block.
* 'status' is RDIError_NoError to indicate success, non-zero if a
* configuration block of this size can't be accepted.
*
* NOTE: Equivalent to RDP_AddConfig.
*/
#define ADP_ICEM_SelectConfig ADPSUBREASON(CI_HADP,1)
/* ADP_ICEM_SelectConfig
* ---------------------
* Summary: Selects one of the sets of configuration data blocks and
* reinitialises to use the new configuration.
*
* Arguments:
* Send: (byte aspect, byte namelen, byte matchtype, word vsn_req,
bytes name)
* Return: (word status, word vsn_sel)
*
* 'aspect' is one of two values defined below.
* 'namelen' is the number of bytes in 'name'.
* 'matchtype' specifies how the selected version must match that specified,
* and takes one of the values defined below.
* 'vsn_req' is the requested version of the named configuration.
* 'name' is the name of the configuration.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'vsn_sel' is the version number of the configuration selected on success.
*
* NOTE: Equivalent to RDP_SelectConfig.
*/
/* 'aspect':- */
#define ADP_ICEM_SelectConfig_ConfigCPU (0)
#define ADP_ICEM_SelectConfig_ConfigSystem (1)
/* 'matchtype':- */
#define ADP_ICEM_SelectConfig_MatchAny (0)
#define ADP_ICEM_SelectConfig_MatchExactly (1)
#define ADP_ICEM_SelectConfig_MatchNoEarlier (2)
#define ADP_ICEM_ConfigCount ADPSUBREASON(CI_HADP,2)
/* ADP_ICEM_ConfigCount
* --------------------
* Summary: Return number of configurations.
*
* Arguments:
* Send: ()
* Return: (word status [, word count])
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'count' returns the number of configurations if status is zero.
*
* NOTE: Equivalent to RDIConfig_Count.
*/
#define ADP_ICEM_ConfigNth ADPSUBREASON(CI_HADP,3)
/* ADP_ICEM_ConfigNth
* ------------------
* Summary: Gets the nth configuration details.
*
* Arguments:
* Send: (word confign)
* Return: (word status, word version, byte namelen, bytes name)
*
* 'confign' is the number of the configuration.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'version' is the configuration version number.
* 'namelen' is the number of bytes in 'name'.
* 'name' is the name of the configuration.
*
* NOTE: Equivalent to RDIConfig_Nth.
*/
#define ADP_Profile ADPREASON(CI_HADP,19)
/* The first parameter to ADP_Profile is a Reason Subcode, and
* subsequent parameters are defined by that subcode
*
* word reason subcode
* other arguments as reason subcode determines
*
*/
/* ADP_Profile sub-reason codes: */
#define ADP_Profile_Supported ADPSUBREASON(CI_HADP,0)
/* ADP_Profile_Supported
* ---------------------
* Summary: Checks whether profiling is supported.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError if profiling is supported, non-zero otherwise.
*
* NOTE: Can also be determined using Info_Target.
*/
#define ADP_Profile_Stop ADPSUBREASON(CI_HADP,1)
/* ADP_Profile_Stop
* ----------------
* Summary: Stops profiling.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDIProfile_Stop.
*/
#define ADP_Profile_Start ADPSUBREASON(CI_HADP,2)
/* ADP_Profile_Start
* -----------------
* Summary: Starts profiling (PC sampling).
*
* Arguments:
* Send: (word interval)
* Return: (word status)
*
* 'interval' is the period of PC sampling in micro seconds.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDIProfile_Start.
*/
#define ADP_Profile_WriteMap ADPSUBREASON(CI_HADP,3)
#define ADP_ProfileWriteHeaderSize (ADP_DEFAULT_HEADER_SIZE + 4*sizeof(word))
/* ADP_Profile_WriteMap
* --------------------
* Summary: Downloads a map array, which describes the PC ranges for profiling.
*
* Arguments: A number of messages each of form:-
* Send: (word len, word size, word offset, words map_data)
* Return: (word status)
*
* 'len' is the number of elements in the entire map array being downloaded.
* 'size' is the number of words being downloaded in this message, i.e. the
* length of 'map_data'.
* 'offset' is the offset into the entire map array which this message starts
* from, in words.
* 'map_data' consists of 'size' words of map data.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDIProfile_WriteMap.
*/
#define ADP_Profile_ReadMap ADPSUBREASON(CI_HADP,4)
#define ADP_ProfileReadHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
/* ADP_Profile_ReadMap
* -------------------
* Summary: Uploads a set of profile counts which correspond to the current
* profile map.
*
* Arguments: A number of messages, each of the form:
* Send: (word offset, word size)
* Return: (word status, words counts)
*
* 'offset' is the offset in the entire array of counts that this message
* starts from, in words.
* 'size' is the number of words uploaded in this message (in counts).
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'counts' is 'size' words of profile counts.
*
* NOTE: Equivalent to RDIProfile_ReadMap.
*/
#define ADP_Profile_ClearCounts ADPSUBREASON(CI_HADP,5)
/* ADP_Profile_ClearCounts
* -----------------------
* Summary: Requests that PC sample counts be set to zero.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDIProfile_ClearCounts.
*/
#define ADP_InitialiseApplication ADPREASON(CI_HADP,20)
/* ADP_InitialiseApplication
* -------------------------
* Summary: Requests that OS setup up the thread/task so that it can be
* executed.
*
* Arguments:
* Send: ()
* Return: (word status)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
#define ADP_End ADPREASON(CI_HADP,21)
/* ADP_End
* -------
* Summary: Sent by the host debugger to tell angel this debugging session
* is is finished
* Arguments:
* Send: ()
* Return: (word status)
* status' is RDIError_NoError to indicate success, non-zero otherwise.
*/
/******************************************************************
*
* CI_TADP messages
*
*/
#define ADP_TADPUnrecognised ADPREASON(CI_TADP,0)
/* This message is unusual in that it is normally sent in reply to
* another message which is not understood. This is an exception
* to the normal protocol which says that a reply must have the
* same base reason code as the original. There is a single reply
* parameter which is the reason code which was not understood.
*
* As well as being a reply this message can also be sent and will
* return as if this message were unrecognised!
*
* Parameters:
* none
*
* Reply:
* word reason code which was not recognised
*/
/*-------------------------------------------------------------------------*/
#define ADP_Stopped ADPREASON(CI_TADP,1)
/* ADP_Stopped
* -----------
* Summary: This message is sent to the host when the application stops,
* either naturally or due to an exception.
*
* Parameters:
* word reason subcode
* other arguments as reason subcode determines.
* Unless stated otherwise (below) there will be none.
*
* Reply:
* word status unless reason subcode says otherwise
*
* This message is sent to the host when execution has stopped. This
* can be when the end of the application has been reached, or as the
* result of an exception. It can also be the return from an ADP_Step
* process, when the requested number of instructions have been
* executed., or a breakpoint or watchpoint has been hit etc.
*/
/* The first set of Stopped subreason codes are for the ARM hardware
* vectors. These events will be raised if the
* ADP_Control_Vector_Catch allows, or if the target application has
* not provided its own handlers.
*/
#define ADP_Stopped_BranchThroughZero ADPSUBREASON(CI_TADP,0)
#define ADP_Stopped_UndefinedInstr ADPSUBREASON(CI_TADP,1)
#define ADP_Stopped_SoftwareInterrupt ADPSUBREASON(CI_TADP,2)
#define ADP_Stopped_PrefetchAbort ADPSUBREASON(CI_TADP,3)
#define ADP_Stopped_DataAbort ADPSUBREASON(CI_TADP,4)
#define ADP_Stopped_AddressException ADPSUBREASON(CI_TADP,5)
#define ADP_Stopped_IRQ ADPSUBREASON(CI_TADP,6)
#define ADP_Stopped_FIQ ADPSUBREASON(CI_TADP,7)
/* We leave the rest of what would be the bits in the VectorCatch
* bitmask free for future expansion.
*/
/* The following are software reasons for execution stopping: */
#define ADP_Stopped_BreakPoint ADPSUBREASON(CI_TADP,32)
/* Breakpoint was reached
* extra send parameter: word handle - indicates which breakpoint
*/
#define ADP_Stopped_WatchPoint ADPSUBREASON(CI_TADP,33)
/* Watchpoint was triggered
* extra send parameter: word handle - indicates which watchpoint
*/
#define ADP_Stopped_StepComplete ADPSUBREASON(CI_TADP,34)
/* End of ADP_Step request */
#define ADP_Stopped_RunTimeErrorUnknown ADPSUBREASON(CI_TADP,35)
/*
* non-specific fatal runtime support error
*/
#define ADP_Stopped_InternalError ADPSUBREASON(CI_TADP,36)
/* extra send parameter: word error - indicates the nature of the error
*
* An Angel internal error has happened. The error number should be
* displayed for the user to report to his software supplier. Once
* this error has been received the internal state of Angel can no longer
* be trusted.
*/
#define ADP_Stopped_UserInterruption ADPSUBREASON(CI_TADP,37)
/* Host requested interruption */
#define ADP_Stopped_ApplicationExit ADPSUBREASON(CI_TADP,38)
/* extra send parameter: word exitcode
* This indicates that the application has exited via exit(), an exitcode
* of zero indiactes successful termination.
*/
#define ADP_Stopped_StackOverflow ADPSUBREASON(CI_TADP, 39)
/*
* Software stack overflow has occurred
*/
#define ADP_Stopped_DivisionByZero ADPSUBREASON(CI_TADP, 40)
/*
* Division by zero has occurred
*/
#define ADP_Stopped_OSSpecific ADPSUBREASON(CI_TADP, 41)
/*
* The OS has requested that execution stops. The OS will know
* why this has happened.
*/
/******************************************************************
*
* CI_TTDCC messages (Target-initiated debug comms channel)
*
*/
#define ADP_TDCC_ToHost ADPREASON(CI_TTDCC,0)
/* ADP_TDCC_ToHost
* ------------------
* Summary: Send Data down Comms Channel in ToHost direction.
*
* Arguments:
* Send: (word nbytes, words data)
* Return: (word status)
*
* 'nbytes' is number of BYTES to be transferred from the target to the
* host via the Debug Comms channel.
* 'data' is (nbytes/sizeof(word)) WORDS of data to be transferred from
* the target to the host via the Debug Comms channel.
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
*
* NOTE: Equivalent to RDP_CCToHost and RDP_CCToHostReply (just set the
* direction bit).
* NOTE II: Current implementations only support single word transfers
* (nbytes = 4).
*/
#define ADP_TDCC_FromHost ADPREASON(CI_TTDCC,1)
/* ADP_TDCC_FromHost
* --------------------
* Summary: Send Data down Comms Channel in FromHost direction.
*
* Arguments:
* Send: ()
* Return: (word status, word nbytes, words data)
*
* 'status' is RDIError_NoError to indicate success, non-zero otherwise.
* 'nbytes' is number of BYTES to be transferred from the host to the
* target via the Debug Comms channel, or zero if the host has no data
* to transfer.
* 'data' is (nbytes/sizeof(word)) WORDS of transferred data.
*
* NOTE: Equivalent to RDP_CCFromHost and RDP_CCFromHostReply (just set the
* direction bit).
* NOTE II: Current implementations only support single word transfers
* (nbytes = 4).
*/
/*******************************************************************
*
* Error Codes
*
*/
#define RDIError_NoError 0
#define RDIError_Reset 1
#define RDIError_UndefinedInstruction 2
#define RDIError_SoftwareInterrupt 3
#define RDIError_PrefetchAbort 4
#define RDIError_DataAbort 5
#define RDIError_AddressException 6
#define RDIError_IRQ 7
#define RDIError_FIQ 8
#define RDIError_Error 9
#define RDIError_BranchThrough0 10
#define RDIError_NotInitialised 128
#define RDIError_UnableToInitialise 129
#define RDIError_WrongByteSex 130
#define RDIError_UnableToTerminate 131
#define RDIError_BadInstruction 132
#define RDIError_IllegalInstruction 133
#define RDIError_BadCPUStateSetting 134
#define RDIError_UnknownCoPro 135
#define RDIError_UnknownCoProState 136
#define RDIError_BadCoProState 137
#define RDIError_BadPointType 138
#define RDIError_UnimplementedType 139
#define RDIError_BadPointSize 140
#define RDIError_UnimplementedSize 141
#define RDIError_NoMorePoints 142
#define RDIError_BreakpointReached 143
#define RDIError_WatchpointAccessed 144
#define RDIError_NoSuchPoint 145
#define RDIError_ProgramFinishedInStep 146
#define RDIError_UserInterrupt 147
#define RDIError_CantSetPoint 148
#define RDIError_IncompatibleRDILevels 149
#define RDIError_CantLoadConfig 150
#define RDIError_BadConfigData 151
#define RDIError_NoSuchConfig 152
#define RDIError_BufferFull 153
#define RDIError_OutOfStore 154
#define RDIError_NotInDownload 155
#define RDIError_PointInUse 156
#define RDIError_BadImageFormat 157
#define RDIError_TargetRunning 158
#define RDIError_DeviceWouldNotOpen 159
#define RDIError_NoSuchHandle 160
#define RDIError_ConflictingPoint 161
#define RDIError_LittleEndian 240
#define RDIError_BigEndian 241
#define RDIError_SoftInitialiseError 242
#define RDIError_InsufficientPrivilege 253
#define RDIError_UnimplementedMessage 254
#define RDIError_UndefinedMessage 255
#endif
/* EOF adp_h */
|