1 | /* Blackfin MMU Support |
---|
2 | * |
---|
3 | * Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA |
---|
4 | * written by Allan Hessenflow <allanh@kallisti.com> |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | |
---|
14 | #include <rtems.h> |
---|
15 | |
---|
16 | #include <libcpu/memoryRegs.h> |
---|
17 | #include "mmu.h" |
---|
18 | |
---|
19 | /* NOTE: see notes in mmu.h */ |
---|
20 | |
---|
21 | void bfin_mmu_init(bfin_mmu_config_t *config) { |
---|
22 | intptr_t addr; |
---|
23 | intptr_t data; |
---|
24 | int i; |
---|
25 | |
---|
26 | addr = (intptr_t) ICPLB_ADDR0; |
---|
27 | data = (intptr_t) ICPLB_DATA0; |
---|
28 | for (i = 0; i < sizeof(config->instruction) / sizeof(config->instruction[0]); |
---|
29 | i++) { |
---|
30 | *(uint32_t volatile *) addr = (uint32_t) config->instruction[i].address; |
---|
31 | addr += ICPLB_ADDR_PITCH; |
---|
32 | *(uint32_t volatile *) data = config->instruction[i].flags; |
---|
33 | data += ICPLB_DATA_PITCH; |
---|
34 | } |
---|
35 | *(uint32_t volatile *) IMEM_CONTROL |= IMEM_CONTROL_ENICPLB; |
---|
36 | addr = (intptr_t) DCPLB_ADDR0; |
---|
37 | data = (intptr_t) DCPLB_DATA0; |
---|
38 | for (i = 0; i < sizeof(config->data) / sizeof(config->data[0]); i++) { |
---|
39 | *(uint32_t volatile *) addr = (uint32_t) config->data[i].address; |
---|
40 | addr += DCPLB_ADDR_PITCH; |
---|
41 | *(uint32_t volatile *) data = config->data[i].flags; |
---|
42 | data += DCPLB_DATA_PITCH; |
---|
43 | } |
---|
44 | *(uint32_t volatile *) DMEM_CONTROL |= DMEM_CONTROL_ENDCPLB; |
---|
45 | } |
---|
46 | |
---|