亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bsl_pdev.c

?? BSL64xx是一dsp的程序代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************\
* Copyright (C) 2004 by RTD Embedded Technologies, Inc.   All rights reserved.
* Confidential and Proprietary, Not for Public Release
*------------------------------------------------------------------------------
* PROJECT.......... Board Support Library for SPM6420
* VERSION.......... (Defined in README.TXT)
*------------------------------------------------------------------------------
* CONTENT.......... PCI Device Module of BSL
* FILENAME......... bsl_pdev.c
\******************************************************************************/
#define _BSL_PDEV_MOD_

#include <bsl_pdev.h>
#include <bsl_pcibus.h>


#if (BSL_PDEV_SUPPORT)
/******************************************************************************\
*                         L O C A L   S E C T I O N
\******************************************************************************/


/******************************************************************************\
* static macro declarations
\******************************************************************************/

// this many PCI devices can be opened at a time
#define PDEV_MAX_OPENED_PCI_DEVICES			4

// PCI config register number in a PCI device's header
#define PDEV_HDR_PCIIDR_REGOFFS32			0
#define PDEV_HDR_PCICRSR_REGOFFS32			1
#define PDEV_HDR_PCIBAR0_REGOFFS32			4
#define PDEV_HDR_PCIBAR1_REGOFFS32			5
#define PDEV_HDR_PCIBAR2_REGOFFS32			6
#define PDEV_HDR_PCIBAR3_REGOFFS32			7


/******************************************************************************\
* static typedef declarations
\******************************************************************************/

// structure to maintain the opened PCI devices
typedef struct {
	Uint32 vendorAndDeviceID;
	Uint32 ordinal;
} PDEV_OpenedDevices;


/******************************************************************************\
* static function declarations
\******************************************************************************/

BOOL	PDEV_isOpened(Uint32 vendorAndDeviceID, Uint32 ordinal);
Uint32	PDEV_canBeOpened();
Uint32	PDEV_findDevice(Uint32 vendorAndDeviceID, Uint32 ordinal,
			PDEV_DeviceObj *deviceObj);
Uint32	PDEV_readPCIcfg(Uint32 reg, Uint32 dev, Uint32 *val);
Uint32	PDEV_writePCIcfg(Uint32 reg, Uint32 dev, Uint32 val);


/******************************************************************************\
* static variable definitions
\******************************************************************************/

// stores the opened PCI devices ({0,0} means, the 'slot' is empty)
PDEV_OpenedDevices _PDEV_openedDevices[PDEV_MAX_OPENED_PCI_DEVICES] = {
	{0, 0}, {0, 0}, {0, 0}, {0, 0}
};


/******************************************************************************\
* static function definitions
\******************************************************************************/

//==============================================================================
// Returns TRUE, if the given PCI device is opened currently.
//
// parameters:
//		vendorAndDeviceID	Vendor and Device ID of the queried PCI device.
//		ordinal				Ordinal number of the queried PCI device within the
//							set of the same Vendor and Device ID devices.
//
// returns:
//		TRUE, if the queried PCI device is opened currently.
//		Otherwise, FALSE.
//==============================================================================
BOOL PDEV_isOpened(Uint32 vendorAndDeviceID, Uint32 ordinal)
{
	Uint32 dev;

	for( dev = 0; dev < PDEV_MAX_OPENED_PCI_DEVICES; dev++)
	{
		if( (_PDEV_openedDevices[dev].vendorAndDeviceID == vendorAndDeviceID)
			&& (_PDEV_openedDevices[dev].ordinal == ordinal) ) return TRUE;
	}
	return FALSE;
}

//==============================================================================
// Returns the index of the slot that can be used to store a new opened PCI
// device for maintain.
// If there is no more room, the returned value is greater than the greatest
// index.
//==============================================================================
Uint32 PDEV_canBeOpened()
{
	Uint32 dev;

	for( dev = 0; dev < PDEV_MAX_OPENED_PCI_DEVICES; dev++)
	{
		if( (_PDEV_openedDevices[dev].vendorAndDeviceID == 0)
			&& (_PDEV_openedDevices[dev].ordinal == 0) ) return dev;
	}

	/* there is no more place */
	return (PDEV_MAX_OPENED_PCI_DEVICES + 1);
}

