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

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

?? can.c

?? lm3s下lwip的udp
?? C
?? 第 1 頁 / 共 5 頁
字號:
//*****************************************************************************
unsigned long
CANStatusGet(unsigned long ulBase, tCANStsReg eStatusReg)
{
    unsigned long ulStatus;

    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));

    switch(eStatusReg)
    {
        //
        // Just return the global CAN status register since that is what was
        // requested.
        //
        case CAN_STS_CONTROL:
        {
            ulStatus = CANRegRead(ulBase + CAN_O_STS);
            CANRegWrite(ulBase + CAN_O_STS,
                        ~(CAN_STS_RXOK | CAN_STS_TXOK | CAN_STS_LEC_M));
            break;
        }

        //
        // Combine the Transmit status bits into one 32bit value.
        //
        case CAN_STS_TXREQUEST:
        {
            ulStatus = CANRegRead(ulBase + CAN_O_TXRQ1);
            ulStatus |= CANRegRead(ulBase + CAN_O_TXRQ2) << 16;
            break;
        }

        //
        // Combine the New Data status bits into one 32bit value.
        //
        case CAN_STS_NEWDAT:
        {
            ulStatus = CANRegRead(ulBase + CAN_O_NWDA1);
            ulStatus |= CANRegRead(ulBase + CAN_O_NWDA2) << 16;
            break;
        }

        //
        // Combine the Message valid status bits into one 32bit value.
        //
        case CAN_STS_MSGVAL:
        {
            ulStatus = CANRegRead(ulBase + CAN_O_MSG1VAL);
            ulStatus |= CANRegRead(ulBase + CAN_O_MSG2VAL) << 16;
            break;
        }

        //
        // Unknown CAN status requested so return 0.
        //
        default:
        {
            ulStatus = 0;
            break;
        }
    }
    return(ulStatus);
}

//*****************************************************************************
//
//! Reads the CAN controller error counter register.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param pulRxCount is a pointer to storage for the receive error counter.
//! \param pulTxCount is a pointer to storage for the transmit error counter.
//!
//! Reads the error counter register and returns the transmit and receive error
//! counts to the caller along with a flag indicating if the controller receive
//! counter has reached the error passive limit.  The values of the receive and
//! transmit error counters are returned through the pointers provided as
//! parameters.
//!
//! After this call, \e *pulRxCount will hold the current receive error count
//! and \e *pulTxCount will hold the current transmit error count.
//!
//! \return Returns \b true if the receive error count has reached the error
//! passive limit, and \b false if the error count is below the error passive
//! limit.
//
//*****************************************************************************
tBoolean
CANErrCntrGet(unsigned long ulBase, unsigned long *pulRxCount,
              unsigned long *pulTxCount)
{
    unsigned long ulCANError;

    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));

    //
    // Read the current count of transmit/receive errors.
    //
    ulCANError = CANRegRead(ulBase + CAN_O_ERR);

    //
    // Extract the error numbers from the register value.
    //
    *pulRxCount = (ulCANError & CAN_ERR_REC_M) >> CAN_ERR_REC_S;
    *pulTxCount = (ulCANError & CAN_ERR_TEC_M) >> CAN_ERR_TEC_S;

    if(ulCANError & CAN_ERR_RP)
    {
        return(true);
    }
    return(false);
}

