Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:40

0001 /*  Blackfin MMU Support
0002  *
0003  *  Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA
0004  *             written by Allan Hessenflow <allanh@kallisti.com>
0005  *
0006  *  The license and distribution terms for this file may be
0007  *  found in the file LICENSE in this distribution or at
0008  *  http://www.rtems.org/license/LICENSE.
0009  */
0010 
0011 
0012 #include <rtems.h>
0013 
0014 #include <libcpu/memoryRegs.h>
0015 #include <libcpu/mmu.h>
0016 
0017 /* NOTE: see notes in mmu.h */
0018 
0019 void bfin_mmu_init(bfin_mmu_config_t *config) {
0020   intptr_t addr;
0021   intptr_t data;
0022   int i;
0023 
0024   addr = (intptr_t) ICPLB_ADDR0;
0025   data = (intptr_t) ICPLB_DATA0;
0026   for (i = 0; i < sizeof(config->instruction) / sizeof(config->instruction[0]);
0027        i++) {
0028     *(uint32_t volatile *) addr = (uint32_t) config->instruction[i].address;
0029     addr += ICPLB_ADDR_PITCH;
0030     *(uint32_t volatile *) data = config->instruction[i].flags;
0031     data += ICPLB_DATA_PITCH;
0032   }
0033   *(uint32_t volatile *) IMEM_CONTROL |= IMEM_CONTROL_ENICPLB;
0034   addr = (intptr_t) DCPLB_ADDR0;
0035   data = (intptr_t) DCPLB_DATA0;
0036   for (i = 0; i < sizeof(config->data) / sizeof(config->data[0]); i++) {
0037     *(uint32_t volatile *) addr = (uint32_t) config->data[i].address;
0038     addr += DCPLB_ADDR_PITCH;
0039     *(uint32_t volatile *) data = config->data[i].flags;
0040     data += DCPLB_DATA_PITCH;
0041   }
0042   *(uint32_t volatile *) DMEM_CONTROL |= DMEM_CONTROL_ENDCPLB;
0043 }
0044