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

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

?? can.c

?? iar 安裝使用的方法。其中包括一些工程模板
?? C
?? 第 1 頁 / 共 5 頁
字號:
//! - \b CAN_STS_TXREQUEST - if a message object's TxRequest bit is set, that
//! means that a transmission is pending on that object.  The application can
//! use this to determine which objects are still waiting to send a message.
//! - \b CAN_STS_NEWDAT - if a message object's NewDat bit is set, that means
//! that a new message has been received in that object, and has not yet been
//! picked up by the host application
//! - \b CAN_STS_MSGVAL - if a message object's MsgVal bit is set, that means
//! it has a valid configuration programmed.  The host application can use this
//! to determine which message objects are empty/unused.
//!
//! \return Returns the value of the status register.
//
//*****************************************************************************
unsigned long
CANStatusGet(unsigned long ulBase, tCANStsReg eStatusReg)
{
    unsigned long ulStatus;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));

    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((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));

    //
    // 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.
//!
//! To send a data frame or remote frame directly, take the following steps:
//!
//! -# Set \e tMsgObjType to \b MSG_OBJ_TYPE_TX.
//! -# Set \e ulMsgID to the message ID.
//! -# Set \e ulFlags Set \b MSG_OBJ_TX_INT_ENABLE to to get an interrupt when
//! the message is sent.  To disable filtering based on message identifiers, do
//! not set \b MSG_OBJ_USE_ID_FILTER.
//! -# Set \e ulMsgLen to the number of bytes in the data frame.
//! -# Set \e pucMsgData to point to an array containing the bytes in the
//! message (if a data frame, this is not applicable; if a remote frame, it is
//! a good idea to set this to point to a valid buffer).
//! -# Call this function with \e ulObjID set to one of the 32 object buffers.
//!
//! To receive a specific data frame, take the following steps:
//!
//! -# Set \e tMsgObjType to \b MSG_OBJ_TYPE_RX.
//! -# Set \e ulMsgID to the full message ID, or a partial mask to use partial
//! ID matching.
//! -# Set \e ulMsgIDMask bits that should be used for masking during
//! comparison.
//! -# Set \e 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 ulMsgLen to the number of bytes in the expected data frame.
//! -# The buffer pointed to by \e pucMsgData is not used for this 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((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
    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);
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
风间由美一区二区三区在线观看 | 精品美女被调教视频大全网站| 91啪九色porn原创视频在线观看| 国产69精品久久久久777| 久久成人av少妇免费| 免费精品视频最新在线| 免费成人av资源网| 美女在线视频一区| 美女网站视频久久| 韩国成人精品a∨在线观看| 美女任你摸久久| 黑人巨大精品欧美一区| 精品一区二区精品| 国产高清不卡一区二区| 国产不卡在线视频| 99久久精品国产精品久久| 波多野结衣亚洲一区| 色婷婷av一区二区三区软件| 欧美性色欧美a在线播放| 欧美系列一区二区| 91精品国产综合久久国产大片| 日韩欧美一级二级三级久久久| 欧美va日韩va| 欧美激情一区二区三区全黄| 综合欧美一区二区三区| 一区二区三国产精华液| 午夜精品aaa| 韩国精品主播一区二区在线观看 | 99久久久免费精品国产一区二区| 成人小视频在线| 色婷婷av一区| 日韩一区二区在线观看视频| 国产日韩欧美精品综合| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲福利视频一区| 久久99精品久久久久婷婷| 成人性生交大合| 精品视频免费在线| 精品国产伦一区二区三区免费| 国产精品毛片高清在线完整版| 亚洲影院免费观看| 美女视频黄免费的久久 | 欧美久久高跟鞋激| 久久一夜天堂av一区二区三区| 国产精品国产三级国产aⅴ无密码| 亚洲视频狠狠干| 日本亚洲欧美天堂免费| 国产馆精品极品| 欧美色图在线观看| 久久婷婷国产综合精品青草| 亚洲人成精品久久久久| 日本欧美一区二区三区| 成人免费av资源| 欧美精品在线观看一区二区| 国产婷婷色一区二区三区| 一区二区三区日本| 韩国精品主播一区二区在线观看| 色94色欧美sute亚洲线路一ni| 日韩欧美亚洲国产另类| 日韩毛片精品高清免费| 老司机午夜精品| 91久久精品国产91性色tv| 久久综合狠狠综合久久激情| 亚洲国产一区二区三区青草影视| 国产成人综合在线| 制服丝袜在线91| 亚洲精品福利视频网站| 国产一区在线观看视频| 欧美日韩一级片在线观看| 国产视频一区二区在线| 日韩不卡一区二区三区| 91高清视频在线| 久久精品一区二区三区av| 人人精品人人爱| 91极品视觉盛宴| 国产精品乱码一区二区三区软件 | 国内精品久久久久影院一蜜桃| 在线视频综合导航| 国产精品理伦片| 国产一区二区三区视频在线播放| 欧美日韩在线综合| 国产精品成人一区二区三区夜夜夜 | 亚洲欧美日韩中文播放| 国产精品夜夜嗨| 日韩欧美国产小视频| 婷婷国产v国产偷v亚洲高清| 色婷婷亚洲精品| 亚洲色图欧美激情| 大桥未久av一区二区三区中文| 精品sm在线观看| 久久电影网站中文字幕| 欧美精品v日韩精品v韩国精品v| 综合网在线视频| www.99精品| 国产精品黄色在线观看| 国产成人在线观看| 久久理论电影网| 国产自产高清不卡| 欧美不卡123| 精品一二三四区| 欧美mv和日韩mv的网站| 蜜芽一区二区三区| 91精品国产aⅴ一区二区| 亚洲www啪成人一区二区麻豆| 欧洲一区二区av| 亚洲成人激情社区| 欧美日韩视频一区二区| 午夜精品久久久| 6080亚洲精品一区二区| 日本aⅴ亚洲精品中文乱码| 欧美一区二区三区在线电影 | 色噜噜狠狠色综合中国| 亚洲欧美成aⅴ人在线观看| 色94色欧美sute亚洲线路一ni| 亚洲靠逼com| 欧美性生活一区| 日日夜夜精品免费视频| 日韩欧美不卡在线观看视频| 精品在线播放午夜| 国产日韩欧美一区二区三区乱码| 国产aⅴ综合色| 国产精品乱人伦中文| 日本乱人伦一区| 石原莉奈一区二区三区在线观看| 欧美一区二区三区人| 韩国成人在线视频| 国产精品久久久久久久久免费桃花| 91丨porny丨户外露出| 伊人色综合久久天天人手人婷| 欧美日韩一区二区三区在线看| 日韩国产精品久久| 2020国产精品久久精品美国| 成人免费不卡视频| 亚洲综合在线五月| 日韩欧美三级在线| 成人av在线资源| 亚洲h在线观看| www精品美女久久久tv| 成人va在线观看| 午夜久久久久久电影| 精品成人一区二区| 色妹子一区二区| 美女视频网站久久| 成人欧美一区二区三区1314| 欧美在线观看视频一区二区| 奇米888四色在线精品| 国产精品乱码人人做人人爱| 欧美猛男gaygay网站| 国产精品综合二区| 亚洲高清视频的网址| 精品成人免费观看| 91高清视频在线| 国产一区二区三区免费在线观看| 亚洲久本草在线中文字幕| 日韩一本二本av| 成人免费高清在线观看| 午夜视频一区二区| 欧美国产日韩在线观看| 欧美日韩精品一区二区三区| 国产成人综合亚洲91猫咪| 五月天精品一区二区三区| 国产精品福利av| 日韩亚洲欧美在线| 99精品视频一区| 国产一区 二区 三区一级| 亚洲图片欧美一区| 欧美国产综合一区二区| 777精品伊人久久久久大香线蕉| 暴力调教一区二区三区| 激情六月婷婷久久| 夜夜嗨av一区二区三区网页| 中文字幕免费不卡在线| 日韩欧美精品在线视频| 91国偷自产一区二区使用方法| 国产精品亚洲成人| 日韩av一区二区三区| 亚洲综合成人在线| 国产精品久久三| 国产欧美一区视频| 日韩欧美三级在线| 欧美放荡的少妇| 91传媒视频在线播放| av在线不卡电影| 顶级嫩模精品视频在线看| 免费成人小视频| 日韩av一区二区三区| 亚洲超碰精品一区二区| 亚洲精品视频免费看| 国产精品免费aⅴ片在线观看| 久久夜色精品一区| 日韩一级二级三级精品视频| 欧美性一二三区| 欧美综合一区二区三区| 色综合天天做天天爱| 成年人国产精品| 成人在线视频一区| 国产99久久久国产精品潘金网站| 国产一区二区91| 国产美女在线精品| 国内精品视频666|