Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:57

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * RTEMS generic MPC83xx BSP
0005  *
0006  * This file integrates the IPIC irq controller.
0007  */
0008 
0009 /*
0010  * Copyright (c) 2007 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 #include <rtems.h>
0035 
0036 #include <libcpu/powerpc-utility.h>
0037 
0038 #include <bsp.h>
0039 #include <bsp/irq.h>
0040 #include <bsp/irq-generic.h>
0041 #include <bsp/vectors.h>
0042 
0043 static int qemuppc_exception_handler(
0044   BSP_Exception_frame *frame,
0045   unsigned exception_number
0046 )
0047 {
0048   rtems_panic("Unexpected interrupt occured");
0049   return 0;
0050 }
0051 
0052 rtems_status_code bsp_interrupt_get_attributes(
0053   rtems_vector_number         vector,
0054   rtems_interrupt_attributes *attributes
0055 )
0056 {
0057   return RTEMS_SUCCESSFUL;
0058 }
0059 
0060 rtems_status_code bsp_interrupt_is_pending(
0061   rtems_vector_number vector,
0062   bool               *pending
0063 )
0064 {
0065   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0066   bsp_interrupt_assert(pending != NULL);
0067   *pending = false;
0068   return RTEMS_UNSATISFIED;
0069 }
0070 
0071 rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
0072 {
0073   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0074   return RTEMS_UNSATISFIED;
0075 }
0076 
0077 rtems_status_code bsp_interrupt_clear(rtems_vector_number vector)
0078 {
0079   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0080   return RTEMS_UNSATISFIED;
0081 }
0082 
0083 rtems_status_code bsp_interrupt_vector_is_enabled(
0084   rtems_vector_number vector,
0085   bool               *enabled
0086 )
0087 {
0088   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0089   bsp_interrupt_assert(enabled != NULL);
0090   *enabled = false;
0091   return RTEMS_UNSATISFIED;
0092 }
0093 
0094 /*
0095  * functions to enable/disable a source at the ipic
0096  */
0097 rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
0098 {
0099   /* FIXME: do something */
0100   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(irqnum));
0101   return RTEMS_SUCCESSFUL;
0102 }
0103 
0104 rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
0105 {
0106   /* FIXME: do something */
0107   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(irqnum));
0108   return RTEMS_SUCCESSFUL;
0109 }
0110 
0111 rtems_status_code bsp_interrupt_set_priority(
0112   rtems_vector_number vector,
0113   uint32_t priority
0114 )
0115 {
0116   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0117   return RTEMS_UNSATISFIED;
0118 }
0119 
0120 rtems_status_code bsp_interrupt_get_priority(
0121   rtems_vector_number vector,
0122   uint32_t *priority
0123 )
0124 {
0125   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
0126   bsp_interrupt_assert(priority != NULL);
0127   return RTEMS_UNSATISFIED;
0128 }
0129 
0130 void bsp_interrupt_facility_initialize(void)
0131 {
0132   rtems_status_code sc;
0133 
0134   /* Install exception handler */
0135   sc = ppc_exc_set_handler( ASM_EXT_VECTOR, qemuppc_exception_handler);
0136   _Assert_Unused_variable_equals( sc, RTEMS_SUCCESSFUL);
0137 }