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

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

?? toucan.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一区二区三区免费野_久草精品视频
粉嫩13p一区二区三区| 麻豆传媒一区二区三区| 欧美精品一区二区在线观看| 在线不卡一区二区| 欧美在线视频全部完| 欧美在线视频你懂得| 9191久久久久久久久久久| 欧美日韩中文国产| 欧美一区二区三区四区高清| 日韩欧美一区在线| 久久免费电影网| 国产精品免费网站在线观看| 亚洲色图欧洲色图婷婷| 亚洲日本一区二区三区| 亚洲综合免费观看高清在线观看| 亚洲综合免费观看高清完整版| 一区二区三区国产精华| 青青草国产精品亚洲专区无| 麻豆91精品91久久久的内涵| 国产高清一区日本| 91在线小视频| 欧美丰满一区二区免费视频| 日韩一区二区电影| 国产日韩精品一区二区三区在线| 日韩伦理av电影| 午夜a成v人精品| 久久99精品国产麻豆婷婷洗澡| 成人免费毛片a| 欧美视频在线观看一区| 精品电影一区二区| 亚洲欧洲色图综合| 蜜臀av性久久久久蜜臀aⅴ| 国产在线国偷精品产拍免费yy| 成人99免费视频| 日韩午夜av电影| 中文字幕免费观看一区| 视频一区视频二区中文字幕| 成人综合婷婷国产精品久久| 在线播放中文字幕一区| 国产欧美综合在线| 午夜不卡av免费| 成人av电影在线播放| 日韩欧美成人激情| 曰韩精品一区二区| 国产91露脸合集magnet| 欧美日本国产视频| 成人免费在线播放视频| 精品亚洲aⅴ乱码一区二区三区| 日本黄色一区二区| 久久精品欧美一区二区三区不卡 | 蜜桃视频在线一区| 99久久伊人精品| 久久综合久久久久88| 亚洲国产精品一区二区久久恐怖片 | 国产精品久久久久久户外露出| 亚洲成人黄色小说| 99精品欧美一区| 国产欧美一区二区在线| 久久精品国产**网站演员| 色丁香久综合在线久综合在线观看| 久久久综合视频| 麻豆一区二区三| 在线电影院国产精品| 亚洲综合视频在线观看| 色视频一区二区| 亚洲狼人国产精品| 91麻豆.com| 亚洲日本免费电影| 91女厕偷拍女厕偷拍高清| 日本一区二区三区免费乱视频| 国产精品自在欧美一区| 精品人在线二区三区| 激情另类小说区图片区视频区| 日韩午夜小视频| 麻豆精品在线播放| 精品久久久影院| 国产在线视频一区二区三区| 久久综合九色综合97婷婷女人| 久久国产综合精品| 欧美va亚洲va香蕉在线| 麻豆国产欧美一区二区三区| 欧美videos中文字幕| 国产精品一区二区在线看| 日韩免费高清视频| 国产精品一区二区久久精品爱涩| 欧美精品一区二区三区蜜桃视频 | 欧美日韩电影一区| 日本成人在线网站| 久久综合精品国产一区二区三区| 精品一区二区三区欧美| 国产无遮挡一区二区三区毛片日本| 国产黄色91视频| 亚洲青青青在线视频| 色天使久久综合网天天| 日本亚洲最大的色成网站www| 日韩欧美高清一区| 国产.欧美.日韩| 亚洲黄网站在线观看| 91精品国产欧美一区二区成人| 国内外成人在线| 亚洲色图色小说| 欧美一区国产二区| 国产精品2024| 亚洲综合一二区| 欧美白人最猛性xxxxx69交| 国产成人一区在线| 亚洲综合视频网| 久久精品视频在线看| 91免费国产视频网站| 蜜臀久久99精品久久久久久9| 国产亚洲福利社区一区| 在线精品亚洲一区二区不卡| 九一久久久久久| 亚洲成a人v欧美综合天堂下载| 久久影院午夜片一区| 欧美影视一区二区三区| 国产福利一区在线观看| 亚洲成年人影院| 亚洲天堂精品在线观看| 日韩欧美国产wwwww| 在线中文字幕不卡| 国产二区国产一区在线观看| 日日夜夜精品视频免费| 国产精品久久网站| 精品处破学生在线二十三| 在线观看日韩av先锋影音电影院| 国产精品白丝av| 日韩av高清在线观看| 亚洲精品视频一区二区| 国产女人水真多18毛片18精品视频 | 久久99精品国产麻豆婷婷洗澡| 亚洲精品国产一区二区精华液| 久久新电视剧免费观看| 91精品国产综合久久精品麻豆| 91丨porny丨户外露出| 国产精品2024| 国产一区二区伦理| 免费成人在线影院| 性久久久久久久久久久久| 亚洲日本va午夜在线电影| 日本一区二区视频在线观看| 精品国产不卡一区二区三区| 欧美日本韩国一区二区三区视频| 在线观看一区二区精品视频| 99精品桃花视频在线观看| 国产成人亚洲综合a∨婷婷| 奇米影视7777精品一区二区| 丝袜亚洲另类欧美| 亚洲一区二区偷拍精品| 亚洲一区二区三区四区的| 亚洲人成小说网站色在线 | 日韩二区三区四区| 亚洲午夜国产一区99re久久| 亚洲精品免费在线| 亚洲免费伊人电影| 亚洲人成小说网站色在线 | 大胆亚洲人体视频| 国产91对白在线观看九色| 国产精品影视天天线| 国产不卡视频一区二区三区| proumb性欧美在线观看| 91一区二区三区在线观看| 日本道精品一区二区三区| 欧美在线观看视频在线| 在线综合+亚洲+欧美中文字幕| 日韩欧美在线1卡| 国产三级精品在线| 亚洲同性同志一二三专区| 一区二区在线免费| 日本女优在线视频一区二区| 国产乱码一区二区三区| 不卡影院免费观看| 欧美午夜不卡视频| 日韩一区二区中文字幕| 中文字幕 久热精品 视频在线| ●精品国产综合乱码久久久久| 亚洲永久免费av| 久久国产视频网| a级高清视频欧美日韩| 在线电影一区二区三区| 久久久久国产精品麻豆ai换脸| 亚洲三级在线免费观看| 日韩专区一卡二卡| 国产成人精品一区二| 欧洲精品一区二区三区在线观看| 日韩一本二本av| 亚洲欧美日韩人成在线播放| 日本三级韩国三级欧美三级| 成人性视频免费网站| 欧美午夜免费电影| 久久久久久久久久电影| 亚洲国产精品视频| 国产99精品国产| 日韩欧美中文字幕公布| 亚洲色图在线看| 国产一级精品在线| 在线精品视频免费播放| 日本一区二区三区国色天香 | 日韩av成人高清| 96av麻豆蜜桃一区二区|