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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 2.3 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    1 << LEON3_MP_IRQ,      /* USER OVERRIDABLE */
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
76  BSP_shm_cfgtbl.format       = SHM_BIG;
77
78  /*
79   *  Override cause_intr or shm_isr if your target has
80   *  special requirements.
81   */
82
83  BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt;
84
85#ifdef NEUTRAL_BIG
86  BSP_shm_cfgtbl.convert      = NULL_CONVERT;
87#else
88  BSP_shm_cfgtbl.convert      = CPU_swap_u32;
89#endif
90
91  BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
92  BSP_shm_cfgtbl.Intr.address =
93     (vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
94  if (BSP_shm_cfgtbl.Intr.value == 0)
95    BSP_shm_cfgtbl.Intr.value = 1 << LEON3_MP_IRQ; /* Use default MP-IRQ */
96  BSP_shm_cfgtbl.Intr.length  = 4;
97
98  if (LEON3_Cpu_Index == 0) {
99    tmp = 0;
100    for (i = 1;
101         i < (rtems_configuration_get_user_multiprocessing_table())->maximum_nodes; i++)
102      tmp |= (1 << i);
103    LEON3_IrqCtrl_Regs->mpstat = tmp;
104  }
105
106  *shmcfg = &BSP_shm_cfgtbl;
107}
Note: See TracBrowser for help on using the repository browser.