Back to home page

LXR

 
 

    


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

0001 /**
0002  *  @file
0003  *
0004  *  LEON3 Shared Memory Driver Support - Configuration
0005  */
0006 
0007 /*
0008  *  COPYRIGHT (c) 1989-2012.
0009  *  On-Line Applications Research Corporation (OAR).
0010  *
0011  *  The license and distribution terms for this file may be
0012  *  found in the file LICENSE in this distribution or at
0013  *  http://www.rtems.org/license/LICENSE.
0014  */
0015 
0016 #include <rtems.h>
0017 #include <bsp.h>
0018 #include <leon.h>
0019 #include <shm_driver.h>
0020 
0021 /* Let user override this configuration by declaring this a weak variable */
0022 shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
0023 {
0024   (vol_u32 *)0x40000000,    /* USER OVERRIDABLE */
0025   0x00001000,               /* USER OVERRIDABLE */
0026   SHM_BIG,
0027   NULL_CONVERT,
0028   INTR_MODE,
0029   Shm_Cause_interrupt,
0030   {
0031     NULL,
0032     0,                      /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */
0033     4,
0034   },
0035 };
0036 
0037 void Shm_Get_configuration(
0038   uint32_t   localnode,
0039   shm_config_table **shmcfg
0040 )
0041 {
0042   int i;
0043   unsigned int tmp;
0044   const rtems_multiprocessing_table *mptable;
0045 
0046   BSP_shm_cfgtbl.format       = SHM_BIG;
0047 
0048   /*
0049    *  Override cause_intr or shm_isr if your target has
0050    *  special requirements.
0051    */
0052 
0053   BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt;
0054 
0055 #ifdef NEUTRAL_BIG
0056   BSP_shm_cfgtbl.convert      = NULL_CONVERT;
0057 #else
0058   BSP_shm_cfgtbl.convert      = CPU_swap_u32;
0059 #endif
0060 
0061   BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
0062   BSP_shm_cfgtbl.Intr.address =
0063      (vol_u32 *) &(LEON3_IrqCtrl_Regs->piforce[LEON3_Cpu_Index]);
0064   if (BSP_shm_cfgtbl.Intr.value == 0)
0065     BSP_shm_cfgtbl.Intr.value = 1 << LEON3_mp_irq; /* Use default MP-IRQ */
0066   BSP_shm_cfgtbl.Intr.length  = 4;
0067 
0068   if (LEON3_Cpu_Index == 0) {
0069     tmp = 0;
0070     mptable = rtems_configuration_get_user_multiprocessing_table();
0071     for (i = 1; i < mptable->maximum_nodes; i++)
0072       tmp |= (1 << i);
0073     LEON3_IrqCtrl_Regs->mpstat = tmp;
0074   }
0075 
0076   *shmcfg = &BSP_shm_cfgtbl;
0077 }