OpenCSD - CoreSight Trace Decode Library
1.8.3
Toggle main menu visibility
Loading...
Searching...
No Matches
include
common
ocsd_gen_elem_stack.h
Go to the documentation of this file.
1
/*
2
* \file ocsd_gen_elem_stack.h
3
* \brief OpenCSD : Generic element output stack.
4
*
5
* \copyright Copyright (c) 2020, ARM Limited. All Rights Reserved.
6
*/
7
8
/*
9
* Redistribution and use in source and binary forms, with or without modification,
10
* are permitted provided that the following conditions are met:
11
*
12
* 1. Redistributions of source code must retain the above copyright notice,
13
* this list of conditions and the following disclaimer.
14
*
15
* 2. Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
*
19
* 3. Neither the name of the copyright holder nor the names of its contributors
20
* may be used to endorse or promote products derived from this software without
21
* specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#include "
trc_gen_elem.h
"
36
#include "
comp_attach_pt_t.h
"
37
#include "
interfaces/trc_gen_elem_in_i.h
"
38
39
/* element stack to handle cases where a trace element can generate multiple output packets
40
41
maintains the "current" element, which might be sent independently of this stack, and also
42
ensures that persistent data in the output elements is maintained between elements.
43
*/
44
class
OcsdGenElemStack
45
{
46
public
:
47
OcsdGenElemStack
();
48
~OcsdGenElemStack
();
49
50
void
initSendIf
(
componentAttachPt<ITrcGenElemIn>
*pGenElemIf);
51
void
initCSID
(
const
uint8_t CSID) { m_CSID = CSID; };
52
53
OcsdTraceElement
&
getCurrElem
();
54
ocsd_err_t
resetElemStack
();
55
ocsd_err_t
addElem
(
const
ocsd_trc_index_t
trc_pkt_idx);
56
void
setCurrElemIdx
(
const
ocsd_trc_index_t
trc_pkt_idx);
57
ocsd_err_t
addElemType
(
const
ocsd_trc_index_t
trc_pkt_idx,
ocsd_gen_trc_elem_t
elem_type);
58
59
ocsd_datapath_resp_t
sendElements
();
60
const
int
numElemToSend
()
const
;
61
62
private
:
63
typedef
struct
_elemPtr {
64
OcsdTraceElement
*pElem;
65
ocsd_trc_index_t
trc_pkt_idx;
66
} elemPtr_t;
67
68
const
bool
isInit();
69
70
ocsd_err_t
growArray();
71
void
copyPersistentData(
int
src,
int
dst);
72
void
resetIndexes();
73
74
elemPtr_t *m_pElemArray;
75
int
m_elemArraySize;
76
77
int
m_elem_to_send;
78
int
m_curr_elem_idx;
79
int
m_send_elem_idx;
80
82
uint8_t m_CSID;
83
componentAttachPt<ITrcGenElemIn>
*m_sendIf;
84
85
bool
m_is_init;
86
};
87
88
inline
const
int
OcsdGenElemStack::numElemToSend
()
const
89
{
90
return
m_elem_to_send;
91
}
92
93
inline
void
OcsdGenElemStack::initSendIf
(
componentAttachPt<ITrcGenElemIn>
*pGenElemIf)
94
{
95
m_sendIf = pGenElemIf;
96
}
97
98
inline
void
OcsdGenElemStack::setCurrElemIdx
(
const
ocsd_trc_index_t
trc_pkt_idx)
99
{
100
m_pElemArray[m_curr_elem_idx].trc_pkt_idx = trc_pkt_idx;
101
}
102
103
inline
OcsdTraceElement
&
OcsdGenElemStack::getCurrElem
()
104
{
105
return
*(m_pElemArray[m_curr_elem_idx].pElem);
106
}
107
108
109
/* End of File ocsd_gen_elem_stack.h */
OcsdGenElemStack::addElem
ocsd_err_t addElem(const ocsd_trc_index_t trc_pkt_idx)
add elem to stack and set current.
OcsdGenElemStack::getCurrElem
OcsdTraceElement & getCurrElem()
get the current element.
Definition
ocsd_gen_elem_stack.h:103
OcsdGenElemStack::numElemToSend
const int numElemToSend() const
Definition
ocsd_gen_elem_stack.h:88
OcsdGenElemStack::OcsdGenElemStack
OcsdGenElemStack()
OcsdGenElemStack::sendElements
ocsd_datapath_resp_t sendElements()
send elements on the stack
OcsdGenElemStack::setCurrElemIdx
void setCurrElemIdx(const ocsd_trc_index_t trc_pkt_idx)
packet index for this element
Definition
ocsd_gen_elem_stack.h:98
OcsdGenElemStack::resetElemStack
ocsd_err_t resetElemStack()
set pointers to base of stack
OcsdGenElemStack::addElemType
ocsd_err_t addElemType(const ocsd_trc_index_t trc_pkt_idx, ocsd_gen_trc_elem_t elem_type)
OcsdGenElemStack::initSendIf
void initSendIf(componentAttachPt< ITrcGenElemIn > *pGenElemIf)
Definition
ocsd_gen_elem_stack.h:93
OcsdGenElemStack::~OcsdGenElemStack
~OcsdGenElemStack()
OcsdGenElemStack::initCSID
void initCSID(const uint8_t CSID)
Definition
ocsd_gen_elem_stack.h:51
OcsdTraceElement
Generic trace element class.
Definition
trc_gen_elem.h:50
componentAttachPt
Single component interface pointer attachment point.
Definition
comp_attach_pt_t.h:61
comp_attach_pt_t.h
OpenCSD : Component attachment point interface class.
ocsd_gen_trc_elem_t
enum _ocsd_gen_trc_elem_t ocsd_gen_trc_elem_t
ocsd_trc_index_t
uint32_t ocsd_trc_index_t
Definition
ocsd_if_types.h:59
ocsd_datapath_resp_t
enum _ocsd_datapath_resp_t ocsd_datapath_resp_t
ocsd_err_t
enum _ocsd_err_t ocsd_err_t
trc_gen_elem.h
OpenCSD : Decoder Generic trace element output class.
trc_gen_elem_in_i.h
Generated on
for OpenCSD - CoreSight Trace Decode Library by
1.17.0