avrx_resetsemaphore.s

来自「血凝仪检测系统,硬件电路部分由正弦波产生模块、前级放大与滤波模块、检测线圈、锁相」· S 代码 · 共 67 行

S
67
字号
#include        "avrx.inc"
/*
        Copyright 1999-2001, Larry Barello
        larry@barello.net

REVISION HISTORY
        20010403 - Initial update for avrx-ctoasm.inc port

*/
        _MODULE(avrx_resetsemaphore)
        _CODESECTION

/*+
; -----------------------------------------------
; pMutex AvrXResetSemaphore(pMutex)
; pMutex AvrXResetObjectSemaphore(pMutex)
;
; Force a semaphore into the _PEND state.  This is almost identical
; to SetSemaphore, but the end state is always _PEND rather than,
; possibly _DONE
;
; Usable in either USER or KERNEL code.
;
; PASSED:       R25:R24 = Semaphore
; RETURNS:      
; USES:         Z, X, flags
; STACK:
; SIDE EFFECTS: 
; Notes:        It doesn't make sense to reset a semaphore that has
;               a process waiting, so just skip that situation.
-*/
        _PUBLIC(AvrXIntResetObjectSemaphore)
        _FUNCTION(AvrXResetObjectSemaphore)
        
AvrXResetObjectSemaphore:
AvrXIntResetObjectSemaphore:
        mov     Zl, p1l
        mov     Zh, p1h
        adiw    Zl, 2
        rjmp    ars00
        _ENDFUNC
        
        _FUNCTION(AvrXResetSemaphore)
        _PUBLIC(AvrXIntResetSemaphore)
        
AvrXResetSemaphore:
AvrXIntResetSemaphore:
        mov     Zh, p1h
        mov     Zl, p1l
ars00:
        BeginCritical
        ldd     tmp2, Z+NextL
        ldd     tmp3, Z+NextH
        subi    tmp2, lo8(_DONE)
        sbci    tmp3, hi8(_DONE)
        breq    ars01           ; If it was _DONE, now it is _PEND
                                ; otherwize restore Pointer
        subi    tmp2, lo8(-_DONE)
        sbci    tmp3, hi8(-_DONE)
ars01:
        std     Z+NextH, tmp3 
        std     Z+NextL, tmp2
        EndCriticalReturn
        _ENDFUNC
        _END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?