Skip to content

Commit cb7fb18

Browse files
authored
[svdconv] add protection handling to SvdItem::CopyItem and add SvdItem::SetProtection
1 parent d1fa6c5 commit cb7fb18

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

tools/svdconv/SVDModel/include/SvdItem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class SvdItem : public SvdElement {
183183
std::string GetHierarchicalNameResulting ();
184184
std::string TryGetHeaderStructName (SvdItem *item);
185185
const std::string& GetPeripheralName ();
186+
bool SetProtection (SvdTypes::ProtectionType protection) { m_protection = protection; return true; }
186187
SvdTypes::ProtectionType GetProtection () { return m_protection; }
187188
std::string GetDeriveName ();
188189
SvdItem* GetParent () { return m_parent; }

tools/svdconv/SVDModel/src/SvdItem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,13 +895,15 @@ bool SvdItem::CopyItem(SvdItem *from)
895895
const auto lineNo = GetLineNumber ();
896896
const auto bitWidth = GetBitWidth ();
897897
const auto dimElementIndex = GetDimElementIndex();
898+
const auto protection = GetProtection ();
898899

899900
if(name == "") { SetName (from->GetName ()); }
900901
if(dispName == "") { SetDisplayName (from->GetDisplayName ()); }
901902
if(descr == "") { SetDescription (from->GetDescription ()); }
902903
if(lineNo == -1) { SetLineNumber (from->GetLineNumber ()); }
903904
if(bitWidth == (int32_t)SvdItem::VALUE32_NOT_INIT){ SetBitWidth (from->GetBitWidth ()); }
904905
if(dimElementIndex == SvdItem::VALUE32_NOT_INIT) { SetDimElementIndex(from->GetDimElementIndex()); }
906+
if(protection == SvdTypes::ProtectionType::UNDEF) { SetProtection (from->GetProtection ()); }
905907

906908
string tag = "Copied ";
907909
const string &oldTag = GetTag();

0 commit comments

Comments
 (0)