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 | |
---|
22 | extern rtems_mpci_entry Shm_Get_packet( |
---|
23 | rtems_packet_prefix ** |
---|
24 | ); |
---|
25 | |
---|
26 | rtems_mpci_entry Shm_Initialization( void ); |
---|
27 | |
---|
28 | extern rtems_mpci_entry Shm_Receive_packet( |
---|
29 | rtems_packet_prefix ** |
---|
30 | ); |
---|
31 | |
---|
32 | extern rtems_mpci_entry Shm_Return_packet( |
---|
33 | rtems_packet_prefix * |
---|
34 | ); |
---|
35 | |
---|
36 | extern 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 */ |
---|
53 | shm_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 | |
---|
68 | void 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 | } |
---|