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

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

?? toucan.c

?? CAN SJA1000 LINUX driver
?? C
?? 第 1 頁 / 共 5 頁
字號:
    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;        }    }        hwLength = (UCHAR)(buffer->Control & 0x000F);        if (hwLength > *len)    {        /*        If the actual number of bytes in the message are greater than        expected bytes by user, set error no and do not copy message        DLC into *len        */        errnoSet(S_can_buffer_overflow);            }    else {        /*If the message DLC and the expected data length is equal,        or data buffer size is larger, copy message DLC into *len        and continue */        *len = hwLength;        retCode = OK;    }    /*    * Write data bytes equal to length of message    */        for(i = 0; i < *len; i++)        data[i] = buffer->Data[i];            /*check the channel control field to see if the message was new*/            regCtrl = buffer->Control & 0x00f0;        if(regCtrl == TOUCAN_BUFFER_FULL)        *newData = 1;        retCode = OK;    /*Read the free running timer to unlock channel accessed*/    timerRead = pTouCanRegs->can_TIMER; exit:    return retCode;}/************************************************************************** TouCAN_GetMessageLength - get the message length** This function returns the length of the message data in the channel* The minimum value returned is 0, and the maximum value is 8. * This number is equal to the "len" argument in CAN_ReadData. If the data * has zero length, this function returns zero. The mode of the channel* must not be WNCAN_CHN_INACTIVE or WNCAN_CHN_INVALID** RETURNS:        length of data or -1 if error** ERRNO:          S_can_illegal_channel_no, S_can_illegal_config***/static int TouCAN_GetMessageLength( struct WNCAN_Device *pDev, UCHAR channelNum ){    struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    TouCANBuf         pTouCanBufs;    volatile TouCAN_StandardMsgType *buffer;    int               retLen = -1; /* pessimistic */            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*/        if(pDev->pCtrl->chnMode[channelNum] != WNCAN_CHN_TRANSMIT)    {        if(buffer->Control & TOUCAN_BUFFER_BUSY)        {            errnoSet(S_can_busy);                            goto exit;        }    }        /* Copy number of bytes in data*/    retLen = (UCHAR)(buffer->Control & 0x000F);         /*Read the free running timer to unlock channel accessed*/    timerRead = pTouCanRegs->can_TIMER;        exit:        return retLen;}      /************************************************************************** TouCAN_WriteID - write the CAN Id  to the channel number ** This function writes the CAN Id to the channel. The type of Id * (standard or extended) is specified. the behaviour of the function for* every channel mode is specified as follows:* WNCAN_CHN_INVALID: not allowed. ERROR is returned.* WNCAN_CHN_INACTIVE: not allowed. ERROR is returned.* WNCAN_CHN_RECEIVE: CAN messages with this Id will be received.* WNCAN_CHN_TRANSMIT: CAN meesage with the specified ID will be transmitted* when CAN_Tx is called* WNCAN_CHN_RTR_REQUESTER: CAN message with this id and RTR bit set will* be transmitted when CAN_TX is called* WNCAN_CHN_RTR_RESPONDER: CAN message with this id will be automatically* transmitted when a matching RTR request is received. CAN_WriteData should* be called to set up data for response.*** RETURNS:        OK, or ERROR** ERRNO:          S_can_illegal_channel_no,*                 S_can_illegal_config**/      static STATUS TouCAN_WriteID( struct WNCAN_Device *pDev, UCHAR channelNum, ULONG canId, BOOL ext ){        struct canAccess *pcanAccess;    TouCANBuf         pTouCanBufs;    volatile TouCAN_StandardMsgType *buffer;    ULONG             Longsrr=0;        ULONG             temp,id;         volatile USHORT   len=0;    USHORT            setRtr=0;       USHORT            ctrlReg;    STATUS            retCode = ERROR; /* pessimistic */        /*    * Get pointer to TouCAN registers and channels.        */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;    pTouCanBufs = (TouCANBuf)pcanAccess->pTouCanBufs;        buffer = &pTouCanBufs->can_MSG[channelNum];                  /*    * Check if channel number is within range    * or if it is marked invalid    */        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;    }        /*Save and later restore data length, in case previously set*/    len = buffer->Control & 0x000f;              /*store code in buffer control register*/    ctrlReg = buffer->Control & 0x00f0;              switch(pDev->pCtrl->chnMode[channelNum]) {    case WNCAN_CHN_RTR_REQUESTER:        /*If channel is marked as a remote requester, set RTR bit*/        setRtr = 0x0001;              case WNCAN_CHN_TRANSMIT:        if(ext)            Longsrr = (ULONG)0x00100000;                        default:        /*mark channel as inactive while id is set up*/        buffer->Control = TOUCAN_INACTIVE_BUFFER;    }        /*Write identifier*/    if (ext == TRUE)    {        /* extended format*/        /* Make bit 28 MSB*/        temp = canId << 3;                id = (temp & TOUCAN_M28TO18)| Longsrr | 0x00080000;        id |= ((temp & TOUCAN_M17TO0) >> 2);                      buffer->Id2_OR_TimeStamp = ((USHORT)id) | setRtr;        buffer->Id = (USHORT)(id>>16);    }    else    {        /* standard format */        /* Prepare second word of message structure */        id = (canId << 5) | (setRtr << 4);                /* Write second word containing Id, IDE, SRR */        buffer->Id = (USHORT)id;        buffer->Id2_OR_TimeStamp = 0;   /* time-stamp, ignored */    }        /* Mark channel as valid */    if(pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_RECEIVE)    {        /*Mark channel ready for reception*/        buffer->Control = TOUCAN_BUFFER_READY_TO_RX;    }    else    {        /*         * Restore original code in control register, if channel is          * RTR responder, in case data has been previously set         */        buffer->Control = ctrlReg | len;    }    retCode = OK;          exit:    return retCode;}/******************************************************************************** TouCAN_WriteData - writes "len" bytes of data to the channel** This function writes "len" bytes of data to the channel. An error is returned* if the number of bytes to be written exceed 8. The mode of the channel must be* WNCAN_CHN_TRANSMIT, or WNCAN_CHN_RTR_RESPONDER** RETURNS:        ERROR if an input parameter is invalid, OK otherwise.*   * ERRNO:          S_can_illegal_channel_no,*                 S_can_illegal_config,*                 S_can_illegal_data_length**/static STATUS TouCAN_WriteData( struct WNCAN_Device *pDev, UCHAR channelNum, UCHAR *data, UCHAR len ){    struct canAccess *pcanAccess;       TouCANBuf         pTouCanBufs;    volatile TouCAN_StandardMsgType *buffer;        STATUS            retCode = ERROR; /* pessimistic */        USHORT            temp = 0;     UCHAR             i;            if (channelNum >= TOUCAN_MAX_MSG_OBJ)    {        errnoSet(S_can_illegal_channel_no);        goto exit;    }        if((pDev->pCtrl->chnMode[channelNum] != WNCAN_CHN_TRANSMIT) &&        (pDev->pCtrl->chnMode[channelNum] != WNCAN_CHN_RTR_RESPONDER))     {        errnoSet(S_can_illegal_config);                goto exit;    }        /*    * Get pointer to TouCAN registers and channels.        */    pcanAccess = (struct canAccess *)pDev->pCtrl->csData;           pTouCanBufs = (TouCANBuf)pcanAccess->pTouCanBufs;                   buffer = &pTouCanBufs->can_MSG[channelNum];        /* Lock buffer*/         temp = buffer->Control & 0xfff0;    buffer->Control = TOUCAN_TX_NOT_READY;           if(len > 8)    {        errnoSet(S_can_illegal_data_length);        goto exit;    }        /*Write message length*/    temp |= (USHORT)len ;         for(i = 0 ; i < len; i++)        buffer->Data[i] = data[i];        buffer->Control = temp | len;        retCode = OK;            exit:       return retCode;}/************************************************************************** TouCAN_TxMsg - transmits a CAN message** This function performs the same function as the following series* of function calls:** 1. TouCAN_WriteID(context,channelNum,canID,ext);* 2. TouCAN_WriteData(context,channelNum,data,len);* 3. TouCAN_Tx(context,channel);** The mode of the channel must be WNCAN_CHN_TRANSMIT or WNCAN_CHN_RTR_REQUESTER* If the length specified exceeds 8 byes an error will be returned.** RETURNS:        ERROR if an input parameter is invalid, OK otherwise.*   * ERRNO:          S_can_illegal_channel_no,*                 S_can_illegal_config*                 S_can_illegal_data_length,*                 S_can_busy**/static STATUS TouCAN_TxMsg( struct WNCAN_Device *pDev, UCHAR channelNum, ULONG canId, BOOL ext, UCHAR *data, UCHAR len ){    struct canAccess *pcanAccess;    TouCAN            pTouCanRegs;    TouCANBuf         pTouCanBufs;    volatile TouCAN_StandardMsgType *buffer;    ULONG             temp;    UINT              i;    ULONG             id;    USHORT            setRtr=0;       STATUS            retCode = ERROR; /* pessimistic */        if (channelNum >= TOUCAN_MAX_MSG_OBJ)    {        errnoSet(S_can_illegal_channel_no);        goto exit;    }        if((pDev->pCtrl->chnMode[channelNum] != WNCAN_CHN_TRANSMIT) &&        (pDev->pCtrl->chnMode[channelNum] != WNCAN_CHN_RTR_REQUESTER))        {        errnoSet(S_can_illegal_config);                goto exit;    }        if(len > 8)    {        errnoSet(S_can_illegal_data_length);        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];                 /*    * Check if tx request is set before transmitting     * only a write access will deactivate a transmit     * buffer, so this is safe    */       if((buffer->Control & 0x00c0) == 0x00c0)    {        errnoSet(S_can_busy);                    goto exit;    }        /*Lock channel*/    buffer->Control = TOUCAN_TX_NOT_READY;                    if(pDev->pCtrl->chnMode[channelNum] == WNCAN_CHN_RTR_REQUESTER)        setRtr = 0x0001;    else    {        /* write data */        for(i = 0 ; i < len ; i++)        {            buffer->Data[i] = data[i];        }    }        /*Write identifier*/    if (ext)    {        /*Write extended identifier to channel*/        /* Make bit 28 MSB*/        temp = canId << 3;                id = (temp & TOUCAN_M28TO18)| 0x00100000 | 0x00080000;        id |= ((temp & TOUCAN_M17TO0) >> 2);                buffer->Id2_OR_TimeStamp = ((USHORT)id) | setRtr;             buffer->Id = (USHORT)(id>>16);                          }    else    {        /*Write standard identifier to channel*/        id = (canId << 5) | (setRtr << 4);                buffer->Id = (USHORT)id;        buffer->Id2_OR_TimeStamp = 0;   /* time-stamp, ignored */    }        /*    * Request a transmission and write length if channel is marked    * as a transmit or remote requester channel    */                    buffer->Control = (TOUCAN_TX | len);                        retCode = OK;                exit:    return retCode;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99天天综合性| 日韩免费高清电影| 精品1区2区在线观看| 国产精品视频九色porn| 一区二区三区精品在线| 韩国女主播成人在线观看| 91老司机福利 在线| 日韩欧美国产一区二区在线播放 | 欧美日韩卡一卡二| 国产精品国产三级国产普通话蜜臀 | 国产精品视频一区二区三区不卡| 亚洲一区欧美一区| 不卡的av网站| 国产农村妇女毛片精品久久麻豆| 久久精品国产99国产精品| 欧美亚洲尤物久久| 亚洲天堂av老司机| av午夜一区麻豆| 国产视频一区二区在线| 另类小说综合欧美亚洲| 91精品婷婷国产综合久久性色| 亚洲色图欧洲色图婷婷| 成年人午夜久久久| 久久男人中文字幕资源站| 蜜乳av一区二区| 欧美一区二区啪啪| 免费观看日韩av| 欧美一级理论片| 免费久久精品视频| 91精品国产麻豆| 丝袜亚洲另类欧美综合| 欧美影院一区二区三区| 一区二区激情视频| 在线视频国内自拍亚洲视频| 亚洲精品老司机| 欧美亚洲一区三区| 午夜激情综合网| 日韩色在线观看| 黄色成人免费在线| 国产亚洲午夜高清国产拍精品| 国产成人高清在线| 国产精品视频一区二区三区不卡| 99久久婷婷国产| 一区二区三区美女视频| 精品国产露脸精彩对白| 久久成人久久爱| 欧美高清在线精品一区| 99久久精品免费| 亚洲一区二区免费视频| 91精品国产91久久综合桃花| 蜜桃精品视频在线| 久久精品人人做人人爽97| av午夜一区麻豆| 亚洲一区二区欧美激情| 精品三级在线观看| av电影一区二区| 亚洲丶国产丶欧美一区二区三区| 欧美福利视频导航| 国产精品亚洲成人| 国产精品久久免费看| 欧美无砖砖区免费| 久久99热国产| 亚洲欧美在线aaa| 在线不卡免费欧美| 国产成人在线色| 亚洲综合偷拍欧美一区色| 欧美一区二区观看视频| 成人丝袜高跟foot| 婷婷六月综合网| 欧美激情一二三区| 欧美猛男gaygay网站| 国产精选一区二区三区| 综合久久一区二区三区| 日韩一区二区三区免费看| 成人免费看的视频| 奇米综合一区二区三区精品视频| 国产精品久久精品日日| 欧美日韩mp4| 97精品国产97久久久久久久久久久久| 视频一区视频二区中文| 中文字幕精品在线不卡| 欧美日韩国产乱码电影| www.亚洲免费av| 麻豆91免费看| 亚洲成人免费视频| 国产精品电影一区二区| 精品国产91久久久久久久妲己| 色哟哟在线观看一区二区三区| 另类小说视频一区二区| 亚洲妇女屁股眼交7| 亚洲欧美综合在线精品| 久久精品日产第一区二区三区高清版| 欧美日韩国产三级| 91久久香蕉国产日韩欧美9色| 国产一区在线看| 日韩精品乱码av一区二区| 亚洲天堂免费看| 国产精品对白交换视频| 国产欧美一区二区三区网站| 日韩精品一区二区三区在线| 久久久久久久av麻豆果冻| 欧美日韩一级黄| 99精品热视频| 成人免费高清在线| 国产成人av在线影院| 麻豆视频观看网址久久| 亚洲成a人v欧美综合天堂| 亚洲色图在线看| 中文在线一区二区| 国产欧美一区二区三区鸳鸯浴| 欧美tk丨vk视频| 精品成人一区二区| 欧美成人精品1314www| 欧美一区二区在线免费观看| 欧美久久久久久久久| 欧美精品tushy高清| 7777精品伊人久久久大香线蕉| 欧美亚一区二区| 欧美视频在线播放| 欧美久久免费观看| 在线播放日韩导航| 欧美成人精品1314www| 精品久久久久一区二区国产| 欧美电视剧在线观看完整版| 久久伊99综合婷婷久久伊| 久久美女高清视频| 欧美激情一区二区三区不卡 | 欧美一区二区三区的| 5566中文字幕一区二区电影 | 欧美喷潮久久久xxxxx| 91.com在线观看| 亚洲人123区| 亚洲激情成人在线| 午夜欧美在线一二页| 久久精品99国产精品日本| 国模套图日韩精品一区二区| 床上的激情91.| 色婷婷av一区| 日韩视频一区二区| 国产日产精品一区| 1000部国产精品成人观看| 亚洲福利视频一区二区| 精品在线观看免费| 91在线一区二区三区| 欧美系列亚洲系列| 精品国产一区二区国模嫣然| 国产精品天干天干在线综合| 亚洲自拍欧美精品| 国内精品视频666| 色综合久久久久综合体| 日韩三区在线观看| 国产精品视频一二三区| 亚洲bdsm女犯bdsm网站| 国产精品影视在线观看| 欧美亚洲国产一区二区三区| 精品欧美一区二区在线观看| 中文一区二区完整视频在线观看 | 老司机精品视频在线| 国产不卡在线一区| 欧美怡红院视频| 国产人成亚洲第一网站在线播放| 亚洲综合男人的天堂| 国产夫妻精品视频| 欧美顶级少妇做爰| 中文字幕一区二区三区在线播放| 午夜视频在线观看一区二区| 国产精品亚洲第一| 日韩色视频在线观看| 亚洲国产成人porn| 不卡一区二区中文字幕| 日韩精品一区二区三区视频播放| 一区在线观看视频| 国产一区二区导航在线播放| 欧美午夜精品久久久久久超碰| 中文字幕av一区二区三区高| eeuss鲁片一区二区三区在线观看| 91精品国产综合久久福利| 亚洲人成网站在线| 丁香婷婷综合激情五月色| 欧美日韩二区三区| 亚洲综合一区二区精品导航| 成人免费看片app下载| 久久久亚洲午夜电影| 奇米色一区二区| 欧美日韩综合一区| 亚洲精品国产第一综合99久久| 成人爱爱电影网址| 久久久久综合网| 国产乱子伦一区二区三区国色天香| 欧美一区二区视频免费观看| 亚洲最新视频在线播放| 91在线视频播放地址| 欧美激情一区二区三区蜜桃视频| 久久精品国内一区二区三区| 欧美精品乱人伦久久久久久| 亚洲v精品v日韩v欧美v专区 | 亚洲一二三级电影| 色一情一乱一乱一91av| 亚洲日本一区二区| 色就色 综合激情|