summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-04-24 16:58:41 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-04-24 16:58:41 +0000
commitcadb5d1641059adb5bbef5900e2cefee653f2b74 (patch)
tree6353a9fe2f02c1b89b69e6cf55eef27d24710ce7 /c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
parent2006-04-24 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-cadb5d1641059adb5bbef5900e2cefee653f2b74.tar.bz2
2006-04-24 Jiri Gaisler <jiri@gaisler.com>
Edvin Catovic <edvin@gaisler.com> PR bsps/972 * ChangeLog, Makefile.am, configure.ac, amba/amba.c, clock/ckinit.c, console/Makefile.am, console/console.c, console/debugputs.c, include/Makefile.am, include/amba.h, include/bsp.h, include/leon.h, leon_smc91111/leon_smc91111.c, startup/bspstart.c, timer/timer.c, tools/Makefile.am, wrapup/Makefile.am: Added Shared Memory Support Driver. Added Leon Gaisler Research Ethernet support. Enhanced AMBA bus support. * console/debugprintf.c, console/spacewire.c, include/spacewire.h, leon_greth/.cvsignore, leon_greth/Makefile.am, leon_greth/leon_greth.c, shmsupp/.cvsignore, shmsupp/Makefile.am, shmsupp/addrconv.c, shmsupp/getcfg.c, shmsupp/lock.c, shmsupp/mpisr.c: New files.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
new file mode 100644
index 0000000000..b56702849e
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
@@ -0,0 +1,134 @@
+/* void Shm_Get_configuration( localnode, &shmcfg )
+ *
+ * This routine initializes, if necessary, and returns a pointer
+ * to the Shared Memory Configuration Table for the XXX target.
+ *
+ * INPUT PARAMETERS:
+ * localnode - local node number
+ * shmcfg - address of pointer to SHM Config Table
+ *
+ * OUTPUT PARAMETERS:
+ * *shmcfg - pointer to SHM Config Table
+ *
+XXX: FIX THE COMMENTS BELOW WHEN THE CPU IS KNOWN
+ * NOTES: The XYZ does not have an interprocessor interrupt.
+ *
+ * The following table illustrates the configuration limitations:
+ *
+ * BUS MAX
+ * MODE ENDIAN NODES
+ * ========= ====== =======
+ * POLLED BIG 2+
+ * INTERRUPT **** NOT SUPPORTED ****
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * getcfg.c,v 1.7.8.1 2003/09/04 18:44:56 joel Exp
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <shm_driver.h>
+
+/* multiprocessor communications interface (MPCI) table */
+
+
+extern rtems_mpci_entry Shm_Get_packet(
+ rtems_packet_prefix **
+);
+
+rtems_mpci_entry Shm_Initialization( void );
+
+extern rtems_mpci_entry Shm_Receive_packet(
+ rtems_packet_prefix **
+);
+
+extern rtems_mpci_entry Shm_Return_packet(
+ rtems_packet_prefix *
+);
+
+extern rtems_mpci_entry Shm_Send_packet(
+ rtems_unsigned32,
+ rtems_packet_prefix *
+);
+
+
+/* rtems_mpci_table MPCI_table = { */
+/* 100000, /\* default timeout value in ticks *\/ */
+/* MAX_PACKET_SIZE, /\* maximum packet size *\/ */
+/* Shm_Initialization, /\* initialization procedure *\/ */
+/* Shm_Get_packet, /\* get packet procedure *\/ */
+/* Shm_Return_packet, /\* return packet procedure *\/ */
+/* Shm_Send_packet, /\* packet send procedure *\/ */
+/* Shm_Receive_packet /\* packet receive procedure *\/ */
+/* }; */
+
+
+/*
+ * configured if currently polling of interrupt driven
+ */
+
+#define INTERRUPT 0 /* XXX: */
+#define POLLING 1 /* XXX: fix me -- is polling ONLY!!! */
+
+
+shm_config_table BSP_shm_cfgtbl;
+
+void Shm_Get_configuration(
+ rtems_unsigned32 localnode,
+ shm_config_table **shmcfg
+)
+{
+ extern rtems_configuration_table Configuration;
+ int i;
+ unsigned int tmp, ncpu;
+
+ BSP_shm_cfgtbl.base = 0x40000000;
+ BSP_shm_cfgtbl.length = 0x00001000;
+ BSP_shm_cfgtbl.format = SHM_BIG;
+
+ /*
+ * Override cause_intr or shm_isr if your target has
+ * special requirements.
+ */
+
+ BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
+
+#ifdef NEUTRAL_BIG
+ BSP_shm_cfgtbl.convert = NULL_CONVERT;
+#else
+ BSP_shm_cfgtbl.convert = CPU_swap_u32;
+#endif
+
+ BSP_shm_cfgtbl.poll_intr = INTR_MODE;
+ BSP_shm_cfgtbl.Intr.address = (vol_u32) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
+ BSP_shm_cfgtbl.Intr.value = 1 << LEON3_MP_IRQ ;
+ BSP_shm_cfgtbl.Intr.length = 4;
+
+ if (LEON3_Cpu_Index == 0)
+ {
+ tmp = 0; /* ncpu = (((LEON3_IrqCtrl_Regs->mpstat) >> 28) & 0xf) + 1; */
+ for (i = 1; i < (Configuration.User_multiprocessing_table)->maximum_nodes+1; i++)
+ tmp |= (1 << i);
+ LEON3_IrqCtrl_Regs->mpstat = tmp;
+ }
+
+ /*
+ if ((Configuration.User_multiprocessing_table)->node == 1)
+ {
+ tmp = 0;
+ for (i = 1; i < (Configuration.User_multiprocessing_table)->maximum_nodes; i++)
+ {
+ tmp = tmp | (1 << (LEON3_Cpu_Index + i));
+ }
+ LEON3_IrqCtrl_Regs->mpstat = tmp;
+ }
+ */
+
+ *shmcfg = &BSP_shm_cfgtbl;
+}