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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? xsicpdrv.c

?? usb 檢驗程序
?? C
字號:
/******************************************************************************
**
**  COPYRIGHT (C) 2000, 2001 Intel Corporation.
**
**  This software as well as the software described in it is furnished under 
**  license and may only be used or copied in accordance with the terms of the 
**  license. The information in this file is furnished for informational use 
**  only, is subject to change without notice, and should not be construed as 
**  a commitment by Intel Corporation. Intel Corporation assumes no 
**  responsibility or liability for any errors or inaccuracies that may appear 
**  in this document or any software that may be provided in association with 
**  this document. 
**  Except as permitted by such license, no part of this document may be 
**  reproduced, stored in a retrieval system, or transmitted in any form or by 
**  any means without the express written consent of Intel Corporation. 
**
**  FILENAME:       xsicp.c
**
**  PURPOSE:        API functions for the Infrared Communication Port.
**
**  LAST MODIFIED:  $Modtime: 7/06/01 2:42p $
******************************************************************************/

/*
*******************************************************************************
*   HEADER FILES
*******************************************************************************
*/                                                                      
#include "systypes.h"
#define ICP_GLOBALS  1
#include "XsIcpDrv.h"
#include "XsCLkMgrDrv.h"
#include "XsUartDrv.h"
#include "UtilFunc.h"

/*
*******************************************************************************
*   GLOBAL DEFINITIONS
*******************************************************************************
*/

/*
*******************************************************************************
*   LOCAL DEFINITIONS
*******************************************************************************
*/

static IcpCfgT defaultIcpCfg = {
	IcpLoopbackOn,				// Enable loopback mode
	IcpRxOperation,				// Enable receive or transmit operation
	IcpTxFIFOUnderunNoInt,		// Ignore interrupt on Tx FIFO underrun
	IcpFIFOIntDisabled,			// Receive FIFO interrupt disabled
	IcpFIFOIntDisabled,			// Transmit FIFO interrupt disabled
	IcpAddressMatchDisabled,	// Address match disabled
    ICP_MATCH_ALL,				// Address match is not used, why bother 
    IcpRxFIFOTrgLevel32,		// Rx FIFO trigger level 32 bytes
//    IcpRxFIFOTrgLevel8,			// Rx FIFO trigger level 8 bytes
    IcpPinPolarityNonInvert,	// Tx pin polarity is not inverted 
    IcpPinPolarityNonInvert,    // Rx pin polarity is not inverted	 
};

