Skip to content

Commit

Permalink
[svdconv] add protection handling to SvdItem::CopyItem and add SvdIte…
Browse files Browse the repository at this point in the history
…m::SetProtection
  • Loading branch information
ckudera authored Nov 13, 2024
1 parent d1fa6c5 commit cb7fb18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/svdconv/SVDModel/include/SvdItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class SvdItem : public SvdElement {
std::string GetHierarchicalNameResulting ();
std::string TryGetHeaderStructName (SvdItem *item);
const std::string& GetPeripheralName ();
bool SetProtection (SvdTypes::ProtectionType protection) { m_protection = protection; return true; }
SvdTypes::ProtectionType GetProtection () { return m_protection; }
std::string GetDeriveName ();
SvdItem* GetParent () { return m_parent; }
Expand Down
2 changes: 2 additions & 0 deletions tools/svdconv/SVDModel/src/SvdItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,15 @@ bool SvdItem::CopyItem(SvdItem *from)
const auto lineNo = GetLineNumber ();
const auto bitWidth = GetBitWidth ();
const auto dimElementIndex = GetDimElementIndex();
const auto protection = GetProtection ();

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

string tag = "Copied ";
const string &oldTag = GetTag();
Expand Down

0 comments on commit cb7fb18

Please sign in to comment.