IMPORT _tx_thread_fiq_context_save
IMPORT _tx_thread_fiq_context_restore
IF :DEF:TX_ENABLE_IRQ_NESTING
IMPORT _tx_thread_irq_nesting_start
IMPORT _tx_thread_irq_nesting_end
ENDIF
IF :DEF:TX_ENABLE_FIQ_NESTING
IMPORT _tx_thread_fiq_nesting_start
IMPORT _tx_thread_fiq_nesting_end
ENDIF
/*
上面以_tx_thread_*开头的函数,是由theadx OS提供的,主要用在进行中断处理时,保存中断的上下文,便于中断返回时
能够继续执行.以下内容来自ThreadXUserGuide.pdf
Like other ThreadX interrupt service routines, the low-level handler must
call _tx_thread_context_save before calling the driver ISR. After the driver ISR returns, the
low-level handler must call _tx_thread_context_restore.
The following small code segment is typical of most ThreadX managed ISRs. In most cases, this processing is in assembly language.
_application_ISR_vector_entry:
; Save context and prepare for
; ThreadX use by calling the ISR
; entry function.
CALL __tx_thread_context_save
; The ISR can now call ThreadX
; services and its own C functions
; When the ISR is finished, context
; is restored (or thread preemption)
; by calling the context restore
; function. Control does not return!
JUMP __tx_thread_context_restore
上面的英文描述,与实例代码式大致相同
*/
IMPORT myIrqHander
;
;
AREA ||.text||, CODE, READONLY
;
;
EXPORT _irq_handler
EXPORT __tx_irq_processing_return
_irq_handler
;
; /* Jump to context save to save system context. */
B _tx_thread_context_save
__tx_irq_processing_return
;
; /* At this point execution is still in the IRQ mode. The CPSR, point of
; interrupt, and all C scratch registers are available for use. In
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-40032-2.html
政府是他爸扶在那里
我不羡慕你