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

4.104.114.84.95
Last change on this file since 97871c97 was 97871c97, checked in by Joel Sherrill <joel.sherrill@…>, on 07/12/06 at 18:24:44

2006-07-12 Joel Sherrill <joel@…>

  • Makefile.am: Merge SHM support from 4.6 branch.
  • shmsupp/README, shmsupp/addrconv.c, shmsupp/getcfg.c, shmsupp/lock.c, shmsupp/mpisr.c: New files.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*  void Shm_Get_configuration( localnode, &shmcfg )
2 *
3 *  This routine initializes, if necessary, and returns a pointer
4 *  to the Shared Memory Configuration Table for the XXX target.
5 *
6 *  INPUT PARAMETERS:
7 *    localnode - local node number
8 *    shmcfg    - address of pointer to SHM Config Table
9 *
10 *  OUTPUT PARAMETERS:
11 *    *shmcfg   - pointer to SHM Config Table
12 *
13XXX: FIX THE COMMENTS BELOW WHEN THE CPU IS KNOWN
14 *  NOTES:  The XYZ does not have an interprocessor interrupt.
15 *
16 *          The following table illustrates the configuration limitations:
17 *
18 *                                   BUS     MAX
19 *                          MODE    ENDIAN  NODES
20 *                        ========= ====== =======
21 *                         POLLED    BIG    2+
22 *                        INTERRUPT **** NOT SUPPORTED ****
23 *
24 *  COPYRIGHT (c) 1989-1999.
25 *  On-Line Applications Research Corporation (OAR).
26 *
27 *  The license and distribution terms for this file may be
28 *  found in the file LICENSE in this distribution or at
29 *  http://www.rtems.com/license/LICENSE.
30 *
31 *  getcfg.c,v 1.7.8.1 2003/09/04 18:44:56 joel Exp
32 */
33
34#include <rtems.h>
35#include <bsp.h>
36#include <shm_driver.h>
37
38/* multiprocessor communications interface (MPCI) table */
39
40
41extern rtems_mpci_entry Shm_Get_packet(
42  rtems_packet_prefix **
43);
44
45rtems_mpci_entry Shm_Initialization( void );
46
47extern rtems_mpci_entry Shm_Receive_packet(
48  rtems_packet_prefix **
49);
50
51extern rtems_mpci_entry Shm_Return_packet(
52  rtems_packet_prefix *
53);
54
55extern rtems_mpci_entry Shm_Send_packet(
56  rtems_unsigned32,
57  rtems_packet_prefix *
58);
59
60
61/* rtems_mpci_table MPCI_table  = { */
62/*   100000,                     /\* default timeout value in ticks *\/ */
63/*   MAX_PACKET_SIZE,            /\* maximum packet size *\/ */
64/*   Shm_Initialization,         /\* initialization procedure   *\/ */
65/*   Shm_Get_packet,             /\* get packet procedure       *\/ */
66/*   Shm_Return_packet,          /\* return packet procedure    *\/ */
67/*   Shm_Send_packet,            /\* packet send procedure      *\/ */
68/*   Shm_Receive_packet          /\* packet receive procedure   *\/ */
69/* }; */
70
71
72/*
73 *  configured if currently polling of interrupt driven
74 */
75
76#define INTERRUPT 0        /* XXX: */
77#define POLLING   1        /* XXX: fix me -- is polling ONLY!!! */
78
79
80shm_config_table BSP_shm_cfgtbl;
81
82void Shm_Get_configuration(
83  rtems_unsigned32   localnode,
84  shm_config_table **shmcfg
85)
86{
87  extern rtems_configuration_table Configuration;
88  int i;
89  unsigned int tmp, ncpu;
90 
91   BSP_shm_cfgtbl.base         = 0x40000000;
92   BSP_shm_cfgtbl.length       = 0x00001000;
93   BSP_shm_cfgtbl.format       = SHM_BIG;
94
95   /*
96    *  Override cause_intr or shm_isr if your target has
97    *  special requirements.
98    */
99
100   BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt;
101
102#ifdef NEUTRAL_BIG
103   BSP_shm_cfgtbl.convert      = NULL_CONVERT;
104#else
105   BSP_shm_cfgtbl.convert      = CPU_swap_u32;
106#endif
107
108   BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
109   BSP_shm_cfgtbl.Intr.address = (vol_u32) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
110   BSP_shm_cfgtbl.Intr.value   = 1 << LEON3_MP_IRQ ;
111   BSP_shm_cfgtbl.Intr.length  = 4;
112
113   if (LEON3_Cpu_Index == 0)
114   {
115     tmp = 0; /* ncpu = (((LEON3_IrqCtrl_Regs->mpstat) >> 28) & 0xf) + 1; */
116     for (i = 1; i < (Configuration.User_multiprocessing_table)->maximum_nodes+1; i++)
117       tmp |= (1 << i);
118     LEON3_IrqCtrl_Regs->mpstat = tmp;
119   }
120
121   /*
122   if ((Configuration.User_multiprocessing_table)->node == 1)
123   {
124     tmp = 0;
125     for (i = 1; i < (Configuration.User_multiprocessing_table)->maximum_nodes; i++)
126     {
127       tmp = tmp | (1 << (LEON3_Cpu_Index + i));
128     }
129     LEON3_IrqCtrl_Regs->mpstat = tmp;
130   }
131   */
132     
133   *shmcfg = &BSP_shm_cfgtbl;
134}
Note: See TracBrowser for help on using the repository browser.