|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
Regulator voltage scaling and over-drive. More...
Macros | |
| #define | PWR_READY_TIMEOUT_ITERATIONS (100000U) |
| Polls allowed for each CSR ready-flag wait (see Poll-count timeouts). | |
Functions | |
| DRIVER_MUST_CHECK DriverStatus_e | pwrSetVoltageScale (PwrRegisters_t *pwr, uint32_t vos) |
| Select the regulator voltage scale for the coming PLL frequency. | |
| DRIVER_MUST_CHECK DriverStatus_e | pwrWaitVoltageScaleReady (const PwrRegisters_t *pwr) |
| Wait until the regulator reaches the selected scale (CSR.VOSRDY). | |
| DRIVER_MUST_CHECK DriverStatus_e | pwrEnableOverdrive (PwrRegisters_t *pwr) |
| Enable over-drive, to run above the scale's normal maximum. | |
| static DriverStatus_e | pwrWaitCsrFlag (const PwrRegisters_t *pwr, uint32_t flag) |
| Poll a CSR flag until it sets or PWR_READY_TIMEOUT_ITERATIONS polls pass. | |
Regulator voltage scaling and over-drive.
| #define PWR_READY_TIMEOUT_ITERATIONS (100000U) |
Polls allowed for each CSR ready-flag wait (see Poll-count timeouts).
Definition at line 14 of file pwr.c.
Referenced by pwrWaitCsrFlag().
| DriverStatus_e pwrSetVoltageScale | ( | PwrRegisters_t * | pwr, |
| uint32_t | vos ) |
Select the regulator voltage scale for the coming PLL frequency.
Takes effect when the PLL is turned on, so there is nothing to wait for here.
| pwr | PWR block (e.g. PWR). |
| vos | PWR_CR_VOS_SCALE1, PWR_CR_VOS_SCALE2 or PWR_CR_VOS_SCALE3. |
| DRIVER_STATUS_OK | CR.VOS written. |
| DRIVER_STATUS_ERR_INVALID_PARAM | vos is not a scale value. |
Definition at line 42 of file pwr.c.
References PwrRegisters_t::CR, DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, PWR_CR_VOS_Msk, PWR_CR_VOS_Pos, PWR_CR_VOS_SCALE1, PWR_CR_VOS_SCALE2, PWR_CR_VOS_SCALE3, and pwrSetVoltageScale().
Referenced by bspClockInit(), and pwrSetVoltageScale().
| DriverStatus_e pwrWaitVoltageScaleReady | ( | const PwrRegisters_t * | pwr | ) |
Wait until the regulator reaches the selected scale (CSR.VOSRDY).
| pwr | PWR block (e.g. PWR); only CSR is read. |
| DRIVER_STATUS_OK | VOSRDY is set. |
| DRIVER_STATUS_ERR_TIMEOUT | VOSRDY did not set within the poll budget. |
Definition at line 58 of file pwr.c.
References PWR_CSR_VOSRDY, pwrWaitCsrFlag(), and pwrWaitVoltageScaleReady().
Referenced by bspClockInit(), and pwrWaitVoltageScaleReady().
| DriverStatus_e pwrEnableOverdrive | ( | PwrRegisters_t * | pwr | ) |
Enable over-drive, to run above the scale's normal maximum.
Sets ODEN and waits for ODRDY, then sets ODSWEN and waits for ODSWRDY, as ST's HAL does. CR.VOS is preserved.
| pwr | PWR block (e.g. PWR). |
| DRIVER_STATUS_OK | ODSWRDY is set. |
| DRIVER_STATUS_ERR_TIMEOUT | ODRDY did not set (ODSWEN is then not written), or ODSWRDY did not. |
Definition at line 63 of file pwr.c.
References PwrRegisters_t::CR, DRIVER_STATUS_OK, PWR_CR_ODEN, PWR_CR_ODSWEN, PWR_CSR_ODRDY, PWR_CSR_ODSWRDY, pwrEnableOverdrive(), and pwrWaitCsrFlag().
Referenced by bspClockInit(), and pwrEnableOverdrive().
|
static |
Poll a CSR flag until it sets or PWR_READY_TIMEOUT_ITERATIONS polls pass.
| pwr | PWR block; only CSR is read. |
| flag | PWR_CSR_VOSRDY, PWR_CSR_ODRDY or PWR_CSR_ODSWRDY. |
| DRIVER_STATUS_OK | The flag is set. |
| DRIVER_STATUS_ERR_TIMEOUT | It did not set in time. |
Definition at line 23 of file pwr.c.
References PwrRegisters_t::CSR, DRIVER_STATUS_ERR_TIMEOUT, DRIVER_STATUS_OK, PWR_READY_TIMEOUT_ITERATIONS, and pwrWaitCsrFlag().
Referenced by pwrEnableOverdrive(), pwrWaitCsrFlag(), and pwrWaitVoltageScaleReady().