/*
******************************************************************************************
*
* FUNCTION:             XsIcpHWSetup         
*
* DESCRIPTION:          This function is used for hardware initialization of ICP.
*                       It uses the ICP configuration structure to configure ICP's
*                       modes of operation.
*
* INPUT PARAMETERS:     ctxP  is a pointer to ICP's context structure
*
* RETURNS:              0    if successful
*                       UINT32  in case of error.
*
* GLOBAL EFFECTS:       none
*
* ASSUMPTIONS:          none
*
*******************************************************************************************
*/
UINT32 XsIcpDrv_HWSetup(volatile IcpRegsT * regsP, IcpCfgT * cfgP)
{   
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;
    //IcpCfgT * cfgP = (IcpCfgT *)ctxP->cfgP;
	UINT32 error = FALSE;
    UINT data;
	PVUINT GPSRy = (PVUINT)0x40e0001c;
	PVUINT GPDRy = (PVUINT)0x40e00010;
	PVUINT GAFR0y = (PVUINT)0x40e0005c;

	// Disable the peripheral clock bit for the STUART
	CLKMGR_DISABLE_CLK(CKEN_CK_STUART_OFS);

    // Clear any previous setup
	regsP->ICCR0 = 0;
	regsP->ICCR1 = 0;
	regsP->ICCR2 = 0;

	// Configure GPIOs 

	*GPSRy = 0x00008000;
	*GPDRy &= ~0x0000C000; 
	*GPDRy |= 0x00008000;
	*GAFR0y &= ~0xf0000000;
	*GAFR0y |= 0x90000000;

	//XsGpioSetIcp ();

	// Select the peripheral clock bit for the ICP
	CLKMGR_ENABLE_CLK(CKEN_CK_ICP_OFS);
	
	// Enable ICP unit
	regsP->ICCR0 |= ICP_ICCR0_ITR;
	
	// Select what action to take on transmit FIFO underrun
	if (cfgP->actionTxFIFOUnderrun == IcpTxFIFOUnderunNoInt)
	{
		// Transmit FIFO underrun causes CRC, stop flag, and 
		// SIR to be transmitted (TUR ignored)
		regsP->ICCR0 &= ~ICP_ICCR0_TUS; 
	}
	else
	{
		// Transmit FIFO underrun causes an abort to be transmitted
		// state of TUR sent to interrupt controller
		regsP->ICCR0 |= ICP_ICCR0_TUS; 
	}

	// Enable/disable address match function
	if (cfgP->enableAddressMatch == IcpAddressMatchDisabled)
	{
		// Disable receiver address match function
		regsP->ICCR0 &= ~ICP_ICCR0_AME;
	}
	else
	{
		// Enable receiver address match function
		regsP->ICCR0 |= ICP_ICCR0_AME;
		// Write the address match value to the ICCR1
		regsP->ICCR1 = cfgP->addressMatchValue & ICP_ICCR1_MASK;
	}

	// Select the receiver FIFO trigger level
	switch (cfgP->RxFIFOTrgLevel)
	{
		case IcpRxFIFOTrgLevel8: 
			regsP->ICCR2 |= ICP_ICCR2_TRIG_8BYTES;
			break;
		case IcpRxFIFOTrgLevel16: 
			regsP->ICCR2 |= ICP_ICCR2_TRIG_16BYTES;
			break;
		case IcpRxFIFOTrgLevel32: 
			regsP->ICCR2 |= ICP_ICCR2_TRIG_32BYTES;
			break;
		default:
			regsP->ICCR2 |= ICP_ICCR2_TRIG_8BYTES;
	}

	// Select Tx pin polarity
	if (cfgP->TxPinPolarity == IcpPinPolarityInvert)
	{
		// Data output from ICP is inverted 
		regsP->ICCR2 &= ~ICP_ICCR2_TXP;
	}
	else
	{
		// Data output from ICP is non-inverted 
		regsP->ICCR2 |= ICP_ICCR2_TXP;
	}

	// Select Rx pin polarity
	if (cfgP->RxPinPolarity == IcpPinPolarityInvert)
	{
		// Data input from receive data pin is inverted 
		regsP->ICCR2 &= ~ICP_ICCR2_RXP;
	}
	else
	{
		// Data input from receive data pin is non-inverted 
		regsP->ICCR2 |= ICP_ICCR2_RXP;
	}

	// Enable/disable receiver FIFO interrupt	
	if (cfgP->RxIntEnable == IcpFIFOIntDisabled)
	{
		// Receive FIFO does not generate an interrupt
		regsP->ICCR0 &= ~ICP_ICCR0_RIE;
	}
	else
	{
		// Receive FIFO generates an interrupt	
		regsP->ICCR0 |= ICP_ICCR0_RIE;
	}

	// Enable/disable transmitter FIFO interrupt	
	if (cfgP->TxIntEnable == IcpFIFOIntDisabled)
	{
		// Transmit FIFO does not generate an interrupt
		regsP->ICCR0 &= ~ICP_ICCR0_TIE;
	}
	else
	{
		// Transmit FIFO generates an interrupt	
		regsP->ICCR0 |= ICP_ICCR0_TIE;
	}

    // Make sure the Rx FIFO is empty
    //while (ctxP->readBitStatusReg1IcpFnP(ctxP, IcpRxNotEmpty))
    while (GET_BIT(&regsP->ICSR1, IcpRxNotEmpty))
        data = regsP->ICDR;

	// Enable/disable HSSP transmit and receive operations
	if (cfgP->loopback == IcpLoopbackOn)
	{
		// Loopback mode of operation enabled
		regsP->ICCR0 |= ICP_ICCR0_LBM; 

		// if loopback mode is enabled than enable both Tx and Rx operations
		regsP->ICCR0 |= (ICP_ICCR0_TXE | ICP_ICCR0_RXE);
	}
	else if ((cfgP->loopback == IcpLoopbackOff) && (cfgP->function == IcpRxOperation))
	{
		// Normal serial port operation enabled
		regsP->ICCR0 &= ~ICP_ICCR0_LBM;

	    // Enable ICP receive operation
		regsP->ICCR0 |= ICP_ICCR0_RXE;
	}
	else if ((cfgP->loopback == IcpLoopbackOff) && (cfgP->function == IcpTxOperation))
	{
		// Normal serial port operation enabled
		regsP->ICCR0 &= ~ICP_ICCR0_LBM; 

	    // Enable ICP transmit operation
		regsP->ICCR0 |= ICP_ICCR0_TXE;
	}

	return error;
}

