[ion] Renaming STCSR, STCVR and STRVR to SYST_CSR, SYST_CVR and SYST_RVR

This commit is contained in:
Damien Nicolet
2018-11-07 00:34:20 +01:00
parent c0c0905b84
commit 92e59f720f
3 changed files with 17 additions and 17 deletions

View File

@@ -46,11 +46,11 @@ uint32_t Ion::millis() {
}
uint32_t Ion::micros() {
uint32_t c1 = CM4.STCVR()->getCURRENT();
uint32_t c1 = CM4.SYST_CVR()->getCURRENT();
uint32_t ms1 = millis_elapsed;
uint32_t c2 = CM4.STCVR()->getCURRENT();
uint32_t c2 = CM4.SYST_CVR()->getCURRENT();
uint32_t ms2 = millis_elapsed;
uint32_t load = CM4.STRVR()->getRELOAD();
uint32_t load = CM4.SYST_RVR()->getRELOAD();
return ((c1 > c2) ? ms1 : ms2) * 1000 + ((load - c2) * 1000) / (load + 1);
}
@@ -201,15 +201,15 @@ void initPeripherals() {
Console::Device::init();
SWD::Device::init();
CM4.STRVR()->setRELOAD(11999);
CM4.STCVR()->setCURRENT(0);
CM4.STCSR()->setCLKSOURCE(CM4::STCSR::CLKSOURCE::AHB_DIV8);
CM4.STCSR()->setTICKINT(true);
CM4.STCSR()->setENABLE(true);
CM4.SYST_RVR()->setRELOAD(11999);
CM4.SYST_CVR()->setCURRENT(0);
CM4.SYST_CSR()->setCLKSOURCE(CM4::SYST_CSR::CLKSOURCE::AHB_DIV8);
CM4.SYST_CSR()->setTICKINT(true);
CM4.SYST_CSR()->setENABLE(true);
}
void shutdownPeripherals(bool keepLEDAwake) {
CM4.STCSR()->setENABLE(false);
CM4.SYST_CSR()->setENABLE(false);
SWD::Device::shutdown();
Console::Device::shutdown();

View File

@@ -40,7 +40,7 @@ public:
REGS_BOOL_FIELD(SLEEPDEEP, 2);
};
class STCSR : public Register32 {
class SYST_CSR : public Register32 {
public:
enum class CLKSOURCE : uint8_t {
AHB_DIV8 = 0,
@@ -52,20 +52,20 @@ public:
REGS_BOOL_FIELD(ENABLE, 0);
};
class STRVR : public Register32 {
class SYST_RVR : public Register32 {
public:
REGS_FIELD(RELOAD, uint32_t, 23, 0);
};
class STCVR : public Register32 {
class SYST_CVR : public Register32 {
public:
REGS_FIELD(CURRENT, uint32_t, 23, 0);
};
constexpr CM4() {};
REGS_REGISTER_AT(STCSR, 0x10);
REGS_REGISTER_AT(STRVR, 0x14);
REGS_REGISTER_AT(STCVR, 0x18);
REGS_REGISTER_AT(SYST_CSR, 0x10);
REGS_REGISTER_AT(SYST_RVR, 0x14);
REGS_REGISTER_AT(SYST_CVR, 0x18);
REGS_REGISTER_AT(VTOR, 0xD08);
REGS_REGISTER_AT(AIRCR, 0xD0C);
REGS_REGISTER_AT(SCR, 0xD10);

View File

@@ -9,7 +9,7 @@ namespace USB {
namespace Device {
void Calculator::PollAndReset(bool exitWithKeyboard) {
CM4.STCSR()->setTICKINT(false);
CM4.SYST_CSR()->setTICKINT(false);
char serialNumber[Ion::Device::SerialNumberLength+1];
Ion::Device::copySerialNumber(serialNumber);
Calculator c(serialNumber);
@@ -38,7 +38,7 @@ void Calculator::PollAndReset(bool exitWithKeyboard) {
* will enter the newly flashed firmware. */
Ion::Device::jumpReset();
}
CM4.STCSR()->setTICKINT(true);
CM4.SYST_CSR()->setTICKINT(true);
}
Descriptor * Calculator::descriptor(uint8_t type, uint8_t index) {