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

📄 int_sbc.s

📁 抢占
💻 S
📖 第 1 页 / 共 5 页
字号:
;/* CALLS                                                                 */
;/*                                                                       */
;/*      INC_Initialize                      Common initialization        */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*	 B. Sellew	 02-21-1997	 Created and verified version 1.0 */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _INT_Initialize
_INT_Initialize:
        XDEF    _main
_main:
;VOID    INT_Initialize(void)
;{
;
;    /* Lockout interrupts during initialization.  */
;
        MOVE.W  #$2700,SR                   ; Lockout interrupts
;
;    /* Setup the vectors loaded flag to indicate to other routines in the 
;       system whether or not all of the default vectors have been loaded. 
;       If INT_Loaded_Flag is 1, all of the default vectors have been loaded.
;       Otherwise, if INT_Loaded_Flag is 0, registering an LISR cause the
;       default vector to be loaded.  */
;    INT_Loaded_Flag =  1;
;
	MOVE.L	#1,D0
	MOVE.L	D0,_INT_Loaded_Flag
;
;     /* Reset the VBR to point to address zero. */
;
	MOVE.L  A7,D1
        MOVE.L  #0,D0
        MOVEA.L D0,A7
        MOVEC.L A7,VBR
        MOVEA.L D1,A7
;
;     /* Set up Timer 1 for a 10ms periodic tick that generates a Level 5
;        autovector. */
;
	MOVE.L  #ICR9_CFG,D0          ; Pick up configuration value for ICR9
	MOVE.B  D0,(MBAR_ADDR+ICR9)   ; Setup Timer 1 interrupt for lev 5, pri 0
	MOVE.L  #TRR1_LOAD,D0         ; Pick up compare value
	MOVE.W  D0,(MBAR_ADDR+TRR1)   ; Load into TRR1, val = (25MHz / 16) / 100
	MOVE.L  #TMR1_CFG,D0          ; Pick up configuration value for TMR1
	MOVE.W  D0,(MBAR_ADDR+TMR1)   ; Setup Timer 1
	                              ;   Prescaler = 0
	                              ;   Enable reference interrupt
	                              ;   Restart timer after reference reached
	                              ;   System clock / 16
	                              ;   Enable timer
	MOVE.W  (MBAR_ADDR+IMR),D0    ; Get current interrupt lockout status
	ANDI.L  #IMR_MASK,D0          ; Set Timer 1 bit
	MOVE.W  D0,(MBAR_ADDR+IMR)    ; Enable Timer 1 interrupt
;
;    /* Save the current value of the system stack.  */
;
        CLR.L   -(A7)                       ; Place a NULL on the system stack 
        MOVE.L  A7,_TCD_System_Stack        ; Save system stack pointer
;        
;    /* Define the global data structures that need to be initialized by this
;       routine.  These structures are used to define the system timer 
;       management HISR.  */
;    TMD_HISR_Stack_Ptr =        _sys_memory;
;    TMD_HISR_Stack_Size =       HISR_STACK;
;    TMD_HISR_Priority =         0;
;
	MOVE.L	#HISR_STACK,D0             ; pick up size of HISR stack
	MOVE.L	D0,_TMD_HISR_Stack_Size    ; store in variable
	CLR.L	D0                         ; get a 0
	MOVE.L	D0,_TMD_HISR_Priority      ; store priority = 0
	MOVE.L	#_sys_memory,D0            ; get address of sys_memory section
	MOVE.L	D0,_TMD_HISR_Stack_Ptr     ; set up as HISR stack
	ADD.L	#HISR_STACK,D0             ; move available mem pointer up
;
;     /* Invalidate, then enable the cache */
;
        MOVE.L  #CACHE_INV,D1              ; pick up Invalidate All command
        MOVEC   D1,CACR                    ; invalidate all cache lines
        MOVE.L  #CACHE_EN,D1               ; pick up Enable command
        MOVEC   D1,CACR                    ; enable the cache
;
;
;     /* Call INC_Initialize with a pointer to the first available memory 
;        address after the compiler's global data.  This memory may be used
;        by the application.  */
;     INC_Initialize(first_available_address);
;
        MOVE.L  D0,-(A7)
        JSR     _INC_Initialize
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      INT_Vectors_Loaded                                               */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function returns the flag that indicates whether or not     */
;/*      all the default vectors have been loaded.  If it is false,       */
;/*      each LISR register also loads the ISR shell into the actual      */
;/*      vector table.                                                    */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      Barry Sellew, Accelerated Technology, Inc.                       */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TCC_Register_LISR                   Register LISR for vector     */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _INT_Vectors_Loaded
_INT_Vectors_Loaded:
;INT    INT_Vectors_Loaded(void)
;{
;
;    /* Just return the loaded vectors flag.  */
;    return(INT_Loaded_Flag);
;
        MOVE.L  _INT_Loaded_Flag,D0         ; Put the flag into D0
        RTS                                 ; Return to caller
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      INT_Setup_Vector                                                 */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function sets up the specified vector with the new vector   */
;/*      value.  The previous vector value is returned to the caller.     */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      Barry Sellew, Accelerated Technology, Inc.                       */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Application                                                      */
;/*      TCC_Register_LISR                   Register LISR for vector     */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      vector                              Vector number to setup       */
;/*      new                                 Pointer to new assembly      */
;/*                                            language ISR               */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      old vector contents                                              */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _INT_Setup_Vector
_INT_Setup_Vector:
;VOID  *INT_Setup_Vector(INT vector, VOID *new)
;{
;
;VOID    *old_vector;                        /* Old interrupt vector      */
;VOID   **vector_table;                      /* Pointer to vector table   */
;
;    /* Calculate the starting address of the actual vector table.  */
;    vector_table =  (VOID **) 0x0;
;
        MOVEA.L #0,A0                       ; Pointer to the vector table
;
;    /* Pickup the old interrupt vector.  */
;    old_vector =  vector_table[vector];
;
        MOVE.L  4(A7),D0                    ; Pickup the vector number
        LSL.L   #2,D0                       ; Adjust for the vector size
        ADDA.L  D0,A0                       ; Add in offset to vector base
        MOVE.L  (A0),D0                     ; Pickup previous vector
;    
;    /* Setup the new interrupt vector.  */
;    vector_table[vector] =  new;
;
        MOVE.L  8(A7),D1                    ; Pickup the new vector pointer

⌨️ 快捷键说明

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