Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSScoreISR
0007  *
0008  * @brief This header file provides the main interfaces of the
0009  *   @ref RTEMSScoreISR.
0010  */
0011 
0012 /*
0013  *  COPYRIGHT (c) 1989-2012.
0014  *  On-Line Applications Research Corporation (OAR).
0015  *
0016  * Redistribution and use in source and binary forms, with or without
0017  * modification, are permitted provided that the following conditions
0018  * are met:
0019  * 1. Redistributions of source code must retain the above copyright
0020  *    notice, this list of conditions and the following disclaimer.
0021  * 2. Redistributions in binary form must reproduce the above copyright
0022  *    notice, this list of conditions and the following disclaimer in the
0023  *    documentation and/or other materials provided with the distribution.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035  * POSSIBILITY OF SUCH DAMAGE.
0036  */
0037 
0038 #ifndef _RTEMS_SCORE_ISR_H
0039 #define _RTEMS_SCORE_ISR_H
0040 
0041 #include <rtems/score/isrlevel.h>
0042 
0043 /**
0044  * @defgroup RTEMSScoreISR ISR Handler
0045  *
0046  * @ingroup RTEMSScore
0047  *
0048  * @brief This group contains the ISR Handler implementation.
0049  *
0050  * This handler encapsulates functionality which provides the foundation
0051  * ISR services used in all of the APIs supported by RTEMS.  This handler
0052  * supports interrupt critical sections, vectoring of user interrupt handlers,
0053  * nesting of interrupts, and manipulating interrupt levels.
0054  *
0055  * The ::_ISR_Nest_level variable is maintained by @ref RTEMSScorePerCPU.
0056  *
0057  * @{
0058  */
0059 
0060 #ifdef __cplusplus
0061 extern "C" {
0062 #endif
0063 
0064 /**
0065  *  The following type defines the type used to manage the vectors.
0066  */
0067 typedef uint32_t   ISR_Vector_number;
0068 
0069 /**
0070  *  Return type for ISR Handler
0071  */
0072 typedef void ISR_Handler;
0073 
0074 #if (CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE)
0075 
0076 typedef void * ISR_Handler_entry;
0077 
0078 #else
0079 /**
0080  *  Pointer to an ISR Handler
0081  */
0082 #if (CPU_ISR_PASSES_FRAME_POINTER == TRUE)
0083 typedef ISR_Handler ( *ISR_Handler_entry )(
0084                  ISR_Vector_number,
0085                  CPU_Interrupt_frame *
0086              );
0087 #else
0088 typedef ISR_Handler ( *ISR_Handler_entry )(
0089                  ISR_Vector_number
0090              );
0091 #endif
0092 
0093 /**
0094  *  The following declares the Vector Table.  Application
0095  *  interrupt service routines are vectored by the ISR Handler via this table.
0096  */
0097 extern ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ];
0098 #endif
0099 
0100 /**
0101  * @brief Provides the configured interrupt stack size through an address.
0102  *
0103  * The address of this global symbol is equal to the configured interrupt stack
0104  * size.  The address of this symbol has an arbitrary value an may not be
0105  * representable in the code model used by the compiler.
0106  *
0107  * This global symbol is defined by the application configuration option
0108  * CONFIGURE_INIT_TASK_STACK_SIZE via <rtems/confdefs.h>.
0109  */
0110 RTEMS_DECLARE_GLOBAL_SYMBOL( _ISR_Stack_size );
0111 
0112 /**
0113  * @brief Provides the configured interrupt stack size through an object.
0114  *
0115  * This object is provided to avoid issues with the _ISR_Stack_size symbol
0116  * address and the code model used by the compiler.
0117  */
0118 extern const char * const volatile _ISR_Stack_size_object;
0119 
0120 /**
0121  * @brief The interrupt stack area begin.
0122  *
0123  * The interrupt stack area is defined by the application configuration via
0124  * <rtems/confdefs.h>.  The size of the area depends on
0125  * CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_MAXIMUM_PROCESSORS.
0126  */
0127 extern char _ISR_Stack_area_begin[];
0128 
0129 /**
0130  * @brief The interrupt stack area end.
0131  *
0132  * The interrupt stack area is defined by the application configuration via
0133  * <rtems/confdefs.h>.  The size of the area depends on
0134  * CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_MAXIMUM_PROCESSORS.
0135  */
0136 extern const char _ISR_Stack_area_end[];
0137 
0138 /**
0139  * @brief Initializes the ISR handler.
0140  *
0141  * This routine performs the initialization necessary for the ISR handler.
0142  */
0143 void _ISR_Handler_initialization ( void );
0144 
0145 /**
0146  *  @brief Install interrupt handler vector.
0147  *
0148  *  This routine installs new_handler as the interrupt service routine
0149  *  for the specified vector.  The previous interrupt service routine is
0150  *  returned as old_handler.
0151  *
0152  *  LM32 Specific Information:
0153  *  XXX document implementation including references if appropriate
0154  *
0155  *  @param[in] _vector is the vector number
0156  *  @param[in] _new_handler is ISR handler to install
0157  *  @param[in] _old_handler is a pointer to a variable which will be set
0158  *             to the old handler
0159  *
0160  *  @retval *_old_handler will be set to the old ISR handler
0161  */
0162 #define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \
0163   _CPU_ISR_install_vector( _vector, _new_handler, _old_handler )
0164 
0165 /**
0166  * @brief ISR interrupt dispatcher.
0167  *
0168  * This routine is the interrupt dispatcher.  ALL interrupts
0169  * are vectored to this routine so that minimal context can be saved
0170  * and setup performed before the application's high-level language
0171  * interrupt service routine is invoked.   After the application's
0172  * interrupt service routine returns control to this routine, it
0173  * will determine if a thread dispatch is necessary.  If so, it will
0174  * ensure that the necessary thread scheduling operations are
0175  * performed when the outermost interrupt service routine exits.
0176  *
0177  * @note  Typically implemented in assembly language.
0178  */
0179 void _ISR_Handler( void );
0180 
0181 #ifdef __cplusplus
0182 }
0183 #endif
0184 
0185 /** @} */
0186 
0187 #endif
0188 /* end of include file */