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

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

?? toucan.c

?? CAN例程 源碼 CAN例程 源碼
?? 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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
岛国av在线一区| 在线视频你懂得一区二区三区| 日韩一区中文字幕| 91精品国产综合久久精品app | 99视频一区二区| 亚洲成人激情自拍| 国产精品久久久久影院亚瑟| 欧美xxx久久| 欧美性大战久久| 国产高清无密码一区二区三区| 视频一区二区中文字幕| 中文字幕在线观看一区| 精品久久99ma| 欧美肥妇bbw| 欧美在线视频日韩| av一区二区三区黑人| 国产真实精品久久二三区| 亚洲激情自拍偷拍| 中文字幕中文字幕一区| 精品美女被调教视频大全网站| 欧美日韩国产a| 欧美怡红院视频| 色哟哟一区二区三区| 成人av免费在线| 国产成人亚洲综合a∨婷婷图片| 蜜臀av一区二区在线观看| 亚洲成人福利片| 亚洲在线视频一区| 一区二区三区国产精品| 亚洲视频在线观看三级| 国产精品无圣光一区二区| 久久精品综合网| 国产网站一区二区三区| 久久综合色播五月| 精品国产一区二区三区久久久蜜月 | 中文字幕乱码亚洲精品一区| 久久综合久久久久88| 日韩精品一区二区在线观看| 在线电影欧美成精品| 欧美日韩一区二区在线观看 | 一区二区三区中文字幕精品精品| 国产精品免费视频网站| 国产精品色哟哟网站| 国产精品麻豆视频| 亚洲色图第一区| 亚洲欧美色综合| 一区二区三区欧美| 丝袜脚交一区二区| 乱一区二区av| 国产精品一区二区久激情瑜伽| 国产成人午夜精品5599| 粉嫩在线一区二区三区视频| 成人伦理片在线| 色播五月激情综合网| 欧美色综合网站| 91精品国产综合久久小美女| 精品va天堂亚洲国产| 欧美国产亚洲另类动漫| 亚洲免费观看高清| 性欧美疯狂xxxxbbbb| 捆绑紧缚一区二区三区视频| 国产精品亚洲午夜一区二区三区| 国产精品亚洲视频| 91视频一区二区三区| 91久久精品一区二区二区| 欧美伦理影视网| 26uuu另类欧美| 国产精品久久久99| 午夜精品福利一区二区蜜股av| 日本欧洲一区二区| 国产成人精品免费在线| 欧美在线观看禁18| 精品欧美黑人一区二区三区| 日本一区二区三级电影在线观看 | 一区二区三区欧美日韩| 另类专区欧美蜜桃臀第一页| 丰满亚洲少妇av| 欧美日韩一级二级三级| 26uuu亚洲综合色| 亚洲日本丝袜连裤袜办公室| 午夜一区二区三区在线观看| 国产精一区二区三区| 色婷婷综合中文久久一本| 日韩一区二区三区四区| 国产精品久久久久久亚洲毛片 | 免费一级欧美片在线观看| 成人免费精品视频| 555www色欧美视频| 日韩一区中文字幕| 激情久久久久久久久久久久久久久久| 不卡高清视频专区| 欧美电影免费观看高清完整版在线观看 | 91捆绑美女网站| 日韩丝袜情趣美女图片| 亚洲欧美日韩国产手机在线| 久久精品久久综合| 在线观看亚洲精品视频| 国产视频一区不卡| 美女视频网站久久| 99久久精品免费看国产免费软件| 欧美一区二区不卡视频| 一区二区三区中文字幕在线观看| 国产福利一区二区| 日韩精品一区二区三区在线播放| 亚洲国产视频一区二区| 不卡一区中文字幕| 久久久精品一品道一区| 免费av网站大全久久| 欧美午夜精品免费| 亚洲欧洲综合另类| 成人综合在线观看| 精品国产sm最大网站| 天使萌一区二区三区免费观看| 色综合久久精品| 中文字幕第一区第二区| 国内精品国产成人| 日韩精品一区在线观看| 天天爽夜夜爽夜夜爽精品视频| 一本大道久久a久久精品综合| 中文字幕欧美激情| 国产91丝袜在线播放九色| 精品国产精品一区二区夜夜嗨| 性欧美疯狂xxxxbbbb| 91国偷自产一区二区三区观看| 国产精品久久久久aaaa樱花| 国产福利一区二区三区视频| 精品国产污网站| 国产真实乱对白精彩久久| 日韩美女一区二区三区四区| 日日骚欧美日韩| 在线成人av影院| 日韩经典中文字幕一区| 欧美另类高清zo欧美| 亚洲成人三级小说| 6080国产精品一区二区| 日韩中文欧美在线| 日韩视频在线一区二区| 精东粉嫩av免费一区二区三区| 91精品国产手机| 久久99精品国产麻豆不卡| 精品国产91亚洲一区二区三区婷婷| 欧美aa在线视频| 日韩欧美你懂的| 狠狠v欧美v日韩v亚洲ⅴ| 久久精品亚洲乱码伦伦中文 | 91碰在线视频| 一区二区三区免费观看| 欧美精品99久久久**| 日本网站在线观看一区二区三区 | 国产色产综合色产在线视频| 国产久卡久卡久卡久卡视频精品| 国产女人18毛片水真多成人如厕| 成人激情视频网站| 亚洲女女做受ⅹxx高潮| 欧美在线视频你懂得| 视频在线在亚洲| 精品嫩草影院久久| 成人高清视频在线观看| 亚洲综合视频在线| 在线观看91精品国产麻豆| 韩国av一区二区三区| 中文字幕亚洲欧美在线不卡| 一本到高清视频免费精品| 视频一区视频二区中文字幕| 精品久久久久久最新网址| 成人毛片在线观看| 亚洲成人福利片| 国产偷国产偷亚洲高清人白洁| 91日韩在线专区| 美女网站色91| 中文字幕佐山爱一区二区免费| 欧美日韩精品免费| 国产不卡一区视频| 亚洲综合无码一区二区| 欧美精品一区二区三区很污很色的| 99视频热这里只有精品免费| 婷婷久久综合九色国产成人| 国产亚洲欧美日韩俺去了| 在线观看免费视频综合| 国产乱人伦偷精品视频免下载| 亚洲蜜臀av乱码久久精品| 欧美一三区三区四区免费在线看| 国产成人精品aa毛片| 偷拍日韩校园综合在线| 欧美激情资源网| 欧美一级久久久| 91看片淫黄大片一级在线观看| 精品一区二区三区免费观看 | 日韩欧美国产综合| proumb性欧美在线观看| 日本亚洲最大的色成网站www| 国产精品第一页第二页第三页| 日韩欧美你懂的| 欧美视频精品在线| av一区二区三区四区| 狠狠色综合色综合网络| 婷婷成人激情在线网| 亚洲精品美国一| 亚洲国产电影在线观看| 精品久久久久久亚洲综合网|