File tree 1 file changed +21
-16
lines changed
1 file changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -102,29 +102,34 @@ void perfc_port_clear_system_timer_counter(void);
102
102
void perfc_port_insert_to_system_timer_insert_ovf_handler (void )
103
103
{
104
104
int64_t lLoad = perfc_port_get_system_timer_top () + 1 ;
105
- s_lSystemClockCounts += lLoad ;
106
105
107
- // update system ms counter
108
- do {
109
- int64_t lTemp = s_wMSResidule + lLoad ;
106
+ /* prevent high priority exceptions from preempting the system timer OVF
107
+ * exception handling
108
+ */
109
+ __IRQ_SAFE {
110
+ s_lSystemClockCounts += lLoad ;
111
+
112
+ // update system ms counter
113
+ do {
114
+ int64_t lTemp = s_wMSResidule + lLoad ;
110
115
111
- int64_t lMS = lTemp / s_wMSUnit ;
112
- s_lSystemMS += lMS ;
113
- s_wMSResidule = (uint32_t )((int64_t )lTemp - (int64_t )lMS * s_wMSUnit );
116
+ int64_t lMS = lTemp / s_wMSUnit ;
117
+ s_lSystemMS += lMS ;
118
+ s_wMSResidule = (uint32_t )((int64_t )lTemp - (int64_t )lMS * s_wMSUnit );
114
119
115
- } while (0 );
120
+ } while (0 );
116
121
117
- // update system us counter
118
- do {
119
- int64_t lTemp = s_wUSResidule + lLoad ;
122
+ // update system us counter
123
+ do {
124
+ int64_t lTemp = s_wUSResidule + lLoad ;
120
125
121
- int64_t lUS = lTemp / s_wUSUnit ;
122
- s_lSystemUS += lUS ;
123
-
124
- s_wUSResidule = (uint32_t )((int64_t )lTemp - (int64_t )lUS * s_wUSUnit );
126
+ int64_t lUS = lTemp / s_wUSUnit ;
127
+ s_lSystemUS += lUS ;
125
128
126
- } while ( 0 );
129
+ s_wUSResidule = ( uint32_t )(( int64_t ) lTemp - ( int64_t ) lUS * s_wUSUnit );
127
130
131
+ } while (0 );
132
+ }
128
133
}
129
134
130
135
uint32_t perfc_get_systimer_frequency (void )
You can’t perform that action at this time.
0 commit comments