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

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

?? can.c

?? CAN_FIFO收發例程
?? C
?? 第 1 頁 / 共 5 頁
字號:
//!
//! \return None.
//
//*****************************************************************************
void
CANIntClear(unsigned long ulBase, unsigned long ulIntClr)
{
    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));
    ASSERT((ulIntClr == CAN_INT_INTID_STATUS) ||
           ((ulIntClr>=1) && (ulIntClr <=32)));

    if(ulIntClr == CAN_INT_INTID_STATUS)
    {
        //
        // Simply read and discard the status to clear the interrupt.
        //
        CANRegRead(ulBase + CAN_O_STS);
    }
    else
    {
        //
        // Wait to be sure that this interface is not busy.
        //
        while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
        {
        }

        //
        // Only change the interrupt pending state by setting only the
        // CAN_IF1CMSK_CLRINTPND bit.
        //
        CANRegWrite(ulBase + CAN_O_IF1CMSK, CAN_IF1CMSK_CLRINTPND);

        //
        // Send the clear pending interrupt command to the CAN controller.
        //
        CANRegWrite(ulBase + CAN_O_IF1CRQ, ulIntClr & CAN_IF1CRQ_MNUM_M);

        //
        // Wait to be sure that this interface is not busy.
        //
        while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
        {
        }
    }
}

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

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

    ulCtlReg = CANRegRead(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 transmitted 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 transmitted or received correctly.
        //
        ulCtlReg |= CAN_CTL_DAR;
    }

    CANRegWrite(ulBase + CAN_O_CTL, ulCtlReg);
}

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

    //
    // Read the disable automatic retry setting from the CAN controller.
    //
    if(CANRegRead(ulBase + CAN_O_CTL) & CAN_CTL_DAR)
    {
        //
        // Automatic data retransmission is not enabled.
        //
        return(false);
    }

    //
    // Automatic data retransmission is enabled.
    //
    return(true);
}

