TASK_MAN.H 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /**********************************************************************
  16. module: TASK_MAN.C
  17. author: James R. Dose
  18. date: July 25, 1994
  19. Public header for TASK_MAN.C, a low level timer task scheduler.
  20. (c) Copyright 1994 James R. Dose. All Rights Reserved.
  21. **********************************************************************/
  22. #ifndef __TASK_MAN_H
  23. #define __TASK_MAN_H
  24. enum TASK_ERRORS
  25. {
  26. TASK_Warning = -2,
  27. TASK_Error = -1,
  28. TASK_Ok = 0
  29. };
  30. typedef struct task
  31. {
  32. struct task *next;
  33. struct task *prev;
  34. void ( *TaskService )( struct task * );
  35. void *data;
  36. long rate;
  37. volatile long count;
  38. int priority;
  39. int active;
  40. } task;
  41. // TS_InInterrupt is TRUE during a taskman interrupt.
  42. // Use this if you have code that may be used both outside
  43. // and within interrupts.
  44. extern volatile int TS_InInterrupt;
  45. void TS_Shutdown( void );
  46. task *TS_ScheduleTask( void ( *Function )( task * ), int rate,
  47. int priority, void *data );
  48. int TS_Terminate( task *ptr );
  49. void TS_Dispatch( void );
  50. void TS_SetTaskRate( task *Task, int rate );
  51. void TS_UnlockMemory( void );
  52. int TS_LockMemory( void );
  53. #endif