//*****************************************************************************
//
//! Configures a message object in the CAN controller.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param ulObjID is the object number to configure (1-32).
//! \param pMsgObject is a pointer to a structure containing message object
//! settings.
//! \param eMsgType indicates the type of message for this object.
//!
//! This function is used to configure any one of the 32 message objects in the
//! CAN controller.  A message object can be configured as any type of CAN
//! message object as well as several options for automatic transmission and
//! reception.  This call also allows the message object to be configured to
//! generate interrupts on completion of message receipt or transmission.  The
//! message object can also be configured with a filter/mask so that actions
//! are only taken when a message that meets certain parameters is seen on the
//! CAN bus.
//!
//! The \e eMsgType parameter must be one of the following values:
//!
//! - \b MSG_OBJ_TYPE_TX - CAN transmit message object.
//! - \b MSG_OBJ_TYPE_TX_REMOTE - CAN transmit remote request message object.
//! - \b MSG_OBJ_TYPE_RX - CAN receive message object.
//! - \b MSG_OBJ_TYPE_RX_REMOTE - CAN receive remote request message object.
//! - \b MSG_OBJ_TYPE_RXTX_REMOTE - CAN remote frame receive remote, then
//! transmit message object.
//!
//! The message object pointed to by \e pMsgObject must be populated by the
//! caller, as follows:
//!
//! - \e ulMsgID - contains the message ID, either 11 or 29 bits.
//! - \e ulMsgIDMask - mask of bits from \e ulMsgID that must match if
//! identifier filtering is enabled.
//! - \e ulFlags
//!   - Set \b MSG_OBJ_TX_INT_ENABLE flag to enable interrupt on transmission.
//!   - Set \b MSG_OBJ_RX_INT_ENABLE flag to enable interrupt on receipt.
//!   - Set \b MSG_OBJ_USE_ID_FILTER flag to enable filtering based on the
//!   identifier mask specified by \e ulMsgIDMask.
//! - \e ulMsgLen - the number of bytes in the message data.  This should be
//! non-zero even for a remote frame; it should match the expected bytes of the
//! data responding data frame.
//! - \e pucMsgData - points to a buffer containing up to 8 bytes of data for a
//! data frame.
//!
//! \b Example: To send a data frame or remote frame(in response to a remote
//! request), take the following steps:
//!
//! -# Set \e eMsgType to \b MSG_OBJ_TYPE_TX.
//! -# Set \e pMsgObject->ulMsgID to the message ID.
//! -# Set \e pMsgObject->ulFlags. Make sure to set \b MSG_OBJ_TX_INT_ENABLE to
//! allow an interrupt to be generated when the message is sent.
//! -# Set \e pMsgObject->ulMsgLen to the number of bytes in the data frame.
//! -# Set \e pMsgObject->pucMsgData to point to an array containing the bytes
//! to send in the message.
//! -# Call this function with \e ulObjID set to one of the 32 object buffers.
//!
//! \b Example: To receive a specific data frame, take the following steps:
//!
//! -# Set \e eMsgObjType to \b MSG_OBJ_TYPE_RX.
//! -# Set \e pMsgObject->ulMsgID to the full message ID, or a partial mask to
//! use partial ID matching.
//! -# Set \e pMsgObject->ulMsgIDMask bits that should be used for masking
//! during comparison.
//! -# Set \e pMsgObject->ulFlags as follows:
//!   - Set \b MSG_OBJ_TX_INT_ENABLE flag to be interrupted when the data frame
//!   is received.
//!   - Set \b MSG_OBJ_USE_ID_FILTER flag to enable identifier based filtering.
//! -# Set \e pMsgObject->ulMsgLen to the number of bytes in the expected data
//! frame.
//! -# The buffer pointed to by \e pMsgObject->pucMsgData  and
//! \e pMsgObject->ulMsgLen are not used by this call as no data is present at
//! the time of the call.
//! -# Call this function with \e ulObjID set to one of the 32 object buffers.
//!
//! If you specify a message object buffer that already contains a message
//! definition, it will be overwritten.
//!
//! \return None.
//
//*****************************************************************************
void
CANMessageSet(unsigned long ulBase, unsigned long ulObjID,
              tCANMsgObject *pMsgObject, tMsgObjType eMsgType)
{
    unsigned short usCmdMaskReg;
    unsigned short usMaskReg[2];
    unsigned short usArbReg[2];
    unsigned short usMsgCtrl;
    tBoolean bTransferData;
    tBoolean bUseExtendedID;

    bTransferData = 0;

    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));
    ASSERT((ulObjID <= 32) && (ulObjID != 0));
    ASSERT((eMsgType == MSG_OBJ_TYPE_TX) ||
           (eMsgType == MSG_OBJ_TYPE_TX_REMOTE) ||
           (eMsgType == MSG_OBJ_TYPE_RX) ||
           (eMsgType == MSG_OBJ_TYPE_RX_REMOTE) ||
           (eMsgType == MSG_OBJ_TYPE_TX_REMOTE) ||
           (eMsgType == MSG_OBJ_TYPE_RXTX_REMOTE));

    //
    // Wait for busy bit to clear
    //
    while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
    {
    }

    //
    // See if we need to use an extended identifier or not.
    //
    if((pMsgObject->ulMsgID > CAN_MAX_11BIT_MSG_ID) ||
       (pMsgObject->ulFlags & MSG_OBJ_EXTENDED_ID))
    {
        bUseExtendedID = 1;
    }
    else
    {
        bUseExtendedID = 0;
    }

    //
    // This is always a write to the Message object as this call is setting a
    // message object.  This call will also always set all size bits so it sets
    // both data bits.  The call will use the CONTROL register to set control
    // bits so this bit needs to be set as well.
    //
    usCmdMaskReg = (CAN_IF1CMSK_WRNRD | CAN_IF1CMSK_DATAA | CAN_IF1CMSK_DATAB |
                    CAN_IF1CMSK_CONTROL);

    //
    // Initialize the values to a known state before filling them in based on
    // the type of message object that is being configured.
    //
    usArbReg[0] = 0;
    usMsgCtrl = 0;
    usMaskReg[0] = 0;
    usMaskReg[1] = 0;

    switch(eMsgType)
    {
        //
        // Transmit message object.
        //
        case MSG_OBJ_TYPE_TX:
        {
            //
            // Set the TXRQST bit and the reset the rest of the register.
            //
            usMsgCtrl |= CAN_IF1MCTL_TXRQST;
            usArbReg[1] = CAN_IF1ARB2_DIR;
            bTransferData = 1;
            break;
        }

        //
        // Transmit remote request message object
        //
        case MSG_OBJ_TYPE_TX_REMOTE:
        {
            //
            // Set the TXRQST bit and the reset the rest of the register.
            //
            usMsgCtrl |= CAN_IF1MCTL_TXRQST;
            usArbReg[1] = 0;
            break;
        }

        //
        // Receive message object.
        //
        case MSG_OBJ_TYPE_RX:
        {
            //
            // This clears the DIR bit along with everthing else.  The TXRQST
            // bit was cleard by defaulting usMsgCtrl to 0.
            //
            usArbReg[1] = 0;
            break;
        }

        //
        // Receive remote request message object.
        //
        case MSG_OBJ_TYPE_RX_REMOTE:
        {
            //
            // The DIR bit is set to one for remote receivers.  The TXRQST bit
            // was cleard by defaulting usMsgCtrl to 0.
            //
            usArbReg[1] = CAN_IF1ARB2_DIR;

            //
            // Set this object so that it only indicates that a remote frame
            // was received and allow for software to handle it by sending back
            // a data frame.
            //
            usMsgCtrl = CAN_IF1MCTL_UMASK;

            //
            // Use the full Identifier by default.
            //
            usMaskReg[0] = 0xffff;
            usMaskReg[1] = 0x1fff;

            //
            // Make sure to send the mask to the message object.
            //
            usCmdMaskReg |= CAN_IF1CMSK_MASK;
            break;
        }

        //
        // Remote frame receive remote, with auto-transmit message object.
        //
        case MSG_OBJ_TYPE_RXTX_REMOTE:
        {
            //
            // Oddly the DIR bit is set to one for remote receivers.
            //
            usArbReg[1] = CAN_IF1ARB2_DIR;

            //
            // Set this object to auto answer if a matching identifier is seen.
            //
            usMsgCtrl = CAN_IF1MCTL_RMTEN | CAN_IF1MCTL_UMASK;

            //
            // The data to be returned needs to be filled in.
            //
            bTransferData = 1;
            break;
        }

        //
        // This case should never happen due to the ASSERT statement at the
        // beginning of this function.
        //
        default:
        {
            return;
        }
    }

    //
    // Configure the Mask Registers.
    //
    if(pMsgObject->ulFlags & MSG_OBJ_USE_ID_FILTER)
    {
        if(bUseExtendedID)
        {
            //
            // Set the 29 bits of Identifier mask that were requested.
            //
            usMaskReg[0] = pMsgObject->ulMsgIDMask & CAN_IF1MSK1_IDMSK_M;
            usMaskReg[1] = ((pMsgObject->ulMsgIDMask >> 16) &
                            CAN_IF1MSK2_IDMSK_M);
        }
        else
        {
            //
            // Lower 16 bit are unused so set them to zero.
            //
            usMaskReg[0] = 0;

            //
            // Put the 11 bit Mask Identifier into the upper bits of the field
            // in the register.
            //
            usMaskReg[1] = ((pMsgObject->ulMsgIDMask << 2) &
                            CAN_IF1MSK2_IDMSK_M);
        }
    }

    //
    // If the caller wants to filter on the extended ID bit then set it.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大片免费久久精品三p | 欧美艳星brazzers| 中文字幕在线观看一区| 一二三四社区欧美黄| 美国毛片一区二区| 激情文学综合插| 美女脱光内衣内裤视频久久网站 | 亚洲欧美一区二区三区孕妇| 日韩**一区毛片| 日韩精彩视频在线观看| 9久草视频在线视频精品| caoporen国产精品视频| 精品久久久久久久久久久院品网| 夜夜爽夜夜爽精品视频| 亚洲成人精品在线观看| 日韩精品乱码免费| 色综合久久久久| 欧美激情艳妇裸体舞| 韩国v欧美v日本v亚洲v| 91精品国模一区二区三区| 亚洲在线观看免费| 99r国产精品| 欧美猛男男办公室激情| 亚洲欧美日韩人成在线播放| 成人午夜在线视频| 欧美视频中文一区二区三区在线观看| 欧美日韩国产在线观看| 日韩欧美国产一区在线观看| 亚洲第一av色| 337p亚洲精品色噜噜狠狠| 五月天一区二区三区| 在线观看日韩高清av| 一区二区三区在线观看动漫| 91一区二区三区在线观看| 欧美日韩中文国产| 亚洲成a天堂v人片| 884aa四虎影成人精品一区| 午夜欧美电影在线观看| 国产激情视频一区二区三区欧美| 26uuu另类欧美亚洲曰本| 亚洲色图丝袜美腿| 色素色在线综合| 亚洲a一区二区| 成人精品视频一区二区三区尤物| 欧美日韩黄色一区二区| 日本成人中文字幕| 97久久精品人人爽人人爽蜜臀| 18成人在线视频| 欧美日韩日本视频| 国产精品网曝门| 美女高潮久久久| 亚洲国产高清不卡| 在线视频一区二区免费| 偷拍一区二区三区| 91麻豆高清视频| 亚洲大片免费看| 91麻豆福利精品推荐| 午夜激情久久久| 在线视频中文字幕一区二区| 欧美国产激情二区三区| 日本强好片久久久久久aaa| 精品sm在线观看| av日韩在线网站| 日韩一区二区免费电影| 亚洲麻豆国产自偷在线| 5月丁香婷婷综合| 国产成人免费视| 一卡二卡欧美日韩| 精品毛片乱码1区2区3区| 成人午夜精品一区二区三区| 日韩亚洲欧美综合| 五月婷婷另类国产| 欧美日韩一区二区不卡| 国产69精品一区二区亚洲孕妇 | 久久久国产精品不卡| 日本精品视频一区二区三区| 国内偷窥港台综合视频在线播放| 亚洲精品ww久久久久久p站| 波多野结衣的一区二区三区| 久久精品人人做人人爽人人| 在线观看视频一区| 成人福利视频在线看| 国产精品亲子乱子伦xxxx裸| 欧美日韩免费一区二区三区视频| 国产成人精品在线看| 欧美国产日韩一二三区| 欧美精品久久一区| 97国产一区二区| 国产乱码精品1区2区3区| 精品国产精品一区二区夜夜嗨| 一本一道综合狠狠老| 国产精品一区二区久久不卡| 午夜电影网亚洲视频| 一区二区视频免费在线观看| 91福利视频久久久久| 成人免费高清视频在线观看| 理论片日本一区| 国产色产综合色产在线视频| 99视频在线精品| 国产成人av一区二区三区在线观看| 久久久精品日韩欧美| 丰满亚洲少妇av| 久久99蜜桃精品| 中文字幕欧美日韩一区| 精品国产制服丝袜高跟| 成人午夜电影小说| 亚洲精品国产品国语在线app| 国产日韩欧美a| 久久久综合九色合综国产精品| 国产不卡在线一区| 一区二区三区四区视频精品免费 | 国产传媒欧美日韩成人| 精品一区二区三区av| 国产精品入口麻豆九色| 欧美三级视频在线观看| 国产在线精品一区二区夜色 | 久久久www免费人成精品| 日韩欧美一级片| 日韩欧美二区三区| 欧美一区二区视频网站| 91精品国产欧美日韩| 欧美日韩一区三区四区| 欧美男女性生活在线直播观看| 制服视频三区第一页精品| 国产成人免费av在线| 久久日韩精品一区二区五区| 欧美一区二区女人| 精品国产一区二区三区av性色 | 91精品国产91久久久久久一区二区| 久草精品在线观看| 在线视频中文字幕一区二区| 国产伦精品一区二区三区在线观看 | 欧美本精品男人aⅴ天堂| 欧美一级艳片视频免费观看| 激情综合网最新| 久久久久国产精品免费免费搜索 | 色欧美片视频在线观看| 色哟哟精品一区| 欧美日韩久久不卡| 成人福利视频网站| 91啪九色porn原创视频在线观看| 免费看欧美美女黄的网站| 韩国欧美国产1区| 亚洲永久免费视频| 青草av.久久免费一区| 国产精品久久久久aaaa樱花| 樱花影视一区二区| 免费成人美女在线观看.| 成人一区二区三区| 国产麻豆精品久久一二三| 国产成人精品网址| 久久66热re国产| 欧美体内she精高潮| 日韩精品一区二区三区四区视频| 日本道在线观看一区二区| 国产成人在线电影| 欧美在线|欧美| 久久综合色播五月| 亚洲视频中文字幕| 免费成人av资源网| 免费在线成人网| 免费欧美高清视频| 91首页免费视频| 精品国产一区a| 亚洲国产综合视频在线观看| 国产精品一区一区三区| 另类小说综合欧美亚洲| 99久久婷婷国产综合精品| 成人理论电影网| 99国产精品一区| 国产亚洲精品精华液| 国产欧美一区二区精品性| 亚洲h在线观看| 91美女在线观看| 国产精品丝袜一区| 成人免费在线播放视频| 一区二区三区在线影院| 国产一区二区久久| 91精品中文字幕一区二区三区| 综合中文字幕亚洲| 亚洲女同女同女同女同女同69| 国产盗摄精品一区二区三区在线| 日韩欧美美女一区二区三区| 亚洲午夜激情av| 色一情一伦一子一伦一区| 国产精品视频yy9299一区| 中文字幕人成不卡一区| 国产美女在线精品| 日韩欧美另类在线| 日韩国产欧美三级| 韩国女主播一区| 日韩视频免费观看高清完整版在线观看 | 欧美本精品男人aⅴ天堂| 肉色丝袜一区二区| 国内欧美视频一区二区| 福利一区二区在线| 国产清纯美女被跳蛋高潮一区二区久久w | 欧美国产日本视频| 成人丝袜高跟foot| 久久精品男人的天堂|