@@ -24,48 +24,56 @@ SOFTWARE.
2424volatile uint32_t ap3_stimer_overflows = 0x00 ;
2525uint64_t ticks = 0 ;
2626
27- void _fill_ticks ( void ){
27+ void _fill_ticks (void )
28+ {
2829 ticks = ap3_stimer_overflows;
2930 ticks <<= 32 ;
3031 ticks |= (am_hal_stimer_counter_get () & 0xFFFFFFFF );
3132}
3233
33- unsigned long micros ( void ){
34+ unsigned long micros (void )
35+ {
3436 _fill_ticks ();
35- return (uint32_t )(ticks/ AP3_STIMER_FREQ_MHZ);
37+ return (uint32_t )(ticks / AP3_STIMER_FREQ_MHZ);
3638}
3739
38- unsigned long millis ( void ){
40+ unsigned long millis (void )
41+ {
3942 _fill_ticks ();
40- return (uint32_t )(ticks/ AP3_STIMER_FREQ_KHZ);
43+ return (uint32_t )(ticks / AP3_STIMER_FREQ_KHZ);
4144}
4245
43- unsigned long seconds ( void ){
46+ unsigned long secs (void )
47+ {
4448 _fill_ticks ();
45- return (uint32_t )(ticks/ AP3_STIMER_FREQ_HZ);
49+ return (uint32_t )(ticks / AP3_STIMER_FREQ_HZ);
4650}
4751
48- unsigned long systicks ( void ){
52+ unsigned long systicks (void )
53+ {
4954 return am_hal_stimer_counter_get ();
5055}
5156
52- unsigned long sysoverflows ( void ){
57+ unsigned long sysoverflows (void )
58+ {
5359 return ap3_stimer_overflows;
5460}
5561
56- void delay (uint32_t ms){
62+ void delay (uint32_t ms)
63+ {
5764 am_util_delay_ms (ms);
5865}
5966
60- void delayMicroseconds (uint32_t us){
67+ void delayMicroseconds (uint32_t us)
68+ {
6169 am_util_delay_us (us);
6270}
6371
64- extern " C" void am_stimer_isr (void ){
65- am_hal_stimer_int_clear (AM_HAL_STIMER_INT_OVERFLOW);
66- ap3_stimer_overflows += 1 ;
67- // At the fastest rate (3MHz) the 64 bits of the stimer
68- // along with this overflow counter can keep track of
69- // the time for ~ 195,000 years without wrapping to 0
72+ extern " C" void am_stimer_isr (void )
73+ {
74+ am_hal_stimer_int_clear (AM_HAL_STIMER_INT_OVERFLOW);
75+ ap3_stimer_overflows += 1 ;
76+ // At the fastest rate (3MHz) the 64 bits of the stimer
77+ // along with this overflow counter can keep track of
78+ // the time for ~ 195,000 years without wrapping to 0
7079}
71-
0 commit comments