/*
*******************************************************************************
*
* FUNCTION:         loopbackIcp                  
*
* DESCRIPTION:      This function is used to test ICP in loopback mode of operation.
*
* INPUT PARAMETERS: ctxP    is a pointer to ICP context structure. 
*                   data    is the data sent via loopback path.
*
* RETURNS:          INT  	data only max. 8 bit of data are significant).
*                           or -1 if timeout expired and no character has been received.
*
* GLOBAL EFFECTS:   none
*
* ASSUMPTIONS:      ICP's FIFO' Tx and Rx level interrupts are disabled, Tx and Rx units
*					are enabled, and loopback test mode is enabled
*
*******************************************************************************
*/
int XsIcpDrv_loopbackIcp(volatile IcpRegsT * regsP, INT data)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;
    INT retry = ICP_RETRY_LOOP;

   	if ((regsP->ICSR1 & ICP_ICSR0_TFS) != 0)
	{
		// Check if Tx FIFO is not full
		while ((regsP->ICSR1 & ICP_ICSR1_TNF) == 0);

    	// Write data to the transmit FIFO
    	regsP->ICDR = data;   
    	Util_DelayUs(10);

    	// Wait for the loopback data to arrive
    	while (((regsP->ICSR1 & ICP_ICSR1_RNE) == 0) && (--retry > 0))
    		Util_DelayUs(1);
    }        
    
    if (retry > 0)
      return regsP->ICDR;
	
    return (-1);
}

/*
*******************************************************************************
*
* FUNCTION:         writeIcp                      
*
* DESCRIPTION:      This function is used to transmit data via ICP in polled mode
*                   operation
*
* INPUT PARAMETERS: ctxP    is a pointer to ICP context structure 
*                   txbufP  is a pointer to the buffer where the data is going 
*                           to be taken from
*                   len     is number of bytes to be sent
*
* RETURNS:          none.
*
* GLOBAL EFFECTS:   none.
*
* ASSUMPTIONS:      none.
*
*******************************************************************************
*/
void XsIcpDrv_writeIcp (volatile IcpRegsT * regsP, PCHAR txbufP, INT len)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;
    INT i;
  
    for (i = 0; i < len; i++)
    {
		if ((regsP->ICSR1 & ICP_ICSR0_TFS) != 0)
		{
			// Check if Tx FIFO is not full
			while ((regsP->ICSR1 & ICP_ICSR1_TNF) == 0);

        	// Write data
        	regsP->ICDR = *txbufP++;   
    	}
	}
}

/*
*******************************************************************************
*
* FUNCTION:         readIcp        
*
* DESCRIPTION:      This function is used to receive data via Icp in polled mode 
*                   operation
*
* INPUT PARAMETERS: ctxP    is a pointer to ICP's context structure 
*                   rxbufP  is a pointer to the buffer where received data is
*                           going to be placed
*                   len     is a specified number of bytes to read.
*					timOut  is timeout value, -1 means wati for ever
*
* RETURNS:          INT an actual number of bytes have been read        
*                   
* GLOBAL EFFECTS:   none.
*                  
* ASSUMPTIONS:      none.
*                  
*******************************************************************************
*/                  
int XsIcpDrv_readIcp (volatile IcpRegsT * regsP, PCHAR rxbufP, INT len, int timeOut)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;
	//INT retry = ICP_RETRY_LOOP;
	unsigned int retry = timeOut;
    INT i;
  
    for (i = 0; i < len; i++) 
    {
        // Wait for data to be available
//		while( ((regsP->ICSR1 & ICP_ICSR1_RNE) == 0) && (--retry > 0) )
    	while( 	((regsP->ICSR1 & ICP_ICSR1_RNE) == 0) && 
    			((--retry > 0) && (timeOut != -1))	)
    		Util_DelayUs(1);
    
    	if (retry > 0)
		{
      	  	*rxbufP++ = regsP->ICDR;
			//retry = ICP_RETRY_LOOP;
    	  	retry = timeOut;
		}
		else
		{
    	    break;
		}
	}

    if (retry > 0)
      return i;

    return (-1);
}


/*
*******************************************************************************
*
* FUNCTION:         clearRxIcp
*
* DESCRIPTION:      This function is used to clear receive FIFO of the Icp
*
* INPUT PARAMETERS: ctxP    is a pointer to the ICP's context structure
*
* RETURNS:          INT     a contence of the ICCR0
*
* GLOBAL EFFECTS:   none.
*
* ASSUMPTIONS:      none.
*
*******************************************************************************
*/
int XsIcpDrv_clearRxIcp (volatile IcpRegsT * regsP)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;

    regsP->ICCR0 &= ~ICP_ICCR0_RXE;
    return regsP->ICCR0;
}

