diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
commit | f508189682b6fba62e08feeb1596f682bad5fff9 (patch) | |
tree | 28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/devices/pic/base/pic_protection.h | |
download | piklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip |
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/devices/pic/base/pic_protection.h')
-rw-r--r-- | src/devices/pic/base/pic_protection.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/devices/pic/base/pic_protection.h b/src/devices/pic/base/pic_protection.h new file mode 100644 index 0000000..67ff667 --- /dev/null +++ b/src/devices/pic/base/pic_protection.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef PIC_PROTECTION_H +#define PIC_PROTECTION_H + +#include "pic.h" + +namespace Pic +{ +class Data; + +//---------------------------------------------------------------------------- +class Protection +{ +public: + enum { MAX_NB_BLOCKS = 8 }; + enum Family { NoProtection = 0, BasicProtection, BlockProtection, CodeGuard, Nb_Families }; + enum Type { ProgramProtected = 0, WriteProtected, ReadProtected, + StandardSecurity, HighSecurity, Nb_Types }; + +public: + Protection(const Pic::Data &data, const Config &config) : _data(data), _config(config) {} + Family family() const; + QString securityValueName(Type type) const; + bool hasBootBlock() const; + QString bootSizeMaskName() const; + QString bootMaskName(Type ptype) const; + QString bootLabel() const; + uint nbBlocks() const; + QString blockSizeMaskName(uint i) const; + QString blockMaskName(Type ptype, uint i) const; + QString blockLabel(uint i) const; + AddressRangeVector extractRanges(const QString &name, MemoryRangeType type) const; + bool checkRange(const QString &mask, const QString &name) const; + QString maskName(Type type, MemoryRangeType mtype) const; + bool isAllProtectedValueName(const QString &valueName) const; + bool isNoneProtectedValueName(const QString &valueName) const; + +private: + const Pic::Data &_data; + const Config &_config; + + enum SegmentType { BootSegment = 0, SecureSegment, GeneralSegment, Nb_SegmentTypes }; + static bool extractRanges(const QString &name, QValueVector<Address> &starts, Address &end, bool &ok); + class ProtectedRange { + public: + QValueVector<Address> starts, ends; + }; + ProtectedRange extractRange(const QString &mask, const QString &name, bool &ok) const; +}; + +} //namespace + +#endif |