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

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

?? toucan.c

?? 風河編寫的摩托羅拉toucan模塊的驅動代碼
?? 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一区二区三区免费野_久草精品视频
图片区小说区国产精品视频| 国产精品蜜臀av| 99热99精品| 一区二区三区在线不卡| 精品视频一区二区不卡| 国产在线精品不卡| 午夜精品福利一区二区三区av| 日韩欧美国产一区二区三区| 成人手机电影网| 天天射综合影视| 中文子幕无线码一区tr| 日韩美女一区二区三区| 99视频精品免费视频| 国产专区欧美精品| 亚洲gay无套男同| 一区二区三区在线视频观看58| 久久久精品综合| 精品久久久久久最新网址| 欧美日韩一区二区三区四区| 成人黄色国产精品网站大全在线免费观看 | 久久精品亚洲麻豆av一区二区 | 国产精品亚洲成人| 美女任你摸久久| 蜜臀av一区二区在线免费观看| 亚洲黄色免费网站| 一区二区三区四区国产精品| 国产精品久久久久久久蜜臀| 国产精品你懂的在线欣赏| 日本一区二区不卡视频| 国产欧美一区二区精品忘忧草| 欧美一级二级三级蜜桃| 精品国产一区二区三区久久久蜜月 | 2024国产精品视频| 国产精品传媒在线| 亚洲一区在线观看视频| 中文字幕不卡三区| 国产精品欧美一级免费| ...xxx性欧美| 亚洲午夜精品在线| 亚洲五月六月丁香激情| 亚洲一区二区视频在线| 天堂影院一区二区| 一个色在线综合| 激情文学综合插| 成人黄色软件下载| 正在播放一区二区| 精品久久国产字幕高潮| 日韩精品专区在线| 国产精品麻豆久久久| 日本不卡中文字幕| 99久久精品免费| 精品日韩欧美在线| 亚洲黄色av一区| 国模无码大尺度一区二区三区| 国产综合色在线视频区| 粉嫩绯色av一区二区在线观看 | 久久精品久久久精品美女| 国产中文字幕一区| 欧美一区二区三区免费在线看 | 午夜激情久久久| 在线观看视频欧美| 国产精品久久久久影视| 美女高潮久久久| 色婷婷精品大在线视频| 中文字幕av不卡| 韩国v欧美v日本v亚洲v| 欧美色网一区二区| 亚洲免费毛片网站| 国产91清纯白嫩初高中在线观看 | 久久一区二区三区四区| 五月激情综合婷婷| 欧美网站大全在线观看| 亚洲免费观看高清| 成人精品高清在线| 国产精品久久毛片a| 国产一区二区不卡老阿姨| 日韩欧美国产系列| 久久99精品视频| xf在线a精品一区二区视频网站| 日产欧产美韩系列久久99| 欧美日韩一区久久| 亚洲小少妇裸体bbw| 欧美一区二区三区的| 午夜精品123| 精品国产成人系列| 国产91精品在线观看| 欧美国产精品一区二区三区| 国产91精品一区二区麻豆网站| 国产精品免费视频一区| 国产不卡免费视频| 亚洲色图丝袜美腿| 欧美日韩国产另类不卡| 麻豆高清免费国产一区| 亚洲精品一区二区三区福利| 国产成人免费视频一区| 国产精品网友自拍| 欧美性猛交xxxx乱大交退制版| 亚洲午夜国产一区99re久久| 欧美精品一二三区| 久久黄色级2电影| 国产欧美日韩麻豆91| 91啪亚洲精品| 国产在线视视频有精品| 综合久久久久久| 日韩女优视频免费观看| 成人精品鲁一区一区二区| 亚洲免费资源在线播放| 久久嫩草精品久久久精品 | 国产一区二区中文字幕| 樱桃国产成人精品视频| 久久精品一区蜜桃臀影院| 欧美一区二区三区精品| av激情亚洲男人天堂| 蜜桃视频第一区免费观看| 国产精品热久久久久夜色精品三区 | 老司机精品视频一区二区三区| 亚洲成a人片综合在线| 国产精品天美传媒沈樵| 久久久久久久久久久久久女国产乱| 99精品1区2区| 色综合久久久久| 91视频在线观看免费| 国产麻豆精品theporn| 黄色小说综合网站| 久久99国产精品久久99果冻传媒| 一区二区不卡在线视频 午夜欧美不卡在| 777亚洲妇女| 欧美日韩免费一区二区三区 | 日韩一区二区中文字幕| 欧美视频自拍偷拍| 欧美精品黑人性xxxx| 欧美在线高清视频| 欧美色涩在线第一页| 99国内精品久久| 日本亚洲欧美天堂免费| 日日夜夜精品视频免费| 美女网站一区二区| 精品在线视频一区| 成人av在线一区二区| 在线亚洲一区二区| 欧美乱妇20p| 精品国产污污免费网站入口| 久久久午夜电影| 亚洲狠狠丁香婷婷综合久久久| 亚洲国产你懂的| 紧缚捆绑精品一区二区| 99精品视频一区| 欧美另类一区二区三区| 久久午夜免费电影| 亚洲日本乱码在线观看| 日韩av在线发布| 国产在线精品一区二区不卡了| 91视频国产观看| 91精品在线一区二区| 欧美中文字幕久久| 本田岬高潮一区二区三区| 成人黄色小视频| 99视频在线精品| 日韩久久精品一区| 久久人人97超碰com| 天天综合日日夜夜精品| 久久精品二区亚洲w码| 欧美系列日韩一区| 国产精品你懂的在线| 久久精品久久综合| 99久久国产免费看| 中文字幕制服丝袜一区二区三区 | 亚洲综合男人的天堂| 99久久久国产精品免费蜜臀| 日韩精品一区二区三区视频播放 | 欧美在线观看视频一区二区| 中文字幕一区二区三区四区| 久久丁香综合五月国产三级网站 | 99re视频精品| 国产精品久久影院| 99久久综合国产精品| 精品久久99ma| 韩国欧美国产1区| 国产三级久久久| 国产一区二区按摩在线观看| 欧美一区二区三区性视频| 日本欧美加勒比视频| 色综合中文字幕国产| 国产精品久久久久久亚洲毛片 | 亚洲国产综合视频在线观看| 91免费版在线| 日韩不卡手机在线v区| 亚洲精品在线免费观看视频| 激情综合色综合久久综合| 精品久久99ma| 91丨porny丨中文| 五月天激情综合网| 中文在线资源观看网站视频免费不卡 | 日本成人在线网站| 久久男人中文字幕资源站| 成人夜色视频网站在线观看| 欧美国产精品中文字幕| 精品视频在线免费| 国产美女精品人人做人人爽| 91精品国产入口在线|