1010 */
1111
1212#include "sch.h"
13+ #include "sch_event_management.h"
1314
1415int32_t sch_system_tasks_ready_set = 0 ;
1516int32_t sch_preempt_tasks_ready_set = 0 ;
@@ -26,14 +27,14 @@ sch_task_t* sch_task_registry[SCH_MAX_QUANTITY_OF_TASKS] = {0};
2627 * @param init
2728 */
2829void sch_task_create (sch_task_t * const task , sch_task_priority priority , sch_irq irq , sch_task_dispatch_fn dispatch , sch_task_presetting_fn presetting ) {
29- if (task != (sch_task_t * const )NULL ) {
30- task -> irq = irq ;
31- task -> priority = priority ;
32- task -> task_dispatch = dispatch ;
33- task -> task_presetting = presetting ;
30+ if (task != (sch_task_t * const )NULL ) {
31+ task -> irq = irq ;
32+ task -> priority = priority ;
33+ task -> task_dispatch = dispatch ;
34+ task -> task_presetting = presetting ;
3435
35- task -> task_presetting (task );
36- }
36+ task -> task_presetting (task );
37+ }
3738}
3839
3940/**
@@ -43,15 +44,15 @@ void sch_task_create(sch_task_t* const task, sch_task_priority priority, sch_irq
4344 * @param param
4445 */
4546void sch_task_run (sch_task_t * const task , void * param ) {
46- SCH_ASSERT ((task -> priority > 0 ) && (task -> priority < SCH_MAX_QUANTITY_OF_TASKS ));
47- (* task -> task_dispatch )(task );
47+ SCH_ASSERT ((task -> priority > 0 ) && (task -> priority < SCH_MAX_QUANTITY_OF_TASKS ));
48+ (* task -> task_dispatch )(task );
4849
49- //afterword
50- if (task -> priority < 0 ) {
51- sch_system_tasks_ready_set &= ~(1U << (uint8_t )(- task -> priority - 1 ));
52- } else {
53- sch_preempt_tasks_ready_set &= ~(1U << (uint8_t )(task -> priority - 1 ));
54- }
50+ //afterword
51+ if (task -> priority < 0 ) {
52+ sch_system_tasks_ready_set &= ~(1U << (uint8_t )(- task -> priority - 1 ));
53+ } else {
54+ sch_preempt_tasks_ready_set &= ~(1U << (uint8_t )(task -> priority - 1 ));
55+ }
5556}
5657
5758/**
@@ -60,9 +61,18 @@ void sch_task_run(sch_task_t* const task, void* param) {
6061 * @param task
6162 */
6263void sch_task_activate (sch_task_t * const task ) {
63- if (task -> priority < 0 ) {
64- sch_system_tasks_ready_set |= (1U << (uint8_t )(- task -> priority - 1 ));
65- } else {
66- sch_preempt_tasks_ready_set |= (1U << (uint8_t )(task -> priority - 1 ));
67- }
64+ if (task -> priority < 0 ) {
65+ sch_system_tasks_ready_set |= (1U << (uint8_t )(- task -> priority - 1 ));
66+ } else {
67+ sch_preempt_tasks_ready_set |= (1U << (uint8_t )(task -> priority - 1 ));
68+ }
69+ }
70+
71+ /**
72+ * @brief Wrapper function for starting the arbitraging the processes
73+ *
74+ */
75+ uint8_t sch_run (void ) {
76+ sch_event_management ();
77+ return 0 ;
6878}
0 commit comments