1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <stdbool.h>
18 
19 #include "eri.h"
20 #include "xtensa-debug-module.h"
21 
22 // Low-level Xtensa TRAX utils
23 
24 /**
25  * @brief  Start a Trax trace on the current CPU with instructions as unit of delay.
26  * Memory blocks to be used as Trax memory must be enabled before
27  * calling this function, if needed.
28  */
29 void xt_trax_start_trace_instructions(void);
30 
31 /**
32  * @brief  Start a Trax trace on the current CPU with words as unit of delay.
33  * Memory blocks to be used as Trax memory must be enabled before
34  * calling this function, if needed.
35  */
36 void xt_trax_start_trace_words(void);
37 
38 /**
39  * @brief Check if Trax trace is active on current CPU.
40  *
41  * @return bool. Return true if trace is active.
42  */
43 bool xt_trax_trace_is_active(void);
44 
45 /**
46  * @brief  Trigger a Trax trace stop after the indicated delay. If this is called
47  *         before and the previous delay hasn't ended yet, this will overwrite
48  *         that delay with the new value. The delay will always start at the time
49  *         the function is called.
50  *
51  * @param  delay : The delay to stop the trace in, in the unit indicated to
52  *              trax_start_trace. Note: the trace memory has 4K words available.
53  */
54 void xt_trax_trigger_traceend_after_delay(int delay);
55