mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-07-05 03:47:15 -04:00
Add an assert to catch register overflow (#1265)
This commit is contained in:
parent
03db672b8f
commit
2e13eab2c9
|
@ -234,6 +234,11 @@ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void )
|
||||||
{
|
{
|
||||||
const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1UL;
|
const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1UL;
|
||||||
|
|
||||||
|
/* PR1 is 16-bit. Ensure that the configPERIPHERAL_CLOCK_HZ and
|
||||||
|
* configTICK_RATE_HZ are defined such that ulCompareMatch value would fit
|
||||||
|
* in 16-bits. */
|
||||||
|
configASSERT( ( ulCompareMatch & 0xFFFF0000 ) == 0 );
|
||||||
|
|
||||||
T1CON = 0x0000;
|
T1CON = 0x0000;
|
||||||
T1CONbits.TCKPS = portPRESCALE_BITS;
|
T1CONbits.TCKPS = portPRESCALE_BITS;
|
||||||
PR1 = ulCompareMatch;
|
PR1 = ulCompareMatch;
|
||||||
|
|
Loading…
Reference in a new issue