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

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

?? toucan.c

?? CAN SJA1000 LINUX driver
?? 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一区二区三区免费野_久草精品视频
国产精品久久久久久亚洲毛片| 高清国产午夜精品久久久久久| 91老师国产黑色丝袜在线| 日韩美一区二区三区| 日韩成人dvd| 在线播放国产精品二区一二区四区 | 蜜桃视频在线观看一区二区| 欧美日韩黄色影视| 午夜视频一区二区三区| 欧美色窝79yyyycom| 亚洲福中文字幕伊人影院| 欧美日韩国产系列| 丝袜美腿亚洲色图| 69堂精品视频| 激情文学综合丁香| 国产蜜臀av在线一区二区三区| 国产美女精品人人做人人爽| 国产精品欧美久久久久无广告| 极品美女销魂一区二区三区免费| 久久亚洲欧美国产精品乐播| 国产在线视频一区二区三区| 久久综合九色综合欧美亚洲| 国产成人av一区二区三区在线| 国产人伦精品一区二区| 99久久久久久99| 亚洲午夜精品久久久久久久久| 51精品视频一区二区三区| 另类小说综合欧美亚洲| 久久你懂得1024| 国产精一品亚洲二区在线视频| 久久久久久亚洲综合影院红桃| 成人黄色一级视频| 亚洲高清在线精品| 日韩免费高清视频| 成人a免费在线看| 国产精品久久久久久久久搜平片| 一本到不卡精品视频在线观看| 亚洲一二三级电影| 日韩一级二级三级| 成人ar影院免费观看视频| 亚洲一区二区视频在线观看| 日韩视频免费观看高清完整版在线观看 | 亚洲二区在线观看| 中文字幕一区在线| 欧美一级免费大片| 99久精品国产| 激情小说欧美图片| 亚洲日本免费电影| 26uuu国产电影一区二区| 91在线码无精品| 免费看日韩a级影片| 国产精品久久福利| 日韩欧美在线综合网| 国产在线一区二区| 午夜欧美电影在线观看| 日本一区二区动态图| 一区二区三区欧美日| 欧洲一区二区三区在线| 国产成人av一区二区三区在线 | av成人免费在线观看| 国产精品88888| 国精品**一区二区三区在线蜜桃| 日日摸夜夜添夜夜添国产精品 | 亚洲国产美女搞黄色| 国产精品的网站| 国产精品高潮呻吟| 国产精品免费视频一区| 国产婷婷色一区二区三区四区| 欧美va亚洲va| 精品国产乱码久久久久久蜜臀| 日韩无一区二区| 91精品一区二区三区久久久久久| 欧美日韩视频在线第一区 | 国产麻豆日韩欧美久久| 狠狠色综合色综合网络| 国产乱码精品一区二区三| 国产精品原创巨作av| 成熟亚洲日本毛茸茸凸凹| 成人精品免费看| 91亚洲精品久久久蜜桃| 欧美亚洲愉拍一区二区| 精品视频全国免费看| 国产午夜亚洲精品羞羞网站| 久久综合九色综合97_久久久| 久久免费视频色| 欧美国产国产综合| 日韩理论片在线| 亚洲国产成人av| 久久99精品国产91久久来源| 国产精品正在播放| 色综合久久88色综合天天免费| 欧美性猛片aaaaaaa做受| 欧美日韩亚洲国产综合| 日韩欧美精品在线视频| 欧美韩国日本综合| 一区二区三区四区激情 | 久久精品国产亚洲一区二区三区| 免费视频最近日韩| 国产黄色成人av| 一本一本久久a久久精品综合麻豆| 欧美私人免费视频| 精品免费日韩av| 欧美国产综合一区二区| 亚洲一区二区精品3399| 久久精品国产一区二区三区免费看| 国产成人午夜片在线观看高清观看| 91视频xxxx| 欧美一卡二卡在线观看| 国产日韩欧美不卡在线| 亚洲高清在线精品| 国产精品2024| 欧美日韩视频一区二区| 久久亚洲私人国产精品va媚药| 亚洲视频一区在线| 另类小说综合欧美亚洲| 色哟哟一区二区在线观看 | 国产成人午夜高潮毛片| 91黄色免费网站| 久久久五月婷婷| 亚洲国产精品视频| 成人视屏免费看| 欧美一区午夜视频在线观看| 国产精品嫩草影院com| 日韩成人dvd| 色综合久久久久| 久久久精品黄色| 日本中文字幕一区二区视频| 成人国产视频在线观看| 日韩精品最新网址| 亚洲男同性视频| 国产高清亚洲一区| 欧美一区二区三区成人| 亚洲视频中文字幕| 91视频xxxx| 中文字幕免费不卡| 欧美aaaaa成人免费观看视频| 色噜噜狠狠成人网p站| 国产肉丝袜一区二区| 蜜臀av亚洲一区中文字幕| 在线一区二区视频| 国产精品麻豆久久久| 国产乱码一区二区三区| 欧美一级片在线观看| 自拍av一区二区三区| 国产成人综合亚洲91猫咪| 日韩一区二区在线观看| 夜夜操天天操亚洲| 97se亚洲国产综合自在线不卡| 久久久久国产精品人| 蜜桃精品视频在线| 欧美一区二区三区视频| 亚洲福利视频三区| 欧美日韩国产高清一区| 夜夜嗨av一区二区三区| 色八戒一区二区三区| 亚洲色图视频网站| 99精品久久免费看蜜臀剧情介绍| 久久精品一区四区| 国产成人精品三级麻豆| 国产日产欧美一区| 成人一区二区在线观看| 国产欧美一区二区三区网站| 国产精品亚洲人在线观看| 精品捆绑美女sm三区| 久久99最新地址| www激情久久| 国产呦萝稀缺另类资源| 久久综合久久鬼色中文字| 精品一区二区三区日韩| 日韩精品一区二区三区老鸭窝| 日本vs亚洲vs韩国一区三区二区| 欧美日韩国产大片| 麻豆成人综合网| 久久中文娱乐网| 国产999精品久久| 中文字幕一区二区三区四区不卡| 成人国产精品免费网站| 亚洲免费观看高清完整版在线观看 | 欧美婷婷六月丁香综合色| 亚洲一区视频在线| 欧美美女网站色| 免费人成精品欧美精品| 欧美电影免费提供在线观看| 国产一区二区三区在线观看精品| 国产蜜臀97一区二区三区| 91一区在线观看| 五月天激情综合网| 欧美sm美女调教| www.色精品| 亚洲一区国产视频| 久久综合五月天婷婷伊人| 丰满放荡岳乱妇91ww| 亚洲精品视频免费看| 欧美精品一二三| 国产传媒一区在线| 一区二区三区日本| 日韩视频在线永久播放| 成人黄色综合网站| 天天操天天干天天综合网| 久久久久久久久久久电影|