//*****************************************************************************
//
//! 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:
//!
//! - \b CAN_STS_CONTROL - the main controller status
//! - \b CAN_STS_TXREQUEST - bit mask of objects pending transmission
//! - \b CAN_STS_NEWDAT - bit mask of objects with new data
//! - \b 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 controller
//! status register fields are as follows:
//!
//! - \b CAN_STATUS_BUS_OFF - controller is in bus-off condition
//! - \b CAN_STATUS_EWARN - an error counter has reached a limit of at least 96
//! - \b CAN_STATUS_EPASS - CAN controller is in the error passive state
//! - \b CAN_STATUS_RXOK - a message was received successfully (independent of
//! any message filtering).
//! - \b CAN_STATUS_TXOK - a message was successfully transmitted
//! - \b CAN_STATUS_LEC_MSK - mask of last error code bits (3 bits)
//! - \b CAN_STATUS_LEC_NONE - no error
//! - \b CAN_STATUS_LEC_STUFF - stuffing error detected
//! - \b CAN_STATUS_LEC_FORM - a format error occurred in the fixed format part
//! of a message
//! - \b CAN_STATUS_LEC_ACK - a transmitted message was not acknowledged
//! - \b CAN_STATUS_LEC_BIT1 - dominant level detected when trying to send in
//! recessive mode
//! - \b CAN_STATUS_LEC_BIT0 - recessive level detected when trying to send in
//! dominant mode
//! - \b CAN_STATUS_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 objects without needing to query each one.  They contain the
//! following information:
//!
//! - \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(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_RX_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 is 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩久久久精品| 国产午夜亚洲精品理论片色戒| 欧美人妇做爰xxxⅹ性高电影| 精品毛片乱码1区2区3区| 亚洲视频一二三| 极品尤物av久久免费看| 91国内精品野花午夜精品| 欧美tickle裸体挠脚心vk| 亚洲夂夂婷婷色拍ww47| 国产成人免费视频一区| 91精品国产色综合久久ai换脸| 欧美激情一区二区| 韩国女主播一区二区三区| 欧美精品一卡两卡| 亚洲中国最大av网站| 北岛玲一区二区三区四区| 精品久久国产97色综合| 亚洲电影中文字幕在线观看| 福利一区在线观看| 日韩精品一区二区三区视频在线观看| 亚洲视频电影在线| aa级大片欧美| 国产精品视频一二三| 国产乱码精品一区二区三区av | 精品成人佐山爱一区二区| 一区二区三区四区激情| 一本大道综合伊人精品热热| 国产欧美综合在线观看第十页| 韩国精品在线观看| 精品国内二区三区| 国产在线乱码一区二区三区| 欧美一二三四区在线| 日本午夜精品一区二区三区电影 | 国产99久久久久久免费看农村| 日韩欧美亚洲国产另类| 免费观看久久久4p| 欧美成人综合网站| 国内成+人亚洲+欧美+综合在线| 欧美一级精品在线| 久久精品国产久精国产爱| 日韩亚洲欧美一区二区三区| 日本三级亚洲精品| 精品国产免费人成在线观看| 极品少妇一区二区三区精品视频| 精品国产乱码久久久久久久 | 亚洲福中文字幕伊人影院| 欧美挠脚心视频网站| 日本怡春院一区二区| 久久亚洲欧美国产精品乐播| 国产激情视频一区二区三区欧美 | 日韩一区二区麻豆国产| 另类专区欧美蜜桃臀第一页| 精品少妇一区二区三区在线视频| 激情成人综合网| 国产精品天天摸av网| 色94色欧美sute亚洲线路一ni | 久久久久高清精品| 波多野结衣视频一区| 亚洲欧美一区二区三区国产精品| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美国产视频在线| 欧美专区在线观看一区| 日本中文在线一区| 国产精品午夜在线| 欧美日韩另类一区| 国产在线精品视频| 亚洲精品美腿丝袜| 欧美电影免费观看高清完整版在线观看 | 一区二区三区视频在线观看| 91精品久久久久久久久99蜜臂| 国产一区日韩二区欧美三区| 亚洲欧美一区二区在线观看| 777a∨成人精品桃花网| 成人蜜臀av电影| 日韩电影免费一区| 亚洲精品免费播放| 久久久五月婷婷| 欧美丝袜丝交足nylons| 国产成人午夜高潮毛片| 亚洲国产日韩综合久久精品| 久久蜜桃一区二区| 欧美日本一道本| av不卡在线播放| 激情国产一区二区| 天天影视涩香欲综合网| 国产精品入口麻豆原神| 日韩欧美电影一二三| 日本精品裸体写真集在线观看| 国产一区在线看| 天天爽夜夜爽夜夜爽精品视频| 中文字幕av一区 二区| 日韩一卡二卡三卡四卡| 欧美视频在线不卡| 99精品视频在线播放观看| 精品一区二区三区久久| 亚洲成人av福利| 亚洲人成网站精品片在线观看| 久久九九影视网| 日韩精品一区二区三区四区视频| 在线视频一区二区免费| 成人丝袜高跟foot| 国产麻豆日韩欧美久久| 毛片一区二区三区| 日本美女一区二区三区视频| 亚洲www啪成人一区二区麻豆 | 欧美不卡一区二区| 欧美精品tushy高清| 欧美亚洲国产怡红院影院| 成年人午夜久久久| 成人av在线资源| 国产成人精品网址| 粉嫩高潮美女一区二区三区| 国产一区啦啦啦在线观看| 国产在线视频不卡二| 国产米奇在线777精品观看| 加勒比av一区二区| 久久精品国产亚洲高清剧情介绍| 蜜桃视频一区二区| 久久精品国产**网站演员| 免费成人av资源网| 麻豆精品一区二区三区| 美女免费视频一区| 久久激五月天综合精品| 久久超碰97中文字幕| 国模套图日韩精品一区二区| 激情综合网最新| 国产不卡高清在线观看视频| 成人免费毛片高清视频| 99re66热这里只有精品3直播 | 大美女一区二区三区| aaa亚洲精品| 色综合天天综合网国产成人综合天| 91美女福利视频| 欧美性极品少妇| 4438x亚洲最大成人网| 精品欧美一区二区久久| 国产视频视频一区| 亚洲欧美一区二区三区极速播放 | 91.xcao| 久久综合狠狠综合| 亚洲天堂2016| 午夜久久久影院| 精品无人码麻豆乱码1区2区| 处破女av一区二区| 91福利国产成人精品照片| 555夜色666亚洲国产免| 26uuu亚洲综合色欧美| 中文字幕一区二区三区不卡| 亚洲午夜精品网| 黄色小说综合网站| 色综合咪咪久久| 欧美成人官网二区| 中文字幕一区二区三区乱码在线| 午夜亚洲福利老司机| 国产在线国偷精品免费看| 91在线精品一区二区三区| 在线综合+亚洲+欧美中文字幕| 2023国产精品视频| 亚洲午夜激情av| 国产精品一区二区男女羞羞无遮挡| 91免费观看在线| 日韩欧美一二三区| 亚洲综合免费观看高清完整版| 六月婷婷色综合| 欧美视频一区二区三区| 久久综合色鬼综合色| 亚洲高清不卡在线| 99久久婷婷国产精品综合| 欧美videofree性高清杂交| 一区二区三区欧美| 成人午夜精品在线| 日韩一区二区在线看| 一区二区三区在线不卡| 国产精品亚洲一区二区三区妖精| 欧美亚洲另类激情小说| 国产精品久久久久久久裸模| 加勒比av一区二区| 91精品国产综合久久久久久久 | 蜜桃视频在线一区| 精品视频123区在线观看| 国产精品乱子久久久久| 久久99国产精品免费| 欧美美女直播网站| 亚洲人成亚洲人成在线观看图片| 国产精品主播直播| 日韩精品一区二| 久久狠狠亚洲综合| 欧美一区二区三区四区视频| 亚洲国产精品影院| 在线观看www91| 一区二区三区视频在线看| 91蜜桃免费观看视频| 欧美激情在线一区二区三区| 精品一区二区三区免费播放| 精品少妇一区二区| 日本中文字幕一区二区视频| 777色狠狠一区二区三区| 日韩av一级片| 日韩欧美一区二区在线视频| 日韩黄色在线观看|