OpenCSD - CoreSight Trace Decode Library
1.8.3
Toggle main menu visibility
Loading...
Searching...
No Matches
include
common
ocsd_gen_elem_list.h
Go to the documentation of this file.
1
/*
2
* \file ocsd_gen_elem_list.h
3
* \brief OpenCSD : Generic element output list.
4
*
5
* \copyright Copyright (c) 2016, 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 <list>
36
#include "
trc_gen_elem.h
"
37
#include "
comp_attach_pt_t.h
"
38
#include "
interfaces/trc_gen_elem_in_i.h
"
39
56
class
OcsdGenElemList
57
{
58
public
:
59
OcsdGenElemList
();
60
~OcsdGenElemList
();
61
62
void
initSendIf
(
componentAttachPt<ITrcGenElemIn>
*pGenElemIf);
63
void
initCSID
(
const
uint8_t CSID) { m_CSID = CSID; };
64
65
void
reset
();
66
67
OcsdTraceElement
*
getNextElem
(
const
ocsd_trc_index_t
trc_pkt_idx);
68
const
int
getNumElem
()
const
;
69
70
const
ocsd_gen_trc_elem_t
getElemType
(
const
int
entryN)
const
;
71
72
void
pendLastNElem
(
int
numPend);
73
void
commitAllPendElem
();
74
void
cancelPendElem
();
75
const
int
numPendElem
()
const
;
76
80
ocsd_datapath_resp_t
sendElements
();
81
const
bool
elemToSend
()
const
;
82
83
private
:
84
85
void
growArray();
86
const
int
getAdjustedIdx(
int
idxIn)
const
;
87
88
89
// list element contains pointer and byte index in trace stream
90
typedef
struct
_elemPtr {
91
OcsdTraceElement
*pElem;
92
ocsd_trc_index_t
trc_pkt_idx;
93
} elemPtr_t;
94
95
elemPtr_t *m_pElemArray;
96
int
m_elemArraySize;
97
98
int
m_firstElemIdx;
99
int
m_numUsed;
100
int
m_numPend;
101
102
uint8_t m_CSID;
103
104
componentAttachPt<ITrcGenElemIn>
*m_sendIf;
105
};
106
107
inline
const
int
OcsdGenElemList::getAdjustedIdx(
int
idxIn)
const
108
{
109
if
(idxIn >= m_elemArraySize)
110
idxIn -= m_elemArraySize;
111
return
idxIn;
112
}
113
114
inline
const
int
OcsdGenElemList::getNumElem
()
const
115
{
116
return
m_numUsed;
117
}
118
119
inline
const
int
OcsdGenElemList::numPendElem
()
const
120
{
121
return
m_numPend;
122
}
123
124
inline
void
OcsdGenElemList::pendLastNElem
(
int
numPend)
125
{
126
if
(numPend >=
getNumElem
())
127
m_numPend = numPend;
128
}
129
130
inline
void
OcsdGenElemList::commitAllPendElem
()
131
{
132
m_numPend = 0;
133
}
134
135
inline
void
OcsdGenElemList::cancelPendElem
()
136
{
137
if
(m_numPend > 0)
138
{
139
m_numUsed -= m_numPend;
140
}
141
}
142
143
inline
const
bool
OcsdGenElemList::elemToSend
()
const
144
{
145
return
((
getNumElem
() - m_numPend) > 0);
146
}
147
148
inline
void
OcsdGenElemList::initSendIf
(
componentAttachPt<ITrcGenElemIn>
*pGenElemIf)
149
{
150
m_sendIf = pGenElemIf;
151
}
152
153
/* End of File ocsd_gen_elem_list.h */
OcsdGenElemList::pendLastNElem
void pendLastNElem(int numPend)
Last element to be pended prior to cancel/commit decision.
Definition
ocsd_gen_elem_list.h:124
OcsdGenElemList::getNextElem
OcsdTraceElement * getNextElem(const ocsd_trc_index_t trc_pkt_idx)
get next free element on the stack (add one to the output)
OcsdGenElemList::reset
void reset()
reset the element list.
OcsdGenElemList::getNumElem
const int getNumElem() const
return the total number of elements on the stack (inlcuding any pended ones).
Definition
ocsd_gen_elem_list.h:114
OcsdGenElemList::initSendIf
void initSendIf(componentAttachPt< ITrcGenElemIn > *pGenElemIf)
Definition
ocsd_gen_elem_list.h:148
OcsdGenElemList::~OcsdGenElemList
~OcsdGenElemList()
OcsdGenElemList::sendElements
ocsd_datapath_resp_t sendElements()
OcsdGenElemList::elemToSend
const bool elemToSend() const
true if any none-pending elements left to send.
Definition
ocsd_gen_elem_list.h:143
OcsdGenElemList::getElemType
const ocsd_gen_trc_elem_t getElemType(const int entryN) const
get the type for the nth element in the stack (0 indexed)
OcsdGenElemList::cancelPendElem
void cancelPendElem()
cancel the last pended element on the stack.
Definition
ocsd_gen_elem_list.h:135
OcsdGenElemList::initCSID
void initCSID(const uint8_t CSID)
Definition
ocsd_gen_elem_list.h:63
OcsdGenElemList::OcsdGenElemList
OcsdGenElemList()
OcsdGenElemList::commitAllPendElem
void commitAllPendElem()
commit all pended elements.
Definition
ocsd_gen_elem_list.h:130
OcsdGenElemList::numPendElem
const int numPendElem() const
return the number of pended elements.
Definition
ocsd_gen_elem_list.h:119
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
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