[4967f6b] | 1 | /** |
---|
| 2 | * @file |
---|
[97871c97] | 3 | * |
---|
[4967f6b] | 4 | * LEON3 Shared Memory Driver Support - Configuration |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | /* |
---|
| 8 | * COPYRIGHT (c) 1989-2012. |
---|
[97871c97] | 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 |
---|
[c499856] | 13 | * http://www.rtems.org/license/LICENSE. |
---|
[97871c97] | 14 | */ |
---|
| 15 | |
---|
| 16 | #include <rtems.h> |
---|
| 17 | #include <bsp.h> |
---|
| 18 | #include <shm_driver.h> |
---|
| 19 | |
---|
[39e8aa9] | 20 | /* Let user override this configuration by declaring this a weak variable */ |
---|
| 21 | shm_config_table BSP_shm_cfgtbl __attribute__((weak)) = |
---|
| 22 | { |
---|
| 23 | (vol_u32 *)0x40000000, /* USER OVERRIDABLE */ |
---|
| 24 | 0x00001000, /* USER OVERRIDABLE */ |
---|
| 25 | SHM_BIG, |
---|
| 26 | NULL_CONVERT, |
---|
| 27 | INTR_MODE, |
---|
| 28 | Shm_Cause_interrupt, |
---|
| 29 | { |
---|
| 30 | NULL, |
---|
[93b000e] | 31 | 0, /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */ |
---|
[39e8aa9] | 32 | 4, |
---|
| 33 | }, |
---|
| 34 | }; |
---|
[97871c97] | 35 | |
---|
| 36 | void Shm_Get_configuration( |
---|
[1408ea8d] | 37 | uint32_t localnode, |
---|
[97871c97] | 38 | shm_config_table **shmcfg |
---|
| 39 | ) |
---|
| 40 | { |
---|
| 41 | int i; |
---|
[4bbf6ecb] | 42 | unsigned int tmp; |
---|
[363b1f7] | 43 | rtems_multiprocessing_table *mptable; |
---|
[44b06ca] | 44 | |
---|
[4bbf6ecb] | 45 | BSP_shm_cfgtbl.format = SHM_BIG; |
---|
[97871c97] | 46 | |
---|
[4bbf6ecb] | 47 | /* |
---|
| 48 | * Override cause_intr or shm_isr if your target has |
---|
| 49 | * special requirements. |
---|
| 50 | */ |
---|
[97871c97] | 51 | |
---|
[4bbf6ecb] | 52 | BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt; |
---|
[97871c97] | 53 | |
---|
| 54 | #ifdef NEUTRAL_BIG |
---|
[4bbf6ecb] | 55 | BSP_shm_cfgtbl.convert = NULL_CONVERT; |
---|
[97871c97] | 56 | #else |
---|
[4bbf6ecb] | 57 | BSP_shm_cfgtbl.convert = CPU_swap_u32; |
---|
[97871c97] | 58 | #endif |
---|
| 59 | |
---|
[4bbf6ecb] | 60 | BSP_shm_cfgtbl.poll_intr = INTR_MODE; |
---|
| 61 | BSP_shm_cfgtbl.Intr.address = |
---|
[6d79be5] | 62 | (vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]); |
---|
[39e8aa9] | 63 | if (BSP_shm_cfgtbl.Intr.value == 0) |
---|
[93b000e] | 64 | BSP_shm_cfgtbl.Intr.value = 1 << LEON3_mp_irq; /* Use default MP-IRQ */ |
---|
[4bbf6ecb] | 65 | BSP_shm_cfgtbl.Intr.length = 4; |
---|
| 66 | |
---|
| 67 | if (LEON3_Cpu_Index == 0) { |
---|
| 68 | tmp = 0; |
---|
[363b1f7] | 69 | mptable = rtems_configuration_get_user_multiprocessing_table(); |
---|
| 70 | for (i = 1; i < mptable->maximum_nodes; i++) |
---|
[4bbf6ecb] | 71 | tmp |= (1 << i); |
---|
[44b06ca] | 72 | LEON3_IrqCtrl_Regs->mpstat = tmp; |
---|
[4bbf6ecb] | 73 | } |
---|
| 74 | |
---|
| 75 | *shmcfg = &BSP_shm_cfgtbl; |
---|
[97871c97] | 76 | } |
---|