📄 rzkresumeinterruptthread.s
字号:
;/*
;* File : RZKResumeInterruptThread.s
;*
;* Description : Contains a routine to resume interrupt thread
;*
;* Copyright 2004 ZiLOG Inc. ALL RIGHTS RESERVED.
;*
;* This file contains unpublished confidential and proprietary information
;* of ZiLOG, Inc.
;* NO PART OF THIS WORK MAY BE DUPLICATED, STORED, PUBLISHED OR DISCLOSED
;* IN ANY FORM WITHOUT THE PRIOR WRITTEN CONSENT OF ZiLOG, INC.
;* This is not a license and no use of any kind of this work is authorized
;* in the absence of a written license granted by ZiLOG, Inc. in ZiLOG's
;* sole discretion
;*/
.extern _hCurrentThread
.extern _DispatchQueue
.extern _DQPriorityBitMap
.extern _pMap
.extern _bTaskChangeFlag
.extern _QueueAppend
.extern _RZKScheduler
OFFSET_STATE : equ 06H
OFFSET_OPMODE : equ 11H
OFFSET_DP : equ 12H
THREAD_RUNNING : equ 08H
THREAD_INFINITESUSPEND : equ 80H
.def _RZKResumeInterruptThread
.assume adl=1
;/* Function : RZKResumeInterruptThread
;*
;* Description : Resumes interrupt thread
;*
;* Inputs : Thread handle to resume.
;*
;* Outputs : None
;*
;* Dependencies : None.
;*/
_RZKResumeInterruptThread:
PUSH IX
LD IX, 0
ADD IX, SP
;Below code is equivalent to pThread->uState |= THREAD_RUNNING and pThread->uState &= (~THREAD_INFINITESUSPEND)
LD IY, (IX+6) ;IY now contains thread handle
LD A, (IY+OFFSET_STATE)
BIT %7,A
JP Z,_ret
EI
LD A, (IY+OFFSET_STATE)
OR A, THREAD_RUNNING
RES 7,A
LD (IY+OFFSET_STATE), A
DI
LD L,(IY + OFFSET_DP) ;pThread->cDispPriority
LD H,6 ;size of DispatchQueue=6 typedef struct DISPATCHQ_t
; { RZK_TCB_t * pNext;
; RZK_TCB_t * pPrevious;
; } RZK_DISPATCHQ_t
MLT HL ;multiply with index
LD BC,_DispatchQueue + 3 ;Add 3 to access .pPrevious member of dispatch queue
ADD HL,BC ;DispatchQueue[uIndex]
LD HL, (HL) ;DispatchQueue[pThread->cDispPriority].pPrevious
; Equivalent to above code. Equivalent to QueueAppend code
LD BC, (HL)
LD(IY),BC
LD(IY + %3),HL
LD BC, IY
LD (HL), BC
LD IY, (IY)
LD (IY + %3), BC
LD IY, (IX+6) ;Restore IY: IY now contains thread handle
; Equivalent to above code. Equivalent to QueueAppend code
;Below code is equivalent to &pMap[pThread->cDispPriority]
LD L,(IY + OFFSET_DP) ;pThread->cDispPriority
LD H,4 ;size of each member of pMap array = 4
MLT HL ;Multiply to get index into pmap array bytewise
LD BC, _pMap ;_pMap
ADD HL, BC ;&pMap[pThread->cDispPriority]
;Below code is equivalent to DQPriorityBitMap |= pMap [pThread->cDispPriority];
; As eZ80 is 8 bit 4 OR statements are required to OR a 32 bit value
LD IY, _DQPriorityBitMap
LD A, (IY)
OR A, (HL)
LD (IY), A
INC HL
LD A, (IY + 1)
OR A, (HL)
LD (IY + 1), A
INC HL
LD A, (IY + 2)
OR A, (HL)
LD (IY + 2), A
INC HL
LD A, (IY + 3)
OR A, (HL)
LD (IY + 3), A
_ret:
LD SP, IX
POP IX
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -