X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c..d11ed10c5314c44dc01c06954d1d73d4894cbff8:/LUFA/Scheduler/Scheduler.h?ds=sidebyside diff --git a/LUFA/Scheduler/Scheduler.h b/LUFA/Scheduler/Scheduler.h index 979156e7c..f71736fd5 100644 --- a/LUFA/Scheduler/Scheduler.h +++ b/LUFA/Scheduler/Scheduler.h @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -33,6 +33,21 @@ * Simple round-robbin cooperative scheduler for use in basic projects where non real-time tasks need * to be executed. Each task is executed in sequence, and can be enabled or disabled individually or as a group. * + * \deprecated This module is deprecated and will be removed in a future library release. + */ + +/** @defgroup Group_Scheduler Simple Task Scheduler - LUFA/Scheduler/Scheduler.h + * + * \deprecated This module is deprecated and will be removed in a future library release. + * + * \section Sec_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Scheduler/Scheduler.c + * + * \section Module Description + * Simple round-robbin cooperative scheduler for use in basic projects where non real-time tasks need + * to be executed. Each task is executed in sequence, and can be enabled or disabled individually or as a group. + * * For a task to yield it must return, thus each task should have persistent data marked with the static attribute. * * Usage Example: @@ -44,8 +59,8 @@ * * TASK_LIST * { - * { Task: MyTask1, TaskStatus: TASK_RUN, GroupID: 1 }, - * { Task: MyTask2, TaskStatus: TASK_RUN, GroupID: 1 }, + * { .Task = MyTask1, .TaskStatus = TASK_RUN, .GroupID = 1 }, + * { .Task = MyTask2, .TaskStatus = TASK_RUN, .GroupID = 1 }, * } * * int main(void) @@ -63,11 +78,6 @@ * // Implementation Here * } * \endcode - */ - -/** @defgroup Group_Scheduler Simple Task Scheduler - LUFA/Scheduler/Scheduler.h - * - * Simple round-robbin task scheduler. See Scheduler.h description for more details. * * @{ */ @@ -109,12 +119,12 @@ * \code * TASK_LIST * { - * { Task: MyTask1, TaskStatus: TASK_RUN, GroupID: 1 }, + * { .Task = MyTask1, .TaskStatus = TASK_RUN, .GroupID = 1 }, * // More task entries here * } * \endcode */ - #define TASK_LIST extern TaskEntry_t Scheduler_TaskList[]; TaskEntry_t Scheduler_TaskList[] = + #define TASK_LIST TaskEntry_t Scheduler_TaskList[] = /** Constant, giving the maximum delay in scheduler ticks which can be stored in a variable of type * SchedulerDelayCounter_t. @@ -127,16 +137,23 @@ /** Task status mode constant, for passing to Scheduler_SetTaskMode() or Scheduler_SetGroupTaskMode(). */ #define TASK_STOP false - /** Starts the scheduler in its infinite loop, executing running tasks. This should be placed at the end - * of the user application's main() function, as it can never return to the calling function. - */ - #define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS); - - /** Initializes the scheduler so that the scheduler functions can be called before the scheduler itself - * is started. This must be executed before any scheduler function calls other than Scheduler_Start(), - * and can be omitted if no such functions could be called before the scheduler is started. - */ - #define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS); + /* Pseudo-Function Macros: */ + #if defined(__DOXYGEN__) + /** Starts the scheduler in its infinite loop, executing running tasks. This should be placed at the end + * of the user application's main() function, as it can never return to the calling function. + */ + void Scheduler_Start(void); + + /** Initializes the scheduler so that the scheduler functions can be called before the scheduler itself + * is started. This must be executed before any scheduler function calls other than Scheduler_Start(), + * and can be omitted if no such functions could be called before the scheduler is started. + */ + void Scheduler_Init(void); + #else + #define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS); + + #define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS); + #endif /* Type Defines: */ /** Type define for a pointer to a scheduler task. */ @@ -179,7 +196,7 @@ /** Resets the delay counter value to the current tick count. This should be called to reset the period * for a delay in a task which is dependant on the current tick value. * - * \param DelayCounter Counter which is storing the starting tick count for a given delay. + * \param[out] DelayCounter Counter which is storing the starting tick count for a given delay. */ static inline void Scheduler_ResetDelay(SchedulerDelayCounter_t* const DelayCounter) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; @@ -194,8 +211,8 @@ /* Function Prototypes: */ /** Determines if the given tick delay has elapsed, based on the given . * - * \param Delay The delay to test for, measured in ticks - * \param DelayCounter The counter which is storing the starting tick value for the delay + * \param[in] Delay The delay to test for, measured in ticks + * \param[in] DelayCounter The counter which is storing the starting tick value for the delay * * \return Boolean true if the delay has elapsed, false otherwise * @@ -216,16 +233,16 @@ /** Sets the task mode for a given task. * - * \param Task Name of the task whose status is to be changed - * \param TaskStatus New task status for the task (TASK_RUN or TASK_STOP) + * \param[in] Task Name of the task whose status is to be changed + * \param[in] TaskStatus New task status for the task (TASK_RUN or TASK_STOP) */ void Scheduler_SetTaskMode(const TaskPtr_t Task, const bool TaskStatus); /** Sets the task mode for a given task group ID, allowing for an entire group of tasks to have their * statuses changed at once. * - * \param GroupID Value of the task group ID whose status is to be changed - * \param TaskStatus New task status for tasks in the specified group (TASK_RUN or TASK_STOP) + * \param[in] GroupID Value of the task group ID whose status is to be changed + * \param[in] TaskStatus New task status for tasks in the specified group (TASK_RUN or TASK_STOP) */ void Scheduler_SetGroupTaskMode(const uint8_t GroupID, const bool TaskStatus); @@ -242,7 +259,7 @@ Scheduler_TotalTasks = TotalTasks; } - static inline void Scheduler_GoSchedule(const uint8_t TotalTasks) ATTR_NO_RETURN ATTR_ALWAYS_INLINE; + static inline void Scheduler_GoSchedule(const uint8_t TotalTasks) ATTR_NO_RETURN ATTR_ALWAYS_INLINE ATTR_DEPRECATED; static inline void Scheduler_GoSchedule(const uint8_t TotalTasks) { Scheduler_InitScheduler(TotalTasks);