Last change
on this file since f7c91fc was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.2 KB
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | mtsetp.c -- Multi-Tasker -- change task priority
|
---|
4 | Version 4 -- 1988-04-11 -- D.N. Lynx Crowe
|
---|
5 | (c) Copyright 1988 -- D.N. Lynx Crowe
|
---|
6 | =============================================================================
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include "stddefs.h"
|
---|
10 | #include "biosdefs.h"
|
---|
11 | #include "mtdefs.h"
|
---|
12 |
|
---|
13 | extern short setipl(); /* set processor IPL function */
|
---|
14 |
|
---|
15 | extern struct _mt_def *_MT_;
|
---|
16 |
|
---|
17 | /*
|
---|
18 | =============================================================================
|
---|
19 | MTSetP() -- reset task priority and dispatch to highest priority task
|
---|
20 |
|
---|
21 | Returns old task priority.
|
---|
22 | =============================================================================
|
---|
23 | */
|
---|
24 |
|
---|
25 | unsigned
|
---|
26 | MTSetP(pri)
|
---|
27 | unsigned pri;
|
---|
28 | {
|
---|
29 | register short oldipl;
|
---|
30 | register unsigned oldpri;
|
---|
31 |
|
---|
32 | if ((struct _mt_def *)NIL EQ _MT_)
|
---|
33 | _MT_ = (struct _mt_def *)XBIOS(X_MTDEFS);
|
---|
34 |
|
---|
35 | oldipl = setipl(7); /* DISABLE INTERRUPTS */
|
---|
36 |
|
---|
37 | oldpri = _MT_->mtp->CurP->pri; /* get old task priority */
|
---|
38 | _MT_->mtp->CurP->pri = pri; /* set new priority for task */
|
---|
39 |
|
---|
40 | setipl(oldipl); /* RESTORE INTERRUPTS */
|
---|
41 |
|
---|
42 | MTSwap(); /* swap to highest priority ready task */
|
---|
43 | return(oldpri); /* return old task priority */
|
---|
44 | }
|
---|
45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.