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

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

?? can.c

?? ucos_ii/tcpip to lm3s6965
?? C
?? 第 1 頁 / 共 4 頁
字號:

//*****************************************************************************
//
//! Sets the CAN controller auto-retransmission behavior.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param bAutoRetry enables auto-retransmission
//!
//! Enables or disables automatic retransmission of messages with detected
//! errors.  If \e bAutoRetry is \b true, then auto-retransmission is enabled,
//! otherwise it is disabled.
//!
//! \return None.
//
//*****************************************************************************
void
CANRetrySet(unsigned long ulBase, tBoolean bAutoRetry)
{
    unsigned long ulCtlReg;

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

    ulCtlReg = CANReadReg(ulBase + CAN_O_CTL);

    //
    // Conditionally set the DAR bit to enable/disable auto-retry.
    //
    if(bAutoRetry)
    {
        //
        // Clearing the DAR bit tells the controller to not disable the
        // auto-retry of messages which were not transmited or received
        // correctly.
        //
        ulCtlReg &= ~CAN_CTL_DAR;
    }
    else
    {
        //
        // Setting the DAR bit tells the controller to disable the auto-retry
        // of messages which were not transmited or received correctly.
        //
        ulCtlReg |= CAN_CTL_DAR;
    }
    CANWriteReg(ulBase + CAN_O_CTL, ulCtlReg);
}

//*****************************************************************************
//
//! Gets the current setting for auto-retransmission.
//!
//! \param ulBase is the base address of the CAN controller.
//!
//! Reads the current setting of the auto-retransmission setting in the CAN
//! controller and returns it to the caller.
//!
//! \return \b true if automatic retransmission is enabled, false otherwise
//
//*****************************************************************************
tBoolean
CANRetryGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));

    if(CANReadReg(ulBase + CAN_O_CTL) & CAN_CTL_DAR)
    {
        return(0);
    }
    return(1);
}

//*****************************************************************************
//
//! Reads one of the controller status registers.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param eStatusReg is the status register to read
//!
//! Reads a status register of the CAN controller and returns it to the
//! caller.  The different status registers are:
//! - CAN_STS_CONTROL - the main controller status
//! - CAN_STS_TXREQUEST - bit mask of objects pending transmission
//! - CAN_STS_NEWDAT - bit mask of objects with new data
//! - CAN_STS_MSGVAL - bit mask of objects with valid configuration
//!
//! When reading the main controller status register, a pending status
//! interrupt will be cleared.  This should be used in the interrupt handler
//! for the CAN controller if the cause is a status interrupt.  The fields of
//! controller status register are as follows:
//! - CAN_STS_BOFF - controller is in bus-off condition
//! - CAN_STS_EWARN - an error counter has reached a limit of at least 96
//! - CAN_STS_EPASS - CAN controller is in the error passive state
//! - CAN_STS_RXOK - a message was received successfully (independent of
//!                  any message filtering.
//! - CAN_STS_TXOK - a message was successfully transmitted
//! - CAN_STS_LEC_MSK - mask of last error code bits (3 bits)
//! - CAN_STS_LEC_NONE - no error
//! - CAN_STS_LEC_STUFF - stuffing error detected
//! - CAN_STS_LEC_FORM - a format error in the fixed format part of a message
//! - CAN_STS_LEC_ACK - a transmitted message was not acknowledged
//! - CAN_STS_LEC_BIT1 - dominant level detected when trying to send recessive
//! - CAN_STS_LEC_BIT0 - recessive level detected when trying to send dominant
//! - CAN_STS_LEC_CRC - CRC error in received message
//!
//! The remaining status registers are 32-bit bit maps to the message
//! objects.  They can be used to quickly obtain information about the status
//! of all the message object without needing to query each one.  They contain
//! the following information:
//! - 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.
//! - 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
//! - 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 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 = CANReadReg(ulBase + CAN_O_STS);
            CANWriteReg(ulBase + CAN_O_STS,
                ~(CAN_STS_RXOK | CAN_STS_TXOK | CAN_STS_LEC_MSK));
            break;
        }
        //
        // Combine the Transmit status bits into one 32bit value.
        //
        case CAN_STS_TXREQUEST:
        {
            ulStatus = CANReadReg(ulBase + CAN_O_TXRQ1);
            ulStatus |= CANReadReg(ulBase + CAN_O_TXRQ2) << 16;
            break;
        }
        //
        // Combine the New Data status bits into one 32bit value.
        //
        case CAN_STS_NEWDAT:
        {
            ulStatus = CANReadReg(ulBase + CAN_O_NWDA1);
            ulStatus |= CANReadReg(ulBase + CAN_O_NWDA2) << 16;
            break;
        }
        //
        // Combine the Message valid status bits into one 32bit value.
        //
        case CAN_STS_MSGVAL:
        {
            ulStatus = CANReadReg(ulBase + CAN_O_MSGVAL1);
            ulStatus |= CANReadReg(ulBase + CAN_O_MSGVAL2) << 16;
            break;
        }
        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 points to storage for the receive error counter
