⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tct.s

📁 sharp触摸屏测试代码
💻 S
📖 第 1 页 / 共 5 页
字号:
        ADD     a4,a2,a3                    ; Compute the beginning of stack
        BIC     a4,a4,#3                    ; Insure word alignment
        SUB     a4,a4,#4                    ; Reserve a word
;
;    /* Save the stack ending address.  */
;    hisr -> tc_stack_end =  REG_Stack_End;
;    
        STR     a4,[a1,#&28]                ; Save the stack ending address
;
;    /* Reference the HISR shell.  */
;    REG_Function_Ptr =  (VOID *) TCT_HISR_Shell;
;
;    /* Build an initial stack.  This initial stack frame facilitates an 
;       solicited return to the TCT_HISR_Shell function, which in turn 
;       invokes the appropriate HISR.  The initial HISR stack frame has the 
;       following format:
;
;               (Lower Address) Stack Top ->    0       (Solicited stack type)
;                !!FOR THUMB ONLY!!             0/0x20  Saved state mask
;                                               v1      Saved v1
;                                               v2      Saved v2
;                                               v3      Saved v3
;                                               v4      Saved v4
;                                               v5      Saved v5
;                                               v6/sb   Saved v6/sl
;                                               v7/sl   Saved v7/sl
;                                               fp      Saved fp
;                                               ip      Saved ip
;               (Higher Address) Stack Bottom-> pc      Saved pc
;    */
;
        LDR     a3,[pc, #HISR_Shell-.-8]    ; Pickup address of shell entry
        STR     a3,[a4], #-4                ; Store entry address on stack
        ADD     a3,a4,#&4                   ; Compute initial sp
        STR     a3,[a4], #-4                ; Store initial ip
        STR     a3,[a4], #-4                ; Store initial fp
        LDR     a3,[a1,#&24]                ; Pickup the stack starting address
        STR     a3,[a4], #-4                ; Store initial v7/sl
        MOV     a3,#0                       ; Clear value for initial registers
        STR     a3,[a4], #-4                ; Store initial v6/sb
        STR     a3,[a4], #-4                ; Store initial v5
        STR     a3,[a4], #-4                ; Store initial v4
        STR     a3,[a4], #-4                ; Store initial v3
        STR     a3,[a4], #-4                ; Store initial v2
        STR     a3,[a4], #-4                ; Store initial v1
        [ THUMB
        STR     a3,[a4], #-4                ; Store initial state mask
        ]
        STR     a3,[a4, #0]                 ; Store solicited stack type on the
                                            ; top of the stack 
;
;    /* Save the minimum amount of remaining stack memory.  */
;    hisr -> tc_stack_minimum =  REG_Stack_Size - (ARM)44 or (THUMB)48;
;        
        [ THUMB
        MOV     a3,#48                      ; Size of solicited stack frame
        |
        MOV     a3,#44                      ; Size of solicited stack frame
        ]
        SUB     a2,a2,a3                    ; Compute minimum available bytes
        STR     a2,[a1, #&34]               ; Save in minimum stack area
;
;    /* Save the new stack pointer into the task's control block.  */
;    hisr -> tc_stack_pointer =  (VOID *) Stack_Top;
;
        STR     a4,[a1, #&2C]               ; Save stack pointer

        [ THUMB
        BX      lr                          ; Return to caller
        |	
        MOV     pc,lr                       ; Return to caller
        ]
;}
;
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TCT_Build_Signal_Frame                                           */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function builds a frame on top of the task's stack to       */
;/*      cause the task's signal handler to execute the next time         */
;/*      the task is executed.                                            */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TCC_Send_Signals                    Send signals to a task       */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      task                                Task control block pointer   */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      W. Lamie        02-15-1994      Created initial version 1.0      */
;/*      D. Lamie        02-15-1994      Verified version 1.0             */
;/*                                                                       */
;/*************************************************************************/
;VOID  TCT_Build_Signal_Frame(TC_TCB *task)
;{
        EXPORT  TCT_Build_Signal_Frame
TCT_Build_Signal_Frame
;
;    /* Pickup the stack pointer.  */
;    REG_Stack_Ptr =  (BYTE_PTR) task -> tc_stack_pointer;
;    
        LDR     a4,[a1,#&2c]                ; Pickup the current stack pointer
;
;    /* Reference the Signal shell.  */
;    REG_Function_Ptr =  (VOID *) TCC_Signal_Shell;
;
;    /* Build a signal stack.  This signal stack frame facilitates an 
;       solicited return to the TCC_Signal_Shell function, which in turn 
;       invokes the appropriate signal handler.  The initial HISR stack frame 
;       has the following format:
;
;               (Lower Address) Stack Top ->    0       (Solicited stack type)
;                !!FOR THUMB ONLY!!             0/0x20  Saved state mask
;                                               v1      Saved v1
;                                               v2      Saved v2
;                                               v3      Saved v3
;                                               v4      Saved v4
;                                               v5      Saved v5
;                                               v6/sb   Saved v6/sl
;                                               v7/sl   Saved v7/sl
;                                               fp      Saved fp
;                                               ip      Saved ip
;               (Higher Address) Stack Bottom-> pc      Saved pc
;    */
;
        LDR     a3,[pc, #Signal_Shell-.-8]  ; Pickup address of shell entry
        [ THUMB
        BIC     a3,a3,#1                    ; Clear low bit
        ]
        STR     a3,[a4], #-4                ; Store entry address on stack
        ADD     a3,a4,#&4                   ; Compute initial sp
        STR     a3,[a4], #-4                ; Store initial ip
        STR     a3,[a4], #-4                ; Store initial fp
        LDR     a3,[a1,#&24]                ; Pickup the stack starting address
        STR     a3,[a4], #-4                ; Store initial v7/sl
        MOV     a3,#0                       ; Clear value for initial registers
        STR     a3,[a4], #-4                ; Store initial v6/sb
        STR     a3,[a4], #-4                ; Store initial v5
        STR     a3,[a4], #-4                ; Store initial v4
        STR     a3,[a4], #-4                ; Store initial v3
        STR     a3,[a4], #-4                ; Store initial v2
        STR     a3,[a4], #-4                ; Store initial v1
        [ THUMB
        MOV     a2,#&20                     ; Get initial state mask
    	STR     a2,[a4], #-4                ; Store initial state mask  
        ]
        STR     a3,[a4, #0]                 ; Store solicited stack type on the
                                            ; top of the stack 
;
;    /* Save the new stack pointer into the task's control block.  */
;    task -> tc_stack_pointer =  (VOID *) (REG_Stack_Ptr - REG_Stack_Size);
;
        STR     a4,[a1, #&2C]               ; Save stack pointer

        [ THUMB
        BX      lr                          ; Return to caller
        |	
        MOV     pc,lr                       ; Return to caller
        ]
;}
;
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TCT_Check_Stack                                                  */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function checks the current stack for overflow conditions.  */
;/*      Additionally, this function keeps track of the minimum amount    */
;/*      of stack space for the calling thread and returns the current    */
;/*      available stack space.                                           */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TCC_Send_Signals                    Send signals to a task       */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      ERC_System_Error                    System error handler         */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      available bytes in stack                                         */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      W. Lamie        02-15-1994      Created initial version 1.0      */
;/*      D. Lamie        02-15-1994      Verified version 1.0             */
;/*                                                                       */
;/*************************************************************************/
;UNSIGNED  TCT_Check_Stack(void)
;{
        EXPORT  TCT_Check_Stack
TCT_Check_Stack
;
;TC_TCB         *thread;
;UNSIGNED       remaining;
;
;    /* Pickup the current task/HISR pointer.  */
;    thread =  (TC_TCB *) TCD_Current_Thread;
;
        LDR     a1,[pc,#Current_Thread-.-8] ; Pickup address of thread pointer
        LDR     a1,[a1,#0]                  ; Pickup thread pointer
;

⌨️ 快捷键说明

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