xref: /freebsd/contrib/opencsd/decoder/include/opencsd/trc_pkt_types.h (revision c120c5646da1a1d2c4d90fd069a7e2a8d559eb46)
1 /*!
2  * \file       opencsd/trc_pkt_types.h
3  * \brief      OpenCSD: Common "C" types for trace packets.
4  *
5  * \copyright  Copyright (c) 2015, ARM Limited. All Rights Reserved.
6  */
7 
8 
9 /*
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * 3. Neither the name of the copyright holder nor the names of its contributors
21  * may be used to endorse or promote products derived from this software without
22  * specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef ARM_TRC_PKT_TYPES_H_INCLUDED
37 #define ARM_TRC_PKT_TYPES_H_INCLUDED
38 
39 #include <stdint.h>
40 #include "opencsd/ocsd_if_types.h"
41 
42 /** @defgroup trc_pkts  OpenCSD Library : Trace Packet Types
43 
44     @brief Types used in trace packet description structures.
45 
46 @{*/
47 
48 
49 /** @name Common Packet Types
50 @{*/
51 
52 typedef enum _ocsd_pkt_va_size
53 {
54     VA_32BIT,
55     VA_64BIT
56 } ocsd_pkt_va_size;
57 
58 typedef struct _ocsd_pkt_vaddr
59 {
60     ocsd_pkt_va_size size;     /**< Virtual address size. */
61     ocsd_vaddr_t val;  /**< Current value */
62     uint8_t pkt_bits;   /**< Bits updated this packet */
63     uint8_t valid_bits; /**< Currently valid bits */
64 } ocsd_pkt_vaddr;
65 
66 typedef struct _ocsd_pkt_byte_sz_val
67 {
68     uint32_t val;
69     uint8_t  size_bytes;
70     uint8_t  valid_bytes;
71 } ocsd_pkt_byte_sz_val;
72 
73 typedef enum _ocsd_pkt_atm_type
74 {
75     ATOM_PATTERN,   /**< set atom packet using pattern supplied */
76     ATOM_REPEAT     /**< set atom packet using repeat value (convert to pattern) */
77 } ocsd_pkt_atm_type;
78 
79 typedef enum _ocsd_atm_val {
80     ATOM_N,
81     ATOM_E
82 } ocsd_atm_val;
83 
84 typedef struct _ocsd_pkt_atom
85 {
86     /** pattern across num bits.
87         Bit sequence:- ls bit = oldest atom (1st instruction executed), ms bit = newest (last instruction executed),
88         Bit values  :-  1'b1 = E atom, 1'b0 = N atom.
89       */
90     uint32_t En_bits;
91     uint8_t num;                /**< number of atoms represented */
92 } ocsd_pkt_atom;
93 
94 /** Isync Reason - common to PTM and ETMv3 **/
95 typedef enum _ocsd_iSync_reason {
96     iSync_Periodic = 0,
97     iSync_TraceEnable,
98     iSync_TraceRestartAfterOverflow,
99     iSync_DebugExit
100 } ocsd_iSync_reason;
101 
102 
103 typedef enum _ocsd_armv7_exception {
104     Excp_Reserved,
105     Excp_NoException,
106     Excp_Reset,
107     Excp_IRQ,
108     Excp_FIQ,
109     Excp_AsyncDAbort,
110     Excp_DebugHalt,
111     Excp_Jazelle,
112     Excp_SVC,
113     Excp_SMC,
114     Excp_Hyp,
115     Excp_Undef,
116     Excp_PrefAbort,
117     Excp_Generic,
118     Excp_SyncDataAbort,
119     Excp_CMUsageFault,
120     Excp_CMNMI,
121     Excp_CMDebugMonitor,
122     Excp_CMMemManage,
123     Excp_CMPendSV,
124     Excp_CMSysTick,
125     Excp_CMBusFault,
126     Excp_CMHardFault,
127     Excp_CMIRQn,
128     Excp_ThumbEECheckFail,
129 } ocsd_armv7_exception;
130 
131 /** @}*/
132 
133 /** @}*/
134 
135 #endif // ARM_TRC_PKT_TYPES_H_INCLUDED
136 
137 /* End of File opencsd/trc_pkt_types.h */
138