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

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

?? toucan.c

?? 美國(guó)wind river 公司的CAN總線源代碼
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/* toucan.c - implementation of CAN Common Interface for Motorola TouCAN *//* Copyright 2001 Wind River Systems, Inc. *//* modification history --------------------18dec01,lsg 05aug02,lsg modifications for WindNet CAN 1.2*//*  DESCRIPTION This file contains the functions, specific to the Motorola TouCAN CAN controller, 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 <CAN/wnCAN.h>#include <CAN/canController.h>#include <CAN/canBoard.h>#ifdef INCLUDE_TOUCAN#include <CAN/toucan.h>#include <CAN/toucanOffsets.h>#include <drv/misc/uimb/ppcUimb.h>/*static variable to read free running timer Timer is read to unlock a channel, after it has been accessed.Static declaration is used to prevent optimization of timer read statement.*/static USHORT timerRead;extern UINT32 vxImemBaseGet(void);#define VECTOR_TABLE_OFFSET_FROM_LEVEL(n) (2*n + 1)const WNCAN_ChannelType g_TOUCANchnType[TOUCAN_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_TRANSMIT_RECEIVE,    WNCAN_CHN_TRANSMIT_RECEIVE };/******************************************************************************* TouCANSetHaltFrz - Sets up registers for debug mode *                       Set FRZ and HALT bits in MCR                       ** RETURNS: Error value*/static UCHAR TouCANSetHaltFrz( TouCAN pTouCanRegs){    /*     * Request debug mode      * Set FRZ and HALT     */        pTouCanRegs->can_MCR = (TOUCAN_FRZ | TOUCAN_HALT);            /*    * Poll till FRZACK is set    */    while(!(pTouCanRegs->can_MCR & TOUCAN_FRZACK))    {        /* just spin */    }        return OK;}/****************************************************************************** TouCANResetHaltFrz -  Resets debug mode** RETURNS: Error value*/static void TouCANResetHaltFrz( TouCAN pTouCanRegs){    /*Clear FRZ bit in MCR*/    pTouCanRegs->can_MCR &= ~(TOUCAN_FRZ | TOUCAN_HALT);        return;      }/************************************************************************** TouCAN_Init - This function initializes the CAN controller** This function initializes the CAN controller and makes default selections.* 1. Puts the CAN controller into reset 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. Unless user has changed these values before init is called, the*    default bit timing values are set to a baud rate of 250K. TouCAN has a *    separate field provided for setting the propgation delay in the bit time. *    The default value of propseg is 7. A TouCAN controller specific function*    TouCAN_SetPropseg is provided to change the propseg value stored in the *    CAN controller structure in software. The new value will be written to *    the hardware register when CAN_Init or CAN_SetBitTiming is called.* 4. Following reset both error counters reset to zero* 5. Sets local and global receive masks to don't care (accept all)* 6. Makes all channels inactive in hardware* 7. Set default values for timer sync = enabled, lbuf = lowest id first,*    auto power save mode = disabled, * 8. 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 always** ERRNO:   N/A**/static STATUS TouCAN_Init( struct WNCAN_Device *pDev ){    struct canAccess *pcanAccess;    TouCAN     pTouCanRegs;    TouCANBuf  pTouCanBufs;        UCHAR      value;    STATUS     retCode;    UINT       iflag;    UCHAR      i;    UCHAR      j;        pcanAccess = (struct canAccess *)pDev->pCtrl->csData;        pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;        pTouCanBufs = (TouCANBuf)pcanAccess->pTouCanBufs;            /* Put the controller into debug mode */    TouCANSetHaltFrz(pTouCanRegs);              /* Clear channel interrupt sources */       iflag = pTouCanRegs->can_IFLAG;    pTouCanRegs->can_IFLAG = 0;        /* Turn off Bus Off interrupt and error interrupt */                    pTouCanRegs->can_CR0 &= ~(TOUCAN_BOFF_MASK_ENABLE | TOUCAN_ERROR_MASK_ENABLE);        /*    Write default values for timeer sync enable and buffer transmission     priority, unless user has changed these by callin TouCAN specific     function TouCAN_SetTimerSync and TouCAN_SetLBuf    */    pTouCanRegs->can_CR1 = pcanAccess->TouCANTimerSync | pcanAccess->TouCANLBuf;        /*Set bit Timing values*/                pTouCanRegs->can_PRESDIV = pDev->pCtrl->brp; /*baud rate prescalar*/        value = (UCHAR)((pDev->pCtrl->sjw << 6) | (pDev->pCtrl->tseg1 << 3) | pDev->pCtrl->tseg2);        pTouCanRegs->can_CR2 = (UCHAR)value; /*sjw, tseg1, tseg2*/        if(pDev->pCtrl->samples)        /*propseg and samples*/              pTouCanRegs->can_CR1 |= (0x80 | pcanAccess->ToucanPropseg);     else        pTouCanRegs->can_CR1 |= pcanAccess->ToucanPropseg;               /* reset receive and transmit error counters */    pTouCanRegs->can_RxECTR = 0;    pTouCanRegs->can_TxECTR = 0;                /*Set receive masks to dont care*/    /*0 -> is don't care and 1 -> match the corresponding id bit*/    pTouCanRegs->can_RxGlobalMask = 0;            pTouCanRegs->can_RxBuff15Mask = 0;            pTouCanRegs->can_RxBuff14Mask = 0;                /* Make all 16 channels inactive */          for(i = 0 ; i < TOUCAN_MAX_MSG_OBJ; i++)    {        pDev->pCtrl->chnMode[i] = WNCAN_CHN_INVALID;                         pTouCanBufs->can_MSG[i].Control = TOUCAN_INACTIVE_BUFFER;          pTouCanBufs->can_MSG[i].Id = 0;        pTouCanBufs->can_MSG[i].Id2_OR_TimeStamp = 0;        for(j = 0 ; j < 8 ; j++)                    pTouCanBufs->can_MSG[i].Data[j] = 0;    }        /* Clear the controller reset */    /*     * Self wake, auto power save, low power stop mode are disabled by default    * The user can set them by calling the api provided if required         */                pTouCanRegs->can_MCR |= pcanAccess->TouCANAutoPowersSave;        /*    * Leave the HALT and FRZ bits asserted. The user will have to call     * CAN_Start to negate these bits and enable CAN communication    */               pTouCanRegs->can_MCR &= ~(TOUCAN_SFTRST | TOUCAN_SUPV);        retCode = OK;        return retCode;}/************************************************************************** TouCAN_Start - Bring 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**/static void TouCAN_Start( struct WNCAN_Device *pDev ){    struct canAccess *pcanAccess;    TouCAN     pTouCanRegs;         /*    * Get pointer to TouCAN registers      */        pcanAccess = (struct canAccess *)pDev->pCtrl->csData;       pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;            /* Start the TouCAN controller */           TouCANResetHaltFrz(pTouCanRegs);            }/************************************************************************** TouCAN_Stop - Put CAN controller offline** Disables communication between CAN controller and the CAN bus** RETURNS: N/A*   * ERRNO:   N/A**/static void TouCAN_Stop( struct WNCAN_Device *pDev ){    struct canAccess *pcanAccess;    TouCAN     pTouCanRegs;         /*    * Get pointer to TouCAN registers      */        pcanAccess = (struct canAccess *)pDev->pCtrl->csData;       pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;            /* enter debug mode */    TouCANSetHaltFrz(pTouCanRegs);            }/************************************************************************** TouCAN_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 interrupts due to errors on the CAN bus*                   This may be implemented as a single or multiple*                   interrupt sources on the CAN controller.* WNCAN_INT_BUS_OFF: enables interrupt indicating bus off condition  * WNCAN_INT_WAKE_UP: enables interrupt on wake up* All interrupt masks that need to be enabled must be specified in the list* passed to the function, in order to be set, every time the function* is called. ** RETURNS: OK or ERROR** ERRNO:   S_can_invalid_parameter**/static STATUS TouCAN_SetIntMask(struct WNCAN_Device *pDev, WNCAN_IntType intMask){        struct canAccess *pcanAccess;    TouCAN            pTouCANRegs;    int               oldLevel;        USHORT            value;    STATUS            retCode=OK;         /*    * Get pointer to TouCAN registers    */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCANRegs = (TouCAN)pcanAccess->pTouCanRegs;        /*      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    {        /*        Check if controller is in configuration change enable mode        if not set HALT bit        */        value = pTouCANRegs->can_MCR;        if((value & TOUCAN_HALT) != TOUCAN_HALT)            TouCANSetHaltFrz(pTouCANRegs);                      oldLevel = intLock();                if(intMask & WNCAN_INT_ERROR)            pTouCANRegs->can_CR0 |= TOUCAN_ERROR_MASK_ENABLE;               else            pTouCANRegs->can_CR0 &= ~TOUCAN_ERROR_MASK_ENABLE;                      if(intMask & WNCAN_INT_WAKE_UP)            pTouCANRegs->can_MCR |= TOUCAN_WAKEUPINT_ENABLE;        else            pTouCANRegs->can_MCR &= ~TOUCAN_WAKEUPINT_ENABLE;                        if(intMask & WNCAN_INT_BUS_OFF)            pTouCANRegs->can_CR0 |= TOUCAN_BOFF_MASK_ENABLE;        else            pTouCANRegs->can_CR0 &= ~TOUCAN_BOFF_MASK_ENABLE;                intUnlock(oldLevel);                /* Restore original state of controller */        if((value & TOUCAN_HALT) != TOUCAN_HALT)            TouCANResetHaltFrz(pTouCANRegs);    }    return retCode;    }/************************************************************************** TouCAN_EnableInt - - enable interrupts from the CAN device to the CPU.** This function enables interrupts from the CAN controller to reach the* CPU. Typically, enables a global interrupt mask bit at the CPU level.*   * RETURNS: N/A** ERRNO:   N/A**/static void TouCAN_EnableInt( struct WNCAN_Device *pDev ){        struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    UINT ppc5xxIlevel;    UINT32 tblOffset = 0;    int oldLevel;            /*    * Get pointer to TouCAN registers.            */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;            pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;                ppc5xxIlevel = ((pTouCanRegs->can_ICR & 0x00c0) >> 3) | ((pTouCanRegs->can_ICR & 0x0700) >> 8);        oldLevel = intLock();        tblOffset = VECTOR_TABLE_OFFSET_FROM_LEVEL(ppc5xxIlevel);        /* activate IRQ at the board and CPU level */    intEnable(tblOffset);            intUnlock(oldLevel);        return;}/************************************************************************** TouCAN_DisableInt - CAN interrupts are disabled on the controller.** RETURNS: N/A*   * ERRNO:   **/static void TouCAN_DisableInt( struct WNCAN_Device *pDev ){    struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    UINT ppc5xxIlevel;    UINT32 tblOffset = 0;    int oldLevel;            /*    * Get pointer to TouCAN registers.            */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;            pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;                ppc5xxIlevel = ((pTouCanRegs->can_ICR & 0x00c0) >> 3) | ((pTouCanRegs->can_ICR & 0x0700) >> 8);        oldLevel = intLock();

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区小说| 成人毛片在线观看| 国产一区激情在线| 国产91丝袜在线观看| 色综合天天综合网国产成人综合天 | 国产一区在线视频| 99久久伊人精品| 欧美日韩国产成人在线免费| 久久综合色综合88| 有码一区二区三区| 狠狠色丁香久久婷婷综合丁香| 99久久国产综合精品麻豆| 5月丁香婷婷综合| 国产精品剧情在线亚洲| 天堂蜜桃91精品| 成人免费观看av| 欧美一级搡bbbb搡bbbb| 中文字幕欧美激情一区| 三级亚洲高清视频| 不卡视频在线观看| 日韩午夜av电影| 中文字幕字幕中文在线中不卡视频| 婷婷久久综合九色综合伊人色| 国产精品伊人色| 欧美视频完全免费看| 国产欧美精品一区| 亚洲www啪成人一区二区麻豆 | 国产午夜三级一区二区三| 亚洲视频图片小说| 国产一区二区精品在线观看| 欧美性猛交xxxxxx富婆| 国产精品丝袜黑色高跟| 日本va欧美va瓶| 在线视频中文字幕一区二区| 欧美激情一区在线观看| 麻豆精品国产传媒mv男同| 色天使色偷偷av一区二区| 国产亚洲精品免费| 蜜臀精品一区二区三区在线观看 | 午夜久久久久久久久久一区二区| 国产精品一区二区久久不卡| 欧美日韩国产a| 亚洲精品国产精品乱码不99| 国产麻豆成人传媒免费观看| 7777精品伊人久久久大香线蕉的 | 在线视频综合导航| 欧美极品美女视频| 黄色资源网久久资源365| 欧美精品乱人伦久久久久久| 亚洲日本韩国一区| 成人丝袜高跟foot| 欧美精品一区二区蜜臀亚洲| 天堂影院一区二区| 欧美视频在线观看一区二区| 亚洲欧美日韩系列| 成人av网在线| 久久精品视频在线看| 久久99精品国产麻豆婷婷| 欧美福利视频导航| 亚洲成人777| 欧美视频一区在线| 樱桃视频在线观看一区| 一本色道综合亚洲| 国产精品久久午夜夜伦鲁鲁| 高清日韩电视剧大全免费| 久久久久国产精品厨房| 国产伦精品一区二区三区视频青涩 | 国产精品国产成人国产三级 | 欧美激情一区二区| 国产成人精品一区二区三区四区| 欧美大片日本大片免费观看| 蜜臀久久99精品久久久久久9| 91福利小视频| 一区二区日韩av| 欧美视频在线一区二区三区| 亚洲一区二区精品视频| 欧美色区777第一页| 亚洲国产aⅴ天堂久久| 欧洲在线/亚洲| 视频一区二区三区中文字幕| 欧美精品一二三区| 日本在线不卡一区| 日韩精品一区二区三区在线播放| 久久99热这里只有精品| 久久蜜桃香蕉精品一区二区三区| 国产精品12区| 国产精品久久久久久久久久久免费看 | 欧美一区二区三级| 免费精品99久久国产综合精品| 欧美一区二区国产| 国产麻豆精品在线观看| 国产精品美日韩| 91福利社在线观看| 日韩电影免费在线| xnxx国产精品| 成人app软件下载大全免费| 一区二区三区av电影 | 国产一区日韩二区欧美三区| 国产欧美一区二区精品久导航| av欧美精品.com| 亚洲一区二区三区在线| 欧美一级淫片007| 成人性生交大合| 一区二区三区免费| 欧美一级片在线看| 成人国产精品免费观看视频| 一区二区三区中文字幕精品精品| 欧美精品日韩一本| 国产成人精品免费看| 亚洲综合免费观看高清完整版在线| 欧美一级免费观看| 成人午夜视频免费看| 亚洲成人第一页| 国产欧美视频一区二区三区| 日本韩国一区二区| 美美哒免费高清在线观看视频一区二区| 久久久欧美精品sm网站| 色嗨嗨av一区二区三区| 久久成人精品无人区| 亚洲欧洲精品成人久久奇米网| 欧美另类z0zxhd电影| 国产成人精品影院| 午夜久久久久久久久| 中文字幕巨乱亚洲| 欧美精品少妇一区二区三区| 国产成人99久久亚洲综合精品| 亚洲一区在线观看视频| 国产日本亚洲高清| 欧美自拍丝袜亚洲| 国产精品自产自拍| 视频在线观看91| 综合久久综合久久| 欧美xxxx老人做受| 欧美日韩一区中文字幕| 成人午夜电影久久影院| 捆绑紧缚一区二区三区视频| 亚洲柠檬福利资源导航| 精品国一区二区三区| 欧美视频在线一区二区三区 | 久久久久97国产精华液好用吗| 欧美性大战久久久久久久| 国产成人精品免费网站| 免费在线观看一区| 亚洲午夜av在线| 一区二区中文字幕在线| 久久亚洲精华国产精华液| 欧美肥胖老妇做爰| 在线看不卡av| av亚洲精华国产精华精华| 国产一区在线观看视频| 日本欧美韩国一区三区| 亚洲一区二区三区四区五区黄| 国产精品久久夜| 亚洲精品一区二区三区在线观看| 91黄视频在线观看| 99国产精品视频免费观看| 国产成人午夜精品影院观看视频| 日韩精品电影在线| 夜夜嗨av一区二区三区四季av| 国产精品久久久一本精品| 久久综合九色综合97_久久久| 91精品一区二区三区久久久久久| 欧美色倩网站大全免费| 色综合天天综合网国产成人综合天| 国产成人鲁色资源国产91色综| 久久超碰97中文字幕| 三级久久三级久久| 艳妇臀荡乳欲伦亚洲一区| 国产精品丝袜91| 亚洲国产电影在线观看| 国产亚洲精品精华液| 久久精品视频免费| 久久亚洲精品国产精品紫薇 | 成人激情小说网站| 国产精品一区二区久激情瑜伽| 久久精品国产99国产精品| 午夜伊人狠狠久久| 亚洲一区二区免费视频| 亚洲国产成人va在线观看天堂| 一区二区三区产品免费精品久久75| 亚洲天堂2016| 亚洲欧美另类久久久精品| 欧美高清在线一区二区| 中文字幕第一区| 中文字幕av一区二区三区| 国产精品伦理在线| 中文字幕佐山爱一区二区免费| 国产精品久久久久三级| 国产精品国产三级国产aⅴ原创| 国产精品国产三级国产aⅴ入口| 国产精品毛片久久久久久| 国产精品久久久久影院| 自拍偷拍亚洲欧美日韩| 亚洲柠檬福利资源导航| 亚洲福利视频三区| 调教+趴+乳夹+国产+精品| 亚欧色一区w666天堂| 老汉av免费一区二区三区| 国产在线一区观看| k8久久久一区二区三区|