[ion/device] Rename some PCB version methods

This commit is contained in:
Gabriel Ozouf
2021-03-25 17:19:45 +01:00
committed by Gabriel
parent 5ccf8d6b97
commit b8727bc256
8 changed files with 14 additions and 14 deletions

View File

@@ -21,7 +21,6 @@ ion_device_bench_src += $(addprefix ion/src/device/bench/command/, \
lcd_timing.o \
led.cpp \
mcu_serial.cpp \
pcb_version.cpp \
ping.cpp \
print.cpp \
screen_id.cpp \
@@ -30,4 +29,5 @@ ion_device_bench_src += $(addprefix ion/src/device/bench/command/, \
standby.cpp \
usb_plugged.cpp \
vblank.cpp \
write_pcb_version.cpp \
)

View File

@@ -23,7 +23,6 @@ constexpr CommandHandler handles[] = {
CommandHandler("LCD_TIMING", Command::LCDTiming),
CommandHandler("LED", Command::LED),
CommandHandler("MCU_SERIAL", Command::MCUSerial),
CommandHandler("PCB_VERSION", Command::PCBVersion),
CommandHandler("PING", Command::Ping),
CommandHandler("PRINT", Command::Print),
CommandHandler("SCREEN_ID", Command::ScreenID),
@@ -32,6 +31,7 @@ constexpr CommandHandler handles[] = {
CommandHandler("STANDBY", Command::Standby),
CommandHandler("USB_PLUGGED", Command::USBPlugged),
CommandHandler("VBLANK", Command::VBlank),
CommandHandler("WRITE_PCB_VERSION", Command::WritePCBVersion),
CommandHandler(nullptr, nullptr)
};

View File

@@ -24,7 +24,7 @@ void LCDPins(const char * input);
void LCDTiming(const char * input);
void LED(const char * input);
void MCUSerial(const char * input);
void PCBVersion(const char * input);
void WritePCBVersion(const char * input);
void Ping(const char * input);
void Print(const char * input);
void ScreenID(const char * input);

View File

@@ -6,7 +6,7 @@ namespace Device {
namespace Bench {
namespace Command {
void PCBVersion(const char * input) {
void WritePCBVersion(const char * input) {
if (input != nullptr) {
reply(sSyntaxError);
return;
@@ -18,12 +18,12 @@ void PCBVersion(const char * input) {
#if IN_FACTORY
Board::writePCBVersion(PCB_LATEST);
/* Read directly from memory, as when IN_FACTORY is true, the method
* readPCBVersion always returns PCB_LATEST. */
* pcbVersion always returns PCB_LATEST. */
if (Board::readPCBVersionInMemory() != PCB_LATEST) {
reply(sKO);
return;
}
Board::lockVersionOTP();
Board::lockPCBVersion();
#endif
reply(sOK);
}

View File

@@ -230,7 +230,7 @@ void shutdownClocks(bool keepLEDAwake) {
RCC.AHB1ENR()->set(ahb1enr);
}
PCBVersion readPCBVersion() {
PCBVersion pcbVersion() {
return PCB_LATEST;
}
@@ -240,7 +240,7 @@ PCBVersion readPCBVersionInMemory() {
void writePCBVersion(PCBVersion) {}
void lockVersionOTP() {}
void lockPCBVersion() {}
}
}

View File

@@ -378,7 +378,7 @@ constexpr int pcbVersionOTPIndex = 0;
* because the OTP are initialized with 1s, we store the bitwise-not of the
* version number. This way, devices with blank OTP are considered version 0. */
PCBVersion readPCBVersion() {
PCBVersion pcbVersion() {
#if IN_FACTORY
/* When flashing for the first time, we want all systems that depend on the
* PCB version to function correctly before flashing the PCB version. This
@@ -399,9 +399,9 @@ void writePCBVersion(PCBVersion version) {
InternalFlash::WriteMemory(destination, reinterpret_cast<uint8_t *>(&formattedVersion), sizeof(formattedVersion));
}
void lockVersionOTP() {
void lockPCBVersion() {
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPLocksAddress + pcbVersionOTPIndex);
uint8_t zero = 0x00;
uint8_t zero = 0;
InternalFlash::WriteMemory(destination, &zero, sizeof(zero));
}

View File

@@ -10,7 +10,7 @@ using namespace Regs;
namespace USB {
bool useAlternateFunctionVbus() {
return Board::readPCBVersion() == 0;
return Board::pcbVersion() == 0;
}
void initVbus() {

View File

@@ -27,10 +27,10 @@ void setClockFrequency(Frequency f);
typedef uint32_t PCBVersion;
PCBVersion readPCBVersion();
PCBVersion pcbVersion();
PCBVersion readPCBVersionInMemory();
void writePCBVersion(PCBVersion version);
void lockVersionOTP();
void lockPCBVersion();
}
}