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 | * |
---|
13 | XXX: 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 | |
---|
32 | #include <rtems.h> |
---|
33 | #include <bsp.h> |
---|
34 | #include <shm_driver.h> |
---|
35 | |
---|
36 | /* multiprocessor communications interface (MPCI) table */ |
---|
37 | |
---|
38 | |
---|
39 | extern rtems_mpci_entry Shm_Get_packet( |
---|
40 | rtems_packet_prefix ** |
---|
41 | ); |
---|
42 | |
---|
43 | rtems_mpci_entry Shm_Initialization( void ); |
---|
44 | |
---|
45 | extern rtems_mpci_entry Shm_Receive_packet( |
---|
46 | rtems_packet_prefix ** |
---|
47 | ); |
---|
48 | |
---|
49 | extern rtems_mpci_entry Shm_Return_packet( |
---|
50 | rtems_packet_prefix * |
---|
51 | ); |
---|
52 | |
---|
53 | extern rtems_mpci_entry Shm_Send_packet( |
---|
54 | uint32_t, |
---|
55 | rtems_packet_prefix * |
---|
56 | ); |
---|
57 | |
---|
58 | |
---|
59 | /* rtems_mpci_table MPCI_table = { */ |
---|
60 | /* 100000, /\* default timeout value in ticks *\/ */ |
---|
61 | /* MAX_PACKET_SIZE, /\* maximum packet size *\/ */ |
---|
62 | /* Shm_Initialization, /\* initialization procedure *\/ */ |
---|
63 | /* Shm_Get_packet, /\* get packet procedure *\/ */ |
---|
64 | /* Shm_Return_packet, /\* return packet procedure *\/ */ |
---|
65 | /* Shm_Send_packet, /\* packet send procedure *\/ */ |
---|
66 | /* Shm_Receive_packet /\* packet receive procedure *\/ */ |
---|
67 | /* }; */ |
---|
68 | |
---|
69 | |
---|
70 | /* |
---|
71 | * configured if currently polling of interrupt driven |
---|
72 | */ |
---|
73 | |
---|
74 | #define INTERRUPT 0 /* XXX: */ |
---|
75 | #define POLLING 1 /* XXX: fix me -- is polling ONLY!!! */ |
---|
76 | |
---|
77 | /* Let user override this configuration by declaring this a weak variable */ |
---|
78 | shm_config_table BSP_shm_cfgtbl __attribute__((weak)) = |
---|
79 | { |
---|
80 | (vol_u32 *)0x40000000, /* USER OVERRIDABLE */ |
---|
81 | 0x00001000, /* USER OVERRIDABLE */ |
---|
82 | SHM_BIG, |
---|
83 | NULL_CONVERT, |
---|
84 | INTR_MODE, |
---|
85 | Shm_Cause_interrupt, |
---|
86 | { |
---|
87 | NULL, |
---|
88 | 1 << LEON3_MP_IRQ, /* USER OVERRIDABLE */ |
---|
89 | 4, |
---|
90 | }, |
---|
91 | }; |
---|
92 | |
---|
93 | void Shm_Get_configuration( |
---|
94 | uint32_t localnode, |
---|
95 | shm_config_table **shmcfg |
---|
96 | ) |
---|
97 | { |
---|
98 | extern rtems_configuration_table Configuration; |
---|
99 | int i; |
---|
100 | unsigned int tmp; |
---|
101 | |
---|
102 | BSP_shm_cfgtbl.format = SHM_BIG; |
---|
103 | |
---|
104 | /* |
---|
105 | * Override cause_intr or shm_isr if your target has |
---|
106 | * special requirements. |
---|
107 | */ |
---|
108 | |
---|
109 | BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt; |
---|
110 | |
---|
111 | #ifdef NEUTRAL_BIG |
---|
112 | BSP_shm_cfgtbl.convert = NULL_CONVERT; |
---|
113 | #else |
---|
114 | BSP_shm_cfgtbl.convert = CPU_swap_u32; |
---|
115 | #endif |
---|
116 | |
---|
117 | BSP_shm_cfgtbl.poll_intr = INTR_MODE; |
---|
118 | BSP_shm_cfgtbl.Intr.address = |
---|
119 | (vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]); |
---|
120 | if (BSP_shm_cfgtbl.Intr.value == 0) |
---|
121 | BSP_shm_cfgtbl.Intr.value = 1 << LEON3_MP_IRQ; /* Use default MP-IRQ */ |
---|
122 | BSP_shm_cfgtbl.Intr.length = 4; |
---|
123 | |
---|
124 | if (LEON3_Cpu_Index == 0) { |
---|
125 | tmp = 0; |
---|
126 | for (i = 1; |
---|
127 | i < (Configuration.User_multiprocessing_table)->maximum_nodes; i++) |
---|
128 | tmp |= (1 << i); |
---|
129 | LEON3_IrqCtrl_Regs->mpstat = tmp; |
---|
130 | } |
---|
131 | |
---|
132 | *shmcfg = &BSP_shm_cfgtbl; |
---|
133 | } |
---|