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

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

?? i82527.c

?? CAN例程 源碼 CAN例程 源碼
?? 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一区二区三区免费野_久草精品视频
亚洲人成影院在线观看| 国产宾馆实践打屁股91| 精品一区二区三区影院在线午夜| 国产激情精品久久久第一区二区| 欧美在线高清视频| 国产欧美精品日韩区二区麻豆天美| 洋洋av久久久久久久一区| 国产精品一区二区久久不卡| 欧美日韩一区二区三区视频| 国产精品久久久爽爽爽麻豆色哟哟| 国内成人免费视频| 69久久夜色精品国产69蝌蚪网| 国产精品久久久久影院亚瑟| 精彩视频一区二区三区| 欧美亚洲国产bt| 亚洲视频狠狠干| 成人激情动漫在线观看| 久久久欧美精品sm网站| 蜜臀久久99精品久久久画质超高清| 91在线无精精品入口| 国产日本亚洲高清| 国产麻豆午夜三级精品| 欧美一区二区三区男人的天堂| 一级精品视频在线观看宜春院| 成+人+亚洲+综合天堂| 久久久久97国产精华液好用吗| 免费三级欧美电影| 91精品蜜臀在线一区尤物| 亚洲不卡在线观看| 精品视频一区三区九区| 香蕉av福利精品导航| 欧美视频一区在线| 亚洲成av人片在www色猫咪| 91极品美女在线| 亚洲激情自拍视频| 欧美午夜理伦三级在线观看| 看电视剧不卡顿的网站| 在线播放中文一区| 日本午夜一本久久久综合| 欧美日韩国产高清一区二区三区 | 国产a视频精品免费观看| 欧美r级在线观看| 国产综合色产在线精品| 亚洲精品在线电影| 国产成人夜色高潮福利影视| 国产精品三级视频| 91原创在线视频| 一区二区日韩av| 制服丝袜中文字幕一区| 久久不见久久见免费视频1| 精品国产污污免费网站入口| 国产精品一区二区视频| 国产精品麻豆99久久久久久| 色综合久久88色综合天天免费| 一区二区三区中文在线观看| 欧美日韩国产bt| 精品一区二区三区在线播放视频| 久久九九影视网| 色狠狠色狠狠综合| 欧美aⅴ一区二区三区视频| 久久综合久久久久88| 91天堂素人约啪| 91久久一区二区| 日本sm残虐另类| 国产日韩影视精品| 色香蕉成人二区免费| 麻豆一区二区99久久久久| 中文成人综合网| 91麻豆精品国产91久久久资源速度 | 91久久久免费一区二区| 婷婷中文字幕综合| 久久婷婷国产综合精品青草| 91蜜桃婷婷狠狠久久综合9色| 丝袜美腿亚洲一区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 奇米在线7777在线精品| 中文字幕av资源一区| 欧美精品色综合| 成人国产精品免费网站| 日本中文字幕一区二区有限公司| 日本一区二区三区电影| 欧美一区二区精美| 99精品视频在线观看免费| 久久精品免费观看| 亚洲一区视频在线| 中文字幕av一区二区三区免费看 | 国产精品69久久久久水密桃| 亚洲国产精品一区二区尤物区| 精品理论电影在线观看| 欧美色图片你懂的| 99久久综合精品| 国产一区二区三区蝌蚪| 亚洲h在线观看| 亚洲婷婷综合久久一本伊一区| 精品国产一区二区三区不卡| 欧美日韩综合在线免费观看| 成年人国产精品| 国产成人午夜视频| 久久不见久久见免费视频7 | 欧美日韩免费视频| 成人avav影音| 成人永久aaa| 国产乱码精品一区二区三区五月婷| 亚洲国产美女搞黄色| 最新不卡av在线| 国产精品久久综合| 国产日本欧洲亚洲| 中文字幕欧美日韩一区| 久久久久久久精| 精品国产一区二区三区av性色| 在线观看91精品国产麻豆| 欧美亚一区二区| 欧美性感一类影片在线播放| 91视频免费看| 色哟哟欧美精品| 欧洲色大大久久| 欧美熟乱第一页| 欧美乱熟臀69xxxxxx| 欧美男人的天堂一二区| 在线电影一区二区三区| 56国语精品自产拍在线观看| 欧美精三区欧美精三区| 3d动漫精品啪啪| 欧美videofree性高清杂交| 精品少妇一区二区三区免费观看| 日韩午夜在线观看视频| 精品国产乱码久久久久久浪潮| 久久亚洲捆绑美女| 国产精品青草久久| 亚洲色图制服丝袜| 午夜免费欧美电影| 蜜桃视频在线一区| 国产成人午夜视频| 91在线视频官网| 欧美日韩国产另类一区| 日韩精品一区二区三区视频播放 | 狠狠色丁香婷综合久久| 国产精品1024久久| 91亚洲精品久久久蜜桃| 欧美性受xxxx黑人xyx性爽| 日韩午夜激情视频| 国产区在线观看成人精品 | 成人av在线观| 欧美吞精做爰啪啪高潮| 日韩精品一区二区三区视频在线观看| 久久色视频免费观看| 亚洲视频在线一区| 亚洲成av人片| 久久99国产精品久久| 99综合电影在线视频| 欧美色精品在线视频| 欧美精品一区二区三区在线播放| 欧美韩国一区二区| 视频一区二区不卡| 丁香五精品蜜臀久久久久99网站| 在线观看视频一区| 久久婷婷一区二区三区| 一个色综合网站| 国产高清在线精品| 欧美性感一区二区三区| 国产午夜精品久久久久久免费视 | 日韩欧美www| 亚洲欧美偷拍三级| 麻豆精品一二三| 91丨porny丨在线| 精品成人私密视频| 一区二区高清在线| 成人性视频免费网站| 日韩欧美电影一二三| 亚洲一区二区在线视频| 国产激情精品久久久第一区二区| 欧美亚洲高清一区二区三区不卡| 中文字幕精品在线不卡| 美女视频黄 久久| 欧美色综合天天久久综合精品| 久久久久国产成人精品亚洲午夜| 天堂影院一区二区| 欧洲一区二区三区免费视频| 国产调教视频一区| 久久超碰97中文字幕| 欧美日韩情趣电影| 亚洲蜜桃精久久久久久久| 国产69精品久久久久毛片| 日韩精品一区二区三区在线| 午夜精品久久久久久久久久| 91免费版在线看| 国产精品欧美久久久久一区二区 | 婷婷丁香久久五月婷婷| 在线国产电影不卡| 亚洲精品国产精品乱码不99| 大桥未久av一区二区三区中文| 精品国产乱码久久久久久牛牛| 日韩福利视频导航| 在线91免费看| 日韩电影在线观看电影| 在线看国产一区二区| 亚洲午夜免费视频| 欧美三级三级三级爽爽爽| 亚洲图片自拍偷拍| 欧美日韩一本到|