Defines | Functions | Variables

# scheduler.h File Reference

This file is the definition of the scheduler. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | Wait_semaphore(a) while(!(a)) (a) = FALSE
| _____ I N C L U D E S ____________________________________________________
#define | TASK_DUMMY 0x00
| _____ M A C R O S ________________________________________________________ Definition of Task ID.
#define | TASK_0 0x01
#define | TASK_1 0x02
#define | TASK_2 0x04
#define | TASK_3 0x08
#define | TASK_4 0x10
#define | TASK_5 0x20
#define | TASK_6 0x40
#define | TASK_7 0x80
#define | ALL_TASK (TASK_0|TASK_1|TASK_2|TASK_3|TASK_4|TASK_5|TASK_6|TASK_7)
#define | SCHEDULER_CUSTOM 0
| End Task ID.
#define | SCHEDULER_TIMED 1
#define | SCHEDULER_TASK 2
#define | SCHEDULER_FREE 3
#define | Scheduler_call_next_task()
#define | Scheduler_new_schedule()
#define | Scheduler_call_next_init()
## Functions
void | scheduler_init (void)
| _____ D E C L A R A T I O N ______________________________________________
void | scheduler_tasks (void)
| Task execution scheduler.
void | scheduler (void)
| Init & run the scheduler.
void | scheduler_empty_fct (void)
| Do nothing Avoid uncalled segment warning if the empty function is not used.
## Variables
bit | scheduler_tick_flag
| _____ D E F I N I T I O N ________________________________________________

## Detailed Description

This file is the definition of the scheduler.

This file contains the scheduler definition and the task function to be executed by the scheduler NOTE: SCHEDULER_TICK & FPER are defined in config.h

- Compiler: IAR EWAVR and GNU GCC for AVR
- Supported devices: ATmega32U4

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file scheduler.h.

## Define Documentation

#define Wait_semaphore | ( |  | a ) | while(!(a)) (a) = FALSE

_____ I N C L U D E S ____________________________________________________

Definition at line 57 of file scheduler.h.

#define TASK_DUMMY 0x00

_____ M A C R O S ________________________________________________________ Definition of Task ID.

This ID is used to properly send the event to a specific task. Mind, it will be possible to send an event to many task by TASK_1 | TASK_0. The name of the define can be changed by another define. That customization should be done in the file mail_evt.h

Definition at line 66 of file scheduler.h.

#define TASK_0 0x01

Definition at line 67 of file scheduler.h.

#define TASK_1 0x02

Definition at line 68 of file scheduler.h.

#define TASK_2 0x04

Definition at line 69 of file scheduler.h.

#define TASK_3 0x08

Definition at line 70 of file scheduler.h.

#define TASK_4 0x10

Definition at line 71 of file scheduler.h.

#define TASK_5 0x20

Definition at line 72 of file scheduler.h.

#define TASK_6 0x40

Definition at line 73 of file scheduler.h.

#define TASK_7 0x80

Definition at line 74 of file scheduler.h.

#define ALL_TASK (TASK_0|TASK_1|TASK_2|TASK_3|TASK_4|TASK_5|TASK_6|TASK_7)

Definition at line 77 of file scheduler.h.

#define SCHEDULER_CUSTOM 0

End Task ID.

----- Scheduler Types -----

Definition at line 81 of file scheduler.h.

#define SCHEDULER_TIMED 1

Definition at line 82 of file scheduler.h.

#define SCHEDULER_TASK 2

Definition at line 83 of file scheduler.h.

#define SCHEDULER_FREE 3

Definition at line 84 of file scheduler.h.

#define Scheduler_call_next_task | ( | ) |

Definition at line 205 of file scheduler.h.

Referenced by scheduler_tasks().

#define Scheduler_new_schedule | ( | ) |

Definition at line 208 of file scheduler.h.

Referenced by scheduler_tasks().

#define Scheduler_call_next_init | ( | ) |

Definition at line 211 of file scheduler.h.

Referenced by scheduler_init().

## Function Documentation

void scheduler_init | ( | void | ) |

_____ D E C L A R A T I O N ______________________________________________

_____ D E C L A R A T I O N ______________________________________________

_____ D E C L A R A T I O N ______________________________________________ Scheduler initialization

Task_x_init() and Task_x_fct() are defined in config.h

Warning:
  Code:XX bytes (function code length)

Parameters:

  :none |

Returns:
  :none

Definition at line 79 of file scheduler.c.

References Scheduler_call_next_init, Scheduler_task_1_init, and Scheduler_task_2_init.

Referenced by scheduler().

    {
       #ifdef Scheduler_time_init
          Scheduler_time_init();
       #endif
       #ifdef TOKEN_MODE
          token =  TOKEN_FREE;
       #endif
       #ifdef Scheduler_task_1_init
          Scheduler_task_1_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_2_init
          Scheduler_task_2_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_3_init
          Scheduler_task_3_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_4_init
          Scheduler_task_4_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_5_init
          Scheduler_task_5_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_6_init
          Scheduler_task_6_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_7_init
          Scheduler_task_7_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_8_init
          Scheduler_task_8_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_9_init
          Scheduler_task_9_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_10_init
          Scheduler_task_10_init();
          Scheduler_call_next_init();
       #endif
       #ifdef Scheduler_task_11_init
          Scheduler_task_11_init();
          Scheduler_call_next_init();
       #endif
       Scheduler_reset_tick_flag();
    }

Here is the caller graph for this function:

void scheduler_tasks | ( | void | ) |

Task execution scheduler.

Warning:
  Code:XX bytes (function code length)

Parameters:

  :none |

Returns:
  :none

Definition at line 140 of file scheduler.c.

References Scheduler_call_next_task, scheduler_empty_fct(), Scheduler_new_schedule, Scheduler_task_1, Scheduler_task_2, and Scheduler_task_3.

Referenced by scheduler().

    {
       // To avoid uncalled segment warning if the empty function is not used
       scheduler_empty_fct();

       for(;;)
       {
          Scheduler_new_schedule();
          #ifdef Scheduler_task_1
             Scheduler_task_1();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_2
             Scheduler_task_2();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_3
             Scheduler_task_3();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_4
             Scheduler_task_4();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_5
             Scheduler_task_5();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_6
             Scheduler_task_6();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_7
             Scheduler_task_7();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_8
             Scheduler_task_8();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_9
             Scheduler_task_9();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_10
             Scheduler_task_10();
             Scheduler_call_next_task();
          #endif
          #ifdef Scheduler_task_11
             Scheduler_task_11();
             Scheduler_call_next_task();
          #endif
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void scheduler | ( | void | ) |

Init & run the scheduler.

Warning:
  Code:XX bytes (function code length)

Parameters:

  :none |

Returns:
  :none

Definition at line 201 of file scheduler.c.

References scheduler_init(), and scheduler_tasks().

Referenced by main().

    {
       scheduler_init();
       scheduler_tasks();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void scheduler_empty_fct | ( | void | ) |

Do nothing Avoid uncalled segment warning if the empty function is not used.

Warning:
  Code:XX bytes (function code length)

Parameters:

  :none |

Returns:
  :none

Definition at line 215 of file scheduler.c.

Referenced by scheduler_tasks().

    {
    }

Here is the caller graph for this function:

## Variable Documentation

bit scheduler_tick_flag

_____ D E F I N I T I O N ________________________________________________