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

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

?? toucan.c

?? CAN例程 源碼 CAN例程 源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
        tblOffset = VECTOR_TABLE_OFFSET_FROM_LEVEL(ppc5xxIlevel);        /* activate IRQ at the board and CPU level */    intDisable(tblOffset);        intUnlock(oldLevel);        return;}/************************************************************************** TouCAN_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 in software, 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 + (propseg + 1) + (tseg1 + 1) + (tseg2+1) time quanta ** tseg1 refers to the segment of bit time after the end of propseg * and upto the sample point. The TouCAN has a settable propseg, there* is a controller specific function provided to set it. There will be* a place holder for the propseg in the CAN controller struct as well,* with the other bit timing parameters. For TouCAN the default* value of propseg is 7.*  ---------------------------------------------------------* |    |            |              |                        |  *  sync <--propseg-> <---tseg1 -->^|^<---------tseg2 ------>*                          sample point ** RETURNS: ERROR if any of the input parameters have invalid values,*          OK otherwise.*                       * ERRNO:   S_can_invalid_parameter**/static STATUS TouCAN_SetBitTiming( struct WNCAN_Device *pDev, UCHAR tseg1,  UCHAR tseg2,  UCHAR brp,  UCHAR sjw,    BOOL  samples    ){    struct canAccess *pcanAccess;    TouCAN            pTouCANRegs;    UCHAR             value;    STATUS            retCode = ERROR;        USHORT            regMCR;           /* qualify parameters */    if((sjw > 0x03) || (tseg1 > 7) || (tseg2 > 7))    {        errnoSet(S_can_invalid_parameter);                goto exit;    }        /*    * Get pointer to TouCAN registers and channels.        */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCANRegs = (TouCAN)pcanAccess->pTouCanRegs;            /*    Check if controller is in configuration change enable mode    if not set HALT bit    */    regMCR = pTouCANRegs->can_MCR;        if((regMCR & TOUCAN_HALT) != TOUCAN_HALT)        TouCANSetHaltFrz(pTouCANRegs);              /*Save input bit timing values in software CAN controller structure*/           pDev->pCtrl->brp = brp;            pDev->pCtrl->sjw = sjw;    pDev->pCtrl->tseg1 = tseg1;    pDev->pCtrl->tseg2 = tseg2;                 pDev->pCtrl->samples = samples;        /*Set bit Timing values*/    /* btr0 and btr1 */         pTouCANRegs->can_PRESDIV = brp;        /*Write values for rjw, tseg1, tseg2 in CR2*/    value = ((sjw << 6) | (tseg1 << 3) | tseg2);        pTouCANRegs->can_CR2 = (UCHAR)value;        /*Write value for propseg*/    /*    * If the user does not want a hard coded value of 7    * the value can be changed by calling the api TouCAN_SetPropseg    */    value = pTouCANRegs->can_CR1 & ~(TOUCAN_PROPSEG);        if(samples)        value |= (0x80 | pcanAccess->ToucanPropseg);    else        value |= pcanAccess->ToucanPropseg;        pTouCANRegs->can_CR1 = value;                /*restore controller state*/    if((regMCR & TOUCAN_HALT) != TOUCAN_HALT)        TouCANResetHaltFrz(pTouCANRegs);        retCode = OK;    exit:           return retCode;}/**************************************************************************** TouCAN_GetBaudRate: Returns baud rate by recalculating bit timing parameters* * RETURNS: baud rate in bps* * ERRNO:   N/A*/static UINT TouCAN_GetBaudRate( struct WNCAN_Device *pDev, UINT  *samplePoint   ){       struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    ULONG             sys_clk_frequency;     UINT32            base;    volatile unsigned int uimbMcr;    USHORT            num_time_quanta;    UCHAR             brp, tseg1, tseg2, propseg;           /*    * Get pointer to TouCAN registers and channels.        */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;        sys_clk_frequency = pDev->pBrd->xtalFreq;        /*Get base of address space*/    base = vxImemBaseGet();        /*Check the Half speed bit setting in the UMCR*/            uimbMcr = *(PPCUIMB_MCR(base));        if(uimbMcr && UIMB_HSPEED) {         /*The IMB frequency is one half that of the U bus*/        sys_clk_frequency = sys_clk_frequency / 2;    }            brp = (pTouCanRegs->can_PRESDIV) + 1;        tseg1 = ((pTouCanRegs->can_CR2 & TOUCAN_PSEG) >> 3) + 1;              tseg2 = (pTouCanRegs->can_CR2 & TOUCAN_PSEG2) + 1;              propseg = (pTouCanRegs->can_CR1 & TOUCAN_PROPSEG) + 1;              /*Calculate baud rate*/    num_time_quanta = 1 + propseg + tseg1 + tseg2;        *samplePoint = ((1+propseg+tseg1) * 100)/num_time_quanta;        return(sys_clk_frequency / (num_time_quanta * brp));    }/************************************************************************** TouCAN_GetBusStatus - get the bus status** This function returns the status of the CAN bus. The bus is * either in a WNCAN_BUS_OFF, WNCAN_BUS_WARN, or WNCAN_BUS_OK state.** WNCAN_BUS_OFF: CAN controller is in BUS OFF state* A CAN node is bus off when the transmit error count is greater than* or equal to 256* WNCAN_BUS_WARN: CAN controller is in ERROR WARNING state* A CAN node is in error warning state when the number of transmit errors* equals or exceeds 96, or the number of receive errors equals or exceeds* 96* WNCAN_BUS_OK: CAN controller is in ERROR ACTIVE state* A CAN node in error active state can normally take part in bus communication* and sends an ACTIVE ERROR FLAG when an error has been detected. ** RETURNS: status of the CAN bus = WNCAN_BUS_OK, WNCAN_BUSWARN, * WNCAN_BUS_OFF** ERRNO: N/A**/static WNCAN_BusStatus TouCAN_GetBusStatus( struct WNCAN_Device *pDev ){        struct canAccess *pcanAccess;    TouCAN     pTouCanRegs;    USHORT     regStatus;    WNCAN_BusStatus retStat=WNCAN_BUS_OFF;        /*    * Get pointer to TouCAN registers and channels.        */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;                          /* read the status register */    regStatus = pTouCanRegs->can_ESTAT;        if((regStatus & TOUCAN_FCS) == TOUCAN_ERR_ACTIVE)        retStat = WNCAN_BUS_OK;    else if(regStatus & 0x0020)        retStat = WNCAN_BUS_OFF;        if((regStatus & TOUCAN_TXWARN) || (regStatus & TOUCAN_RXWARN))        retStat = WNCAN_BUS_WARN;            return retStat;}/************************************************************************** TouCAN_GetBusError - get the bus error** This function returns an ORed bit mask of all the bus errors that have* occured during the last bus activity.* Bus errors returned by this function can have the following values:* WNCAN_ERR_NONE: No errors detected* WNCAN_ERR_BIT: Bit error. * WNCAN_ERR_ACK: Acknowledgement error. * WNCAN_ERR_CRC: CRC error* WNCAN_ERR_FORM: Form error* WNCAN_ERR_STUFF: Stuff error* WNCAN_ERR_UNKNOWN: this condition should not occur* The five errors are not mutually exclusive. * The occurence of an error will be indicated by an interrupt. Typically, * this function will be called from the error interrupt handling case in the* user's ISR callback function, to find out the kind of error that occured* on the bus.** RETURNS: the bus error** ERRNO: N/A**/static WNCAN_BusError TouCAN_GetBusError( struct WNCAN_Device *pDev ){            struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    USHORT            value;    WNCAN_BusError    error = WNCAN_ERR_NONE;        pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;                          /* read the error status capture register */    value = pTouCanRegs->can_ESTAT;        if(value & TOUCAN_ACKERR)        error |= WNCAN_ERR_ACK;        if(value & TOUCAN_CRCERR)        error |= WNCAN_ERR_CRC;        if(value & TOUCAN_FORMERR)        error |= WNCAN_ERR_FORM;        if(value & TOUCAN_STUFFERR)        error |= WNCAN_ERR_STUFF;        if(value & (TOUCAN_TXDOM_RXREC | TOUCAN_TXREC_TXDOM))        error |= WNCAN_ERR_BIT;        return error;    }/************************************************************************** TouCAN_ReadID - read the CAN Id ** This function reads the CAN Id corresponding to the channel number on* the controller. The standard or extended flag is set by the function.* The mode of the channel cannot be WNCAN_CHN_INACTIVE or WNCAN_CHN_INVALID** RETURNS:        LONG: the CAN Id; on error return -1** ERRNO:          S_can_illegal_channel_no,*                 S_can_illegal_config*                 S_can_busy***/static long TouCAN_ReadID( struct WNCAN_Device *pDev, UCHAR channelNum, BOOL* ext ){        struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    TouCANBuf         pTouCanBufs;         volatile TouCAN_StandardMsgType *buffer;    unsigned short    value;        long              msgID = -1; /* invalid msg id */     /*     * Check if channel number is within range      * or if it marked as inactive     * or if the buffer is currently receiving and hence busy    */     if (channelNum >= TOUCAN_MAX_MSG_OBJ)    {        errnoSet(S_can_illegal_channel_no);        goto exit;    }        if((pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_INACTIVE) ||        (pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_INVALID))    {        errnoSet(S_can_illegal_config);                    goto exit;    }        /*    * Get pointer to TouCAN registers.            */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;        pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;    pTouCanBufs = (TouCANBuf)pcanAccess->pTouCanBufs;        buffer = &pTouCanBufs->can_MSG[channelNum];        /*next test busy bit only for Rx buffers*/        if((pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_RECEIVE) ||        (pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_RTR_RESPONDER))       {        if(buffer->Control & TOUCAN_BUFFER_BUSY)        {            errnoSet(S_can_busy);                        goto exit;        }    }        /*     * Get the message ID from the buffer, and copy the ID    */            if((buffer->Id & TOUCAN_IDE_EXT) == TOUCAN_IDE_EXT)    {        /*Copy ID of message */        value = (USHORT)((buffer->Id & (USHORT)TOUCAN_ID_BITS_28TO18) |            ((buffer->Id & (USHORT)TOUCAN_ID_BITS_17TO15) << 2));        msgID = ((ULONG)value << 13) | ((ULONG)buffer->Id2_OR_TimeStamp>>1);                            *ext = TRUE;    }        else    {        msgID = (buffer->Id >> 5);                          *ext = FALSE;    }        /*Read the free running timer to unlock channel accessed*/    timerRead = pTouCanRegs->can_TIMER; exit:            return msgID;} /************************************************************************** TouCAN_ReadData - reads 0 to 8 bytes of data from channel** This function reads "len" bytes of data from the channel and sets the value* of len to the number of bytes read. The range of "len" is zero (for zero * length data) to a maximum of eight. The mode of the channel must not be * WNCAN_CHN_INVALID or WNCAN_CHN_INACTIVE; however, the newData flag is valid * WNCAN_CHN_RECEIVE or WNCAN_CHN_REQUESTER channel mode.* For receive channels, if no new data has been received since the last* CAN_ReadData  function call, the newData flag is set to FALSE; * otherwise, the flag is TRUE. In both cases, the data and length of the* data currently in the channel are read. ** RETURNS:        OK, or ERROR** ERRNO:          S_can_illegal_channel_no,*                 S_can_illegal_config,*                 S_can_buffer_overflow,*                 S_can_busy**/static STATUS TouCAN_ReadData      (      struct WNCAN_Device *pDev,      UCHAR  channelNum,      UCHAR  *data,      UCHAR  *len,      BOOL   *newData      ){        struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    TouCANBuf         pTouCanBufs;    volatile TouCAN_StandardMsgType *buffer;    UINT            i;      STATUS          retCode = ERROR; /* pessimistic */    volatile USHORT regCtrl;    volatile UCHAR  hwLength;    if (channelNum >= TOUCAN_MAX_MSG_OBJ)    {        errnoSet(S_can_illegal_channel_no);        goto exit;    }        if((pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_INACTIVE) ||            (pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_INVALID))    {        errnoSet(S_can_illegal_config);                goto exit;    }        /*     * Get pointer to TouCAN registers and channels.         */            pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCanRegs = (TouCAN)pcanAccess->pTouCanRegs;    pTouCanBufs = (TouCANBuf)pcanAccess->pTouCanBufs;                   buffer = &pTouCanBufs->can_MSG[channelNum];        /*next test busy bit only for Rx buffers*/    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级片在线看| 精品国产一区二区三区久久影院 | 欧美一区二区三区啪啪| 色综合天天天天做夜夜夜夜做| 国产美女在线精品| 国产九色精品成人porny| 国产精品456露脸| 成人av在线资源网| 91成人网在线| 欧美一级高清片| 久久久久久久综合狠狠综合| 日本一区二区成人| 玉足女爽爽91| 日本欧美在线观看| 美女精品一区二区| 国产成人精品亚洲777人妖 | 日韩影院精彩在线| 国内外成人在线| 成人91在线观看| 欧美日韩国产综合一区二区| 欧美高清一级片在线| 日韩精品在线看片z| 中文字幕亚洲区| 视频一区二区欧美| 成人国产精品免费观看视频| 欧美在线观看视频一区二区 | 国产欧美日韩在线观看| 中文字幕精品在线不卡| 香港成人在线视频| 成人涩涩免费视频| 制服丝袜亚洲网站| 国产精品久久久久久一区二区三区 | 欧美精品在线观看播放| 国产亚洲精品bt天堂精选| 亚洲综合激情网| 国产酒店精品激情| 欧美精品日日鲁夜夜添| 中文字幕不卡的av| 美国三级日本三级久久99| 92精品国产成人观看免费| 精品国产一区二区在线观看| 亚洲欧美日韩一区二区| 国产一区二区视频在线播放| 精品视频123区在线观看| 日本一区二区三区久久久久久久久不 | 欧美国产精品专区| 日本午夜精品视频在线观看 | 678五月天丁香亚洲综合网| 中文在线资源观看网站视频免费不卡 | 国产日韩亚洲欧美综合| 日韩精品成人一区二区三区| 91麻豆国产自产在线观看| 国产亚洲欧美在线| 麻豆成人久久精品二区三区小说| 色呦呦网站一区| 国产精品黄色在线观看| 国产激情偷乱视频一区二区三区| 日韩久久免费av| 亚洲电影在线播放| 色琪琪一区二区三区亚洲区| 国产精品人成在线观看免费 | 午夜精品123| 欧美亚一区二区| 一区二区三区在线观看国产| 菠萝蜜视频在线观看一区| 久久综合色综合88| 国产美女精品人人做人人爽 | 日本丶国产丶欧美色综合| 最新久久zyz资源站| 成人性生交大合| 国产精品视频在线看| 丁香激情综合五月| 欧美国产日韩一二三区| 成人深夜在线观看| 中文字幕欧美一| 91日韩一区二区三区| 亚洲精品成a人| 欧美亚洲一区二区三区四区| 亚洲国产综合91精品麻豆| 欧美性受xxxx黑人xyx| 性做久久久久久久免费看| 日韩视频在线一区二区| 黑人精品欧美一区二区蜜桃| 久久欧美一区二区| 成人黄色免费短视频| 日韩伦理免费电影| 欧美色视频一区| 欧美bbbbb| 中文字幕av一区二区三区高| 91蝌蚪porny九色| 亚洲国产成人tv| 日韩天堂在线观看| 风间由美一区二区三区在线观看| 中文字幕一区二区三区视频| 欧美日韩国产天堂| 精油按摩中文字幕久久| 中文字幕亚洲综合久久菠萝蜜| 欧美性受xxxx| 精品一区二区三区久久| 亚洲色图欧洲色图婷婷| 69久久夜色精品国产69蝌蚪网| 精品一区二区三区不卡 | 精品女同一区二区| 99视频一区二区三区| 日韩精品一二三四| 国产欧美一区在线| 欧美日韩卡一卡二| 国产成人av在线影院| 亚洲成av人片在线观看无码| 国产日韩欧美a| 欧美精品777| 不卡一区在线观看| 六月婷婷色综合| 亚洲男人的天堂网| 精品三级在线看| 91国在线观看| 国产精品乡下勾搭老头1| 亚洲一区欧美一区| 国产精品美女久久久久aⅴ| 制服丝袜国产精品| 91国产精品成人| 成人免费黄色大片| 精品一区二区三区影院在线午夜 | 久久久亚洲欧洲日产国码αv| 欧美在线观看一区二区| 成人毛片在线观看| 麻豆91精品视频| 香蕉久久夜色精品国产使用方法 | 天堂蜜桃一区二区三区| 国产精品传媒视频| 久久久久久久久久久久久女国产乱| 欧美日韩一区二区欧美激情| 99re热视频精品| 成人手机在线视频| 国产成人亚洲精品青草天美| 久久不见久久见中文字幕免费| 一区二区免费在线播放| 亚洲欧洲日韩av| 一区免费观看视频| 国产精品美女久久久久aⅴ | 美女网站一区二区| 丝袜a∨在线一区二区三区不卡| 亚洲综合色婷婷| 亚洲综合一二三区| 亚洲一区二区成人在线观看| 亚洲精品国产a| 亚洲一区二区三区自拍| 亚洲午夜在线电影| 午夜一区二区三区视频| 天堂一区二区在线免费观看| 亚洲超碰精品一区二区| 丝袜诱惑亚洲看片| 亚洲成人免费在线观看| 日韩高清欧美激情| 老司机精品视频在线| 精品夜夜嗨av一区二区三区| 国产美女视频91| 懂色av一区二区三区免费观看| 国产成人啪午夜精品网站男同| 国产成人精品综合在线观看| 懂色av噜噜一区二区三区av| 91在线观看污| 91黄色在线观看| 欧美裸体一区二区三区| 日韩欧美亚洲另类制服综合在线 | 亚洲男同1069视频| 亚洲成人1区2区| 久久精品国产秦先生| 国产乱码精品一区二区三区忘忧草 | 日韩亚洲国产中文字幕欧美| 精品国内二区三区| 中文字幕第一区综合| 亚洲与欧洲av电影| 奇米一区二区三区av| 高清视频一区二区| 欧美性色综合网| 日韩免费在线观看| 18成人在线观看| 蜜臀精品一区二区三区在线观看 | 日韩va欧美va亚洲va久久| 国精产品一区一区三区mba视频| 成人高清视频免费观看| 欧美日韩专区在线| 久久久精品欧美丰满| 亚洲第一福利一区| 国产馆精品极品| 欧美婷婷六月丁香综合色| 精品区一区二区| 亚洲一二三区不卡| 成人夜色视频网站在线观看| 欧美日韩一区二区不卡| 国产农村妇女毛片精品久久麻豆| 一区二区三区精品在线观看| 韩国三级电影一区二区| 在线亚洲免费视频| 国产欧美日本一区视频| 日韩有码一区二区三区| 91国产视频在线观看| 国产日产欧美一区| 九色综合狠狠综合久久|