- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# scheduler.h File Reference

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: AT90USB1287, AT90USB1286, AT90USB647, AT90USB646
  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 54 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 63 of file scheduler.h.

#define TASK_0 0x01

Definition at line 64 of file scheduler.h.

#define TASK_1 0x02

Definition at line 65 of file scheduler.h.

#define TASK_2 0x04

Definition at line 66 of file scheduler.h.

#define TASK_3 0x08

Definition at line 67 of file scheduler.h.

#define TASK_4 0x10

Definition at line 68 of file scheduler.h.

#define TASK_5 0x20

Definition at line 69 of file scheduler.h.

#define TASK_6 0x40

Definition at line 70 of file scheduler.h.

#define TASK_7 0x80

Definition at line 71 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 74 of file scheduler.h.

#define SCHEDULER_CUSTOM 0

End Task ID.

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

Definition at line 78 of file scheduler.h.

#define SCHEDULER_TIMED 1

Definition at line 79 of file scheduler.h.

#define SCHEDULER_TASK 2

Definition at line 80 of file scheduler.h.

#define SCHEDULER_FREE 3

Definition at line 81 of file scheduler.h.

#define Scheduler_call_next_task | ( |  | ) |

Definition at line 202 of file scheduler.h.

Referenced by scheduler_tasks().

#define Scheduler_new_schedule | ( |  | ) |

Definition at line 205 of file scheduler.h.

Referenced by scheduler_tasks().

#define Scheduler_call_next_init | ( |  | ) |

Definition at line 208 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 ______________________________________________

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 77 of file scheduler.c.

References Scheduler_call_next_init, Scheduler_task_1_init, and Scheduler_task_2_init.

    00078 {
    00079    #ifdef Scheduler_time_init
    00080       Scheduler_time_init();
    00081    #endif
    00082    #ifdef TOKEN_MODE
    00083       token =  TOKEN_FREE;
    00084    #endif
    00085    #ifdef Scheduler_task_1_init
    00086       Scheduler_task_1_init();
    00087       Scheduler_call_next_init();
    00088    #endif
    00089    #ifdef Scheduler_task_2_init
    00090       Scheduler_task_2_init();
    00091       Scheduler_call_next_init();
    00092    #endif
    00093    #ifdef Scheduler_task_3_init
    00094       Scheduler_task_3_init();
    00095       Scheduler_call_next_init();
    00096    #endif
    00097    #ifdef Scheduler_task_4_init
    00098       Scheduler_task_4_init();
    00099       Scheduler_call_next_init();
    00100    #endif
    00101    #ifdef Scheduler_task_5_init
    00102       Scheduler_task_5_init();
    00103       Scheduler_call_next_init();
    00104    #endif
    00105    #ifdef Scheduler_task_6_init
    00106       Scheduler_task_6_init();
    00107       Scheduler_call_next_init();
    00108    #endif
    00109    #ifdef Scheduler_task_7_init
    00110       Scheduler_task_7_init();
    00111       Scheduler_call_next_init();
    00112    #endif
    00113    #ifdef Scheduler_task_8_init
    00114       Scheduler_task_8_init();
    00115       Scheduler_call_next_init();
    00116    #endif
    00117    #ifdef Scheduler_task_9_init
    00118       Scheduler_task_9_init();
    00119       Scheduler_call_next_init();
    00120    #endif
    00121    #ifdef Scheduler_task_10_init
    00122       Scheduler_task_10_init();
    00123       Scheduler_call_next_init();
    00124    #endif
    00125    #ifdef Scheduler_task_11_init
    00126       Scheduler_task_11_init();
    00127       Scheduler_call_next_init();
    00128    #endif
    00129    Scheduler_reset_tick_flag();
    00130 }

void scheduler_tasks | ( | void |  | ) |

Task execution scheduler.

Warning:
  Code:XX bytes (function code length)

Parameters:

  | :none |

Returns:
  :none

Definition at line 138 of file scheduler.c.

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

    00139 {
    00140    // To avoid uncalled segment warning if the empty function is not used
    00141    scheduler_empty_fct();
    00142
    00143    for(;;)
    00144    {
    00145       Scheduler_new_schedule();
    00146       #ifdef Scheduler_task_1
    00147          Scheduler_task_1();
    00148          Scheduler_call_next_task();
    00149       #endif
    00150       #ifdef Scheduler_task_2
    00151          Scheduler_task_2();
    00152          Scheduler_call_next_task();
    00153       #endif
    00154       #ifdef Scheduler_task_3
    00155          Scheduler_task_3();
    00156          Scheduler_call_next_task();
    00157       #endif
    00158       #ifdef Scheduler_task_4
    00159          Scheduler_task_4();
    00160          Scheduler_call_next_task();
    00161       #endif
    00162       #ifdef Scheduler_task_5
    00163          Scheduler_task_5();
    00164          Scheduler_call_next_task();
    00165       #endif
    00166       #ifdef Scheduler_task_6
    00167          Scheduler_task_6();
    00168          Scheduler_call_next_task();
    00169       #endif
    00170       #ifdef Scheduler_task_7
    00171          Scheduler_task_7();
    00172          Scheduler_call_next_task();
    00173       #endif
    00174       #ifdef Scheduler_task_8
    00175          Scheduler_task_8();
    00176          Scheduler_call_next_task();
    00177       #endif
    00178       #ifdef Scheduler_task_9
    00179          Scheduler_task_9();
    00180          Scheduler_call_next_task();
    00181       #endif
    00182       #ifdef Scheduler_task_10
    00183          Scheduler_task_10();
    00184          Scheduler_call_next_task();
    00185       #endif
    00186       #ifdef Scheduler_task_11
    00187          Scheduler_task_11();
    00188          Scheduler_call_next_task();
    00189       #endif
    00190    }
    00191 }

Here is the call 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 199 of file scheduler.c.

References scheduler_init(), and scheduler_tasks().

    00200 {
    00201    scheduler_init();
    00202    scheduler_tasks();
    00203 }

Here is the call 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 213 of file scheduler.c.

    00214 {
    00215 }

## Variable Documentation

bit scheduler_tick_flag

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

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

When SCHEDULER_TYPE != SCHEDULER_FREE, this flag control task calls.

Definition at line 56 of file scheduler.c.