clock: [#55] Proper variable type.
This commit is contained in:
parent
d76151ef15
commit
af73839406
@ -127,7 +127,7 @@ to exclude the API function. */
|
|||||||
* must set up LPC_SCT1.
|
* must set up LPC_SCT1.
|
||||||
*/
|
*/
|
||||||
void vConfigureTimerForRunTimeStats(void);
|
void vConfigureTimerForRunTimeStats(void);
|
||||||
unsigned long ulGetTimeForRunTimeStats(void);
|
configRUN_TIME_COUNTER_TYPE ulGetTimeForRunTimeStats(void);
|
||||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||||
/* The value is read directly from the counter register for efficiency and low overhead. */
|
/* The value is read directly from the counter register for efficiency and low overhead. */
|
||||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetTimeForRunTimeStats()
|
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetTimeForRunTimeStats()
|
||||||
|
|||||||
@ -59,14 +59,11 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Used by FreeRTOS to collect runtime statistics.
|
* @brief Used by FreeRTOS to collect runtime statistics.
|
||||||
* @paragraph FreeRTOS is unable to handle the counter overflow, so it must be done from our side.
|
* @paragraph FreeRTOS is unable to handle the counter overflow, so it must be done from our side.
|
||||||
* This solution will break eventually later on, presumably after 1193 hours of runtime,
|
* @return configRUN_TIME_COUNTER_TYPE
|
||||||
* since unsigned long won't be able to hold more than that amount of milliseconds.
|
|
||||||
* FreeRTOS expects to get unsigned long, so there's nothing more that can be done.
|
|
||||||
* @return unsigned long
|
|
||||||
*/
|
*/
|
||||||
unsigned long ulGetTimeForRunTimeStats(void)
|
configRUN_TIME_COUNTER_TYPE ulGetTimeForRunTimeStats(void)
|
||||||
{
|
{
|
||||||
return (unsigned long)(((double)(counter_overflows - 1) * max_counter_value) + LPC_SCT1->COUNT_U)
|
return (configRUN_TIME_COUNTER_TYPE)(((double)(counter_overflows - 1) * max_counter_value) + LPC_SCT1->COUNT_U)
|
||||||
/ ((double)Chip_Clock_GetMainClockRate() / 1000);
|
/ ((double)Chip_Clock_GetMainClockRate() / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user