//==============================================================================
// Attempts to find a PCI device and fills up a PDEV_DeviceObj structure to
// handle the found device.
//
// This function can find PCI device with 'function number' 0 only.
//
// parameters:
//		vendorAndDeviceID	Vendor and Device ID of the queried PCI device.
//							The PDEV_PCI_BOARD_RTD_x macros should be used.
//		ordinal				Ordinal number of the queried PCI device within the
//							set of the same Vendor and Device ID devices.
//							Must be at least 1.
//		pDeviceObj			Pointer to the PCI device descriptor to be filled
//							up, if the requested device has been found.
//
// returns:
//		PDEV_DEVICE_FOUND		All right. Device has been found.
//		PDEV_DEVICE_NOT_FOUND	No error, but the device has not been found.
//		PDEV_PCI_CONFIG_ERROR	PCI configuration cycle error has occured.
//==============================================================================
Uint32 PDEV_findDevice(Uint32 vendorAndDeviceID, Uint32 ordinal,
	PDEV_DeviceObj * pDeviceObj)
{
	Uint32	dev, ven_dev_id, ord;
	Uint32	pcicrsr;
	Uint32	bar;

	ord = 1;

	for( dev = 0; dev <= 15; dev++ )
	{
		// read PCI Configuration and check error
		if( PDEV_readPCIcfg(PDEV_HDR_PCIIDR_REGOFFS32,dev,&ven_dev_id)
			== PCIBUS_TOE_NO_ERROR )
		{
			// a PCI device has been found
			if( ven_dev_id == vendorAndDeviceID )
			{
				// an appropriate PCI device has been found according to the
				// given Vendor and Device IDs
				if( ord >= ordinal )
					// the ">=" is a protection for parameter 'ordinal' = 0
					// thus, the ordinal = 0 and 1 mean 1
				{
					// the required PCI device has been found

					// stores the location of the device
					// If later, a PCI config cycle has to be applied for the
					// opened device, you can use this device number.
					pDeviceObj->location = dev;

					pDeviceObj->barTypes = 0;

					// read PCICRSR reg.
					if( PDEV_readPCIcfg(
							PDEV_HDR_PCICRSR_REGOFFS32,dev,&pcicrsr)
						!= PCIBUS_TOE_NO_ERROR )
					{
						return PDEV_PCI_CONFIG_ERROR;
					}

					// clear PCICRSR reg's error flags and set flags to
					// response Memory and I/O cycles.
					pcicrsr |= 0xF8000007;

					// write PCICRSR reg. back
					if( PDEV_writePCIcfg(
							PDEV_HDR_PCICRSR_REGOFFS32,dev,pcicrsr)
						!= PCIBUS_TOE_NO_ERROR )
					{
						return PDEV_PCI_CONFIG_ERROR;
					}

					// read Base Address registers
					for( bar = 0; bar < PDEV_NUMBER_OF_BARS; bar++ )
					{
						if( PDEV_readPCIcfg(
								PDEV_HDR_PCIBAR0_REGOFFS32 + bar,
								dev, &(pDeviceObj->baseAddress[bar]) )
							!= PCIBUS_TOE_NO_ERROR )
						{
							return PDEV_PCI_CONFIG_ERROR;
						}

						// store the Type Of the base address (Memory or I/O)
						pDeviceObj->barTypes |=
							(pDeviceObj->baseAddress[bar] & 0xF) << (4 * bar);

						// make clear Base Address without control bits in the
						// lower bits
						pDeviceObj->baseAddress[bar] &= ~0xF;
					}

					// The requested PCI device has been found, the major
					// information about the device has been stored in the
					// pDeviceObj.
					return PDEV_DEVICE_FOUND;
				}
				// search the next device with the same Vendor and Device IDs
				ord++;
			}
			else
			{
				// NOT this device what we want to find
				// do nothing, go on
			}
		}
	}

	// The requested PCI device has not been found.
	return PDEV_DEVICE_NOT_FOUND;
}

