diff options
author | Ruslan Bukin <br@FreeBSD.org> | 2018-04-04 12:33:46 +0000 |
---|---|---|
committer | Ruslan Bukin <br@FreeBSD.org> | 2018-04-04 12:33:46 +0000 |
commit | a6157d81121ac9559d806dafa346039199598442 (patch) | |
tree | 74bb8dac03bea2e41b98a242951cee587339288a | |
download | src-6c06d22cdcc0a3a7c1b2ccd94ae57e3e7c8dad43.tar.gz src-6c06d22cdcc0a3a7c1b2ccd94ae57e3e7c8dad43.zip |
Import OpenCSD -- an ARM CoreSight Trace Decode library.vendor/opencsd/900407e9d6400f6541138d6c2e483a9fc2d699a4
Git ID 900407e9d6400f6541138d6c2e483a9fc2d699a4
Sponsored by: DARPA, AFRL
196 files changed, 44105 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..54627e695ab4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,76 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ + +# Vc++ build files +*tlog +Debug/ +ipch/ +*.opensdf +*.sdf +*.suo +*.user +*.idb +*.pdb +*.exp +*.ilk + +# ignore emacs backup saves +*~ + +# ignore bin test directory +bin/ +*.log +ref_trace_decoder/build/win/rctdl_c_api_lib/Release/* +ref_trace_decoder/build/win/rctdl_c_api_lib/x64/Release/* +ref_trace_decoder/build/win/ref_trace_decode_lib/Release/* +ref_trace_decoder/build/win/ref_trace_decode_lib/x64/Release/* +ref_trace_decoder/tests/build/win/simple_pkt_print_c_api/Release/* +ref_trace_decoder/tests/build/win/simple_pkt_print_c_api/x64/Release/* +*.lastbuildstate +*.manifest +*.cache +ref_trace_decoder/docs/html/* +ref_trace_decoder/tests/build/win/simple_pkt_print_c_api/Debug-dll/* +ref_trace_decoder/tests/build/win/simple_pkt_print_c_api/x64/Debug-dll/* +ref_trace_decoder/tests/build/win/trc_pkt_lister/Debug-dll/* +ref_trace_decoder/tests/build/win/trc_pkt_lister/Release-dll/* +ref_trace_decoder/tests/build/win/trc_pkt_lister/x64/Debug-dll/* +ref_trace_decoder/tests/build/win/trc_pkt_lister/x64/Release-dll/* +*.bak +*.orig +decoder/docs/html/* +*.orig +*.VC.db +*.VC.VC.opendb +*.iobj +*.ipdb diff --git a/HOWTO.md b/HOWTO.md new file mode 100644 index 000000000000..dfaf9de6452e --- /dev/null +++ b/HOWTO.md @@ -0,0 +1,661 @@ +HOWTO - using the library with perf {#howto_perf} +=================================== + +@brief Using command line perf and OpenCSD to collect and decode trace. + +This HOWTO explains how to use the perf cmd line tools and the openCSD +library to collect and extract program flow traces generated by the +CoreSight IP blocks on a Linux system. The examples have been generated using +an aarch64 Juno-r0 platform. All information is considered accurate and tested +using the latest version of the library and the `master` branch on the +[perf-opencsd github repository][1]. + + +On Target Trace Acquisition - Perf Record +----------------------------------------- +All the enhancement to the Perf tools that support the new `cs_etm` pmu have +not been upstreamed yet. To get the required functionality branch +`perf-opencsd-master` needs to be downloaded to the target system where +traces are to be collected. This branch is a vanilla upstream kernel +supplemented with modifications to the CoreSight framework and drivers to be +usable by the Perf core. The remaining out of tree patches are being +upstreamed incrementally. + +From there compiling the perf tools with `make -C tools/perf` will yield a +`perf` executable that will support CoreSight trace collection. Note that if +traces are to be decompressed *off* target, there is no need to download and +compile the openCSD library (on the target). + +Before launching a trace run a sink that will collect trace data needs to be +identified. All CoreSight blocks identified by the framework are registed in +sysFS: + + + linaro@linaro-nano:~$ ls /sys/bus/coresight/devices/ + 20010000.etf 20040000.main_funnel 22040000.etm 22140000.etm + 230c0000.A53_funnel 23240000.etm replicator@20020000 20030000.tpiu + 20070000.etr 220c0000.A57_funnel 23040000.etm 23140000.etm 23340000.etm + + +CoreSight blocks are listed in the device tree for a specific system and +discovered at boot time. Since tracers can be linked to more than one sink, +the sink that will recieve trace data needs to be identified and given as an +option on the perf command line. Once a sink has been identify trace collection +can start. An easy and yet interesting example is the `uname` command: + + linaro@linaro-nano:~/kernel$ ./tools/perf/perf record -e cs_etm/@20070000.etr/ --per-thread uname + +This will generate a `perf.data` file where execution has been traced for both +user and kernel space. To narrow the field to either user or kernel space the +`u` and `k` options can be specified. For example the following will limit +traces to user space: + + + linaro@linaro-nano:~/kernel$ ./tools/perf/perf record -vvv -e cs_etm/@20070000.etr/u --per-thread uname + Problems setting modules path maps, continuing anyway... + ----------------------------------------------------------- + perf_event_attr: + type 8 + size 112 + { sample_period, sample_freq } 1 + sample_type IP|TID|IDENTIFIER + read_format ID + disabled 1 + exclude_kernel 1 + exclude_hv 1 + enable_on_exec 1 + sample_id_all 1 + ------------------------------------------------------------ + sys_perf_event_open: pid 11375 cpu -1 group_fd -1 flags 0x8 + ------------------------------------------------------------ + perf_event_attr: + type 1 + size 112 + config 0x9 + { sample_period, sample_freq } 1 + sample_type IP|TID|IDENTIFIER + read_format ID + disabled 1 + exclude_kernel 1 + exclude_hv 1 + mmap 1 + comm 1 + enable_on_exec 1 + task 1 + sample_id_all 1 + mmap2 1 + comm_exec 1 + ------------------------------------------------------------ + sys_perf_event_open: pid 11375 cpu -1 group_fd -1 flags 0x8 + mmap size 266240B + AUX area mmap length 131072 + perf event ring buffer mmapped per thread + Synthesizing auxtrace information + Linux + auxtrace idx 0 old 0 head 0x11ea0 diff 0x11ea0 + [ perf record: Woken up 1 times to write data ] + overlapping maps: + 7f99daf000-7f99db0000 0 [vdso] + 7f99d84000-7f99db3000 0 /lib/aarch64-linux-gnu/ld-2.21.so + 7f99d84000-7f99daf000 0 /lib/aarch64-linux-gnu/ld-2.21.so + 7f99db0000-7f99db3000 0 /lib/aarch64-linux-gnu/ld-2.21.so + failed to write feature 8 + failed to write feature 9 + failed to write feature 14 + [ perf record: Captured and wrote 0.072 MB perf.data ] + + linaro@linaro-nano:~/kernel$ ls -l ~/.debug/ perf.data + _-rw------- 1 linaro linaro 77888 Mar 2 20:41 perf.data + + /home/linaro/.debug/: + total 16 + drwxr-xr-x 2 linaro linaro 4096 Mar 2 20:40 [kernel.kallsyms] + drwxr-xr-x 2 linaro linaro 4096 Mar 2 20:40 [vdso] + drwxr-xr-x 3 linaro linaro 4096 Mar 2 20:40 bin + drwxr-xr-x 3 linaro linaro 4096 Mar 2 20:40 lib + +Trace data filtering +-------------------- +The amount of traces generated by CoreSight tracers is staggering, event for +the most simple trace scenario. Reducing trace generation to specific areas +of interest is desirable to save trace buffer space and avoid getting lost in +the trace data that isn't relevant. Supplementing the 'k' and 'u' options +described above is the notion of address filters. + +On CoreSight two types of address filter have been implemented - address range +and start/stop filter: + +**Address range filters:** +With address range filters traces are generated if the instruction pointer +falls within the specified range. Any work done by the CPU outside of that +range will not be traced. Address range filters can be specified for both +user and kernel space session: + + perf record -e cs_etm/@20070000.etr/k --filter 'filter 0xffffff8008562d0c/0x48' --per-thread uname + + perf record -e cs_etm/@20070000.etr/u --filter 'filter 0x72c/0x40@/opt/lib/libcstest.so.1.0' --per-thread ./main + +When dealing with kernel space trace addresses are typically taken in the +'System.map' file. In user space addresses are relocatable and can be +extracted from an objdump output: + + $ aarch64-linux-gnu-objdump -d libcstest.so.1.0 + ... + ... + 000000000000072c <coresight_test1>: <------------ Beginning of traces + 72c: d10083ff sub sp, sp, #0x20 + 730: b9000fe0 str w0, [sp,#12] + 734: b9001fff str wzr, [sp,#28] + 738: 14000007 b 754 <coresight_test1+0x28> + 73c: b9400fe0 ldr w0, [sp,#12] + 740: 11000800 add w0, w0, #0x2 + 744: b9000fe0 str w0, [sp,#12] + 748: b9401fe0 ldr w0, [sp,#28] + 74c: 11000400 add w0, w0, #0x1 + 750: b9001fe0 str w0, [sp,#28] + 754: b9401fe0 ldr w0, [sp,#28] + 758: 7100101f cmp w0, #0x4 + 75c: 54ffff0d b.le 73c <coresight_test1+0x10> + 760: b9400fe0 ldr w0, [sp,#12] + 764: 910083ff add sp, sp, #0x20 + 768: d65f03c0 ret + ... + ... + +Following the address the amount of byte is specified and if tracing in user +space, the full path to the binary (or library) being traced. + +**Start/Stop filters:** +With start/stop filters traces are generated when the instruction pointer is +equal to the start address. Incidentally traces stop being generated when the +insruction pointer is equal to the stop address. Anything that happens between +there to events is traced: + + perf record -e cs_etm/@20070000.etr/k --filter 'start 0xffffff800856bc50,stop 0xffffff800856bcb0' --per-thread uname + + perf record -vvv -e cs_etm/@20070000.etr/u --filter 'start 0x72c@/opt/lib/libcstest.so.1.0, \ + stop 0x40082c@/home/linaro/main' \ + --per-thread ./main + +**Limitation on address filters:** +The only limitation on address filters is the amount of address comparator +found on an implementation and the mutual exclusion between range and +start stop filters. As such the following example would _not_ work: + + perf record -e cs_etm/@20070000.etr/k --filter 'start 0xffffff800856bc50,stop 0xffffff800856bcb0, \ // start/stop + filter 0x72c/0x40@/opt/lib/libcstest.so.1.0' \ // address range + --per-thread uname + +Additional Trace Options +------------------------ +Additional options can be used during trace collection that add information to the captured trace. + +- Timestamps: These packets are added to the trace streams to allow correlation of different sources where tools support this. +- Cycle Counts: These packets are added to get a count of cycles for blocks of executed instructions. Adding cycle counts will considerably increase the amount of generated trace. +The relationship between cycle counts and executed instructions differs according to the trace protocol. +For example, the ETMv4 protocol will emit counts for groups of instructions according to a minimum count threshold. +Presently this threshold is fixed at 256 cycles for `perf record`. + +Command line options in `perf record` to use these features are part of the options for the `cs_etm` event: + + perf record -e cs_etm/timestamp,cycacc,@20070000.etr/ --per-thread uname + +At current version, `perf record` and `perf script` do not use this additional information. + +On Target Trace Collection +-------------------------- +The entire program flow will have been recorded in the `perf.data` file. +Information about libraries and executable is stored under `$HOME/.debug`: + + linaro@linaro-nano:~/kernel$ tree ~/.debug + .debug + ├── [kernel.kallsyms] + │  └── 0542921808098d591a7acba5a1163e8991897669 + │  └── kallsyms + ├── [vdso] + │  └── 551fbbe29579eb63be3178a04c16830b8d449769 + │  └── vdso + ├── bin + │  └── uname + │  └── ed95e81f97c4471fb2ccc21e356b780eb0c92676 + │  └── elf + └── lib + └── aarch64-linux-gnu + ├── ld-2.21.so + │  └── 94912dc5a1dc8c7ef2c4e4649d4b1639b6ebc8b7 + │  └── elf + └── libc-2.21.so + └── 169a143e9c40cfd9d09695333e45fd67743cd2d6 + └── elf + + 13 directories, 5 files + linaro@linaro-nano:~/kernel$ + + +All this information needs to be collected in order to successfully decode +traces off target: + + linaro@linaro-nano:~/kernel$ tar czf uname.trace.tgz perf.data ~/.debug + + +Note that file `vmlinux` should also be added to the bundle if kernel traces +have also been collected. + + +Off Target OpenCSD Compilation +------------------------------ +The openCSD library is not part of the perf tools. It is available on +[github][1] and needs to be compiled before the perf tools. Checkout the +required branch/tag version into a local directory. + + linaro@t430:~/linaro/coresight$ git clone -b v0.8 https://github.com/Linaro/OpenCSD.git my-opencsd + Cloning into 'OpenCSD'... + remote: Counting objects: 2063, done. + remote: Total 2063 (delta 0), reused 0 (delta 0), pack-reused 2063 + Receiving objects: 100% (2063/2063), 2.51 MiB | 1.24 MiB/s, done. + Resolving deltas: 100% (1399/1399), done. + Checking connectivity... done. + linaro@t430:~/linaro/coresight$ ls my-opencsd + decoder LICENSE README.md HOWTO.md TODO + +Once the source code has been acquired compilation of the openCSD library can +take place. For Linux two options are available, LINUX and LINUX64, based on +the host's (which has nothing to do with the target) architecture: + + linaro@t430:~/linaro/coresight/$ cd my-opencsd/decoder/build/linux/ + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ ls + makefile rctdl_c_api_lib ref_trace_decode_lib + + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ make LINUX64=1 DEBUG=1 + ... + ... + + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ ls ../../lib/linux64/dbg/ + libopencsd.a libopencsd_c_api.a libopencsd_c_api.so libopencsd.so + +From there the header file and libraries need to be installed on the system, +something that requires root privileges. The default installation path is +/usr/include/opencsd for the header files and /usr/lib/ for the libraries: + + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ sudo make install + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ ls -l /usr/include/opencsd + total 60 + drwxr-xr-x 2 root root 4096 Dec 12 10:19 c_api + drwxr-xr-x 2 root root 4096 Dec 12 10:19 etmv3 + drwxr-xr-x 2 root root 4096 Dec 12 10:19 etmv4 + -rw-r--r-- 1 root root 28049 Dec 12 10:19 ocsd_if_types.h + drwxr-xr-x 2 root root 4096 Dec 12 10:19 ptm + drwxr-xr-x 2 root root 4096 Dec 12 10:19 stm + -rw-r--r-- 1 root root 7264 Dec 12 10:19 trc_gen_elem_types.h + -rw-r--r-- 1 root root 3972 Dec 12 10:19 trc_pkt_types.h + + linaro@t430:~/linaro/coresight/my-opencsd/decoder/build/linux$ ls -l /usr/lib/libopencsd* + -rw-r--r-- 1 root root 598720 Dec 12 10:19 /usr/lib/libopencsd_c_api.so + -rw-r--r-- 1 root root 4692200 Dec 12 10:19 /usr/lib/libopencsd.so + +A "clean_install" target is also available so that openCSD installed files can +be removed from a system. Going forward the goal is to have the openCSD library +packaged as a Debian or RPM archive so that it can be installed from a +distribution without having to be compiled. + + +Off Target Perf Tools Compilation +--------------------------------- +As mentionned above the openCSD library is not part of the perf tools' code base +and needs to be installed on a system prior to compilation. Information about +the status of the openCSD library on a system is given at compile time by the +perf tools build script: + + linaro@t430:~/linaro/linux-kernel$ make VF=1 -C tools/perf + Auto-detecting system features: + ... dwarf: [ on ] + ... dwarf_getlocations: [ on ] + ... glibc: [ on ] + ... gtk2: [ on ] + ... libaudit: [ on ] + ... libbfd: [ OFF ] + ... libelf: [ on ] + ... libnuma: [ OFF ] + ... numa_num_possible_cpus: [ OFF ] + ... libperl: [ on ] + ... libpython: [ on ] + ... libslang: [ on ] + ... libcrypto: [ on ] + ... libunwind: [ OFF ] + ... libdw-dwarf-unwind: [ on ] + ... zlib: [ on ] + ... lzma: [ OFF ] + ... get_cpuid: [ on ] + ... bpf: [ on ] + ... libopencsd: [ on ] <------- + + +At the end of the compilation a new perf binary is available in `tools/perf/`: + + linaro@t430:~/linaro/linux-kernel$ ldd tools/perf/perf + linux-vdso.so.1 => (0x00007fff135db000) + libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f15f9176000) + librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f15f8f6e000) + libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f15f8c64000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f15f8a60000) + libopencsd_c_api.so => /usr/lib/libopencsd_c_api.so (0x00007f15f884e000) <------- + libelf.so.1 => /usr/lib/x86_64-linux-gnu/libelf.so.1 (0x00007f15f8635000) + libdw.so.1 => /usr/lib/x86_64-linux-gnu/libdw.so.1 (0x00007f15f83ec000) + libaudit.so.1 => /lib/x86_64-linux-gnu/libaudit.so.1 (0x00007f15f81c5000) + libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007f15f7e38000) + libperl.so.5.22 => /usr/lib/x86_64-linux-gnu/libperl.so.5.22 (0x00007f15f7a5d000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f15f7693000) + libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f15f7104000) + libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f15f6eea000) + /lib64/ld-linux-x86-64.so.2 (0x0000559b88038000) + libopencsd.so => /usr/lib/libopencsd.so (0x00007f15f6c62000) <------- + libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f15f68df000) + libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f15f66c9000) + liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f15f64a6000) + libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f15f6296000) + libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f15f605e000) + libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f15f5e5a000) + + +Additional debug output from the decoder can be compiled in by setting the +`CSTRACE_RAW` environment variable. Setting this to `packed` gets trace frame +output as follows:- + + Frame Data; Index 576; RAW_PACKED; d6 d6 d6 d6 d6 d6 d6 d6 fc fb d6 d6 d6 d6 e0 7f + Frame Data; Index 576; ID_DATA[0x14]; d7 d6 d7 d6 d7 d6 d7 d6 fd fb d7 d6 d7 d6 e0 + +Set to any other value will remove the RAW_PACKED lines. + +Working with a debug version of the openCSD library +--------------------------------------------------- +When compiling the perf tools it is possible to reference another version of +the openCSD library than the one installed on the system. This is useful when +working with multiple development trees or having the desire to keep system +libraries intact. Two environment variable are available to tell the perf tools +build script where to get the header file and libraries, namely CSINCLUDES and +CSLIBS: + + linaro@t430:~/linaro/linux-kernel$ export CSINCLUDES=~/linaro/coresight/my-opencsd/decoder/include/ + linaro@t430:~/linaro/linux-kernel$ export CSLIBS=~/linaro/coresight/my-opencsd/decoder/lib/linux64-rel/ + linaro@t430:~/linaro/linux-kernel$ make VF=1 -C tools/perf + +This will have the effect of compiling and linking against the provided library. +Since the system's openCSD library is in the loader's search patch the +LD_LIBRARY_PATH environment variable needs to be set. + + linaro@t430:~/linaro/linux-kernel$ export LD_LIBRARY_PATH=$CSLIBS + + +Trace Decoding with Perf Report +------------------------------- +Before working with custom traces it is suggested to use a trace bundle that +is known to be working properly. A sample bundle has been made available +here [2]. Trace bundles can be extracted anywhere and have no dependencies on +where the perf tools and openCSD library have been compiled. + + linaro@t430:~/linaro/coresight$ mkdir sept20 + linaro@t430:~/linaro/coresight$ cd sept20 + linaro@t430:~/linaro/coresight/sept20$ wget http://people.linaro.org/~mathieu.poirier/openCSD/uname.v4.user.sept20.tgz + linaro@t430:~/linaro/coresight/sept20$ md5sum uname.v4.user.sept20.tgz + f53f11d687ce72bdbe9de2e67e960ec6 uname.v4.user.sept20.tgz + linaro@t430:~/linaro/coresight/sept20$ tar xf uname.v4.user.sept20.tgz + linaro@t430:~/linaro/coresight/sept20$ ls -la + total 1312 + drwxrwxr-x 3 linaro linaro 4096 Mar 3 10:26 . + drwxrwxr-x 5 linaro linaro 4096 Mar 3 10:13 .. + drwxr-xr-x 7 linaro linaro 4096 Feb 24 12:21 .debug + -rw------- 1 linaro linaro 78016 Feb 24 12:21 perf.data + -rw-rw-r-- 1 linaro linaro 1245881 Feb 24 12:25 uname.v4.user.sept20.tgz + +Perf is expecting files related to the trace capture (`perf.data`) to be located +under `~/.debug` [3]. This example will remove the current `~/.debug` directory +to be sure everything is clean. + + linaro@t430:~/linaro/coresight/sept20$ rm -rf ~/.debug + linaro@t430:~/linaro/coresight/sept20$ cp -dpR .debug ~/ + linaro@t430:~/linaro/coresight/sept20$ ../perf-opencsd-master/tools/perf/perf report --stdio + + # To display the perf.data header info, please use --header/--header-only options. + # + # + # Total Lost Samples: 0 + # + # Samples: 0 of event 'cs_etm//u' + # Event count (approx.): 0 + # + # Children Self Command Shared Object Symbol + # ........ ........ ....... ............. ...... + # + + + # Samples: 0 of event 'dummy:u' + # Event count (approx.): 0 + # + # Children Self Command Shared Object Symbol + # ........ ........ ....... ............. ...... + # + + + # Samples: 115K of event 'instructions:u' + # Event count (approx.): 522009 + # + # Children Self Command Shared Object Symbol + # ........ ........ ....... ................ ...................... + # + 4.13% 4.13% uname libc-2.21.so [.] 0x0000000000078758 + 3.81% 3.81% uname libc-2.21.so [.] 0x0000000000078e50 + 2.06% 2.06% uname libc-2.21.so [.] 0x00000000000fcaf4 + 1.65% 1.65% uname libc-2.21.so [.] 0x00000000000fcae4 + 1.59% 1.59% uname ld-2.21.so [.] 0x000000000000a7f4 + 1.50% 1.50% uname libc-2.21.so [.] 0x0000000000078e40 + 1.43% 1.43% uname libc-2.21.so [.] 0x00000000000fcac4 + 1.31% 1.31% uname libc-2.21.so [.] 0x000000000002f0c0 + 1.26% 1.26% uname ld-2.21.so [.] 0x0000000000016888 + 1.24% 1.24% uname libc-2.21.so [.] 0x0000000000078e7c + 1.24% 1.24% uname libc-2.21.so [.] 0x00000000000fcab8 + ... + +Additional data can be obtained, which contains a dump of the trace packets received using the command + + mjl@ubuntu-vbox:./perf-opencsd-master/coresight/tools/perf/perf report --stdio --dump + +resulting a large amount of data, trace looking like:- + + 0x618 [0x30]: PERF_RECORD_AUXTRACE size: 0x11ef0 offset: 0 ref: 0x4d881c1f13216016 idx: 0 tid: 15244 cpu: -1 + + . ... CoreSight ETM Trace data: size 73456 bytes + + 0: I_ASYNC : Alignment Synchronisation. + 12: I_TRACE_INFO : Trace Info. + 17: I_TRACE_ON : Trace On. + 18: I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000007F89F24D80; Ctxt: AArch64,EL0, NS; + 28: I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE + 29: I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE + 30: I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE + 32: I_ATOM_F6 : Atom format 6.; EEEEN + 33: I_ATOM_F1 : Atom format 1.; E + 34: I_EXCEPT : Exception.; Data Fault; Ret Addr Follows; + 36: I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000007F89F2832C; + 45: I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0xFFFFFFC000083400; Ctxt: AArch64,EL1, NS; + 56: I_TRACE_ON : Trace On. + 57: I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000007F89F2832C; Ctxt: AArch64,EL0, NS; + 68: I_ATOM_F3 : Atom format 3.; NEE + 69: I_ATOM_F3 : Atom format 3.; NEN + 70: I_ATOM_F3 : Atom format 3.; NNE + 71: I_ATOM_F5 : Atom format 5.; ENENE + 72: I_ATOM_F5 : Atom format 5.; NENEN + 73: I_ATOM_F5 : Atom format 5.; ENENE + 74: I_ATOM_F5 : Atom format 5.; NENEN + 75: I_ATOM_F5 : Atom format 5.; ENENE + 76: I_ATOM_F3 : Atom format 3.; NNE + 77: I_ATOM_F3 : Atom format 3.; NNE + 78: I_ATOM_F3 : Atom format 3.; NNE + 80: I_ATOM_F3 : Atom format 3.; NNE + 81: I_ATOM_F3 : Atom format 3.; ENN + 82: I_EXCEPT : Exception.; Data Fault; Ret Addr Follows; + 84: I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000007F89F283F0; + 93: I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0xFFFFFFC000083400; Ctxt: AArch64,EL1, NS; + 104: I_TRACE_ON : Trace On. + 105: I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000007F89F283F0; Ctxt: AArch64,EL0, NS; + 116: I_ATOM_F5 : Atom format 5.; NNNNN + 117: I_ATOM_F5 : Atom format 5.; NNNNN + + +Trace Decoding with Perf Script +------------------------------- +Working with perf scripts needs more command line options but yields +interesting results. + + linaro@t430:~/linaro/coresight/sept20$ export EXEC_PATH=/home/linaro/coresight/perf-opencsd-master/tools/perf/ + linaro@t430:~/linaro/coresight/sept20$ export SCRIPT_PATH=$EXEC_PATH/scripts/python/ + linaro@t430:~/linaro/coresight/sept20$ export XTOOL_PATH=/your/aarch64/toolchain/path/bin/ + linaro@t430:~/linaro/coresight/sept20$ ../perf-opencsd-master/tools/perf/perf --exec-path=${EXEC_PATH} script --script=python:${SCRIPT_PATH}/cs-trace-disasm.py -- -d ${XTOOL_PATH}/aarch64-linux-gnu-objdump + + 7f89f24d80: 910003e0 mov x0, sp + 7f89f24d84: 94000d53 bl 7f89f282d0 <free@plt+0x3790> + 7f89f282d0: d11203ff sub sp, sp, #0x480 + 7f89f282d4: a9ba7bfd stp x29, x30, [sp,#-96]! + 7f89f282d8: 910003fd mov x29, sp + 7f89f282dc: a90363f7 stp x23, x24, [sp,#48] + 7f89f282e0: 9101e3b7 add x23, x29, #0x78 + 7f89f282e4: a90573fb stp x27, x28, [sp,#80] + 7f89f282e8: a90153f3 stp x19, x20, [sp,#16] + 7f89f282ec: aa0003fb mov x27, x0 + 7f89f282f0: 910a82e1 add x1, x23, #0x2a0 + 7f89f282f4: a9025bf5 stp x21, x22, [sp,#32] + 7f89f282f8: a9046bf9 stp x25, x26, [sp,#64] + 7f89f282fc: 910102e0 add x0, x23, #0x40 + 7f89f28300: f800841f str xzr, [x0],#8 + 7f89f28304: eb01001f cmp x0, x1 + 7f89f28308: 54ffffc1 b.ne 7f89f28300 <free@plt+0x37c0> + 7f89f28300: f800841f str xzr, [x0],#8 + 7f89f28304: eb01001f cmp x0, x1 + 7f89f28308: 54ffffc1 b.ne 7f89f28300 <free@plt+0x37c0> + 7f89f28300: f800841f str xzr, [x0],#8 + 7f89f28304: eb01001f cmp x0, x1 + 7f89f28308: 54ffffc1 b.ne 7f89f28300 <free@plt+0x37c0> + +Kernel Trace Decoding +--------------------- + +When dealing with kernel space traces the vmlinux file has to be communicated +explicitely to perf using the "--vmlinux" command line option: + + linaro@t430:~/linaro/coresight/sept20$ ../perf-opencsd-master/tools/perf/perf report --stdio --vmlinux=./vmlinux + ... + ... + linaro@t430:~/linaro/coresight/sept20$ ../perf-opencsd-master/tools/perf/perf script --vmlinux=./vmlinux + +When using scripts things get a little more convoluted. Using the same example +an above but for traces but for kernel traces, the command line becomes: + + linaro@t430:~/linaro/coresight/sept20$ export EXEC_PATH=/home/linaro/coresight/perf-opencsd-master/tools/perf/ + linaro@t430:~/linaro/coresight/sept20$ export SCRIPT_PATH=$EXEC_PATH/scripts/python/ + linaro@t430:~/linaro/coresight/sept20$ export XTOOL_PATH=/your/aarch64/toolchain/path/bin/ + linaro@t430:~/linaro/coresight/sept20$ ../perf-opencsd-master/tools/perf/perf --exec-path=${EXEC_PATH} script \ + --vmlinux=./vmlinux \ + --script=python:${SCRIPT_PATH}/cs-trace-disasm.py -- \ + -d ${XTOOLS_PATH}/aarch64-linux-gnu-objdump \ + -k ./vmlinux + ... + ... + +The option "--vmlinux=./vmlinux" is interpreted by the "perf script" command +the same way it if for "perf report". The option "-k ./vmlinux" is dependant +on the script being executed and has no related to the "--vmlinux", though it +is highly advised to keep them synchronized. + + +Perf Test Environment Scripts +----------------------------- + +The decoder library comes with a number of `bash` scripts that ease the setting up of the +offline build and test environment for perf, and executing tests. + +These scripts can be found in + + decoder/tests/perf-test-scripts + +There are three scripts provided: + +- `perf-setup-env.bash` : this sets up all the environment variables mentioned above. +- `perf-test-report.bash` : this runs `perf report` - using the environment setup by `perf-setup-env.bash` +- `perf-test-script.bash` : this runs `perf script` - using the environment setup by `perf-setup-env.bash` + +Use as follows:- + +1. Prior to building perf, edit `perf-setup-env.bash` to conform to your environment. There are four lines at the top of the file that will require editing. + +2. Execute the script using the command + + source perf-setup-env.bash + + This will set up all the environment variables mentioned in the sections on building and running + perf above, and these are used by the `perf-test...` scripts to run the tests. + +3. Build perf as described above. +4. Follow the instructions for downloading the test capture, or create a capture from your target. +5. Copy the `perf-test...` scripts into the capture data directory -> the one that contains `perf.data`. + +6. The scripts can now be run. No options are required for the default operation, but any command line options will be added to the perf report / perf script command line. + +e.g. + + ./perf-test-report.bash --dump + +will add the --dump option to the end of the command line and run + + ${PERF_EXEC_PATH}/perf report --stdio --dump + + +Generating coverage files for Feedback Directed Optimization: AutoFDO +--------------------------------------------------------------------- + +Below is an example of using ARM ETM for autoFDO. The updates to the perf +support for this is experimental and available on the 'autoFDO' branch of +the [perf-opencsd github repository][1]. + +It also requires autofdo (https://github.com/google/autofdo) and gcc version 5. The bubble +sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tutorial). + + $ gcc-5 -O3 sort.c -o sort_optimized + $ taskset -c 2 ./sort_optimized + Bubble sorting array of 30000 elements + 5910 ms + + $ perf record -e cs_etm/@20070000.etr/u --per-thread taskset -c 2 ./sort + Bubble sorting array of 30000 elements + 12543 ms + [ perf record: Woken up 35 times to write data ] + [ perf record: Captured and wrote 69.640 MB perf.data ] + + $ perf inject -i perf.data -o inj.data --itrace=il64 --strip + $ create_gcov --binary=./sort --profile=inj.data --gcov=sort.gcov -gcov_version=1 + $ gcc-5 -O3 -fauto-profile=sort.gcov sort.c -o sort_autofdo + $ taskset -c 2 ./sort_autofdo + Bubble sorting array of 30000 elements + 5806 ms + + +The Linaro CoreSight Team +------------------------- +- Mike Leach +- Tor Jeremiassen +- Chunyan Zang +- Mathieu Poirier + + +One Last Thing +-------------- +We welcome help on this project. If you would like to add features or help +improve the way things work, we want to hear from you. + +Best regards, +*The Linaro CoreSight Team* + +-------------------------------------- +[1]: https://github.com/Linaro/perf-opencsd "perf-opencsd Github" + +[2]: http://people.linaro.org/~mathieu.poirier/openCSD/uname.v4.user.sept20.tgz + +[3]: Get in touch with us if you know a way to change this. diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000000..8c80288c53f9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ + BSD 3Clause License + http://directory.fsf.org/wiki/License:BSD_3Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + (1) Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + (2) Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + (3)The name of the author may not be used to + endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 000000000000..44b7c6807c35 --- /dev/null +++ b/README.md @@ -0,0 +1,132 @@ +OpenCSD - An open source CoreSight(tm) Trace Decode library {#mainpage} +=========================================================== + +This library provides an API suitable for the decode of ARM(r) CoreSight(tm) trace streams. + +The library will decode formatted trace in three stages: + +1. *Frame Deformatting* : Removal CoreSight frame formatting from individual trace streams. +2. *Packet Processing* : Separate individual trace streams into discrete packets. +3. *Packet Decode* : Convert the packets into fully decoded trace describing the program flow on a core. + +The library is implemented in C++ with an optional "C" API. + +Library Versioning +------------------ + +From version 0.4, library versioning will use a semantic versioning format +(per http://semver.org) of the form _Major.minor.patch_ (M.m.p). + +Internal library version calls, documentation and git repository will use this format moving forwards. +Where a patch version is not quoted, or quoted as .x then comments will apply to the entire release. + +Releases will be at M.m.0, with patch version incremented for bugfixes or documentation updates. + +Releases will appear on the master branch in the git repository with an appropriate version tag. + +CoreSight Trace Component Support. +---------------------------------- + +_Current Version 0.8.2_ + +### Current support: + +- ETMv4 (v4.1) instruction trace - packet processing and packet decode. +- PTM (v1.1) instruction trace - packet processing and packet decode. +- ETMv3 (v3.5) instruction trace - packet processing and packet decode. +- ETMv3 (v3.5) data trace - packet processing. +- STM (v1.1) software trace - packet processing and packet decode. + +- External Decoders - support for addition of external / custom decoders into the library. + +### Support to be added: + +- ITM software trace - packet processing and decode. +- ETMv3 data trace - packet decode. +- ETMv4 data trace - packet processing and decode. + +Note: for ITM and STM, packet decode is combining Master+Channel+Marker+Payload packets into a single generic +output packet. + + +Note on the Git Repository. +--------------------------- + +This git repository for OpenCSD contains only source for the OpenCSD decoder library. +From version 0.4, releases appear as versioned tags on the master branch. + +From version 0.7.4, the required updates to CoreSight drivers and perf, that are not +currently upstream in the linux kernel tree, are now contained in a separate +repository to be found at: + +https://github.com/Linaro/perf-opencsd + + +Documentation +------------- + +API Documentation is provided inline in the source header files, which use the __doxygen__ standard mark-up. +Run `doxygen` on the `./doxygen_config.dox` file located in the `./docs` directory.. + + doxygen ./doxygen_config.dox + +This will produce the documentation in the `./docs/html` directory. The doxygen configuration also includes +the `*.md` files as part of the documentation. + + +Building the Library +-------------------- + +See [build_libs.md](@ref build_lib) in the `./docs` directory for build details. + + +How the Library is used in Linux `perf` +--------------------------------------- +The library and additional infrastructure for programming CoreSight components has been integrated +with the standard linux perfomance analysis tool `perf`. + + +See [HOWTO.md](@ref howto_perf) for details. + + +Version and Modification Information +==================================== + +- _Version 0.001_: Library development - tested with `perf` tools integration - BKK16, 8th March 2016 +- _Version 0.002_: Library development - added in PTM decoder support. Restructure header dir, replaced ARM rctdl prefix with opencsd/ocsd. +- _Version 0.003_: Library development - added in ETMv3 instruction decoder support. +- _Version 0.4_ : Library development - updated decode tree and C-API for generic decoder handling. Switch to semantic versioning. +- _Version 0.4.1_: Minor Update & Bugfixes - fix to PTM decoder, ID checking on test program, adds NULL_TS support in STM packet processor. +- _Version 0.4.2_: Minor Update - Update to documentation for perf usage in 4.8 kernel branch. +- _Version 0.5.0_: Library Development - external decoder support. STM full decode. +- _Version 0.5.1_: Minor Update & Bugfixes - Update HOWTO for kernel 4.9. Build fixes for parallel builds +- _Version 0.5.2_: Minor Update & Bugfixes - Update trace info packet string o/p + Cycle count packet bugfixes. +- _Version 0.5.3_: Doc update for using AutoFDO with ETM and additional timestamp and cycle count options. +- _Version 0.5.4_: Updates: X-compile for arm/arm64. Remove deprecated VS2010 builds. Bugfix: GCC inline semantics in debug build. +- _Version 0.6.0_: Packet printers moved from tests into the main library. C++ and C APIs updated to allow clients to use them. + Update to allow perf to insert barrier packets (4xFSYNC) which the decoder can be made to use to reset the decode state. +- _Version 0.6.1_: Bugfix: instruction follower bug on A32 branch to T32. +- _Version 0.7.0_: Add handling for trace return stack feature to ETMv4 and PTM trace. +- _Version 0.7.1_: Bugfix: ETMv3 packet processor. +- _Version 0.7.2_: Bugfix: ETMv4 decoder - fix exact match packet address follower. +- _Version 0.7.3_: Bugfix: PTM decoder - issues with initialisation and ASYNC detection. +- _Version 0.7.4_: Notification of change of repository for perf extensions. gcc 6.x build fixes. +- _Version 0.7.5_: Bugfix: ETMv4 decoder memory leak. Linux build update - header dependencies force rebuild. +- _Version 0.8.0_: Header restructure and build update to enable linux version to install library and C-API headers in standard locations. + Library output naming changed from 'cstraced' to 'opencsd'. +- _Version 0.8.1_: Minor updates: Use install tool to copy headers. Changes to HOWTO for perf usage. +- _Version 0.8.2_: Bugfix: C++ init errors fixed for CLANG build process. + +Licence Information +=================== + +This library is licensed under the [BSD three clause licence.](http://directory.fsf.org/wiki/License:BSD_3Clause) + +A copy of this license is in the `LICENCE` file included with the source code. + +Contact +======= + +Using the github site: https://github.com/Linaro/OpenCSD + +Mailing list: coresight@lists.linaro.org @@ -0,0 +1,19 @@ +* ETMv4/PTM - decoder updates to handle advanced configuration. +-> Certain (currently unused by perf / current hardware) configuration settings + can alter the format of the trace output. One example is Return Stack - + settable in the control registers for PTM/ETMv4, and removes some inline + addresses. Decoder must use a follower to correctly trace when this is set. + +* ITM packet processing and decode. +-> ITM is primarily an M class SW trace module. I wouldn't expect to see it on + systems with STM, unless a companion M class was present. + +*Data trace - ETMv4 / ETMv3 +-> Differing solutions to data trace in v4/v3 - v4 is separate trace stream + completely, output at trace ID <instruction_trace_ID>+1. ETMv3 is inline with + the instruction trace. + +Cortex-A cores do not support this architecturally. On R and M profile cores it +is an option. There are scenarios in future that could see linux on R cores, plus +on something like Juno it is possible to switch on trace for the SCP +(M class processor). So at some point data trace may be required. diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile new file mode 100644 index 000000000000..330829b77089 --- /dev/null +++ b/decoder/build/linux/makefile @@ -0,0 +1,196 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - master makefile for libraries and tests +# +# command line options +# DEBUG=1 create a debug build +# + +# Set project root - relative to build directory +ifeq ($(OCSD_ROOT),) +OCSD_ROOT := $(shell pwd | sed 's,/build/linux.*,,') +export OCSD_ROOT +endif + +# library names +LIB_BASE_NAME=opencsd +export LIB_BASE_NAME +LIB_CAPI_NAME=$(LIB_BASE_NAME)_c_api +export LIB_CAPI_NAME + +# determine base architecture, heavily borrowed from the Linux kernel v4.4's +# tools/perf/config/Makefile.arch +# For example, to compile for arm64 on a X86 PC, you can issue the command: +# "export ARCH=arm64" +ifndef ARCH +ARCH := $(shell uname -m 2>/dev/null || echo not) +endif + +# source root directories +export OCSD_LIB_ROOT=$(OCSD_ROOT)/lib + +export OCSD_INCLUDE=$(OCSD_ROOT)/include +export OCSD_SOURCE=$(OCSD_ROOT)/source + +export OCSD_TESTS=$(OCSD_ROOT)/tests + +export LIB_UAPI_INC_DIR=opencsd + +# tools +export MASTER_CC=$(CROSS_COMPILE)gcc +export MASTER_CPP=$(CROSS_COMPILE)g++ +export MASTER_LINKER=$(CROSS_COMPILE)g++ +export MASTER_LIB=$(CROSS_COMPILE)ar +export INSTALL=install + +# installation directory +INSTALL_LIB_DIR=/usr/lib/ +export INSTALL_INCLUDE_DIR=/usr/include/ + +# compile flags +MASTER_CC_FLAGS := -c -Wall -DLINUX +MASTER_CPP_FLAGS := -c -Wall -DLINUX -std=c++11 +MASTER_LINKER_FLAGS := -Wl,-z,defs +MASTER_LIB_FLAGS := rcs + +# debug variant +ifdef DEBUG +MASTER_CC_FLAGS += -g -O0 -DDEBUG +MASTER_CPP_FLAGS += -g -O0 -DDEBUG +BUILD_VARIANT=dbg +else +MASTER_CC_FLAGS += -g -O2 -DNDEBUG +MASTER_CPP_FLAGS += -g -O2 -DNDEBUG +BUILD_VARIANT=rel +endif + + +# platform bit size variant +ifeq ($(ARCH),x86) + MFLAG:="-m32" + BIT_VARIANT=32 +else ifeq ($(ARCH),x86_64) + MFLAG:="-m64" + BIT_VARIANT=64 +else ifeq ($(ARCH),arm) + BIT_VARIANT=-arm +else ifeq ($(ARCH),arm64) + BIT_VARIANT=-arm64 +else ifeq ($(ARCH),aarch64) + BIT_VARIANT=-arm64 +else ifeq ($(ARCH),aarch32) + BIT_VARIANT=-arm +endif + +MASTER_CC_FLAGS += $(MFLAG) +MASTER_CPP_FLAGS += $(MFLAG) +MASTER_LINKER_FLAGS += $(MFLAG) + +# export build flags +export MASTER_CC_FLAGS +export MASTER_CPP_FLAGS +export MASTER_LINKER_FLAGS +export MASTER_LIB_FLAGS + +# target directories +export PLAT_DIR=linux$(BIT_VARIANT)/$(BUILD_VARIANT) +export LIB_TARGET_DIR=$(OCSD_LIB_ROOT)/$(PLAT_DIR) +export LIB_TEST_TARGET_DIR=$(OCSD_TESTS)/lib/$(PLAT_DIR) +export BIN_TEST_TARGET_DIR=$(OCSD_TESTS)/bin/$(PLAT_DIR) + +########################################################### +# build targets + +all: libs tests + +libs: $(LIB_BASE_NAME)_lib $(LIB_CAPI_NAME)_lib + +install: libs + $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so $(INSTALL_LIB_DIR)/ + $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so $(INSTALL_LIB_DIR)/ + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make install_inc + +################################ +# build OpenCSD trace decode library +# +$(LIB_BASE_NAME)_lib: $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so + +$(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so: $(LIB_BASE_NAME)_all +$(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a: $(LIB_BASE_NAME)_all + +# single command builds both .a and .so targets in sub-makefile +$(LIB_BASE_NAME)_all: + mkdir -p $(LIB_TARGET_DIR) + cd $(OCSD_ROOT)/build/linux/ref_trace_decode_lib && make + +################################ +# build OpenCSD trace decode C API library +# +$(LIB_CAPI_NAME)_lib: $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so + +$(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so: $(LIB_CAPI_NAME)_all +$(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a: $(LIB_CAPI_NAME)_all + +# single command builds both .a and .so targets in sub-makefile +$(LIB_CAPI_NAME)_all: $(LIB_BASE_NAME)_lib + mkdir -p $(LIB_TARGET_DIR) + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make + +################################# +# build tests + +.PHONY: tests +tests: libs + cd $(OCSD_ROOT)/tests/build/linux/echo_test_dcd_lib && make + cd $(OCSD_ROOT)/tests/build/linux/snapshot_parser_lib && make + cd $(OCSD_ROOT)/tests/build/linux/trc_pkt_lister && make + cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && make + +############################################################# +# clean targets +# +clean: clean_libs clean_tests + +.PHONY: clean_libs clean_tests + +clean_libs: + cd $(OCSD_ROOT)/build/linux/ref_trace_decode_lib && make clean + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make clean + +clean_tests: + cd $(OCSD_ROOT)/tests/build/linux/echo_test_dcd_lib && make clean + cd $(OCSD_ROOT)/tests/build/linux/snapshot_parser_lib && make clean + cd $(OCSD_ROOT)/tests/build/linux/trc_pkt_lister && make clean + cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && make clean + +clean_install: + rm -f $(INSTALL_LIB_DIR)/lib$(LIB_BASE_NAME).so + rm -f $(INSTALL_LIB_DIR)/lib$(LIB_CAPI_NAME).so + rm -rf $(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR) diff --git a/decoder/build/linux/rctdl_c_api_lib/makefile b/decoder/build/linux/rctdl_c_api_lib/makefile new file mode 100644 index 000000000000..fb54d3ad8c24 --- /dev/null +++ b/decoder/build/linux/rctdl_c_api_lib/makefile @@ -0,0 +1,105 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - makefile for C API wrapper library +# + +CPP := $(MASTER_CPP) +LINKER := $(MASTER_LINKER) +LIB := $(MASTER_LIB) + +CPP_FLAGS := $(MASTER_CPP_FLAGS) -fpic -Wno-switch +LIB_FLAGS := $(MASTER_LIB_FLAGS) +LINKER_FLAGS := $(MASTER_LINKER_FLAGS) -shared + +LIB_NAME = lib$(LIB_CAPI_NAME) +SO_LIB_DEPS= -L$(LIB_TARGET_DIR) -l$(LIB_BASE_NAME) + +BUILD_DIR=./$(PLAT_DIR) + +VPATH= $(OCSD_SOURCE)/c_api + +CPP_INCLUDES= \ + -I$(OCSD_INCLUDE) \ + -I$(OCSD_SOURCE)/c_api + +OBJECTS=$(BUILD_DIR)/ocsd_c_api.o \ + $(BUILD_DIR)/ocsd_c_api_custom_obj.o + +INST_INC_SRC=$(OCSD_INCLUDE)/$(LIB_UAPI_INC_DIR) +INST_INC_DST=$(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR) + +all: build_dir $(OBJECTS) + mkdir -p $(LIB_TARGET_DIR) + $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + $(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS) $(SO_LIB_DEPS) + +build_dir: + mkdir -p $(BUILD_DIR) + +##### build rules + +## object dependencies +DEPS := $(OBJECTS:%.o=%.d) + +-include $(DEPS) + +## object compile +$(BUILD_DIR)/%.o : %.cpp + $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ + + +#### clean +.PHONY: clean +clean: + rm -f $(OBJECTS) + rm -f $(DEPS) + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so + +#### install the necessary include files for the c-api library on linux +install_inc: + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/trc_gen_elem_types.h $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ocsd_if_types.h $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/trc_pkt_types.h $(INST_INC_DST)/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/ptm + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ptm/trc_pkt_types_ptm.h $(INST_INC_DST)/ptm/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/stm + $(INSTALL) --mode=0644 $(INST_INC_SRC)/stm/trc_pkt_types_stm.h $(INST_INC_DST)/stm/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/etmv3 + $(INSTALL) --mode=0644 $(INST_INC_SRC)/etmv3/trc_pkt_types_etmv3.h $(INST_INC_DST)/etmv3/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/etmv4 + $(INSTALL) --mode=0644 $(INST_INC_SRC)/etmv4/trc_pkt_types_etmv4.h $(INST_INC_DST)/etmv4/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/c_api + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/ocsd_c_api_types.h $(INST_INC_DST)/c_api/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/opencsd_c_api.h $(INST_INC_DST)/c_api/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/ocsd_c_api_custom.h $(INST_INC_DST)/c_api/ + + diff --git a/decoder/build/linux/ref_trace_decode_lib/makefile b/decoder/build/linux/ref_trace_decode_lib/makefile new file mode 100644 index 000000000000..a356066d009f --- /dev/null +++ b/decoder/build/linux/ref_trace_decode_lib/makefile @@ -0,0 +1,143 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - makefile for main trace decode library +# + +CPP := $(MASTER_CPP) +LINKER := $(MASTER_LINKER) +LIB := $(MASTER_LIB) + +CPP_FLAGS := $(MASTER_CPP_FLAGS) -fpic -Wno-switch +LIB_FLAGS := $(MASTER_LIB_FLAGS) +LINKER_FLAGS := $(MASTER_LINKER_FLAGS) -shared + +LIB_NAME= lib$(LIB_BASE_NAME) + +BUILD_DIR=./$(PLAT_DIR) + +VPATH= $(OCSD_SOURCE) \ + $(OCSD_SOURCE)/etmv3 \ + $(OCSD_SOURCE)/etmv4 \ + $(OCSD_SOURCE)/ptm \ + $(OCSD_SOURCE)/i_dec \ + $(OCSD_SOURCE)/mem_acc \ + $(OCSD_SOURCE)/stm \ + $(OCSD_SOURCE)/pkt_printers + + +CPP_INCLUDES= \ + -I$(OCSD_INCLUDE) \ + -I$(OCSD_SOURCE) + +ETMV3OBJ= $(BUILD_DIR)/trc_cmp_cfg_etmv3.o \ + $(BUILD_DIR)/trc_pkt_decode_etmv3.o \ + $(BUILD_DIR)/trc_pkt_elem_etmv3.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv3.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv3_impl.o + +ETMV4OBJ= $(BUILD_DIR)/trc_cmp_cfg_etmv4.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv4.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv4i_impl.o \ + $(BUILD_DIR)/trc_pkt_decode_etmv4i.o \ + $(BUILD_DIR)/trc_pkt_elem_etmv4i.o \ + $(BUILD_DIR)/trc_pkt_elem_etmv4d.o \ + $(BUILD_DIR)/trc_etmv4_stack_elem.o + +PTMOBJ= $(BUILD_DIR)/trc_cmp_cfg_ptm.o \ + $(BUILD_DIR)/trc_pkt_elem_ptm.o \ + $(BUILD_DIR)/trc_pkt_proc_ptm.o \ + $(BUILD_DIR)/trc_pkt_decode_ptm.o + +IDECOBJ= $(BUILD_DIR)/trc_i_decode.o \ + $(BUILD_DIR)/trc_idec_arminst.o + +MEMACCOBJ= $(BUILD_DIR)/trc_mem_acc_mapper.o \ + $(BUILD_DIR)/trc_mem_acc_bufptr.o \ + $(BUILD_DIR)/trc_mem_acc_file.o \ + $(BUILD_DIR)/trc_mem_acc_base.o \ + $(BUILD_DIR)/trc_mem_acc_cb.o + +STMOBJ= $(BUILD_DIR)/trc_pkt_elem_stm.o \ + $(BUILD_DIR)/trc_pkt_proc_stm.o \ + $(BUILD_DIR)/trc_pkt_decode_stm.o + +PKTPRNTOBJ= $(BUILD_DIR)/raw_frame_printer.o \ + $(BUILD_DIR)/trc_print_fact.o + + +OBJECTS=$(BUILD_DIR)/ocsd_code_follower.o \ + $(BUILD_DIR)/ocsd_dcd_tree.o \ + $(BUILD_DIR)/ocsd_error.o \ + $(BUILD_DIR)/ocsd_error_logger.o \ + $(BUILD_DIR)/ocsd_gen_elem_list.o \ + $(BUILD_DIR)/ocsd_lib_dcd_register.o \ + $(BUILD_DIR)/ocsd_msg_logger.o \ + $(BUILD_DIR)/ocsd_version.o \ + $(BUILD_DIR)/trc_component.o \ + $(BUILD_DIR)/trc_core_arch_map.o \ + $(BUILD_DIR)/trc_frame_deformatter.o \ + $(BUILD_DIR)/trc_gen_elem.o \ + $(BUILD_DIR)/trc_printable_elem.o \ + $(BUILD_DIR)/trc_ret_stack.o \ + $(ETMV3OBJ) \ + $(ETMV4OBJ) \ + $(IDECOBJ) \ + $(MEMACCOBJ) \ + $(STMOBJ) \ + $(PTMOBJ) \ + $(PKTPRNTOBJ) + +all: build_dir $(OBJECTS) + mkdir -p $(LIB_TARGET_DIR) + $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + $(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS) + +build_dir: + mkdir -p $(BUILD_DIR) + +##### build rules + +## object dependencies +DEPS := $(OBJECTS:%.o=%.d) + +-include $(DEPS) + +## object compile +$(BUILD_DIR)/%.o : %.cpp + $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ + + +#### clean +.PHONY: clean +clean: + rm -f $(OBJECTS) + rm -f $(DEPS) + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so diff --git a/decoder/build/win-vs2015/opencsd.props b/decoder/build/win-vs2015/opencsd.props new file mode 100644 index 000000000000..64b1268db436 --- /dev/null +++ b/decoder/build/win-vs2015/opencsd.props @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros"> + <LIB_BASE_NAME>opencsd</LIB_BASE_NAME> + <LIB_CAPI_NAME>opencsd_c_api</LIB_CAPI_NAME> + </PropertyGroup> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup> + <BuildMacro Include="LIB_BASE_NAME"> + <Value>$(LIB_BASE_NAME)</Value> + <EnvironmentVariable>true</EnvironmentVariable> + </BuildMacro> + <BuildMacro Include="LIB_CAPI_NAME"> + <Value>$(LIB_CAPI_NAME)</Value> + <EnvironmentVariable>true</EnvironmentVariable> + </BuildMacro> + </ItemGroup> +</Project> diff --git a/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj b/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj new file mode 100644 index 000000000000..c82ad9bc5e3e --- /dev/null +++ b/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj @@ -0,0 +1,327 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug-dll|Win32"> + <Configuration>Debug-dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug-dll|x64"> + <Configuration>Debug-dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release-dll|Win32"> + <Configuration>Release-dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release-dll|x64"> + <Configuration>Release-dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{533F929A-A73B-46B6-9D5F-FFCD62F734E3}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>rctdl_c_api_lib</RootNamespace> + <ProjectName>ocsd_c_api_lib</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_CAPI_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <TargetName>$(LIB_CAPI_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>lib$(LIB_CAPI_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>$(LIB_CAPI_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>lib$(LIB_CAPI_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>$(LIB_CAPI_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_CAPI_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <TargetName>$(LIB_CAPI_NAME)</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;_OCSD_C_API_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;_OCSD_C_API_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;_OCSD_C_API_DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;_OCSD_C_API_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_custom.h" /> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_cust_fact.h" /> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_cust_impl.h" /> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_types.h" /> + <ClInclude Include="..\..\..\include\opencsd\c_api\opencsd_c_api.h" /> + <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.h" /> + <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_obj.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\ref_trace_decode_lib\ref_trace_decode_lib.vcxproj"> + <Project>{7f500891-cc76-405f-933f-f682bc39f923}</Project> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\c_api\ocsd_c_api.cpp" /> + <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj.filters b/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj.filters new file mode 100644 index 000000000000..a9b05adfdf4c --- /dev/null +++ b/decoder/build/win-vs2015/rctdl_c_api_lib/rctdl_c_api_lib.vcxproj.filters @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\c_api\opencsd_c_api.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_obj.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_custom.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_cust_fact.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\c_api\ocsd_c_api_cust_impl.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\c_api\ocsd_c_api.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.sln b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.sln new file mode 100644 index 000000000000..94b561a39848 --- /dev/null +++ b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.sln @@ -0,0 +1,135 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opencsd_lib", "ref_trace_decode_lib.vcxproj", "{7F500891-CC76-405F-933F-F682BC39F923}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ocsd_c_api_lib", "..\rctdl_c_api_lib\rctdl_c_api_lib.vcxproj", "{533F929A-A73B-46B6-9D5F-FFCD62F734E3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "snapshot_parser_lib", "..\..\..\tests\build\win-vs2015\snapshot_parser_lib\snapshot_parser_lib.vcxproj", "{DE1F395D-4F53-42FB-8AEF-993A4BF7E411}" + ProjectSection(ProjectDependencies) = postProject + {7F500891-CC76-405F-933F-F682BC39F923} = {7F500891-CC76-405F-933F-F682BC39F923} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "trc_pkt_lister", "..\..\..\tests\build\win-vs2015\trc_pkt_lister\trc_pkt_lister.vcxproj", "{18ABC652-AB11-4993-9491-1A7FB7117339}" + ProjectSection(ProjectDependencies) = postProject + {7F500891-CC76-405F-933F-F682BC39F923} = {7F500891-CC76-405F-933F-F682BC39F923} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c_api_pkt_print_test", "..\..\..\tests\build\win-vs2015\c_api_pkt_print_test\c_api_pkt_print_test.vcxproj", "{3AC169DA-E156-4D16-95DF-73D7302A5606}" + ProjectSection(ProjectDependencies) = postProject + {46219A32-8178-41C1-B3B1-B5A6E547515F} = {46219A32-8178-41C1-B3B1-B5A6E547515F} + {533F929A-A73B-46B6-9D5F-FFCD62F734E3} = {533F929A-A73B-46B6-9D5F-FFCD62F734E3} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ext_dcd_echo_test", "..\..\..\tests\build\win-vs2015\ext_dcd_echo_test\ext_dcd_echo_test.vcxproj", "{46219A32-8178-41C1-B3B1-B5A6E547515F}" + ProjectSection(ProjectDependencies) = postProject + {533F929A-A73B-46B6-9D5F-FFCD62F734E3} = {533F929A-A73B-46B6-9D5F-FFCD62F734E3} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7F500891-CC76-405F-933F-F682BC39F923}.Debug|Win32.ActiveCfg = Debug|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug|Win32.Build.0 = Debug|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug|x64.ActiveCfg = Debug|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug|x64.Build.0 = Debug|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Release|Win32.ActiveCfg = Release|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Release|Win32.Build.0 = Release|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Release|x64.ActiveCfg = Release|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Release|x64.Build.0 = Release|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {7F500891-CC76-405F-933F-F682BC39F923}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {7F500891-CC76-405F-933F-F682BC39F923}.Release-dll|x64.Build.0 = Release-dll|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug|Win32.ActiveCfg = Debug|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug|Win32.Build.0 = Debug|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug|x64.ActiveCfg = Debug|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug|x64.Build.0 = Debug|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release|Win32.ActiveCfg = Release|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release|Win32.Build.0 = Release|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release|x64.ActiveCfg = Release|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release|x64.Build.0 = Release|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {533F929A-A73B-46B6-9D5F-FFCD62F734E3}.Release-dll|x64.Build.0 = Release-dll|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug|Win32.ActiveCfg = Debug|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug|Win32.Build.0 = Debug|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug|x64.ActiveCfg = Debug|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug|x64.Build.0 = Debug|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release|Win32.ActiveCfg = Release|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release|Win32.Build.0 = Release|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release|x64.ActiveCfg = Release|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release|x64.Build.0 = Release|x64 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {DE1F395D-4F53-42FB-8AEF-993A4BF7E411}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug|Win32.ActiveCfg = Debug|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug|Win32.Build.0 = Debug|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug|x64.ActiveCfg = Debug|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug|x64.Build.0 = Debug|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release|Win32.ActiveCfg = Release|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release|Win32.Build.0 = Release|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release|x64.ActiveCfg = Release|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release|x64.Build.0 = Release|x64 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {18ABC652-AB11-4993-9491-1A7FB7117339}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug|Win32.ActiveCfg = Debug|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug|Win32.Build.0 = Debug|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug|x64.ActiveCfg = Debug|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug|x64.Build.0 = Debug|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release|Win32.ActiveCfg = Release|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release|Win32.Build.0 = Release|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release|x64.ActiveCfg = Release|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release|x64.Build.0 = Release|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {3AC169DA-E156-4D16-95DF-73D7302A5606}.Release-dll|x64.Build.0 = Release-dll|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug|Win32.ActiveCfg = Debug|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug|Win32.Build.0 = Debug|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug|x64.ActiveCfg = Debug|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug|x64.Build.0 = Debug|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug-dll|Win32.ActiveCfg = Debug|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug-dll|Win32.Build.0 = Debug|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug-dll|x64.ActiveCfg = Debug|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Debug-dll|x64.Build.0 = Debug|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release|Win32.ActiveCfg = Release|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release|Win32.Build.0 = Release|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release|x64.ActiveCfg = Release|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release|x64.Build.0 = Release|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release-dll|Win32.ActiveCfg = Release|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release-dll|Win32.Build.0 = Release|Win32 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release-dll|x64.ActiveCfg = Release|x64 + {46219A32-8178-41C1-B3B1-B5A6E547515F}.Release-dll|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj new file mode 100644 index 000000000000..123fc0061100 --- /dev/null +++ b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj @@ -0,0 +1,453 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug-dll|Win32"> + <Configuration>Debug-dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug-dll|x64"> + <Configuration>Debug-dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release-dll|Win32"> + <Configuration>Release-dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release-dll|x64"> + <Configuration>Release-dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{7F500891-CC76-405F-933F-F682BC39F923}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>ref_trace_decode_lib</RootNamespace> + <ProjectName>opencsd_lib</ProjectName> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\opencsd.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\rel\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> + <OutDir>..\..\..\lib\win$(PlatformArchitecture)\dbg\</OutDir> + <TargetName>lib$(LIB_BASE_NAME)</TargetName> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <TargetExt>.lib</TargetExt> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(OutDir)$(TargetName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <None Include="..\..\..\..\HOWTO.md" /> + <None Include="..\..\..\..\LICENSE" /> + <None Include="..\..\..\..\README.md" /> + <None Include="..\..\..\..\TODO" /> + <None Include="..\..\..\docs\build_libs.md" /> + <None Include="..\..\..\docs\external_custom.md" /> + <None Include="..\..\..\docs\test_progs.md" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\include\common\comp_attach_notifier_i.h" /> + <ClInclude Include="..\..\..\include\common\comp_attach_pt_t.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_code_follower.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_mngr.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_mngr_i.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_tree.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_tree_elem.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_error.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_error_logger.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_gen_elem_list.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_lib_dcd_register.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_msg_logger.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_pe_context.h" /> + <ClInclude Include="..\..\..\include\common\ocsd_version.h" /> + <ClInclude Include="..\..\..\include\common\trc_component.h" /> + <ClInclude Include="..\..\..\include\common\trc_core_arch_map.h" /> + <ClInclude Include="..\..\..\include\common\trc_cs_config.h" /> + <ClInclude Include="..\..\..\include\common\trc_frame_deformatter.h" /> + <ClInclude Include="..\..\..\include\common\trc_gen_elem.h" /> + <ClInclude Include="..\..\..\include\common\trc_pkt_decode_base.h" /> + <ClInclude Include="..\..\..\include\common\trc_pkt_elem_base.h" /> + <ClInclude Include="..\..\..\include\common\trc_pkt_proc_base.h" /> + <ClInclude Include="..\..\..\include\common\trc_printable_elem.h" /> + <ClInclude Include="..\..\..\include\common\trc_ret_stack.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\etmv3_decoder.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_cmp_cfg_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_dcd_mngr_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_decode_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_elem_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_proc_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_types_etmv3.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\etmv4_decoder.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_cmp_cfg_etmv4.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_dcd_mngr_etmv4i.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_etmv4_stack_elem.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_decode_etmv4i.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_elem_etmv4d.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_elem_etmv4i.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_proc_etmv4.h" /> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_types_etmv4.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_abs_typed_base_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_data_rawframe_in_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_data_raw_in_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_error_log_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_gen_elem_in_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_indexer_pkt_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_indexer_src_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_instr_decode_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_pkt_in_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_pkt_raw_in_i.h" /> + <ClInclude Include="..\..\..\include\interfaces\trc_tgt_mem_access_i.h" /> + <ClInclude Include="..\..\..\include\i_dec\trc_idec_arminst.h" /> + <ClInclude Include="..\..\..\include\i_dec\trc_i_decode.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_base.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_bufptr.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_cb.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_cb_if.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_file.h" /> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_mapper.h" /> + <ClInclude Include="..\..\..\include\opencsd\ocsd_if_types.h" /> + <ClInclude Include="..\..\..\include\ocsd_if_version.h" /> + <ClInclude Include="..\..\..\include\opencsd.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\gen_elem_printer.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\item_printer.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\pkt_printer_t.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\raw_frame_printer.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\trc_pkt_printers.h" /> + <ClInclude Include="..\..\..\include\pkt_printers\trc_print_fact.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\ptm_decoder.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_cmp_cfg_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_dcd_mngr_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_decode_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_elem_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_proc_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_types_ptm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\stm_decoder.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_cmp_cfg_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_dcd_mngr_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_decode_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_elem_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_proc_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_types_stm.h" /> + <ClInclude Include="..\..\..\include\opencsd\trc_gen_elem_types.h" /> + <ClInclude Include="..\..\..\include\opencsd\trc_pkt_types.h" /> + <ClInclude Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3_impl.h" /> + <ClInclude Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4d_impl.h" /> + <ClInclude Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4i_impl.h" /> + <ClInclude Include="..\..\..\source\trc_frame_deformatter_impl.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\etmv3\trc_cmp_cfg_etmv3.cpp" /> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_decode_etmv3.cpp" /> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_elem_etmv3.cpp" /> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3.cpp" /> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3_impl.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_cmp_cfg_etmv4.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_etmv4_stack_elem.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_decode_etmv4i.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_elem_etmv4d.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_elem_etmv4i.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4.cpp" /> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4i_impl.cpp" /> + <ClCompile Include="..\..\..\source\i_dec\trc_idec_arminst.cpp" /> + <ClCompile Include="..\..\..\source\i_dec\trc_i_decode.cpp" /> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_base.cpp" /> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_bufptr.cpp" /> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_cb.cpp" /> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_file.cpp" /> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_mapper.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_code_follower.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_dcd_tree.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_error.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_error_logger.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_gen_elem_list.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_lib_dcd_register.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_msg_logger.cpp" /> + <ClCompile Include="..\..\..\source\ocsd_version.cpp" /> + <ClCompile Include="..\..\..\source\pkt_printers\raw_frame_printer.cpp" /> + <ClCompile Include="..\..\..\source\pkt_printers\trc_print_fact.cpp" /> + <ClCompile Include="..\..\..\source\ptm\trc_cmp_cfg_ptm.cpp" /> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_decode_ptm.cpp" /> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_elem_ptm.cpp" /> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_proc_ptm.cpp" /> + <ClCompile Include="..\..\..\source\stm\trc_pkt_decode_stm.cpp" /> + <ClCompile Include="..\..\..\source\stm\trc_pkt_elem_stm.cpp" /> + <ClCompile Include="..\..\..\source\stm\trc_pkt_proc_stm.cpp" /> + <ClCompile Include="..\..\..\source\trc_component.cpp" /> + <ClCompile Include="..\..\..\source\trc_core_arch_map.cpp" /> + <ClCompile Include="..\..\..\source\trc_frame_deformatter.cpp" /> + <ClCompile Include="..\..\..\source\trc_gen_elem.cpp" /> + <ClCompile Include="..\..\..\source\trc_printable_elem.cpp" /> + <ClCompile Include="..\..\..\source\trc_ret_stack.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters new file mode 100644 index 000000000000..cceb92bd83ff --- /dev/null +++ b/decoder/build/win-vs2015/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters @@ -0,0 +1,488 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + <Filter Include="interfaces"> + <UniqueIdentifier>{80012968-9f0d-4623-901a-c2fa5f1c0890}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\etmv3"> + <UniqueIdentifier>{98cd2a71-b44f-4884-bb8a-56c851cc8321}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\etmv4"> + <UniqueIdentifier>{dd155712-7990-4cdd-b9b0-299d97f625e4}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\ptm"> + <UniqueIdentifier>{9ec501e2-9ba4-4bad-a3d3-cdb604cc38b4}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\mem_acc"> + <UniqueIdentifier>{23a35c62-e38f-43f6-a03b-6f1287478a69}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\i_dec"> + <UniqueIdentifier>{f550018a-8974-4f8b-975a-bd8b86ae418f}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\stm"> + <UniqueIdentifier>{2c796b59-81f6-49c9-88cf-e90ed2e741a3}</UniqueIdentifier> + </Filter> + <Filter Include="docs-files"> + <UniqueIdentifier>{5ea7e02d-0667-4d2d-8c3d-039daf112edc}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\ptm"> + <UniqueIdentifier>{2aa8a97b-13da-4bd1-bdb5-02f3e1cf030b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\etmv4"> + <UniqueIdentifier>{ff9157b6-ef07-41e4-8ff4-322c50ea6665}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\etmv3"> + <UniqueIdentifier>{0c2ba881-cc82-4567-ab59-d2363b4c3d1b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\stm"> + <UniqueIdentifier>{73a56760-b7ff-4d56-88f0-13249201081c}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\i_dec"> + <UniqueIdentifier>{cb3682ee-abbd-44c3-a175-4522d76e2d68}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\mem_acc"> + <UniqueIdentifier>{eb9beab1-99c6-4eaa-88c0-893b05b2e673}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\common"> + <UniqueIdentifier>{58d2398e-efdd-45d9-b7be-fc6096f3bec2}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\pkt_printers"> + <UniqueIdentifier>{0e6e1f5d-465e-4f91-88a3-479952bbd316}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\pkt_printers"> + <UniqueIdentifier>{baf047d0-0ff7-4502-b42b-4f1fda94d54b}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\..\LICENSE"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\..\README.md"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\..\TODO"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\docs\build_libs.md"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\docs\test_progs.md"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\..\HOWTO.md"> + <Filter>docs-files</Filter> + </None> + <None Include="..\..\..\docs\external_custom.md"> + <Filter>docs-files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\trc_frame_deformatter_impl.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_tgt_mem_access_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_pkt_raw_in_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_pkt_in_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_instr_decode_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_indexer_src_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_indexer_pkt_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_gen_elem_in_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_error_log_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_data_raw_in_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_data_rawframe_in_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\etmv3_decoder.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_elem_etmv3.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_cmp_cfg_etmv3.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_proc_etmv3.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_types_etmv3.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_proc_etmv4.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_types_etmv4.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_elem_etmv4d.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_elem_etmv4i.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_cmp_cfg_etmv4.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\etmv4_decoder.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_elem_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_cmp_cfg_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_types_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_proc_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\ptm_decoder.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_base.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_file.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_bufptr.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_mapper.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\i_dec\trc_idec_arminst.h"> + <Filter>Header Files\i_dec</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\i_dec\trc_i_decode.h"> + <Filter>Header Files\i_dec</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_pkt_decode_etmv4i.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\stm_decoder.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_elem_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_cmp_cfg_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_proc_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_types_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_pkt_decode_etmv3.h"> + <Filter>Header Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_cb_if.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\mem_acc\trc_mem_acc_cb.h"> + <Filter>Header Files\mem_acc</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_pkt_decode_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4d_impl.h"> + <Filter>Source Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4i_impl.h"> + <Filter>Source Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3_impl.h"> + <Filter>Source Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\comp_attach_notifier_i.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\comp_attach_pt_t.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_tree.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_tree_elem.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_error.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_error_logger.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_msg_logger.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_version.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_component.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_core_arch_map.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_frame_deformatter.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_gen_elem.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_pkt_decode_base.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_pkt_proc_base.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_printable_elem.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_pe_context.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_code_follower.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_gen_elem_list.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_cs_config.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_mngr.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_dcd_mngr_i.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\ocsd_lib_dcd_register.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\interfaces\trc_abs_typed_base_i.h"> + <Filter>interfaces</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_dcd_mngr_etmv4i.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv3\trc_dcd_mngr_etmv3.h"> + <Filter>Source Files\etmv3</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ptm\trc_dcd_mngr_ptm.h"> + <Filter>Header Files\ptm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_dcd_mngr_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_pkt_elem_base.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\stm\trc_pkt_decode_stm.h"> + <Filter>Header Files\stm</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\ocsd_if_version.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\gen_elem_printer.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\item_printer.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\pkt_printer_t.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\raw_frame_printer.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\trc_pkt_printers.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pkt_printers\trc_print_fact.h"> + <Filter>Header Files\pkt_printers</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\common\trc_ret_stack.h"> + <Filter>Header Files\common</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\etmv4\trc_etmv4_stack_elem.h"> + <Filter>Header Files\etmv4</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\ocsd_if_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\trc_gen_elem_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\opencsd\trc_pkt_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\trc_component.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\trc_frame_deformatter.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\trc_core_arch_map.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\trc_printable_elem.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\trc_gen_elem.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_decode_ptm.cpp"> + <Filter>Source Files\ptm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_elem_ptm.cpp"> + <Filter>Source Files\ptm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ptm\trc_pkt_proc_ptm.cpp"> + <Filter>Source Files\ptm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_elem_etmv4d.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_elem_etmv4i.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_proc_etmv4i_impl.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_pkt_decode_etmv4i.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_elem_etmv3.cpp"> + <Filter>Source Files\etmv3</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_decode_etmv3.cpp"> + <Filter>Source Files\etmv3</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv3\trc_cmp_cfg_etmv3.cpp"> + <Filter>Source Files\etmv3</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3.cpp"> + <Filter>Source Files\etmv3</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv3\trc_pkt_proc_etmv3_impl.cpp"> + <Filter>Source Files\etmv3</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_cmp_cfg_etmv4.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ptm\trc_cmp_cfg_ptm.cpp"> + <Filter>Source Files\ptm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\stm\trc_pkt_proc_stm.cpp"> + <Filter>Source Files\stm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\stm\trc_pkt_elem_stm.cpp"> + <Filter>Source Files\stm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\i_dec\trc_i_decode.cpp"> + <Filter>Source Files\i_dec</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\i_dec\trc_idec_arminst.cpp"> + <Filter>Source Files\i_dec</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_base.cpp"> + <Filter>Source Files\mem_acc</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_mapper.cpp"> + <Filter>Source Files\mem_acc</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_bufptr.cpp"> + <Filter>Source Files\mem_acc</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_cb.cpp"> + <Filter>Source Files\mem_acc</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\mem_acc\trc_mem_acc_file.cpp"> + <Filter>Source Files\mem_acc</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_dcd_tree.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_error.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_error_logger.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_msg_logger.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_version.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_code_follower.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_gen_elem_list.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ocsd_lib_dcd_register.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\stm\trc_pkt_decode_stm.cpp"> + <Filter>Source Files\stm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\pkt_printers\raw_frame_printer.cpp"> + <Filter>Source Files\pkt_printers</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\pkt_printers\trc_print_fact.cpp"> + <Filter>Source Files\pkt_printers</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\trc_ret_stack.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\etmv4\trc_etmv4_stack_elem.cpp"> + <Filter>Source Files\etmv4</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/decoder/docs/build_libs.md b/decoder/docs/build_libs.md new file mode 100644 index 000000000000..b7c8536ca5f0 --- /dev/null +++ b/decoder/docs/build_libs.md @@ -0,0 +1,113 @@ +Building and using the Library {#build_lib} +============================== + +@brief How to build the library and test programs and include the library in an application + +Platform Support +---------------- + +The current makefiles and build projects support building the library on Linux and Windows, +x86 or x64 hosts. + +Support is expected for ARM linux and baremetal, AArch32 and AArch64 platforms. + + +Building the Library +-------------------- + +The library and test programs are built from the library `./build/<platform>` directory. + +See [`./docs/test_progs.md`](@ref test_progs) for further information on use of the test +programs. + +### Linux x86/x64 ### + +Go to the `./build/linux/` and run `make` in that directory. + +Options to pass to the makefile are:- +- `LINUX64=1` : build the 64 bit version of the library +- `DEBUG=1` : build the debug version of the library. + +Libraries are delivered to the `./lib/linux<bitsize>/<dbg\rel>` directories. +e.g. `./lib/linux64/rel` will contain the linux 64 bit release libraries. + +The following libraries are built:- +- `libcstraced.so` : shared library containing the main C++ based decoder library +- `libcstraced_c_api.so` : shared library containing the C-API wrapper library. Dependent on `libcstraced.so` +- `libcstraced.a` : static library containing the main C++ based decoder library. +- `libcstraced_c_api.a` : static library containing the C-API wrapper library. + +Test programs are delivered to the `./tests/bin/linux<bitsize>/<dgb\rel>` directories. + +The test programs are built to used the .so versions of the libraries. +- `trc_pkt_lister` - dependent on `libcstraced.so`. +- `simple_pkt_print_c_api` - dependent on `libcstraced_c_api.so` & hence `libcstraced.so`. + +The test program build for `trc_pkt_lister` also builds an auxiliary library used by this program for test purposes only. +This is the `libsnapshot_parser.a` library, delivered to the `./tests/lib/linux<bitsize>/<dgb\rel>` directories. + +### Windows ### + +Use the `.\build\win\ref_trace_decode_lib\ref_trace_decode_lib.sln` file to load a solution +which contains all library and test build projects. + +Libraries are delivered to the `./lib/win<bitsize>/<dbg\rel>` directories. +e.g. `./lib/win64/rel` will contain the windows 64 bit release libraries. + +The solution contains four configurations:- +- *Debug* : builds debug versions of static C++ main library and C-API libraries, test programs linked to the static library. +- *Debug-dll* : builds debug versions of static main library and C-API DLL. C-API statically linked to the main library. +C-API test built as `simple_pkt_print_c_api-dl.exe` and linked against the DLL version of the C-API library. +- *Release* : builds release static library versions, test programs linked to static libraries. +- *Release-dll* : builds release C-API DLL, static main library. + +_Note_: Currently there is no Windows DLL version of the main C++ library. This may follow once +the project is nearer completion with further decode protocols, and the classes requiring export are established.. + +Libraries built are:- +- `libcstraced.lib` : static main C++ decoder library. +- `cstraced_c_api.dll` : C-API DLL library. Statically linked against `libcstraced.lib` at .DLL build time. +- `libcstraced_c_api.lib` : C-API static library. + +There is also a project file to build an auxiliary library used `trc_pkt_lister` for test purposes only. +This is the `snapshot_parser_lib.lib` library, delivered to the `./tests/lib/win<bitsize>/<dgb\rel>` directories. + + +### Additional Build Options ### + +__Library Virtual Address Size__ + +The ocsd_if_types.h file includes a #define that controls the size of the virtual addresses +used within the library. By default this is a 64 bit `uint64_t` value. + +When building for ARM architectures that have only a 32 bit Virtual Address, and building on +32 bit ARM architectures it may be desirable to build a library that uses a v-addr size of +32 bits. Define `USE_32BIT_V_ADDR` to enable this option + + +Including the Library in an Application +--------------------------------------- + +The user source code includes a header according to the API to be used:- + +- Main C++ decoder library - include `opencsd.h`. Link to C++ library. +- C-API library - include `opencsd_c_api.h`. Link to C-API library. + +### Linux build ### + +By default linux builds will link against the .so versions of the library. Using the C-API library will also +introduce a dependency on the main C++ decoder .so. Ensure that the library paths and link commands are part of the +application makefile. + +To use the static versions use appropriate linker options. + +### Windows build ### + +To link against the C-API DLL, include the .DLL name as a dependency in the application project options. + +To link against the C-API static library, include the library name in the dependency list, and define the macro +`OCSD_USE_STATIC_C_API` in the preprocessor definitions. This ensures that the correct static bindings are declared in +the header file. Also link against the main C++ library. + +To link against the main C++ library include the library name in the dependency list. + diff --git a/decoder/docs/doxygen_config.dox b/decoder/docs/doxygen_config.dox new file mode 100644 index 000000000000..acc6137f4264 --- /dev/null +++ b/decoder/docs/doxygen_config.dox @@ -0,0 +1,2413 @@ +# Doxyfile 1.8.8 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "OpenCSD - CoreSight Trace Decode Library" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = 0.5 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./. + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if <section_label> ... \endif and \cond <section_label> +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = ../include \ + ../include/interfaces \ + ../include/etmv3 \ + ../include/etmv4 \ + ../include/ptm \ + ../include/c_api \ + ../include/stm \ + ../include/mem_acc \ + ../../README.md \ + . \ + ../../HOWTO.md \ + ../include/common \ + ../include + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# <filter> <input-file> +# +# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# compiled with the --with-libclang option. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra stylesheet files is of importance (e.g. the last +# stylesheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use <access key> + S +# (what the <access key> is depends on the OS and browser, but it is typically +# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down +# key> to jump into the search results window, the results can be navigated +# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel +# the search. The filter options can be selected when the cursor is inside the +# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> +# to select a filter and <Enter> or <escape> to activate or cancel the filter +# option. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. There +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain the +# search results. +# +# Doxygen ships with an example indexer ( doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: http://xapian.org/). +# +# See the section "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will return the search results when EXTERNAL_SEARCH is enabled. +# +# Doxygen ships with an example indexer ( doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Searching" for details. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. +# The default file is: searchdata.xml. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of +# to a relative location where the documentation can be found. The format is: +# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. +# The default value is: YES. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. +# +# Note that when enabling USE_PDFLATEX this option is only used for generating +# bitmaps for formulas in the HTML output, but not in the Makefile that is +# written to the output directory. +# The default file is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate +# index for LaTeX. +# The default file is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used by the +# printer. +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x +# 14 inches) and executive (7.25 x 10.5 inches). +# The default value is: a4. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names +# that should be included in the LaTeX output. To get the times font for +# instance you can specify +# EXTRA_PACKAGES=times +# If left blank no extra packages will be included. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the +# generated LaTeX document. The header should contain everything until the first +# chapter. If it is left blank doxygen will generate a standard header. See +# section "Doxygen usage" for information on how to let doxygen write the +# default header to a separate file. +# +# Note: Only use a user-defined header if you know what you are doing! The +# following commands have a special meaning inside the header: $title, +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string, +# for the replacement values of the other commands the user is refered to +# HTML_HEADER. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the +# generated LaTeX document. The footer should contain everything after the last +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. +# +# Note: Only use a user-defined footer if you know what you are doing! +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_FOOTER = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the LATEX_OUTPUT output +# directory. Note that the files will be copied as-is; there are no commands or +# markers available. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will +# contain links (just like the HTML output) instead of page references. This +# makes the output suitable for online browsing using a PDF viewer. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate +# the PDF file directly from the LaTeX files. Set this option to YES to get a +# higher quality PDF documentation. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode +# command to the generated LaTeX files. This will instruct LaTeX to keep running +# if errors occur, instead of asking the user for help. This option is also used +# when generating formulas in HTML. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BATCHMODE = NO + +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the +# index chapters (such as File Index, Compound Index, etc.) in the output. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HIDE_INDICES = NO + +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source +# code with syntax highlighting in the LaTeX output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. See +# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# The default value is: plain. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The +# RTF output is optimized for Word 97 and may not look too pretty with other RTF +# readers/editors. +# The default value is: NO. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: rtf. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will +# contain hyperlink fields. The RTF file will contain links (just like the HTML +# output) instead of page references. This makes the output suitable for online +# browsing using Word or some other Word compatible readers that support those +# fields. +# +# Note: WordPad (write) and others do not support links. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's config +# file, i.e. a series of assignments. You only have to provide replacements, +# missing definitions are set to their default value. +# +# See also section "Doxygen usage" for information on how to generate the +# default style sheet that doxygen normally uses. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an RTF document. Syntax is +# similar to doxygen's config file. A template extensions file can be generated +# using doxygen -e rtf extensionFile. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for +# classes and files. +# The default value is: NO. + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. A directory man3 will be created inside the directory specified by +# MAN_OUTPUT. +# The default directory is: man. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to the generated +# man pages. In case the manual section does not start with a number, the number +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is +# optional. +# The default value is: .3. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_EXTENSION = .3 + +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it +# will generate one additional man file for each entity documented in the real +# man page(s). These additional files only source the real man page, but without +# them the man command would be unable to find the correct page. +# The default value is: NO. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that +# captures the structure of the code including all documentation. +# The default value is: NO. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: xml. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_OUTPUT = xml + +# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program +# listings (including syntax highlighting and cross-referencing information) to +# the XML output. Note that enabling this will significantly increase the size +# of the XML output. +# The default value is: YES. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files +# that can be used to generate PDF. +# The default value is: NO. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. +# The default directory is: docbook. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_OUTPUT = docbook + +# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen +# Definitions (see http://autogen.sf.net) file that captures the structure of +# the code including all documentation. Note that this feature is still +# experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module +# file that captures the structure of the code including all documentation. +# +# Note that this feature is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI +# output from the Perl module output. +# The default value is: NO. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely +# formatted so it can be parsed by a human reader. This is useful if you want to +# understand what is going on. On the other hand, if this tag is set to NO the +# size of the Perl module output will be much smaller and Perl will parse it +# just the same. +# The default value is: YES. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file are +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful +# so different doxyrules.make files included by the same Makefile don't +# overwrite each other's variables. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all +# C-preprocessor directives found in the sources and include files. +# The default value is: YES. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names +# in the source code. If set to NO only conditional compilation will be +# performed. Macro expansion can be done in a controlled way by setting +# EXPAND_ONLY_PREDEF to YES. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then +# the macro expansion is limited to the macros specified with the PREDEFINED and +# EXPAND_AS_DEFINED tags. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES the includes files in the +# INCLUDE_PATH will be searched if a #include is found. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by the +# preprocessor. +# This tag requires that the tag SEARCH_INCLUDES is set to YES. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will be +# used. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that are +# defined before the preprocessor is started (similar to the -D option of e.g. +# gcc). The argument of the tag is a list of macros of the form: name or +# name=definition (no spaces). If the definition and the "=" are omitted, "=1" +# is assumed. To prevent a macro definition from being undefined via #undef or +# recursively expanded use the := operator instead of the = operator. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this +# tag can be used to specify a list of macro names that should be expanded. The +# macro definition that is found in the sources will be used. Use the PREDEFINED +# tag if you want to use a different macro definition that overrules the +# definition found in the source code. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will +# remove all references to function-like macros that are alone on a line, have +# an all uppercase name, and do not end with a semicolon. Such function macros +# are typically used for boiler-plate code, and will confuse the parser if not +# removed. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tag files. For each tag +# file the location of the external documentation should be added. The format of +# a tag file without this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where loc1 and loc2 can be relative or absolute paths or URLs. See the +# section "Linking to external documentation" for more information about the use +# of tag files. +# Note: Each tag file must have a unique name (where the name does NOT include +# the path). If a tag file is not located in the directory in which doxygen is +# run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create a +# tag file that is based on the input files it reads. See section "Linking to +# external documentation" for more information about the usage of tag files. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external class will be listed in the +# class index. If set to NO only the inherited external classes will be listed. +# The default value is: NO. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in +# the modules index. If set to NO, only the current project's groups will be +# listed. +# The default value is: YES. + +EXTERNAL_GROUPS = YES + +# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in +# the related pages index. If set to NO, only the current project's pages will +# be listed. +# The default value is: YES. + +EXTERNAL_PAGES = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of 'which perl'). +# The default file (with absolute path) is: /usr/bin/perl. + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram +# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to +# NO turns the diagrams off. Note that this option also works with HAVE_DOT +# disabled, but it is recommended to install and use dot, since it yields more +# powerful graphs. +# The default value is: YES. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see: +# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. + +DIA_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide inheritance +# and usage relations if the target is undocumented or is not a class. +# The default value is: YES. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz (see: +# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# Bell Labs. The other options in this section have no effect if this option is +# set to NO +# The default value is: NO. + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed +# to run in parallel. When set to 0 doxygen will base this on the number of +# processors available in the system. You can set it explicitly to a value +# larger than 0 to get control over the balance between CPU load and processing +# speed. +# Minimum value: 0, maximum value: 32, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NUM_THREADS = 0 + +# When you want a differently looking font in the dot files that doxygen +# generates you can specify the font name using DOT_FONTNAME. You need to make +# sure dot is able to find the font, which can be done by putting it in a +# standard location or by setting the DOTFONTPATH environment variable or by +# setting DOT_FONTPATH to the directory containing the font. +# The default value is: Helvetica. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of +# dot graphs. +# Minimum value: 4, maximum value: 24, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the default font as specified with +# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set +# the path where dot can find it using this tag. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTPATH = + +# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for +# each documented class showing the direct and indirect inheritance relations. +# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a +# graph for each documented class showing the direct and indirect implementation +# dependencies (inheritance, containment, and class references variables) of the +# class with other documented classes. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for +# groups, showing the direct groups dependencies. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the +# class node. If there are many fields or methods and many nodes the graph may +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the +# number of items for each type to make the size more manageable. Set this to 0 +# for no limit. Note that the threshold may be exceeded by 50% before the limit +# is enforced. So when you set the threshold to 10, up to 15 fields may appear, +# but if the number exceeds 15, the total amount of fields shown is limited to +# 10. +# Minimum value: 0, maximum value: 100, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LIMIT_NUM_FIELDS = 10 + +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and +# collaboration graphs will show the relations between templates and their +# instances. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +TEMPLATE_RELATIONS = NO + +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to +# YES then doxygen will generate a graph for each documented file showing the +# direct and indirect include dependencies of the file with other documented +# files. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDE_GRAPH = YES + +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are +# set to YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other documented +# files. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH tag is set to YES then doxygen will generate a call +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical +# hierarchy of all classes instead of a textual one. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the +# dependencies a directory has on other directories in a graphical way. The +# dependency relations are determined by the #include relations between the +# files in the directories. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order +# to make the SVG files visible in IE 9+ (other browsers do not have this +# requirement). +# Possible values are: png, jpg, gif and svg. +# The default value is: png. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# +# Note that this requires a modern browser other than Internet Explorer. Tested +# and working are Firefox, Chrome, Safari, and Opera. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make +# the SVG files visible. Older versions of IE do not have SVG support. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +INTERACTIVE_SVG = NO + +# The DOT_PATH tag can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the \dotfile +# command). +# This tag requires that the tag HAVE_DOT is set to YES. + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = + +# The DIAFILE_DIRS tag can be used to specify one or more directories that +# contain dia files that are included in the documentation (see the \diafile +# command). + +DIAFILE_DIRS = + +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. +# This tag requires that the tag HAVE_DOT is set to YES. + +PLANTUML_JAR_PATH = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes +# that will be shown in the graph. If the number of nodes in a graph becomes +# larger than this value, doxygen will truncate the graph, which is visualized +# by representing a node as a red box. Note that doxygen if the number of direct +# children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that +# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. +# Minimum value: 0, maximum value: 10000, default value: 50. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs +# generated by dot. A depth value of 3 means that only nodes reachable from the +# root by following a path via at most 3 edges will be shown. Nodes that lay +# further from the root node will be omitted. Note that setting this option to 1 +# or 2 may greatly reduce the computation time needed for large code bases. Also +# note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. +# Minimum value: 0, maximum value: 1000, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not seem +# to support this out of the box. +# +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) support +# this, this feature is disabled by default. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page +# explaining the meaning of the various boxes and arrows in the dot generated +# graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot +# files that are used to generate the various graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_CLEANUP = YES diff --git a/decoder/docs/external_custom.md b/decoder/docs/external_custom.md new file mode 100644 index 000000000000..64e51915ca81 --- /dev/null +++ b/decoder/docs/external_custom.md @@ -0,0 +1,148 @@ +Attaching External Custom Decoders {#custom_decoders} +================================== + +@brief A description of the C API external decoder interface. + +Introduction +------------ + +An external custom decoder is one which decodes a CoreSight trace byte stream from a source other +than an ARM core which cannot be decoded by the standard built-in decoders within the library. + +An example of this may be a trace stream from a DSP device. + +The external decoder API allows a suitable decoder to be attached to the library and used in the +same way as the built-in decoders. This means that the external decoder can be created and destroyed +using the decode tree API, and will integrate seamlessly with any ARM processor decoders that are part +of the same tree. + +An external decoder will be required to use three standard structures:- + +- `ocsd_extern_dcd_fact_t` : This is a decoder "factory" that allows the creation of the custom decoders. +- `ocsd_extern_dcd_inst_t` : This structure provides decoder data to the library for a single decoder instance. +- `ocsd_extern_dcd_cb_fns` : This structure provides a set of callback functions allowing the decoder to use library functionality in the same way as built-in decoders. + +These structures consist of data and function pointers to allow integration with the library infrastructure. + +Registering A Decoder +--------------------- + +A single API function is provided to allow a decoder to be registered with the library by name. + + ocsd_err_t ocsd_register_custom_decoder(const char *name, ocsd_extern_dcd_fact_t *p_dcd_fact); + +This registers the custom decoder with the library using the supplied name and factory structure. +As part of the registration function the custom decoder will be assigned a protocol ID which may be used in +API functions requiring this parameter. + +Once registered, the standard API functions used with the built-in decoders will work with the custom decoder. + +The Factory Structure +--------------------- +This structure contains the interface that is registered with the library to allow the creation of custom decoder instances. + +The mandatory functions that must be provided include: +- `fnCreateCustomDecoder` : Creates a decoder. This function will fill in a `ocsd_extern_dcd_inst_t` structure for the decoder instance. +- `fnDestroyCustomDecoder` : Destroys the decoder. Takes the `decoder_handle` attribute of the instance structure. +- `fnGetCSIDFromConfig` : Extracts the CoreSight Trace ID from the decoder configuration structure. + May be called before the create function. The CSID is used as part of the creation process to + attach the decoder to the correct trace byte stream. + +`fnPacketToString` : This optional function will provide a human readable string from a protocol specific packet structure. + +`protocol_id` : This is filled in when the decoder type is registered with the library. Used in some API + calls to specify the decoder protocol type. + + + +Creating a Custom Decoder Instance +---------------------------------- + +Once the custom decoder factory has been registered with the library then using the decoder uses the standard creation API:- + +`ocsd_dt_create_decoder(const dcd_tree_handle_t handle, const char *decoder_name, const int create_flags, + const void *decoder_cfg, unsigned char *pCSID)` + + +This creates a decoder by type name in the current decode tree and attaches it to the trace data stream associated with a CoreSight trace ID extracted from +the trace configuration. + +To create a custom decoder instance simply use the custom name and a pointer to the custom configuration structure. + +Calling this on a custom decoder name will result in a call to the factor function `fnCreateCustomDecoder` function:- +`ocsd_err_t CreateCustomDecoder(const int create_flags, const void *decoder_cfg, const ocsd_extern_dcd_cb_fns *p_lib_callbacks, ocsd_extern_dcd_inst_t *p_decoder_inst)` + +This will first require that the `ocsd_extern_dcd_inst_t` structure is populated. + +There is are two mandatory function calls in this structure that may be called by the library + + `fnTraceDataIn` : the decoder must provide this as this is called by the library to provide the + raw trace data to the decoder. + + `fn_update_pkt_mon` : Allows the library to communicate when packet sink / packet monitor interfaces are attached to the decoder and in use. + +The decoder creation process will also fill in the additional information to allow the library to correctly call back into the custom decoder using the `decoder_handle` parameter. + +Secondly the library will provide a structure of callback functions - `ocsd_extern_dcd_cb_fns` - that the decoder can use to access standard library functionality. +This includes the standard error and message logging functions, the memory access and ARM instruction decode functions, plus the current output sink for generic +trace elements generated by the decoder. The decoder is not required to use these functions - indeed the ARM instruction decode will not be useful to none ARM +architecture decoders, but should where possible use these functions if being used as part of a combined ARM / custom decoder tree. This will simplify client +use of the external decoders. + +The `create_flags` parameter will describe the expected operational mode for the decoder. The flags are:- +- `OCSD_CREATE_FLG_PACKET_PROC` : Packet processing only - the decoder will split the incoming stream into protocol trace packets and output these. +- `OCSD_CREATE_FLG_FULL_DECODER` : Full decode - the decoder will split the incoming stream into protocol trace packets and further decode and analyse these to produce generic trace output which may describe the program flow. + +Finally the decoder creation function will interpret the custom configuration (`decoder_cfg`) and fill in the CoreSight Trace ID parameter `pCSID` +for this decoder instance. Decoder configuration structures describe registers and parameters used in programming up the trace source. The only +minimum requirement is that it is possible to extract a CoreSight trace ID from the configuration to allow the library to attach the correct byte +stream to the decoder. + + +Example : The echo_test decoder +-------------------------------- + +The echo_test decoder is provided to both test the C-API interfaces provided for using custom decoders and as a worked example for using these interfaces. + +This decoder is initialised and created by the `c_api_pkt_print_test` program when the `-extern` command line option is used. + +In order to use a custom decoder, the header files for that decoder must be included by the client as they are not part of the built-in provided by the standard library includes. + + #include "ext_dcd_echo_test_fact.h" // provides the ext_echo_get_dcd_fact() fn + #include "ext_dcd_echo_test.h" // provides the echo_dcd_cfg_t config structure. + +The `register_extern_decoder()` function in the test shows how simple the API is to use. + +The implementation of the decoder provides an external function to get a factory structure. + + p_ext_fact = ext_echo_get_dcd_fact(); + +Assuming this returns a structure then the decoder is registered by name. + + if (p_ext_fact) + { + err = ocsd_register_custom_decoder(EXT_DCD_NAME, p_ext_fact); + } + +After this the test uses the same code path as the built in decoders when testing the custom decoder. +The test function `ocsd_err_t create_decoder_extern(dcd_tree_handle_t dcd_tree_h)` is called if the test parameters indicate a custom decoder is needed. +This populates the custom configuration structure specific to the echo_test decoder (`echo_dcd_cfg_t`), then passes this plus the decoder name to the same `create_generic_decoder()` function used when testing the built in decoders. + + + static ocsd_err_t create_decoder_extern(dcd_tree_handle_t dcd_tree_h) + { + echo_dcd_cfg_t trace_cfg_ext; + + /* setup the custom configuration */ + trace_cfg_ext.cs_id = 0x010; + if (test_trc_id_override != 0) + { + trace_cfg_ext.cs_id = (uint32_t)test_trc_id_override; + } + + /* create an external decoder - no context needed as we have a single stream to a single handler. */ + return create_generic_decoder(dcd_tree_h, EXT_DCD_NAME, (void *)&trace_cfg_ext, 0); + } + +From the test program perspective, these are the only changes made to the test program to test this decoder. +The `create_generic_decoder()` then uses the normal C-API calls such as `ocsd_dt_create_decoder()` and `ocsd_dt_attach_packet_callback()` to hook the decoder into the decode tree infrastructure. diff --git a/decoder/docs/specs/ARM Trace and Debug Snapshot file format 0v2.pdf b/decoder/docs/specs/ARM Trace and Debug Snapshot file format 0v2.pdf Binary files differnew file mode 100644 index 000000000000..7a9b16f8291b --- /dev/null +++ b/decoder/docs/specs/ARM Trace and Debug Snapshot file format 0v2.pdf diff --git a/decoder/docs/test_progs.md b/decoder/docs/test_progs.md new file mode 100644 index 000000000000..51cb526085a7 --- /dev/null +++ b/decoder/docs/test_progs.md @@ -0,0 +1,199 @@ +Test Programs {#test_progs} +============= + +@brief A description of the test programs used with the library. + +The Programs +------------ + +There are currently two test programs built alongside the library. + +1. `trc_pkt_lister` : This test the C++ library by taking a trace "snapshot" directory as an input +and decodes all or a chosen set of trace sources from within the trace data buffers in the library. Command +line parameters allow the test program to be controlled. + +2. `c_api_pkt_print_test` : This program tests the "C" API functions, using hardcoded tests +based on the same "snapshots" used for the C++ library. Limited user control for this program. +This can also run tests using the external test decoder to validate the external decoder API. +See [external_custom.md](@ref custom_decoders) for details. + +These programs are both built at the same time as the library for the same set of platforms. +See [build_libs.md](@ref build_lib) for build details. + + +Trace "Snapshot" directory. +---------------------------- + +The `.\tests\snapshots` directory contains a number of trace snapshots used for testing the library. +Trace snapshots are dumps of captured binary trace data, CoreSight component configurations and memory +dumps to allow trace decode. + +Snapshots are generated on ARM targets and can then be analysed offline. The snapshot format is available +in a separate document. + +The `trc_pkt_lister` program. +----------------------------- + +This will take a snapshot directory as an input, and list and/or decode all the trace packets for a +single source, for any currently supported protocol. + +The output will be a list of discrete packets, generic output packets and any error messages +to file and/or screen as selected by the input command line options. + +By default the program will list packets only (no decode), for the first discovered trace sink +(ETB, ETF, ETR) in the snapshot directory, with all streams output. + +__Command Line Options__ + +*Snapshot selection* + +- `-ss_dir <dir>` : Set the directory path to a trace snapshot. +- `-ss_verbose` : Verbose output when reading the snapshot. + +*Decode options* + +- `-id <n>` : Set an ID to list (may be used mutiple times) - default if no id set is for all IDs to be printed. +- `-src_name <name>` : List packets from a given snapshot source name (defaults to first source found). +- `-decode` : Full decode of the packets from the trace snapshot (default is to list undecoded packets only. +- `-decode_only` : Does not list the undecoded packets, just the trace decode. +- `-o_raw_packed` : Output raw packed trace frames. +- `-o_raw_unpacked` : Output raw unpacked trace data per ID. + +*Output options* + +Default is to output to file and stdout. Setting any option overrides and limits to only +the options set. +- `-logstdout` : output to stdout. +- `-logstderr` : output to stderr. +- `-logfile` : output to file using the default log file name. +- `-logfilename <name>` : change the name of the output log file. + + +__Test output examples__ + +Example command lines with short output excerpts. + +*TC2, ETMv3 packet processor output, raw packet output.* + +Command line:- +`trc_pkt_lister -ss_dir ..\..\..\snapshots\TC2 -o_raw_unpacked` + +~~~~~~~~~~~~~~~~ +Frame Data; Index 17958; ID_DATA[0x11]; 16 04 c0 86 42 97 e1 c4 +Idx:17945; ID:11; I_SYNC : Instruction Packet synchronisation.; (Periodic); Addr=0xc00416e2; S; ISA=Thumb2; +Idx:17961; ID:11; P_HDR : Atom P-header.; WEN; Cycles=1 +Frame Data; Index 17968; ID_DATA[0x11]; ce af 90 80 80 00 a4 84 a0 84 a4 88 +Idx:17962; ID:11; TIMESTAMP : Timestamp Value.; TS=0x82f9d13097 (562536984727) +Idx:17974; ID:11; P_HDR : Atom P-header.; WW; Cycles=2 +Idx:17975; ID:11; P_HDR : Atom P-header.; WE; Cycles=1 +Idx:17976; ID:11; P_HDR : Atom P-header.; W; Cycles=1 +Idx:17977; ID:11; P_HDR : Atom P-header.; WE; Cycles=1 +Idx:17978; ID:11; P_HDR : Atom P-header.; WW; Cycles=2 +Idx:17979; ID:11; P_HDR : Atom P-header.; WEWE; Cycles=2 +Frame Data; Index 17980; ID_DATA[0x10]; a0 82 +Idx:17980; ID:10; P_HDR : Atom P-header.; W; Cycles=1 +Idx:17981; ID:10; P_HDR : Atom P-header.; WEE; Cycles=1 +Frame Data; Index 17984; ID_DATA[0x10]; b8 84 a4 88 a0 82 +Idx:17984; ID:10; P_HDR : Atom P-header.; WWWWWWW; Cycles=7 +Idx:17985; ID:10; P_HDR : Atom P-header.; WE; Cycles=1 +Idx:17986; ID:10; P_HDR : Atom P-header.; WW; Cycles=2 +Idx:17987; ID:10; P_HDR : Atom P-header.; WEWE; Cycles=2 +Idx:17988; ID:10; P_HDR : Atom P-header.; W; Cycles=1 +Idx:17989; ID:10; P_HDR : Atom P-header.; WEE; Cycles=1 +~~~~~~~~~~~~~~~~ + +*Juno - ETB_1 selected for STM packet output, raw packet output* + +Command line:- +`trc_pkt_lister -ss_dir ..\..\..\snapshots\juno_r1_1 -o_raw_unpacked -src_name ETB_1` + +~~~~~~~~~~~~~~~~ +Trace Packet Lister: CS Decode library testing +----------------------------------------------- + +Trace Packet Lister : reading snapshot from path ..\..\..\snapshots\juno_r1_1 +Using ETB_1 as trace source +Trace Packet Lister : STM Protocol on Trace ID 0x20 +Frame Data; Index 0; ID_DATA[0x20]; ff ff ff ff ff ff ff ff ff ff 0f 0f 30 41 +Idx:0; ID:20; ASYNC:Alignment synchronisation packet. +Idx:11; ID:20; VERSION:Version packet.; Ver=3 +Frame Data; Index 16; ID_DATA[0x20]; f1 1a 00 00 00 30 10 af 01 00 00 10 03 f2 1a +Idx:13; ID:20; M8:Set current master.; Master=0x41 +Idx:17; ID:20; D32M:32 bit data; with marker.; Data=0x10000000 +Idx:22; ID:20; C8:Set current channel.; Chan=0x0001 +Idx:23; ID:20; D32M:32 bit data; with marker.; Data=0x10000001 +Idx:28; ID:20; C8:Set current channel.; Chan=0x0002 +Frame Data; Index 32; ID_DATA[0x20]; 00 00 00 32 30 af 01 00 00 30 03 f4 1a 00 00 +Idx:30; ID:20; D32M:32 bit data; with marker.; Data=0x10000002 +Idx:36; ID:20; C8:Set current channel.; Chan=0x0003 +Idx:37; ID:20; D32M:32 bit data; with marker.; Data=0x10000003 +Idx:42; ID:20; C8:Set current channel.; Chan=0x0004 +Frame Data; Index 48; ID_DATA[0x20]; 00 f4 ff ff ff ff ff ff ff ff ff ff f0 00 13 +Idx:44; ID:20; D32M:32 bit data; with marker.; Data=0x10000004 +Idx:50; ID:20; ASYNC:Alignment synchronisation packet. +Idx:61; ID:20; VERSION:Version packet.; Ver=3 +~~~~~~~~~~~~~~~~ + +*Juno - ETMv4 full trace decode + packet monitor, source trace ID 0x10 only.* + +Command line:- +`trc_pkt_lister -ss_dir ..\..\..\snapshots\juno_r1_1 -decode -id 0x10` + +~~~~~~~~~~~~~~~~ +Idx:17230; ID:10; RCTDL_GEN_TRC_ELEM_TRACE_ON() +Idx:17232; ID:10; RCTDL_GEN_TRC_ELEM_PE_CONTEXT(EL1N; AArch64; VMID=0x0; CTXTID=0x0; ) +Idx:17248; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc000096a00:[0xffffffc000096a10] ) +Idx:17249; ID:10; [0x9d 0x30 0x25 0x59 0x00 0xc0 0xff 0xff 0xff ]; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0xFFFFFFC000594AC0; +Idx:17258; ID:10; [0xf7 ]; I_ATOM_F1 : Atom format 1.; E +Idx:17258; ID:10; RCTDL_GEN_TRC_ELEM_ADDR_NACC( 0xffffffc000594ac0 ) +Idx:17259; ID:10; [0x95 0xd6 0x95 ]; I_ADDR_S_IS0 : Address, Short, IS0.; Addr=0xFFFFFFC000592B58 ~[0x12B58] +Idx:17262; ID:10; [0xf9 ]; I_ATOM_F3 : Atom format 3.; ENN +Idx:17262; ID:10; RCTDL_GEN_TRC_ELEM_ADDR_NACC( 0xffffffc000592b58 ) +Idx:17264; ID:10; [0xf7 ]; I_ATOM_F1 : Atom format 1.; E +Idx:17265; ID:10; [0x9a 0x32 0x62 0x5a 0x00 ]; I_ADDR_L_32IS0 : Address, Long, 32 bit, IS0.; Addr=0x005AC4C8; +Idx:17270; ID:10; [0xdb ]; I_ATOM_F2 : Atom format 2.; EE +Idx:17270; ID:10; RCTDL_GEN_TRC_ELEM_ADDR_NACC( 0xffffffc0005ac4c8 ) +Idx:17271; ID:10; [0x9a 0x62 0x52 0x0e 0x00 ]; I_ADDR_L_32IS0 : Address, Long, 32 bit, IS0.; Addr=0x000EA588; +Idx:17276; ID:10; [0xfc ]; I_ATOM_F3 : Atom format 3.; NNE +Idx:17276; ID:10; RCTDL_GEN_TRC_ELEM_ADDR_NACC( 0xffffffc0000ea588 ) +Idx:17277; ID:10; [0x9a 0x58 0x15 0x59 0x00 ]; I_ADDR_L_32IS0 : Address, Long, 32 bit, IS0.; Addr=0x00592B60; +Idx:17283; ID:10; [0x06 0x1d ]; I_EXCEPT : Exception.; IRQ; Ret Addr Follows; +Idx:17285; ID:10; [0x95 0x59 ]; I_ADDR_S_IS0 : Address, Short, IS0.; Addr=0x00592B64 ~[0x164] +Idx:17283; ID:10; RCTDL_GEN_TRC_ELEM_EXCEPTION(pref ret addr:0xffffffc000592b64; excep num (0x0e) +Idx:17287; ID:10; [0x9a 0x20 0x19 0x08 0x00 ]; I_ADDR_L_32IS0 : Address, Long, 32 bit, IS0.; Addr=0x00083280; +Idx:17292; ID:10; [0xfd ]; I_ATOM_F3 : Atom format 3.; ENE +Idx:17292; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc000083280:[0xffffffc000083284] ) +Idx:17292; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc000083d40:[0xffffffc000083d9c] ) +Idx:17292; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc000083d9c:[0xffffffc000083dac] ) +Idx:17293; ID:10; [0x95 0xf7 0x09 ]; I_ADDR_S_IS0 : Address, Short, IS0.; Addr=0x000813DC ~[0x13DC] +Idx:17297; ID:10; [0xdb ]; I_ATOM_F2 : Atom format 2.; EE +Idx:17297; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc0000813dc:[0xffffffc0000813f0] ) +Idx:17297; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc00008f2e0:[0xffffffc00008f2e4] ) +Idx:17298; ID:10; [0x95 0x7e ]; I_ADDR_S_IS0 : Address, Short, IS0.; Addr=0x000813F8 ~[0x1F8] +Idx:17300; ID:10; [0xe0 ]; I_ATOM_F6 : Atom format 6.; EEEN +Idx:17300; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc0000813f8:[0xffffffc00008140c] ) +Idx:17300; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc00008141c:[0xffffffc000081434] ) +Idx:17300; ID:10; RCTDL_GEN_TRC_ELEM_INSTR_RANGE(exec range=0xffffffc00008140c:[0xffffffc000081414] ) +Idx:17300; ID:10; RCTDL_GEN_TRC_ELEM_ADDR_NACC( 0xffffffc000117cf0 ) + + +~~~~~~~~~~~~~~~~ + +The `c_api_pkt_print_test` program. +----------------------------------- + +Program tests the C-API infrastructure, including as an option the external decoder support. + +Limited to decoding trace from a single CoreSight ID. Uses the same "snapshots" as the C++ test program, but using hardcoded path values. + +__Command Line Options__ + +By default the program will run the single CoreSight ID of 0x10 in packet processing output mode using the ETMv4 decoder on the Juno snapshot. + +- `-id <n>` : Change the ID used for the test. +- `-etmv3` : Test the ETMv3 decoder - uses the TC2 snapshot. +- `-ptm` : Test the PTM decoder - uses the TC2 snapshot. +- `-stm` : Test the STM decoder - uses juno STM only snapshot. +- `-extern` : Use the 'echo_test' external decoder to test the custom decoder API. +- `-decode` : Output trace protocol packets and full decode generic packets. +- `-decode_only` : Output full decode generic packets only. diff --git a/decoder/include/common/comp_attach_notifier_i.h b/decoder/include/common/comp_attach_notifier_i.h new file mode 100644 index 000000000000..e0062ef24bb9 --- /dev/null +++ b/decoder/include/common/comp_attach_notifier_i.h @@ -0,0 +1,63 @@ +/*! + * \file comp_attach_notifier_i.h + * \brief OpenCSD : Component attach point notifier interface. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_COMP_ATTACH_NOTIFIER_I_H_INCLUDED +#define ARM_COMP_ATTACH_NOTIFIER_I_H_INCLUDED + +/*! + * @class IComponentAttachNotifier + * @addtogroup ocsd_infrastructure + * @brief Notification interface for attachment. + * + * Interface to the componentAttachPt classes that allow notification on component + * connect and disconnect. + */ +class IComponentAttachNotifier { +public: + IComponentAttachNotifier() {}; /**< Default interface constructor */ + virtual ~IComponentAttachNotifier() {}; /**< Default interface destructor */ + + /*! + * Callback called by the componentAttachPt() classes when a component is attached + * to or detached from the attach point. + * + * @param num_attached : number of remaining components attached to the point after the + * operation that triggered the notification. + */ + virtual void attachNotify(const int num_attached) = 0; +}; + +#endif // ARM_COMP_ATTACH_NOTIFIER_I_H_INCLUDED + +/* End of File comp_attach_notifier_i.h */ diff --git a/decoder/include/common/comp_attach_pt_t.h b/decoder/include/common/comp_attach_pt_t.h new file mode 100644 index 000000000000..71f4c84caa2f --- /dev/null +++ b/decoder/include/common/comp_attach_pt_t.h @@ -0,0 +1,240 @@ +/*! + * \file comp_attach_pt_t.h + * \brief OpenCSD : Component attachment point interface class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_COMP_ATTACH_PT_T_H_INCLUDED +#define ARM_COMP_ATTACH_PT_T_H_INCLUDED + +#include <vector> +#include "opencsd/ocsd_if_types.h" + +/** @defgroup ocsd_infrastructure OpenCSD Library : Library Component Infrastructure + + @brief Classes providing library infrastructure and auxilary functionality +@{*/ + +#include "comp_attach_notifier_i.h" + +/*! + * @class componentAttachPt + * @brief Single component interface pointer attachment point. + * + * This is a class template to standardise the connections between decode components. + * + * An attachment point connects a component interface pointer to the component providing the + * attachment point. + * + * This attachment point implementation allows a single interface to be connected. + * + */ +template <class T> +class componentAttachPt { +public: + componentAttachPt(); /**< Default constructor */ + virtual ~componentAttachPt(); /**< Default destructor */ + + /*! + * Attach an interface of type T to the attachment point. + * + * @param component : interface to attach. + * + * @return ocsd_err_t : OCSD_OK if successful, OCSD_ERR_ATTACH_TOO_MANY if too many connections. + */ + virtual ocsd_err_t attach(T* component); + + /*! + * Detach component from the attachment point. + * + * @param component : Component to detach. + * + * @return virtual ocsd_err_t : OCSD_OK if successful, OCSD_ERR_ATTACH_COMP_NOT_FOUND if no match to component. + */ + virtual ocsd_err_t detach(T* component); + + + // detach current first if anything attached, connect supplied pointer, remain unattached if pointer 0 + virtual ocsd_err_t replace_first(T* component); + + /*! + * Detach all components. + */ + virtual void detach_all(); + + /*! + * Return the current (first) attached interface pointer. + * Will return 0 if nothing attached or the attachment point is disabled. + * + * @return T* : Current Interface pointer of type T or 0. + */ + virtual T* first(); + + /*! + * Return the next attached interface. + * The componentAttachPt base implmentation will always return 0 as only a single attachment is possible + * + * @return T* : Always returns 0. + */ + virtual T* next(); + + /*! + * Returns the number of interface pointers attached to this attachment point. + * + * @return int : number of component interfaces attached. + */ + virtual int num_attached(); + + /*! + * Attach a notifier interface to the attachment point. Will call back on this interface whenever + * a component is attached or detached. + * + * @param *notifier : pointer to the IComponentAttachNotifier interface. + */ + void set_notifier(IComponentAttachNotifier *notifier); + + /* enable state does not affect attach / detach, but can be used to filter access to interfaces */ + const bool enabled() const; /**< return the enabled flag. */ + void set_enabled(const bool enable); + + + /*! + * Check to see if any attachements. Will return attach state independent of enable state. + * + * @return const bool : true if attachment. + */ + const bool hasAttached() const { return m_hasAttached; }; + + + /*! + * Return both the attachment and enabled state. + * + * @return const bool : true if both has attachment and is enabled. + */ + const bool hasAttachedAndEnabled() const { return m_hasAttached && m_enabled; }; + +protected: + bool m_enabled; /**< Flag to indicate if the attachment point is enabled. */ + bool m_hasAttached; /**< Flag indicating at least one attached interface */ + IComponentAttachNotifier *m_notifier; /**< Optional attachement notifier interface. */ + T *m_comp; /**< pointer to the single attached interface */ +}; + + + +template<class T> componentAttachPt<T>::componentAttachPt() +{ + m_comp = 0; + m_notifier = 0; + m_enabled = true; + m_hasAttached = false; +} + +template<class T> componentAttachPt<T>::~componentAttachPt() +{ + detach_all(); +} + + +template<class T> ocsd_err_t componentAttachPt<T>::attach(T* component) +{ + if(m_comp != 0) + return OCSD_ERR_ATTACH_TOO_MANY; + m_comp = component; + if(m_notifier) m_notifier->attachNotify(1); + m_hasAttached = true; + return OCSD_OK; +} + +template<class T> ocsd_err_t componentAttachPt<T>::replace_first(T* component) +{ + if(m_hasAttached) + detach(m_comp); + + if(component == 0) + return OCSD_OK; + + return attach(component); +} + +template<class T> ocsd_err_t componentAttachPt<T>::detach(T* component) +{ + if(m_comp != component) + return OCSD_ERR_ATTACH_COMP_NOT_FOUND; + m_comp = 0; + m_hasAttached = false; + if(m_notifier) m_notifier->attachNotify(0); + return OCSD_OK; +} + +template<class T> T* componentAttachPt<T>::first() +{ + return (m_enabled) ? m_comp : 0; +} + +template<class T> T* componentAttachPt<T>::next() +{ + return 0; +} + +template<class T> int componentAttachPt<T>::num_attached() +{ + return ((m_comp != 0) ? 1 : 0); +} + +template<class T> void componentAttachPt<T>::detach_all() +{ + m_comp = 0; + m_hasAttached = false; + if(m_notifier) m_notifier->attachNotify(0); +} + +template<class T> void componentAttachPt<T>::set_notifier(IComponentAttachNotifier *notifier) +{ + m_notifier = notifier; +} + +template<class T> const bool componentAttachPt<T>::enabled() const +{ + return m_enabled; +} + +template<class T> void componentAttachPt<T>::set_enabled(const bool enable) +{ + m_enabled = enable; +} + + +/** @}*/ + +#endif // ARM_COMP_ATTACH_PT_T_H_INCLUDED + +/* End of File comp_attach_pt_t.h */ diff --git a/decoder/include/common/ocsd_code_follower.h b/decoder/include/common/ocsd_code_follower.h new file mode 100644 index 000000000000..0e8691034a68 --- /dev/null +++ b/decoder/include/common/ocsd_code_follower.h @@ -0,0 +1,231 @@ +/* + * \file ocsd_code_follower.h + * \brief OpenCSD : Code follower for instruction trace decode + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_CODE_FOLLOWER_H_INCLUDED +#define ARM_OCSD_CODE_FOLLOWER_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include "opencsd/trc_pkt_types.h" +#include "comp_attach_pt_t.h" +#include "interfaces/trc_tgt_mem_access_i.h" +#include "interfaces/trc_instr_decode_i.h" + +/*! + * @class OcsdCodeFollower + * @brief The code follower looks for waypoints or addresses. + * + * Code follower used to determine the trace ranges for Atom or other waypoint + * elements. Uses memory accessor and I decoder to follow the code path. + * + */ +class OcsdCodeFollower +{ +public: + OcsdCodeFollower(); + ~OcsdCodeFollower(); + +//*********** setup API + void initInterfaces(componentAttachPt<ITargetMemAccess> *pMemAccess, componentAttachPt<IInstrDecode> *pIDecode); + +// set information for decode operation - static or occasionally changing settings +// per decode values are passed as parameters into the decode API calls. + void setArchProfile(const ocsd_arch_profile_t profile); //!< core profile + void setMemSpaceAccess(const ocsd_mem_space_acc_t mem_acc_rule); //!< memory space to use for access (filtered by S/NS, EL etc). + void setMemSpaceCSID(const uint8_t csid); //!< memory spaces might be partitioned by CSID + void setISA(const ocsd_isa isa); //!< set the ISA for the decode. + void setDSBDMBasWP(); //!< DSB and DMB can be treated as WP in some archs. + +//********** code following API + + // standard WP search - for program flow trace + //ocsd_err_t followToAtomWP(idec_res_t &op_result, const ocsd_vaddr_t addrStart, const ocsd_atm_val A); + + // PTM exception code may require follow to an address + //ocsd_err_t followToAddress(idec_res_t &op_result, const ocsd_vaddr_t addrStart, const ocsd_atm_val A, const ocsd_vaddr_t addrMatch); + + // single instruction atom format such as ETMv3 + ocsd_err_t followSingleAtom(const ocsd_vaddr_t addrStart, const ocsd_atm_val A); + + // follow N instructions + // ocsd_err_t followNInstructions(idec_res_t &op_result) // ETMv4 Q elements + +//*********************** results API + const ocsd_vaddr_t getRangeSt() const; //!< inclusive start address of decoded range (value passed in) + const ocsd_vaddr_t getRangeEn() const; //!< exclusive end address of decoded range (first instruction _not_ executed / potential next instruction). + const bool hasRange() const; //!< we have a valid range executed (may be false if nacc). + + const bool hasNextAddr() const; //!< we have calulated the next address - otherwise this is needed from trace packets. + const ocsd_vaddr_t getNextAddr() const; //!< next address - valid if hasNextAddr() true. + + // information on last instruction executed in range. + const ocsd_instr_type getInstrType() const; //!< last instruction type + const ocsd_instr_subtype getInstrSubType() const; //!< last instruction sub-type + const bool isCondInstr() const; //!< is a conditional instruction + const bool isLink() const; //!< is a link (branch with link etc) + const bool ISAChanged() const; //!< next ISA different from input ISA. + const ocsd_isa nextISA() const; //!< ISA for next instruction + + // information on error conditions + const bool isNacc() const; //!< true if Memory Not Accessible (nacc) error occurred + void clearNacc(); //!< clear the nacc error flag + const ocsd_vaddr_t getNaccAddr() const; //!< get the nacc error address. + +private: + bool initFollowerState(); //!< clear all the o/p data and flags, check init valid. + + ocsd_err_t decodeSingleOpCode(); //!< decode single opcode address from current m_inst_info packet + + ocsd_instr_info m_instr_info; + + ocsd_vaddr_t m_st_range_addr; //!< start of excuted range - inclusive address. + ocsd_vaddr_t m_en_range_addr; //!< end of executed range - exclusive address. + ocsd_vaddr_t m_next_addr; //!< calcuated next address (could be eo range of branch address, not set for indirect branches) + bool m_b_next_valid; //!< true if next address valid, false if need address from trace packets. + + //! memory space rule to use when accessing memory. + ocsd_mem_space_acc_t m_mem_acc_rule; + //! memory space csid to use when accessing memory. + uint8_t m_mem_space_csid; + + ocsd_vaddr_t m_nacc_address; //!< memory address that was inaccessible - failed read @ start, or during follow operation + bool m_b_nacc_err; //!< memory NACC error - required address was unavailable. + + //! pointers to the memory access and i decode interfaces. + componentAttachPt<ITargetMemAccess> *m_pMemAccess; + componentAttachPt<IInstrDecode> *m_pIDecode; + +}; + +#endif // ARM_OCSD_CODE_FOLLOWER_H_INCLUDED + +//*********** setup API +inline void OcsdCodeFollower::setArchProfile(const ocsd_arch_profile_t profile) +{ + m_instr_info.pe_type = profile; +} + +inline void OcsdCodeFollower::setMemSpaceAccess(const ocsd_mem_space_acc_t mem_acc_rule) +{ + m_mem_acc_rule = mem_acc_rule; +} + +inline void OcsdCodeFollower::setMemSpaceCSID(const uint8_t csid) +{ + m_mem_space_csid = csid; +} + +inline void OcsdCodeFollower::setISA(const ocsd_isa isa) +{ + m_instr_info.isa = isa; +} + +inline void OcsdCodeFollower::setDSBDMBasWP() +{ + m_instr_info.dsb_dmb_waypoints = 1; +} + +//**************************************** results API +inline const ocsd_vaddr_t OcsdCodeFollower::getRangeSt() const +{ + return m_st_range_addr; +} + +inline const ocsd_vaddr_t OcsdCodeFollower::getRangeEn() const +{ + return m_en_range_addr; +} + +inline const bool OcsdCodeFollower::hasRange() const +{ + return m_st_range_addr < m_en_range_addr; +} + +inline const bool OcsdCodeFollower::hasNextAddr() const +{ + return m_b_next_valid; +} + +inline const ocsd_vaddr_t OcsdCodeFollower::getNextAddr() const +{ + return m_next_addr; +} + +// information on last instruction executed in range. +inline const ocsd_instr_type OcsdCodeFollower::getInstrType() const +{ + return m_instr_info.type; +} + +inline const ocsd_instr_subtype OcsdCodeFollower::getInstrSubType() const +{ + return m_instr_info.sub_type; +} + +inline const bool OcsdCodeFollower::isCondInstr() const +{ + return (bool)(m_instr_info.is_conditional == 1); +} + +inline const bool OcsdCodeFollower::isLink() const +{ + return (bool)(m_instr_info.is_link == 1); +} + +inline const bool OcsdCodeFollower::ISAChanged() const +{ + return (bool)(m_instr_info.isa != m_instr_info.next_isa); +} + +inline const ocsd_isa OcsdCodeFollower::nextISA() const +{ + return m_instr_info.next_isa; +} + +// information on error conditions +inline const bool OcsdCodeFollower::isNacc() const +{ + return m_b_nacc_err; +} + +inline void OcsdCodeFollower::clearNacc() +{ + m_b_nacc_err = false; +} + +inline const ocsd_vaddr_t OcsdCodeFollower::getNaccAddr() const +{ + return m_nacc_address; +} + +/* End of File ocsd_code_follower.h */ diff --git a/decoder/include/common/ocsd_dcd_mngr.h b/decoder/include/common/ocsd_dcd_mngr.h new file mode 100644 index 000000000000..ba7d8a89c46f --- /dev/null +++ b/decoder/include/common/ocsd_dcd_mngr.h @@ -0,0 +1,396 @@ +/* + * \file ocsd_dcd_mngr.h + * \brief OpenCSD : Decoder manager base class. + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_DCD_MNGR_H_INCLUDED +#define ARM_OCSD_DCD_MNGR_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include "common/ocsd_dcd_mngr_i.h" +#include "common/ocsd_lib_dcd_register.h" +#include "common/trc_pkt_decode_base.h" +#include "common/trc_pkt_proc_base.h" + +template <class P, class Pt, class Pc> +class DecoderMngrBase : public IDecoderMngr +{ +public: + DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol); + virtual ~DecoderMngrBase() {}; + + // create decoder interface. + virtual ocsd_err_t createDecoder(const int create_flags, const int instID, const CSConfig *p_config, TraceComponent **p_component); + virtual ocsd_err_t destroyDecoder(TraceComponent *p_component); + + virtual const ocsd_trace_protocol_t getProtocolType() const { return m_builtInProtocol; } + +// common + virtual ocsd_err_t attachErrorLogger(TraceComponent *pComponent, ITraceErrorLog *pIErrorLog); + +// pkt decoder + virtual ocsd_err_t attachInstrDecoder(TraceComponent *pComponent, IInstrDecode *pIInstrDec); + virtual ocsd_err_t attachMemAccessor(TraceComponent *pComponent, ITargetMemAccess *pMemAccessor); + virtual ocsd_err_t attachOutputSink(TraceComponent *pComponent, ITrcGenElemIn *pOutSink); + +// pkt processor + virtual ocsd_err_t attachPktMonitor(TraceComponent *pComponent, ITrcTypedBase *pPktRawDataMon); + virtual ocsd_err_t attachPktIndexer(TraceComponent *pComponent, ITrcTypedBase *pPktIndexer); + virtual ocsd_err_t attachPktSink(TraceComponent *pComponent, ITrcTypedBase *pPktDataInSink); + +// data input connection interface + virtual ocsd_err_t getDataInputI(TraceComponent *pComponent, ITrcDataIn **ppDataIn); + +// generate a Config object from opaque config struct pointer. + virtual ocsd_err_t createConfigFromDataStruct(CSConfig **pConfigBase, const void *pDataStruct); + +// implemented by decoder handler derived classes + virtual TraceComponent *createPktProc(const bool useInstID, const int instID) = 0; + virtual TraceComponent *createPktDecode(const bool useInstID, const int instID) { return 0; }; + virtual CSConfig *createConfig(const void *pDataStruct) = 0; + + +private: + ocsd_trace_protocol_t m_builtInProtocol; //!< Protocol ID if built in type. +}; + +template <class P, class Pt, class Pc> +DecoderMngrBase<P,Pt,Pc>::DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol) +{ + OcsdLibDcdRegister *pDcdReg = OcsdLibDcdRegister::getDecoderRegister(); + if(pDcdReg) + pDcdReg->registerDecoderTypeByName(decoderTypeName,this); + m_builtInProtocol = builtInProtocol; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::createDecoder(const int create_flags, const int instID, const CSConfig *pConfig, TraceComponent **ppTrcComp) +{ + TraceComponent *pkt_proc = 0; + TraceComponent *pkt_dcd = 0; + bool bUseInstID = (create_flags & OCSD_CREATE_FLG_INST_ID) != 0; + bool bDecoder = (create_flags & OCSD_CREATE_FLG_FULL_DECODER) != 0; + bool bUnConfigured = (pConfig == 0); + + const Pc *pConf = dynamic_cast< const Pc * >(pConfig); + + // check inputs valid... + if((pConf == 0) && !bUnConfigured) + return OCSD_ERR_INVALID_PARAM_TYPE; + + if((create_flags & (OCSD_CREATE_FLG_PACKET_PROC | OCSD_CREATE_FLG_FULL_DECODER)) == 0) + return OCSD_ERR_INVALID_PARAM_VAL; + + // always need a packet processor + pkt_proc = createPktProc(bUseInstID, instID); + if(!pkt_proc) + return OCSD_ERR_MEM; + + // set the configuration + TrcPktProcBase<P,Pt,Pc> *pProcBase = dynamic_cast< TrcPktProcBase<P,Pt,Pc> *>(pkt_proc); + if(pProcBase == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + if(!bUnConfigured) + pProcBase->setProtocolConfig(pConf); + + *ppTrcComp = pkt_proc; + + // may need a packet decoder + if(bDecoder) + { + // create the decoder + pkt_dcd = createPktDecode(bUseInstID, instID); + if(!pkt_dcd) + return OCSD_ERR_MEM; + + // get the decoder base + TrcPktDecodeBase<P,Pc> *pBase = dynamic_cast< TrcPktDecodeBase<P,Pc> *>(pkt_dcd); + if(pBase == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + if(!bUnConfigured) + pBase->setProtocolConfig(pConf); + + // associate decoder with packet processor + // -> this means a TraceComponent with an associated component is a packet decoder. + // the associated component is the connected packet processor. + pkt_dcd->setAssocComponent(pkt_proc); + + // connect packet processor and decoder + pProcBase->getPacketOutAttachPt()->attach(pBase); + + *ppTrcComp = pkt_dcd; + } + return OCSD_OK; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::destroyDecoder(TraceComponent *pComponent) +{ + if(pComponent->getAssocComponent() != 0) + delete pComponent->getAssocComponent(); + delete pComponent; + return OCSD_OK; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachErrorLogger(TraceComponent *pComponent, ITraceErrorLog *pIErrorLog) +{ + return pComponent->getErrorLogAttachPt()->replace_first(pIErrorLog); +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachInstrDecoder(TraceComponent *pComponent, IInstrDecode *pIInstrDec) +{ + ocsd_err_t err = OCSD_ERR_DCD_INTERFACE_UNUSED; + + if(pComponent->getAssocComponent() == 0) // no associated component - so this is a packet processor + return OCSD_ERR_INVALID_PARAM_TYPE; + + TrcPktDecodeI *pDcdI = dynamic_cast< TrcPktDecodeI * >(pComponent); + if(pDcdI == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + if(pDcdI->getUsesIDecode()) + err = pDcdI->getInstrDecodeAttachPt()->replace_first(pIInstrDec); + + return err; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachMemAccessor(TraceComponent *pComponent, ITargetMemAccess *pMemAccessor) +{ + ocsd_err_t err = OCSD_ERR_DCD_INTERFACE_UNUSED; + + if(pComponent->getAssocComponent() == 0) // no associated component - so this is a packet processor + return OCSD_ERR_INVALID_PARAM_TYPE; + + TrcPktDecodeI *pDcdI = dynamic_cast< TrcPktDecodeI * >(pComponent); + if(pDcdI == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + if(pDcdI->getUsesMemAccess()) + err = pDcdI->getMemoryAccessAttachPt()->replace_first(pMemAccessor); + + return err; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachOutputSink(TraceComponent *pComponent, ITrcGenElemIn *pOutSink) +{ + ocsd_err_t err = OCSD_ERR_INVALID_PARAM_TYPE; + + if(pComponent->getAssocComponent() == 0) // no associated component - so this is a packet processor + return err; + + TrcPktDecodeI *pDcdI = dynamic_cast< TrcPktDecodeI * >(pComponent); + if(pDcdI == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + err = pDcdI->getTraceElemOutAttachPt()->replace_first(pOutSink); + + return err; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::getDataInputI(TraceComponent *pComponent, ITrcDataIn **ppDataIn) +{ + // find the packet processor + TraceComponent *pPktProc = pComponent; + if(pComponent->getAssocComponent() != 0) + pPktProc = pComponent->getAssocComponent(); + + TrcPktProcI *pPPI = dynamic_cast< TrcPktProcI * >(pPktProc); + if(pPPI == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + *ppDataIn = pPPI; + + return OCSD_OK; +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachPktMonitor(TraceComponent *pComponent, ITrcTypedBase *pPktRawDataMon) +{ + // find the packet processor + TraceComponent *pPktProc = pComponent; + if(pComponent->getAssocComponent() != 0) + pPktProc = pComponent->getAssocComponent(); + + // get the packet processor + TrcPktProcBase<P,Pt,Pc> *pPktProcBase = dynamic_cast< TrcPktProcBase<P,Pt,Pc> * >(pPktProc); + if(pPktProcBase == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + // get the interface + IPktRawDataMon<P> *p_If = dynamic_cast< IPktRawDataMon<P> * >(pPktRawDataMon); + if(p_If == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + return pPktProcBase->getRawPacketMonAttachPt()->replace_first(p_If); +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachPktIndexer(TraceComponent *pComponent, ITrcTypedBase *pPktIndexer) +{ + // find the packet processor + TraceComponent *pPktProc = pComponent; + if(pComponent->getAssocComponent() != 0) + pPktProc = pComponent->getAssocComponent(); + + // get the packet processor + TrcPktProcBase<P,Pt,Pc> *pPktProcBase = dynamic_cast< TrcPktProcBase<P,Pt,Pc> * >(pPktProc); + if(pPktProcBase == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + // get the interface + ITrcPktIndexer<Pt> *p_If = dynamic_cast< ITrcPktIndexer<Pt> * >(pPktIndexer); + if(p_If == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + return pPktProcBase->getTraceIDIndexerAttachPt()->replace_first(p_If); +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::attachPktSink(TraceComponent *pComponent, ITrcTypedBase *pPktDataInSink) +{ + // must be solo packet processor + if(pComponent->getAssocComponent() != 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + // interface must be the correct one. + IPktDataIn<P> *pkt_in_i = dynamic_cast< IPktDataIn<P> * >(pPktDataInSink); + if(pkt_in_i == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + // get the packet processor + TrcPktProcBase<P,Pt,Pc> *pPktProcBase = dynamic_cast< TrcPktProcBase<P,Pt,Pc> * >(pComponent); + if(pPktProcBase == 0) + return OCSD_ERR_INVALID_PARAM_TYPE; + + // attach + return pPktProcBase->getPacketOutAttachPt()->replace_first(pkt_in_i); +} + +template <class P, class Pt, class Pc> +ocsd_err_t DecoderMngrBase<P,Pt,Pc>::createConfigFromDataStruct(CSConfig **pConfigBase, const void *pDataStruct) +{ + CSConfig *pConfig = createConfig(pDataStruct); + if(!pConfig) + return OCSD_ERR_MEM; + *pConfigBase = pConfig; + return OCSD_OK; +} + +/****************************************************************************************************/ +/* Full decoder / packet process pair, templated base for creating decoder objects */ +/****************************************************************************************************/ + +template< class P, // Packet class. + class Pt, // Packet enum type ID. + class Pc, // Processor config class. + class PcSt, // Processor config struct type + class PktProc, // Packet processor class. + class PktDcd> // Packet decoder class. +class DecodeMngrFullDcd : public DecoderMngrBase<P,Pt,Pc> +{ +public: + DecodeMngrFullDcd (const std::string &name, ocsd_trace_protocol_t builtInProtocol) + : DecoderMngrBase<P,Pt,Pc>(name,builtInProtocol) {}; + + virtual ~DecodeMngrFullDcd() {}; + + virtual TraceComponent *createPktProc(const bool useInstID, const int instID) + { + TraceComponent *pComp; + if(useInstID) + pComp = new (std::nothrow) PktProc(instID); + else + pComp = new (std::nothrow) PktProc(); + return pComp; + } + + virtual TraceComponent *createPktDecode(const bool useInstID, const int instID) + { + TraceComponent *pComp; + if(useInstID) + pComp = new (std::nothrow)PktDcd(instID); + else + pComp = new (std::nothrow)PktDcd(); + return pComp; + } + + virtual CSConfig *createConfig(const void *pDataStruct) + { + return new (std::nothrow) Pc((PcSt *)pDataStruct); + } +}; + +/****************************************************************************************************/ +/* Packet processor only, templated base for creating decoder objects */ +/****************************************************************************************************/ + +template< class P, // Packet class. + class Pt, // Packet enum type ID. + class Pc, // Processor config class. + class PcSt, // Processor config struct type + class PktProc> // Packet processor class. +class DecodeMngrPktProc : public DecoderMngrBase<P,Pt,Pc> +{ +public: + DecodeMngrPktProc (const std::string &name, ocsd_trace_protocol_t builtInProtocol) + : DecoderMngrBase<P,Pt,Pc>(name,builtInProtocol) {}; + + virtual ~DecodeMngrPktProc() {}; + + virtual TraceComponent *createPktProc(const bool useInstID, const int instID) + { + TraceComponent *pComp; + if(useInstID) + pComp = new (std::nothrow) PktProc(instID); + else + pComp = new (std::nothrow) PktProc(); + return pComp; + } + + virtual CSConfig *createConfig(const void *pDataStruct) + { + return new (std::nothrow) Pc((PcSt *)pDataStruct); + } +}; + + + +#endif // ARM_OCSD_DCD_MNGR_H_INCLUDED + +/* End of File ocsd_dcd_mngr.h */ diff --git a/decoder/include/common/ocsd_dcd_mngr_i.h b/decoder/include/common/ocsd_dcd_mngr_i.h new file mode 100644 index 000000000000..5ecbe31401a8 --- /dev/null +++ b/decoder/include/common/ocsd_dcd_mngr_i.h @@ -0,0 +1,98 @@ +/* + * \file ocsd_dcd_mngr_i.h + * \brief OpenCSD : Decoder manager interface. + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_DCD_MNGR_I_H_INCLUDED +#define ARM_OCSD_DCD_MNGR_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include "common/trc_cs_config.h" +#include "common/trc_component.h" + +#include "interfaces/trc_error_log_i.h" +#include "interfaces/trc_data_raw_in_i.h" +#include "interfaces/trc_instr_decode_i.h" +#include "interfaces/trc_tgt_mem_access_i.h" +#include "interfaces/trc_gen_elem_in_i.h" +#include "interfaces/trc_abs_typed_base_i.h" + +class IDecoderMngr +{ +public: + IDecoderMngr() {}; + virtual ~IDecoderMngr() {}; + +// create and destroy decoders + virtual ocsd_err_t createDecoder(const int create_flags, const int instID, const CSConfig *p_config, TraceComponent **ppComponent) = 0; + virtual ocsd_err_t destroyDecoder(TraceComponent *pComponent) = 0; + + //! Get the built in protocol type ID managed by this instance - extern for custom decoders + virtual const ocsd_trace_protocol_t getProtocolType() const = 0; + +// connect decoders to other components - (replace current / 0 pointer value to detach ); +// compatible with all decoders + //!attach error logger to ptk-processor, or both of pkt processor and pkt decoder pair + virtual ocsd_err_t attachErrorLogger(TraceComponent *pComponent, ITraceErrorLog *pIErrorLog) = 0; + +// pkt decoder only + //! attach instruction decoder to pkt decoder + virtual ocsd_err_t attachInstrDecoder(TraceComponent *pComponent, IInstrDecode *pIInstrDec) = 0; + + //! attach memory accessor to pkt decoder + virtual ocsd_err_t attachMemAccessor(TraceComponent *pComponent, ITargetMemAccess *pMemAccessor) = 0; + + //! attach generic output interface to pkt decoder + virtual ocsd_err_t attachOutputSink(TraceComponent *pComponent, ITrcGenElemIn *pOutSink) = 0; + +// pkt processor only + //! attach a raw packet monitor to pkt processor (solo pkt processor, or pkt processor part of pair) + virtual ocsd_err_t attachPktMonitor(TraceComponent *pComponent, ITrcTypedBase *pPktRawDataMon) = 0; + + //! attach a packet indexer to pkt processor (solo pkt processor, or pkt processor part of pair) + virtual ocsd_err_t attachPktIndexer(TraceComponent *pComponent, ITrcTypedBase *pPktIndexer) = 0; + + //! attach a packet data sink to pkt processor output (solo pkt processor only - instead of decoder when pkt processor only created.) + virtual ocsd_err_t attachPktSink(TraceComponent *pComponent, ITrcTypedBase *pPktDataInSink) = 0; + +// data input connection interface + //! get raw data input interface from packet processor + virtual ocsd_err_t getDataInputI(TraceComponent *pComponent, ITrcDataIn **ppDataIn) = 0; + +// create configuration from data structure + virtual ocsd_err_t createConfigFromDataStruct(CSConfig **pConfigBase, const void *pDataStruct) = 0; + +}; + +#endif // ARM_OCSD_DCD_MNGR_I_H_INCLUDED + +/* End of File ocsd_dcd_mngr.h */
\ No newline at end of file diff --git a/decoder/include/common/ocsd_dcd_tree.h b/decoder/include/common/ocsd_dcd_tree.h new file mode 100644 index 000000000000..496f8e5d72e0 --- /dev/null +++ b/decoder/include/common/ocsd_dcd_tree.h @@ -0,0 +1,406 @@ +/*! + * \file ocsd_dcd_tree.h + * \brief OpenCSD : Trace Decode Tree. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_DCD_TREE_H_INCLUDED +#define ARM_OCSD_DCD_TREE_H_INCLUDED + +#include <vector> +#include <list> + +#include "opencsd.h" +#include "ocsd_dcd_tree_elem.h" + +/** @defgroup dcd_tree OpenCSD Library : Trace Decode Tree. + @brief Create a multi source decode tree for a single trace capture buffer. + + Use to create a connected set of decoder objects to decode a trace buffer. + There may be multiple trace sources within the capture buffer. + +@{*/ + +/*! + * @class DecodeTree + * @brief Class to manage the decoding of data from a single trace sink . + * + * Provides functionality to build a tree of decode objects capable of decoding + * multiple trace sources within a single trace sink (capture buffer). + * + */ +class DecodeTree : public ITrcDataIn +{ +public: +/** @name Creation and Destruction +@{*/ + DecodeTree(); //!< default constructor + ~DecodeTree(); //!< default destructor + + /*! + * @brief Create a decode tree. + * Automatically creates a trace frame deformatter if required and a default error log component. + * + * @param src_type : Data stream source type, can be CoreSight frame formatted trace, or single demuxed trace data stream, + * @param formatterCfgFlags : Configuration flags for trace de-formatter. + * + * @return DecodeTree * : pointer to the decode tree, 0 if creation failed. + */ + static DecodeTree *CreateDecodeTree(const ocsd_dcd_tree_src_t src_type, const uint32_t formatterCfgFlags); + + /** @brief Destroy a decode tree */ + static void DestroyDecodeTree(DecodeTree *p_dcd_tree); + +/** @}*/ + + +/** @name Error and element Logging +@{*/ + /** @brief The library default error logger */ + static ocsdDefaultErrorLogger* getDefaultErrorLogger() { return &s_error_logger; }; + + /** the current error logging interface in use */ + static ITraceErrorLog *getCurrentErrorLogI() { return s_i_error_logger; }; + + /** set an alternate error logging interface. */ + static void setAlternateErrorLogger(ITraceErrorLog *p_error_logger); + + /** get the list of packet printers for this decode tree */ + std::vector<ItemPrinter *> &getPrinterList() { return m_printer_list; }; + + /** add a protocol packet printer */ + ocsd_err_t addPacketPrinter(uint8_t CSID, bool bMonitor, ItemPrinter **ppPrinter); + + /** add a raw frame printer */ + ocsd_err_t addRawFramePrinter(RawFramePrinter **ppPrinter, uint32_t flags); + + /** add a generic element output printer */ + ocsd_err_t addGenElemPrinter(TrcGenericElementPrinter **ppPrinter); + + + +/** @}*/ + + +/** @name Trace Data Path +@{*/ + /** @brief Trace Data input interface (ITrcDataIn) + + Decode tree implements the data in interface : ITrcDataIn . + Captured raw trace data is passed into the deformatter and decoders via this method. + */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed); + + /*! + * @brief Decoded Trace output. + * + * Client trace analysis program attaches a generic trace element interface to + * receive the output from the trace decode operations. + * + * @param *i_gen_trace_elem : Pointer to the interface. + */ + void setGenTraceElemOutI(ITrcGenElemIn *i_gen_trace_elem); + + /*! @brief Return the connected generic element interface */ + ITrcGenElemIn *getGenTraceElemOutI() const { return m_i_gen_elem_out; }; + +/** @}*/ + +/** @name Decoder Management +@{*/ + + /*! + * Creates a decoder that is registered with the library under the supplied name. + * createFlags determine if a full packet processor / packet decoder pair or + * packet processor only is created. + * Uses the supplied configuration structure. + * + * @param &decoderName : registered name of decoder + * @param createFlags : Decoder creation options. + * @param *pConfig : Pointer to a valid configuration structure for the named decoder. + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t createDecoder(const std::string &decoderName, const int createFlags, const CSConfig *pConfig); + + /* */ + /*! + * Remove a decoder / packet processor attached to an Trace ID output on the frame de-mux. + * + * Once removed another decoder can be created that has a CSConfig using that ID. + * + * @param CSID : Trace ID to remove. + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t removeDecoder(const uint8_t CSID); + + +/* get decoder elements currently in use */ + + /*! + * Find a decode tree element associated with a specific CoreSight trace ID. * + */ + DecodeTreeElement *getDecoderElement(const uint8_t CSID) const; + /* iterate decoder elements */ + + /*! + * Decode tree iteration. Return the first tree element 0 if no elements avaiable. + * + * @param &elemID : CoreSight Trace ID associated with this element + */ + DecodeTreeElement *getFirstElement(uint8_t &elemID); + /*! + * Return the next tree element - or 0 if no futher elements avaiable. + * + * @param &elemID : CoreSight Trace ID associated with this element + */ + DecodeTreeElement *getNextElement(uint8_t &elemID); + +/* set key interfaces - attach / replace on any existing tree components */ + + /*! + * Set an ARM instruction opcode decoder. + * + * @param *i_instr_decode : Pointer to the interface. + */ + void setInstrDecoder(IInstrDecode *i_instr_decode); + /*! + * Set a target memory access interface - used to access program image memory for instruction + * trace decode. + * + * @param *i_mem_access : Pointer to the interface. + */ + void setMemAccessI(ITargetMemAccess *i_mem_access); + + +/** @}*/ + +/** @name Memory Access Mapper + + A memory mapper is used to organise a collection of memory accessor objects that contain the + memory images for different areas of traced instruction memory. These areas could be the executed + program and a set of loaded .so libraries for example - each of which would have code sections in + different memory locations. + + A memory accessor represents a snapshot of an area of memory as it appeared during trace capture, + for a given memory space. Memory spaces are described by the ocsd_mem_space_acc_t enum. The most + general memory space is OCSD_MEM_SPACE_ANY. This represents memory that can be secure or none-secure, + available at any exception level. + + The memory mapper will not allow two accessors to overlap in the same memory space. + + The trace decdoer will access memory with a memory space parameter that represents the current core + state - the mapper will find the closest memory space match for the address. + + e.g. if the core is accessing secure EL3, then the most specialised matching space will be accessed. + If an EL3 space matches that will be used, otherwise the any secure, and finally _ANY. + + It is no necessary for clients to register memory accessors for all spaces - _ANY will be sufficient + in many cases. + + +@{*/ + + /* */ + /*! + * This creates a memory mapper within the decode tree. + * + * @param type : defaults to MEMACC_MAP_GLOBAL (only type available at present) + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t createMemAccMapper(memacc_mapper_t type = MEMACC_MAP_GLOBAL); + + /*! + * Get a pointer to the memory mapper. Allows a client to add memory accessors directly to the mapper. + * @return TrcMemAccMapper : Pointer to the mapper. + */ + TrcMemAccMapper *getMemAccMapper() const { return m_default_mapper; }; + + /*! + * Set an external mapper rather than create a mapper in the decode tree. + * Setting this will also destroy any internal mapper that was previously created. + * + * @param pMapper : pointer to the mapper to add. + */ + void setExternMemAccMapper(TrcMemAccMapper * pMapper); + + /*! + * Return true if a mapper has been set (internal or external + */ + const bool hasMemAccMapper() const { return (bool)(m_default_mapper != 0); }; + + void logMappedRanges(); //!< Log the mapped memory ranges to the default message logger. + +/** @}*/ + +/** @name Memory Accessors + A memory accessor represents a snapshot of an area of memory as it appeared during trace capture. + + Memory spaces represent either common global memory, or Secure / none-secure and EL specific spaces. + +@{*/ + + /*! + * Creates a memory accessor for a memory block in the supplied buffer and adds to the current mapper. + * + * @param address : Start address for the memory block in the memory map. + * @param mem_space : Memory space + * @param *p_mem_buffer : start of the buffer. + * @param mem_length : length of the buffer. + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t addBufferMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length); + + /*! + * Creates a memory accessor for a memory block supplied as a contiguous binary data file, and adds to the current mapper. + * + * @param address : Start address for the memory block in the memory map. + * @param mem_space : Memory space + * @param &filepath : Path to the binary data file + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t addBinFileMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const std::string &filepath); + + /*! + * Creates a memory accessor for a memory block supplied as a one or more memory regions in a binary file. + * Region structures are created that describe the memory start address, the offset within the binary file + * for that address, and the length of the region. This accessor can be used to point to the code section + * in a program file for example. + * + * @param *region_array : array of valid memory regions in the file. + * @param num_regions : number of regions + * @param mem_space : Memory space + * @param &filepath : Path to the binary data file + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t addBinFileRegionMemAcc(const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const std::string &filepath); + + /*! + * This memory accessor allows the client to supply a callback function for the region + * defined by the start and end addresses. This can be used to supply a custom memory accessor, + * or to directly access memory if the decode is running live on a target system. + * + * @param st_address : start address of region. + * @param en_address : end address of region. + * @param mem_space : Memory space + * @param p_cb_func : Callback function + * @param *p_context : client supplied context information + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t addCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context); + + /*! + * Remove the memory accessor from the map, that begins at the given address, for the memory space provided. + * + * @param address : Start address of the memory accessor. + * @param mem_space : Memory space for the memory accessor. + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t removeMemAccByAddress(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space); + +/** @}*/ + +/** @name CoreSight Trace Frame De-mux +@{*/ + + //! Get the Trace Frame de-mux. + TraceFormatterFrameDecoder *getFrameDeformatter() const { return m_frame_deformatter_root; }; + + + /*! @brief ID filtering - sets the output filter on the trace deformatter. + + Only supplied IDs will be decoded. + + No effect if no decoder attached for the ID + + @param ids : Vector of CS Trace IDs + */ + ocsd_err_t setIDFilter(std::vector<uint8_t> &ids); // only supplied IDs will be decoded + + ocsd_err_t clearIDFilter(); //!< remove filter, all IDs will be decoded + +/** @}*/ + +private: + bool initialise(const ocsd_dcd_tree_src_t type, uint32_t formatterCfgFlags); + const bool usingFormatter() const { return (bool)(m_dcd_tree_type == OCSD_TRC_SRC_FRAME_FORMATTED); }; + void setSingleRoot(TrcPktProcI *pComp); + ocsd_err_t createDecodeElement(const uint8_t CSID); + void destroyDecodeElement(const uint8_t CSID); + void destroyMemAccMapper(); + + ocsd_dcd_tree_src_t m_dcd_tree_type; + + IInstrDecode *m_i_instr_decode; + ITargetMemAccess *m_i_mem_access; + ITrcGenElemIn *m_i_gen_elem_out; //!< Output interface for generic elements from decoder. + + ITrcDataIn* m_i_decoder_root; /*!< root decoder object interface - either deformatter or single packet processor */ + + TraceFormatterFrameDecoder *m_frame_deformatter_root; + + DecodeTreeElement *m_decode_elements[0x80]; + + uint8_t m_decode_elem_iter; + + TrcMemAccMapper *m_default_mapper; //!< the mem acc mapper to use + bool m_created_mapper; //!< true if created by decode tree object + + std::vector<ItemPrinter *> m_printer_list; //!< list of packet printers. + + /* global error logger - all sources */ + static ITraceErrorLog *s_i_error_logger; + static std::list<DecodeTree *> s_trace_dcd_trees; + + /**! default error logger */ + static ocsdDefaultErrorLogger s_error_logger; + + /**! default instruction decoder */ + static TrcIDecode s_instruction_decoder; +}; + +/** @}*/ + +#endif // ARM_OCSD_DCD_TREE_H_INCLUDED + +/* End of File ocsd_dcd_tree.h */ diff --git a/decoder/include/common/ocsd_dcd_tree_elem.h b/decoder/include/common/ocsd_dcd_tree_elem.h new file mode 100644 index 000000000000..2b609fbf04f8 --- /dev/null +++ b/decoder/include/common/ocsd_dcd_tree_elem.h @@ -0,0 +1,112 @@ +/*! + * \file ocsd_dcd_tree_elem.h + * \brief OpenCSD : Decode tree element. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_DCD_TREE_ELEM_H_INCLUDED +#define ARM_OCSD_DCD_TREE_ELEM_H_INCLUDED + +#include "common/ocsd_dcd_mngr_i.h" +#include "common/trc_component.h" + +/** @addtogroup dcd_tree +@{*/ + +/*! @struct _decoder_elements + * @brief Decode tree element base structure. + * + * Element describes the protocol supported for this element and + * contains pointers to the decoder manager interface and component handle. + */ +typedef struct _decoder_elements +{ + std::string dcd_name; //!< Registered name of the decoder + TraceComponent *dcd_handle; //!< handle to the decoder object + IDecoderMngr *dcd_mngr; //!< pointer to the decoder manager interface for the decodcer + ocsd_trace_protocol_t protocol;//!< protocol type + bool created; /**< decode tree created this element (destroy it on tree destruction) */ +} decoder_element; + +/*! + * @class DecodeTreeElement + * @brief Decode tree element + * + * Decoder tree elements are references to individual decoders in the tree. + * These allow iteration of all decoders in the tree to perform common operations. + * + * The DecodeTree contains a list of elements. + */ +class DecodeTreeElement : protected decoder_element +{ +public: + DecodeTreeElement(); + ~DecodeTreeElement() {}; + + void SetDecoderElement(const std::string &name, IDecoderMngr *dcdMngr, TraceComponent *pHandle, bool bCreated); + void DestroyElem(); + + const std::string &getDecoderTypeName() { return dcd_name; }; + IDecoderMngr *getDecoderMngr() { return dcd_mngr; }; + ocsd_trace_protocol_t getProtocol() const { return protocol; }; + TraceComponent *getDecoderHandle() { return dcd_handle; }; +}; + +inline DecodeTreeElement::DecodeTreeElement() +{ + dcd_name = "unknown"; + dcd_mngr = 0; + dcd_handle = 0; + protocol = OCSD_PROTOCOL_END; + created = false; +} + +inline void DecodeTreeElement::SetDecoderElement(const std::string &name, IDecoderMngr *dcdMngr, TraceComponent *pHandle, bool bCreated) +{ + dcd_name = name; + dcd_mngr = dcdMngr; + dcd_handle = pHandle; + protocol = OCSD_PROTOCOL_UNKNOWN; + if(dcd_mngr) + protocol = dcd_mngr->getProtocolType(); + created = bCreated; +} + +inline void DecodeTreeElement::DestroyElem() +{ + if(created && (dcd_mngr != 0) && (dcd_handle != 0)) + dcd_mngr->destroyDecoder(dcd_handle); +} + +/** @}*/ +#endif // ARM_OCSD_DCD_TREE_ELEM_H_INCLUDED + +/* End of File ocsd_dcd_tree_elem.h */ diff --git a/decoder/include/common/ocsd_error.h b/decoder/include/common/ocsd_error.h new file mode 100644 index 000000000000..e547f4878033 --- /dev/null +++ b/decoder/include/common/ocsd_error.h @@ -0,0 +1,116 @@ +/*! + * \file ocsd_error.h + * \brief OpenCSD : Library Error class + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_ERROR_H_INCLUDED +#define ARM_OCSD_ERROR_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include <string> +/** @ingroup ocsd_infrastructure +@{*/ + +/*! + * @class ocsdError + * + * This class is the error object for the Ocsd. + * + * Errors are created with a severity (ocsd_err_severity_t) and a standard ocsd_err_t error code. + * Errors can optionally be created with a trace index (offset from start of capture buffer), and + * trace CoreSight source channel ID. + * + * A custom error message can be appended to the error. + * + * The ocsdError class contains a static function to output a formatted string representation of an error. + * + */ +class ocsdError { +public: + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code); /**< Default error constructor with severity and error code. */ + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx); /**< Constructor with optional trace index. */ + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id); /**< Constructor with optional trace index and channel ID. */ + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const std::string &msg); /**< Default error constructor with severity and error code - plus message. */ + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const std::string &msg); /**< Constructor with optional trace index - plus message. */ + ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id, const std::string &msg); /**< Constructor with optional trace index and channel ID - plus message. */ + + ocsdError(const ocsdError *pError); /**< Copy constructor */ + ocsdError(const ocsdError &Error); /**< Copy constructor */ + ~ocsdError(); /**< Destructor */ + + ocsdError& operator=(const ocsdError *p_err); + ocsdError& operator=(const ocsdError &err); + + void setMessage(const std::string &msg) { m_err_message = msg; }; /**< Set custom error message */ + const std::string &getMessage() const { return m_err_message; }; /**< Get custom error message */ + + const ocsd_err_t getErrorCode() const { return m_error_code; }; /**< Get error code. */ + const ocsd_err_severity_t getErrorSeverity() const { return m_sev; }; /**< Get error severity. */ + const ocsd_trc_index_t getErrorIndex() const { return m_idx; }; /**< Get trace index associated with the error. */ + const uint8_t getErrorChanID() const { return m_chan_ID; }; /**< Get the trace source channel ID associated with the error. */ + + static const std::string getErrorString(const ocsdError &error); /**< Generate a formatted error string for the supplied error. */ + +private: + static void appendErrorDetails(std::string &errStr, const ocsdError &error); /**< build the error string. */ + ocsdError(); /**< Make no parameter default constructor inaccessible. */ + + ocsd_err_t m_error_code; /**< Error code for this error */ + ocsd_err_severity_t m_sev; /**< severity for this error */ + ocsd_trc_index_t m_idx; /**< Trace buffer index associated with this error (optional) */ + uint8_t m_chan_ID; /**< trace source ID associated with this error (optional) */ + + std::string m_err_message; /**< Additional text associated with this error (optional) */ +}; + +inline ocsdError& ocsdError::operator=(const ocsdError *p_err) +{ + this->m_error_code = p_err->getErrorCode(); + this->m_sev = p_err->getErrorSeverity(); + this->m_idx = p_err->getErrorIndex(); + this->m_chan_ID = p_err->getErrorChanID(); + this->m_err_message = p_err->getMessage(); + return *this; +} + +inline ocsdError& ocsdError::operator=(const ocsdError &err) +{ + return (*this = &err); +} + + +/** @}*/ + +#endif // ARM_OCSD_ERROR_H_INCLUDED + +/* End of File ocsd_error.h */ diff --git a/decoder/include/common/ocsd_error_logger.h b/decoder/include/common/ocsd_error_logger.h new file mode 100644 index 000000000000..d60139726efb --- /dev/null +++ b/decoder/include/common/ocsd_error_logger.h @@ -0,0 +1,89 @@ +/*! + * \file ocsd_error_logger.h + * \brief OpenCSD : Library error logger. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_ERROR_LOGGER_H_INCLUDED +#define ARM_OCSD_ERROR_LOGGER_H_INCLUDED + +#include <string> +#include <vector> +#include <fstream> + +#include "interfaces/trc_error_log_i.h" +#include "ocsd_error.h" +#include "ocsd_msg_logger.h" + +class ocsdDefaultErrorLogger : public ITraceErrorLog +{ +public: + ocsdDefaultErrorLogger(); + virtual ~ocsdDefaultErrorLogger(); + + bool initErrorLogger(const ocsd_err_severity_t verbosity, bool bCreateOutputLogger = false); + + virtual ocsdMsgLogger *getOutputLogger() { return m_output_logger; }; + virtual void setOutputLogger(ocsdMsgLogger *pLogger); + + virtual const ocsd_hndl_err_log_t RegisterErrorSource(const std::string &component_name); + + virtual void LogError(const ocsd_hndl_err_log_t handle, const ocsdError *Error); + virtual void LogMessage(const ocsd_hndl_err_log_t handle, const ocsd_err_severity_t filter_level, const std::string &msg ); + + virtual const ocsd_err_severity_t GetErrorLogVerbosity() const { return m_Verbosity; }; + + virtual ocsdError *GetLastError() { return m_lastErr; }; + virtual ocsdError *GetLastIDError(const uint8_t chan_id) + { + if(OCSD_IS_VALID_CS_SRC_ID(chan_id)) + return m_lastErrID[chan_id]; + return 0; + }; + +private: + void CreateErrorObj(ocsdError **ppErr, const ocsdError *p_from); + + ocsdError *m_lastErr; + ocsdError *m_lastErrID[0x80]; + + ocsd_err_severity_t m_Verbosity; + + ocsdMsgLogger *m_output_logger; // pointer to a standard message output logger; + bool m_created_output_logger; // true if this class created it's own logger; + + std::vector<std::string> m_error_sources; +}; + + +#endif // ARM_OCSD_ERROR_LOGGER_H_INCLUDED + +/* End of File ocsd_error_logger.h */ diff --git a/decoder/include/common/ocsd_gen_elem_list.h b/decoder/include/common/ocsd_gen_elem_list.h new file mode 100644 index 000000000000..0ff1bd59cbbe --- /dev/null +++ b/decoder/include/common/ocsd_gen_elem_list.h @@ -0,0 +1,153 @@ +/* + * \file ocsd_gen_elem_stack.h + * \brief OpenCSD : Generic element output stack. + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <list> +#include "trc_gen_elem.h" +#include "comp_attach_pt_t.h" +#include "interfaces/trc_gen_elem_in_i.h" + +/*! + * @class OcsdGenElemList + * @brief Maintain a list of elements to be output + * + * Each incoming packet can result in multiple output elements. + * These are stacked in this class prior to entering the output phase of processing. + * + * This should remove some of the requirement on the packet processing to be re-enterant, + * simplifying this code. + * + * Last element(s) on this stack can be marked pending to allow for later cancellation. + * (This required for cancel element in ETMv3 exeception branch). + * + * The "list" is actually a ring buffer - maintaining pointers to indicate current valid elements. + * This buffer can increase on demand, but will only be released at the end of a decode session. + */ +class OcsdGenElemList +{ +public: + OcsdGenElemList(); + ~OcsdGenElemList(); + + void initSendIf(componentAttachPt<ITrcGenElemIn> *pGenElemIf); + void initCSID(const uint8_t CSID) { m_CSID = CSID; }; + + void reset(); //!< reset the element list. + + OcsdTraceElement *getNextElem(const ocsd_trc_index_t trc_pkt_idx); //!< get next free element on the stack (add one to the output) + const int getNumElem() const; //!< return the total number of elements on the stack (inlcuding any pended ones). + + const ocsd_gen_trc_elem_t getElemType(const int entryN) const; //!< get the type for the nth element in the stack (0 indexed) + + void pendLastNElem(int numPend); //!< Last element to be pended prior to cancel/commit decision. + void commitAllPendElem(); //!< commit all pended elements. + void cancelPendElem(); //!< cancel the last pended element on the stack. + const int numPendElem() const; //!< return the number of pended elements. + + /*! Send all of the none pended elements + Stop sending when all sent or _CONT response. + */ + ocsd_datapath_resp_t sendElements(); + const bool elemToSend() const; //!< true if any none-pending elements left to send. + +private: + + void growArray(); + const int getAdjustedIdx(int idxIn) const; //!< get adjusted index into circular buffer. + + + // list element contains pointer and byte index in trace stream + typedef struct _elemPtr { + OcsdTraceElement *pElem; //!< pointer to the listed trace element + ocsd_trc_index_t trc_pkt_idx; //!< packet index in the trace stream + } elemPtr_t; + + elemPtr_t *m_pElemArray; //!< an array of pointers to elements. + int m_elemArraySize; //!< number of element pointers in the array + + int m_firstElemIdx; //!< internal index in array of first element in use. + int m_numUsed; //!< number of elements in use + int m_numPend; //!< internal count of pended elements. + + uint8_t m_CSID; + + componentAttachPt<ITrcGenElemIn> *m_sendIf; //!< element send interface. +}; + +inline const int OcsdGenElemList::getAdjustedIdx(int idxIn) const +{ + if(idxIn >= m_elemArraySize) + idxIn -= m_elemArraySize; + return idxIn; +} + +inline const int OcsdGenElemList::getNumElem() const +{ + return m_numUsed; +} + +inline const int OcsdGenElemList::numPendElem() const +{ + return m_numPend; +} + +inline void OcsdGenElemList::pendLastNElem(int numPend) +{ + if(numPend >= getNumElem()) + m_numPend = numPend; +} + +inline void OcsdGenElemList::commitAllPendElem() +{ + m_numPend = 0; +} + +inline void OcsdGenElemList::cancelPendElem() +{ + if(m_numPend > 0) + { + m_numUsed -= m_numPend; + } +} + +inline const bool OcsdGenElemList::elemToSend() const +{ + return ((getNumElem() - m_numPend) > 0); +} + +inline void OcsdGenElemList::initSendIf(componentAttachPt<ITrcGenElemIn> *pGenElemIf) +{ + m_sendIf = pGenElemIf; +} + +/* End of File ocsd_gen_elem_stack.h */ diff --git a/decoder/include/common/ocsd_lib_dcd_register.h b/decoder/include/common/ocsd_lib_dcd_register.h new file mode 100644 index 000000000000..6ba4cf82240a --- /dev/null +++ b/decoder/include/common/ocsd_lib_dcd_register.h @@ -0,0 +1,131 @@ +/* + * \file ocsd_lib_dcd_register.h + * \brief OpenCSD : Library decoder registration and management. + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +#ifndef ARM_OCSD_LIB_DCD_REGISTER_H_INCLUDED +#define ARM_OCSD_LIB_DCD_REGISTER_H_INCLUDED + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <map> + +#include "opencsd/ocsd_if_types.h" +#include "common/ocsd_dcd_mngr_i.h" + +/*! + * @class OcsdLibDcdRegister : Registers decoders with the library + * + * library decoder register class allows decoders to be registered by name, and the register allows clients to access + * the list of names of registerd decoders. + * + * The decoders in the library are accessed through the decoder manager interface. This provides a set of functions to allow + * the creation, manipulation and destruction of registered decoders + * + */ +class OcsdLibDcdRegister +{ +public: + static OcsdLibDcdRegister *getDecoderRegister(); + + static void deregisterAllDecoders(); //!< library cleanup - deregisters decoder managers and destroys the register object. + static const ocsd_trace_protocol_t getNextCustomProtocolID(); + static void releaseLastCustomProtocolID(); + + const ocsd_err_t registerDecoderTypeByName(const std::string &name, IDecoderMngr *p_decoder_fact); //!< register a decoder manager interface + const ocsd_err_t getDecoderMngrByName(const std::string &name, IDecoderMngr **p_decoder_mngr); + const ocsd_err_t getDecoderMngrByType(const ocsd_trace_protocol_t decoderType, IDecoderMngr **p_decoder_mngr); + + const bool isRegisteredDecoder(const std::string &name); + const bool getFirstNamedDecoder(std::string &name); + const bool getNextNamedDecoder(std::string &name); + + const bool isRegisteredDecoderType(const ocsd_trace_protocol_t decoderType); + +private: + void registerBuiltInDecoders(); //!< register the list of build in decoder managers on first access of getDecoderMngrByName. + void deRegisterCustomDecoders(); //!< delete all custom decoders registered with the library. + + std::map<const std::string, IDecoderMngr *> m_decoder_mngrs; //!< map linking names to decoder manager interfaces. + std::map<const std::string, IDecoderMngr *>::const_iterator m_iter; //!< iterator for name search. + + std::map<const ocsd_trace_protocol_t, IDecoderMngr *> m_typed_decoder_mngrs; //!< map linking decoder managers to protocol type ID + + // cache last found by type to speed up repeated quries on same object. + IDecoderMngr *m_pLastTypedDecoderMngr; //!< last manager we found by type + + + + // singleton pattern - need just one of these in the library - ensure all default constructors are private. + OcsdLibDcdRegister(); + OcsdLibDcdRegister(OcsdLibDcdRegister const &) {}; + OcsdLibDcdRegister& operator=(OcsdLibDcdRegister const &){ return *this; }; + ~OcsdLibDcdRegister(); + + static OcsdLibDcdRegister *m_p_libMngr; + static bool m_b_registeredBuiltins; + static ocsd_trace_protocol_t m_nextCustomProtocolID; +}; + +/*! + * Typedef of function signature to create a decoder manager. + * + * @param *name : Registered name of the decoder. + */ +typedef IDecoderMngr *(*CreateMngr)(const std::string &name); + +/*! + * Template function to create a specific decoder manager class object. + * + * @param &name : Registered name of the decoder. + * + * @return IDecoderMngr * : pointer to the decoder manager base class interface. + */ +template <typename T> IDecoderMngr *createManagerInst(const std::string &name) +{ + return new (std::nothrow)T(name); +} + +/*! Structure to contain the information needed to create and register a builtin decoder + * manager with the library + */ +typedef struct built_in_decoder_info { + IDecoderMngr *pMngr; //!< pointer to created decoder manager + CreateMngr PFn; //!< function to create the decoder manager. + const char *name; //!< registered name of the decoder. +} built_in_decoder_info_t; + +//! Define to use to fill in an array of built_in_decoder_info_t structures. +#define CREATE_BUILTIN_ENTRY(C,N) { 0, createManagerInst<C>, N } + +#endif // ARM_OCSD_LIB_DCD_REGISTER_H_INCLUDED + +/* End of File ocsd_lib_dcd_register.h */ diff --git a/decoder/include/common/ocsd_msg_logger.h b/decoder/include/common/ocsd_msg_logger.h new file mode 100644 index 000000000000..c40af9189aa7 --- /dev/null +++ b/decoder/include/common/ocsd_msg_logger.h @@ -0,0 +1,84 @@ +/*! + * \file ocsd_msg_logger.h + * \brief OpenCSD : Generic Message logger / printer + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_MSG_LOGGER_H_INCLUDED +#define ARM_OCSD_MSG_LOGGER_H_INCLUDED + +#include <string> +#include <fstream> + +class ocsdMsgLogStrOutI +{ +public: + ocsdMsgLogStrOutI() {}; + virtual ~ocsdMsgLogStrOutI() {}; + + virtual void printOutStr(const std::string &outStr) = 0; +}; + +class ocsdMsgLogger +{ +public: + ocsdMsgLogger(); + ~ocsdMsgLogger(); + + typedef enum { + OUT_NONE = 0, + OUT_FILE = 1, + OUT_STDERR = 2, + OUT_STDOUT = 4, + OUT_STR_CB = 8 /* output to external string callback interface */ + } output_dest; + + void setLogOpts(int logOpts); + const int getLogOpts() const { return m_outFlags; }; + + void setLogFileName(const char *fileName); + void setStrOutFn(ocsdMsgLogStrOutI *p_IstrOut); + + void LogMsg(const std::string &msg); + + const bool isLogging() const; + +private: + int m_outFlags; + + std::string m_logFileName; + std::fstream m_out_file; + ocsdMsgLogStrOutI *m_pOutStrI; +}; + +#endif // ARM_OCSD_MSG_LOGGER_H_INCLUDED + +/* End of File ocsd_msg_logger.h */ diff --git a/decoder/include/common/ocsd_pe_context.h b/decoder/include/common/ocsd_pe_context.h new file mode 100644 index 000000000000..797881cf6985 --- /dev/null +++ b/decoder/include/common/ocsd_pe_context.h @@ -0,0 +1,116 @@ +/* + * \file ocsd_pe_context.h + * \brief OpenCSD : Wrapper class for PE context + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_OCSD_PE_CONTEXT_H_INCLUDED +#define ARM_OCSD_PE_CONTEXT_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/*! @class OcsdPeContext + * @brief Handler for the ocsd_pe_context structure. + * + * Reads and writes structure values, enforcing interaction rules between values + * and flags. + */ +class OcsdPeContext +{ +public: + OcsdPeContext(); + OcsdPeContext(const ocsd_pe_context *context); + ~OcsdPeContext() {}; + + OcsdPeContext &operator =(const OcsdPeContext &ctxt); + OcsdPeContext &operator =(const ocsd_pe_context *context); + + void resetCtxt(); + + void setSecLevel(const ocsd_sec_level sl) { m_context.security_level = sl; }; + void setEL(const ocsd_ex_level el) { m_context.exception_level = el; m_context.el_valid = el > ocsd_EL_unknown ? 1 : 0; }; + void setCtxtID(const uint32_t id) { m_context.context_id = id; m_context.ctxt_id_valid = 1; }; + void setVMID(const uint32_t id) { m_context.vmid = id; m_context.vmid_valid = 1; }; + void set64bit(const bool is64bit) { m_context.bits64 = is64bit ? 1 : 0; }; + + const ocsd_sec_level getSecLevel() const { return m_context.security_level; }; + const ocsd_ex_level getEL() const { return m_context.exception_level; }; + const bool ELvalid() const { return (m_context.el_valid == 1); }; + const uint32_t getCtxtID() const { return (m_context.ctxt_id_valid == 1) ? m_context.context_id : 0; }; + const bool ctxtIDvalid() const { return (m_context.ctxt_id_valid == 1); }; + const uint32_t getVMID() const { return (m_context.vmid_valid == 1) ? m_context.vmid : 0; }; + const bool VMIDvalid() const { return (m_context.vmid_valid == 1); }; + + // only allow an immutable copy of the structure out to C-API land. + operator const ocsd_pe_context &() const { return m_context; }; + +private: + ocsd_pe_context m_context; +}; + +inline OcsdPeContext::OcsdPeContext() +{ + resetCtxt(); +} + +inline OcsdPeContext::OcsdPeContext(const ocsd_pe_context *context) +{ + m_context = *context; +} + +inline void OcsdPeContext::resetCtxt() +{ + // initialise the context + m_context.bits64 = 0; + m_context.context_id = 0; + m_context.ctxt_id_valid = 0; + m_context.el_valid = 0; + m_context.exception_level = ocsd_EL_unknown; + m_context.security_level = ocsd_sec_secure; + m_context.vmid = 0; + m_context.vmid_valid = 0; +} + +inline OcsdPeContext & OcsdPeContext::operator =(const OcsdPeContext &ctxt) +{ + m_context = ctxt; + return *this; +} + +inline OcsdPeContext & OcsdPeContext::operator =(const ocsd_pe_context *context) +{ + m_context = *context; + return *this; +} + + +#endif // ARM_OCSD_PE_CONTEXT_H_INCLUDED + +/* End of File ocsd_pe_context.h */ diff --git a/decoder/include/common/ocsd_version.h b/decoder/include/common/ocsd_version.h new file mode 100644 index 000000000000..b68c85f43022 --- /dev/null +++ b/decoder/include/common/ocsd_version.h @@ -0,0 +1,46 @@ +/* + * \file ocsd_version.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_OCSD_VERSION_H_INCLUDED +#define ARM_OCSD_VERSION_H_INCLUDED + +class ocsdVersion +{ +public: + static const uint32_t vers_num(); + static const char *vers_str(); +}; + +#endif // ARM_OCSD_VERSION_H_INCLUDED + +/* End of File ocsd_version.h */ diff --git a/decoder/include/common/trc_component.h b/decoder/include/common/trc_component.h new file mode 100644 index 000000000000..6096ac70f6f0 --- /dev/null +++ b/decoder/include/common/trc_component.h @@ -0,0 +1,149 @@ +/*! + * \file trc_component.h + * \brief OpenCSD : Base trace decode component. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_COMPONENT_H_INCLUDED +#define ARM_TRC_COMPONENT_H_INCLUDED + +#include <string> +#include "comp_attach_pt_t.h" +#include "interfaces/trc_error_log_i.h" +#include "ocsd_error.h" + +class errLogAttachMonitor; + +/** @addtogroup ocsd_infrastructure +@{*/ + +/*! + * @class TraceComponent + * @brief Base class for all decode components in the library. + * + * Provides error logging attachment point and component type and instance naming + * Interface for handling of component operational mode. + */ +class TraceComponent +{ +public: + TraceComponent(const std::string &name); + TraceComponent(const std::string &name, int instIDNum); + virtual ~TraceComponent(); /**< Default Destructor */ + + const std::string &getComponentName() const { return m_name; }; + void setComponentName(const std::string &name) { m_name = name; }; + + /** Error logger attachment point.*/ + componentAttachPt<ITraceErrorLog> *getErrorLogAttachPt() { return &m_error_logger; }; + + /*! + * Set the operational mode for the component. + * This controls the way the component behaves under error conditions etc. + * These flags may also control output formats or data. + * Operation mode flags used are component specific and defined by derived classes. + * + * @param op_flags : Set of operation mode flags. + * + * @return ocsd_err_t : OCSD_OK if flags supported by this component, error if unsuppored + */ + ocsd_err_t setComponentOpMode(uint32_t op_flags); + + /*! + * Return the current operational mode flags values + * + * @return const uint32_t : Op Mode flags. + */ + const uint32_t getComponentOpMode() const { return m_op_flags; }; + + /*! + * Get the supported operational mode flags for this component. + * Base class will return nothing supported. + * Derived class must set the value correctly for the component. + * + * @return const uint32_t : Supported flags values. + */ + const uint32_t getSupportedOpModes() const { return m_supported_op_flags; }; + + /*! + * Set associated trace component - used by generic code to track + * packet processor / packet decoder pairs. + * + * @param *assocComp : pointer to the associated component + */ + void setAssocComponent(TraceComponent *assocComp) { m_assocComp = assocComp; }; + + + /*! + * get associated trace component pointer + * + * @return TraceComponent *: associated component. + */ + TraceComponent *getAssocComponent() { return m_assocComp; }; + + /*! + * Log a message at the default severity on this component. + */ + void LogDefMessage(const std::string &msg) + { + LogMessage(m_errVerbosity, msg); + } + +protected: + friend class errLogAttachMonitor; + + void LogError(const ocsdError &Error); + void LogMessage(const ocsd_err_severity_t filter_level, const std::string &msg); + const ocsd_err_severity_t getErrorLogLevel() const { return m_errVerbosity; }; + const bool isLoggingErrorLevel(const ocsd_err_severity_t level) const { return level <= m_errVerbosity; }; + void updateErrorLogLevel(); + + void do_attach_notify(const int num_attached); + void Init(const std::string &name); + + uint32_t m_op_flags; //!< current component operational mode flags. + uint32_t m_supported_op_flags; //!< supported component operational mode flags - derived class to intialise. + +private: + componentAttachPt<ITraceErrorLog> m_error_logger; + ocsd_hndl_err_log_t m_errLogHandle; + ocsd_err_severity_t m_errVerbosity; + errLogAttachMonitor *m_pErrAttachMon; + + std::string m_name; + + TraceComponent *m_assocComp; //!< associated component -> if this is a pkt decoder, associated pkt processor. +}; +/** @}*/ +#endif // ARM_TRC_COMPONENT_H_INCLUDED + +/* End of File trc_component.h */ diff --git a/decoder/include/common/trc_core_arch_map.h b/decoder/include/common/trc_core_arch_map.h new file mode 100644 index 000000000000..5a24149180fc --- /dev/null +++ b/decoder/include/common/trc_core_arch_map.h @@ -0,0 +1,68 @@ +/*! + * \file trc_core_arch_map.h + * \brief OpenCSD : Map core name strings to architecture profile constants. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_CORE_ARCH_MAP_H_INCLUDED +#define ARM_TRC_CORE_ARCH_MAP_H_INCLUDED + +#include <map> +#include <string> +#include "opencsd/ocsd_if_types.h" + +class CoreArchProfileMap +{ +public: + CoreArchProfileMap(); + ~CoreArchProfileMap() {}; + + ocsd_arch_profile_t getArchProfile(const std::string &coreName); + +private: + + std::map<std::string, ocsd_arch_profile_t> core_profiles; +}; + +inline ocsd_arch_profile_t CoreArchProfileMap::getArchProfile(const std::string &coreName) +{ + ocsd_arch_profile_t ap = { ARCH_UNKNOWN, profile_Unknown }; + + std::map<std::string, ocsd_arch_profile_t>::const_iterator it; + it = core_profiles.find(coreName); + if(it != core_profiles.end()) + ap = it->second; + return ap; +} + +#endif // ARM_TRC_CORE_ARCH_MAP_H_INCLUDED + +/* End of File trc_core_arch_map.h */ diff --git a/decoder/include/common/trc_cs_config.h b/decoder/include/common/trc_cs_config.h new file mode 100644 index 000000000000..9b2c13012f99 --- /dev/null +++ b/decoder/include/common/trc_cs_config.h @@ -0,0 +1,62 @@ +/* + * \file trc_cs_config.h + * \brief OpenCSD : Trace component config base class. + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ +#ifndef ARM_TRC_CS_CONFIG_H_INCLUDED +#define ARM_TRC_CS_CONFIG_H_INCLUDED + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** @addtogroup ocsd_protocol_cfg +@{*/ + +/*! + * @class CSConfig + * @brief Base class for configuration data on CoreSight trace component. + * + * Defines common access functionality, common to all components. + * (e.g. trace ID). + * + */ +class CSConfig +{ +public: + CSConfig() {}; + virtual ~CSConfig() {}; + + virtual const uint8_t getTraceID() const = 0; //!< CoreSight Trace ID for this device. +}; + +/** @}*/ + +#endif // ARM_TRC_CS_CONFIG_H_INCLUDED + +/* End of File trc_cs_config.h */
\ No newline at end of file diff --git a/decoder/include/common/trc_frame_deformatter.h b/decoder/include/common/trc_frame_deformatter.h new file mode 100644 index 000000000000..e4297a41e8fd --- /dev/null +++ b/decoder/include/common/trc_frame_deformatter.h @@ -0,0 +1,97 @@ +/*! + * \file trc_frame_deformatter.h + * \brief OpenCSD : De-format CoreSight formatted trace frame. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_TRC_FRAME_DEFORMATTER_H_INCLUDED +#define ARM_TRC_FRAME_DEFORMATTER_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +#include "interfaces/trc_data_raw_in_i.h" +#include "comp_attach_pt_t.h" + +class ITrcRawFrameIn; +class ITrcDataMixIDIn; +class ITrcSrcIndexCreator; +class ITraceErrorLog; +class TraceFmtDcdImpl; + +/** @defgroup ocsd_deformatter OpenCSD Library : Trace Frame Deformatter + @brief CoreSight Formatted Trace Frame - deformatting functionality. +@{*/ + +class TraceFormatterFrameDecoder : public ITrcDataIn +{ +public: + TraceFormatterFrameDecoder(); + TraceFormatterFrameDecoder(int instNum); + virtual ~TraceFormatterFrameDecoder(); + + /* the data input interface from the reader */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed); + + /* attach a data processor to a stream ID output */ + componentAttachPt<ITrcDataIn> *getIDStreamAttachPt(uint8_t ID); + + /* attach a data processor to the raw frame output */ + componentAttachPt<ITrcRawFrameIn> *getTrcRawFrameAttachPt(); + + componentAttachPt<ITrcSrcIndexCreator> *getTrcSrcIndexAttachPt(); + + componentAttachPt<ITraceErrorLog> *getErrLogAttachPt(); + + /* configuration - set operational mode for incoming stream (has FSYNCS etc) */ + ocsd_err_t Configure(uint32_t cfg_flags); + const uint32_t getConfigFlags() const; + + /* enable / disable ID streams - default as all enabled */ + ocsd_err_t OutputFilterIDs(std::vector<uint8_t> &id_list, bool bEnable); + ocsd_err_t OutputFilterAllIDs(bool bEnable); + + /* decode control */ + ocsd_datapath_resp_t Reset(); /* reset the decode to the start state, drop partial data - propogate to attached components */ + ocsd_datapath_resp_t Flush(); /* flush existing data if possible, retain state - propogate to attached components */ + +private: + TraceFmtDcdImpl *m_pDecoder; + int m_instNum; +}; + +/** @}*/ + +#endif // ARM_TRC_FRAME_DEFORMATTER_H_INCLUDED + +/* End of File trc_frame_deformatter.h */
\ No newline at end of file diff --git a/decoder/include/common/trc_gen_elem.h b/decoder/include/common/trc_gen_elem.h new file mode 100644 index 000000000000..00081b556904 --- /dev/null +++ b/decoder/include/common/trc_gen_elem.h @@ -0,0 +1,206 @@ +/*! + * \file trc_gen_elem.h + * \brief OpenCSD : Decoder Generic trace element output class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_TRC_GEN_ELEM_H_INCLUDED +#define ARM_TRC_GEN_ELEM_H_INCLUDED + +#include "opencsd/trc_gen_elem_types.h" +#include "trc_printable_elem.h" +#include "ocsd_pe_context.h" + +/** @addtogroup gen_trc_elem +@{*/ + +/*! + * @class OcsdTraceElement + * @brief Generic trace element class + * + */ +class OcsdTraceElement : public trcPrintableElem, public ocsd_generic_trace_elem +{ +public: + OcsdTraceElement(); + OcsdTraceElement(ocsd_gen_trc_elem_t type); + virtual ~OcsdTraceElement() {}; + + void init(); + +// set elements API + + void setType(const ocsd_gen_trc_elem_t type); //!< set type and init flags + void updateType(const ocsd_gen_trc_elem_t type); //!< change type only - no init + + void setContext(const ocsd_pe_context &new_context) { context = new_context; }; + void setISA(const ocsd_isa isa_update); + + void setCycleCount(const uint32_t cycleCount); + void setEvent(const event_t ev_type, const uint16_t number); + void setTS(const uint64_t ts, const bool freqChange = false); + + void setExcepMarker() { excep_data_marker = 1; }; + void setExceptionNum(uint32_t excepNum) { exception_number = excepNum; }; + + + void setTraceOnReason(const trace_on_reason_t reason); + + void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr); + void setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype); + void setAddrStart(const ocsd_vaddr_t st_addr) { this->st_addr = st_addr; }; + + void setSWTInfo(const ocsd_swt_info_t swt_info) { sw_trace_info = swt_info; }; + void setExtendedDataPtr(const void *data_ptr); + +// stringize the element + + virtual void toString(std::string &str) const; + +// get elements API + + OcsdTraceElement &operator =(const ocsd_generic_trace_elem* p_elem); + + const ocsd_gen_trc_elem_t getType() const { return elem_type; }; + + // return current context + const ocsd_pe_context &getContext() const { return context; }; + + +private: + void printSWInfoPkt(std::ostringstream &oss) const; + void clearPerPktData(); //!< clear flags that indicate validity / have values on a per packet basis + +}; + +inline OcsdTraceElement::OcsdTraceElement(ocsd_gen_trc_elem_t type) +{ + elem_type = type; +} + +inline OcsdTraceElement::OcsdTraceElement() +{ + elem_type = OCSD_GEN_TRC_ELEM_UNKNOWN; +} + +inline void OcsdTraceElement::setCycleCount(const uint32_t cycleCount) +{ + cycle_count = cycleCount; + has_cc = 1; +} + +inline void OcsdTraceElement::setEvent(const event_t ev_type, const uint16_t number) +{ + trace_event.ev_type = (uint16_t)ev_type; + trace_event.ev_number = ev_type == EVENT_NUMBERED ? number : 0; +} + +inline void OcsdTraceElement::setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr) +{ + this->st_addr = st_addr; + this->en_addr = en_addr; +} + +inline void OcsdTraceElement::setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype) +{ + last_instr_exec = exec ? 1 : 0; + this->last_i_type = last_i_type; + this->last_i_subtype = last_i_subtype; +} + +inline void OcsdTraceElement::setType(const ocsd_gen_trc_elem_t type) +{ + // set the type and clear down the per element flags + elem_type = type; + + clearPerPktData(); +} + +inline void OcsdTraceElement::updateType(const ocsd_gen_trc_elem_t type) +{ + elem_type = type; +} + +inline void OcsdTraceElement::init() +{ + st_addr = en_addr = (ocsd_vaddr_t)-1; + isa = ocsd_isa_unknown; + + cycle_count = 0; + timestamp = 0; + + context.ctxt_id_valid = 0; + context.vmid_valid = 0; + context.el_valid = 0; + + last_i_type = OCSD_INSTR_OTHER; + last_i_subtype = OCSD_S_INSTR_NONE; + + clearPerPktData(); +} + +inline void OcsdTraceElement::clearPerPktData() +{ + flag_bits = 0; // union with trace_on_reason / trace_event + + ptr_extended_data = 0; // extended data pointer +} + +inline void OcsdTraceElement::setTraceOnReason(const trace_on_reason_t reason) +{ + trace_on_reason = reason; +} + +inline void OcsdTraceElement::setISA(const ocsd_isa isa_update) +{ + isa = isa_update; + if(isa > ocsd_isa_unknown) + isa = ocsd_isa_unknown; +} + +inline void OcsdTraceElement::setTS(const uint64_t ts, const bool freqChange /*= false*/) +{ + timestamp = ts; + cpu_freq_change = freqChange ? 1 : 0; + has_ts = 1; +} + +inline void OcsdTraceElement::setExtendedDataPtr(const void *data_ptr) +{ + extended_data = 1; + ptr_extended_data = data_ptr; +} + + +/** @}*/ + +#endif // ARM_TRC_GEN_ELEM_H_INCLUDED + +/* End of File trc_gen_elem.h */ diff --git a/decoder/include/common/trc_pkt_decode_base.h b/decoder/include/common/trc_pkt_decode_base.h new file mode 100644 index 000000000000..2bbf5e51d878 --- /dev/null +++ b/decoder/include/common/trc_pkt_decode_base.h @@ -0,0 +1,303 @@ +/*! + * \file trc_pkt_decode_base.h + * \brief OpenCSD : Trace Packet decoder base class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_DECODE_BASE_H_INCLUDED +#define ARM_TRC_PKT_DECODE_BASE_H_INCLUDED + +#include "trc_component.h" +#include "comp_attach_pt_t.h" + +#include "interfaces/trc_pkt_in_i.h" +#include "interfaces/trc_gen_elem_in_i.h" +#include "interfaces/trc_tgt_mem_access_i.h" +#include "interfaces/trc_instr_decode_i.h" + +/** @defgroup ocsd_pkt_decode OpenCSD Library : Packet Decoders. + + @brief Classes providing Protocol Packet Decoding capability. + + Packet decoders convert incoming protocol packets from a packet processor, + into generic trace elements to be output to an analysis program. + + Packet decoders can be:- + - PE decoders - converting ETM or PTM packets into instruction and data trace elements + - SW stimulus decoder - converting STM or ITM packets into software generated trace elements. + - Bus decoders - converting HTM packets into bus transaction elements. + +@{*/ + + +class TrcPktDecodeI : public TraceComponent +{ +public: + TrcPktDecodeI(const char *component_name); + TrcPktDecodeI(const char *component_name, int instIDNum); + virtual ~TrcPktDecodeI() {}; + + componentAttachPt<ITrcGenElemIn> *getTraceElemOutAttachPt() { return &m_trace_elem_out; }; + componentAttachPt<ITargetMemAccess> *getMemoryAccessAttachPt() { return &m_mem_access; }; + componentAttachPt<IInstrDecode> *getInstrDecodeAttachPt() { return &m_instr_decode; }; + + void setUsesMemAccess(bool bUsesMemaccess) { m_uses_memaccess = bUsesMemaccess; }; + const bool getUsesMemAccess() const { return m_uses_memaccess; }; + + void setUsesIDecode(bool bUsesIDecode) { m_uses_idecode = bUsesIDecode; }; + const bool getUsesIDecode() const { return m_uses_idecode; }; + +protected: + + /* implementation packet decoding interface */ + virtual ocsd_datapath_resp_t processPacket() = 0; + virtual ocsd_datapath_resp_t onEOT() = 0; + virtual ocsd_datapath_resp_t onReset() = 0; + virtual ocsd_datapath_resp_t onFlush() = 0; + virtual ocsd_err_t onProtocolConfig() = 0; + virtual const uint8_t getCoreSightTraceID() = 0; + + const bool checkInit(); + + /* data output */ + ocsd_datapath_resp_t outputTraceElement(const OcsdTraceElement &elem); // use current index + ocsd_datapath_resp_t outputTraceElementIdx(ocsd_trc_index_t idx, const OcsdTraceElement &elem); // use supplied index (where decoder caches elements) + + /* target access */ + ocsd_err_t accessMemory(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, uint32_t *num_bytes, uint8_t *p_buffer); + + /* instruction decode */ + ocsd_err_t instrDecode(ocsd_instr_info *instr_info); + + componentAttachPt<ITrcGenElemIn> m_trace_elem_out; + componentAttachPt<ITargetMemAccess> m_mem_access; + componentAttachPt<IInstrDecode> m_instr_decode; + + ocsd_trc_index_t m_index_curr_pkt; + + bool m_decode_init_ok; //!< set true if all attachments in place for decode. (remove checks in main throughput paths) + bool m_config_init_ok; //!< set true if config set. + + std::string init_err_msg; //!< error message for init error + + bool m_uses_memaccess; + bool m_uses_idecode; + +}; + +inline TrcPktDecodeI::TrcPktDecodeI(const char *component_name) : + TraceComponent(component_name), + m_index_curr_pkt(0), + m_decode_init_ok(false), + m_config_init_ok(false), + m_uses_memaccess(true), + m_uses_idecode(true) +{ +} + +inline TrcPktDecodeI::TrcPktDecodeI(const char *component_name, int instIDNum) : + TraceComponent(component_name, instIDNum), + m_index_curr_pkt(0), + m_decode_init_ok(false), + m_config_init_ok(false), + m_uses_memaccess(true), + m_uses_idecode(true) +{ +} + +inline const bool TrcPktDecodeI::checkInit() +{ + if(!m_decode_init_ok) + { + if(!m_config_init_ok) + init_err_msg = "No decoder configuration information"; + else if(!m_trace_elem_out.hasAttachedAndEnabled()) + init_err_msg = "No element output interface attached and enabled"; + else if(m_uses_memaccess && !m_mem_access.hasAttachedAndEnabled()) + init_err_msg = "No memory access interface attached and enabled"; + else if(m_uses_idecode && !m_instr_decode.hasAttachedAndEnabled()) + init_err_msg = "No instruction decoder interface attached and enabled"; + else + m_decode_init_ok = true; + } + return m_decode_init_ok; +} + +inline ocsd_datapath_resp_t TrcPktDecodeI::outputTraceElement(const OcsdTraceElement &elem) +{ + return m_trace_elem_out.first()->TraceElemIn(m_index_curr_pkt,getCoreSightTraceID(), elem); +} + +inline ocsd_datapath_resp_t TrcPktDecodeI::outputTraceElementIdx(ocsd_trc_index_t idx, const OcsdTraceElement &elem) +{ + return m_trace_elem_out.first()->TraceElemIn(idx, getCoreSightTraceID(), elem); +} + +inline ocsd_err_t TrcPktDecodeI::instrDecode(ocsd_instr_info *instr_info) +{ + if(m_uses_idecode) + return m_instr_decode.first()->DecodeInstruction(instr_info); + return OCSD_ERR_DCD_INTERFACE_UNUSED; +} + +inline ocsd_err_t TrcPktDecodeI::accessMemory(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, uint32_t *num_bytes, uint8_t *p_buffer) +{ + if(m_uses_memaccess) + return m_mem_access.first()->ReadTargetMemory(address,getCoreSightTraceID(),mem_space, num_bytes,p_buffer); + return OCSD_ERR_DCD_INTERFACE_UNUSED; +} + +/**********************************************************************/ +template <class P, class Pc> +class TrcPktDecodeBase : public TrcPktDecodeI, public IPktDataIn<P> +{ +public: + TrcPktDecodeBase(const char *component_name); + TrcPktDecodeBase(const char *component_name, int instIDNum); + virtual ~TrcPktDecodeBase(); + + virtual ocsd_datapath_resp_t PacketDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *p_packet_in); + + + /* protocol configuration */ + ocsd_err_t setProtocolConfig(const Pc *config); + const Pc * getProtocolConfig() const { return m_config; }; + +protected: + void ClearConfigObj(); + + /* the protocol configuration */ + Pc * m_config; + /* the current input packet */ + const P * m_curr_packet_in; + +}; + + +template <class P, class Pc> TrcPktDecodeBase<P, Pc>::TrcPktDecodeBase(const char *component_name) : + TrcPktDecodeI(component_name), + m_config(0) +{ +} + +template <class P, class Pc> TrcPktDecodeBase<P, Pc>::TrcPktDecodeBase(const char *component_name, int instIDNum) : + TrcPktDecodeI(component_name,instIDNum), + m_config(0) +{ +} + +template <class P, class Pc> TrcPktDecodeBase<P, Pc>::~TrcPktDecodeBase() +{ + ClearConfigObj(); +} + +template <class P, class Pc> ocsd_datapath_resp_t TrcPktDecodeBase<P, Pc>::PacketDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *p_packet_in) +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + if(!checkInit()) + { + LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_NOT_INIT,init_err_msg)); + return OCSD_RESP_FATAL_NOT_INIT; + } + + switch(op) + { + case OCSD_OP_DATA: + if(p_packet_in == 0) + { + LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL)); + resp = OCSD_RESP_FATAL_INVALID_PARAM; + } + else + { + m_curr_packet_in = p_packet_in; + m_index_curr_pkt = index_sop; + resp = processPacket(); + } + break; + + case OCSD_OP_EOT: + resp = onEOT(); + break; + + case OCSD_OP_FLUSH: + resp = onFlush(); + break; + + case OCSD_OP_RESET: + resp = onReset(); + break; + + default: + LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL)); + resp = OCSD_RESP_FATAL_INVALID_OP; + break; + } + return resp; +} + + /* protocol configuration */ +template <class P, class Pc> ocsd_err_t TrcPktDecodeBase<P, Pc>::setProtocolConfig(const Pc *config) +{ + ocsd_err_t err = OCSD_ERR_INVALID_PARAM_VAL; + if(config != 0) + { + ClearConfigObj(); // remove any current config + m_config = new (std::nothrow) Pc(*config); // make a copy of the config - don't rely on the object passed in being valid outside the context of the call. + if(m_config != 0) + { + err = onProtocolConfig(); + if(err == OCSD_OK) + m_config_init_ok = true; + } + else + err = OCSD_ERR_MEM; + } + return err; +} + +template <class P, class Pc> void TrcPktDecodeBase<P, Pc>::ClearConfigObj() +{ + if(m_config) + { + delete m_config; + m_config = 0; + } +} + +/** @}*/ +#endif // ARM_TRC_PKT_DECODE_BASE_H_INCLUDED + +/* End of File trc_pkt_decode_base.h */ diff --git a/decoder/include/common/trc_pkt_elem_base.h b/decoder/include/common/trc_pkt_elem_base.h new file mode 100644 index 000000000000..07604a664210 --- /dev/null +++ b/decoder/include/common/trc_pkt_elem_base.h @@ -0,0 +1,49 @@ +/* + * \file trc_pkt_elem_base.h + * \brief Reference CoreSight Trace Decoder : + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ +#ifndef ARM_TRC_PKT_ELEM_BASE_H_INCLUDED +#define ARM_TRC_PKT_ELEM_BASE_H_INCLUDED + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +class TrcPacketBase +{ +public: + TrcPacketBase() {}; + virtual ~TrcPacketBase() {} + + //! return the underlying C API packet structure + virtual const void *c_pkt() const = 0; +}; + +#endif // ARM_TRC_PKT_ELEM_BASE_H_INCLUDED + +/* End of File trc_pkt_elem_base.h */
\ No newline at end of file diff --git a/decoder/include/common/trc_pkt_proc_base.h b/decoder/include/common/trc_pkt_proc_base.h new file mode 100644 index 000000000000..3098a3d0c0ea --- /dev/null +++ b/decoder/include/common/trc_pkt_proc_base.h @@ -0,0 +1,412 @@ +/*! + * \file trc_pkt_proc_base.h + * \brief OpenCSD : Trace packet processor base class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_PROC_BASE_H_INCLUDED +#define ARM_TRC_PKT_PROC_BASE_H_INCLUDED + +#include "interfaces/trc_data_raw_in_i.h" +#include "interfaces/trc_pkt_in_i.h" +#include "interfaces/trc_pkt_raw_in_i.h" +#include "interfaces/trc_indexer_pkt_i.h" + +#include "trc_component.h" +#include "comp_attach_pt_t.h" + +/** @defgroup ocsd_pkt_proc OpenCSD Library : Packet Processors. + @brief Classes providing Protocol Packet Processing capability. + + Packet processors take an incoming byte stream and convert into discrete packets for the + required trace protocol. +@{*/ + + + +/*! + * @class TrcPktProcI + * @brief Base Packet processing interface + * + * Defines the packet processing methods that protocol specific processors must + * implement. + * + */ +class TrcPktProcI : public TraceComponent, public ITrcDataIn +{ +public: + TrcPktProcI(const char *component_name); + TrcPktProcI(const char *component_name, int instIDNum); + virtual ~TrcPktProcI() {}; + + /** Trace byte data input interface - from ITrcDataIn. + */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed) = 0; + +protected: + + /* implementation packet processing interface */ + + /*! @brief Implementation function for the OCSD_OP_DATA operation */ + virtual ocsd_datapath_resp_t processData( const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed) = 0; + + virtual ocsd_datapath_resp_t onEOT() = 0; //!< Implementation function for the OCSD_OP_EOT operation + virtual ocsd_datapath_resp_t onReset() = 0; //!< Implementation function for the OCSD_OP_RESET operation + virtual ocsd_datapath_resp_t onFlush() = 0; //!< Implementation function for the OCSD_OP_FLUSH operation + virtual ocsd_err_t onProtocolConfig() = 0; //!< Called when the configuration object is passed to the decoder. + virtual const bool isBadPacket() const = 0; //!< check if the current packet is an error / bad packet +}; + +inline TrcPktProcI::TrcPktProcI(const char *component_name) : + TraceComponent(component_name) +{ +} + +inline TrcPktProcI::TrcPktProcI(const char *component_name, int instIDNum) : + TraceComponent(component_name,instIDNum) +{ +} + +/*! + * @class TrcPktProcBase + * @brief Packet Processor base class. Provides common infrastructure and interconnections for packet processors. + * + * The class is a templated base class. + * - P - this is the packet object class. + * - Pt - this is the packet type class. + * - Pc - this is the packet configuration class. + * + * implementations will provide concrete classes for each of these to operate under the common infrastructures. + * The base provides the trace data in (ITrcDataIn) interface and operates on the incoming operation type. + * + * Implementions override the 'onFn()' and data process functions defined in TrcPktProcI, + * with the base class ensuring consistent ordering of operations. + * + */ +template <class P, class Pt, class Pc> +class TrcPktProcBase : public TrcPktProcI +{ +public: + TrcPktProcBase(const char *component_name); + TrcPktProcBase(const char *component_name, int instIDNum); + virtual ~TrcPktProcBase(); + + /** Byte trace data input interface defined in ITrcDataIn + + The base class implementation processes the operation to call the + interface functions on TrcPktProcI. + */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed); + + +/* component attachment points */ + + //! Attachement point for the protocol packet output + componentAttachPt<IPktDataIn<P>> *getPacketOutAttachPt() { return &m_pkt_out_i; }; + //! Attachment point for the protocol packet monitor + componentAttachPt<IPktRawDataMon<P>> *getRawPacketMonAttachPt() { return &m_pkt_raw_mon_i; }; + + //! Attachment point for a packet indexer + componentAttachPt<ITrcPktIndexer<Pt>> *getTraceIDIndexerAttachPt() { return &m_pkt_indexer_i; }; + +/* protocol configuration */ + //!< Set the protocol specific configuration for the decoder. + virtual ocsd_err_t setProtocolConfig(const Pc *config); + //!< Get the configuration for the decoder. + virtual const Pc *getProtocolConfig() const { return m_config; }; + +protected: + + /* data output functions */ + ocsd_datapath_resp_t outputDecodedPacket(const ocsd_trc_index_t index_sop, const P *pkt); + + void outputRawPacketToMonitor( const ocsd_trc_index_t index_sop, + const P *pkt, + const uint32_t size, + const uint8_t *p_data); + + void indexPacket(const ocsd_trc_index_t index_sop, const Pt *packet_type); + + ocsd_datapath_resp_t outputOnAllInterfaces(const ocsd_trc_index_t index_sop, const P *pkt, const Pt *pkt_type, std::vector<uint8_t> &pktdata); + + ocsd_datapath_resp_t outputOnAllInterfaces(const ocsd_trc_index_t index_sop, const P *pkt, const Pt *pkt_type, const uint8_t *pktdata, uint32_t pktlen); + + /*! Let the derived class figure out if it needs to collate and send raw data. + can improve wait for sync performance if we do not need to save and send unsynced data. + */ + const bool hasRawMon() const; + + /* the protocol configuration */ + const Pc *m_config; + + void ClearConfigObj(); // remove our copy of the config + + const bool checkInit(); // return true if init (configured and at least one output sink attached), false otherwise. + +private: + /* decode control */ + ocsd_datapath_resp_t Reset(const ocsd_trc_index_t index); + ocsd_datapath_resp_t Flush(); + ocsd_datapath_resp_t EOT(); + + componentAttachPt<IPktDataIn<P>> m_pkt_out_i; + componentAttachPt<IPktRawDataMon<P>> m_pkt_raw_mon_i; + + componentAttachPt<ITrcPktIndexer<Pt>> m_pkt_indexer_i; + + bool m_b_is_init; +}; + +template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::TrcPktProcBase(const char *component_name) : + TrcPktProcI(component_name), + m_config(0), + m_b_is_init(false) +{ +} + +template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::TrcPktProcBase(const char *component_name, int instIDNum) : + TrcPktProcI(component_name, instIDNum), + m_config(0), + m_b_is_init(false) +{ +} + +template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::~TrcPktProcBase() +{ + ClearConfigObj(); +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed) +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + + switch(op) + { + case OCSD_OP_DATA: + if((dataBlockSize == 0) || (pDataBlock == 0) || (numBytesProcessed == 0)) + { + if(numBytesProcessed) + *numBytesProcessed = 0; // ensure processed bytes value set to 0. + LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL,"Packet Processor: Zero length data block or NULL pointer error\n")); + resp = OCSD_RESP_FATAL_INVALID_PARAM; + } + else + resp = processData(index,dataBlockSize,pDataBlock,numBytesProcessed); + break; + + case OCSD_OP_EOT: + resp = EOT(); + break; + + case OCSD_OP_FLUSH: + resp = Flush(); + break; + + case OCSD_OP_RESET: + resp = Reset(index); + break; + + default: + LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL,"Packet Processor : Unknown Datapath operation\n")); + resp = OCSD_RESP_FATAL_INVALID_OP; + break; + } + return resp; +} + + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::Reset(const ocsd_trc_index_t index) +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + + // reset the trace decoder attachment on main data path. + if(m_pkt_out_i.hasAttachedAndEnabled()) + resp = m_pkt_out_i.first()->PacketDataIn(OCSD_OP_RESET,index,0); + + // reset the packet processor implmentation + if(!OCSD_DATA_RESP_IS_FATAL(resp)) + resp = onReset(); + + // packet monitor + if(m_pkt_raw_mon_i.hasAttachedAndEnabled()) + m_pkt_raw_mon_i.first()->RawPacketDataMon(OCSD_OP_RESET,index,0,0,0); + + return resp; +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::Flush() +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + ocsd_datapath_resp_t resplocal = OCSD_RESP_CONT; + + // the trace decoder attachment on main data path. + if(m_pkt_out_i.hasAttachedAndEnabled()) + resp = m_pkt_out_i.first()->PacketDataIn(OCSD_OP_FLUSH,0,0); // flush up the data path first. + + // if the connected components are flushed, not flush this one. + if(OCSD_DATA_RESP_IS_CONT(resp)) + resplocal = onFlush(); // local flush + + return (resplocal > resp) ? resplocal : resp; +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::EOT() +{ + ocsd_datapath_resp_t resp = onEOT(); // local EOT - mark any part packet as incomplete type and prepare to send + + // the trace decoder attachment on main data path. + if(m_pkt_out_i.hasAttachedAndEnabled() && !OCSD_DATA_RESP_IS_FATAL(resp)) + resp = m_pkt_out_i.first()->PacketDataIn(OCSD_OP_EOT,0,0); + + // packet monitor + if(m_pkt_raw_mon_i.hasAttachedAndEnabled()) + m_pkt_raw_mon_i.first()->RawPacketDataMon(OCSD_OP_EOT,0,0,0,0); + + return resp; +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::outputDecodedPacket(const ocsd_trc_index_t index, const P *pkt) +{ + ocsd_datapath_resp_t resp = OCSD_RESP_CONT; + + // bad packet filter. + if((getComponentOpMode() & OCSD_OPFLG_PKTPROC_NOFWD_BAD_PKTS) && isBadPacket()) + return resp; + + // send a complete packet over the primary data path + if(m_pkt_out_i.hasAttachedAndEnabled()) + resp = m_pkt_out_i.first()->PacketDataIn(OCSD_OP_DATA,index,pkt); + return resp; +} + +template<class P,class Pt, class Pc> void TrcPktProcBase<P, Pt, Pc>::outputRawPacketToMonitor( + const ocsd_trc_index_t index_sop, + const P *pkt, + const uint32_t size, + const uint8_t *p_data) +{ + // never output 0 sized packets. + if(size == 0) + return; + + // bad packet filter. + if((getComponentOpMode() & OCSD_OPFLG_PKTPROC_NOMON_BAD_PKTS) && isBadPacket()) + return; + + // packet monitor - this cannot return CONT / WAIT, but does get the raw packet data. + if(m_pkt_raw_mon_i.hasAttachedAndEnabled()) + m_pkt_raw_mon_i.first()->RawPacketDataMon(OCSD_OP_DATA,index_sop,pkt,size,p_data); +} + +template<class P,class Pt, class Pc> const bool TrcPktProcBase<P, Pt, Pc>::hasRawMon() const +{ + return m_pkt_raw_mon_i.hasAttachedAndEnabled(); +} + +template<class P,class Pt, class Pc> void TrcPktProcBase<P, Pt, Pc>::indexPacket(const ocsd_trc_index_t index_sop, const Pt *packet_type) +{ + // packet indexer - cannot return CONT / WAIT, just gets the current index and type. + if(m_pkt_indexer_i.hasAttachedAndEnabled()) + m_pkt_indexer_i.first()->TracePktIndex(index_sop,packet_type); +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::outputOnAllInterfaces(const ocsd_trc_index_t index_sop, const P *pkt, const Pt *pkt_type, std::vector<uint8_t> &pktdata) +{ + indexPacket(index_sop,pkt_type); + if(pktdata.size() > 0) // prevent out of range errors for 0 length vector. + outputRawPacketToMonitor(index_sop,pkt,(uint32_t)pktdata.size(),&pktdata[0]); + return outputDecodedPacket(index_sop,pkt); +} + +template<class P,class Pt, class Pc> ocsd_datapath_resp_t TrcPktProcBase<P, Pt, Pc>::outputOnAllInterfaces(const ocsd_trc_index_t index_sop, const P *pkt, const Pt *pkt_type, const uint8_t *pktdata, uint32_t pktlen) +{ + indexPacket(index_sop,pkt_type); + outputRawPacketToMonitor(index_sop,pkt,pktlen,pktdata); + return outputDecodedPacket(index_sop,pkt); +} + +template<class P,class Pt, class Pc> ocsd_err_t TrcPktProcBase<P, Pt, Pc>::setProtocolConfig(const Pc *config) +{ + ocsd_err_t err = OCSD_ERR_INVALID_PARAM_VAL; + if(config != 0) + { + ClearConfigObj(); + m_config = new (std::nothrow) Pc(*config); + if(m_config != 0) + err = onProtocolConfig(); + else + err = OCSD_ERR_MEM; + } + return err; +} + +template<class P,class Pt, class Pc> void TrcPktProcBase<P, Pt, Pc>::ClearConfigObj() +{ + if(m_config) + { + delete m_config; + m_config = 0; + } +} + +template<class P,class Pt, class Pc> const bool TrcPktProcBase<P, Pt, Pc>::checkInit() +{ + if(!m_b_is_init) + { + if( (m_config != 0) && + (m_pkt_out_i.hasAttached() || m_pkt_raw_mon_i.hasAttached()) + ) + m_b_is_init = true; + } + return m_b_is_init; +} + +/** @}*/ + +#endif // ARM_TRC_PKT_PROC_BASE_H_INCLUDED + +/* End of File trc_pkt_proc_base.h */ diff --git a/decoder/include/common/trc_printable_elem.h b/decoder/include/common/trc_printable_elem.h new file mode 100644 index 000000000000..92a47e882b1a --- /dev/null +++ b/decoder/include/common/trc_printable_elem.h @@ -0,0 +1,91 @@ +/*! + * \file trc_printable_elem.h + * \brief OpenCSD : Standard printable element base class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PRINTABLE_ELEM_H_INCLUDED +#define ARM_TRC_PRINTABLE_ELEM_H_INCLUDED + +#include <string> +#include <cstdint> + +/** @addtogroup ocsd_infrastructure +@{*/ + +/*! + * @class trcPrintableElem + * @brief Class to provide trace element strings for printing + * + * Provide a standard interface to the trace packet classes to allow the packets + * to be printed in logging or tools. + * + * Provides some standard formatting functionality + * + */ +class trcPrintableElem +{ +public: + trcPrintableElem() {}; + virtual ~trcPrintableElem() {}; + virtual void toString(std::string &str) const; + virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const; + + // print formatting utilities + static void getValStr(std::string &valStr, const int valTotalBitSize, const int valValidBits, const uint64_t value, const bool asHex = true, const int updateBits = 0); + +}; + +inline void trcPrintableElem::toString(std::string &str) const +{ + str = "Trace Element : print not implemented"; +} + +inline void trcPrintableElem::toStringFmt(const uint32_t /*fmtFlags*/, std::string &str) const +{ + toString(str); +} + +/** static template string function - used in "C" API to provide generic printing */ +template<class Pc, class Pt> +void trcPrintElemToString(const void *p_pkt, std::string &str) +{ + Pc pktClass; + pktClass = static_cast<const Pt *>(p_pkt); + pktClass.toString(str); +} + +/** @}*/ + +#endif // ARM_TRC_PRINTABLE_ELEM_H_INCLUDED + +/* End of File trc_printable_elem.h */ diff --git a/decoder/include/common/trc_ret_stack.h b/decoder/include/common/trc_ret_stack.h new file mode 100644 index 000000000000..a7f53d1cbaeb --- /dev/null +++ b/decoder/include/common/trc_ret_stack.h @@ -0,0 +1,114 @@ +/* +* \file trc_ret_stack.h +* \brief OpenCSD : trace decoder return stack feature. +* +* \copyright Copyright (c) 2017, ARM Limited. All Rights Reserved. +*/ + +/* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* 3. Neither the name of the copyright holder nor the names of its contributors +* may be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef ARM_TRC_RET_STACK_H_INCLUDED +#define ARM_TRC_RET_STACK_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +// uncomment below for return stack logging +// #define TRC_RET_STACK_DEBUG + +#ifdef TRC_RET_STACK_DEBUG +class TraceComponent; +#endif + +typedef struct _retStackElement +{ + ocsd_vaddr_t ret_addr; + ocsd_isa ret_isa; +} retStackElement; + +class TrcAddrReturnStack +{ +public: + TrcAddrReturnStack(); + ~TrcAddrReturnStack() {}; + + void set_active(bool active) + { + m_active = active; + }; + + bool is_active() const + { + return m_active; + }; + + void push(const ocsd_vaddr_t addr, const ocsd_isa isa); + ocsd_vaddr_t pop(ocsd_isa &isa); + void flush(); + + bool overflow() const + { + return (bool)(num_entries < 0); + }; + + void set_pop_pending() + { + if (m_active) + m_pop_pending = true; + } + + void clear_pop_pending() + { + m_pop_pending = false; + } + + bool pop_pending() const + { + return m_pop_pending; + }; + +private: + bool m_active; + bool m_pop_pending; // flag for decoder to indicate a pop might be needed depending on the next packet (ETMv4) + + int head_idx; + int num_entries; + retStackElement m_stack[16]; + +#ifdef TRC_RET_STACK_DEBUG +public: + void set_dbg_logger(TraceComponent *pLogger) { m_p_debug_logger = pLogger; }; +private: + void LogOp(const char *pszOpString, ocsd_vaddr_t addr, int head_off, ocsd_isa isa); + + TraceComponent *m_p_debug_logger; +#endif // TRC_RET_STACK_DEBUG +}; + +#endif // ARM_TRC_RET_STACK_H_INCLUDED + +/* End of File trc_ret_stack.h */ diff --git a/decoder/include/i_dec/trc_i_decode.h b/decoder/include/i_dec/trc_i_decode.h new file mode 100644 index 000000000000..ac31a79ded63 --- /dev/null +++ b/decoder/include/i_dec/trc_i_decode.h @@ -0,0 +1,56 @@ +/* + * \file trc_i_decode.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_TRC_I_DECODE_H_INCLUDED +#define ARM_TRC_I_DECODE_H_INCLUDED + +#include "interfaces/trc_instr_decode_i.h" +#include "opencsd/ocsd_if_types.h" + +class TrcIDecode : public IInstrDecode +{ +public: + TrcIDecode() {}; + virtual ~TrcIDecode() {}; + + virtual ocsd_err_t DecodeInstruction(ocsd_instr_info *instr_info); + +private: + ocsd_err_t DecodeA32(ocsd_instr_info *instr_info); + ocsd_err_t DecodeA64(ocsd_instr_info *instr_info); + ocsd_err_t DecodeT32(ocsd_instr_info *instr_info); +}; + +#endif // ARM_TRC_I_DECODE_H_INCLUDED + +/* End of File trc_i_decode.h */ diff --git a/decoder/include/i_dec/trc_idec_arminst.h b/decoder/include/i_dec/trc_idec_arminst.h new file mode 100644 index 000000000000..b15984948d29 --- /dev/null +++ b/decoder/include/i_dec/trc_idec_arminst.h @@ -0,0 +1,130 @@ +/* + * \file trc_idec_arminst.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_IDEC_ARMINST_H_INCLUDED +#define ARM_TRC_IDEC_ARMINST_H_INCLUDED + +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS 1 +#endif + +#include "opencsd/ocsd_if_types.h" +#include <cstdint> + +/* +For Thumb2, test if a halfword is the first half of a 32-bit instruction, +as opposed to a complete 16-bit instruction. +*/ +inline int is_wide_thumb(uint16_t insthw) +{ + return (insthw & 0xF800) >= 0xE800; +} + +/* +In the following queries, 16-bit Thumb2 instructions should be +passed in as the high halfword, e.g. xxxx0000. +*/ + +/* +Test whether an instruction is a branch (software change of the PC). +This includes branch instructions and all loads and data-processing +instructions that write to the PC. It does not include exception +instructions such as SVC, HVC and SMC. +(Performance event 0x0C includes these.) +*/ +int inst_ARM_is_branch(uint32_t inst); +int inst_Thumb_is_branch(uint32_t inst); +int inst_A64_is_branch(uint32_t inst); + +/* +Test whether an instruction is a direct (aka immediate) branch. +Performance event 0x0D counts these. +*/ +int inst_ARM_is_direct_branch(uint32_t inst); +int inst_Thumb_is_direct_branch(uint32_t inst); +int inst_A64_is_direct_branch(uint32_t inst); + +/* +Get branch destination for a direct branch. +*/ +int inst_ARM_branch_destination(uint32_t addr, uint32_t inst, uint32_t *pnpc); +int inst_Thumb_branch_destination(uint32_t addr, uint32_t inst, uint32_t *pnpc); +int inst_A64_branch_destination(uint64_t addr, uint32_t inst, uint64_t *pnpc); + +int inst_ARM_is_indirect_branch(uint32_t inst); +int inst_Thumb_is_indirect_branch(uint32_t inst); +int inst_A64_is_indirect_branch(uint32_t inst); + +int inst_ARM_is_branch_and_link(uint32_t inst); +int inst_Thumb_is_branch_and_link(uint32_t inst); +int inst_A64_is_branch_and_link(uint32_t inst); + +int inst_ARM_is_conditional(uint32_t inst); +int inst_Thumb_is_conditional(uint32_t inst); +int inst_A64_is_conditional(uint32_t inst); + +/* For an IT instruction, return the number of instructions conditionalized + (from 1 to 4). For other instructions, return zero. */ +unsigned int inst_Thumb_is_IT(uint32_t inst); + +typedef enum { + ARM_BARRIER_NONE, + ARM_BARRIER_ISB, + ARM_BARRIER_DMB, + ARM_BARRIER_DSB +} arm_barrier_t; + +arm_barrier_t inst_ARM_barrier(uint32_t inst); +arm_barrier_t inst_Thumb_barrier(uint32_t inst); +arm_barrier_t inst_A64_barrier(uint32_t inst); + +/* +Test whether an instruction is definitely undefined, e.g. because +allocated to a "permanently UNDEFINED" space (UDF mnemonic). +Other instructions besides the ones indicated, may always or +sometimes cause an undefined instruction trap. This call is +intended to be helpful in 'runaway decode' prevention. +*/ +int inst_ARM_is_UDF(uint32_t inst); +int inst_Thumb_is_UDF(uint32_t inst); +int inst_A64_is_UDF(uint32_t inst); + + +/* access sub-type information */ +ocsd_instr_subtype get_instr_subtype(); +void clear_instr_subtype(); + +#endif // ARM_TRC_IDEC_ARMINST_H_INCLUDED + +/* End of File trc_idec_arminst.h */ diff --git a/decoder/include/interfaces/trc_abs_typed_base_i.h b/decoder/include/interfaces/trc_abs_typed_base_i.h new file mode 100644 index 000000000000..0db60770844a --- /dev/null +++ b/decoder/include/interfaces/trc_abs_typed_base_i.h @@ -0,0 +1,58 @@ +/* + * \file trc_abs_typed_base_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_ABS_TYPED_BASE_I_H_INCLUDED +#define ARM_TRC_ABS_TYPED_BASE_I_H_INCLUDED + +/*! + * @class ITrcTypedBase + * @brief Abstract base class to for interfaces templated types. + * + * This class is used as an abstract base for any interfaces that are specialised using + * template<> types. + * + * Designed to allow interface objects to be passed through generic interfaces into type + * specific templated implmentation handlers and converted/checked using RTTI. + */ +class ITrcTypedBase +{ +public: + ITrcTypedBase() {}; + virtual ~ITrcTypedBase() {}; +}; + +#endif // ARM_TRC_ABS_TYPED_BASE_I_H_INCLUDED + +/* End of File trc_abs_typed_base_i.h */ diff --git a/decoder/include/interfaces/trc_data_raw_in_i.h b/decoder/include/interfaces/trc_data_raw_in_i.h new file mode 100644 index 000000000000..bf020d706df8 --- /dev/null +++ b/decoder/include/interfaces/trc_data_raw_in_i.h @@ -0,0 +1,84 @@ +/* + * \file trc_data_raw_in_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRCDATA_RAW_IN_I_H_INCLUDED +#define ARM_TRCDATA_RAW_IN_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/** @class ITrcDataIn + * + * @brief Interface to either trace data frame deformatter or packet processor. + * + * @ingroup ocsd_interfaces + * + * Interface class to a processor that can consume raw formatted trace byte stream from a trace reader + * or raw source buffer into a deformatter object. + * + * Also used to interface a single trace source ID data stream into a packet processor. + * + */ +class ITrcDataIn { +public: + ITrcDataIn() {}; /**< Default constructor. */ + virtual ~ITrcDataIn() {}; /**< Default destructor. */ + + /*! + * Data input method for a component on the Trace decode datapath. + * Datapath operations passed to the component, which responds with data path response codes. + * + * This API is for raw trace data, which can be:- + * - CoreSight formatted frame data for input to the frame deformatter. + * - Single binary source data for input to a packet decoder. + * + * @param op : Data path operation. + * @param index : Byte index of start of pDataBlock data as offset from start of captured data. May be zero for none-data operation + * @param dataBlockSize : Size of data block. Zero for none-data operation. + * @param *pDataBlock : pointer to data block. Null for none-data operation + * @param *numBytesProcessed : Pointer to count of data used by processor. Set by processor on data operation. Null for none-data operation + * + * @return ocsd_datapath_resp_t : Standard data path response code. + */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed) = 0; + +}; + +#endif // ARM_TRCDATA_RAW_IN_I_H_INCLUDED + + +/* End of File trc_data_raw_in_i.h */ diff --git a/decoder/include/interfaces/trc_data_rawframe_in_i.h b/decoder/include/interfaces/trc_data_rawframe_in_i.h new file mode 100644 index 000000000000..9fc35319b86e --- /dev/null +++ b/decoder/include/interfaces/trc_data_rawframe_in_i.h @@ -0,0 +1,81 @@ +/* + * \file trc_data_rawframe_in_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRCDATA_RAWFRAME_IN_I_H_INCLUDED +#define ARM_TRCDATA_RAWFRAME_IN_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/*! + * @class ITrcRawFrameIn + * + * @brief Interface to monitor the raw frame decode progress.. + * + * @ingroup ocsd_interfaces + * + * This interface allows a program to monitor the contents of the CoreSight frames passing through the + * frame deformatter. + * + * + */ +class ITrcRawFrameIn { +public: + ITrcRawFrameIn() {}; /**< Default constructor. */ + virtual ~ITrcRawFrameIn() {}; /**< Default destructor. */ + + /*! + * Interface to monitor CoreSight frame data. Output as blocks of data. + * + * @param op : Data path operation. + * @param index : Byte index of start of pDataBlock data as offset from start of captured data. May be zero for none-data operation + * @param frame_element : Type of frame element being output. + * @param dataBlockSize : size of frame element. + * @param *pDataBlock : pointer to frame data. + * @param traceID : Trace ID when element type ID data. + * + * @return ocsd_err_t : Standard library erroc code. Monitor only, not on data path. + */ + virtual ocsd_err_t TraceRawFrameIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const ocsd_rawframe_elem_t frame_element, + const int dataBlockSize, + const uint8_t *pDataBlock, + const uint8_t traceID) = 0; +}; + + +#endif // ARM_TRCDATA_RAWFRAME_IN_I_H_INCLUDED + +/* End of File trc_data_rawframe_in_i.h */ diff --git a/decoder/include/interfaces/trc_error_log_i.h b/decoder/include/interfaces/trc_error_log_i.h new file mode 100644 index 000000000000..2fc796f72457 --- /dev/null +++ b/decoder/include/interfaces/trc_error_log_i.h @@ -0,0 +1,134 @@ +/*! + * \file trc_error_log_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_ERROR_LOG_I_H_INCLUDED +#define ARM_TRC_ERROR_LOG_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include <string> + +class ocsdError; +class ocsdMsgLogger; + +/*! + * @class ITraceErrorLog + * @brief Error logging interface. + * @ingroup ocsd_interfaces + * + * This class provides a standard interface to the decoder error logger for all trace decode and + * reader components. + * + * Implementation will determine if and how the errors and messages are logged. + * + */ +class ITraceErrorLog +{ +public: + ITraceErrorLog() {}; /**< default constructor */ + virtual ~ITraceErrorLog() {}; /**< default destructor */ + + /*! + * Register a named component error source. Allows the logger to associate errors with components. + * returned handle to be used with subsequent error log calls. + * + * @param &component_name : name of the component. + * + * @return virtual const : Handle associated with the component. + */ + virtual const ocsd_hndl_err_log_t RegisterErrorSource(const std::string &component_name) = 0; + + /*! + * Return the verbosity level of the logger. Errors of the returned ocsd_err_severity_t severity + * or lower will be logged, others are ignored. + * + * @return ocsd_err_severity_t : Current logging severity level. + */ + virtual const ocsd_err_severity_t GetErrorLogVerbosity() const = 0; + + /*! + * Log an error. + * Pass an error object and the component or generic handle to associate with the error. + * Error will be saved for access by GetLastError(). + * + * If logger implementation has output print logging enabled then this may be printed to file or screen. + * + * @param handle : Component handle or standard generic handle + * @param *Error : Pointer to an error object. + */ + virtual void LogError(const ocsd_hndl_err_log_t handle, const ocsdError *Error) = 0; + + /*! + * Log a general message. Associated with component or use generic handle. + * Message logged to same output as errors if output enabled, but not saved for GetLastError() + * + * @param handle : Component handle or standard generic handle. + * @param filter_level : Verbosity filter. + * @param msg : Pointer to an error object. + */ + virtual void LogMessage(const ocsd_hndl_err_log_t handle, const ocsd_err_severity_t filter_level, const std::string &msg ) = 0; + + /*! + * Get a pointer to the last logged error. + * Returns 0 if no errors have been logged. + * + * @return ocsdError *: last error pointer. + */ + virtual ocsdError *GetLastError() = 0; + + /*! + * Get the last error associated with the given Trace source channel ID. + * returns a pointer to the error or 0 if no errors associated with the ID. + * + * @param chan_id : ID. + * + * @return ocsdError *: last error pointer for ID or 0. + */ + virtual ocsdError *GetLastIDError(const uint8_t chan_id) = 0; + + virtual ocsdMsgLogger *getOutputLogger() = 0; + virtual void setOutputLogger(ocsdMsgLogger *pLogger) = 0; + + enum generic_handles { + HANDLE_GEN_ERR = 0, + HANDLE_GEN_WARN, + HANDLE_GEN_INFO, + /* last value in list */ + HANDLE_FIRST_REGISTERED_COMPONENT /**< 1st valid handle value for components registered with logger */ + }; +}; + +#endif // ARM_TRC_ERROR_LOG_I_H_INCLUDED + +/* End of File trc_error_log_i.h */ diff --git a/decoder/include/interfaces/trc_gen_elem_in_i.h b/decoder/include/interfaces/trc_gen_elem_in_i.h new file mode 100644 index 000000000000..5bad293ff13d --- /dev/null +++ b/decoder/include/interfaces/trc_gen_elem_in_i.h @@ -0,0 +1,77 @@ +/* + * \file trc_gen_elem_in_i.h + * \brief OpenCSD : Generic Trace Element interface. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_GEN_ELEM_IN_I_H_INCLUDED +#define ARM_TRC_GEN_ELEM_IN_I_H_INCLUDED + +class OcsdTraceElement; + +/*! + * @class ITrcGenElemIn + + * @brief Interface for the input of generic trace elements. + * + * @ingroup ocsd_interfaces + * + * This interface is the principal output attachment point for the trace packet decoders. + * + */ +class ITrcGenElemIn +{ +public: + ITrcGenElemIn() {}; /**< Default constructor. */ + virtual ~ITrcGenElemIn() {}; /**< Default destructor. */ + + + /*! + * Interface for analysis blocks that take generic trace elements as their input. + * Final interface on the decode data path. The index provided is that for the generating + * trace packet. Multiple generic elements may be produced from a single packet so they will + * all have the same start index. + * + * @param index_sop : Trace index for start of packet generating this element. + * @param trc_chan_id : CoreSight Trace ID for this source. + * @param &elem : Generic trace element generated from the deocde data path + * + * @return ocsd_datapath_resp_t : Standard data path response. + */ + virtual ocsd_datapath_resp_t TraceElemIn(const ocsd_trc_index_t index_sop, + const uint8_t trc_chan_id, + const OcsdTraceElement &elem) = 0; +}; + +#endif // ARM_TRC_GEN_ELEM_IN_I_H_INCLUDED + +/* End of File trc_gen_elem_in_i.h */ diff --git a/decoder/include/interfaces/trc_indexer_pkt_i.h b/decoder/include/interfaces/trc_indexer_pkt_i.h new file mode 100644 index 000000000000..02aecda8b039 --- /dev/null +++ b/decoder/include/interfaces/trc_indexer_pkt_i.h @@ -0,0 +1,77 @@ +/* + * \file trc_indexer_pkt_i.h + * \brief OpenCSD : Trace packet indexer + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_INDEXER_PKT_I_H_INCLUDED +#define ARM_TRC_INDEXER_PKT_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class ITrcPktIndexer + + * @brief Templated interface class to index packet types. + * + * @ingroup ocsd_interfaces + * + * Each protocol version will have an associated indexer that will index significant + * packets such as synchronisation points, timestamps, trigger events. + * + * Creating an index is optional at runtime, but will allow any analysis program to synchronise the + * different trace streams. + * + * Indexes need to be created only once and can be saved for re-use. + * + * Packet processors should be created to support the attachment of an indexer. + * + */ +template <class Pt> +class ITrcPktIndexer : public ITrcTypedBase +{ +public: + ITrcPktIndexer() {}; /**< Default constructor. */ + virtual ~ITrcPktIndexer() {}; /**< Default destructor. */ + + /*! + * Interface method for trace packet indexing. Implementated by a channel packet indexer. + * + * @param index_sop : trace index at the start of the packet. + * @param *packet_type : The packet type being indexed. + */ + virtual void TracePktIndex(const ocsd_trc_index_t index_sop, const Pt *packet_type) = 0; +}; + +#endif // ARM_TRC_INDEXER_PKT_I_H_INCLUDED + +/* End of File trc_indexer_pkt_i.h */ diff --git a/decoder/include/interfaces/trc_indexer_src_i.h b/decoder/include/interfaces/trc_indexer_src_i.h new file mode 100644 index 000000000000..078efa515253 --- /dev/null +++ b/decoder/include/interfaces/trc_indexer_src_i.h @@ -0,0 +1,124 @@ +/* + * \file trc_indexer_src_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef ARM_TRC_INDEXER_SRC_I_H_INCLUDED +#define ARM_TRC_INDEXER_SRC_I_H_INCLUDED + +#include <vector> +#include "opencsd/ocsd_if_types.h" + +/*! + * @class ITrcSrcIndexCreator + * + * @brief Interface class to index the frame formatted trace stream + * + * @ingroup ocsd_interfaces + * + * This indexer creates an index of trace IDs present in the frame formatted trace stream. + * It will also index any trigger point markers indicated in the frame format. + * + * Indexing is optional at runtime. Indexes can be saved and re-used. + */ +class ITrcSrcIndexCreator +{ +public: + ITrcSrcIndexCreator() {}; /**< Default constructor. */ + virtual ~ITrcSrcIndexCreator() {}; /**< Default destructor. */ + + /*! + * The size of block that the indexer will split trace into - this is effectively the + * index granularity. The indexing will indicate if an indexed element - e.g. a source + * ID - is present in the block. Smaller granularity will mean a larger index but more + * resolution in IDs and event positions. + * + * Block sizes will be power of 2 aligned, not less 256 bytes (16 frames). + * Indexer will choose block size based on total trace size and desired granularity. + * + * @return uint32_t : Size of indexing block. + */ + virtual const uint32_t IndexBlockSize() const; + + /*! + * Index a single ID + * + * @param src_idx : trace index of source ID + * @param ID : The source ID. + * + * @return virtual ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t TrcIDIndex(const ocsd_trc_index_t src_idx, const uint8_t ID) = 0; + + /*! + * Index a set of IDs in a block. + * Block is assumed to be one of size IndexBlockSize() + * + * May be used by the deformatter to collate IDs and reduce indexing calls. + * May be used by hardware capture source that has its own index of IDs, to transfer + * indexing information into the decoder indexer. + * + * @param src_idx_start : Index of start of block. + * @param IDs : IDs within the block. + * + * @return virtual ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t TrcIDBlockMap(const ocsd_trc_index_t src_idx_start, const std::vector<uint8_t> IDs) = 0; + + /*! + * The CoreSight frame format can use a reserved ID to indicate trigger or other + * events programmed into the trace protocol generator. + * This call indexes these events. + * + * @param src_idx : trace index of the event. + * @param event_type : type of event. + * + * @return ocsd_err_t : OCSD_OK if indexed correctly, OCSD_ERR_INVALID_PARAM_VAL if incorrect value used. + */ + virtual ocsd_err_t TrcEventIndex(const ocsd_trc_index_t src_idx, const int event_type) = 0; + + + /*! + * When the frame formatter is using frame syncs (typically TPIU output captured on off chip capture + * device), this index call notes the position of these elements. + * + * @param src_idx : trace index of sync point. + */ + virtual void TrcSyncIndex(const ocsd_trc_index_t src_idx); + +}; + +#endif // ARM_TRC_INDEXER_SRC_I_H_INCLUDED + +/* End of File trc_indexer_src_i.h */ diff --git a/decoder/include/interfaces/trc_instr_decode_i.h b/decoder/include/interfaces/trc_instr_decode_i.h new file mode 100644 index 000000000000..75af19ff796a --- /dev/null +++ b/decoder/include/interfaces/trc_instr_decode_i.h @@ -0,0 +1,66 @@ +/* + * \file trc_instr_decode_i.h + * \brief OpenCSD : Interface for instruction decode. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_INSTR_DECODE_I_H_INCLUDED +#define ARM_TRC_INSTR_DECODE_I_H_INCLUDED + +/*! + * @class IInstrDecode + * @ingroup ocsd_interfaces + * @brief Interface class to an instruction opcode decoder. + * + * The opcode decoder needs to be capable of limited decode required for trace + * execution flow determination. + * + */ +class IInstrDecode +{ +public: + IInstrDecode() {}; /**< Default constructor. */ + virtual ~IInstrDecode() {}; /**< Default destructor. */ + + /*! + * Instruction opcode decode for the packet trace decoder to follow the + * instruction execution flow. + * + * @param *instr_info : Structure to pass current opcode, and receive required decode information. + * + * @return ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t DecodeInstruction(ocsd_instr_info *instr_info) = 0; +}; + +#endif // ARM_TRC_INSTR_DECODE_I_H_INCLUDED + +/* End of File trc_instr_decode_i.h */ diff --git a/decoder/include/interfaces/trc_pkt_in_i.h b/decoder/include/interfaces/trc_pkt_in_i.h new file mode 100644 index 000000000000..8f6c5eff6db5 --- /dev/null +++ b/decoder/include/interfaces/trc_pkt_in_i.h @@ -0,0 +1,80 @@ +/* + * \file trc_pkt_in_i.h + * \brief OpenCSD : Interface for trace protocol packet input + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_IN_I_H_INCLUDED +#define ARM_TRC_PKT_IN_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class IPktDataIn + * @ingroup ocsd_interfaces + * @brief Interface class providing an input for discrete protocol packets. + * + * Implemented by trace protocol packet decoders to convert packets into + * generic trace elements. + * + * Packet class used will contain information on the latest packet, + * and any intra-packet state. + * + */ +template<class P> +class IPktDataIn : public ITrcTypedBase +{ +public: + IPktDataIn() {}; /**< Default constructor. */ + virtual ~IPktDataIn() {}; /**< Default destructor. */ + + /*! + * Interface function to process a single protocol packet. + * Pass a trace index for the start of packet and a pointer to a packet when the + * datapath operation is OCSD_OP_DATA. + * + * @param op : Datapath operation. + * @param index_sop : Trace index for the start of the packet, 0 if not OCSD_OP_DATA. + * @param *p_packet_in : Protocol Packet - when data path operation is OCSD_OP_DATA. null otherwise. + * + * @return ocsd_datapath_resp_t : Standard data path response. + */ + virtual ocsd_datapath_resp_t PacketDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *p_packet_in) = 0; + + +}; + +#endif // ARM_TRC_PKT_IN_I_H_INCLUDED + +/* End of File trc_proc_pkt_in_i.h */ diff --git a/decoder/include/interfaces/trc_pkt_raw_in_i.h b/decoder/include/interfaces/trc_pkt_raw_in_i.h new file mode 100644 index 000000000000..6f7b21383024 --- /dev/null +++ b/decoder/include/interfaces/trc_pkt_raw_in_i.h @@ -0,0 +1,83 @@ +/* + * \file trc_pkt_raw_in_i.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_RAW_IN_I_H_INCLUDED +#define ARM_TRC_PKT_RAW_IN_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class IPktRawDataMon + * + * @brief Interface class for packet processor monitor. + * + * @addtogroup ocsd_interfaces + * + * This interface provides a monitor point for the packet processor block. + * The templated interface is called with a complete packet of the given + * type, plus the raw packet bytes. Use for tools which need to display compplete + * packets or require additional processing on raw packet data. + * + * This interface is not part of the data decode path and cannot provide feedback. + * + */ +template<class P> +class IPktRawDataMon : public ITrcTypedBase +{ +public: + IPktRawDataMon() {}; /**< Default constructor. */ + virtual ~IPktRawDataMon() {}; /**< Default destructor. */ + + /*! + * Interface monitor function called with a complete packet, or other + * data path operation. + * + * @param op : Datapath operation + * @param index_sop : start of packet index + * @param *pkt : The expanded packet + * @param size : size of packet data bytes + * @param *p_data : the packet data bytes. + * + */ + virtual void RawPacketDataMon( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *pkt, + const uint32_t size, + const uint8_t *p_data) = 0; +}; + +#endif // ARM_TRC_PKT_RAW_IN_I_H_INCLUDED + +/* End of File trc_pkt_raw_in_i.h */ diff --git a/decoder/include/interfaces/trc_tgt_mem_access_i.h b/decoder/include/interfaces/trc_tgt_mem_access_i.h new file mode 100644 index 000000000000..effc9b5e161e --- /dev/null +++ b/decoder/include/interfaces/trc_tgt_mem_access_i.h @@ -0,0 +1,91 @@ +/* + * \file trc_tgt_mem_access_i.h + * \brief OpenCSD : Target memory read interface. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_TGT_MEM_ACCESS_I_H_INCLUDED +#define ARM_TRC_TGT_MEM_ACCESS_I_H_INCLUDED + +/*! + * @class ITargetMemAccess + * + * @brief Interface to target memory access. + * + * @ingroup ocsd_interfaces + * + * Read Target memory call is used by the decoder to access the memory location in the + * target memory space for the next instruction(s) to be traced. + * + * Memory data returned is to be little-endian. + * + * The implementator of this interface could either use file(s) containing dumps of memory + * locations from the target, be an elf file reader extracting code, or a live target + * connection, depending on the tool execution context. + * + * + */ +class ITargetMemAccess +{ +public: + ITargetMemAccess() {}; /**< default interface constructor */ + virtual ~ITargetMemAccess() {}; /**< default interface destructor */ + + /*! + * Read a block of target memory into supplied buffer. + * + * Bytes read set less than bytes required, along with a success return code indicates full memory + * location not accessible. Function will return all accessible bytes from the address up to the point + * where the first inaccessible location appears. + * + * The cs_trace_id associates a memory read with a core. Different cores may have different memory spaces, + * the memory access may take this into account. Access will first look in the registered memory areas + * associated with the ID, failing that will look into any global memory spaces. + * + * @param address : Address to access. + * @param cs_trace_id : protocol source trace ID. + * @param mem_space : Memory space to access, (secure, non-secure, optionally with EL, or any). + * @param num_bytes : [in] Number of bytes required. [out] Number of bytes actually read. + * @param *p_buffer : Buffer to fill with the bytes. + * + * @return ocsd_err_t : OCSD_OK on successful access (including memory not available) + */ + virtual ocsd_err_t ReadTargetMemory( const ocsd_vaddr_t address, + const uint8_t cs_trace_id, + const ocsd_mem_space_acc_t mem_space, + uint32_t *num_bytes, + uint8_t *p_buffer) = 0; +}; + + +#endif // ARM_TRC_TGT_MEM_ACCESS_I_H_INCLUDED + +/* End of File trc_tgt_mem_access_i.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc.h b/decoder/include/mem_acc/trc_mem_acc.h new file mode 100644 index 000000000000..66f91229da21 --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc.h @@ -0,0 +1,47 @@ +/* + * \file trc_mem_acc.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_H_INCLUDED +#define ARM_TRC_MEM_ACC_H_INCLUDED + +#include "trc_mem_acc_base.h" +#include "trc_mem_acc_bufptr.h" +#include "trc_mem_acc_file.h" +#include "trc_mem_acc_mapper.h" +#include "trc_mem_acc_cb.h" + + +#endif // ARM_TRC_MEM_ACC_H_INCLUDED + +/* End of File trc_mem_acc.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_base.h b/decoder/include/mem_acc/trc_mem_acc_base.h new file mode 100644 index 000000000000..71b6a816edad --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_base.h @@ -0,0 +1,244 @@ +/*! + * \file trc_mem_acc_base.h + * \brief OpenCSD : Memory accessor base class. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_BASE_H_INCLUDED +#define ARM_TRC_MEM_ACC_BASE_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include <string> + +/*! + * @class TrcMemAccessorBase + * @brief Memory range to access by trace decoder. + * + * Represents a memory access range for the trace decoder. + * Range inclusive from m_startAddress to m_endAddress. + * e.g. a 1k range from 0x1000 has start of 0x1000 and end of 0x13FF + * + * Derived classes provide specific access types such as binary files and memory buffers. + * + */ +class TrcMemAccessorBase +{ +public: + + /** Describes the storage type of the underlying memory accessor */ + enum MemAccTypes { + MEMACC_UNKNOWN, + MEMACC_FILE, //<! Binary data file accessor + MEMACC_BUFPTR, //<! memory buffer accessor + MEMACC_CB_IF, //<! callback interface accessor - use for live memory access + }; + + /** default constructor */ + TrcMemAccessorBase(MemAccTypes type); + + /** costruct with address range values */ + TrcMemAccessorBase(MemAccTypes type, ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr); + + /** default desctructor */ + virtual ~TrcMemAccessorBase() {}; + + /*! + * Set the inclusive address range of this accessor. + * + * @param startAddr : start address of the range. + * @param endAddr : end address of the range. + */ + void setRange(ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr); + + /*! + * test if an address is in the inclusive range for this accessor + * + * @param s_address : Address to test. + * + * @return const bool : true if the address is in range. + */ + virtual const bool addrInRange(const ocsd_vaddr_t s_address) const; + + + /*! + * test if an address is the start of range for this accessor + * + * @param s_address : Address to test. + * + * @return const bool : true if the address is start of range. + */ + virtual const bool addrStartOfRange(const ocsd_vaddr_t s_address) const; + + /*! + * Test number of bytes available from the start address, up to the number of requested bytes. + * Tests if all the requested bytes are available from the supplied start address. + * Returns the number available up to full requested amount. + * + * @param s_address : Start address within the range. + * @param reqBytes : Number of bytes needed from the start address. + * + * @return const uint32_t : Bytes available, up to reqBytes. 0 is s_address not in range. + */ + virtual const uint32_t bytesInRange(const ocsd_vaddr_t s_address, const uint32_t reqBytes) const; + + /*! + * test is supplied range accessor overlaps this range. + * + * @param *p_test_acc : Accessor to test for overlap. + * + * @return bool : true if overlap, false if not. + */ + virtual const bool overLapRange(const TrcMemAccessorBase *p_test_acc) const; + + /*! + * Read bytes from via the accessor from the memory range. + * + * @param s_address : Start address of the read. + * @param memSpace : memory space for this access. + * @param reqBytes : Number of bytes required. + * @param *byteBuffer : Buffer to copy the bytes into. + * + * @return uint32_t : Number of bytes read, 0 if s_address out of range, or mem space not accessible. + */ + virtual const uint32_t readBytes(const ocsd_vaddr_t s_address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer) = 0; + + /*! + * Validate the address range - ensure addresses aligned, different, st < en etc. + * + * @return bool : true if valid range. + */ + virtual const bool validateRange(); + + + const enum MemAccTypes getType() const { return m_type; }; + + /* handle memory spaces */ + void setMemSpace(ocsd_mem_space_acc_t memSpace) { m_mem_space = memSpace; }; + const ocsd_mem_space_acc_t getMemSpace() const { return m_mem_space; }; + const bool inMemSpace(const ocsd_mem_space_acc_t mem_space) const { return (bool)(((uint8_t)m_mem_space & (uint8_t)mem_space) != 0); }; + + /* memory access info logging */ + virtual void getMemAccString(std::string &accStr) const; + +protected: + ocsd_vaddr_t m_startAddress; /**< accessible range start address */ + ocsd_vaddr_t m_endAddress; /**< accessible range end address */ + const MemAccTypes m_type; /**< memory accessor type */ + ocsd_mem_space_acc_t m_mem_space; +}; + +inline TrcMemAccessorBase::TrcMemAccessorBase(MemAccTypes accType, ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr) : + m_startAddress(startAddr), + m_endAddress(endAddr), + m_type(accType), + m_mem_space(OCSD_MEM_SPACE_ANY) +{ +} + +inline TrcMemAccessorBase::TrcMemAccessorBase(MemAccTypes accType) : + m_startAddress(0), + m_endAddress(0), + m_type(accType), + m_mem_space(OCSD_MEM_SPACE_ANY) +{ +} + +inline void TrcMemAccessorBase::setRange(ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr) +{ + m_startAddress = startAddr; + m_endAddress = endAddr; +} + +inline const bool TrcMemAccessorBase::addrInRange(const ocsd_vaddr_t s_address) const +{ + return (s_address >= m_startAddress) && (s_address <= m_endAddress); +} + +inline const bool TrcMemAccessorBase::addrStartOfRange(const ocsd_vaddr_t s_address) const +{ + return (s_address == m_startAddress); +} + + +inline const uint32_t TrcMemAccessorBase::bytesInRange(const ocsd_vaddr_t s_address, const uint32_t reqBytes) const +{ + ocsd_vaddr_t bytesInRange = 0; + if(addrInRange(s_address)) // start not in range, return 0. + { + // bytes available till end address. + bytesInRange = m_endAddress - s_address + 1; + if(bytesInRange > reqBytes) + bytesInRange = reqBytes; + } + return (uint32_t)bytesInRange; +} + +inline const bool TrcMemAccessorBase::overLapRange(const TrcMemAccessorBase *p_test_acc) const +{ + if( addrInRange(p_test_acc->m_startAddress) || + addrInRange(p_test_acc->m_endAddress) + ) + return true; + return false; +} + +inline const bool TrcMemAccessorBase::validateRange() +{ + if(m_startAddress & 0x1) // at least hword aligned for thumb + return false; + if((m_endAddress + 1) & 0x1) + return false; + if(m_startAddress == m_endAddress) // zero length range. + return false; + if(m_startAddress > m_endAddress) // values bakcwards / invalid + return false; + return true; +} + + +class TrcMemAccFactory +{ +public: + /** Accessor Creation */ + static ocsd_err_t CreateBufferAccessor(TrcMemAccessorBase **pAccessor, const ocsd_vaddr_t s_address, const uint8_t *p_buffer, const uint32_t size); + static ocsd_err_t CreateFileAccessor(TrcMemAccessorBase **pAccessor, const std::string &pathToFile, ocsd_vaddr_t startAddr, size_t offset = 0, size_t size = 0); + static ocsd_err_t CreateCBAccessor(TrcMemAccessorBase **pAccessor, const ocsd_vaddr_t s_address, const ocsd_vaddr_t e_address, const ocsd_mem_space_acc_t mem_space); + + /** Accessor Destruction */ + static void DestroyAccessor(TrcMemAccessorBase *pAccessor); +private: + TrcMemAccFactory() {}; + ~TrcMemAccFactory() {}; +}; + +#endif // ARM_TRC_MEM_ACC_BASE_H_INCLUDED + +/* End of File trc_mem_acc_base.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_bufptr.h b/decoder/include/mem_acc/trc_mem_acc_bufptr.h new file mode 100644 index 000000000000..61ec345abe68 --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_bufptr.h @@ -0,0 +1,76 @@ +/* + * \file trc_mem_acc_bufptr.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_BUFPTR_H_INCLUDED +#define ARM_TRC_MEM_ACC_BUFPTR_H_INCLUDED + +#include "mem_acc/trc_mem_acc_base.h" + +/*! + * @class TrcMemAccBufPtr: + * @brief Trace memory accessor for a memory buffer. + * + * Wraps a memory buffer in an memory range accessor object. + * Takes a copy of the buffer pointer which must remain valid + * for the lifetime of the object. + * + */ +class TrcMemAccBufPtr: public TrcMemAccessorBase +{ +public: + /*! + * Construct the accessor. + * uses the start address as the start of range and calculates the end address + * according to the buffer size + * + * @param s_address : Start address in memory map represented by the data in the buffer. + * @param *p_buffer : pointer to a buffer of binary data. + * @param size : size of the buffer. + * + */ + TrcMemAccBufPtr(const ocsd_vaddr_t s_address, const uint8_t *p_buffer, const uint32_t size); + + virtual ~TrcMemAccBufPtr() {}; /**< default destructor */ + + /** Memory access override - allow decoder to read bytes from the buffer. */ + virtual const uint32_t readBytes(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer); + +private: + const uint8_t *m_p_buffer; /**< pointer to the memory buffer */ + const uint32_t m_size; /**< size of the memory buffer. */ +}; + +#endif // ARM_TRC_MEM_ACC_BUFPTR_H_INCLUDED + +/* End of File trc_mem_acc_bufptr.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_cb.h b/decoder/include/mem_acc/trc_mem_acc_cb.h new file mode 100644 index 000000000000..df6f9930e4fc --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_cb.h @@ -0,0 +1,81 @@ +/*! + * \file trc_mem_acc_cb.h + * \brief OpenCSD : Callback trace memory accessor. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_CB_H_INCLUDED +#define ARM_TRC_MEM_ACC_CB_H_INCLUDED + +#include "mem_acc/trc_mem_acc_base.h" +#include "mem_acc/trc_mem_acc_cb_if.h" + +class TrcMemAccCB : public TrcMemAccessorBase +{ +public: + TrcMemAccCB(const ocsd_vaddr_t s_address, + const ocsd_vaddr_t e_address, + const ocsd_mem_space_acc_t mem_space); + + + virtual ~TrcMemAccCB() {}; + + /** Memory access override - allow decoder to read bytes from the buffer. */ + virtual const uint32_t readBytes(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer); + + void setCBIfClass(TrcMemAccCBIF *p_if); + void setCBIfFn(Fn_MemAcc_CB p_fn, const void *p_context); + +private: + TrcMemAccCBIF *m_p_CBclass; //<! callback class. + Fn_MemAcc_CB m_p_CBfn; //<! callback function. + const void *m_p_cbfn_context; //<! context pointer for callback function. +}; + +inline void TrcMemAccCB::setCBIfClass(TrcMemAccCBIF *p_if) +{ + m_p_CBclass = p_if; + m_p_CBfn = 0; // only one callback type per accessor. + m_p_cbfn_context = 0; +} + +inline void TrcMemAccCB::setCBIfFn(Fn_MemAcc_CB p_fn, const void *p_context) +{ + m_p_CBfn = p_fn; + m_p_cbfn_context = p_context; + m_p_CBclass = 0; // only one callback type per accessor. +} + + + +#endif // ARM_TRC_MEM_ACC_CB_H_INCLUDED + +/* End of File trc_mem_acc_cb.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_cb_if.h b/decoder/include/mem_acc/trc_mem_acc_cb_if.h new file mode 100644 index 000000000000..54dc1848c45e --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_cb_if.h @@ -0,0 +1,71 @@ +/*! + * \file trc_mem_acc_cb_if.h + * \brief OpenCSD : Memory Accessor Callback Direct Interface + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_CB_IF_H_INCLUDED +#define ARM_TRC_MEM_ACC_CB_IF_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/*! + * @class TrcMemAccCBIF + * @brief Interface class to implement memory accessor callbacks + * + * Implement an object with this interface to use in a memory accessor callback type. + * Callback accesses the memory according to address and memory space. + * Use for trace decode memory access on live systems, or where the implemented accessor types + * are not suitable for the memory data being accessed. + * + */ +class TrcMemAccCBIF +{ +public: + TrcMemAccCBIF() {}; + virtual ~TrcMemAccCBIF() {}; + + /*! + * Read bytes from via the accessor from the memory range. + * + * @param s_address : Start address of the read. + * @param memSpace : memory space for this access. + * @param reqBytes : Number of bytes required. + * @param *byteBuffer : Buffer to copy the bytes into. + * + * @return uint32_t : Number of bytes read, 0 if s_address out of range, or mem space not accessible. + */ + virtual const uint32_t readBytes(const ocsd_vaddr_t s_address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer) = 0; +}; + +#endif // ARM_TRC_MEM_ACC_CB_IF_H_INCLUDED + +/* End of File trc_mem_acc_cb_if.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_file.h b/decoder/include/mem_acc/trc_mem_acc_file.h new file mode 100644 index 000000000000..7f8d5462cbf5 --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_file.h @@ -0,0 +1,234 @@ +/* + * \file trc_mem_acc_file.h + * \brief OpenCSD : Access binary target memory file + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_FILE_H_INCLUDED +#define ARM_TRC_MEM_ACC_FILE_H_INCLUDED + +#include <map> +#include <string> +#include <fstream> +#include <list> + +#include "opencsd/ocsd_if_types.h" +#include "mem_acc/trc_mem_acc_base.h" + +// an add-on region to a file - allows setting of a region at a none-zero offset for a file. +class FileRegionMemAccessor : public TrcMemAccessorBase +{ +public: + FileRegionMemAccessor() : TrcMemAccessorBase(MEMACC_FILE) {}; + virtual ~FileRegionMemAccessor() {}; + + void setOffset(const size_t offset) { m_file_offset = offset; }; + const size_t getOffset() const { return m_file_offset; }; + + bool operator<(const FileRegionMemAccessor& rhs) { return this->m_startAddress < rhs.m_startAddress; }; + + // not going to use these objects to read bytes - defer to the file class for that. + virtual const uint32_t readBytes(const ocsd_vaddr_t s_address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer) { return 0; }; + + const ocsd_vaddr_t regionStartAddress() const { return m_startAddress; }; + +private: + size_t m_file_offset; +}; + +/*! + * @class TrcMemAccessorFile + * @brief Memory accessor for a binary file. + * + * Memory accessor based on a binary file snapshot of some memory. + * + * Static creation code to allow reference counted accessor usable for + * multiple access maps attached to multiple source trees for the same system. + */ +class TrcMemAccessorFile : public TrcMemAccessorBase +{ +public: + /** read bytes override - reads from file */ + virtual const uint32_t readBytes(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t memSpace, const uint32_t reqBytes, uint8_t *byteBuffer); + +protected: + TrcMemAccessorFile(); /**< protected default constructor */ + virtual ~ TrcMemAccessorFile(); /**< protected default destructor */ + + /** increment reference counter */ + void IncRefCount() { m_ref_count++; }; + + /** decrement reference counter */ + void DecRefCount() { m_ref_count--; }; + + /** get current reference count */ + const int getRefCount() const { return m_ref_count; }; + + /*! + * Initialise accessor with file name and path, and start address. + * File opened and length calculated to determine end address for the range. + * + * @param &pathToFile : Binary file path and name + * @param startAddr : system memory address associated with start of binary datain file. + * + * @return bool : true if set up successfully, false if file could not be opened. + */ + ocsd_err_t initAccessor(const std::string &pathToFile, ocsd_vaddr_t startAddr, size_t offset, size_t size); + + /** get the file path */ + const std::string &getFilePath() const { return m_file_path; }; + + /** get an offset region if extant for the address */ + FileRegionMemAccessor *getRegionForAddress(const ocsd_vaddr_t startAddr) const; + + /* validate ranges */ + virtual const bool validateRange(); + +public: + + /*! + * File may contain multiple none-overlapping ranges in a single file. + * + * @param startAddr : Address for beginning of byte data. + * @param size : size of range in bytes. + * @param offset : offset into file for that data. + * + * @return bool : true if set successfully. + */ + bool AddOffsetRange(const ocsd_vaddr_t startAddr, const size_t size, const size_t offset); + + /*! + * Override in case we have multiple regions in the file. + * + * @param s_address : Address to test. + * + * @return const bool : true if the address is in range. + */ + virtual const bool addrInRange(const ocsd_vaddr_t s_address) const; + + /*! + * test if an address is the start of range for this accessor + * + * @param s_address : Address to test. + * + * @return const bool : true if the address is start of range. + */ + virtual const bool addrStartOfRange(const ocsd_vaddr_t s_address) const; + + /*! + * Test number of bytes available from the start address, up to the number of requested bytes. + * Tests if all the requested bytes are available from the supplied start address. + * Returns the number available up to full requested amount. + * + * @param s_address : Start address within the range. + * @param reqBytes : Number of bytes needed from the start address. + * + * @return const uint32_t : Bytes available, up to reqBytes. 0 is s_address not in range. + */ + virtual const uint32_t bytesInRange(const ocsd_vaddr_t s_address, const uint32_t reqBytes) const; + + /*! + * test is supplied range accessor overlaps this range. + * + * @param *p_test_acc : Accessor to test for overlap. + * + * @return bool : true if overlap, false if not. + */ + virtual const bool overLapRange(const TrcMemAccessorBase *p_test_acc) const; + + /*! Override to handle ranges and offset accessors plus add in file name. */ + virtual void getMemAccString(std::string &accStr) const; + + + /*! + * Create a file accessor based on the supplied path and address. + * Keeps a list of file accessors created. + * + * File will be checked to ensure valid accessor can be created. + * + * If an accessor using the supplied file is currently in use then a reference to that + * accessor will be returned and the accessor reference counter updated. + * + * @param &pathToFile : Path to binary file + * @param startAddr : Start address of data represented by file. + * + * @return TrcMemAccessorFile * : pointer to accessor if successful, 0 if it could not be created. + */ + static ocsd_err_t createFileAccessor(TrcMemAccessorFile **p_acc, const std::string &pathToFile, ocsd_vaddr_t startAddr, size_t offset = 0, size_t size = 0); + + /*! + * Destroy supplied accessor. + * + * Reference counter decremented and checked and accessor destroyed if no longer in use. + * + * @param *p_accessor : File Accessor to destroy. + */ + static void destroyFileAccessor(TrcMemAccessorFile *p_accessor); + + /*! + * Test if any accessor is currently using the supplied file path + * + * @param &pathToFile : Path to test. + * + * @return bool : true if an accessor exists with this file path. + */ + static const bool isExistingFileAccessor(const std::string &pathToFile); + + /*! + * Get the accessor using the supplied file path + * Use after createFileAccessor if additional memory ranges need + * adding to an exiting file accessor. + * + * @param &pathToFile : Path to test. + * + * @return TrcMemAccessorFile * : none 0 if an accessor exists with this file path. + */ + static TrcMemAccessorFile * getExistingFileAccessor(const std::string &pathToFile); + + + + +private: + static std::map<std::string, TrcMemAccessorFile *> s_FileAccessorMap; /**< map of file accessors in use. */ + +private: + std::ifstream m_mem_file; /**< input binary file stream */ + ocsd_vaddr_t m_file_size; /**< size of the file */ + int m_ref_count; /**< accessor reference count */ + std::string m_file_path; /**< path to input file */ + std::list<FileRegionMemAccessor *> m_access_regions; /**< additional regions in the file at non-zero offsets */ + bool m_base_range_set; /**< true when offset 0 set */ + bool m_has_access_regions; /**< true if single file contains multiple regions */ +}; + +#endif // ARM_TRC_MEM_ACC_FILE_H_INCLUDED + +/* End of File trc_mem_acc_file.h */ diff --git a/decoder/include/mem_acc/trc_mem_acc_mapper.h b/decoder/include/mem_acc/trc_mem_acc_mapper.h new file mode 100644 index 000000000000..07d044ead81c --- /dev/null +++ b/decoder/include/mem_acc/trc_mem_acc_mapper.h @@ -0,0 +1,128 @@ +/* + * \file trc_mem_acc_mapper.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_MEM_ACC_MAPPER_H_INCLUDED +#define ARM_TRC_MEM_ACC_MAPPER_H_INCLUDED + +#include <vector> + +#include "opencsd/ocsd_if_types.h" +#include "interfaces/trc_tgt_mem_access_i.h" +#include "interfaces/trc_error_log_i.h" +#include "mem_acc/trc_mem_acc_base.h" + +typedef enum _memacc_mapper_t { + MEMACC_MAP_GLOBAL, +} memacc_mapper_t; + +class TrcMemAccMapper : public ITargetMemAccess +{ +public: + TrcMemAccMapper(); + TrcMemAccMapper(bool using_trace_id); + virtual ~TrcMemAccMapper(); + +// decoder memory access interface + virtual ocsd_err_t ReadTargetMemory( const ocsd_vaddr_t address, + const uint8_t cs_trace_id, + const ocsd_mem_space_acc_t mem_space, + uint32_t *num_bytes, + uint8_t *p_buffer); + +// mapper memory area configuration interface + + // add an accessor to this map + virtual ocsd_err_t AddAccessor(TrcMemAccessorBase *p_accessor, const uint8_t cs_trace_id) = 0; + + // remove a specific accessor + virtual ocsd_err_t RemoveAccessor(const TrcMemAccessorBase *p_accessor) = 0; + + + // clear all attached accessors from the map + void RemoveAllAccessors(); + + // remove a single accessor based on address. + ocsd_err_t RemoveAccessorByAddress(const ocsd_vaddr_t st_address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id = 0); + + // set the error log. + void setErrorLog(ITraceErrorLog *err_log_i) { m_err_log = err_log_i; }; + + // print out the ranges in this mapper. + virtual void logMappedRanges() = 0; + +protected: + virtual bool findAccessor(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id) = 0; // set m_acc_curr if found valid range, leave unchanged if not. + virtual bool readFromCurrent(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id) = 0; + virtual TrcMemAccessorBase *getFirstAccessor() = 0; + virtual TrcMemAccessorBase *getNextAccessor() = 0; + virtual void clearAccessorList() = 0; + + void LogMessage(const std::string &msg); + + TrcMemAccessorBase *m_acc_curr; // most recently used - try this first. + uint8_t m_trace_id_curr; // trace ID for the current accessor + const bool m_using_trace_id; // true if we are using separate memory spaces by TraceID. + ITraceErrorLog *m_err_log; // error log to print out mappings on request. +}; + + +// address spaces common to all sources using this mapper. +// trace id unused. +class TrcMemAccMapGlobalSpace : public TrcMemAccMapper +{ +public: + TrcMemAccMapGlobalSpace(); + virtual ~TrcMemAccMapGlobalSpace(); + + // mapper creation interface - prevent overlaps + virtual ocsd_err_t AddAccessor(TrcMemAccessorBase *p_accessor, const uint8_t cs_trace_id); + + // print out the ranges in this mapper. + virtual void logMappedRanges(); + +protected: + virtual bool findAccessor(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id); + virtual bool readFromCurrent(const ocsd_vaddr_t address,const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id); + virtual TrcMemAccessorBase *getFirstAccessor(); + virtual TrcMemAccessorBase *getNextAccessor(); + virtual void clearAccessorList(); + virtual ocsd_err_t RemoveAccessor(const TrcMemAccessorBase *p_accessor); + + std::vector<TrcMemAccessorBase *> m_acc_global; + std::vector<TrcMemAccessorBase *>::iterator m_acc_it; +}; + +#endif // ARM_TRC_MEM_ACC_MAPPER_H_INCLUDED + +/* End of File trc_mem_acc_mapper.h */ diff --git a/decoder/include/ocsd_if_version.h b/decoder/include/ocsd_if_version.h new file mode 100644 index 000000000000..7d51ba27bdf2 --- /dev/null +++ b/decoder/include/ocsd_if_version.h @@ -0,0 +1,65 @@ +/* + * \file ocsd_if_version.h + * \brief OpenCSD : Library API versioning + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_IF_VERSION_H_INCLUDED +#define ARM_OCSD_IF_VERSION_H_INCLUDED + +#include <stdint.h> + +/** @addtogroup ocsd_interfaces +@{*/ + +/** @name Library Versioning +@{*/ +#define OCSD_VER_MAJOR 0x0 /**< Library Major Version */ +#define OCSD_VER_MINOR 0x8 /**< Library Minor Version */ +#define OCSD_VER_PATCH 0x2 /**< Library Patch Version */ + +/** Library version number - MMMMnnpp format. + MMMM = major version, + nn = minor version, + pp = patch version +*/ +#define OCSD_VER_NUM (((uint32_t)OCSD_VER_MAJOR << 16) | ((uint32_t)OCSD_VER_MINOR << 8) | ((uint32_t)OCSD_VER_PATCH)) + +#define OCSD_VER_STRING "0.8.2" /**< Library Version string */ +#define OCSD_LIB_NAME "OpenCSD Library" /**< Library name string */ +#define OCSD_LIB_SHORT_NAME "OCSD" /**< Library Short name string */ +/** @}*/ + +/** @}*/ + +#endif // ARM_OCSD_IF_VERSION_H_INCLUDED + +/* End of File ocsd_if_version.h */ diff --git a/decoder/include/opencsd.h b/decoder/include/opencsd.h new file mode 100644 index 000000000000..615bbcafa2d9 --- /dev/null +++ b/decoder/include/opencsd.h @@ -0,0 +1,84 @@ +/*! + * \file opencsd.h + * \brief OpenCSD: Open CoreSight Trace Decoder -Master include file for C++ library + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OPENCSD_H_INCLUDED +#define ARM_OPENCSD_H_INCLUDED + +/** C interface types */ +#include "opencsd/ocsd_if_types.h" +#include "opencsd/trc_pkt_types.h" +#include "opencsd/trc_gen_elem_types.h" + +/* C++ abstract interfaces */ +#include "interfaces/trc_data_raw_in_i.h" +#include "interfaces/trc_data_rawframe_in_i.h" +#include "interfaces/trc_error_log_i.h" +#include "interfaces/trc_gen_elem_in_i.h" +#include "interfaces/trc_instr_decode_i.h" +#include "interfaces/trc_pkt_in_i.h" +#include "interfaces/trc_pkt_raw_in_i.h" +#include "interfaces/trc_tgt_mem_access_i.h" + +/* protocol base classes and generic elements */ +#include "common/ocsd_version.h" +#include "common/ocsd_error.h" +#include "common/trc_gen_elem.h" +#include "common/trc_core_arch_map.h" + +/** Implemented Protocol decoders */ +#include "common/trc_frame_deformatter.h" + +#include "opencsd/etmv3/etmv3_decoder.h" +#include "opencsd/etmv4/etmv4_decoder.h" +#include "opencsd/ptm/ptm_decoder.h" +#include "opencsd/stm/stm_decoder.h" + +/** C++ library object types */ +#include "common/ocsd_error_logger.h" +#include "common/ocsd_msg_logger.h" +#include "i_dec/trc_i_decode.h" +#include "mem_acc/trc_mem_acc.h" + +/* printers for builtin packet elements */ +#include "pkt_printers/trc_pkt_printers.h" +#include "pkt_printers/trc_print_fact.h" + +/** The decode tree and decoder register*/ +#include "common/ocsd_lib_dcd_register.h" +#include "common/ocsd_dcd_tree.h" + + +#endif // ARM_OPENCSD_H_INCLUDED + +/* End of File opencsd.h */ diff --git a/decoder/include/opencsd/c_api/ocsd_c_api_cust_fact.h b/decoder/include/opencsd/c_api/ocsd_c_api_cust_fact.h new file mode 100644 index 000000000000..f9e6a95104cc --- /dev/null +++ b/decoder/include/opencsd/c_api/ocsd_c_api_cust_fact.h @@ -0,0 +1,54 @@ +/* +* \file ocsd_c_api_cust_fact.h +* \brief OpenCSD : Custom decoder factory API functions +* +* \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. +*/ + +/* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* 3. Neither the name of the copyright holder nor the names of its contributors +* may be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef ARM_OCSD_C_API_CUST_FACT_H_INCLUDED +#define ARM_OCSD_C_API_CUST_FACT_H_INCLUDED + +#include "ocsd_c_api_types.h" +#include "ocsd_c_api_custom.h" + +/* Declarations for the functions implemented in the custom decoder factory. */ + +/** Required function to create a decoder instance - fills in the decoder struct supplied. */ +ocsd_err_t CreateCustomDecoder(const int create_flags, const void *decoder_cfg, ocsd_extern_dcd_inst_t *p_decoder_inst); + +/** Required Function to destroy a decoder instance - indicated by decoder handle */ +ocsd_err_t DestroyCustomDecoder(const void *decoder_handle); + +/** Required Function to extract the CoreSight Trace ID from the configuration structure */ +ocsd_err_t GetCSIDFromConfig(const void *decoder_cfg, unsigned char *p_csid); + +/** Optional Function to convert a protocol specific trace packet to human readable string */ +ocsd_err_t PacketToString(const void *trc_pkt, char *buffer, const int buflen); + +#endif /* ARM_OCSD_C_API_CUST_FACT_H_INCLUDED */ diff --git a/decoder/include/opencsd/c_api/ocsd_c_api_cust_impl.h b/decoder/include/opencsd/c_api/ocsd_c_api_cust_impl.h new file mode 100644 index 000000000000..245ce162752e --- /dev/null +++ b/decoder/include/opencsd/c_api/ocsd_c_api_cust_impl.h @@ -0,0 +1,158 @@ +/* +* \file ocsd_c_api_cust_impl.h +* \brief OpenCSD : Custom decoder implementation common API definitions +* +* \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. +*/ + +/* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* 3. Neither the name of the copyright holder nor the names of its contributors +* may be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef ARM_OCSD_C_API_CUST_IMPL_H_INCLUDED +#define ARM_OCSD_C_API_CUST_IMPL_H_INCLUDED + +#include "opencsd/c_api/ocsd_c_api_types.h" +#include "opencsd/c_api/ocsd_c_api_custom.h" + +/** @addtogroup ocsd_ext_dcd +@{*/ + +/**@name External decoder - Inline utility functions. + @brief inline functions used in decoders to call the various library callback functionality. + + Functions manipulate and use the ocsd_extern_dcd_cb_fns structure to call into the library, + with appropriate checking for initialisation and usage flags. + +@{*/ + +static inline ocsd_datapath_resp_t lib_cb_GenElemOp(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_trc_index_t index_sop, + const uint8_t trc_chan_id, + const ocsd_generic_trace_elem *elem) +{ + if (callbacks->fn_gen_elem_out) + return callbacks->fn_gen_elem_out(callbacks->lib_context, index_sop, trc_chan_id, elem); + return OCSD_RESP_FATAL_NOT_INIT; +} + +static inline ocsd_err_t lib_cb_LogError(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_err_severity_t filter_level, + const ocsd_err_t code, + const ocsd_trc_index_t idx, + const uint8_t chan_id, + const char *pMsg) +{ + if (callbacks->fn_log_error) + { + callbacks->fn_log_error(callbacks->lib_context, filter_level, code, idx, chan_id, pMsg); + return OCSD_OK; + } + return OCSD_ERR_NOT_INIT; +} + +static inline ocsd_err_t lib_cb_LogMsg(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_err_severity_t filter_level, + const char *pMsg) +{ + if (callbacks->fn_log_msg) + { + callbacks->fn_log_msg(callbacks->lib_context, filter_level, pMsg); + return OCSD_OK; + } + return OCSD_ERR_NOT_INIT; +} + +static inline ocsd_err_t lib_cb_DecodeArmInst(const ocsd_extern_dcd_cb_fns *callbacks, + ocsd_instr_info *instr_info) +{ + if (callbacks->fn_arm_instruction_decode) + return callbacks->fn_arm_instruction_decode(callbacks->lib_context, instr_info); + return OCSD_ERR_NOT_INIT; +} + +static inline ocsd_err_t lib_cb_MemAccess(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_vaddr_t address, + const uint8_t cs_trace_id, + const ocsd_mem_space_acc_t mem_space, + uint32_t *num_bytes, + uint8_t *p_buffer) +{ + if (callbacks->fn_memory_access) + return callbacks->fn_memory_access(callbacks->lib_context, address, cs_trace_id, mem_space, num_bytes, p_buffer); + return OCSD_ERR_NOT_INIT; +} + +static inline void lib_cb_PktMon(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *pkt, + const uint32_t size, + const uint8_t *p_data) +{ + if (callbacks->packetCBFlags & OCSD_CUST_DCD_PKT_CB_USE_MON) + { + if (callbacks->fn_packet_mon) + callbacks->fn_packet_mon(callbacks->lib_context, op, index_sop, pkt, size, p_data); + } +} + +static inline int lib_cb_usePktMon(const ocsd_extern_dcd_cb_fns *callbacks) +{ + return (callbacks->packetCBFlags & OCSD_CUST_DCD_PKT_CB_USE_MON); +} + +/* callback function to connect to the packet sink interface, on the main decode +data path - used if decoder created as packet processor only */ +static inline ocsd_datapath_resp_t lib_cb_PktDataSink(const ocsd_extern_dcd_cb_fns *callbacks, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *pkt) +{ + if (callbacks->packetCBFlags & OCSD_CUST_DCD_PKT_CB_USE_SINK) + { + if (callbacks->fn_packet_data_sink) + return callbacks->fn_packet_data_sink(callbacks->lib_context, op, index_sop, pkt); + else + return OCSD_RESP_FATAL_NOT_INIT; + } + return OCSD_RESP_CONT; +} + +static inline int lib_cb_usePktSink(const ocsd_extern_dcd_cb_fns *callbacks) +{ + return (callbacks->packetCBFlags & OCSD_CUST_DCD_PKT_CB_USE_SINK); +} + +static inline void lib_cb_updatePktCBFlags(ocsd_extern_dcd_cb_fns *callbacks, const int newFlags) +{ + callbacks->packetCBFlags = newFlags; +} + +/** @}*/ + +/** @}*/ + +#endif /* ARM_OCSD_C_API_CUST_IMPL_H_INCLUDED */ diff --git a/decoder/include/opencsd/c_api/ocsd_c_api_custom.h b/decoder/include/opencsd/c_api/ocsd_c_api_custom.h new file mode 100644 index 000000000000..ada0a68cb3db --- /dev/null +++ b/decoder/include/opencsd/c_api/ocsd_c_api_custom.h @@ -0,0 +1,253 @@ +/* + * \file ocsd_c_api_custom.h + * \brief OpenCSD : Custom decoder interface types and structures + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_OCSD_C_API_CUSTOM_H_INCLUDED +#define ARM_OCSD_C_API_CUSTOM_H_INCLUDED + +#include "ocsd_c_api_types.h" + + + /** @defgroup ocsd_ext_dcd OpenCSD Library : Custom External Decoder C-API + @brief Set of types, structures and interfaces for attaching custom decoders via the C-API + + These types, functions and structures define the required API between a custom external decoder + and the library, which will allow the decoder to interact with the library and use library + resources in the same way as the built-in decoders. + + The external decoder must implement:- + - A set of factory functions that allow the creation and destruction of decoder instances. + - A set of call-in and call-back functions plus data structures allowing interaction with the library. + + @{*/ + + +/**@name External decoder - Input Interfaces +@{*/ + +/* Custom decoder C-API interface types. */ + +/** Raw trace data input function - a decoder must have one of these + Implements ITrcDataIn with the addition of a decoder handle to provide context in the decoder. + */ +typedef ocsd_datapath_resp_t (* fnTraceDataIn)( const void *decoder_handle, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed); + +/** Function to update the in-use flags for the packet sinks + + Defines if the fnPktMonCB or fnPktDataSinkCB callbacks are in use by the library. + If so then it is expected that the decoder should call them when trace protocol packets are generated. + + This function must be implemented in the decoder. + + @param decoder_handle : handle for decoder accessed by this call. + @param flags: Values indicating interfaces in use / not in use. [ OCSD_CUST_DCD_PKT_CB_USE_MON or OCSD_CUST_DCD_PKT_CB_USE_SINK] +*/ +typedef void (* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags); + + + +/** Flag to indicate the the packet monitor (fnPktMonCB) is in use in the library */ +#define OCSD_CUST_DCD_PKT_CB_USE_MON 0x1 + +/** Flag to indicate the the packet sink (fnPktDataSinkCB) is in use in the library - only if trace packet processing only mode. */ +#define OCSD_CUST_DCD_PKT_CB_USE_SINK 0x2 + +/** Owned by the library instance object, this structure is filled in by the ocsd_extern_dcd_fact_t createDecoder() function. */ +typedef struct _ocsd_extern_dcd_inst { + /* Mandatory decoder call back functions - library initialisation will fail without these. */ + fnTraceDataIn fn_data_in; /**< raw trace data input function to decoder */ + fnUpdatePktMonFlags fn_update_pkt_mon; /**< update the packet monitor / sink usage flags */ + + /* Decoder instance data */ + void *decoder_handle; /**< Instance handle for the decoder - used by library to call the decoder call in functions */ + char *p_decoder_name; /**< type name of the decoder - may be used in logging */ + uint8_t cs_id; /**< Coresight ID for the instance - extracted from the config on creation. */ + +} ocsd_extern_dcd_inst_t; + +/** @}*/ + + +/**@name External decoder - Callback Interfaces +@{*/ + + +/** callback function to connect into the generic element output point + Implements ITrcGenElemIn::TraceElemIn with addition of library context pointer. + */ +typedef ocsd_datapath_resp_t (* fnGenElemOpCB)( const void *lib_context, + const ocsd_trc_index_t index_sop, + const uint8_t trc_chan_id, + const ocsd_generic_trace_elem *elem); + +/** callback functions to connect into the library error logging mechanism + Implements ITraceErrorLog::LogError with addition of library context pointer. +*/ +typedef void (* fnLogErrorCB)( const void *lib_context, + const ocsd_err_severity_t filter_level, + const ocsd_err_t code, + const ocsd_trc_index_t idx, + const uint8_t chan_id, + const char *pMsg); + +/** callback functions to connect into the library error logging mechanism + Implements ITraceErrorLog::LogMessage with addition of library context pointer. +*/ +typedef void (* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg); + +/** callback function to connect an ARM instruction decoder + Implements IInstrDecode::DecodeInstruction with addition of library context pointer. +*/ +typedef ocsd_err_t (* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info); + +/** callback function to connect the memory accessor interface + Implements ITargetMemAccess::ReadTargetMemory with addition of library context pointer. +*/ +typedef ocsd_err_t (* fnMemAccessCB)(const void *lib_context, + const ocsd_vaddr_t address, + const uint8_t cs_trace_id, + const ocsd_mem_space_acc_t mem_space, + uint32_t *num_bytes, + uint8_t *p_buffer); + +/** callback function to connect to the packet monitor interface of the packet processor + Implements IPktRawDataMon::RawPacketDataMon <void> with addition of library context pointer. +*/ +typedef void (* fnPktMonCB)( const void *lib_context, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *pkt, + const uint32_t size, + const uint8_t *p_data); + +/** callback function to connect to the packet sink interface, on the main decode + data path - use if decoder created as packet processor only + + Implements IPktDataIn::PacketDataIn <void> with addition of library context pointer. +*/ +typedef ocsd_datapath_resp_t (* fnPktDataSinkCB)( const void *lib_context, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *pkt); + +/** an instance of this is owned by the decoder, filled in by the library - allows the CB fns in the library decode tree to be called. */ +typedef struct _ocsd_extern_dcd_cb_fns { +/* Callback functions */ + fnGenElemOpCB fn_gen_elem_out; /**< Callback to output a generic element. */ + fnLogErrorCB fn_log_error; /**< Callback to output an error. */ + fnLogMsgCB fn_log_msg; /**< Callback to output a message. */ + fnDecodeArmInstCB fn_arm_instruction_decode; /**< Callback to decode an ARM instruction. */ + fnMemAccessCB fn_memory_access; /**< Callback to access memory images related to the trace capture. */ + fnPktMonCB fn_packet_mon; /**< Callback to output trace packet to packet monitor. */ + fnPktDataSinkCB fn_packet_data_sink; /**< Callback to output trace packet to packet sink - if in pack processing only mode. */ +/* CB in use flags. */ + int packetCBFlags; /**< Flags to indicate if the packet sink / packet monitor callbacks are in use. ( OCSD_CUST_DCD_PKT_CB_USE_MON / OCSD_CUST_DCD_PKT_CB_USE_SINK) */ +/* library context */ + const void *lib_context; /**< library context pointer - use in callbacks to allow the library to load the correct context data. */ +} ocsd_extern_dcd_cb_fns; + +/** @}*/ + +/**@name External decoder - Decoder Factory +@{*/ + +/** Function to create a decoder instance + + Create a decoder instance according to the create_flags parameter and the supplied decoder_cfg structure. + Fill in the p_decoder_inst structure, copy the p_lib_callbacks information for use in the decoder instance. + + Create flags can be: + - OCSD_CREATE_FLG_PACKET_PROC: decoder will split the incoming trace into trace protocol packets and not further decode them. fnPktDataSinkCB likely to be in use. + - OCSD_CREATE_FLG_FULL_DECODER: decoder will split the incoming trace into trace protocol packets and further decode them to recreate program flow or other generic trace output. + + @param create_flags : Sets the decoder operating mode. + @param *decoder_cfg : Hardware specific configuration for this trace element. + @param *p_lib_callbacks : Library callbacks plus context pointer. + @param *p_decoder_inst : Structure representing the new decoder instance being created. Filled in by create function to contain handle and call-in functions for the library. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful +*/ +typedef ocsd_err_t (* fnCreateCustomDecoder)(const int create_flags, const void *decoder_cfg, const ocsd_extern_dcd_cb_fns *p_lib_callbacks, ocsd_extern_dcd_inst_t *p_decoder_inst); + +/** Function to destroy a decoder instance indicated by decoder handle. + + @param decoder_handle : Instance handle for decoder. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful +*/ +typedef ocsd_err_t (* fnDestroyCustomDecoder)(const void *decoder_handle); + +/** Function to extract the CoreSight Trace ID from the configuration structure. + + @param *decoder_cfg : Hardware specific configuration for this trace element. + @parma *p_csid : location to write CoreSight Trace ID value. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful +*/ +typedef ocsd_err_t (* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid); + +/** Function to convert a protocol specific trace packet to human readable string + + @param *trc_pkt : protocol specific packet structure. + @param *buffer : buffer to fill with string. + @param buflen : length of string buffer. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful +*/ +typedef ocsd_err_t (* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen); + +/** set of functions and callbacks to create an extern custom decoder in the library + via the C API interface. This structure is registered with the library by name and + then decoders of the type can be created on the decode tree. +*/ +typedef struct _ocsd_extern_dcd_fact { + fnCreateCustomDecoder createDecoder; /**< Function pointer to create a decoder instance. */ + fnDestroyCustomDecoder destroyDecoder; /**< Function pointer to destroy a decoder instance. */ + fnGetCSIDFromConfig csidFromConfig; /**< Function pointer to extract the CSID from a config structure */ + fnPacketToString pktToString; /**< Function pointer to print a trace protocol packet in this decoder */ + + ocsd_trace_protocol_t protocol_id; /**< protocol ID assigned during registration. */ +} ocsd_extern_dcd_fact_t; + +/** @}*/ + +/** @}*/ + + +#endif // ARM_OCSD_C_API_CUSTOM_H_INCLUDED + +/* End of File ocsd_c_api_custom.h */ diff --git a/decoder/include/opencsd/c_api/ocsd_c_api_types.h b/decoder/include/opencsd/c_api/ocsd_c_api_types.h new file mode 100644 index 000000000000..ca61e0aaed32 --- /dev/null +++ b/decoder/include/opencsd/c_api/ocsd_c_api_types.h @@ -0,0 +1,105 @@ +/*! + * \file ocsd_c_api_types.h + * \brief OpenCSD : Trace Decoder "C" API types. + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OCSD_C_API_TYPES_H_INCLUDED +#define ARM_OCSD_C_API_TYPES_H_INCLUDED + +/* select the library types that are C compatible - the interface data types */ +#include "opencsd/ocsd_if_types.h" +#include "opencsd/trc_gen_elem_types.h" +#include "opencsd/trc_pkt_types.h" + +/* pull in the protocol decoder types. */ +#include "opencsd/etmv3/trc_pkt_types_etmv3.h" +#include "opencsd/etmv4/trc_pkt_types_etmv4.h" +#include "opencsd/ptm/trc_pkt_types_ptm.h" +#include "opencsd/stm/trc_pkt_types_stm.h" + +/** @ingroup lib_c_api +@{*/ + + +/* Specific C-API only types */ + +/** Handle to decode tree */ +typedef void * dcd_tree_handle_t; + +/** define invalid handle value for decode tree handle */ +#define C_API_INVALID_TREE_HANDLE (dcd_tree_handle_t)0 + +/** Logger output printer - no output. */ +#define C_API_MSGLOGOUT_FLG_NONE 0x0 +/** Logger output printer - output to file. */ +#define C_API_MSGLOGOUT_FLG_FILE 0x1 +/** Logger output printer - output to stderr. */ +#define C_API_MSGLOGOUT_FLG_STDERR 0x2 +/** Logger output printer - output to stdout. */ +#define C_API_MSGLOGOUT_FLG_STDOUT 0x4 +/** Logger output printer - mask of valid flags. */ +#define C_API_MSGLOGOUT_MASK 0x7 + +/** function pointer type for decoder outputs. all protocols, generic data element input */ +typedef ocsd_datapath_resp_t (* FnTraceElemIn)( const void *p_context, + const ocsd_trc_index_t index_sop, + const uint8_t trc_chan_id, + const ocsd_generic_trace_elem *elem); + +/** function pointer type for packet processor packet output sink, packet analyser/decoder input - generic declaration */ +typedef ocsd_datapath_resp_t (* FnDefPktDataIn)(const void *p_context, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *p_packet_in); + +/** function pointer type for packet processor packet monitor sink, raw packet monitor / display input - generic declaration */ +typedef void (* FnDefPktDataMon)(const void *p_context, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const void *p_packet_in, + const uint32_t size, + const uint8_t *p_data); + +/** function pointer tyee for library default logger output to allow client to print zero terminated output string */ +typedef void (* FnDefLoggerPrintStrCB)(const void *p_context, const char *psz_msg_str, const int str_len); + +/** Callback interface type when attaching monitor/sink to packet processor */ +typedef enum _ocsd_c_api_cb_types { + OCSD_C_API_CB_PKT_SINK, /** Attach to the packet processor primary packet output (CB fn is FnDefPktDataIn) */ + OCSD_C_API_CB_PKT_MON, /** Attach to the packet processor packet monitor output (CB fn is FnDefPktDataMon) */ +} ocsd_c_api_cb_types; + +/** @}*/ + +#endif // ARM_OCSD_C_API_TYPES_H_INCLUDED + +/* End of File ocsd_c_api_types.h */ diff --git a/decoder/include/opencsd/c_api/opencsd_c_api.h b/decoder/include/opencsd/c_api/opencsd_c_api.h new file mode 100644 index 000000000000..f9f4ed4b8613 --- /dev/null +++ b/decoder/include/opencsd/c_api/opencsd_c_api.h @@ -0,0 +1,485 @@ +/*! + * \file opencsd_c_api.h + * \brief OpenCSD : "C" API + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_OPENCSD_C_API_H_INCLUDED +#define ARM_OPENCSD_C_API_H_INCLUDED + +/** @defgroup lib_c_api OpenCSD Library : Library "C" API. + @brief "C" API for the OpenCSD Library + + Set of "C" wrapper functions for the OpenCSD library. + + Defines API, functions and callback types. +@{*/ + +/* ensure C bindings */ + +#if defined(WIN32) /* windows bindings */ + /** Building the C-API DLL **/ + #ifdef _OCSD_C_API_DLL_EXPORT + #ifdef __cplusplus + #define OCSD_C_API extern "C" __declspec(dllexport) + #else + #define OCSD_C_API __declspec(dllexport) + #endif + #else + /** building or using the static C-API library **/ + #if defined(_LIB) || defined(OCSD_USE_STATIC_C_API) + #ifdef __cplusplus + #define OCSD_C_API extern "C" + #else + #define OCSD_C_API + #endif + #else + /** using the C-API DLL **/ + #ifdef __cplusplus + #define OCSD_C_API extern "C" __declspec(dllimport) + #else + #define OCSD_C_API __declspec(dllimport) + #endif + #endif + #endif +#else /* linux bindings */ + #ifdef __cplusplus + #define OCSD_C_API extern "C" + #else + #define OCSD_C_API + #endif +#endif + +#include "ocsd_c_api_types.h" +#include "ocsd_c_api_custom.h" + +/** @name Library Version API + +@{*/ +/** Get Library version. Return a 32 bit version in form MMMMnnpp - MMMM = major verison, nn = minor version, pp = patch version */ +OCSD_C_API uint32_t ocsd_get_version(void); + +/** Get library version string */ +OCSD_C_API const char * ocsd_get_version_str(void); +/** @}*/ + +/*---------------------- Trace Decode Tree ----------------------------------------------------------------------------------*/ + +/** @name Library Decode Tree API +@{*/ + +/*! + * Create a decode tree. + * + * @param src_type : Type of tree - formatted input, or single source input + * @param deformatterCfgFlags : Formatter flags - determine presence of frame syncs etc. + * + * @return dcd_tree_handle_t : Handle to the decode tree. Handle value set to 0 if creation failed. + */ +OCSD_C_API dcd_tree_handle_t ocsd_create_dcd_tree(const ocsd_dcd_tree_src_t src_type, const uint32_t deformatterCfgFlags); + +/*! + * Destroy a decode tree. + * + * Also destroys all the associated processors and decoders for the tree. + * + * @param handle : Handle for decode tree to destroy. + */ +OCSD_C_API void ocsd_destroy_dcd_tree(const dcd_tree_handle_t handle); + +/*! + * Input trace data into the decoder. + * + * Large trace source buffers can be broken down into smaller fragments. + * + * @param handle : Handle to decode tree. + * @param op : Datapath operation. + * @param index : Trace buffer byte index for the start of the supplied data block. + * @param dataBlockSize : Size of data block. + * @param *pDataBlock : Pointer to data block. + * @param *numBytesProcessed : Number of bytes actually processed by the decoder. + * + * @return ocsd_datapath_resp_t : Datapath response code (CONT/WAIT/FATAL) + */ +OCSD_C_API ocsd_datapath_resp_t ocsd_dt_process_data(const dcd_tree_handle_t handle, + const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed); + + +/*---------------------- Generic Trace Element Output --------------------------------------------------------------*/ + +/*! + * Set the trace element output callback function. + * + * This function will be called for each decoded generic trace element generated by + * any full trace decoder in the decode tree. + * + * A single function is used for all trace source IDs in the decode tree. + * + * @param handle : Handle to decode tree. + * @param pFn : Pointer to the callback function. + * @param p_context : opaque context pointer value used in callback function. + * + * @return ocsd_err_t : Library error code - OCSD_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_set_gen_elem_outfn(const dcd_tree_handle_t handle, FnTraceElemIn pFn, const void *p_context); + +/*---------------------- Trace Decoders ----------------------------------------------------------------------------------*/ +/*! +* Creates a decoder that is registered with the library under the supplied name. +* Flags determine if a full packet processor / packet decoder pair or +* packet processor only is created. +* Uses the supplied configuration structure. +* +* @param handle : Handle to decode tree. +* @param *decoder_name : Registered name of the decoder to create. +* @param create_flags : Decoder creation options. +* @param *decoder_cfg : Pointer to a valid configuration structure for the named decoder. +* @param *pCSID : Pointer to location to return the configured CoreSight trace ID for the decoder. +* +* @return ocsd_err_t : Library error code - OCSD_OK if successful. +*/ +OCSD_C_API ocsd_err_t ocsd_dt_create_decoder(const dcd_tree_handle_t handle, + const char *decoder_name, + const int create_flags, + const void *decoder_cfg, + unsigned char *pCSID + ); + +/*! +* Remove a decoder from the tree and destroy it. +* +* @param handle : Handle to decode tree. +* @param CSID : Configured CoreSight trace ID for the decoder. +* +* @return ocsd_err_t : Library error code - OCSD_OK if successful. +*/ +OCSD_C_API ocsd_err_t ocsd_dt_remove_decoder( const dcd_tree_handle_t handle, + const unsigned char CSID); + + +/*! +* Attach a callback function to the packet processor. +* +* The callback_type defines the attachment point, either the main packet output +* (only if no decoder attached), or the packet monitor. +* +* @param handle : Handle to decode tree. +* @param CSID : Configured CoreSight trace ID for the decoder. +* @param callback_type : Attachment point +* @param p_fn_pkt_data_in : Pointer to the callback function. +* @param p_context : Opaque context pointer value used in callback function. +* +* @return ocsd_err_t : Library error code - OCSD_OK if successful. +*/ +OCSD_C_API ocsd_err_t ocsd_dt_attach_packet_callback( const dcd_tree_handle_t handle, + const unsigned char CSID, + const ocsd_c_api_cb_types callback_type, + void *p_fn_callback_data, + const void *p_context); + + + + + + +/** @}*/ +/*---------------------- Memory Access for traced opcodes ----------------------------------------------------------------------------------*/ +/** @name Library Memory Accessor configuration on decode tree. + @brief Configure the memory regions available for decode. + + Full decode requires memory regions set up to allow access to the traced + opcodes. Add memory buffers or binary file regions to a map of regions. + +@{*/ + +/*! + * Add a binary file based memory range accessor to the decode tree. + * + * Adds the entire binary file as a memory space to be accessed + * + * @param handle : Handle to decode tree. + * @param address : Start address of memory area. + * @param mem_space : Associated memory space. + * @param *filepath : Path to binary data file. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const char *filepath); + +/*! + * Add a binary file based memory range accessor to the decode tree. + * + * Add a binary file that contains multiple regions of memory with differing + * offsets wihtin the file. + * + * A linked list of file_mem_region_t structures is supplied. Each structure contains an + * offset into the binary file, the start address for this offset and the size of the region. + * + * @param handle : Handle to decode tree. + * @param region_list : Array of memory regions in the file. + * @param num_regions : Size of region array + * @param mem_space : Associated memory space. + * @param *filepath : Path to binary data file. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath); + +/*! + * Add a memory buffer based memory range accessor to the decode tree. + * + * @param handle : Handle to decode tree. + * @param address : Start address of memory area. + * @param mem_space : Associated memory space. + * @param *p_mem_buffer : pointer to memory buffer. + * @param mem_length : Size of memory buffer. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_add_buffer_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length); + + +/*! + * Add a memory access callback function. The decoder will call the function for opcode addresses in the + * address range supplied for the memory spaces covered. + * + * @param handle : Handle to decode tree. + * @param st_address : Start address of memory area covered by the callback. + * @param en_address : End address of the memory area covered by the callback. (inclusive) + * @param mem_space : Memory space(s) covered by the callback. + * @param p_cb_func : Callback function + * @param p_context : opaque context pointer value used in callback function. + * + * @return OCSD_C_API ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_add_callback_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context); + +/*! + * Remove a memory accessor by address and memory space. + * + * @param handle : Handle to decode tree. + * @param st_address : Start address of memory accessor. + * @param mem_space : Memory space(s) covered by the accessor. + * + * @return OCSD_C_API ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_remove_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_mem_space_acc_t mem_space); + +/* + * Print the mapped memory accessor ranges to the configured logger. + * + * @param handle : Handle to decode tree. + */ +OCSD_C_API void ocsd_tl_log_mapped_mem_ranges(const dcd_tree_handle_t handle); + +/** @}*/ + +/** @name Library Default Error Log Object API + @brief Configure the default error logging object in the library. + + Objects created by the decode trees will use this error logger. Configure for + desired error severity, and to enable print or logfile output. + +@{*/ + +/*---------------------- Library Logging and debug ----------------------------------------------------------------------------------*/ +/*! + * Initialise the library error logger. + * + * Choose severity of errors logger, and if the errors will be logged to screen and / or logfile. + * + * @param verbosity : Severity of errors that will be logged. + * @param create_output_logger : Set to none-zero to create an output printer. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_def_errlog_init(const ocsd_err_severity_t verbosity, const int create_output_logger); + +/*! + * Configure the output logger. Choose STDOUT, STDERR and/or log to file. + * Optionally provide a log file name. + * + * @param output_flags : OR combination of required C_API_MSGLOGOUT_FLG_* flags. + * @param *log_file_name : optional filename if logging to file. Set to NULL if not needed. + * + * @return OCSD_C_API ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_def_errlog_config_output(const int output_flags, const char *log_file_name); + +/*! + * Configure the library default error logger to send all strings it is outputting back to the client + * to allow printing within the client application. This is in additional to any other log destinations + * set in ocsd_def_errlog_init(). + * + * @param *p_context : opaque context pointer + * @param p_str_print_cb : client callback function to "print" logstring. + */ +OCSD_C_API ocsd_err_t ocsd_def_errlog_set_strprint_cb(const dcd_tree_handle_t handle, void *p_context, FnDefLoggerPrintStrCB p_str_print_cb); + +/*! + * Print a message via the library output printer - if enabled. + * + * @param *msg : Message to output. + * + */ +OCSD_C_API void ocsd_def_errlog_msgout(const char *msg); + + +/** @}*/ + +/** @name Packet to string interface + +@{*/ + +/*! + * Take a packet structure and render a string representation of the packet data. + * + * Returns a '0' terminated string of (buffer_size - 1) length or less. + * + * @param pkt_protocol : Packet protocol type - used to interpret the packet pointer + * @param *p_pkt : pointer to a valid packet structure of protocol type. cast to void *. + * @param *buffer : character buffer for string. + * @param buffer_size : size of character buffer. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_pkt_str(const ocsd_trace_protocol_t pkt_protocol, const void *p_pkt, char *buffer, const int buffer_size); + +/*! + * Get a string representation of the generic trace element. + * + * @param *p_pkt : pointer to valid generic element structure. + * @param *buffer : character buffer for string. + * @param buffer_size : size of character buffer. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_gen_elem_str(const ocsd_generic_trace_elem *p_pkt, char *buffer, const int buffer_size); + + +/*! + * Init a generic element with type, clearing any flags etc. + */ +OCSD_C_API void ocsd_gen_elem_init(ocsd_generic_trace_elem *p_pkt, const ocsd_gen_trc_elem_t elem_type); + +/** @}*/ + +/** @name Library packet and data printer control API + @brief Allows client to use libraries packet and data printers to log packets etc rather than attach callbacks + to packet output and use packet to string calls. +@{*/ + +/*! + * Set a raw frame printer on the trace frame demuxer. Allows inspection of raw trace data frames for debug. + * Prints via the library default error logging mechanisms. + * + * The flags input determines the data printed. OR combination of one or both of: + * OCSD_DFRMTR_PACKED_RAW_OUT : Output the undemuxed raw data frames. + * OCSD_DFRMTR_UNPACKED_RAW_OUT : Output the raw data by trace ID after unpacking the frame. + * + * @param handle : Handle to decode tree. + * @param flags : indicates type of raw frames to print. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_set_raw_frame_printer(const dcd_tree_handle_t handle, int flags); + +/*! + * Set a library printer on the generic element output of a full decoder. + * + * @param handle : Handle to decode tree. + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_set_gen_elem_printer(const dcd_tree_handle_t handle); + +/*! + * Attach a library printer to the packet processor. May be attached to the main packet output, or the monitor + * output if the main packet output is to be attached to a packet decoder in the datapath. + * + * @param handle : Handle to decode tree. + * @param cs_id : Coresight trace ID for stream to print. + * @param monitor: 0 to attach printer directly to datapath packet output, 1 to attach to packet monitor output + * + * @return ocsd_err_t : Library error code - RCDTL_OK if successful. + */ +OCSD_C_API ocsd_err_t ocsd_dt_set_pkt_protocol_printer(const dcd_tree_handle_t handle, uint8_t cs_id, int monitor); + +/** @}*/ + + +/** @name Custom Decoder API functions + +@{*/ + +/** Register a custom decoder with the library + + @param *name : Name under which to register the decoder. + @param *p_dcd_fact : Custom decoder factory structure. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful. +*/ +OCSD_C_API ocsd_err_t ocsd_register_custom_decoder(const char *name, ocsd_extern_dcd_fact_t *p_dcd_fact); + +/** Clear all registered decoders - library cleanup + + @return ocsd_err_t : Library error code - RCDTL_OK if successful. +*/ +OCSD_C_API ocsd_err_t ocsd_deregister_decoders(void); + +/** Get a string representation of a custom protocol packet. + + Specific function to extract the packet string for a custom protocol ID only. Custom IDs are allocated to decoder factories + during the ocsd_register_custom_decoder() process. + + This function is called by ocsd_pkt_str() when the incoming protocol is a custom ID. + + @param pkt_protocol : Packet protocol type - must be in the custom ID range ( >= OCSD_PROTOCOL_CUSTOM_0, < OCSD_PROTOCOL_END) + @param *p_pkt : pointer to a valid packet structure of protocol type. cast to void *. + @param *buffer : character buffer for string. + @param buffer_size : size of character buffer. + + @return ocsd_err_t : Library error code - RCDTL_OK if successful, OCSD_ERR_NO_PROTOCOL if input ID not in custom range or not in use. +*/ +OCSD_C_API ocsd_err_t ocsd_cust_protocol_to_str(const ocsd_trace_protocol_t pkt_protocol, const void *trc_pkt, char *buffer, const int buflen); + +/** @}*/ + + +/** @}*/ + +#endif // ARM_OPENCSD_C_API_H_INCLUDED + +/* End of File opencsd_c_api.h */ diff --git a/decoder/include/opencsd/etmv3/etmv3_decoder.h b/decoder/include/opencsd/etmv3/etmv3_decoder.h new file mode 100644 index 000000000000..2d5b7281aed6 --- /dev/null +++ b/decoder/include/opencsd/etmv3/etmv3_decoder.h @@ -0,0 +1,47 @@ +/* + * \file etmv3_decoder.h + * \brief OpenCSD : Top level header file for ETMv3 decoder + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_ETMV3_DECODER_H_INCLUDED +#define ARM_ETMV3_DECODER_H_INCLUDED + +#include "opencsd/etmv3/trc_cmp_cfg_etmv3.h" +#include "opencsd/etmv3/trc_pkt_elem_etmv3.h" +#include "opencsd/etmv3/trc_pkt_proc_etmv3.h" +#include "opencsd/etmv3/trc_pkt_types_etmv3.h" +#include "opencsd/etmv3/trc_pkt_decode_etmv3.h" + +#endif // ARM_ETMV3_DECODER_H_INCLUDED + +/* End of File etmv3_decoder.h */ diff --git a/decoder/include/opencsd/etmv3/trc_cmp_cfg_etmv3.h b/decoder/include/opencsd/etmv3/trc_cmp_cfg_etmv3.h new file mode 100644 index 000000000000..509de204a4e6 --- /dev/null +++ b/decoder/include/opencsd/etmv3/trc_cmp_cfg_etmv3.h @@ -0,0 +1,235 @@ +/* + * \file trc_cmp_cfg_etmv3.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_CMP_CFG_ETMV3_H_INCLUDED +#define ARM_TRC_CMP_CFG_ETMV3_H_INCLUDED + +#include "trc_pkt_types_etmv3.h" +#include "common/trc_cs_config.h" + + +/** @addtogroup ocsd_protocol_cfg +@{*/ + +/** @name ETMV3 configuration +@{*/ + + +/*! + * @class EtmV3Config + * @brief Interpreter class for etm v3 config structure. + * + * Provides quick value interpretation methods for the ETMv3 config register values. + * Primarily inlined for efficient code. + * + */ +class EtmV3Config : public CSConfig +{ +public: + EtmV3Config(); /**< Default constructor */ + EtmV3Config(const ocsd_etmv3_cfg *cfg_regs); + ~EtmV3Config() {}; /**< Default destructor */ + + /* register bit constants. */ + static const uint32_t CTRL_DATAVAL = 0x4; + static const uint32_t CTRL_DATAADDR = 0x8; + static const uint32_t CTRL_CYCLEACC = 0x1000; + static const uint32_t CTRL_DATAONLY = 0x100000; + static const uint32_t CTRL_TS_ENA = (0x1 << 28); + static const uint32_t CTRL_VMID_ENA = (0x1 << 30); + + static const uint32_t CCER_HAS_TS = (0x1 << 22); + static const uint32_t CCER_VIRTEXT = (0x1 << 26); + static const uint32_t CCER_TS64BIT = (0x1 << 29); + + static const uint32_t IDR_ALTBRANCH = 0x100000; + +// operations to convert to and from C-API structure + + //! copy assignment operator for C-API base structure into class. + EtmV3Config & operator=(const ocsd_etmv3_cfg *p_cfg); + + //! cast operator returning struct const reference + operator const ocsd_etmv3_cfg &() const { return m_cfg; }; + //! cast operator returning struct const pointer + operator const ocsd_etmv3_cfg *() const { return &m_cfg; }; + + //! combination enum to describe trace mode. + enum EtmTraceMode { + TM_INSTR_ONLY, //!< instruction only trace + TM_I_DATA_VAL, //!< instruction + data value + TM_I_DATA_ADDR, //!< instruction + data address + TM_I_DATA_VAL_ADDR, //!< instr + data value + data address + TM_DATAONLY_VAL, //!< data value trace + TM_DATAONLY_ADDR, //!< data address trace + TM_DATAONLY_VAL_ADDR //!< data value + address trace + }; + + EtmTraceMode const GetTraceMode() const; //!< return trace mode + + const bool isInstrTrace() const; //!< instruction trace present. + const bool isDataValTrace() const; //!< data value trace present. + const bool isDataAddrTrace() const; //!< data address trace present. + const bool isDataTrace() const; //!< either or both data trace types present. + + const bool isCycleAcc() const; //!< return true if cycle accurate tracing enabled. + + const int MinorRev() const; //!< return X revision in 3.X + + const bool isV7MArch() const; //!< source is V7M architecture + const bool isAltBranch() const; //!< Alternate branch packet encoding used. + + const int CtxtIDBytes() const; //!< number of context ID bytes traced 1,2,4; + const bool hasVirtExt() const; //!< processor has virtualisation extensions. + const bool isVMIDTrace() const; //!< VMID tracing enabled. + + const bool hasTS() const; //!< Timestamps implemented in trace. + const bool isTSEnabled() const; //!< Timestamp trace is enabled. + const bool TSPkt64() const; //!< timestamp packet is 64 bits in size. + + virtual const uint8_t getTraceID() const; //!< CoreSight Trace ID for this device. + + const ocsd_arch_version_t getArchVersion() const; //!< architecture version + const ocsd_core_profile_t getCoreProfile() const; //!< core profile. + +private: + ocsd_etmv3_cfg m_cfg; + +}; + + +/* inlines for the bit interpretations */ + +inline EtmV3Config & EtmV3Config::operator=(const ocsd_etmv3_cfg *p_cfg) +{ + m_cfg = *p_cfg; + return *this; +} + +inline const bool EtmV3Config::isCycleAcc() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_CYCLEACC) != 0); +} + +//! return X revision in 3.X +inline const int EtmV3Config::MinorRev() const +{ + return ((int)m_cfg.reg_idr & 0xF0) >> 4; +} + +inline const bool EtmV3Config::isInstrTrace() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_DATAONLY) == 0); +} + +inline const bool EtmV3Config::isDataValTrace() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_DATAVAL) != 0); +} + +inline const bool EtmV3Config::isDataAddrTrace() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_DATAADDR) != 0); +} + +//! either or both data trace present +inline const bool EtmV3Config::isDataTrace() const +{ + return (bool)((m_cfg.reg_ctrl & (CTRL_DATAADDR | CTRL_DATAVAL)) != 0); +} + +inline const bool EtmV3Config::isV7MArch() const +{ + return (bool)((m_cfg.arch_ver == ARCH_V7) && (m_cfg.core_prof == profile_CortexM)); +} + +//! has alternate branch encoding +inline const bool EtmV3Config::isAltBranch() const +{ + return (bool)(((m_cfg.reg_idr & IDR_ALTBRANCH) != 0) && (MinorRev() >= 4)); +} + +//! processor implements virtualisation extensions. +inline const bool EtmV3Config::hasVirtExt() const +{ + return (bool)((m_cfg.reg_ccer & CCER_VIRTEXT) != 0); +} + +//! TS packet is 64 bit. +inline const bool EtmV3Config::TSPkt64() const +{ + return (bool)((m_cfg.reg_ccer & CCER_TS64BIT) != 0); +} + +//! TS implemented. +inline const bool EtmV3Config::hasTS() const +{ + return (bool)((m_cfg.reg_ccer & CCER_HAS_TS) != 0); +} + +//! TS is enabled in the trace +inline const bool EtmV3Config::isTSEnabled() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_TS_ENA) != 0); +} + +//! tracing VMID +inline const bool EtmV3Config::isVMIDTrace() const +{ + return (bool)((m_cfg.reg_ctrl & CTRL_VMID_ENA) != 0); +} + +inline const uint8_t EtmV3Config::getTraceID() const +{ + return (uint8_t)(m_cfg.reg_trc_id & 0x7F); +} + +inline const ocsd_arch_version_t EtmV3Config::getArchVersion() const +{ + return m_cfg.arch_ver; +} + +inline const ocsd_core_profile_t EtmV3Config::getCoreProfile() const +{ + return m_cfg.core_prof; +} + +/** @}*/ + +/** @}*/ + +#endif // ARM_TRC_CMP_CFG_ETMV3_H_INCLUDED + +/* End of File trc_cmp_cfg_etmv3.h */ diff --git a/decoder/include/opencsd/etmv3/trc_dcd_mngr_etmv3.h b/decoder/include/opencsd/etmv3/trc_dcd_mngr_etmv3.h new file mode 100644 index 000000000000..c3a96ffcb5ee --- /dev/null +++ b/decoder/include/opencsd/etmv3/trc_dcd_mngr_etmv3.h @@ -0,0 +1,57 @@ +/* + * \file trc_dcd_mngr_etmv3.h + * \brief OpenCSD : ETMv3 decoder manager / handler specialisation + * + * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ARM_TRC_DCD_MNGR_ETMV3_H_INCLUDED +#define ARM_TRC_DCD_MNGR_ETMV3_H_INCLUDED + +#include "common/ocsd_dcd_mngr.h" +#include "trc_pkt_decode_etmv3.h" +#include "trc_pkt_proc_etmv3.h" +#include "trc_cmp_cfg_etmv3.h" +#include "trc_pkt_types_etmv3.h" + +class DecoderMngrEtmV3 : public DecodeMngrFullDcd< EtmV3TrcPacket, + ocsd_etmv3_pkt_type, + EtmV3Config, + ocsd_etmv3_cfg, + TrcPktProcEtmV3, + TrcPktDecodeEtmV3> +{ +public: + DecoderMngrEtmV3(const std::string &name) : DecodeMngrFullDcd(name,OCSD_PROTOCOL_ETMV3) {}; + virtual ~DecoderMngrEtmV3() {}; +}; + +#endif // ARM_TRC_DCD_MNGR_ETMV3_H_INCLUDED + +/* End of File trc_dcd_mngr_etmv3.h */ diff --git a/decoder/include/opencsd/etmv3/trc_pkt_decode_etmv3.h b/decoder/include/opencsd/etmv3/trc_pkt_decode_etmv3.h new file mode 100644 index 000000000000..b2139c0d9e68 --- /dev/null +++ b/decoder/include/opencsd/etmv3/trc_pkt_decode_etmv3.h @@ -0,0 +1,274 @@ +/*! + * \file trc_pkt_decode_etmv3.h + * \brief OpenCSD : ETMv3 decode + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_DECODE_ETMV3_H_INCLUDED +#define ARM_TRC_PKT_DECODE_ETMV3_H_INCLUDED + +#include "common/trc_pkt_decode_base.h" +#include "common/trc_gen_elem.h" +#include "common/ocsd_pe_context.h" +#include "common/ocsd_code_follower.h" +#include "common/ocsd_gen_elem_list.h" + +#include "opencsd/etmv3/trc_pkt_elem_etmv3.h" +#include "opencsd/etmv3/trc_cmp_cfg_etmv3.h" + +/**************** Atom handling class **************************************/ +class Etmv3Atoms +{ +public: + Etmv3Atoms(const bool isCycleAcc); + ~Etmv3Atoms() {}; + + //! initialise the atom and index values + void initAtomPkt(const EtmV3TrcPacket *in_pkt, const ocsd_trc_index_t &root_index); + + const ocsd_atm_val getCurrAtomVal() const; + const int numAtoms() const; //!< number of atoms + const ocsd_trc_index_t pktIndex() const; //!< originating packet index + + const bool hasAtomCC() const; //!< cycle count for current atom? + const uint32_t getAtomCC() const; //!< cycle count for current atom + const uint32_t getRemainCC() const; //!< get residual cycle count for remaining atoms + + void clearAtom(); //!< clear the current atom, set the next. + void clearAll(); //!< clear all + +private: + + // Atom PHDR packet formats from ETMv3 spec - defines content of header. + enum { + ATOM_PHDR_FMT_1 = 1, + ATOM_PHDR_FMT_2, + ATOM_PHDR_FMT_3, + ATOM_PHDR_FMT_4, + }; + + + + ocsd_pkt_atom m_atom; /**< atom elements - non zero number indicates valid atom count */ + uint8_t m_p_hdr_fmt; /**< if atom elements, associated phdr format */ + uint32_t m_cycle_count; + ocsd_trc_index_t m_root_index; //!< root index for the atom packet + bool m_isCCPacket; +}; + + +inline Etmv3Atoms::Etmv3Atoms(const bool isCycleAcc) +{ + m_isCCPacket = isCycleAcc; +} + +//! initialise the atom and index values +inline void Etmv3Atoms::initAtomPkt(const EtmV3TrcPacket *in_pkt, const ocsd_trc_index_t &root_index) +{ + m_atom = in_pkt->getAtom(); + m_p_hdr_fmt = in_pkt->getPHdrFmt(); + m_cycle_count = in_pkt->getCycleCount(); +} + +inline const ocsd_atm_val Etmv3Atoms::getCurrAtomVal() const +{ + return (m_atom.En_bits & 0x1) ? ATOM_E : ATOM_N; +} + +inline const int Etmv3Atoms::numAtoms() const +{ + return m_atom.num; +} + +inline const ocsd_trc_index_t Etmv3Atoms::pktIndex() const +{ + return m_root_index; +} + +inline const bool Etmv3Atoms::hasAtomCC() const +{ + bool hasCC = false; + if(!m_isCCPacket) + return hasCC; + + switch(m_p_hdr_fmt) + { + case ATOM_PHDR_FMT_4: + default: + break; + + case ATOM_PHDR_FMT_3: + case ATOM_PHDR_FMT_1: + hasCC = true; + break; + + case ATOM_PHDR_FMT_2: + hasCC = (m_atom.num > 1); // first of 2 has W state + break; + } + return hasCC; +} + +inline const uint32_t Etmv3Atoms::getAtomCC() const +{ + uint32_t CC = 0; + if(!m_isCCPacket) + return CC; + + switch(m_p_hdr_fmt) + { + case ATOM_PHDR_FMT_4: // no CC in format 4 + default: + break; + + case ATOM_PHDR_FMT_3: // single CC with optional E atom + CC = m_cycle_count; + break; + + case ATOM_PHDR_FMT_2: // single W on first of 2 atoms + CC = (m_atom.num > 1) ? 1: 0; + break; + + case ATOM_PHDR_FMT_1: // each atom has 1 CC. + CC = 1; + break; + } + return CC; +} + +inline const uint32_t Etmv3Atoms::getRemainCC() const +{ + uint32_t CC = 0; + if(!m_isCCPacket) + return CC; + + switch(m_p_hdr_fmt) + { + case ATOM_PHDR_FMT_4: // no CC in format 4 + default: + break; + + case ATOM_PHDR_FMT_3: + CC = m_cycle_count; + break; + + case ATOM_PHDR_FMT_2: + CC = (m_atom.num > 1) ? 1: 0; + break; + + case ATOM_PHDR_FMT_1: + CC = m_atom.num; + break; + } + return CC; +} + +inline void Etmv3Atoms::clearAtom() +{ + m_atom.En_bits >>=1; + if(m_atom.num) + m_atom.num--; +} + +inline void Etmv3Atoms::clearAll() +{ + m_atom.num = 0; +} + +/********** Main decode class ****************************************************/ +class TrcPktDecodeEtmV3 : public TrcPktDecodeBase<EtmV3TrcPacket, EtmV3Config> +{ +public: + TrcPktDecodeEtmV3(); + TrcPktDecodeEtmV3(int instIDNum); + virtual ~TrcPktDecodeEtmV3(); + +protected: + /* implementation packet decoding interface */ + virtual ocsd_datapath_resp_t processPacket(); + virtual ocsd_datapath_resp_t onEOT(); + virtual ocsd_datapath_resp_t onReset(); + virtual ocsd_datapath_resp_t onFlush(); + virtual ocsd_err_t onProtocolConfig(); + virtual const uint8_t getCoreSightTraceID() { return m_CSID; }; + + /* local decode methods */ + void initDecoder(); //!< initial state on creation (zeros all config) + void resetDecoder(); //!< reset state to start of decode. (moves state, retains config) + + ocsd_datapath_resp_t decodePacket(bool &pktDone); //!< decode a packet + + ocsd_datapath_resp_t processISync(const bool withCC, const bool firstSync = false); + ocsd_datapath_resp_t processBranchAddr(); + ocsd_datapath_resp_t processPHdr(); + + ocsd_datapath_resp_t sendUnsyncPacket(); //!< send an initial unsync packet when decoder starts + + OcsdTraceElement *GetNextOpElem(ocsd_datapath_resp_t &resp); //!< get the next element from the element list. + +private: + void setNeedAddr(bool bNeedAddr); + void pendExceptionReturn(); + bool preISyncValid(ocsd_etmv3_pkt_type pkt_type); +//** intra packet state; + + OcsdCodeFollower m_code_follower; //!< code follower for instruction trace + + ocsd_vaddr_t m_IAddr; //!< next instruction address + bool m_bNeedAddr; //!< true if an address is needed (current out of date / invalid) + bool m_bSentUnknown; //!< true if we have sent an unknown address packet for this phase of needing an address. + bool m_bWaitISync; //!< true if waiting for first ISync packet + + OcsdPeContext m_PeContext; //!< save context data before sending in output packet + + OcsdGenElemList m_outputElemList; //!< list of output elements + + +//** Other packet decoder state; + + // trace decode FSM + typedef enum { + NO_SYNC, //!< pre start trace - init state or after reset or overflow, loss of sync. + WAIT_ASYNC, //!< waiting for a-sync packet. + WAIT_ISYNC, //!< waiting for i-sync packet. + DECODE_PKTS, //!< processing a packet + SEND_PKTS, //!< sending packets. + } processor_state_t; + + processor_state_t m_curr_state; + + uint8_t m_CSID; //!< Coresight trace ID for this decoder. +}; + + +#endif // ARM_TRC_PKT_DECODE_ETMV3_H_INCLUDED + +/* End of File trc_pkt_decode_etmv3.h */ diff --git a/decoder/include/opencsd/etmv3/trc_pkt_elem_etmv3.h b/decoder/include/opencsd/etmv3/trc_pkt_elem_etmv3.h new file mode 100644 index 000000000000..a874ea30c861 --- /dev/null +++ b/decoder/include/opencsd/etmv3/trc_pkt_elem_etmv3.h @@ -0,0 +1,261 @@ +/* + * \file trc_pkt_elem_etmv3.h + * \brief OpenCSD : + * + * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved. + */ + + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED +#define ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED + +#include "trc_pkt_types_etmv3.h" +#include "common/trc_printable_elem.h" +#include "common/trc_pkt_elem_base.h" + +/** @addtogroup trc_pkts +@{*/ + +/*! + * @class EtmV3TrcPacket + * @brief ETMv3 Trace Protocol Packet. + * + * This class represents a single ETMv3 trace packet, along with intra packet state. + * + */ +class EtmV3TrcPacket : public TrcPacketBase, public trcPrintableElem +{ +public: + EtmV3TrcPacket(); + ~EtmV3TrcPacket(); + +// conversions between C-API struct and C++ object types + // assign from C-API struct + EtmV3TrcPacket &operator =(const ocsd_etmv3_pkt* p_pkt); + + // allow const cast to C-API struct to pass C++ object + operator const ocsd_etmv3_pkt*() const { return &m_pkt_data; }; + operator const ocsd_etmv3_pkt&() const { return m_pkt_data; }; + + // override c_pkt to pass out the packet data struct. + virtual const void *c_pkt() const { return &m_pkt_data; }; + +// update interface - set packet values + void Clear(); //!< clear update data in packet ready for new one. + void ResetState(); //!< reset intra packet state data -on full decoder reset. + + void SetType(const ocsd_etmv3_pkt_type p_type); + void SetErrType(const ocsd_etmv3_pkt_type e_type); + void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits); + void SetException( const ocsd_armv7_exception type, + const uint16_t number, + const bool cancel, + const bool cm_type, + const int irq_n = 0, + const int resume = 0); + void UpdateNS(const int NS); + void UpdateAltISA(const int AltISA); + void UpdateHyp(const int Hyp); + void UpdateISA(const ocsd_isa isa); + void UpdateContextID(const uint32_t contextID); + void UpdateVMID(const uint8_t VMID); + void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits); + + bool UpdateAtomFromPHdr(const uint8_t pHdr, const bool cycleAccurate); //!< Interpret P Hdr, return true if valid, false if not. + + void SetDataOOOTag(const uint8_t tag); + void SetDataValue(const uint32_t value); + void UpdateDataAddress(const uint32_t value, const uint8_t valid_bits); + void UpdateDataEndian(const uint8_t BE_Val); + void SetCycleCount(const uint32_t cycleCount); + void SetISyncReason(const ocsd_iSync_reason reason); + void SetISyncHasCC(); + void SetISyncIsLSiP(); + void SetISyncNoAddr(); + +// packet status interface - get packet info. + const ocsd_etmv3_pkt_type getType() const { return m_pkt_data.type; }; + const bool isBadPacket() const; + + const int AltISA() const { return m_pkt_data.context.curr_alt_isa; }; + const ocsd_isa ISA() const { return m_pkt_data.curr_isa; }; + const bool changedISA() const { return m_pkt_data.curr_isa != m_pkt_data.prev_isa; }; + + // any of the context elements updated? + const bool isCtxtUpdated() const; + const bool isCtxtFlagsUpdated() const { return (m_pkt_data.context.updated == 1); }; + const bool isNS() const { return m_pkt_data.context.curr_NS; }; + const bool isHyp() const { return m_pkt_data.context.curr_Hyp; }; + + const bool isCtxtIDUpdated() const { return (m_pkt_data.context.updated_c == 1); } + const uint32_t getCtxtID() const { return m_pkt_data.context.ctxtID; }; + const bool isVMIDUpdated() const { return (m_pkt_data.context.updated_v == 1); } + const uint32_t getVMID() const { return m_pkt_data.context.VMID; }; + + const uint32_t getCycleCount() const { return m_pkt_data.cycle_count; }; + const uint64_t getTS() const { return m_pkt_data.timestamp; }; + + const bool isExcepPkt() const { return (m_pkt_data.exception.bits.present == 1); }; + const ocsd_armv7_exception excepType() const { return m_pkt_data.exception.type; }; + const uint16_t excepNum() const { return m_pkt_data.exception.number; }; + const bool isExcepCancel() const { return (m_pkt_data.exception.bits.present == 1) && (m_pkt_data.exception.bits.cancel == 1); }; + + const ocsd_iSync_reason getISyncReason() const { return m_pkt_data.isync_info.reason; }; + const bool getISyncHasCC() const { return m_pkt_data.isync_info.has_cycle_count; }; + const bool getISyncIsLSiPAddr() const { return m_pkt_data.isync_info.has_LSipAddress; }; + const bool getISyncNoAddr() const { return m_pkt_data.isync_info.no_address; }; + + const ocsd_vaddr_t getAddr() const { return m_pkt_data. |