home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name isisrstk -- Allocate stack space for all C-TOOLS-2-style
- * interrupt service routines
- * (Formerly called PCISRSTK.)
- *
- * Synopsis ercode = isisrstk(stksize);
- *
- * int ercode Error return code
- * int stksize Desired stack size in bytes.
- *
- * Description Interrupt service routines require their own stack.
- * This function must be called before any C-TOOLS-2-style
- * ISR is set up so that stack space can be allocated. The
- * stksize, which must accommodate all C-TOOLS-2-style
- * ISRs, is allocated from the heap, and its segment and
- * offset address are stored in the global variable
- * b_isrstk. These values are used by the ISR setup
- * function, ISSETISR, and the ISR function dispatcher,
- * ISDISPAT.
- *
- * Note: This function and ISSETISR (formerly called
- * PCSETISR) are supplied for compatibility with C TOOLS 2.
- * ISINSTAL is to be preferred for new programs.
- *
- * Returns ercode Returned error code:
- * 0 if successful,
- * 1 if insufficient memory.
- * b_isrstk Physical address of allocated space.
- * b_istksize Size of stack area in bytes.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bisr.h>
-
- #if LAT300
- #include <stdlib.h>
- #endif
- #if MSC300
- #include <malloc.h>
- #endif
-
- ADS b_isrstk = {0,0};
- char *b_isrpstk = NIL;
- int b_istksize = 0;
-
- int isisrstk(stksize)
- int stksize;
- {
- if ((b_isrpstk = malloc((unsigned int) stksize)) == NIL)
- return(1);
-
- utabsptr(b_isrpstk,&b_isrstk);
- b_istksize = stksize;
-
- return(0);
- }