//==============================================================================
// Initiates a PCI Configuration Read Cycle to read a PCI Configuration
// register of a PCI device.
//
// parameters:
//		reg			ordinal number of the register to be read
//		dev			PCI device number of the PCI deivce to be reached
//		val			pointer to an Uint32-type variable to be filled up with the
//					value of the read register
//
// returns:
//		error codes according to the PCIBUS_getError()
//		PCIBUS_TOE_NO_ERROR = All right.
//==============================================================================
Uint32 PDEV_readPCIcfg(Uint32 reg, Uint32 dev, Uint32 *val)
{
	PCIBUS_AccessReqObj	reqCfgCycle;

	// make a request for the PCI Configuration Cycle
	PCIBUS_makeReq_Cfg(
		&reqCfgCycle, reg, 0, dev, val, PCIBUS_TRANSFER_FROM_PCI);

	// reading
	PCIBUS_accessReqWithWait( &reqCfgCycle );

	// check error
	return PCIBUS_getError( &reqCfgCycle );
}

//==============================================================================
// Initiates a PCI Configuration Write Cycle to write a PCI Configuration
// register of a PCI device.
//
// parameters:
//		reg			ordinal number of the register to be read
//		dev			PCI device number of the PCI deivce to be reached
//		bus			PCI bus number of the PCI deivce to be reached
//		val			32-bit word to be written into the selected register of the
//					accessed PCI device
//
// returns:
//		error codes according to the PCIBUS_getError()
//		PCIBUS_TOE_NO_ERROR = All right.
//==============================================================================
Uint32 PDEV_writePCIcfg(Uint32 reg, Uint32 dev, Uint32 val)
{
	PCIBUS_AccessReqObj	reqCfgCycle;
	Uint32	value = val;

	// make a request for the PCI Configuration Cycle
	PCIBUS_makeReq_Cfg(
		&reqCfgCycle, reg, 0, dev, &value, PCIBUS_TRANSFER_TO_PCI);

	// reading
	PCIBUS_accessReqWithWait( &reqCfgCycle );

	// check error
	return PCIBUS_getError( &reqCfgCycle );
}


/******************************************************************************\
*                        G L O B A L   S E C T I O N
\******************************************************************************/


/******************************************************************************\
* global variable definitions
\******************************************************************************/


