source: rtems/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c @ 93b000e

4.115
Last change on this file since 93b000e was 93b000e, checked in by Daniel Cederman <cederman@…>, on Oct 1, 2014 at 11:53:03 AM

bsp/leon3: Replace the define LEON3_MP_IRQ with a weakly linked variable

The LEON3_MP_IRQ define is used to pick the IRQ to be used by the
shared memory driver and for inter-processor interrupts. On some LEON3
systems, for example the GR712RC, the default value of 14 is not suitable.
To make this value configurable from the application, it is replaced with
a weakly linked variable that can be overridden from the application.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 *  @file
3 *
4 *  LEON3 Shared Memory Driver Support - Configuration
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2012.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <rtems.h>
17#include <bsp.h>
18#include <shm_driver.h>
19
20/* multiprocessor communications interface (MPCI) table */
21
22extern rtems_mpci_entry Shm_Get_packet(
23  rtems_packet_prefix **
24);
25
26rtems_mpci_entry Shm_Initialization( void );
27
28extern rtems_mpci_entry Shm_Receive_packet(
29  rtems_packet_prefix **
30);
31
32extern rtems_mpci_entry Shm_Return_packet(
33  rtems_packet_prefix *
34);
35
36extern rtems_mpci_entry Shm_Send_packet(
37  uint32_t,
38  rtems_packet_prefix *
39);
40
41
42/*
43 *  configured if currently polling or interrupt driven
44 *
45 *  NOTE: Code in mpisr.c is commented out. Fix when interrupt mode
46 *        is added.
47 */
48
49#define INTERRUPT 0        /* XXX: */
50#define POLLING   1        /* XXX: fix me -- is polling ONLY!!! */
51
52/* Let user override this configuration by declaring this a weak variable */
53shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
54{
55  (vol_u32 *)0x40000000,    /* USER OVERRIDABLE */
56  0x00001000,               /* USER OVERRIDABLE */
57  SHM_BIG,
58  NULL_CONVERT,
59  INTR_MODE,
60  Shm_Cause_interrupt,
61  {
62    NULL,
63    0,                      /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */
64    4,
65  },
66};
67
68void Shm_Get_configuration(
69  uint32_t   localnode,
70  shm_config_table **shmcfg
71)
72{
73  int i;
74  unsigned int tmp;
75  rtems_multiprocessing_table *mptable;
76
77  BSP_shm_cfgtbl.format       = SHM_BIG;
78
79  /*
80   *  Override cause_intr or shm_isr if your target has
81   *  special requirements.
82   */
83
84  BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt;
85
86#ifdef NEUTRAL_BIG
87  BSP_shm_cfgtbl.convert      = NULL_CONVERT;
88#else
89  BSP_shm_cfgtbl.convert      = CPU_swap_u32;
90#endif
91
92  BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
93  BSP_shm_cfgtbl.Intr.address =
94     (vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
95  if (BSP_shm_cfgtbl.Intr.value == 0)
96    BSP_shm_cfgtbl.Intr.value = 1 << LEON3_mp_irq; /* Use default MP-IRQ */
97  BSP_shm_cfgtbl.Intr.length  = 4;
98
99  if (LEON3_Cpu_Index == 0) {
100    tmp = 0;
101    mptable = rtems_configuration_get_user_multiprocessing_table();
102    for (i = 1; i < mptable->maximum_nodes; i++)
103      tmp |= (1 << i);
104    LEON3_IrqCtrl_Regs->mpstat = tmp;
105  }
106
107  *shmcfg = &BSP_shm_cfgtbl;
108}
Note: See TracBrowser for help on using the repository browser.