Const placement consistency

This commit is contained in:
Nav
2021-10-13 23:59:05 +01:00
parent 1e3f76f040
commit d6aa2ec91a
7 changed files with 72 additions and 72 deletions

View File

@@ -18,70 +18,70 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
struct Avr8EdbgParameters struct Avr8EdbgParameters
{ {
constexpr static Avr8EdbgParameter CONFIG_VARIANT {0x00, 0x00}; static constexpr Avr8EdbgParameter CONFIG_VARIANT {0x00, 0x00};
constexpr static Avr8EdbgParameter CONFIG_FUNCTION {0x00, 0x01}; static constexpr Avr8EdbgParameter CONFIG_FUNCTION {0x00, 0x01};
constexpr static Avr8EdbgParameter PHYSICAL_INTERFACE {0x01, 0x00}; static constexpr Avr8EdbgParameter PHYSICAL_INTERFACE {0x01, 0x00};
constexpr static Avr8EdbgParameter DW_CLOCK_DIVISION_FACTOR {0x01, 0x10}; static constexpr Avr8EdbgParameter DW_CLOCK_DIVISION_FACTOR {0x01, 0x10};
constexpr static Avr8EdbgParameter PDI_CLOCK_SPEED {0x01, 0x31}; static constexpr Avr8EdbgParameter PDI_CLOCK_SPEED {0x01, 0x31};
constexpr static Avr8EdbgParameter MEGA_DEBUG_CLOCK {0x01, 0x21}; static constexpr Avr8EdbgParameter MEGA_DEBUG_CLOCK {0x01, 0x21};
constexpr static Avr8EdbgParameter JTAG_DAISY_CHAIN_SETTINGS {0x01, 0x01}; static constexpr Avr8EdbgParameter JTAG_DAISY_CHAIN_SETTINGS {0x01, 0x01};
// debugWire and JTAG parameters // debugWire and JTAG parameters
constexpr static Avr8EdbgParameter DEVICE_BOOT_START_ADDR {0x02, 0x0A}; static constexpr Avr8EdbgParameter DEVICE_BOOT_START_ADDR {0x02, 0x0A};
constexpr static Avr8EdbgParameter DEVICE_FLASH_BASE {0x02, 0x06}; static constexpr Avr8EdbgParameter DEVICE_FLASH_BASE {0x02, 0x06};
constexpr static Avr8EdbgParameter DEVICE_SRAM_START {0x02, 0x0E}; static constexpr Avr8EdbgParameter DEVICE_SRAM_START {0x02, 0x0E};
constexpr static Avr8EdbgParameter DEVICE_EEPROM_SIZE {0x02, 0x10}; static constexpr Avr8EdbgParameter DEVICE_EEPROM_SIZE {0x02, 0x10};
constexpr static Avr8EdbgParameter DEVICE_EEPROM_PAGE_SIZE {0x02, 0x12}; static constexpr Avr8EdbgParameter DEVICE_EEPROM_PAGE_SIZE {0x02, 0x12};
constexpr static Avr8EdbgParameter DEVICE_FLASH_PAGE_SIZE {0x02, 0x00}; static constexpr Avr8EdbgParameter DEVICE_FLASH_PAGE_SIZE {0x02, 0x00};
constexpr static Avr8EdbgParameter DEVICE_FLASH_SIZE {0x02, 0x02}; static constexpr Avr8EdbgParameter DEVICE_FLASH_SIZE {0x02, 0x02};
constexpr static Avr8EdbgParameter DEVICE_OCD_REVISION {0x02, 0x13}; static constexpr Avr8EdbgParameter DEVICE_OCD_REVISION {0x02, 0x13};
constexpr static Avr8EdbgParameter DEVICE_OCD_DATA_REGISTER {0x02, 0x18}; static constexpr Avr8EdbgParameter DEVICE_OCD_DATA_REGISTER {0x02, 0x18};
constexpr static Avr8EdbgParameter DEVICE_SPMCR_REGISTER {0x02, 0x1D}; static constexpr Avr8EdbgParameter DEVICE_SPMCR_REGISTER {0x02, 0x1D};
constexpr static Avr8EdbgParameter DEVICE_OSCCAL_ADDR {0x02, 0x1E}; static constexpr Avr8EdbgParameter DEVICE_OSCCAL_ADDR {0x02, 0x1E};
constexpr static Avr8EdbgParameter DEVICE_EEARH_ADDR {0x02, 0x19}; static constexpr Avr8EdbgParameter DEVICE_EEARH_ADDR {0x02, 0x19};
constexpr static Avr8EdbgParameter DEVICE_EEARL_ADDR {0x02, 0x1A}; static constexpr Avr8EdbgParameter DEVICE_EEARL_ADDR {0x02, 0x1A};
constexpr static Avr8EdbgParameter DEVICE_EECR_ADDR {0x02, 0x1B}; static constexpr Avr8EdbgParameter DEVICE_EECR_ADDR {0x02, 0x1B};
constexpr static Avr8EdbgParameter DEVICE_EEDR_ADDR {0x02, 0x1C}; static constexpr Avr8EdbgParameter DEVICE_EEDR_ADDR {0x02, 0x1C};
// PDI/XMega device parameters // PDI/XMega device parameters
constexpr static Avr8EdbgParameter DEVICE_XMEGA_APPL_BASE_ADDR {0x02, 0x00}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_APPL_BASE_ADDR {0x02, 0x00};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_BOOT_BASE_ADDR {0x02, 0x04}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_BOOT_BASE_ADDR {0x02, 0x04};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_BASE_ADDR {0x02, 0x08}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_BASE_ADDR {0x02, 0x08};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_FUSE_BASE_ADDR {0x02, 0x0C}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_FUSE_BASE_ADDR {0x02, 0x0C};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_LOCKBIT_BASE_ADDR {0x02, 0x10}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_LOCKBIT_BASE_ADDR {0x02, 0x10};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_USER_SIGN_BASE_ADDR {0x02, 0x14}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_USER_SIGN_BASE_ADDR {0x02, 0x14};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_PROD_SIGN_BASE_ADDR {0x02, 0x18}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_PROD_SIGN_BASE_ADDR {0x02, 0x18};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_DATA_BASE_ADDR {0x02, 0x1C}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_DATA_BASE_ADDR {0x02, 0x1C};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_APPLICATION_BYTES {0x02, 0x20}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_APPLICATION_BYTES {0x02, 0x20};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_BOOT_BYTES {0x02, 0x24}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_BOOT_BYTES {0x02, 0x24};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_NVM_BASE {0x02, 0x2B}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_NVM_BASE {0x02, 0x2B};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_SIGNATURE_OFFSET {0x02, 0x2D}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_SIGNATURE_OFFSET {0x02, 0x2D};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_FLASH_PAGE_BYTES {0x02, 0x26}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_FLASH_PAGE_BYTES {0x02, 0x26};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_SIZE {0x02, 0x28}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_SIZE {0x02, 0x28};
constexpr static Avr8EdbgParameter DEVICE_XMEGA_EEPROM_PAGE_SIZE {0x02, 0x2A}; static constexpr Avr8EdbgParameter DEVICE_XMEGA_EEPROM_PAGE_SIZE {0x02, 0x2A};
// UPDI device parameters // UPDI device parameters
constexpr static Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR {0x02, 0x00}; static constexpr Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR {0x02, 0x00};
constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE {0x02, 0x02}; static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE {0x02, 0x02};
constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_PAGE_SIZE {0x02, 0x03}; static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_PAGE_SIZE {0x02, 0x03};
constexpr static Avr8EdbgParameter DEVICE_UPDI_NVMCTRL_ADDR {0x02, 0x04}; static constexpr Avr8EdbgParameter DEVICE_UPDI_NVMCTRL_ADDR {0x02, 0x04};
constexpr static Avr8EdbgParameter DEVICE_UPDI_OCD_ADDR {0x02, 0x06}; static constexpr Avr8EdbgParameter DEVICE_UPDI_OCD_ADDR {0x02, 0x06};
constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_SIZE {0x02, 0x12}; static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_SIZE {0x02, 0x12};
constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_SIZE {0x02, 0x16}; static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_SIZE {0x02, 0x16};
constexpr static Avr8EdbgParameter DEVICE_UPDI_USER_SIG_SIZE {0x02, 0x18}; static constexpr Avr8EdbgParameter DEVICE_UPDI_USER_SIG_SIZE {0x02, 0x18};
constexpr static Avr8EdbgParameter DEVICE_UPDI_FUSE_SIZE {0x02, 0x1A}; static constexpr Avr8EdbgParameter DEVICE_UPDI_FUSE_SIZE {0x02, 0x1A};
constexpr static Avr8EdbgParameter DEVICE_UPDI_EEPROM_BASE_ADDR {0x02, 0x20}; static constexpr Avr8EdbgParameter DEVICE_UPDI_EEPROM_BASE_ADDR {0x02, 0x20};
constexpr static Avr8EdbgParameter DEVICE_UPDI_USER_SIG_BASE_ADDR {0x02, 0x22}; static constexpr Avr8EdbgParameter DEVICE_UPDI_USER_SIG_BASE_ADDR {0x02, 0x22};
constexpr static Avr8EdbgParameter DEVICE_UPDI_SIG_BASE_ADDR {0x02, 0x24}; static constexpr Avr8EdbgParameter DEVICE_UPDI_SIG_BASE_ADDR {0x02, 0x24};
constexpr static Avr8EdbgParameter DEVICE_UPDI_FUSE_BASE_ADDR {0x02, 0x26}; static constexpr Avr8EdbgParameter DEVICE_UPDI_FUSE_BASE_ADDR {0x02, 0x26};
constexpr static Avr8EdbgParameter DEVICE_UPDI_LOCK_BASE_ADDR {0x02, 0x28}; static constexpr Avr8EdbgParameter DEVICE_UPDI_LOCK_BASE_ADDR {0x02, 0x28};
constexpr static Avr8EdbgParameter DEVICE_UPDI_DEVICE_ID {0x02, 0x2A}; static constexpr Avr8EdbgParameter DEVICE_UPDI_DEVICE_ID {0x02, 0x2A};
constexpr static Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR_MSB {0x02, 0x2C}; static constexpr Avr8EdbgParameter DEVICE_UPDI_PROGMEM_BASE_ADDR_MSB {0x02, 0x2C};
constexpr static Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE_MSB {0x02, 0x2D}; static constexpr Avr8EdbgParameter DEVICE_UPDI_FLASH_PAGE_SIZE_MSB {0x02, 0x2D};
constexpr static Avr8EdbgParameter DEVICE_UPDI_24_BIT_ADDRESSING_ENABLE {0x02, 0x2E}; static constexpr Avr8EdbgParameter DEVICE_UPDI_24_BIT_ADDRESSING_ENABLE {0x02, 0x2E};
constexpr static Avr8EdbgParameter RUN_TIMERS_WHILST_STOPPED {0x03, 0x00}; static constexpr Avr8EdbgParameter RUN_TIMERS_WHILST_STOPPED {0x03, 0x00};
constexpr static Avr8EdbgParameter ENABLE_HIGH_VOLTAGE_UPDI {0x03, 0x06}; static constexpr Avr8EdbgParameter ENABLE_HIGH_VOLTAGE_UPDI {0x03, 0x06};
}; };
enum class Avr8ConfigVariant: unsigned char enum class Avr8ConfigVariant: unsigned char

