; ; Include file for RTOS. ; ; Copyright (c) 1992-1999, Circuit Cellar Inc. ; Copyright (c) 2001, Circuit Cellar Incorporated (Steve@circuitcellar.com) ; ; This program is free software; you can redistribute it and/or ; modify it under the terms of the GNU General Public License ; as published by the Free Software Foundation; either version 2 ; of the License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ; ; Copyright (C) 2001 ; Circuit Cellar Incorporated ; 4 Park St. ; Vernon, CT 06066 ; ; steve@circuitcellar.com ; ;------------------------------------------------------------------------- ; ; ; This file should be INCLUDEd in all RTOS applications. ; It contains the macros that ease access to the RTOS itself. ; external os_define, os_run, os_exit, os_cancel external os_wait, os_init, os_priority ; ; This routine must be called before any other RTOS ; call is made. ; ; rt_init (no arguments) ; rt_init macro call os_init endm ; ; rt_define - Make a task known to the operating system ; ; rt_define must be called before any other commands are issued ; for the task. ; ; rt_define start, stack, bbr, priority, number ; start = start address ; stack = top of stack for this task ; bbr = task's bank ; priority= task's initial priority ; number = task number (1 to NUMTSK-1) ; rt_define macro start,stack,bbr,priority,number ld hl,start ; set start address ld de,stack ; set top of stack ld bc,priority*256+bbr ; set priority and bank ld a,number ; task number call os_define endm ; ; rt_run - Put a task in the READY state. ; ; rt_run number,rsi ; number = task number ; rsi = reschedule interval ; rt_run macro number,rsi ld de,rsi ; set reschedule interval ld a,number ; set task number call os_run endm ; ; rt_exit - Exit the current task ; ; rt_exit (no arguments) ; rt_exit macro jp os_exit endm ; ; rt_priority - Set the current task's priority ; ; rt_priority priority ; priority= task's new priority (1 to 63) ; rt_priority macro priority ld b,priority call os_priority endm ; ; rt_cancel - Cancel a task ; ; rt_cancel number ; number = task number (0 to NUMTSK-1) ; rt_cancel macro number ld a,number ; set task number call os_cancel endm ; ; rt_wait - Put the current task into a WAITING state ; ; rt_wait count ; count = number of tics to wait (1 to 32767) ; rt_wait macro count ld de,count ; set count call os_wait endm