Permalink
Browse files

[os] Move tick optimization os calls to syscalls. Cosmetic.

  • Loading branch information...
KamelHacene committed Oct 31, 2016
1 parent 70c4a50 commit 6462bfebf2ac79de7ad7eb061b041aefe04455ab
View
@@ -170,6 +170,11 @@ FUNC(tpl_status, OS_CODE) tpl_start_schedule_table_synchron(
result = E_OS_STATE;
}
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE((tpl_time_obj *)st);
return result;
}
#endif
@@ -264,6 +269,12 @@ FUNC(tpl_status, OS_CODE) tpl_sync_schedule_table_service(
{
tpl_sync_sched_table(&(st->b_desc), value);
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE((tpl_time_obj *)st);
}
#endif
@@ -330,6 +341,12 @@ FUNC(tpl_status, OS_CODE) tpl_set_schedule_table_async_service(
st->b_desc.state = SCHEDULETABLE_RUNNING | SCHEDULETABLE_ASYNC;
/*st->deviation = 0;*/
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE((tpl_time_obj *)st);
}
#endif
View
@@ -312,11 +312,11 @@ FUNC(tpl_status, OS_CODE) tpl_start_schedule_table_rel(
tpl_schedtable_static*. This cast behaves correctly because the first memeber
of tpl_schedula_table_static is a tpl_time_obj_static */
schedtable = (P2VAR(tpl_schedtable_static, AUTOMATIC, OS_APPL_DATA))(st->b_desc.stat_part);
+ /* A syscall must update counters before using a timeobj's structures */
+ TPL_UPDATE_COUNTERS((tpl_time_obj *)st);
if (st->b_desc.state == (tpl_schedtable_state)SCHEDULETABLE_STOPPED)
{
- /* A syscall must update counters before using a timeobj's structures */
- TPL_UPDATE_COUNTERS((tpl_time_obj *)st);
/* the schedule table is not already started, proceed */
cnt = st->b_desc.stat_part->counter;
@@ -343,6 +343,12 @@ FUNC(tpl_status, OS_CODE) tpl_start_schedule_table_rel(
return the proper error code */
result = E_OS_STATE;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE((tpl_time_obj *)st);
return result;
}
#endif
@@ -409,10 +415,10 @@ FUNC(tpl_status, OS_CODE) tpl_start_schedule_table_abs(
tpl_schedtable_static*. This cast behaves correctly because the first memeber
of tpl_schedula_table_static is a tpl_time_obj_static */
schedtable = (P2VAR(tpl_schedtable_static, AUTOMATIC, OS_APPL_DATA))(st->b_desc.stat_part);
+ /* A syscall must update counters before using a timeobj's structures */
+ TPL_UPDATE_COUNTERS((tpl_time_obj *)st);
if (st->b_desc.state == (tpl_schedtable_state)SCHEDULETABLE_STOPPED)
{
- /* A syscall must update counters before using a timeobj's structures */
- TPL_UPDATE_COUNTERS((tpl_time_obj *)st);
/* the schedule table is not already started, proceed */
cnt = st->b_desc.stat_part->counter;
@@ -457,6 +463,12 @@ FUNC(tpl_status, OS_CODE) tpl_start_schedule_table_abs(
return the proper error code */
result = E_OS_STATE;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE((tpl_time_obj *)st);
return result;
}
#endif
@@ -126,7 +126,7 @@ FUNC(void, OS_CODE) tpl_call_counter_tick_% !interrupt::NAME %_%!core_id%(void)
end if
end foreach
%
- if(next_tick != -1)
+ if(next_tick > 1)
{
/* Set the timer to interrupt at the next alarm date
* We're using the frequency of the sharedcounter.
@@ -139,11 +139,12 @@ FUNC(void, OS_CODE) tpl_call_counter_tick_% !interrupt::NAME %_%!core_id%(void)
}
else
{
- /* If there is no alarm, do not enable the source. Set the LVR to 0 so the
- * next "elapsed_ticks calculation" returns 0
+ /* If there is no alarm, or if an alarm will expire in one tick, we don't
+ * need the slave source.
*/
+ /* Set the LVR to 0 so the next "elapsed_ticks calculation" returns 0*/
PIT_LVR(% !pit_channel_map[slave_source] %) = 0;
- /* Keep the master source up so we're not lost in time */
+ /* Keep the master source up */
tpl_enable_sharedsource(% !core_id %);
}
View
@@ -183,6 +183,12 @@ FUNC(tpl_status, OS_CODE) tpl_get_alarm_service(
{
result = E_OS_NOFUNC;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE(alarm);
}
#endif
@@ -254,6 +260,12 @@ FUNC(tpl_status, OS_CODE) tpl_set_rel_alarm_service(
/* the alarm is in use, return the proper error code */
result = E_OS_STATE;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE(alarm);
}
#endif
@@ -322,6 +334,12 @@ FUNC(tpl_status, OS_CODE) tpl_set_abs_alarm_service(
/* the alarm is in use, return the proper error code */
result = E_OS_STATE;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE(alarm);
}
#endif
@@ -379,6 +397,12 @@ FUNC(tpl_status, OS_CODE) tpl_cancel_alarm_service(
{
result = E_OS_NOFUNC;
}
+
+ /* Tick optimization :
+ * A syscall must enable the mastersource after finishing using the timeobj
+ * structure.
+ */
+ TPL_ENABLE_SHAREDSOURCE(alarm);
}
#endif
View
@@ -135,13 +135,6 @@ FUNC(void, OS_CODE) tpl_insert_time_obj(
}
}
}
-
-#if TPL_OPTIMIZE_TICKS == YES
- /* Enable the sharedsource to force a next tick prediction for the core
- * which has it's counter's timeobj queues modified by this call.
- */
- TPL_ENABLE_SHAREDSOURCE(time_obj);
-#endif
}
/*
@@ -183,13 +176,6 @@ FUNC(void, OS_CODE) tpl_remove_time_obj(
{
counter->next_to = counter->first_to;
}
-
-#if TPL_OPTIMIZE_TICKS == YES
- /* Enable the sharedsource to force a next tick prediction for the core
- * which has it's counter's timeobj queues modified by this call.
- */
- TPL_ENABLE_SHAREDSOURCE(time_obj);
-#endif
}
/*

0 comments on commit 6462bfe

Please sign in to comment.