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

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

?? toucan.c

?? can總線c語言 canopen 源程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* 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();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图丝袜美腿| 欧美激情一区二区三区蜜桃视频| 韩国精品主播一区二区在线观看| 国产精品国模大尺度视频| 另类小说综合欧美亚洲| 99精品久久只有精品| 欧美主播一区二区三区| 久久久一区二区| 亚洲一区二区三区在线| 日产欧产美韩系列久久99| 国产很黄免费观看久久| 日本精品裸体写真集在线观看| 91精品1区2区| 日韩你懂的在线观看| 日韩精品国产欧美| 精久久久久久久久久久| 91免费版在线看| 久久久三级国产网站| 午夜精品福利一区二区三区av | 日欧美一区二区| 国产精品99久久久久久宅男| 99re这里只有精品6| 欧美二区三区的天堂| 一区二区三区视频在线观看| 国产精品伊人色| 精品久久久久久久久久久久包黑料 | 国产一区日韩二区欧美三区| 日本高清不卡一区| 国产精品久久久久久久久免费相片 | 成人精品国产一区二区4080| 91麻豆精品国产综合久久久久久 | 国产婷婷色一区二区三区四区| 蜜臀久久久99精品久久久久久| 欧美日韩国产综合视频在线观看 | 91在线观看下载| 国产欧美日产一区| 国产精品18久久久久久久久| 日韩精品一区二区在线| 日本v片在线高清不卡在线观看| 欧美色手机在线观看| 一区二区成人在线| 一本大道久久a久久精二百| 国产蜜臀97一区二区三区| 精品一区二区三区视频| 欧美一区二区三区日韩| 一区二区欧美国产| 在线播放/欧美激情| 一区二区三区在线观看欧美| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 欧美日韩你懂得| 欧美日韩在线观看一区二区 | 狠狠色丁香久久婷婷综| 久久久久久久av麻豆果冻| 韩国视频一区二区| 亚洲视频一二三区| 制服丝袜亚洲精品中文字幕| 麻豆精品一区二区三区| 国产日产亚洲精品系列| 欧美中文字幕一区二区三区| 国产在线观看一区二区| 久久精品视频一区二区三区| 97精品久久久久中文字幕| 亚洲国产成人高清精品| 欧美一区三区二区| 福利91精品一区二区三区| 亚洲三级在线免费| 欧美调教femdomvk| 国产精品资源在线看| 有码一区二区三区| 国产偷v国产偷v亚洲高清| 欧洲视频一区二区| 国产 欧美在线| 婷婷久久综合九色国产成人| 精品国产亚洲一区二区三区在线观看| 国内精品不卡在线| 亚洲欧美乱综合| 中文字幕不卡在线播放| 日韩一区二区三区高清免费看看| 91亚洲精品一区二区乱码| 国产精品亚洲第一| 国产真实乱偷精品视频免| 五月天久久比比资源色| 亚洲日本va午夜在线电影| 亚洲国产精品成人综合| 国产夜色精品一区二区av| 91精品国产综合久久精品| 91久久久免费一区二区| 国产精品一卡二卡| 国产一区二区三区久久悠悠色av| 日本午夜一本久久久综合| 午夜精品久久久久久久蜜桃app| 亚洲丝袜制服诱惑| 国产精品网站在线观看| 久久精品亚洲乱码伦伦中文| 久久一留热品黄| 欧美精品一区二区三区一线天视频 | 视频一区在线播放| 秋霞午夜鲁丝一区二区老狼| 日本亚洲电影天堂| 青娱乐精品视频在线| 精品一区二区三区在线视频| 国产高清成人在线| 东方欧美亚洲色图在线| 不卡av电影在线播放| 欧美在线免费观看亚洲| 欧美日本一区二区三区四区| 夜色激情一区二区| 日本v片在线高清不卡在线观看| 久久电影网电视剧免费观看| 精品在线免费视频| 成人av高清在线| 欧美天堂一区二区三区| 欧美伦理电影网| 久久精品免费在线观看| 亚洲欧美日韩综合aⅴ视频| 日日夜夜精品视频免费| 亚洲第一在线综合网站| 日本女人一区二区三区| 亚洲美女在线一区| 国产精品国产a级| 亚洲成av人影院| 激情欧美日韩一区二区| 一本久道中文字幕精品亚洲嫩| 欧美亚男人的天堂| xnxx国产精品| 日韩中文字幕区一区有砖一区| 国产一区二区三区黄视频| 欧美日韩午夜精品| 日韩一区日韩二区| 国产九色sp调教91| 欧美男生操女生| 一区二区国产盗摄色噜噜| 国产成人精品在线看| 在线播放91灌醉迷j高跟美女 | 成人av片在线观看| 日韩午夜激情电影| 亚洲综合丁香婷婷六月香| 国产91在线观看| 欧美色爱综合网| 国产偷v国产偷v亚洲高清| 视频一区国产视频| 欧美日韩一区二区三区在线看| 国产女同互慰高潮91漫画| 免费高清视频精品| 91精品免费观看| 日韩精品国产精品| 久久久久久久久久久久电影| 久久久欧美精品sm网站| 91丨九色丨尤物| 轻轻草成人在线| 国产精品成人午夜| 欧美精品v日韩精品v韩国精品v| 麻豆精品在线播放| 国产精品毛片大码女人| 777欧美精品| 国产毛片精品视频| 久久精品一级爱片| 国产经典欧美精品| 亚洲精品国产精品乱码不99| 欧美xxx久久| 欧美三区免费完整视频在线观看| 免费成人美女在线观看.| 中文字幕在线一区| 精品国产成人在线影院| 91在线小视频| 国产精品一区二区在线播放| 一区二区三区高清不卡| 久久网这里都是精品| 欧美日韩一区二区三区四区| 国产一区二区三区观看| 亚洲成人www| 亚洲精品国产一区二区三区四区在线| 精品欧美久久久| 欧美电影一区二区三区| 欧美吻胸吃奶大尺度电影| 91麻豆视频网站| 波多野结衣视频一区| 国产成人啪午夜精品网站男同| 日本中文字幕一区| 亚洲电影一级黄| 亚洲综合区在线| 日韩美女啊v在线免费观看| 亚洲综合成人在线| 综合亚洲深深色噜噜狠狠网站| 欧美经典一区二区三区| 久久久综合九色合综国产精品| 久久婷婷久久一区二区三区| xfplay精品久久| 久久免费偷拍视频| 国产亚洲一区字幕| 日本一二三不卡| ...中文天堂在线一区| 自拍视频在线观看一区二区| 日韩理论片在线| 亚洲国产成人高清精品| 婷婷激情综合网| 久久99国产乱子伦精品免费| 日本欧美一区二区三区| 欧美午夜精品一区| 黄色成人免费在线|