Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*  void Shm_Get_configuration( localnode, &shmcfg )
0004  *
0005  *  This routine initializes, if necessary, and returns a pointer
0006  *  to the Shared Memory Configuration Table for the MVME147.
0007  *
0008  *  INPUT PARAMETERS:
0009  *    localnode - local node number
0010  *    shmcfg    - address of pointer to SHM Config Table
0011  *
0012  *  OUTPUT PARAMETERS:
0013  *    *shmcfg   - pointer to SHM Config Table
0014  *
0015  *  NOTES:  The SIGLP interrupt on the MVME147 is used as an interprocessor
0016  *          interrupt.
0017  *
0018  *  COPYRIGHT (c) 1989-1999.
0019  *  On-Line Applications Research Corporation (OAR).
0020  *
0021  * Redistribution and use in source and binary forms, with or without
0022  * modification, are permitted provided that the following conditions
0023  * are met:
0024  * 1. Redistributions of source code must retain the above copyright
0025  *    notice, this list of conditions and the following disclaimer.
0026  * 2. Redistributions in binary form must reproduce the above copyright
0027  *    notice, this list of conditions and the following disclaimer in the
0028  *    documentation and/or other materials provided with the distribution.
0029  *
0030  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0031  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0032  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0033  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0034  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0035  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0036  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0037  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0038  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0039  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0040  * POSSIBILITY OF SUCH DAMAGE.
0041  *
0042  *  MVME147 port for TNI - Telecom Bretagne
0043  *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
0044  *  June 1996
0045  */
0046 
0047 #include <bsp.h>
0048 #include <rtems.h>
0049 #include "shm_driver.h"
0050 
0051 #define INTERRUPT 1                   /* MVME147 target supports both */
0052 #define POLLING   0                   /* polling and interrupt modes  */
0053 
0054 shm_config_table BSP_shm_cfgtbl;
0055 
0056 static uint32_t *BSP_int_address(void)
0057 {
0058   uint32_t         id, offset;
0059 
0060   id      = (uint32_t) vme_lcsr->gcsr_base_address;
0061   offset  = (id << 4) & 0xF0;
0062   offset |= 0xffff0003; /* points to GCSR global 1 */
0063   return( (uint32_t         * ) offset );
0064 }
0065 
0066 void Shm_Get_configuration(
0067   uint32_t           localnode,
0068   shm_config_table **shmcfg
0069 )
0070 {
0071   /* A shared mem space has bee left between RAM_END and DRAM_END
0072    on the first node*/
0073   if (localnode == 1)
0074     BSP_shm_cfgtbl.base       = (vol_u32 *) RAM_END;
0075   else
0076     BSP_shm_cfgtbl.base       = (vol_u32 *) (DRAM_END + RAM_END);
0077 
0078   BSP_shm_cfgtbl.length       = DRAM_END - RAM_END;
0079   BSP_shm_cfgtbl.format       = SHM_BIG;
0080 
0081   BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt;
0082 
0083 #ifdef NEUTRAL_BIG
0084   BSP_shm_cfgtbl.convert      = NULL_CONVERT;
0085 #else
0086   BSP_shm_cfgtbl.convert      = CPU_swap_u32;
0087 #endif
0088 
0089 #if (POLLING==1)
0090   BSP_shm_cfgtbl.poll_intr    = POLLED_MODE;
0091   BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
0092   BSP_shm_cfgtbl.Intr.value   = NO_INTERRUPT;
0093   BSP_shm_cfgtbl.Intr.length  = NO_INTERRUPT;
0094 #else
0095   BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
0096   BSP_shm_cfgtbl.Intr.address = BSP_int_address(); /* GCSR global 1 */
0097   BSP_shm_cfgtbl.Intr.value   = 0x01; /* SIGLP */
0098   BSP_shm_cfgtbl.Intr.length  = BYTE;
0099 #endif
0100 
0101   *shmcfg = &BSP_shm_cfgtbl;
0102 
0103 }