View File

@@ -29,7 +29,7 @@ std::vector<unsigned char> ReadMemory::getPayload() const {
output[10] = static_cast<unsigned char>(this->bytes >> 24); output[10] = static_cast<unsigned char>(this->bytes >> 24);
if (!this->excludedAddresses.empty()) { if (!this->excludedAddresses.empty()) {
auto const endAddress = this->address + (this->bytes - 1); const auto endAddress = this->address + (this->bytes - 1);
constexpr auto byteBitSize = std::numeric_limits<unsigned char>::digits; constexpr auto byteBitSize = std::numeric_limits<unsigned char>::digits;
auto byteBitset = std::bitset<byteBitSize>(); auto byteBitset = std::bitset<byteBitSize>();

View File

@@ -69,7 +69,7 @@ void EventListener::dispatchEvent(const SharedGenericEventPointer& event) {
void EventListener::dispatchCurrentEvents() { void EventListener::dispatchCurrentEvents() {
auto events = this->getEvents(); auto events = this->getEvents();
for (auto const& event: events) { for (const auto& event: events) {
dispatchEvent(event); dispatchEvent(event);
} }
} }

View File

@@ -15,7 +15,7 @@ void EventManager::deregisterListener(size_t listenerId) {
void EventManager::triggerEvent(const std::shared_ptr<const Events::Event>& event) { void EventManager::triggerEvent(const std::shared_ptr<const Events::Event>& event) {
auto registerListenersLock = std::unique_lock(this->registerListenerMutex); auto registerListenersLock = std::unique_lock(this->registerListenerMutex);
for(auto const& [listenerId, listener] : this->registeredListeners) { for(const auto& [listenerId, listener] : this->registeredListeners) {
if (listener->isEventTypeRegistered(event->getType())) { if (listener->isEventTypeRegistered(event->getType())) {
listener->registerEvent(event); listener->registerEvent(event);
} }
@@ -25,7 +25,7 @@ void EventManager::triggerEvent(const std::shared_ptr<const Events::Event>& even
bool EventManager::isEventTypeListenedFor(Events::EventType eventType) { bool EventManager::isEventTypeListenedFor(Events::EventType eventType) {
auto registerListenersLock = std::unique_lock(this->registerListenerMutex); auto registerListenersLock = std::unique_lock(this->registerListenerMutex);
for(auto const& [listenerId, listener] : this->registeredListeners) { for(const auto& [listenerId, listener] : this->registeredListeners) {
if (listener->isEventTypeRegistered(eventType)) { if (listener->isEventTypeRegistered(eventType)) {
return true; return true;
} }

View File

@@ -18,8 +18,8 @@ namespace Bloom::Widgets
Q_OBJECT Q_OBJECT
public: public:
constexpr static int WIDTH = 23; static constexpr int WIDTH = 23;
constexpr static int HEIGHT = 30; static constexpr int HEIGHT = 30;
BitBodyWidget( BitBodyWidget(
int bitIndex, int bitIndex,

View File

@@ -20,15 +20,15 @@ namespace Bloom::Widgets
Q_OBJECT Q_OBJECT
private: private:
const static int VERTICAL_SPACING = 3; static const int VERTICAL_SPACING = 3;
public: public:
constexpr static int LABEL_HEIGHT = 14; static constexpr int LABEL_HEIGHT = 14;
constexpr static int LABEL_COUNT = 2; static constexpr int LABEL_COUNT = 2;
constexpr static int WIDTH = BitBodyWidget::WIDTH; static constexpr int WIDTH = BitBodyWidget::WIDTH;
constexpr static int HEIGHT = BitBodyWidget::HEIGHT + (BitWidget::LABEL_HEIGHT * BitWidget::LABEL_COUNT) static constexpr int HEIGHT = BitBodyWidget::HEIGHT + (BitWidget::LABEL_HEIGHT * BitWidget::LABEL_COUNT)
+ BitWidget::VERTICAL_SPACING; + BitWidget::VERTICAL_SPACING;
constexpr static int SPACING = 6; static constexpr int SPACING = 6;
BitWidget( BitWidget(
int bitIndex, int bitIndex,

View File

@@ -16,9 +16,9 @@ namespace Bloom::Widgets
Q_OBJECT Q_OBJECT
public: public:
constexpr static int VALUE_GRAPHIC_HEIGHT = 20; static constexpr int VALUE_GRAPHIC_HEIGHT = 20;
constexpr static int HEIGHT = BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT + 8; static constexpr int HEIGHT = BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT + 8;
constexpr static int WIDTH = (BitWidget::WIDTH + BitWidget::SPACING) * 8; static constexpr int WIDTH = (BitWidget::WIDTH + BitWidget::SPACING) * 8;
BitsetWidget(int byteNumber, unsigned char& byte, bool readOnly, QWidget* parent); BitsetWidget(int byteNumber, unsigned char& byte, bool readOnly, QWidget* parent);