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

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

?? 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一区二区三区免费野_久草精品视频
色偷偷88欧美精品久久久| 亚洲欧美激情插 | 欧美中文字幕久久| 精品国产乱码久久久久久久| 日韩精品一区二区三区老鸭窝 | 亚洲美女在线一区| 亚洲影院理伦片| 久久99精品久久久久| 日韩精品91亚洲二区在线观看| 国产精品国产自产拍高清av| 91亚洲男人天堂| 日韩精品一区二区三区视频播放| 国产99久久久国产精品免费看| 一区二区久久久久| 91视频在线观看免费| 久久久久久久久一| 99久久精品免费精品国产| 日本人妖一区二区| 成人精品国产一区二区4080| 亚洲制服丝袜av| 国产麻豆视频精品| 另类调教123区| 成人免费黄色大片| 日韩三级电影网址| 欧美va亚洲va国产综合| 亚洲综合网站在线观看| 国产精品18久久久久| 欧美日韩亚洲另类| 日韩一卡二卡三卡国产欧美| 亚洲久草在线视频| 亚洲大尺度视频在线观看| 成人av免费观看| www久久精品| 男人的天堂亚洲一区| 欧美美女一区二区三区| 一区二区三区日韩欧美精品| 高清不卡在线观看| 国产女人水真多18毛片18精品视频 | eeuss国产一区二区三区| 欧美精品色综合| 亚洲综合激情小说| 欧美视频一区二区三区在线观看| 欧美人伦禁忌dvd放荡欲情| 亚洲品质自拍视频| 国产一区二区在线看| 久久精品夜色噜噜亚洲aⅴ| 国内成人精品2018免费看| 不卡视频一二三| 中文字幕不卡三区| 成人午夜av电影| 国产亚洲短视频| 丰满少妇在线播放bd日韩电影| 色天天综合久久久久综合片| 91精品国产综合久久久久久久久久| 久久久91精品国产一区二区三区| 中文字幕一区二区三区不卡在线| 午夜婷婷国产麻豆精品| 欧美久久高跟鞋激| 日韩成人精品在线观看| 欧美变态口味重另类| 国产精品一区二区91| 欧美极品少妇xxxxⅹ高跟鞋| 本田岬高潮一区二区三区| 成人免费小视频| 欧美亚洲自拍偷拍| 久久九九久久九九| 成人免费看视频| 久久蜜桃一区二区| 成人自拍视频在线观看| 一区二区在线观看av| 欧美色偷偷大香| 美国欧美日韩国产在线播放| 日本一区二区三区高清不卡| 五月天激情综合| 精品国产欧美一区二区| 成人免费看片app下载| 亚洲一区二区欧美| 99久久国产综合精品色伊| 五月天精品一区二区三区| 亚洲精品一区二区三区在线观看| 日韩在线一二三区| 久久久久久久久久久黄色| 国产mv日韩mv欧美| 无码av中文一区二区三区桃花岛| 国产精品一区二区在线观看不卡 | 91精品国产色综合久久不卡蜜臀 | 亚洲激情五月婷婷| 国产一区二区中文字幕| 亚洲人成精品久久久久久 | 777亚洲妇女| 高清不卡在线观看av| 天堂一区二区在线| 国产精品卡一卡二| av网站免费线看精品| 日韩电影在线观看电影| 欧美女孩性生活视频| 亚洲精品久久久蜜桃| 久久嫩草精品久久久精品一| 欧美日韩精品一区二区在线播放| 国产精品久久久久久福利一牛影视| 国产高清视频一区| 免费欧美在线视频| 亚洲精品亚洲人成人网在线播放| 99精品视频一区| 日韩国产精品久久久久久亚洲| 欧美一区二区三区婷婷月色| 蜜臀精品一区二区三区在线观看| 精品国产亚洲一区二区三区在线观看| 久久99国内精品| 午夜精品国产更新| 亚洲欧洲99久久| 国产欧美精品在线观看| av在线不卡观看免费观看| 久久99久久久欧美国产| 三级久久三级久久| 一区二区三区日韩精品视频| 欧美高清视频不卡网| zzijzzij亚洲日本少妇熟睡| 亚洲成人一区在线| 亚洲一区二区成人在线观看| 亚洲日本电影在线| 亚洲欧美在线aaa| 欧美高清在线精品一区| 精品1区2区在线观看| 精品国产一区二区三区不卡| 日韩你懂的在线播放| 欧美一区二区网站| 91精品久久久久久久99蜜桃| 色综合天天综合给合国产| 99久久久无码国产精品| www.久久精品| av激情综合网| 色综合中文综合网| 亚洲视频一区二区在线观看| 国产精品久久久久久久久快鸭| 91久久精品国产91性色tv| 麻豆国产欧美一区二区三区| 亚洲不卡av一区二区三区| 裸体一区二区三区| 成人性色生活片免费看爆迷你毛片| 人人狠狠综合久久亚洲| 国产一区二区中文字幕| 色综合久久中文综合久久牛| 成人激情综合网站| 在线观看成人小视频| 91高清在线观看| 欧美疯狂做受xxxx富婆| 欧美色视频在线| 精品国产一区二区三区不卡 | 欧美在线播放高清精品| 日韩视频123| 亚洲色图欧洲色图婷婷| 日韩av一级片| 91在线观看美女| 日韩欧美黄色影院| 亚洲人成网站色在线观看| 免费高清在线一区| 色综合网色综合| 久久久久久久久蜜桃| 国产视频一区在线观看| 亚洲午夜三级在线| 丁香网亚洲国际| 日韩一级免费观看| 亚洲尤物视频在线| caoporen国产精品视频| 久久综合给合久久狠狠狠97色69| 久久婷婷综合激情| 视频一区二区不卡| 91成人在线精品| 国产精品久久久久精k8 | 欧美亚洲一区二区三区四区| 国产拍欧美日韩视频二区| 亚洲成av人片一区二区三区| 99re热这里只有精品视频| 在线观看欧美日本| 国产欧美1区2区3区| 韩日av一区二区| 欧美一区二区啪啪| 亚洲图片有声小说| 一本大道av一区二区在线播放| 色老汉一区二区三区| 国产精品理伦片| 国产999精品久久久久久绿帽| 99麻豆久久久国产精品免费| 91在线精品秘密一区二区| 日本一区二区三区高清不卡| 国内久久精品视频| 日韩欧美国产系列| 美女脱光内衣内裤视频久久网站| 高清不卡在线观看av| 久久亚洲综合色| 韩国成人福利片在线播放| 日韩一区二区麻豆国产| 秋霞午夜鲁丝一区二区老狼| 国产福利一区在线| 国产拍欧美日韩视频二区| 国产盗摄女厕一区二区三区| 欧美伊人精品成人久久综合97 | 欧美午夜精品久久久久久超碰| 日韩欧美资源站|