⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 harrier_init_raminfo.c

📁 qnx powerpc MPC8245的 BSP源文件
💻 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.  * $  *//* *  harrier_init_raminfo.c *	Tell syspage about our RAM configuration of Harrier based systems */#include "startup.h"// Initialize RAM information on a system with a Harrier memory controller// located at 'xcsr_base'voidharrier_init_raminfo(paddr_t xcsr_base) {	uint32_t		sbar_reg;	unsigned		size;	int				i;	uintptr_t		harrier;	harrier = startup_io_map(0x200, xcsr_base);	sbar_reg = in32(harrier+0x110);	size = 0;		// scan all 8 banks	for(i = 0; i < 8; i++) {		sbar_reg = in32(harrier + 0x110+(i<<2));		switch((sbar_reg>>16) & 0xf){		case 0: break; 		  				// size 0		case 1: size+=0x2000000; break;		// size 32M		case 2:		case 3: size+=0x4000000; break;		// size 64M 		case 4:		case 5:		case 6: size+=0x8000000; break;		// size 128M		case 7:		case 8:		case 9: size+=0x10000000; break;	// size 256M		case 10:		case 11:		case 12: size+=0x20000000; break;	// size 512M		case 13:				case 14: size+=0x40000000; break;	// size 1024M		case 15: size+=0x80000000; break;	// size 2048M		}	}	startup_io_unmap(harrier);	add_ram(0,size);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -