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

📄 init_hwinfo.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.  * $  */#include "startup.h"#include <ppc/85xxintr.h>/* * Initialize hwinfo structure in the system page. * This code is hardware dependant and may have to be changed * changed by end users. */extern uint32_t	ppc8260_brgclk;extern short 	duart;extern short 	ntsecs;extern uint32_t platform_clock;static voidadd_one_ser(unsigned off, int clock) {	paddr_t		paddr = immr_paddr + off;	hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_SERIAL, "8250", 0);	hwi_add_inputclk(264000000, 16);	hwi_add_irq(PPC85xx_INTR_DUART);	hwi_add_location(paddr, 8, 0, hwi_find_as(paddr, 0));	hwi_add_inputclk(clock, 16);}static void add_one_tsec(unsigned off, 					unsigned intr_tx, 					unsigned int intr_rx, 					unsigned int intr_err,					unsigned char *mac,					unsigned char phy_addr){	paddr_t		paddr = immr_paddr + off;	hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_NETWORK, "tsec", 0);	hwi_add_location(paddr, 8, 0, hwi_find_as(paddr, 0));	hwi_add_irq(intr_tx);	hwi_add_irq(intr_rx);	hwi_add_irq(intr_err);	if (mac != NULL) {		hwi_add_nicaddr(mac, 6);	}	if (phy_addr != 0xFF) {		hwi_add_nicphyaddr(phy_addr);	}}voidinit_hwinfo() {	unsigned char mac[6];	if(duart) {		add_one_ser(0x4500, platform_clock);		add_one_ser(0x4600, platform_clock);	} else {		hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_SERIAL, "scc1", 0);				hwi_add_inputclk(ppc8260_brgclk, 16);		hwi_add_irq(PPC85xx_INTR_CPM_SCC1);		hwi_add_irq(PPC85xx_INTR_CPM_PC14);		hwi_add_irq(PPC85xx_INTR_CPM_PC15);		hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_SERIAL, "scc2", 0);		hwi_add_inputclk(ppc8260_brgclk, 16);		hwi_add_irq(PPC85xx_INTR_CPM_SCC2);		hwi_add_irq(PPC85xx_INTR_CPM_PC12);		hwi_add_irq(PPC85xx_INTR_CPM_PC13);	}	mac[0] = 0x00;	mac[1] = 0xE0;	mac[2] = 0x0C;	mac[3] = 0x00;	mac[4] = 0x00;	mac[5] = 0xFD;	add_one_tsec(0x24000, PPC85xx_INTR_TSEC1_TX, PPC85xx_INTR_TSEC1_RX,				PPC85xx_INTR_TSEC1_ERROR,mac,0);	mac[4] = 0x01;	add_one_tsec(0x25000, PPC85xx_INTR_TSEC2_TX, PPC85xx_INTR_TSEC2_RX,				PPC85xx_INTR_TSEC2_ERROR,mac,1);	if (ntsecs > 2) {		mac[4] = 0x02;		add_one_tsec(0x26000, PPC85xx_INTR_TSEC3_TX, PPC85xx_INTR_TSEC3_RX,				PPC85xx_INTR_TSEC3_ERROR,mac,2);		if (ntsecs > 3) {			mac[4] = 0x03;			add_one_tsec(0x27000, PPC85xx_INTR_TSEC4_TX, PPC85xx_INTR_TSEC4_RX,				PPC85xx_INTR_TSEC4_ERROR,mac,3);		}	}	//add PCI information}

⌨️ 快捷键说明

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