-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathos_send_signal.a51
64 lines (56 loc) · 1.47 KB
/
os_send_signal.a51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;------------------------------------------------------------------------------
; This file is part of the 'RTX-51 tiny' Real-Time Operating System Package
; Copyright KEIL ELEKTRONIK GmbH and Keil Software, Inc. 1991 - 2002
;------------------------------------------------------------------------------
;
; OS_SEND_SIGNAL.A51: This module contains the OS_SEND_SIGNAL function
;
; RTX51 TINY VERSION 2
;
;------------------------------------------------------------------------------
NAME ?RTX51_TINY_OS_SEND_SIGNAL
$include (os_defines.inc)
PUBLIC _os_send_signal
PUBLIC _isr_send_signal
EXTRN CODE (?RTX?SET_ISR)
?RTX?CODE SEGMENT CODE
RSEG ?RTX?CODE
USING 0 ; Registerbank 0 for following code
_os_send_signal:
_isr_send_signal:
; os_send_signal (uchar taskid) {
; uchar data *p;
;---- Variable 'taskid' assigned to Register 'R7' ----
;---- Variable 'p' assigned to Register 'R0' ----
; if (no > MAXTASKN) return (0xff);
MOV A,R7
SETB C
SUBB A,#?RTX_MAXTASKN
JC ??C0010
MOV R7,#0FFH
RET
??C0010:
; p = &STATE[taskid].st;
MOV A,R7
RL A
ADD A,#?RTX?TASKSTATE?S+1
MOV R0,A
CLR EA
MOV A,@R0
;
; if (*p & K_ACTIVE) {
JNB ACC.B_ACTIVE,?C0026
; if (*p & K_SIG) *p |= K_READY;
JNB ACC.B_WAITSIG,?C0026
SETB ACC.B_READY
; }
?C0026:
; *p |= SIG_EVENT;
SETB ACC.B_SIGNAL
XCH A,@R0
SETB EA
MOV R7,#0
JNB ACC.B_SIGNAL,NO_SIG_PENDING
INC R7
NO_SIG_PENDING: JMP ?RTX?SET_ISR
END