-
Notifications
You must be signed in to change notification settings - Fork 0
/
SvdField.h
89 lines (67 loc) · 3.11 KB
/
SvdField.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Copyright (c) 2010-2021 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef SvdField_H
#define SvdField_H
#include "SvdTypes.h"
// Configuration
#define FIELD_MAX_BITWIDTH 64
#define FIELD_MAX_OFFSET (FIELD_MAX_BITWIDTH -1)
class SvdField;
class SvdFieldContainer : public SvdItem
{
public:
SvdFieldContainer(SvdItem* parent);
virtual ~SvdFieldContainer();
virtual bool Construct(XMLTreeElement* xmlElement);
virtual bool ProcessXmlElement(XMLTreeElement* xmlElement);
virtual bool CopyItem(SvdItem *from);
protected:
private:
};
class SvdEnumContainer;
class SvdEnum;
class SvdWriteConstraint;
class SvdField : public SvdItem
{
public:
SvdField(SvdItem* parent);
virtual ~SvdField();
virtual bool Calculate();
bool Construct(XMLTreeElement* xmlElement);
bool ProcessXmlElement(XMLTreeElement* xmlElement);
bool ProcessXmlAttributes(XMLTreeElement* xmlElement);
const std::list<SvdEnumContainer*>& GetEnumContainer() const { return (const std::list<SvdEnumContainer*>&)GetChildren(); }
virtual bool CopyItem(SvdItem *from);
bool GetValuesDescriptionString(std::string &longDescr);
virtual bool CheckItem();
virtual bool CalculateDim();
bool AddToMap(SvdEnum *enu, std::map<std::string, SvdEnum*> &map);
bool AddToMap(SvdEnumContainer *enu, std::map<std::string, SvdEnumContainer*> &map);
bool AddToMap(SvdEnum *enu, std::map<uint32_t, SvdEnum*> &map);
virtual uint64_t GetAddress () { return m_offset; }
uint64_t GetOffset () { return m_offset; }
SvdTypes::Access GetAccess () { return m_access; }
SvdTypes::ModifiedWriteValue GetModifiedWriteValue () { return m_modifiedWriteValues; }
SvdTypes::ReadAction GetReadAction () { return m_readAction; }
bool SetOffset (uint64_t offset ) { m_offset = offset ; return true; }
bool SetAccess (SvdTypes::Access access ) { m_access = access ; return true; }
bool SetModifiedWriteValue (SvdTypes::ModifiedWriteValue modifiedWriteValues) { m_modifiedWriteValues = modifiedWriteValues; return true; }
bool SetReadAction (SvdTypes::ReadAction readAction ) { m_readAction = readAction ; return true; }
uint32_t GetLsb() { return m_lsb; }
uint32_t GetMsb() { return m_msb; }
bool SetLsb(uint32_t lsb) { m_lsb = lsb; return true; }
bool SetMsb(uint32_t msb) { m_msb = msb; return true; }
protected:
private:
SvdWriteConstraint *m_writeConstraint;
uint32_t m_lsb;
uint32_t m_msb;
uint64_t m_offset;
SvdTypes::Access m_access;
SvdTypes::ModifiedWriteValue m_modifiedWriteValues;
SvdTypes::ReadAction m_readAction;
};
#endif // SvdField_H