Remove source for deprecated C-API functions along with test API projects and source.
Remove deprecated C-API tests and source from linux library build.
Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/build/linux/makefile | 2 - decoder/build/linux/rctdl_c_api_lib/makefile | 1 - .../rctdl_c_api_lib/rctdl_c_api_lib.vcxproj | 2 - .../rctdl_c_api_lib.vcxproj.filters | 6 - .../ref_trace_decode_lib/ref_trace_decode_lib.sln | 21 - decoder/include/c_api/ocsd_c_api_deprc_fn.h | 233 ------ decoder/include/c_api/opencsd_c_api.h | 5 - decoder/source/c_api/ocsd_c_api_deprc_fn.cpp | 200 ----- .../build/linux/simple_pkt_print_c_api/makefile | 82 -- .../simple_pkt_print_c_api.vcxproj | 333 -------- .../simple_pkt_print_c_api.vcxproj.filters | 22 - decoder/tests/source/simple_pkt_c_api.c | 923 --------------------- 12 files changed, 1830 deletions(-) delete mode 100644 decoder/include/c_api/ocsd_c_api_deprc_fn.h delete mode 100644 decoder/source/c_api/ocsd_c_api_deprc_fn.cpp delete mode 100644 decoder/tests/build/linux/simple_pkt_print_c_api/makefile delete mode 100644 decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj delete mode 100644 decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj.filters delete mode 100644 decoder/tests/source/simple_pkt_c_api.c
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile index 79b0090..d578bbd 100644 --- a/decoder/build/linux/makefile +++ b/decoder/build/linux/makefile @@ -159,7 +159,6 @@ 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/simple_pkt_print_c_api && make cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && make
############################################################# @@ -177,5 +176,4 @@ 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/simple_pkt_print_c_api && make clean cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && make clean diff --git a/decoder/build/linux/rctdl_c_api_lib/makefile b/decoder/build/linux/rctdl_c_api_lib/makefile index 6f4c0e7..c0ebdf5 100644 --- a/decoder/build/linux/rctdl_c_api_lib/makefile +++ b/decoder/build/linux/rctdl_c_api_lib/makefile @@ -50,7 +50,6 @@ CPP_INCLUDES= \ -I$(OCSD_SOURCE)/c_api
OBJECTS=$(BUILD_DIR)/ocsd_c_api.o \ - $(BUILD_DIR)/ocsd_c_api_deprc_fn.o \ $(BUILD_DIR)/ocsd_c_api_custom_obj.o
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 index b68a642..ece6ff0 100644 --- 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 @@ -307,7 +307,6 @@ <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_custom.h" /> <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_cust_fact.h" /> <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_cust_impl.h" /> - <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_deprc_fn.h" /> <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_types.h" /> <ClInclude Include="..\..\..\include\c_api\opencsd_c_api.h" /> <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.h" /> @@ -321,7 +320,6 @@ <ItemGroup> <ClCompile Include="..\..\..\source\c_api\ocsd_c_api.cpp" /> <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.cpp" /> - <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_deprc_fn.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> 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 index b905bab..405a85d 100644 --- 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 @@ -24,9 +24,6 @@ <ClInclude Include="..\..\..\source\c_api\ocsd_c_api_obj.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_deprc_fn.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\..\..\include\c_api\ocsd_c_api_custom.h"> <Filter>Header Files</Filter> </ClInclude> @@ -44,9 +41,6 @@ <ClCompile Include="..\..\..\source\c_api\ocsd_c_api.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_deprc_fn.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\..\..\source\c_api\ocsd_c_api_custom_obj.cpp"> <Filter>Source Files</Filter> </ClCompile> 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 index 2731a39..94b561a 100644 --- 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 @@ -17,11 +17,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "trc_pkt_lister", "......\ {7F500891-CC76-405F-933F-F682BC39F923} = {7F500891-CC76-405F-933F-F682BC39F923} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_pkt_print_c_api", "......\tests\build\win-vs2015\simple_pkt_print_c_api\simple_pkt_print_c_api.vcxproj", "{D18112ED-E2D7-4D49-B1F0-15E98967AC0A}" - ProjectSection(ProjectDependencies) = postProject - {533F929A-A73B-46B6-9D5F-FFCD62F734E3} = {533F929A-A73B-46B6-9D5F-FFCD62F734E3} - 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} @@ -101,22 +96,6 @@ Global {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 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug|Win32.ActiveCfg = Debug|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug|Win32.Build.0 = Debug|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug|x64.ActiveCfg = Debug|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug|x64.Build.0 = Debug|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Debug-dll|x64.Build.0 = Debug-dll|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release|Win32.ActiveCfg = Release|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release|Win32.Build.0 = Release|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release|x64.ActiveCfg = Release|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release|x64.Build.0 = Release|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release-dll|Win32.Build.0 = Release-dll|Win32 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release-dll|x64.ActiveCfg = Release-dll|x64 - {D18112ED-E2D7-4D49-B1F0-15E98967AC0A}.Release-dll|x64.Build.0 = 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 diff --git a/decoder/include/c_api/ocsd_c_api_deprc_fn.h b/decoder/include/c_api/ocsd_c_api_deprc_fn.h deleted file mode 100644 index 463f4af..0000000 --- a/decoder/include/c_api/ocsd_c_api_deprc_fn.h +++ /dev/null @@ -1,233 +0,0 @@ -/*! - * \file ocsd_c_api_deprc_fn.h - * \brief OpenCSD : Deprecated C-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_DEPRC_FN_H_INCLUDED -#define ARM_OCSD_C_API_DEPRC_FN_H_INCLUDED - -/** @defgroup depr_lib_c_api OpenCSD Library : Deprecated "C" API functions and types - - @brief "C" API functions and types that have been deprecated after API changes. - - Retained for regression testing for a few library versions - Will be removed completely in a later library version - - To use these functions define the macro OPENCSD_INC_DEPRECATED_API -@{*/ - -/** function pointer type for ETMv4 instruction packet processor output, packet analyser/decoder input */ -typedef ocsd_datapath_resp_t (* FnEtmv4IPacketDataIn)(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_etmv4_i_pkt *p_packet_in); - -/** function pointer type for ETMv4 instruction packet processor monitor output, raw packet monitor / display input */ -typedef void (* FnEtmv4IPktMonDataIn)( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_etmv4_i_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data); - -/** function pointer type for ETMv3 packet processor output, packet analyser/decoder input */ -typedef ocsd_datapath_resp_t (* FnEtmv3PacketDataIn)(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_etmv3_pkt *p_packet_in); - -/** function pointer type for ETMv3 packet processor monitor output, raw packet monitor / display input */ -typedef void (* FnEtmv3PktMonDataIn)( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_etmv3_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data); - - -/** function pointer type for PTM packet processor output, packet analyser/decoder input */ -typedef ocsd_datapath_resp_t (* FnPtmPacketDataIn)(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_ptm_pkt *p_packet_in); - -/** function pointer type for PTM packet processor monitor output, raw packet monitor / display input */ -typedef void (* FnPtmPktMonDataIn)( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_ptm_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data); - - -/** function pointer type for STM packet processor output, packet analyser/decoder input */ -typedef ocsd_datapath_resp_t (* FnStmPacketDataIn)(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_stm_pkt *p_packet_in); - -/** function pointer type for STM packet processor monitor output, raw packet monitor / display input */ -typedef void (* FnStmPktMonDataIn)( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_stm_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data); - - -/*---------------------- ETMv4 Trace ----------------------------------------------------------------------------------*/ -/*! - * Create an ETMv4 instruction trace packet processor only for the supplied configuration. - * Must supply an output callback function which handles the etmv4 packet types, to attach to the packet processor. - * - * @param handle : handle a decode tree to create the packet processsor. - * @param *etmv4_cfg : pointer to valid Etmv4 configuration structure. - * @param pPktFn : pointer to a packet handling callback function. - * @param p_context : opaque context pointer value used in callback function.. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv4i_pkt_proc(const dcd_tree_handle_t handle, const void *etmv4_cfg, FnEtmv4IPacketDataIn pPktFn, const void *p_context); - -/*! - * Creates a packet processor + packet decoder pair for the supplied configuration structure. - * Uses the output function set in ocsd_dt_set_gen_elem_outfn() as the output sink. - * - * @param handle : Handle to decode tree. - * @param *etmv4_cfg : pointer to valid Etmv4 configuration structure. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv4i_decoder(const dcd_tree_handle_t handle, const void *etmv4_cfg); - -/*! - * Attach a callback function to the packet processor monitor point defined by the CoreSight ID. - * - * @param handle : Handle to decode tree. - * @param trc_chan_id : CoreSight Trace ID for packet processor - * @param pPktFn : Function to attach to monitor point. - * @param p_context : opaque context pointer value used in callback function. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_attach_etmv4i_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnEtmv4IPktMonDataIn pPktFn, const void *p_context); - -/*---------------------- ETMv3 trace ----------------------------------------------------------------------------------*/ -/*! - * Create an ETMv3 trace packet processor only for the supplied configuration. - * Must supply an output callback function which handles the etmv3 packet types, to attach to the packet processor. - * - * @param handle : handle a decode tree to create the packet processsor. - * @param *etmv3_cfg : pointer to valid Etmv3 configuration structure. - * @param pPktFn : pointer to a packet handling callback function. - * @param p_context : opaque context pointer value used in callback function. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv3_pkt_proc(const dcd_tree_handle_t handle, const void *etmv3_cfg, FnEtmv3PacketDataIn pPktFn, const void *p_context); - - -/*! - * Creates a packet processor + packet decoder pair for the supplied configuration structure. - * Uses the output function set in ocsd_dt_set_gen_elem_outfn() as the output sink. - * - * @param handle : Handle to decode tree. - * @param *etmv3_cfg : pointer to valid Etmv4 configuration structure. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv3_decoder(const dcd_tree_handle_t handle, const void *etmv3_cfg); - - - -/*! - * Attach a callback function to the packet processor monitor point defined by the CoreSight ID. - * Packet processor must exist for the trace ID and be an ETMv3 processor. - * - * @param handle : Handle to decode tree. - * @param trc_chan_id : CoreSight Trace ID for packet processor - * @param pPktFn : Function to attach to monitor point. - * @param p_context : opaque context pointer value used in callback function. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_attach_etmv3_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnEtmv3PktMonDataIn pPktFn, const void *p_context); - -/*---------------------- PTM Trace ----------------------------------------------------------------------------------*/ -/*! - * Create an PTM instruction trace packet processor only for the supplied configuration. - * Must supply an output callback function which handles the ptm packet types, to attach to the packet processor. - * - * @param handle : handle a decode tree to create the packet processsor. - * @param *ptm_cfg : pointer to valid Ptm configuration structure. - * @param pPktFn : pointer to a packet handling callback function. - * @param p_context : opaque context pointer value used in callback function.. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_ptm_pkt_proc(const dcd_tree_handle_t handle, const void *ptm_cfg, FnPtmPacketDataIn pPktFn, const void *p_context); - -/*! - * Creates a packet processor + packet decoder pair for the supplied configuration structure. - * Uses the output function set in ocsd_dt_set_gen_elem_outfn() as the output sink. - * - * @param handle : Handle to decode tree. - * @param *ptm_cfg : pointer to valid Ptm configuration structure. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_ptm_decoder(const dcd_tree_handle_t handle, const void *ptm_cfg); - -/*! - * Attach a callback function to the packet processor monitor point defined by the CoreSight ID. - * - * @param handle : Handle to decode tree. - * @param trc_chan_id : CoreSight Trace ID for packet processor - * @param pPktFn : Function to attach to monitor point. - * @param p_context : opaque context pointer value used in callback function. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_attach_ptm_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnPtmPktMonDataIn pPktFn, const void *p_context); - - -/*---------------------- STM Trace ----------------------------------------------------------------------------------*/ -/*! - * Create an STM trace packet processor only for the supplied configuration. - * Must supply an output callback function which handles the stm packet types, to attach to the packet processor. - * - * @param handle : handle a decode tree to create the packet processsor. - * @param *stm_cfg : pointer to valid Stm configuration structure. - * @param pPktFn : pointer to a packet handling callback function. - * @param p_context : opaque context pointer value used in callback function. - * - * @return ocsd_err_t : Library error code - RCDTL_OK if successful. - */ -OCSD_C_API ocsd_err_t ocsd_dt_create_stm_pkt_proc(const dcd_tree_handle_t handle, const void *stm_cfg, FnStmPacketDataIn pPktFn, const void *p_context); - - - -/** deprecated memory region type for adding multi-region binary files to memory access interface */ -typedef ocsd_file_mem_region_t file_mem_region_t; -/** @}*/ - -#endif // ARM_OCSD_C_API_DEPRC_FN_H_INCLUDED - -/* End of File ocsd_c_api_deprc_fn.h */ diff --git a/decoder/include/c_api/opencsd_c_api.h b/decoder/include/c_api/opencsd_c_api.h index 0fee736..2795955 100644 --- a/decoder/include/c_api/opencsd_c_api.h +++ b/decoder/include/c_api/opencsd_c_api.h @@ -426,11 +426,6 @@ OCSD_C_API ocsd_err_t ocsd_cust_protocol_to_str(const ocsd_trace_protocol_t pkt_
/** @}*/
-#ifdef OPENCSD_INC_DEPRECATED_API -#include "ocsd_c_api_deprc_fn.h" -#endif - #endif // ARM_OPENCSD_C_API_H_INCLUDED
- /* End of File opencsd_c_api.h */ diff --git a/decoder/source/c_api/ocsd_c_api_deprc_fn.cpp b/decoder/source/c_api/ocsd_c_api_deprc_fn.cpp deleted file mode 100644 index 959ef0b..0000000 --- a/decoder/source/c_api/ocsd_c_api_deprc_fn.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * \file ocsd_c_api_deprc_fn.cpp - * \brief OpenCSD : Deprecated C-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. - */ - -/* pull in the C++ decode library */ -#include "opencsd.h" - -/* C-API and wrapper objects */ -#define OPENCSD_INC_DEPRECATED_API -#include "c_api/opencsd_c_api.h" -#include "ocsd_c_api_obj.h" - -#ifdef OPENCSD_INC_DEPRECATED_API - -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv4i_pkt_proc(const dcd_tree_handle_t handle, const void *etmv4_cfg, FnEtmv4IPacketDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - uint8_t CSID = 0; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_ETMV4I,OCSD_CREATE_FLG_PACKET_PROC,etmv4_cfg,&CSID); - if(err == OCSD_OK) - { - err = ocsd_dt_attach_packet_callback(handle,CSID, OCSD_C_API_CB_PKT_SINK,(void *)pPktFn,p_context); - if(err != OCSD_OK) - ocsd_dt_remove_decoder(handle,CSID); - } - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv4i_decoder(const dcd_tree_handle_t handle, const void *etmv4_cfg) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - uint8_t CSID = 0; - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_ETMV4I,OCSD_CREATE_FLG_FULL_DECODER,etmv4_cfg,&CSID); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_attach_etmv4i_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnEtmv4IPktMonDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_attach_packet_callback(handle,trc_chan_id,OCSD_C_API_CB_PKT_MON,(void *)pPktFn,p_context); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv3_pkt_proc(const dcd_tree_handle_t handle, const void *etmv3_cfg, FnEtmv3PacketDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - uint8_t CSID = 0; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_ETMV3,OCSD_CREATE_FLG_PACKET_PROC,etmv3_cfg,&CSID); - if(err == OCSD_OK) - { - err = ocsd_dt_attach_packet_callback(handle,CSID, OCSD_C_API_CB_PKT_SINK,(void *)pPktFn,p_context); - if(err != OCSD_OK) - ocsd_dt_remove_decoder(handle,CSID); - } - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_create_etmv3_decoder(const dcd_tree_handle_t handle, const void *etmv3_cfg) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - uint8_t CSID = 0; - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_ETMV3,OCSD_CREATE_FLG_FULL_DECODER,etmv3_cfg,&CSID); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_attach_etmv3_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnEtmv3PktMonDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_attach_packet_callback(handle,trc_chan_id,OCSD_C_API_CB_PKT_MON,(void *)pPktFn,p_context); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - - -OCSD_C_API ocsd_err_t ocsd_dt_create_ptm_pkt_proc(const dcd_tree_handle_t handle, const void *ptm_cfg, FnPtmPacketDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - uint8_t CSID = 0; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_PTM,OCSD_CREATE_FLG_PACKET_PROC,ptm_cfg,&CSID); - if(err == OCSD_OK) - { - err = ocsd_dt_attach_packet_callback(handle,CSID, OCSD_C_API_CB_PKT_SINK,(void *)pPktFn,p_context); - if(err != OCSD_OK) - ocsd_dt_remove_decoder(handle,CSID); - } - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; - -} - -OCSD_C_API ocsd_err_t ocsd_dt_create_ptm_decoder(const dcd_tree_handle_t handle, const void *ptm_cfg) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - uint8_t CSID = 0; - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_PTM,OCSD_CREATE_FLG_FULL_DECODER,ptm_cfg,&CSID); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_attach_ptm_pkt_mon(const dcd_tree_handle_t handle, const uint8_t trc_chan_id, FnPtmPktMonDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_attach_packet_callback(handle,trc_chan_id,OCSD_C_API_CB_PKT_MON,(void *)pPktFn,p_context); - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -OCSD_C_API ocsd_err_t ocsd_dt_create_stm_pkt_proc(const dcd_tree_handle_t handle, const void *stm_cfg, FnStmPacketDataIn pPktFn, const void *p_context) -{ - ocsd_err_t err = OCSD_OK; - uint8_t CSID = 0; - if(handle != C_API_INVALID_TREE_HANDLE) - { - err = ocsd_dt_create_decoder(handle,OCSD_BUILTIN_DCD_STM,OCSD_CREATE_FLG_PACKET_PROC,stm_cfg,&CSID); - if(err == OCSD_OK) - { - err = ocsd_dt_attach_packet_callback(handle,CSID, OCSD_C_API_CB_PKT_SINK,(void *)pPktFn,p_context); - if(err != OCSD_OK) - ocsd_dt_remove_decoder(handle,CSID); - } - } - else - err = OCSD_ERR_INVALID_PARAM_VAL; - return err; -} - -#endif - -/* End of File ocsd_c_api_deprc_fn.cpp */ diff --git a/decoder/tests/build/linux/simple_pkt_print_c_api/makefile b/decoder/tests/build/linux/simple_pkt_print_c_api/makefile deleted file mode 100644 index a1e4612..0000000 --- a/decoder/tests/build/linux/simple_pkt_print_c_api/makefile +++ /dev/null @@ -1,82 +0,0 @@ -######################################################## -# 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. -# -################################################################################# - -######## -# RCTDL - test makefile for simple c api packet list test. -# - -CC := $(MASTER_CC) -CC_FLAGS := $(MASTER_CC_FLAGS) -Wno-switch -LINKER := $(MASTER_LINKER) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS) - -PROG = simple_pkt_print_c_api - -BUILD_DIR=./$(PLAT_DIR) - -VPATH = $(OCSD_TESTS)/source - -CC_INCLUDES = \ - -I$(OCSD_TESTS)/source \ - -I$(OCSD_INCLUDE) - -OBJECTS = $(BUILD_DIR)/simple_pkt_c_api.o - -LIBS = -L$(LIB_TARGET_DIR) -l$(LIB_BASE_NAME) -l$(LIB_CAPI_NAME) - -all: build_dir test_app copy_libs - -test_app: $(OBJECTS) $(BIN_TEST_TARGET_DIR)/$(PROG) - - - $(BIN_TEST_TARGET_DIR)/$(PROG): - mkdir -p $(BIN_TEST_TARGET_DIR) - $(LINKER) $(LINKER_FLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group -o $(BIN_TEST_TARGET_DIR)/$(PROG) - cp $(LIB_TARGET_DIR)/*.so . - -build_dir: - mkdir -p $(BUILD_DIR) - -.PHONY: copy_libs - -copy_libs: - cp $(LIB_TARGET_DIR)/*.so $(BIN_TEST_TARGET_DIR)/. - - -#### build rules -$(BUILD_DIR)/%.o : %.c - $(CC) $(CC_FLAGS) $(CC_INCLUDES) $< -o $@ - -#### clean -.PHONY: clean -clean : - rm -f $(BIN_TEST_TARGET_DIR)/$(PROG) $(OBJECTS) - -# end of file makefile diff --git a/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj b/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj deleted file mode 100644 index d361e9c..0000000 --- a/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj +++ /dev/null @@ -1,333 +0,0 @@ -<?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> - <ItemGroup> - <ClCompile Include="..\..\..\source\simple_pkt_c_api.c" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{D18112ED-E2D7-4D49-B1F0-15E98967AC0A}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>simple_pkt_print_c_api</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'" Label="Configuration"> - <ConfigurationType>Application</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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\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="..\..\..\..\build\win-vs2015\opencsd.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\dbg</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\dbg</OutDir> - <TargetName>$(ProjectName)-dl</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\dbg</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\dbg</OutDir> - <TargetName>$(ProjectName)-dl</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\rel</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\rel</OutDir> - <TargetName>$(ProjectName)-dl</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\rel</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-dll|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>......\bin\win$(PlatformArchitecture)\rel</OutDir> - <TargetName>$(ProjectName)-dl</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;OCSD_USE_STATIC_C_API;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\dbg</AdditionalLibraryDirectories> - <AdditionalDependencies>lib$(LIB_CAPI_NAME).lib;lib$(LIB_BASE_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <PostBuildEvent> - <Command> - </Command> - </PostBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\dbg</AdditionalLibraryDirectories> - <AdditionalDependencies>$(LIB_CAPI_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <PostBuildEvent> - <Command>copy ........\lib\win32\dbg*.dll ......\bin\win32\dbg.</Command> - </PostBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;OCSD_USE_STATIC_C_API;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalDependencies>lib$(LIB_CAPI_NAME).lib;lib$(LIB_BASE_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\dbg</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-dll|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\dbg</AdditionalLibraryDirectories> - <AdditionalDependencies>$(LIB_CAPI_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <PostBuildEvent> - <Command>copy ........\lib\win64\dbg*.dll ......\bin\win64\dbg.</Command> - </PostBuildEvent> - </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;_CONSOLE;_CRT_SECURE_NO_WARNINGS;OCSD_USE_STATIC_C_API;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\rel</AdditionalLibraryDirectories> - <AdditionalDependencies>lib$(LIB_CAPI_NAME).lib;lib$(LIB_BASE_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </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;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\rel</AdditionalLibraryDirectories> - <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(LIB_CAPI_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <PostBuildEvent> - <Command>copy ........\lib\win32\rel*.dll ......\bin\win32\rel.</Command> - </PostBuildEvent> - </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;_CONSOLE;_CRT_SECURE_NO_WARNINGS;OCSD_USE_STATIC_C_API;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\rel</AdditionalLibraryDirectories> - <AdditionalDependencies>lib$(LIB_CAPI_NAME).lib;lib$(LIB_BASE_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </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;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>........\include</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalLibraryDirectories>........\lib\win$(PlatformArchitecture)\rel</AdditionalLibraryDirectories> - <AdditionalDependencies>$(LIB_CAPI_NAME).lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - <PostBuildEvent> - <Command>copy ........\lib\win64\rel*.dll ......\bin\win64\rel.</Command> - </PostBuildEvent> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj.filters b/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj.filters deleted file mode 100644 index 8d50471..0000000 --- a/decoder/tests/build/win-vs2015/simple_pkt_print_c_api/simple_pkt_print_c_api.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ -<?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> - <ClCompile Include="..\..\..\source\simple_pkt_c_api.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/decoder/tests/source/simple_pkt_c_api.c b/decoder/tests/source/simple_pkt_c_api.c deleted file mode 100644 index 86a3f74..0000000 --- a/decoder/tests/source/simple_pkt_c_api.c +++ /dev/null @@ -1,923 +0,0 @@ -/* - * \file simple_pkt_c_api.c - * \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. - */ - -/* - * Example of using the library with the C-API - * - * Simple test program to print packets from a single trace source stream. - * Hard coded configuration based on the Juno r1-1 test snapshot for ETMv4 and - * STM, TC2 test snapshot for ETMv3, PTM - * - */ - -#include <stdio.h> -#include <string.h> -#include <stdint.h> -#include <stdlib.h> - -#define OPENCSD_INC_DEPRECATED_API -/* include the C-API library header */ -#include "c_api/opencsd_c_api.h" - -/* path to juno snapshot, relative to tests/bin/<plat>/<dbg|rel> build output dir */ -#ifdef _WIN32 -const char *default_path_to_snapshot = "..\..\..\snapshots\juno_r1_1\"; -const char *tc2_snapshot = "..\..\..\snapshots\TC2\"; -#else -const char *default_path_to_snapshot = "../../../snapshots/juno_r1_1/"; -const char *tc2_snapshot = "../../../snapshots/TC2/"; -#endif - -/* trace data and memory file dump names */ -const char *trace_data_filename = "cstrace.bin"; -const char *stmtrace_data_filename = "cstraceitm.bin"; -const char *memory_dump_filename = "kernel_dump.bin"; -ocsd_vaddr_t mem_dump_address=0xFFFFFFC000081000; -const ocsd_vaddr_t mem_dump_address_tc2=0xC0008000; - -static int using_mem_acc_cb = 0; -static int use_region_file = 0; - -/* region list to test region file API */ -file_mem_region_t region_list[4]; - -/* trace configuration structures - contains programmed register values of trace hardware */ -static ocsd_etmv4_cfg trace_config; -static ocsd_etmv3_cfg trace_config_etmv3; -static ocsd_stm_cfg trace_config_stm; -static ocsd_ptm_cfg trace_config_ptm; - -/* buffer to handle a packet string */ -#define PACKET_STR_LEN 1024 -static char packet_str[PACKET_STR_LEN]; - -/* decide if we decode & monitor, decode only or packet print */ -typedef enum _test_op { - TEST_PKT_PRINT, - TEST_PKT_DECODE, - TEST_PKT_DECODEONLY -} test_op_t; - -static test_op_t op = TEST_PKT_PRINT; -static ocsd_trace_protocol_t test_protocol = OCSD_PROTOCOL_ETMV4I; -static uint8_t test_trc_id_override = 0x00; - -static int print_data_array(const uint8_t *p_array, const int array_size, char *p_buffer, int buf_size) -{ - int chars_printed = 0; - int bytes_processed; - p_buffer[0] = 0; - - if(buf_size > 9) - { - /* set up the header */ - strcat(p_buffer,"[ "); - chars_printed+=2; - - for(bytes_processed = 0; bytes_processed < array_size; bytes_processed++) - { - sprintf(p_buffer+chars_printed,"0x%02X ", p_array[bytes_processed]); - chars_printed += 5; - if((chars_printed + 5) > buf_size) - break; - } - - strcat(p_buffer,"];"); - chars_printed+=2; - } - else if(buf_size >= 4) - { - sprintf(p_buffer,"[];"); - chars_printed+=3; - } - return chars_printed; -} - -/* choose the operation to use for the test. */ -static void process_cmd_line(int argc, char *argv[]) -{ - int idx = 1; - - while(idx < argc) - { - if(strcmp(argv[idx],"-decode_only") == 0) - { - op = TEST_PKT_DECODEONLY; - } - else if(strcmp(argv[idx],"-decode") == 0) - { - op = TEST_PKT_DECODE; - } - else if(strcmp(argv[idx],"-id") == 0) - { - idx++; - if(idx < argc) - { - test_trc_id_override = (uint8_t)(strtoul(argv[idx],0,0)); - printf("ID override = 0x%02X\n",test_trc_id_override); - } - } - else if(strcmp(argv[idx],"-etmv3") == 0) - { - test_protocol = OCSD_PROTOCOL_ETMV3; - default_path_to_snapshot = tc2_snapshot; - mem_dump_address = mem_dump_address_tc2; - } - else if(strcmp(argv[idx],"-ptm") == 0) - { - test_protocol = OCSD_PROTOCOL_PTM; - default_path_to_snapshot = tc2_snapshot; - mem_dump_address = mem_dump_address_tc2; - } - else if(strcmp(argv[idx],"-stm") == 0) - { - test_protocol = OCSD_PROTOCOL_STM; - trace_data_filename = stmtrace_data_filename; - } - else if(strcmp(argv[idx],"-test_cb") == 0) - { - using_mem_acc_cb = 1; - } - else if(strcmp(argv[idx],"-test_region_file") == 0) - { - use_region_file = 1; - } - else - printf("Ignored unknown argument %s\n", argv[idx]); - idx++; - } -} - -/* Callback function to process the packets in the stream - - simply print them out in this case - */ -ocsd_datapath_resp_t packet_handler(const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const void *p_packet_in) -{ - ocsd_datapath_resp_t resp = OCSD_RESP_CONT; - int offset = 0; - - switch(op) - { - default: break; - case OCSD_OP_DATA: - sprintf(packet_str,"Idx:%" OCSD_TRC_IDX_STR "; ", index_sop); - offset = strlen(packet_str); - - /* got a packet - convert to string and use the libraries' message output to print to file and stdoout */ - if(ocsd_pkt_str(test_protocol,p_packet_in,packet_str+offset,PACKET_STR_LEN-offset) == OCSD_OK) - { - /* add in <CR> */ - if(strlen(packet_str) == PACKET_STR_LEN - 1) /* maximum length */ - packet_str[PACKET_STR_LEN-2] = '\n'; - else - strcat(packet_str,"\n"); - - /* print it using the library output logger. */ - ocsd_def_errlog_msgout(packet_str); - } - else - resp = OCSD_RESP_FATAL_INVALID_PARAM; /* mark fatal error */ - break; - - case OCSD_OP_EOT: - sprintf(packet_str,"**** END OF TRACE ****\n"); - ocsd_def_errlog_msgout(packet_str); - break; - } - - return resp; -} - -/* decode memory access using a CB function -* tests CB API and add / remove mem acc API. -*/ -static FILE *dump_file = NULL; -static ocsd_mem_space_acc_t dump_file_mem_space = OCSD_MEM_SPACE_ANY; -static long mem_file_size = 0; -static ocsd_vaddr_t mem_file_en_address = 0; /* end address last inclusive address in file. */ - -static uint32_t mem_acc_cb(const void *p_context, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint32_t reqBytes, uint8_t *byteBuffer) -{ - uint32_t read_bytes = 0; - size_t file_read_bytes; - - if(dump_file == NULL) - return 0; - - /* bitwise & the incoming mem space and supported mem space to confirm coverage */ - if(((uint8_t)mem_space & (uint8_t)dump_file_mem_space ) == 0) - return 0; - - /* calculate the bytes that can be read */ - if((address >= mem_dump_address) && (address <= mem_file_en_address)) - { - /* some bytes in our range */ - read_bytes = reqBytes; - - if((address + reqBytes - 1) > mem_file_en_address) - { - /* more than are available - just read the available */ - read_bytes = (uint32_t)(mem_file_en_address - (address - 1)); - } - } - - /* read some bytes if more than 0 to read. */ - if(read_bytes != 0) - { - fseek(dump_file,(long)(address-mem_dump_address),SEEK_SET); - file_read_bytes = fread(byteBuffer,sizeof(uint8_t),read_bytes,dump_file); - if(file_read_bytes < read_bytes) - read_bytes = file_read_bytes; - } - return read_bytes; -} - -static ocsd_err_t create_mem_acc_cb(dcd_tree_handle_t dcd_tree_h, const char *mem_file_path) -{ - ocsd_err_t err = OCSD_OK; - dump_file = fopen(mem_file_path,"rb"); - if(dump_file != NULL) - { - fseek(dump_file,0,SEEK_END); - mem_file_size = ftell(dump_file); - mem_file_en_address = mem_dump_address + mem_file_size - 1; - - err = ocsd_dt_add_callback_mem_acc(dcd_tree_h, - mem_dump_address,mem_file_en_address,dump_file_mem_space,&mem_acc_cb,0); - if(err != OCSD_OK) - { - fclose(dump_file); - dump_file = NULL; - } - } - else - err = OCSD_ERR_MEM_ACC_FILE_NOT_FOUND; - return err; -} - -static void destroy_mem_acc_cb(dcd_tree_handle_t dcd_tree_h) -{ - if(dump_file != NULL) - { - ocsd_dt_remove_mem_acc(dcd_tree_h,mem_dump_address,dump_file_mem_space); - fclose(dump_file); - dump_file = NULL; - } -} - -void packet_monitor(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) -{ - int offset = 0; - - switch(op) - { - default: break; - case OCSD_OP_DATA: - sprintf(packet_str,"Idx:%" OCSD_TRC_IDX_STR ";", index_sop); - offset = strlen(packet_str); - offset+= print_data_array(p_data,size,packet_str+offset,PACKET_STR_LEN-offset); - - /* got a packet - convert to string and use the libraries' message output to print to file and stdoout */ - if(ocsd_pkt_str(test_protocol,p_packet_in,packet_str+offset,PACKET_STR_LEN-offset) == OCSD_OK) - { - /* add in <CR> */ - if(strlen(packet_str) == PACKET_STR_LEN - 1) /* maximum length */ - packet_str[PACKET_STR_LEN-2] = '\n'; - else - strcat(packet_str,"\n"); - - /* print it using the library output logger. */ - ocsd_def_errlog_msgout(packet_str); - } - break; - - case OCSD_OP_EOT: - sprintf(packet_str,"**** END OF TRACE ****\n"); - ocsd_def_errlog_msgout(packet_str); - break; - } -} - -ocsd_datapath_resp_t gen_trace_elem_print(const void *p_context, const ocsd_trc_index_t index_sop, const uint8_t trc_chan_id, const ocsd_generic_trace_elem *elem) -{ - ocsd_datapath_resp_t resp = OCSD_RESP_CONT; - int offset = 0; - - sprintf(packet_str,"Idx:%" OCSD_TRC_IDX_STR "; TrcID:0x%02X; ", index_sop, trc_chan_id); - offset = strlen(packet_str); - - if(ocsd_gen_elem_str(elem, packet_str+offset,PACKET_STR_LEN - offset) == OCSD_OK) - { - /* add in <CR> */ - if(strlen(packet_str) == PACKET_STR_LEN - 1) /* maximum length */ - packet_str[PACKET_STR_LEN-2] = '\n'; - else - strcat(packet_str,"\n"); - } - else - { - strcat(packet_str,"Unable to create element string\n"); - } - - /* print it using the library output logger. */ - ocsd_def_errlog_msgout(packet_str); - - return resp; -} - -/************************************************************************/ -/*** ETMV4 ***/ -/************************************************************************/ - -/* hard coded values from snapshot .ini files */ -void set_config_struct_etmv4() -{ - trace_config.arch_ver = ARCH_V8; - trace_config.core_prof = profile_CortexA; - - trace_config.reg_configr = 0x000000C1; - trace_config.reg_traceidr = 0x00000010; /* this is the trace ID -> 0x10, change this to analyse other streams in snapshot.*/ - - if(test_trc_id_override != 0) - { - trace_config.reg_traceidr = (uint32_t)test_trc_id_override; - } - - trace_config.reg_idr0 = 0x28000EA1; - trace_config.reg_idr1 = 0x4100F403; - trace_config.reg_idr2 = 0x00000488; - trace_config.reg_idr8 = 0x0; - trace_config.reg_idr9 = 0x0; - trace_config.reg_idr10 = 0x0; - trace_config.reg_idr11 = 0x0; - trace_config.reg_idr12 = 0x0; - trace_config.reg_idr13 = 0x0; -} - -ocsd_datapath_resp_t etm_v4i_packet_handler(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_etmv4_i_pkt *p_packet_in) -{ - return packet_handler(op,index_sop,(const void *)p_packet_in); -} - - -void etm_v4i_packet_monitor( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_etmv4_i_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data) -{ - packet_monitor(op,index_sop,(void *)p_packet_in,size,p_data); -} - -static ocsd_err_t create_decoder_etmv4(dcd_tree_handle_t dcd_tree_h) -{ - ocsd_err_t ret = OCSD_OK; - char mem_file_path[512]; - int i; - uint32_t i0adjust = 0x100; - - /* populate the ETMv4 configuration structure */ - set_config_struct_etmv4(); - - if(op == TEST_PKT_PRINT) /* packet printing only */ - { - /* Create a packet processor on the decode tree for the ETM v4 configuration we have. - We need to supply the configuration, and a packet handling callback. - */ - ret = ocsd_dt_create_etmv4i_pkt_proc(dcd_tree_h,&trace_config,&etm_v4i_packet_handler,0); - } - else - { - /* Full decode - need decoder, and memory dump */ - - /* create the packet decoder and packet processor pair */ - ret = ocsd_dt_create_etmv4i_decoder(dcd_tree_h,&trace_config); - if(ret == OCSD_OK) - { - if((op != TEST_PKT_DECODEONLY) && (ret == OCSD_OK)) - { - /* print the packets as well as the decode. */ - ret = ocsd_dt_attach_etmv4i_pkt_mon(dcd_tree_h, (uint8_t)(trace_config.reg_traceidr & 0xFF), etm_v4i_packet_monitor,0); - } - } - - /* trace data file path */ - strcpy(mem_file_path,default_path_to_snapshot); - strcat(mem_file_path,memory_dump_filename); - - if(ret == OCSD_OK) - { - if(using_mem_acc_cb) - { - ret = create_mem_acc_cb(dcd_tree_h,mem_file_path); - } - else - { - if(use_region_file) - { - dump_file = fopen(mem_file_path,"rb"); - if(dump_file != NULL) - { - fseek(dump_file,0,SEEK_END); - mem_file_size = ftell(dump_file); - fclose(dump_file); - - - /* populate the region list - split existing file into four regions */ - for(i = 0; i < 4; i++) - { - if(i != 0) - i0adjust = 0; - region_list[i].start_address = mem_dump_address + (i * mem_file_size/4) + i0adjust; - region_list[i].region_size = (mem_file_size/4) - i0adjust; - region_list[i].file_offset = (i * mem_file_size/4) + i0adjust; - } - - /* create a memory file accessor - full binary file */ - ret = ocsd_dt_add_binfile_region_mem_acc(dcd_tree_h,®ion_list[0],4,OCSD_MEM_SPACE_ANY,mem_file_path); - - } - else - ret = OCSD_ERR_MEM_ACC_FILE_NOT_FOUND; - } - else - { - /* create a memory file accessor - full binary file */ - ret = ocsd_dt_add_binfile_mem_acc(dcd_tree_h,mem_dump_address,OCSD_MEM_SPACE_ANY,mem_file_path); - } - } - } - } - return ret; -} - -/************************************************************************/ -/*** ETMV3 ***/ -/************************************************************************/ - -static void set_config_struct_etmv3() -{ - trace_config_etmv3.arch_ver = ARCH_V7; - trace_config_etmv3.core_prof = profile_CortexA; - trace_config_etmv3.reg_ccer = 0x344008F2; - trace_config_etmv3.reg_ctrl = 0x10001860; - trace_config_etmv3.reg_idr = 0x410CF250; - trace_config_etmv3.reg_trc_id = 0x010; - if(test_trc_id_override != 0) - { - trace_config_etmv3.reg_trc_id = (uint32_t)test_trc_id_override; - } -} - -ocsd_datapath_resp_t etm_v3_packet_handler(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_etmv3_pkt *p_packet_in) -{ - return packet_handler(op,index_sop,(const void *)p_packet_in); -} - -void etm_v3_packet_monitor( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_etmv3_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data) -{ - packet_monitor(op,index_sop,(void *)p_packet_in,size,p_data); -} - -static ocsd_err_t create_decoder_etmv3(dcd_tree_handle_t dcd_tree_h) -{ - ocsd_err_t ret = OCSD_OK; - char mem_file_path[512]; - - /* populate the ETMv3 configuration structure */ - set_config_struct_etmv3(); - - - if(op == TEST_PKT_PRINT) /* packet printing only */ - { - /* Create a packet processor on the decode tree for the ETM v4 configuration we have. - We need to supply the configuration, and a packet handling callback. - */ - ret = ocsd_dt_create_etmv3_pkt_proc(dcd_tree_h,&trace_config_etmv3,&etm_v3_packet_handler,0); - } - else - { - /* Full decode - need decoder, and memory dump */ - /* not supported in library at present */ - - - /* create the packet decoder and packet processor pair */ - ret = ocsd_dt_create_etmv3_decoder(dcd_tree_h,&trace_config_etmv3); - if(ret == OCSD_OK) - { - if((op != TEST_PKT_DECODEONLY) && (ret == OCSD_OK)) - { - ret = ocsd_dt_attach_etmv3_pkt_mon(dcd_tree_h, (uint8_t)(trace_config_etmv3.reg_trc_id & 0x7F), etm_v3_packet_monitor,0); - } - } - - /* trace data file path */ - strcpy(mem_file_path,tc2_snapshot); - strcat(mem_file_path,memory_dump_filename); - - if(ret == OCSD_OK) - { - /* create a memory file accessor */ - ret = ocsd_dt_add_binfile_mem_acc(dcd_tree_h,mem_dump_address,OCSD_MEM_SPACE_ANY,mem_file_path); - } - } - return ret; -} - -/************************************************************************/ -/*** PTM ***/ -/************************************************************************/ -/* hard coded values from snapshot .ini files */ -void set_config_struct_ptm() -{ - trace_config_ptm.arch_ver = ARCH_V7; - trace_config_ptm.core_prof = profile_CortexA; - trace_config_ptm.reg_ccer = 0x34C01AC2; - trace_config_ptm.reg_ctrl = 0x10001000; - trace_config_ptm.reg_idr = 0x411CF312; - trace_config_ptm.reg_trc_id = 0x013; - if(test_trc_id_override != 0) - { - trace_config_ptm.reg_trc_id = (uint32_t)test_trc_id_override; - } -} - -ocsd_datapath_resp_t ptm_packet_handler(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_ptm_pkt *p_packet_in) -{ - return packet_handler(op,index_sop,(const void *)p_packet_in); -} - -void ptm_packet_monitor( const void *p_context, - const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_ptm_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data) -{ - packet_monitor(op,index_sop,(void *)p_packet_in,size,p_data); -} - -static ocsd_err_t create_decoder_ptm(dcd_tree_handle_t dcd_tree_h) -{ - ocsd_err_t ret = OCSD_OK; - char mem_file_path[512]; - int i; - uint32_t i0adjust = 0x100; - - /* populate the PTM configuration structure */ - set_config_struct_ptm(); - - if(op == TEST_PKT_PRINT) /* packet printing only */ - { - /* Create a packet processor on the decode tree for the PTM configuration we have. - We need to supply the configuration, and a packet handling callback. - */ - ret = ocsd_dt_create_ptm_pkt_proc(dcd_tree_h,&trace_config_ptm,&ptm_packet_handler,0); - } - else - { - /* Full decode - need decoder, and memory dump */ - - /* create the packet decoder and packet processor pair */ - ret = ocsd_dt_create_ptm_decoder(dcd_tree_h,&trace_config_ptm); - if(ret == OCSD_OK) - { - if((op != TEST_PKT_DECODEONLY) && (ret == OCSD_OK)) - { - /* print the packets as well as the decode. */ - ret = ocsd_dt_attach_ptm_pkt_mon(dcd_tree_h, (uint8_t)(trace_config_ptm.reg_trc_id & 0xFF), ptm_packet_monitor,0); - } - } - - /* trace data file path */ - strcpy(mem_file_path,default_path_to_snapshot); - strcat(mem_file_path,memory_dump_filename); - - if(ret == OCSD_OK) - { - if(using_mem_acc_cb) - { - ret = create_mem_acc_cb(dcd_tree_h,mem_file_path); - } - else - { - if(use_region_file) - { - dump_file = fopen(mem_file_path,"rb"); - if(dump_file != NULL) - { - fseek(dump_file,0,SEEK_END); - mem_file_size = ftell(dump_file); - fclose(dump_file); - - - /* populate the region list - split existing file into four regions */ - for(i = 0; i < 4; i++) - { - if(i != 0) - i0adjust = 0; - region_list[i].start_address = mem_dump_address + (i * mem_file_size/4) + i0adjust; - region_list[i].region_size = (mem_file_size/4) - i0adjust; - region_list[i].file_offset = (i * mem_file_size/4) + i0adjust; - } - - /* create a memory file accessor - full binary file */ - ret = ocsd_dt_add_binfile_region_mem_acc(dcd_tree_h,®ion_list[0],4,OCSD_MEM_SPACE_ANY,mem_file_path); - - } - else - ret = OCSD_ERR_MEM_ACC_FILE_NOT_FOUND; - } - else - { - /* create a memory file accessor - full binary file */ - ret = ocsd_dt_add_binfile_mem_acc(dcd_tree_h,mem_dump_address,OCSD_MEM_SPACE_ANY,mem_file_path); - } - } - } - } - return ret; -} - - -/************************************************************************/ -/*** STM ***/ -/************************************************************************/ - -#define STMTCSR_TRC_ID_MASK 0x007F0000 -#define STMTCSR_TRC_ID_SHIFT 16 -static void set_config_struct_stm() -{ - trace_config_stm.reg_tcsr = 0x00A00005; - if(test_trc_id_override != 0) - { - trace_config_stm.reg_tcsr &= ~STMTCSR_TRC_ID_MASK; - trace_config_stm.reg_tcsr |= ((((uint32_t)test_trc_id_override) << STMTCSR_TRC_ID_SHIFT) & STMTCSR_TRC_ID_MASK); - } - trace_config_stm.reg_feat3r = 0x10000; /* channel default */ - trace_config_stm.reg_devid = 0xFF; /* master default */ - - /* not using hw event trace decode */ - trace_config_stm.reg_hwev_mast = 0; - trace_config_stm.reg_feat1r = 0; - trace_config_stm.hw_event = HwEvent_Unknown_Disabled; -} - -ocsd_datapath_resp_t stm_packet_handler(const void *p_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const ocsd_stm_pkt *p_packet_in) -{ - return packet_handler(op,index_sop,(const void *)p_packet_in); -} - -void stm_packet_monitor( const ocsd_datapath_op_t op, - const ocsd_trc_index_t index_sop, - const ocsd_stm_pkt *p_packet_in, - const uint32_t size, - const uint8_t *p_data) -{ - packet_monitor(op,index_sop,(void *)p_packet_in,size,p_data); -} - -static ocsd_err_t create_decoder_stm(dcd_tree_handle_t dcd_tree_h) -{ - ocsd_err_t ret = OCSD_OK; - /*char mem_file_path[512];*/ - - /* populate the STM configuration structure */ - set_config_struct_stm(); - - - if(op == TEST_PKT_PRINT) /* packet printing only */ - { - /* Create a packet processor on the decode tree for the ETM v4 configuration we have. - We need to supply the configuration, and a packet handling callback. - */ - ret = ocsd_dt_create_stm_pkt_proc(dcd_tree_h,&trace_config_stm,&stm_packet_handler,0); - } - else - { - /* Full decode */ - /* not supported in library at present */ - - printf("STM Full decode not supported in library at present. Packet print only\n"); - ret = OCSD_ERR_RDR_NO_DECODER; - } - return ret; -} - - - -/************************************************************************/ - -/* create a decoder according to options */ -static ocsd_err_t create_decoder(dcd_tree_handle_t dcd_tree_h) -{ - ocsd_err_t err = OCSD_OK; - switch(test_protocol) - { - case OCSD_PROTOCOL_ETMV4I: - err = create_decoder_etmv4(dcd_tree_h); - break; - - case OCSD_PROTOCOL_ETMV3: - err = create_decoder_etmv3(dcd_tree_h); - break; - - case OCSD_PROTOCOL_STM: - err = create_decoder_stm(dcd_tree_h); - break; - - case OCSD_PROTOCOL_PTM: - err = create_decoder_ptm(dcd_tree_h); - break; - - default: - err = OCSD_ERR_NO_PROTOCOL; - break; - } - return err; -} - -#define INPUT_BLOCK_SIZE 1024 - -/* process buffer until done or error */ -ocsd_err_t process_data_block(dcd_tree_handle_t dcd_tree_h, int block_index, uint8_t *p_block, const int block_size) -{ - ocsd_err_t ret = OCSD_OK; - uint32_t bytes_done = 0; - ocsd_datapath_resp_t dp_ret = OCSD_RESP_CONT; - uint32_t bytes_this_time = 0; - - while((bytes_done < (uint32_t)block_size) && (ret == OCSD_OK)) - { - if(OCSD_DATA_RESP_IS_CONT(dp_ret)) - { - dp_ret = ocsd_dt_process_data(dcd_tree_h, - OCSD_OP_DATA, - block_index+bytes_done, - block_size-bytes_done, - ((uint8_t *)p_block)+bytes_done, - &bytes_this_time); - bytes_done += bytes_this_time; - } - else if(OCSD_DATA_RESP_IS_WAIT(dp_ret)) - { - dp_ret = ocsd_dt_process_data(dcd_tree_h, OCSD_OP_FLUSH,0,0,NULL,NULL); - } - else - ret = OCSD_ERR_DATA_DECODE_FATAL; /* data path responded with an error - stop processing */ - } - return ret; -} - -int process_trace_data(FILE *pf) -{ - ocsd_err_t ret = OCSD_OK; - dcd_tree_handle_t dcdtree_handle = C_API_INVALID_TREE_HANDLE; - uint8_t data_buffer[INPUT_BLOCK_SIZE]; - ocsd_trc_index_t index = 0; - size_t data_read; - - - /* Create a decode tree for this source data. - source data is frame formatted, memory aligned from an ETR (no frame syncs) so create tree accordingly - */ - dcdtree_handle = ocsd_create_dcd_tree(OCSD_TRC_SRC_FRAME_FORMATTED, OCSD_DFRMTR_FRAME_MEM_ALIGN); - - if(dcdtree_handle != C_API_INVALID_TREE_HANDLE) - { - - ret = create_decoder(dcdtree_handle); - ocsd_tl_log_mapped_mem_ranges(dcdtree_handle); - - if(ret == OCSD_OK) - /* attach the generic trace element output callback */ - ret = ocsd_dt_set_gen_elem_outfn(dcdtree_handle,gen_trace_elem_print,0); - - /* now push the trace data through the packet processor */ - while(!feof(pf) && (ret == OCSD_OK)) - { - /* read from file */ - data_read = fread(data_buffer,1,INPUT_BLOCK_SIZE,pf); - if(data_read > 0) - { - /* process a block of data - any packets from the trace stream - we have configured will appear at the callback - */ - ret = process_data_block(dcdtree_handle, - index, - data_buffer, - data_read); - index += data_read; - } - else if(ferror(pf)) - ret = OCSD_ERR_FILE_ERROR; - } - - /* no errors - let the data path know we are at end of trace */ - if(ret == OCSD_OK) - ocsd_dt_process_data(dcdtree_handle, OCSD_OP_EOT, 0,0,NULL,NULL); - - - /* shut down the mem acc CB if in use. */ - if(using_mem_acc_cb) - { - destroy_mem_acc_cb(dcdtree_handle); - } - - /* dispose of the decode tree - which will dispose of any packet processors we created - */ - ocsd_destroy_dcd_tree(dcdtree_handle); - } - else - { - printf("Failed to create trace decode tree\n"); - ret = OCSD_ERR_NOT_INIT; - } - return (int)ret; -} - -int main(int argc, char *argv[]) -{ - FILE *trace_data; - char trace_file_path[512]; - int ret = 0; - char message[512]; - - /* command line params */ - process_cmd_line(argc,argv); - - /* trace data file path */ - strcpy(trace_file_path,default_path_to_snapshot); - strcat(trace_file_path,trace_data_filename); - trace_data = fopen(trace_file_path,"rb"); - - if(trace_data != NULL) - { - /* set up the logging in the library - enable the error logger, with an output printer*/ - ret = ocsd_def_errlog_init(OCSD_ERR_SEV_INFO,1); - - /* set up the output - to file and stdout, set custom logfile name */ - if(ret == 0) - ret = ocsd_def_errlog_config_output(C_API_MSGLOGOUT_FLG_FILE | C_API_MSGLOGOUT_FLG_STDOUT, "c_api_test.log"); - - /* print sign-on message in log */ - sprintf(message, "C-API packet print test\nLibrary Version %s\n\n",ocsd_get_version_str()); - ocsd_def_errlog_msgout(message); - - - /* process the trace data */ - if(ret == 0) - ret = process_trace_data(trace_data); - - /* close the data file */ - fclose(trace_data); - } - else - { - printf("Unable to open file %s to process trace data\n", trace_file_path); - ret = -1; - } - return ret; -} -/* End of File simple_pkt_c_api.c */