view src/cs/system/main/gcc/int_dummy.S @ 268:f2e52cab0a73

abb_inth.c: check all interrupt causes, not just one The original code used if - else if - else if etc constructs, thus the first detected interrupt was the only one handled. However, Iota ITSTATREG is a clear-on-read register, thus if we only handle the first detected interrupt and skip checking the others, then the other interrupts will be lost, if more than one interrupt happened to occur in one ABB interrupt handling cycle - a form of rare race condition. Change the code to check all interrupts that were read in this cycle.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 13 Jun 2021 18:17:53 +0000
parents 4e78acac3d88
children
line wrap: on
line source

/*
 * This assembly module contains a few dummy INT_*() functions
 * which are needed by Nucleus (tcc.c) but aren't used in TI's
 * environment.  This code used to be in the big messy int.s
 * assembly module in the original version.
 */

	.text
	.code	32

/*************************************************************************/
/*                                                                       */
/* 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       01-19-1996      Created initial version 1.0      */
/*      B. Sellew       01-22-1996      Verified version 1.0             */
/*                                                                       */
/*************************************************************************/

@INT    INT_Vectors_Loaded(void)
@{
	.globl	INT_Vectors_Loaded
INT_Vectors_Loaded:
@
@    /* Just return the loaded vectors flag.  */
@    return(INT_Loaded_Flag);
@
        MOV     a1,#1                       @ Always return TRUE since there 
                                            @   are really only two normal 
                                            @   vectors IRQ & FIQ
        BX      lr                          @ 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       01-19-1996      Created initial version 1.0      */
/*      B. Sellew       01-22-1996      Verified version 1.0             */
/*                                                                       */
/*************************************************************************/

@VOID  *INT_Setup_Vector(INT vector, VOID *new)
@{
	.globl	INT_Setup_Vector
INT_Setup_Vector:
@
@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 **) 0;
@
@    /* Pickup the old interrupt vector.  */
@    old_vector =  vector_table[vector];
@    
@    /* Setup the new interrupt vector.  */
@    vector_table[vector] =  new;
@    
@    /* Return the old interrupt vector.  */
@    return(old_vector);
@
        MOV     a1,#0                       @ This routine is not applicable to
                                            @   THUMB, return a NULL pointer
        BX      lr                          @ Return to caller
@}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      INT_Retrieve_Shell                                               */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function retrieves the pointer to the shell interrupt       */
/*      service routine.  The shell interrupt service routine calls      */
/*      the LISR dispatch routine.                                       */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Barry Sellew, Accelerated Technology, Inc.                       */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      TCC_Register_LISR                   Register LISR for vector     */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      vector                              Vector number to setup       */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      shell pointer                                                    */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*      B. Sellew       01-19-1996      Created initial version 1.0      */
/*      B. Sellew       01-22-1996      Verified version 1.0             */
/*                                                                       */
/*************************************************************************/

@VOID  *INT_Retrieve_Shell(INT vector)
@{
	.globl	INT_Retrieve_Shell
INT_Retrieve_Shell:
@
@    /* Return the LISR Shell interrupt routine.  */
@    return(INT_Vectors[vector]);
@
        MOV     a1,#0                       @ This routine is not applicable to
                                            @   THUMB, return a NULL pointer
        BX      lr                          @ Return to caller
@}