//! \param pulTxCount points 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
//! - \b true if the receive error count has reached the error passive limit.
//! - \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 = CANReadReg(ulBase + CAN_O_ERR);

    //
    // Extract the error numbers from the register value.
    //
    *pulRxCount = (ulCANError & CAN_ERR_REC_MASK) >> CAN_ERR_REC_SHIFT;
    *pulTxCount = (ulCANError & CAN_ERR_TEC_MASK) >> CAN_ERR_TEC_SHIFT;

    if(ulCANError & CAN_ERR_RP)
    {
        return(1);
    }
    return(0);
}

//*****************************************************************************
//! Sets up 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 points to a structure containing message object fields
//! \param eMsgType Indicates what type of message this object is.
//!     This value will be one of the following:
//!     - MSG_OBJ_TYPE_TX - CAN transmit message object.
//!     - MSG_OBJ_TYPE_TX_REMOTE - CAN transmit remote request message
//!         object.
//!     - MSG_OBJ_TYPE_RX - CAN receive message object.
//!     - MSG_OBJ_TYPE_RX_REMOTE - CAN receive remote request message object.
//!     - MSG_OBJ_TYPE_RXTX_REMOTE - CAN remote frame receive remote, then
//!         transmit message object.
//!
//! This function is used to configure any one of the 32 highly configurable
//! message objects in the CAN controller.  A message object can be set up
//! with a remote or data frame along with several options for automatic
//! transmission and reception.  It can be configured to generate interrupts
//! on completion of message receipt or transmission.  The object can also
//! be set up with filter/mask so that action is only taken when a message
//! that meets certain parameters is seen on the bus.
//!
//! 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
//! - \e ulFlags
//!     Set MSG_OBJ_TX_INT_ENABLE flag to enable interrupt on transmission
//!     Set MSG_OBJ_RX_INT_ENABLE flag to enable interrupt on receipt
//!     Set MSG_OBJ_USE_ID_FILTER flag to enable filtering based on the
//!         identifier mask specified by /e ulMsgIDMask.
//! - 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
//! - pchMsgData - 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 - set to MSG_OBJ_TYPE_TX.
//! - set \e ulMsgID to the message ID
//! - set \e ulFlags
//!     Set MSG_OBJ_TX_INT_ENABLE to to get an interrupt when the message is
//!     sent.
//!     Do not set MSG_OBJ_USE_ID_FILTER so that no identifier filtering is
//!     used.
//! - set \e ulMsgLen to the number of bytes in the data frame
//! - set \e pchMsgData to point to an array containing the bytes in the
//!   message (if a data frame, n/a if remote frame, though 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 - set to 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.
//! - \e ulFlags
//!     Set MSG_OBJ_TX_INT_ENABLE flag to be interrupted when the data frame is
//!     received.
//!     Set 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 pchMsgData 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.
//
//*****************************************************************************
long
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));

    //
    // Wait for busy bit to clear
    //
    while(CANReadReg(ulBase + CAN_O_IF1CRQ) & CAN_IFCRQ_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_IFCMSK_WRNRD | CAN_IFCMSK_DATAA | CAN_IFCMSK_DATAB |
        CAN_IFCMSK_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)
    {
        case MSG_OBJ_TYPE_TX:
        {
            //
            // Set the TXRQST bit and the reset the rest of the register.
            //
            usMsgCtrl |= CAN_IFMCTL_TXRQST;
            usArbReg[1] = CAN_IFARB2_DIR;
            bTransferData = 1;
            break;
        }
        case MSG_OBJ_TYPE_TX_REMOTE:
        {
            //
            // Set the TXRQST bit and the reset the rest of the register.
            //
            usMsgCtrl |= CAN_IFMCTL_TXRQST;
            usArbReg[1] = 0;
            break;
        }
        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;
        }
        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_IFARB2_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_IFMCTL_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_IFCMSK_MASK;
            break;
        }
        case MSG_OBJ_TYPE_RXTX_REMOTE:
        {
            //
            // Oddly the DIR bit is set to one for remote receivers.
            //
            usArbReg[1] = CAN_IFARB2_DIR;

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

            //
            // The data to be returned needs to be filled in.
            //
            bTransferData = 1;
            break;
        }
        default:
        {
            return(-1);
        }
    }

    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品久久不卡毛片| 一区二区三区自拍| 色综合久久88色综合天天6 | 国产精品久久午夜| 欧美精品电影在线播放| 国产成人在线色| 午夜av区久久| 亚洲色图都市小说| 久久综合精品国产一区二区三区| 欧美色手机在线观看| 福利一区在线观看| 美日韩一区二区三区| 樱花影视一区二区| 国产欧美日韩麻豆91| 91精品国产美女浴室洗澡无遮挡| 99视频在线精品| 国产成都精品91一区二区三| 日本伊人精品一区二区三区观看方式| 日韩毛片精品高清免费| 国产清纯白嫩初高生在线观看91| 欧美另类久久久品| 色婷婷久久久综合中文字幕| 懂色av一区二区三区免费观看 | 久久超级碰视频| 午夜欧美一区二区三区在线播放| 亚洲欧美激情一区二区| 久久精品欧美一区二区三区不卡 | 国产精品系列在线播放| 美日韩黄色大片| 亚洲成人一二三| 亚洲国产中文字幕| 一个色妞综合视频在线观看| 亚洲欧洲av另类| 国产精品伦理在线| 国产欧美日韩不卡| 国产日韩亚洲欧美综合| 欧美精品一区二区高清在线观看| 欧美日韩在线三级| 欧美色综合天天久久综合精品| 99r国产精品| 91在线观看污| 91在线精品秘密一区二区| jlzzjlzz欧美大全| 不卡的电影网站| 99久久精品情趣| 91精选在线观看| 日韩免费性生活视频播放| 日韩一区二区三区免费观看| 日韩三区在线观看| 日韩欧美国产系列| 欧美变态tickling挠脚心| 欧美成人伊人久久综合网| 欧美成人精品高清在线播放| 欧美成人aa大片| 国产婷婷色一区二区三区 | 亚洲欧美日韩综合aⅴ视频| 日韩一区在线看| 亚洲一区二区三区视频在线 | 国产人成一区二区三区影院| 国产精品污www在线观看| 国产精品网曝门| 亚洲欧美日本韩国| 亚洲18色成人| 国产在线乱码一区二区三区| 国产jizzjizz一区二区| 99久久夜色精品国产网站| 色综合天天综合狠狠| 欧美日韩一二三| 日韩精品一区在线| 中文字幕在线不卡一区二区三区| 亚洲视频香蕉人妖| 日韩中文字幕一区二区三区| 精品亚洲成a人在线观看| 成人午夜av在线| 色就色 综合激情| 91精品国产福利| 国产片一区二区| 一区二区三区四区视频精品免费| 日韩av中文字幕一区二区| 国产一区二区三区综合| 91美女在线视频| 在线综合视频播放| 国产精品大尺度| 天天影视色香欲综合网老头| 国产激情视频一区二区在线观看| eeuss鲁片一区二区三区| 69堂成人精品免费视频| 亚洲va国产天堂va久久en| 国内精品在线播放| 在线免费av一区| 精品国产电影一区二区| 亚洲男人电影天堂| 久久成人av少妇免费| 色欧美日韩亚洲| 久久蜜臀中文字幕| 亚洲国产综合人成综合网站| 国产精品资源站在线| 欧美三级视频在线播放| 国产丝袜欧美中文另类| 午夜在线成人av| 成人国产精品免费网站| 91精品国产福利| 一个色在线综合| 波多野结衣在线aⅴ中文字幕不卡| 欧美日韩www| 中文字幕一区二区三区不卡在线 | 午夜一区二区三区视频| 国产成人精品亚洲日本在线桃色| 欧美精品九九99久久| 国产精品丝袜黑色高跟| 久久国产精品第一页| 欧美午夜寂寞影院| 一区在线中文字幕| 国产一二精品视频| 日韩一区二区免费在线电影| 亚洲一区欧美一区| 99久久伊人精品| 久久久精品国产99久久精品芒果| 日本免费在线视频不卡一不卡二| 99久久婷婷国产综合精品电影| 久久综合九色综合欧美就去吻| 日本欧美加勒比视频| 欧美吞精做爰啪啪高潮| 亚洲欧美福利一区二区| 丰满少妇在线播放bd日韩电影| 在线电影欧美成精品| 亚洲卡通欧美制服中文| 国产精品自在欧美一区| 日韩精品一区二| 国产精品久久久久久久蜜臀| 国内欧美视频一区二区| 日韩欧美国产一区在线观看| 成人动漫一区二区在线| 国产精品三级久久久久三级| 久久99久久99| 日韩三区在线观看| 亚洲日本成人在线观看| www.视频一区| 中文字幕日韩欧美一区二区三区| 国产在线国偷精品产拍免费yy| 精品精品国产高清一毛片一天堂| 天天av天天翘天天综合网| 欧美三片在线视频观看| 亚洲免费成人av| 在线视频观看一区| 亚洲国产wwwccc36天堂| 欧洲生活片亚洲生活在线观看| 亚洲美女屁股眼交3| 一本色道久久综合亚洲aⅴ蜜桃 | 亚洲美女少妇撒尿| 欧美艳星brazzers| 亚洲精品国产无天堂网2021 | 粉嫩蜜臀av国产精品网站| 日本精品一区二区三区高清 | 国产日韩欧美激情| 成人av午夜电影| 国产精品久久久久婷婷二区次| 91捆绑美女网站| 亚洲精品免费电影| 91精品国产综合久久小美女| 日本在线观看不卡视频| 久久久精品免费免费| 国产精品亚洲午夜一区二区三区| 国产日韩影视精品| 欧洲一区在线观看| 亚洲1区2区3区视频| 亚洲乱码一区二区三区在线观看| 一本色道久久综合亚洲精品按摩| 天天av天天翘天天综合网| 欧洲国内综合视频| 久久se精品一区精品二区| 国产精品黄色在线观看| 色婷婷综合久久久久中文一区二区| 亚洲成人自拍网| 精品免费99久久| 成人一二三区视频| 亚洲美女一区二区三区| 成人小视频在线| 欧美亚洲愉拍一区二区| 蜜臂av日日欢夜夜爽一区| 欧美第一区第二区| jlzzjlzz欧美大全| 亚洲成人av中文| 精品伦理精品一区| 五月天中文字幕一区二区| 久久久久久久久久久久久久久99| 大桥未久av一区二区三区中文| 亚洲精品乱码久久久久久| 欧美一级黄色大片| 成人永久aaa| 亚洲电影你懂得| 欧美电影免费观看高清完整版在 | 丰满少妇在线播放bd日韩电影| 国产精品高潮久久久久无| 91丨porny丨国产| 免费在线成人网| 国产精品色呦呦| 欧美一区二区三区四区五区| 国产传媒久久文化传媒| 综合欧美一区二区三区|