/******************************************************************************\
* global function definitions
\******************************************************************************/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青青草成人在线观看| 午夜精品福利久久久| 一区二区在线看| 精品一二三四区| 91久久国产综合久久| 2023国产精华国产精品| 一区二区三区资源| 国产白丝网站精品污在线入口| 精品视频全国免费看| 欧美va亚洲va| 亚洲一区在线观看免费 | 懂色中文一区二区在线播放| 精品视频在线免费观看| 专区另类欧美日韩| 国产成人欧美日韩在线电影| 制服丝袜日韩国产| 亚洲精品videosex极品| 粉嫩av一区二区三区| 欧美一级精品在线| 亚洲国产精品久久不卡毛片 | 色狠狠综合天天综合综合| 精品久久久久一区| 日本中文一区二区三区| 欧美性猛交xxxx乱大交退制版| 国产精品你懂的在线欣赏| 国产乱人伦偷精品视频免下载| 91精品婷婷国产综合久久竹菊| 亚洲一区二区三区四区在线 | 亚洲乱码国产乱码精品精98午夜| 国产98色在线|日韩| 2023国产一二三区日本精品2022| 蜜臀av一区二区| 日韩一级片网址| 日欧美一区二区| 欧美一区二区三区影视| 日韩专区一卡二卡| 6080日韩午夜伦伦午夜伦| 亚洲123区在线观看| 欧美三级在线播放| 亚洲成a人v欧美综合天堂| 欧美三级电影网| 一区二区三区四区在线播放 | 夜色激情一区二区| 欧美性猛交xxxx黑人交| 亚洲国产欧美在线| 欧美精品乱人伦久久久久久| 人人狠狠综合久久亚洲| 久久夜色精品一区| 国产精品1区2区| 国产精品久久久一本精品| 色香蕉久久蜜桃| 亚洲国产一二三| 日韩欧美不卡一区| 国产精品一区二区果冻传媒| 国产精品视频免费看| 一本大道久久a久久综合| 亚洲一区影音先锋| 日韩视频国产视频| 国产一区二区美女| 亚洲免费毛片网站| 欧美男男青年gay1069videost| 视频一区在线播放| 亚洲精品在线免费播放| 91最新地址在线播放| 午夜视频久久久久久| 欧美大片一区二区三区| 大桥未久av一区二区三区中文| 亚洲视频一区二区在线| 日韩视频在线你懂得| 成人丝袜视频网| 亚洲亚洲人成综合网络| 中文字幕视频一区二区三区久| 在线观看免费一区| 久久激情五月婷婷| 日韩一区欧美一区| 日韩三级伦理片妻子的秘密按摩| 成人国产在线观看| 日韩高清不卡在线| 综合婷婷亚洲小说| 欧美电视剧在线看免费| 欧美少妇bbb| 国产二区国产一区在线观看| 性久久久久久久| 国产精品视频一二三区| 91精品国产免费| 色婷婷久久久综合中文字幕| 麻豆精品视频在线观看| 一区二区三区在线视频免费| 亚洲国产高清在线| 欧美一级淫片007| 91一区二区三区在线观看| 久久99深爱久久99精品| 亚洲黄色录像片| 国产精品免费久久| 日韩三级视频在线观看| 欧美另类videos死尸| 成人动漫av在线| 国产呦精品一区二区三区网站| 一区二区三区日韩在线观看| 中文字幕巨乱亚洲| 精品国产亚洲一区二区三区在线观看| 精品视频在线视频| 欧美最猛性xxxxx直播| 丁香六月综合激情| 国产精品自在在线| 久久99精品网久久| 美女视频黄 久久| 亚洲一二三四久久| 一区二区国产视频| 亚洲精品国久久99热| 国产精品久久久久久久第一福利| 久久综合九色综合欧美就去吻| 制服丝袜亚洲色图| 91精品国产综合久久精品app| 欧美色视频在线| 在线成人av网站| 欧美精品日日鲁夜夜添| 欧美一级欧美一级在线播放| 91精品国模一区二区三区| 欧美美女喷水视频| 欧美精选在线播放| 欧美日韩国产一二三| 欧美精品日韩一区| 精品免费国产一区二区三区四区| 日韩午夜电影av| 久久久久久亚洲综合| 欧美激情中文字幕| 国产精品二三区| 樱桃国产成人精品视频| 亚洲一区中文在线| 日本网站在线观看一区二区三区| 热久久久久久久| 激情小说欧美图片| 成人a级免费电影| 99re热视频这里只精品| 欧美三级欧美一级| 日韩欧美成人激情| 国产精品久久久久影院亚瑟| 亚洲老司机在线| 午夜激情一区二区三区| 久久国产麻豆精品| 国产成人精品影视| 一本到不卡精品视频在线观看| 欧美高清视频不卡网| 欧美成人国产一区二区| 中文字幕不卡的av| 亚洲一区二区视频在线| 日本成人在线视频网站| 成人免费看视频| 欧美亚洲国产一区二区三区va | 欧美变态口味重另类| 国产日韩影视精品| 亚洲自拍与偷拍| 国产九色精品成人porny| 97超碰欧美中文字幕| 日韩三级电影网址| 亚洲免费av观看| 久久99精品国产麻豆婷婷| 972aa.com艺术欧美| 欧美成人精品1314www| 夜夜精品浪潮av一区二区三区| 国产综合一区二区| 欧美日韩专区在线| 国产精品三级在线观看| 日韩国产欧美在线视频| 97久久人人超碰| 久久综合成人精品亚洲另类欧美| 亚洲精品成人在线| 国产精品66部| 欧美成人欧美edvon| 亚洲成在人线在线播放| 成人黄色av电影| 精品成a人在线观看| 视频一区国产视频| 色先锋资源久久综合| 国产精品网站在线观看| www.99精品| 欧美乱妇20p| 中文字幕日韩一区| 九色|91porny| 欧美视频在线观看一区二区| 亚洲国产成人私人影院tom| 美女网站视频久久| 777久久久精品| 一级做a爱片久久| 91色九色蝌蚪| 国产精品网站在线播放| 国产综合色在线| 日韩精品自拍偷拍| 蜜臀va亚洲va欧美va天堂| 欧美色成人综合| 亚洲成在人线在线播放| 欧美亚洲愉拍一区二区| 亚洲精选在线视频| 一本一本大道香蕉久在线精品| 国产精品免费视频观看| 成人国产在线观看| 亚洲色图清纯唯美| 色婷婷激情综合| 欧美va亚洲va国产综合|