Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSImplClassicIntr
0007  *
0008  * @brief This source file contains the legacy interrupt controller support
0009  *   implementation.
0010  */
0011 
0012 /*
0013  * Copyright (C) 2008, 2009 embedded brains GmbH & Co. KG
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  */
0036 
0037 #include <string.h>
0038 
0039 #define BSP_SHARED_HANDLER_SUPPORT
0040 
0041 #include <rtems.h>
0042 #include <rtems/irq.h>
0043 
0044 #include <bsp/irq-generic.h>
0045 
0046 /**
0047  * @deprecated Obsolete.
0048  */
0049 int BSP_get_current_rtems_irq_handler(rtems_irq_connect_data *cd)
0050 {
0051   memset(cd, 0, sizeof(*cd));
0052 
0053   return 1;
0054 }
0055 
0056 /**
0057  * @deprecated Use rtems_interrupt_handler_install() instead.
0058  */
0059 int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *cd)
0060 {
0061   rtems_status_code sc = RTEMS_SUCCESSFUL;
0062 
0063   sc = rtems_interrupt_handler_install(
0064     cd->name,
0065     "LEGACY INSTALLED",
0066     RTEMS_INTERRUPT_UNIQUE,
0067     cd->hdl,
0068     cd->handle
0069   );
0070   if (sc != RTEMS_SUCCESSFUL) {
0071     return 0;
0072   }
0073 
0074   if (cd->on != NULL) {
0075     cd->on(cd);
0076   }
0077 
0078   return 1;
0079 }
0080 
0081 /**
0082  * @deprecated Use rtems_interrupt_handler_install() instead.
0083  */
0084 int BSP_install_rtems_shared_irq_handler(const rtems_irq_connect_data *cd)
0085 {
0086   rtems_status_code sc = RTEMS_SUCCESSFUL;
0087 
0088   sc = rtems_interrupt_handler_install(
0089     cd->name,
0090     "LEGACY INSTALLED",
0091     RTEMS_INTERRUPT_SHARED,
0092     cd->hdl,
0093     cd->handle
0094   );
0095   if (sc != RTEMS_SUCCESSFUL) {
0096     return 0;
0097   }
0098 
0099   if (cd->on != NULL) {
0100     (*cd->on)(cd);
0101   }
0102 
0103   return 1;
0104 }
0105 
0106 /**
0107  * @deprecated Use rtems_interrupt_handler_remove() instead.
0108  */
0109 int BSP_remove_rtems_irq_handler(const rtems_irq_connect_data *cd)
0110 {
0111   rtems_status_code sc = RTEMS_SUCCESSFUL;
0112 
0113   if (cd->off != NULL) {
0114     (*cd->off)(cd);
0115   }
0116 
0117   sc = rtems_interrupt_handler_remove(cd->name, cd->hdl, cd->handle);
0118   if (sc != RTEMS_SUCCESSFUL) {
0119     return 0;
0120   }
0121 
0122   return 1;
0123 }
0124 
0125 /**
0126  * @deprecated Use bsp_interrupt_initialize() instead.
0127  */
0128 int BSP_rtems_irq_mngt_set(rtems_irq_global_settings *config)
0129 {
0130   return 0;
0131 }
0132 
0133 /**
0134  * @deprecated Obsolete.
0135  */
0136 int BSP_rtems_irq_mngt_get(rtems_irq_global_settings **config)
0137 {
0138   *config = NULL;
0139   return 0;
0140 }