📄 scheduler.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD> <META NAME="GENERATOR" CONTENT="langdoc 1.0.1"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE> Simple Scheduler </TITLE> </HEAD> <BODY> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="6"> <TR> <TD ALIGN=CENTER VALIGN=MIDDLE BGCOLOR=BLUE> <H1> <FONT COLOR="#FFFFFF"> Simple Scheduler </FONT> </H1> </TD> </TR> </TABLE><P ALIGN=RIGHT> <I> Copyright (c) 2003 Atmel</I> </P><H2> Library Usage </H2><H3> Package Description </H3><H4> Overview </H4>This module is a simple scheduler.<P><H4> Configuration </H4><PRE>In config.h:<P>1/ SCHEDULER_TYPE (required)SCHEDULER_FREE: free running (max perfs, none constrainst)SCHEDULER_TIMED: a semaphore is used to activate a new schedule (for instance all the tasks are executed each ms)SCHEDULER_TASK: a semaphore is used between each task (for instance each task is executed each ms)SCHEDULER_CUSTOM: custom, it is possible to define another scheduler type<P>2/ Scheduler_task_x_init (optional, except Scheduler_task_1_init)x from 1 to 9, defines the init functions (init of task or general purpose init)<P>3/ Scheduler_task_x (optional, except Scheduler_task_1)x from 1 to 9, defines the task functions<P>4/ Scheduler_time_init (optional)defines the function that will be called to initialize time events: soft timers, tempo...<P>5/ SCHEDULER_ENABLE_IT (optional)allow to enable interrupts after all initializations<P>6/ '#define scheduler main' (optional)if the main is only a call to the scheduler<P>EXAMPLE-------||// File: config.h|#define Scheduler_time_init init_soft_timers||#define Scheduler_task_1_init twi_lib_init|#define Scheduler_task_2_init init_leds_task|#define Scheduler_task_3_init stdo_init|#define Scheduler_task_4_init init_main_task|#define Scheduler_task_5_init stdi_init||#define Scheduler_task_1 leds_task|#define Scheduler_task_3 main_task|#define Scheduler_task_4 stdi_update_kbhit||#define SCHEDULER_TYPE SCHEDULER_FREE|<P>// File: scheduler.c / scheduler.h (after precompiler)void scheduler_init (void){init_soft_timers();twi_lib_init();init_leds_task();stdo_init();init_main_task();stdi_init();;}<P><P>void scheduler_tasks (void){scheduler_empty_fct();for(;;){leds_task();;main_task();;stdi_update_kbhit();;;}}<P><P>void scheduler (void){scheduler_init();scheduler_tasks();}<P><P>void scheduler_empty_fct (void){}<P></PRE><H3> Package Summary </H3><H4> Constants </H4><PRE></PRE><H4> Global Variables </H4><PRE><A HREF="#scheduler_tick_flag">scheduler_tick_flag</A> </PRE><H4> Macros </H4><PRE></PRE><H4> Functions </H4><PRE><A HREF="#scheduler">scheduler</A> <A HREF="#scheduler_empty_fct">scheduler_empty_fct</A> <A HREF="#scheduler_init">scheduler_init</A> <A HREF="#scheduler_tasks">scheduler_tasks</A> </PRE><H3> Files List </H3><UL><LI><B><A NAME="scheduler.c"></A> scheduler.c</B><BR></LI><UL>This file contains the scheduler routines NOTES: Configuration: - SCHEDULER_TYPE in scheduler.h header file - Task & init for at least task number 1 must be defined</UL><LI><B><A NAME="scheduler.h"></A> scheduler.h</B><BR></LI><UL>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</UL></UL><H3> Included Files </H3><UL><LI><B>config.h" / * system definition * / </B><BR></LI><LI><B>intrins.h </B><BR></LI><LI><B>lib_mcu\timer\timer_drv.h" / * timer definition * / </B><BR></LI><LI><B>scheduler.h" / * <A HREF="#scheduler">scheduler</A> definition * / </B><BR></LI></UL><H2> Constant Macros </H2><H2> Global Variables </H2><A NAME="scheduler_tick_flag"></A><H3> scheduler_tick_flag </H3><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#D6E8FF" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>bit <A HREF="#scheduler_tick_flag">scheduler_tick_flag</A> </PRE></TD></TABLE><P>When SCHEDULER_TYPE != SCHEDULER_FREE, this flag control task calls.<P><HR><H2> Function Macros </H2><H2> Functions </H2><A NAME="scheduler"></A><H3> scheduler </H3><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#D6E8FF" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>void <A HREF="#scheduler">scheduler</A> ( void ) </PRE></TD></TABLE><P>Simply call this task to init & run the scheduler<P><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#FFD0D0" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>*return:</PRE></TD></TABLE><HR><A NAME="scheduler_empty_fct"></A><H3> scheduler_empty_fct </H3><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#D6E8FF" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>void <A HREF="#scheduler_empty_fct">scheduler_empty_fct</A> ( void ) </PRE></TD></TABLE><P>This function does nothing<P><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#FFD0D0" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>*return:</PRE></TD></TABLE><HR><A NAME="scheduler_init"></A><H3> scheduler_init </H3><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#D6E8FF" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>void <A HREF="#scheduler_init">scheduler_init</A> ( void ) </PRE></TD></TABLE><P>Scheduler initialization<P><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#FFD0D0" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>*return:</PRE></TD></TABLE><H4> Note </H4><P>Task_x_init() and Task_x_fct() are defined in config.h<HR><A NAME="scheduler_tasks"></A><H3> scheduler_tasks </H3><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#D6E8FF" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>void <A HREF="#scheduler_tasks">scheduler_tasks</A> ( void ) </PRE></TD></TABLE><P>Task execution scheduler<P><TABLE BORDER="0" WIDTH="100 %" BGCOLOR="#FFD0D0" CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>*return:</PRE></TD></TABLE><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -