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

📄 ppc400_pit_init_qtime.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"/* * ppc400_pit_init_qtime() *	Initialize Neutrino time data structures for use with the PPC400 PIT *  unit. *//* * Can use the TBLO register for startup interval timing since it's running * at the same speed as the PIT. */static unsignedtimer_start_pit_alternate() {	return(get_spr(PPC400_SPR_TBLO));}static unsignedtimer_diff_pit_alternate(unsigned start) {	return(get_spr(PPC400_SPR_TBLO) - start);}static unsignedtimer_start_pit_normal() {	return(get_spr(PPC_SPR_TBL));}static unsignedtimer_diff_pit_normal(unsigned start) {	return(get_spr(PPC_SPR_TBL) - start);}static const struct callout_slot timer_callouts[] = {	{ CALLOUT_SLOT( timer_load, _400 ) },	{ CALLOUT_SLOT( timer_value, _400 ) },	{ CALLOUT_SLOT( timer_reload, _400 ) },};voidppc400_pit_init_qtime() {	struct qtime_entry *qtime = alloc_qtime();	unsigned long		freq;	qtime->intr = PPC400_INTR_PI;	freq = cycles_freq;	if(freq == 0) freq = cpu_freq;	switch(PPC_GET_FAM_MEMBER(get_pvr())) {	case PPC_403:		if(get_dcr(PPC403_DCR_IOCR) & PPC403_IOCR_TCS) {			freq = timer_freq;		}		break;	}	qtime->cycles_per_sec = freq;	invert_timer_freq(qtime, freq);	add_callout_array(timer_callouts, sizeof(timer_callouts));	if(ppc400_mftb_supported()) {		timer_start = timer_start_pit_normal;		timer_diff  = timer_diff_pit_normal;	} else {		/*			401, 403 used different SPRs for timebase (for no			rational reason as far as I could see - doc says that they			weren't the same as PPC standard but I can't see how).		*/		timer_start = timer_start_pit_alternate;		timer_diff  = timer_diff_pit_alternate;	}}

⌨️ 快捷键说明

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