/*
*******************************************************************************
*
* FUNCTION:         clearTxIcp
*
* DESCRIPTION:      This function is used to clear transmit FIFO of the Icp
*
* INPUT PARAMETERS: ctxP    is a pointer to the ICP's context structure
*
* RETURNS:          INT     a contence of the ICCR0
*
* GLOBAL EFFECTS:   none.
*
* ASSUMPTIONS:      none.
*
*******************************************************************************
*/
int XsIcpDrv_clearTxIcp (volatile IcpRegsT * regsP)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;

	regsP->ICCR0 &= ~ICP_ICCR0_TXE;
    return regsP->ICCR0;
}

/*
*******************************************************************************
*
* FUNCTION:         shutdownIcp
*
* DESCRIPTION:      This function is used to shutdown the Icp
*                   Tx and Rx FIFOs are cleared and SIU takes control of the data pins 
*
* INPUT PARAMETERS: ctxP    is a pointer to the ICP's context structure
*
* RETURNS:          INT     a contence of the ICCR0
*
* GLOBAL EFFECTS:   none.
*
* ASSUMPTIONS:      none.
*
*******************************************************************************
*/
int XsIcpDrv_shutdownIcp (volatile IcpRegsT * regsP)
{
    //volatile IcpRegsT * regsP = (IcpRegsT *)ctxP->regsP;

	regsP->ICCR0 &= ~ICP_ICCR0_TXE;
	regsP->ICCR0 &= ~ICP_ICCR0_RXE;

	// Disable ICP unit
	regsP->ICCR0 &= ~ICP_ICCR0_ITR;

	// Clear the peripheral clock bit for the ICP
	CLKMGR_DISABLE_CLK(CKEN_CK_ICP_OFS);

    return regsP->ICCR0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产.久久久久久| 99re热这里只有精品免费视频| 欧美v国产在线一区二区三区| 天天色天天操综合| 一区在线观看免费| 精品久久久久久久人人人人传媒| 欧美日韩高清不卡| 国产精品一区三区| 日本aⅴ免费视频一区二区三区| 国产精品久久夜| 精品国产精品一区二区夜夜嗨| 色女孩综合影院| 国产91在线观看丝袜| 国产一区中文字幕| 午夜精品一区二区三区免费视频| 国产精品久久久久久妇女6080| 91精品国产综合久久久久久| 国产风韵犹存在线视精品| 麻豆精品在线视频| 男女性色大片免费观看一区二区| 国产精品乱码一区二三区小蝌蚪| 久久久欧美精品sm网站| 欧美mv和日韩mv的网站| 欧美成人a∨高清免费观看| 精品国产a毛片| xnxx国产精品| 国产欧美日韩视频一区二区| 精品福利一区二区三区| 国产欧美一区视频| 久久国产日韩欧美精品| 亚洲六月丁香色婷婷综合久久| 欧美国产亚洲另类动漫| 国产精品久久久久影院| 亚洲柠檬福利资源导航| 亚洲一区二区3| 青青草成人在线观看| 国产在线国偷精品免费看| 激情综合色播五月| av男人天堂一区| 欧美精三区欧美精三区| 国产亚洲精品资源在线26u| 综合欧美亚洲日本| 激情久久五月天| 欧美日韩亚洲国产综合| 依依成人综合视频| 久久精品国产一区二区三| 成人视屏免费看| 日韩欧美国产一区在线观看| 国产精品久久久久久久久果冻传媒| 日韩高清电影一区| 91黄色小视频| 国产精品不卡在线| 久久99精品久久久久| 欧美精品亚洲一区二区在线播放| 国产视频一区在线播放| 午夜精品一区在线观看| 91在线高清观看| 国产精品国产三级国产aⅴ中文| 五月婷婷另类国产| 色综合一个色综合亚洲| 久久精品日韩一区二区三区| 午夜久久久久久| 欧美三级在线播放| 午夜久久电影网| 91精品国产一区二区三区香蕉| 国产激情91久久精品导航| 99久久er热在这里只有精品66| 久久99精品视频| 日韩一区二区三区高清免费看看| 亚洲一区在线视频| 北条麻妃国产九九精品视频| 久久精品国产精品亚洲红杏| 亚洲国产另类精品专区| 一区二区在线看| 亚洲九九爱视频| 一区二区三区美女视频| 亚洲乱码中文字幕| 一区二区欧美在线观看| 亚洲一区二区三区在线看| 一级精品视频在线观看宜春院| 亚洲欧洲日韩女同| 亚洲精品成人天堂一二三| 综合久久综合久久| 午夜免费久久看| 狠狠色丁香婷婷综合久久片| 国产精品一区二区你懂的| 国产精品亚洲人在线观看| 国产精品66部| 色婷婷久久久亚洲一区二区三区| 在线亚洲免费视频| 欧美精品一区二区在线播放| 中文字幕中文字幕一区| 亚洲1区2区3区4区| 国产精品69毛片高清亚洲| 972aa.com艺术欧美| 日韩免费高清av| 日韩美女视频一区| 久久成人久久鬼色| 欧美伊人精品成人久久综合97| 日韩一区二区三免费高清| 亚洲人成网站色在线观看| 久久成人av少妇免费| 色偷偷一区二区三区| 26uuu亚洲| 欧美a级一区二区| 在线播放91灌醉迷j高跟美女| 日韩欧美另类在线| 亚洲国产精品久久人人爱| 成人网在线免费视频| 日韩精品专区在线影院重磅| 亚洲综合免费观看高清在线观看| 国产成人精品一区二| 精品美女在线观看| 美国十次综合导航| 欧美一卡二卡在线| 日韩精品免费视频人成| 日本高清不卡aⅴ免费网站| 欧美极品另类videosde| 国产激情精品久久久第一区二区| 欧美成人艳星乳罩| 奇米影视一区二区三区小说| 欧美日韩在线播放一区| 激情综合色丁香一区二区| 日韩精品一区二区三区蜜臀| 毛片av一区二区| 久久日韩粉嫩一区二区三区 | 亚洲国产精品久久久男人的天堂 | 国产午夜亚洲精品不卡| 毛片基地黄久久久久久天堂| 欧美一区二区三级| 久久精品999| 国产欧美日韩综合精品一区二区| 国产美女在线观看一区| 欧美国产一区在线| 欧美吻胸吃奶大尺度电影| 蜜桃传媒麻豆第一区在线观看| 精品国产乱子伦一区| 国产精品系列在线播放| 中文字幕字幕中文在线中不卡视频| 一本久道中文字幕精品亚洲嫩| 亚洲自拍偷拍图区| 久久久亚洲午夜电影| 欧美综合一区二区| 国产高清不卡一区| 国产福利电影一区二区三区| 亚洲黄一区二区三区| 91精品国产品国语在线不卡| 国产在线国偷精品免费看| 一区二区三区波多野结衣在线观看| 91精品国产一区二区人妖| 99在线精品观看| 九色porny丨国产精品| 亚洲精品国产高清久久伦理二区| 久久无码av三级| 在线播放日韩导航| 欧美日韩视频在线一区二区| 99精品久久99久久久久| 国产一区二区三区av电影| 老色鬼精品视频在线观看播放| 亚洲精品乱码久久久久| 亚洲精品中文在线影院| 中文字幕亚洲电影| 欧美国产一区二区在线观看| 久久久久久久综合日本| 久久这里只有精品首页| 欧美mv日韩mv国产网站| 91精品国产91热久久久做人人| 欧美久久免费观看| 6080国产精品一区二区| 欧美日韩小视频| 91精品国产aⅴ一区二区| 欧美大片日本大片免费观看| 7777精品伊人久久久大香线蕉完整版| 欧美色视频在线观看| 日韩欧美黄色影院| 国产精品免费视频观看| 国产精品美女久久久久av爽李琼| 中文字幕视频一区二区三区久| 专区另类欧美日韩| 五月婷婷另类国产| 国产在线播放一区三区四| 国产成人精品三级| 欧美性猛片aaaaaaa做受| 日韩一区二区在线看| 国产夜色精品一区二区av| 亚洲欧美一区二区久久| 美女一区二区在线观看| 成人激情文学综合网| 欧美私人免费视频| 久久久五月婷婷| 日韩精品欧美成人高清一区二区| 人人狠狠综合久久亚洲| 91精品国产一区二区三区蜜臀| 国产欧美日本一区二区三区| 亚洲午夜成aⅴ人片| 波多野结衣欧美| 欧美成人vps| 日韩av成人高清| 欧美日韩一区二区在线视频| 欧美激情资源网|