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

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

?? i82527.c

?? CANOPen通信的一些源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* i82527.c - implementation of CAN Common Interface for Intel 82527 *//* Copyright 2001 Wind River Systems, Inc. *//* modification history --------------------05sep02,lsg modified for WindNet CAN 1,209nov01,dnb modified for integration into Tornado12jul01,jac written*//* DESCRIPTIONThis file contains the functions, specific to the Intel 82527 CANcontroller, that implement the interface defined in the wnCAN.h header file. *//* includes */#include <vxWorks.h>#include <errnoLib.h>#include <intLib.h>#include <iv.h>#include <sysLib.h>#include <CAN/wnCAN.h>#include <CAN/canController.h>#include <CAN/canBoard.h>#ifdef INCLUDE_I82527#include <CAN/i82527.h>#include <CAN/i82527Offsets.h>const WNCAN_ChannelType g_i82527chnType[I82527_MAX_MSG_OBJ] = {     WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE,    WNCAN_CHN_RECEIVE};/************************************************************************** I82527_Init - initialize the CAN controller** This function initializes the CAN controller and makes default selections.* 1. Puts the CAN controller into init mode* 2. Disables interrupts at the CAN controller level as well as channel level* 3. Sets bit timing values according to values stored in the CAN controller*    struct. If user has changed these values before init is called, the*    default bit timing values are set to a baud rate of 250K* 4. Sets local and global receive masks to don't care (accept all)* 5. Makes all channels inactive in hardware* 6. The CAN controller has now been initialized but will not participate*    in CAN bus communication. In order to bring the CAN controller online,*    and enable active participation in CAN bus activity, CAN_Start must*    be called following CAN_Init.** Call these functions in this order:* 1. CAN_Open* 2. CAN_Init* 3. CAN_Start** RETURNS: OK or ERROR** ERRNO:   S_can_busy**/static STATUS I82527_Init      (	  struct WNCAN_Device *pDev	  ){    UCHAR   value;    UINT    i;    STATUS  retCode = OK;	struct  i82527ChipSpecific *chipStuff;    if((pDev->pBrd->canInByte(pDev,I82527_R_INFR) & 0x80) != 0)    {        errnoSet(S_can_busy);        retCode = ERROR;    }    else        {        /* Set the default hardware reset state */        pDev->pBrd->canOutByte(pDev,I82527_R_INFR,0x61);		/*Disable interrupts and enbale configuration change*/        /*  set change configuration enable:         CCE  = 1            reset global interrupt enable:           IE   = 0            set init bit:                            Init = 1            disable error interrupt                  EEI  = 0            disable status change interrupt          SEI  = 0 */        pDev->pBrd->canOutByte(pDev, I82527_R_CTRL,0x41);        /* Reset Status Register */        pDev->pBrd->canOutByte(pDev, I82527_R_SR,0x07);		/* Set default values in chip specific struct*/		chipStuff = (struct i82527ChipSpecific *)pDev->pCtrl->csData;		chipStuff->busOffInt = FALSE;		chipStuff->wakeUpInt = FALSE;		chipStuff->errorInt = FALSE;    		                switch(pDev->pBrd->brdType)        {            case WNCAN_ESD_PC104_200:                /* set CLKOUT: 8 MHz < CLKOUT <= 16 MHz (SL1 = 1 SL0 = 0) */                pDev->pBrd->canOutByte(pDev, I82527_R_CLKO,0x20);                /* Comparator enabled, on TX1 RX1 connected */                pDev->pBrd->canOutByte(pDev, I82527_R_BCR,0x00);                /* SCLK = XTALl/2, MCLK = SYSCLK, CLKOUT disabled */                pDev->pBrd->canOutByte(pDev, I82527_R_INFR,0x40);                break;            case WNCAN_MSMCAN:                /* SCLK = XTALl/2, MCLK = SYSCLK, CLKOUT enabled */                pDev->pBrd->canOutByte(pDev, I82527_R_INFR,0x41);                /* set CLKOUT < 8 MHz */                pDev->pBrd->canOutByte(pDev, I82527_R_CLKO,0x30);                /* Comparator bypassed, RX1 disabled, RX0 enabled, TX1 enabled */                pDev->pBrd->canOutByte(pDev, I82527_R_BCR,0x42);                break;            default:                break;        }        /* Set default bit timing  */        value = (pDev->pCtrl->sjw << 6) | pDev->pCtrl->brp;        pDev->pBrd->canOutByte(pDev, I82527_R_BTR0 ,value);		if(pDev->pCtrl->samples)			value = 0x80 | (pDev->pCtrl->tseg2 << 4) | pDev->pCtrl->tseg1;		else			value = (pDev->pCtrl->tseg2 << 4) | pDev->pCtrl->tseg1;        pDev->pBrd->canOutByte(pDev, I82527_R_BTR1 ,value);		/* Set all message objects to invalid and reset each control register.		Set direction to transmit to prevent unwanted receive. */        for (i = 0;i < I82527_MAX_MSG_OBJ; i++)        {            pDev->pBrd->canOutByte(pDev, I82527_R_XMT+i*I82527_OFFS_MSG+                I82527_OFFS_CTRL0,0x55);            pDev->pBrd->canOutByte(pDev, I82527_R_XMT+i*I82527_OFFS_MSG+                I82527_OFFS_CTRL1,0x55);            pDev->pBrd->canOutByte(pDev, I82527_R_XMT+i*I82527_OFFS_MSG+                I82527_OFFS_MCR,0x08);        }		/* set message object 15 to 'don't care' */        pDev->pBrd->canOutByte(pDev, I82527_R_M15M,0);        pDev->pBrd->canOutByte(pDev, I82527_R_M15M+1,0);        pDev->pBrd->canOutByte(pDev, I82527_R_M15M+2,0);        pDev->pBrd->canOutByte(pDev, I82527_R_M15M+3,0);		        /* set global standard mask to 'don't care'*/        pDev->pBrd->canOutByte(pDev, I82527_R_GMS+0,0);        pDev->pBrd->canOutByte(pDev, I82527_R_GMS+1,0);		        /* set global extended mask to 'don't care'*/           pDev->pBrd->canOutByte(pDev, I82527_R_GME+0,0);        pDev->pBrd->canOutByte(pDev, I82527_R_GME+1,0);        pDev->pBrd->canOutByte(pDev, I82527_R_GME+2,0);        pDev->pBrd->canOutByte(pDev, I82527_R_GME+3,0);										        /* set all message objects to free */        for (i = 0; i < I82527_MAX_MSG_OBJ; i++)            pDev->pCtrl->chnMode[i] = WNCAN_CHN_INVALID;					        /*		 * leave the init bit set, clear the CCE bit to prevent write access		 * to configuration registers. The Init bit will be cleared and the		 * CAN controller brought online in CAN_Start		 */        pDev->pBrd->canOutByte(pDev, I82527_R_CTRL, 0x01);    }    return retCode;}/************************************************************************** I82527_Start - Put CAN controller online** This function is called to bring the CAN controller online. The CAN controller* can now participate in transmissions and receptions on the CAN bus.* This function must be called after CAN_Init has been called to initialize and* bring the CAN controller up in a known state.** RETURNS: N/A** ERRNO:   N/A**/void I82527_Start    (	struct WNCAN_Device *pDev	){	UCHAR value;			value = (pDev->pBrd->canInByte(pDev,I82527_R_CTRL));		/* Reset the Init bit */		value &= 0xfe;	    pDev->pBrd->canOutByte(pDev,I82527_R_CTRL,value);		return;	}/************************************************************************** I82527_Stop - Put CAN controller offline** Disables communication between CAN controller and the CAN bus** RETURNS: N/A*   * ERRNO:   N/A**/void I82527_Stop    (	struct WNCAN_Device *pDev	){	UCHAR value;			value = (pDev->pBrd->canInByte(pDev,I82527_R_CTRL));		/* Set the Init bit */		value |= 0x01;	    pDev->pBrd->canOutByte(pDev,I82527_R_CTRL,value);		return;	}/************************************************************************** I82527_SetBitTiming - set bit timing** This function sets the baud rate of the controller. The selection* of the input parameters should be based on an established set of * recommendations for the particular application.* This function sets the bit timing values in the hardware as well as the* controller structure, so that the bit timing values are not lost if Init* is called again. The function will preserve the state of the CAN controller.* i.e. if the CAN controller is online when the function is called, then the * CAN controller will be online when the function exits. ** bit time = 1 + (tseg1 + 1) + (tseg2+1) time quanta * The interpretation of tseg1 are tseg2 are according to the controller's * definition and hence can be written to directly using this function.** In all cases so far, tseg2 refers to the segment of bit time after the sample* point. However, in some controllers tseg1 refers to the segment of bit time* after the end of sync seg upto the sample point.                     *  ---------------------------------------------------------* |    |                    |                              |  *  sync <--------tseg1 --->^|^<---------tseg2 ------------->*                          sample point * ** RETURNS: OK, or ERROR** ERRNO:   S_can_invalid_parameter***/static STATUS I82527_SetBitTiming      (	  struct WNCAN_Device *pDev,	  UCHAR tseg1, 	  UCHAR tseg2, 	  UCHAR brp, 	  UCHAR sjw,	  BOOL  samples	  ){    UCHAR       value;    STATUS      retCode;	    retCode = OK;  /* assume success */	    /* qualify parameters */    if((sjw > 0x03) || (brp > 0x3f) || (tseg1 > 15) ||		(tseg1 < 2) || (tseg2 > 7) || (tseg2 < 1))    {        errnoSet(S_can_invalid_parameter);        retCode = ERROR;    }    else    { 							/* Check if init and configuration change enable bits are set */        /* if not set both */        value = pDev->pBrd->canInByte(pDev, I82527_R_CTRL);				if((value & 0x41) != 0x41)			pDev->pBrd->canOutByte(pDev, I82527_R_CTRL, (value | 0x41));                pDev->pBrd->canOutByte(pDev, I82527_R_BTR0, (sjw << 6) | brp);				if(samples)			pDev->pBrd->canOutByte(pDev, I82527_R_BTR1, (0x80 | (tseg2 << 4) | tseg1));					else			pDev->pBrd->canOutByte(pDev, I82527_R_BTR1, ((tseg2 << 4) | tseg1));						/*restore original state of controller*/		if((value & 0x41) != 0x41)			pDev->pBrd->canOutByte(pDev, I82527_R_CTRL, value);		    }	    return retCode;}/**************************************************************************** I82527_GetBaudRate: Returns baud rate by recalculating bit timing parameters* * RETURNS: baud rate in bps* * ERRNO:   N/A*/static UINT I82527_GetBaudRate      (      struct WNCAN_Device *pDev,	  UINT *samplePoint      ){           	ULONG             sys_clk_frequency;    USHORT            num_time_quanta;    UCHAR             brp, tseg1, tseg2, btr1, value;                    brp = (pDev->pBrd->canInByte(pDev, I82527_R_BTR0) & 0x3f) + 1;        btr1 = pDev->pBrd->canInByte(pDev, I82527_R_BTR1);          tseg2 = ((btr1 & 0x70) >> 4) + 1;    tseg1 = (btr1 & 0x0f) + 1;                     /*Calculate baud rate*/    num_time_quanta = 1 + tseg1 + tseg2;	/* Check the DSC bit in the CPU Interface register */	value = pDev->pBrd->canInByte(pDev, I82527_R_INFR);	if(value & I82527_B_DSC)		sys_clk_frequency = pDev->pBrd->xtalFreq / 2;	else		sys_clk_frequency = pDev->pBrd->xtalFreq;    *samplePoint = ((1 + tseg1) * 100)/num_time_quanta;    return(sys_clk_frequency / (num_time_quanta * brp));}/************************************************************************** I82527_SetIntMask - enable controller level interrupts on the CAN*                     controller** This function enables the specified list of controller level interrupts* on the CAN controller. Interrupts are not enabled at the CAN board level* or at the CPU level.** The interrupt masks available are:* WNCAN_INT_ERROR : enables interrupt on bit error* WNCAN_INT_WAKE_UP: enables interrupt on wake up* Bit errors and wake from sleep mode, are signalled as status change* interrupts on the I82527. Setting the status change interrupt enable bit* corresponds to  enabling WCAN_INT_ERROR and WNCAN_INT_WAKE_UP * CAN_GetIntStatus will return the cause of the status change interrupt, * and this information will be passed on to the user's ISR call back routine* when an interrupt occurs.** WARNING* However, successful transmissions and receptions are also status changes* and will trigger the status change interrupt if enabled. This will greatly * burden the CPU.** WNCAN_INT_BUS_OFF: enables interrupt indicating bus off condition  * The Error Interrupt Enable (EIE) bit in the control register, enables * an interrupt to occur when the error status of the I82527 changes. Error * interrupts are Bus Off and Warn in the staus register.* To enable WNCAN_INT_BUS_OFF, EIE is set. When an interrupt corresponding to* this condition occurs, CAN_GetIntStatus identifies the interrupt source* and * * RETURNS: OK** ERRNO:   S_can_invalid_parameter**/static STATUS I82527_SetIntMask      (	  struct WNCAN_Device *pDev,	  WNCAN_IntType intMask	  ){        STATUS   retCode=OK;        int         oldLevel;	struct  i82527ChipSpecific *chipStuff;	UCHAR   regCtrl;	/*        return error if masks other than error, busoff and wakeup        are passed to the function        */        if((intMask > (WNCAN_INT_ERROR | WNCAN_INT_BUS_OFF | WNCAN_INT_WAKE_UP)) &&           (intMask != WNCAN_INT_ALL)) 	{           errnoSet(S_can_invalid_parameter);           retCode = ERROR;                }        else        {	/* Set default values in chip specific struct*/	chipStuff = (struct i82527ChipSpecific *)pDev->pCtrl->csData;	       /* read the control register */       regCtrl = pDev->pBrd->canInByte(pDev, I82527_R_CTRL);		/*Enable all error interrupts. Bus error,  data overrun*/	if(intMask & WNCAN_INT_ERROR) 		chipStuff->errorInt = TRUE;			else

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品第一页| 欧美日韩精品一区二区三区四区 | 日本不卡免费在线视频| 欧美伦理电影网| 日韩国产欧美在线视频| 欧美一级高清片在线观看| 韩国三级中文字幕hd久久精品| 久久久久久免费毛片精品| 高清在线不卡av| 亚洲影院在线观看| 日韩一区二区在线看| 国产精品99久久久久久久vr | 国产一区二区三区在线看麻豆| 久久色在线视频| 色综合久久综合网欧美综合网| 天天av天天翘天天综合网色鬼国产| 日韩视频不卡中文| 成人av在线电影| 午夜国产精品一区| 亚洲国产经典视频| 欧美日韩激情一区二区三区| 精品一区二区在线视频| 亚洲柠檬福利资源导航| 日韩免费高清av| 色综合天天综合狠狠| 蜜桃视频在线一区| 中文字幕欧美一| 欧美成人r级一区二区三区| 99久久99久久久精品齐齐| 轻轻草成人在线| 亚洲人成亚洲人成在线观看图片| 91麻豆精品国产91久久久久| 不卡的看片网站| 精品午夜久久福利影院| 亚洲精品你懂的| 国产无人区一区二区三区| 欧美三片在线视频观看| 国产.欧美.日韩| 免费成人在线影院| 亚洲午夜激情av| 国产精品视频看| 欧美tickling挠脚心丨vk| 欧美午夜免费电影| av一区二区三区| 经典三级在线一区| 日韩电影免费一区| 亚洲一区二区三区中文字幕| 国产精品天美传媒沈樵| 日韩欧美一区二区不卡| 欧美系列一区二区| 一本大道久久a久久综合婷婷 | 国产精品国产成人国产三级| 日韩写真欧美这视频| 久久无码av三级| 欧美三级韩国三级日本一级| av不卡一区二区三区| 久久se这里有精品| 人人爽香蕉精品| 午夜一区二区三区视频| 一区二区三区四区蜜桃| 国产精品久久夜| 中文字幕免费一区| 国产清纯在线一区二区www| 日韩欧美的一区二区| 7777精品伊人久久久大香线蕉经典版下载| 91网站最新地址| 91免费国产视频网站| 97aⅴ精品视频一二三区| 成人午夜看片网址| 成人精品视频一区| 成人激情午夜影院| 国产精品夜夜嗨| 成人精品在线视频观看| va亚洲va日韩不卡在线观看| 成人毛片在线观看| 99re在线视频这里只有精品| 97久久精品人人做人人爽50路| 成人激情午夜影院| 91亚洲精品一区二区乱码| 91丨porny丨国产入口| 91久久久免费一区二区| 欧日韩精品视频| 欧美日韩成人综合天天影院| 欧美丝袜丝交足nylons| 欧美日本一道本| 日韩一级大片在线观看| 精品国产在天天线2019| www激情久久| 国产精品国产自产拍在线| 亚洲美腿欧美偷拍| 午夜精品久久久久久久久久| 免费看日韩a级影片| 精品一区二区免费在线观看| 国产99一区视频免费| 91视频精品在这里| 欧美精品123区| 精品国产免费一区二区三区四区| 国产欧美日韩另类一区| 亚洲三级电影全部在线观看高清| 亚洲制服丝袜一区| 精品在线免费视频| 成人av网站在线观看免费| 在线中文字幕不卡| 欧美成人一区二区三区片免费| 中文字幕欧美三区| 亚洲一区二区精品久久av| 久久国产免费看| 成人高清视频在线观看| 精品视频免费在线| 精品久久久久久久久久久院品网 | 91福利区一区二区三区| 日韩欧美卡一卡二| 中文字幕在线一区| 麻豆成人91精品二区三区| 99亚偷拍自图区亚洲| 欧美一区二区三区视频免费播放| 中文字幕不卡在线播放| 亚洲成人av电影在线| 国产成人鲁色资源国产91色综| 欧美中文一区二区三区| 2024国产精品视频| 亚洲va在线va天堂| 国产a区久久久| 日韩无一区二区| 亚洲久本草在线中文字幕| 久久99精品网久久| 欧美特级限制片免费在线观看| 久久精品人人爽人人爽| 日韩va亚洲va欧美va久久| 不卡视频在线看| 久久―日本道色综合久久| 香蕉成人伊视频在线观看| 成人午夜短视频| 欧美成人欧美edvon| 国产美女娇喘av呻吟久久| av一区二区三区黑人| 综合欧美亚洲日本| 日韩精品亚洲一区二区三区免费| 99在线视频精品| 久久精品一区二区三区不卡牛牛| 日本aⅴ亚洲精品中文乱码| 91视频在线观看免费| 国产精品美日韩| 国产精品自拍在线| 日韩精品在线看片z| 婷婷成人激情在线网| 日本高清不卡视频| 中文字幕一区二区不卡 | 亚洲免费av高清| 成人黄色777网| 国产午夜精品福利| 国产一区二区在线观看视频| 欧美一区二区三区免费在线看 | 国产呦精品一区二区三区网站| 欧美三片在线视频观看| 亚洲精品成a人| 色呦呦国产精品| 日韩毛片一二三区| 99久久国产综合精品麻豆| 一区2区3区在线看| 欧美三级日韩在线| 中文字幕中文在线不卡住| 成人黄色电影在线| 亚洲欧美在线观看| 99国内精品久久| 一区二区三区色| 在线看不卡av| 亚洲成人午夜电影| 欧美二区三区的天堂| 久久狠狠亚洲综合| 久久色中文字幕| 国产aⅴ综合色| 亚洲素人一区二区| 色视频成人在线观看免| 亚洲一级二级三级| 欧美一区二区在线不卡| 久久se精品一区精品二区| 精品日产卡一卡二卡麻豆| 国产寡妇亲子伦一区二区| 国产精品―色哟哟| 色综合一区二区| 日韩综合一区二区| 精品国产sm最大网站| 国产福利精品一区| 亚洲男女一区二区三区| 欧美日韩精品一区二区三区蜜桃| 日韩在线一二三区| 久久只精品国产| av亚洲产国偷v产偷v自拍| 亚洲黄色小说网站| 香蕉成人啪国产精品视频综合网| 亚洲卡通动漫在线| 久久综合一区二区| 成人精品国产一区二区4080| 亚洲欧美日韩系列| 9191国产精品| 国产老女人精品毛片久久| 亚洲色图一区二区三区| 91.xcao| 成人免费av资源|