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

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

?? toucan.c

?? 風(fēng)河編寫的摩托羅拉toucan模塊的驅(qū)動代碼
?? 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一区二区三区免费野_久草精品视频
欧美久久久久久久久| 成人免费看黄yyy456| 国产精品一级黄| www.av亚洲| 欧美狂野另类xxxxoooo| 久久婷婷综合激情| 亚洲精品免费电影| 精品一区精品二区高清| 99精品视频在线播放观看| 欧美日韩二区三区| 久久久精品欧美丰满| 亚洲一区二区中文在线| 韩国精品主播一区二区在线观看| 成人国产精品免费观看动漫| 欧美日韩精品综合在线| 国产亚洲福利社区一区| 午夜日韩在线电影| 成人午夜免费av| 欧美喷潮久久久xxxxx| 国产精品免费aⅴ片在线观看| 亚洲一区免费观看| 风间由美中文字幕在线看视频国产欧美| 色婷婷综合久久久久中文 | 亚洲美女偷拍久久| 久久国产精品区| 欧美主播一区二区三区美女| 久久综合五月天婷婷伊人| 亚洲制服丝袜av| 波多野洁衣一区| 日韩精品专区在线影院重磅| 亚洲精品videosex极品| 国产精品一二二区| 91精品一区二区三区久久久久久| 中文字幕一区二区不卡| 精品影院一区二区久久久| 欧美日韩免费在线视频| 中文字幕一区二区三区乱码在线| 精品一区二区三区在线播放视频| 91福利社在线观看| 国产精品久久久久7777按摩| 国模少妇一区二区三区| 91精品中文字幕一区二区三区| 亚洲欧美日韩综合aⅴ视频| 国产精品亚洲а∨天堂免在线| 欧美精品xxxxbbbb| 一区二区三区产品免费精品久久75| 国产精品亚洲第一区在线暖暖韩国 | 日韩欧美电影一区| 天天色综合成人网| 欧美午夜视频网站| 一区二区三区中文字幕精品精品 | 夜夜夜精品看看| 成人av电影在线观看| 久久久久一区二区三区四区| 老鸭窝一区二区久久精品| 欧美日本高清视频在线观看| 亚洲午夜三级在线| 欧美色老头old∨ideo| 亚洲精品久久久蜜桃| 波多野结衣中文一区| 国产精品伦理一区二区| 风流少妇一区二区| 欧美高清在线一区| 国产伦精一区二区三区| 欧美电视剧在线看免费| 91麻豆视频网站| 日本欧美一区二区| 国产精品久久久久一区二区三区 | 91超碰这里只有精品国产| 国产精品久久久久一区二区三区共| 国产成+人+日韩+欧美+亚洲| 久久久久97国产精华液好用吗| 国产综合色视频| 久久毛片高清国产| 国产 日韩 欧美大片| 国产精品色呦呦| www.亚洲在线| 一区二区三区色| 欧美视频一区二区在线观看| 亚洲成人免费电影| 7777精品伊人久久久大香线蕉的 | 日韩欧美国产综合| 韩国精品在线观看| 日本一区二区视频在线| 成人午夜在线播放| 亚洲免费观看高清完整版在线观看 | 欧美成人一区二区三区片免费 | 欧美国产精品专区| www.欧美日韩国产在线| 亚洲精品高清在线| 欧美男生操女生| 国产综合色在线| 国产精品国产三级国产普通话99| 91麻豆国产福利精品| 亚洲国产欧美日韩另类综合 | 黑人精品欧美一区二区蜜桃| 久久久久久久久蜜桃| 99久久伊人精品| 亚洲福利视频导航| 精品国产制服丝袜高跟| 成人激情av网| 日韩精品欧美精品| 精品亚洲porn| 99综合影院在线| 99久久精品国产导航| 欧美综合色免费| 国产另类ts人妖一区二区| 国产色爱av资源综合区| 99久久久久久99| 免费av网站大全久久| 欧美国产97人人爽人人喊| 欧美影院精品一区| 韩国女主播一区| 一区二区三区资源| 欧美成人精精品一区二区频| jlzzjlzz欧美大全| 日韩高清欧美激情| 国产人久久人人人人爽| 欧美优质美女网站| 国产精品伊人色| 亚洲成人综合在线| 亚洲国产精品高清| 欧美日韩国产一级| 成人免费视频视频在线观看免费| 亚洲高清不卡在线观看| 国产欧美日韩不卡免费| 欧美精品视频www在线观看| 国产黄色成人av| 亚洲福利国产精品| 中文文精品字幕一区二区| 欧美一区二区三级| 91一区二区三区在线播放| 韩国欧美国产1区| 性做久久久久久免费观看欧美| 国产欧美精品一区| 日韩美女在线视频| 欧美在线你懂得| 国产suv精品一区二区三区 | 色婷婷久久久久swag精品| 久久成人18免费观看| 一区二区三区欧美| 久久久国产综合精品女国产盗摄| 欧美日韩在线亚洲一区蜜芽| 成人动漫一区二区在线| 麻豆精品视频在线观看| 亚洲大片免费看| 亚洲精品综合在线| 国产精品国产三级国产普通话99 | 成人午夜私人影院| 精品一区二区三区视频在线观看 | 欧美精品免费视频| 色哟哟国产精品| 成人一区二区三区视频在线观看| 日本成人在线看| 亚洲国产一区二区三区青草影视| 中文字幕在线不卡国产视频| 久久精品一区二区三区不卡| 日韩一区二区三区av| 欧美日韩国产免费一区二区 | 日韩av中文在线观看| 亚洲一区精品在线| 亚洲激情成人在线| 中文字幕永久在线不卡| 国产亚洲综合在线| 精品国产一区二区在线观看| 日韩精品中午字幕| 欧美亚州韩日在线看免费版国语版| 婷婷中文字幕一区三区| 在线亚洲人成电影网站色www| 一区二区国产视频| 国产亚洲一区二区三区在线观看 | 日本少妇一区二区| 久久综合色播五月| 欧美电影免费观看高清完整版在| 99视频一区二区| 不卡视频一二三| 成人99免费视频| 懂色av中文字幕一区二区三区 | 久久九九99视频| 久久美女艺术照精彩视频福利播放| 欧美成人精品3d动漫h| 精品福利一区二区三区| 久久综合九色综合久久久精品综合| 日韩一区二区三区电影 | 成人动漫一区二区| 99久久国产综合精品女不卡| av电影在线观看完整版一区二区| 99re视频精品| 日本久久精品电影| 欧美网站一区二区| 韩国理伦片一区二区三区在线播放| 美国毛片一区二区三区| 日韩国产欧美在线播放| 国产精品全国免费观看高清| 制服丝袜一区二区三区| 91成人网在线| 欧美丝袜第三区| 国产精品网曝门| 成人午夜精品在线| 日韩高清在线不卡|