mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[Reviews] Code correction and improvement
This commit is contained in:
@@ -161,7 +161,7 @@ private:
|
||||
ExtendedCompatIDDescriptor m_extendedCompatIdDescriptor;
|
||||
|
||||
Descriptor * m_descriptors[8];
|
||||
/* m_descriptors contains only descriptors that sould be returned via the
|
||||
/* m_descriptors contains only descriptors that should be returned via the
|
||||
* method descriptor(uint8_t type, uint8_t index), so do not count descriptors
|
||||
* included in other descriptors or returned by other functions. */
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ void DFUInterface::eraseMemoryIfNeeded() {
|
||||
|
||||
willErase();
|
||||
|
||||
Bootloader::DFUData * config = getDfuConfig();
|
||||
Bootloader::ProtectionState * config = getDfuConfig();
|
||||
|
||||
if (config != nullptr) {
|
||||
// More simple to read
|
||||
@@ -242,7 +242,7 @@ void DFUInterface::writeOnMemory() {
|
||||
memcpy((void *)m_writeAddress, m_largeBuffer, m_largeBufferLength);
|
||||
} else if (Flash::SectorAtAddress(m_writeAddress) >= 0) {
|
||||
|
||||
Bootloader::DFUData * config = getDfuConfig();
|
||||
Bootloader::ProtectionState * config = getDfuConfig();
|
||||
|
||||
if (config != nullptr) {
|
||||
if (m_writeAddress >= 0x08000000 && m_writeAddress <= 0x08010000 && !m_dfuData.isProtectedInternal()) {
|
||||
@@ -306,7 +306,7 @@ void DFUInterface::leaveDFUAndReset() {
|
||||
}
|
||||
|
||||
void DFUInterface::copyDfuData() {
|
||||
m_dfuData = Bootloader::DFUData(!m_dfuConfig->isProtectedInternal(), !m_dfuConfig->isProtectedExternal());
|
||||
m_dfuData = Bootloader::ProtectionState(!m_dfuConfig->isProtectedInternal(), !m_dfuConfig->isProtectedExternal());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
void wholeDataSentCallback(SetupPacket * request, uint8_t * transferBuffer, uint16_t * transferBufferLength) override;
|
||||
bool isErasingAndWriting() const { return m_isErasingAndWriting; }
|
||||
|
||||
void setDfuConfig(Bootloader::DFUData * data) { m_dfuConfig = data; copyDfuData(); }
|
||||
Bootloader::DFUData * getDfuConfig() const { return m_dfuConfig; }
|
||||
void setDfuConfig(Bootloader::ProtectionState * data) { m_dfuConfig = data; copyDfuData(); }
|
||||
Bootloader::ProtectionState * getDfuConfig() const { return m_dfuConfig; }
|
||||
|
||||
protected:
|
||||
void setActiveInterfaceAlternative(uint8_t interfaceAlternativeIndex) override {
|
||||
@@ -180,9 +180,9 @@ private:
|
||||
uint32_t m_writeAddress;
|
||||
uint8_t m_bInterfaceAlternateSetting;
|
||||
bool m_isErasingAndWriting;
|
||||
Bootloader::DFUData * m_dfuConfig;
|
||||
Bootloader::ProtectionState * m_dfuConfig;
|
||||
uint32_t m_eraseAddress;
|
||||
Bootloader::DFUData m_dfuData;
|
||||
Bootloader::ProtectionState m_dfuData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
|
||||
#include "descriptor.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
|
||||
#include "device_capability_descriptor.h"
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ void initMPU() {
|
||||
* then an AHB error is given (AN4760). To prevent this to happen, we
|
||||
* configure the MPU to define the whole Quad-SPI addressable space as
|
||||
* strongly ordered, non-executable and not accessible. Plus, we define the
|
||||
* Quad-SPI region corresponding to the Expternal Chip as executable and
|
||||
* Quad-SPI region corresponding to the External Chip as executable and
|
||||
* fully accessible (AN4861). */
|
||||
MPU.RNR()->setREGION(sector++);
|
||||
MPU.RBAR()->setADDR(0x90000000);
|
||||
|
||||
@@ -51,7 +51,7 @@ bool waitForVBlank() {
|
||||
uint64_t startTime = Timing::millis();
|
||||
uint64_t timeout = startTime + timeoutDelta;
|
||||
|
||||
/* If current time is big enough, currentTime + timeout wraps aroud the
|
||||
/* If current time is big enough, currentTime + timeout wraps around the
|
||||
* uint64_t. We need to take this into account when computing the terminating
|
||||
* event.
|
||||
*
|
||||
|
||||
@@ -49,7 +49,7 @@ void jump(uint32_t jumpIsrVectorAddress) {
|
||||
// Disable cache before reset
|
||||
Ion::Device::Cache::disable();
|
||||
|
||||
/* Shutdown all clocks and periherals to mimic a hardware reset. */
|
||||
/* Shutdown all clocks and peripherals to mimic a hardware reset. */
|
||||
Board::shutdownPeripherals();
|
||||
internalFlashJump(jumpIsrVectorAddress);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Device {
|
||||
namespace WakeUp {
|
||||
|
||||
/* All wakeup functions can be called together without overwriting the same
|
||||
* register. All togethed, they will set SYSCFG and EXTi registers as follow:
|
||||
* register. All together, they will set SYSCFG and EXTi registers as follow:
|
||||
*
|
||||
* GPIO Pin Number|EXTI_EMR|EXTI_FTSR|EXTI_RTSR|EXTICR1|EXTICR2|EXTICR3| Wake up
|
||||
* ---------------+--------+---------+---------+-------+-------+-------+-------------------------
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
};
|
||||
|
||||
class CCMR : Register64 {
|
||||
/* We're declaring CCMR as a 64 bits register. CCMR doesn't exsist per se,
|
||||
/* We're declaring CCMR as a 64 bits register. CCMR doesn't exist per se,
|
||||
* it is in fact the consolidation of CCMR1 and CCMR2. Both are 16 bits
|
||||
* registers, so one could expect the consolidation to be 32 bits. However,
|
||||
* both CCMR1 and CCMR2 live on 32-bits boundaries, so the consolidation has
|
||||
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
ExtendedCompatIDDescriptor m_extendedCompatIdDescriptor;
|
||||
|
||||
Descriptor * m_descriptors[8];
|
||||
/* m_descriptors contains only descriptors that sould be returned via the
|
||||
/* m_descriptors contains only descriptors that should be returned via the
|
||||
* method descriptor(uint8_t type, uint8_t index), so do not count descriptors
|
||||
* included in other descriptors or returned by other functions. */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
|
||||
#include "descriptor.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABLITY_DESCRIPTOR_H
|
||||
#ifndef ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
#define ION_DEVICE_SHARED_USB_STACK_PLATFORM_DEVICE_CAPABILITY_DESCRIPTOR_H
|
||||
|
||||
#include "device_capability_descriptor.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user