📄 ppc7450_init_l3_cache.c
字号:
/* * $QNXLicenseC: * Copyright 2007, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software except in * compliance with the License. You may obtain a copy of the License * at: http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */#include "startup.h"#include <ppc/603cpu.h>#include <ppc/700cpu.h>// Init the L3 cache on PPC7450 family chips. void ppc7450_init_l3_cache(unsigned flags) { unsigned l3cr, l3bits, tmp; // Mask off flag bits we don't need // Enable, clock on, flush tmp = ~(0x88000800) & flags; l3bits = 0x04000000; // Magic bit (errata) l3bits |= tmp; // passed-in flags l3cr = 0; set_spr(1018,l3cr); set_spr(1018,l3bits); asm("sync"); l3cr = l3bits | 0x08000000; //CLKEN asm("sync"); set_spr(1018,l3cr); asm("sync"); // Not sure if this delay is really needed -- it's in the // DINK init code tmp = 0x200000; while(--tmp) asm("nop"); asm("sync"); set_spr(1018,l3cr|0x0400); // L3I asm("sync"); // Wait for invalidate to finish while(get_spr(1018) & 0x0400); asm("sync"); // Not sure again if this is really needed tmp = 0x20000; while(--tmp) asm("nop"); set_spr(1018,l3bits); asm("sync"); // Not sure if this is really needed tmp = 0x200000; while(--tmp) asm("nop"); // OR-in clock enable and cache enable bits then turn on l3cr = l3bits | 0x88000000; //CLKEN|L3E asm("sync"); set_spr(1018,l3cr); asm("sync"); tmp = 0x200000; while(--tmp) asm("nop"); // We're done!}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -