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

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

?? can.c

?? uCOS-II V2.84 LM3S6965 TCPIP Demo
?? C
?? 第 1 頁 / 共 5 頁
字號:
    //
    // Make sure that the address passed in is valid.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE));

    //
    // Clear the init bit in the control register.
    //
    CANWriteReg(ulBase + CAN_O_CTL,
                CANReadReg(ulBase + CAN_O_CTL) & ~CAN_CTL_INIT);
}

//*****************************************************************************
//
//! Disables the CAN controller.
//!
//! \param ulBase is the base address of the CAN controller to disable.
//!
//! Disables the CAN controller for message processing.  When disabled, the
//! controller will no longer automatically process data on the CAN bus.
//! The controller can be restarted by calling CANEnable().  The state of the
//! CAN controller and the message objects in the controller are left as they
//! were before this call was made.
//!
//! \return None.
//
//*****************************************************************************
void
CANDisable(unsigned long ulBase)
{
    //
    // Make sure that the address passed in is valid.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE));

    //
    // Set the init bit in the control register.
    //
    CANWriteReg(ulBase + CAN_O_CTL,
                CANReadReg(ulBase + CAN_O_CTL) | CAN_CTL_INIT);
}

//*****************************************************************************
//
//! Reads the current settings for the CAN controller bit timing.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param pClkParms is a pointer to a structure to hold the timing parameters.
//!
//! This function reads the current configuration of the CAN controller bit
//! clock timing, and stores the resulting information in the structure
//! supplied by the caller.  Refer to CANSetBitTiming() for the meaning of the
//! values that are returned in the structure pointed to by \e pClkParms.
//!
//! \return None.
//
//*****************************************************************************
void
CANGetBitTiming(unsigned long ulBase, tCANBitClkParms *pClkParms)
{
    unsigned int uBitReg;

    //
    // Make sure that the address passed in is valid and the pointer is not
    // NULL.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE));
    ASSERT(pClkParms != 0);

    //
    // Read out all the bit timing values from the CAN controller registers.
    //
    uBitReg = CANReadReg(ulBase + CAN_O_BIT);

    //
    // Set the phase 2 segment.
    //
    pClkParms->uPhase2Seg = ((uBitReg & CAN_BIT_TSEG2) >> 12) + 1;

    //
    // Set the phase 1 segment.
    //
    pClkParms->uSyncPropPhase1Seg = ((uBitReg & CAN_BIT_TSEG1) >> 8) + 1;

    //
    // Set the sychronous jump width.
    //
    pClkParms->uSJW = ((uBitReg & CAN_BIT_SJW) >> 6) + 1;

    //
    // Set the pre-divider for the CAN bus bit clock.
    //
    pClkParms->uQuantumPrescaler =
        ((uBitReg & CAN_BIT_BRP) |
        ((CANReadReg(ulBase + CAN_O_BRPE) & CAN_BRPE_BRPE) << 6)) + 1;
}

//*****************************************************************************
//
//! Configures the CAN controller bit timing.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param pClkParms points to the structure with the clock parameters
//!
//! Configures the various timing parameters for the CAN bus bit timing:
//! Propagation segment, Phase Buffer 1 segment, Phase Buffer 2 segment, and
//! the Synchronization Jump Width.  The values for Propagation and Phase
//! Buffer 1 segments are derived from the combination parameter
//! \e pClkParms->uSyncPropPhase1Seg.  Phase Buffer 2 is determined from the
//! parameter \e pClkParms->uPhase2Seg.  These two parameters, along with
//! \e pClkParms->uSJW are based in units of bit time quanta.
//! The actual quantum time is determined by the
//! \e pClkParms->uQuantumPrescaler value, which specifies what the divisor for
//! the CAN module clock.
//!
//! The total bit time, in quanta, will be the sum of the two Seg
//! parameters, as follows:
//!
//! bit_time_q = uSyncPropPhase1Seg + uPhase2Seg + 1
//!
//! Note that the Sync_Seg is always one quantum in duration, and will be
//! added to derive the correct duration of Prop_Seg and Phase1_Seg.
//!
//! The equation to determine the actual bit rate is as follows:
//!
//! CAN Clock /
//! ((\e uSyncPropPhase1Seg + \e uPhase2Seg + 1)*(\e uQuantumPrescaler))
//!
//! This means that with \e uSyncPropPhase1Seg = 4, \e uPhase2Seg = 1,
//! \e uQuantumPrescaler = 2 and a 8MHz CAN clock, that the bit rate will be
//! (8MHz)/((5 + 2 + 1)*2) or 500 KBit/sec.
//!
//! \return None.
//
//*****************************************************************************
void
CANSetBitTiming(unsigned long ulBase, tCANBitClkParms *pClkParms)
{
    unsigned int uBitReg;
    unsigned int uSavedInit;

    //
    // Make sure that the address passed in is valid and the pClkParms is not
    // NULL.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE));
    ASSERT(pClkParms != 0);

    //
    // The phase 1 segment must be in the range from 2 to 16.
    //
    ASSERT((pClkParms->uSyncPropPhase1Seg >= 2) &&
           (pClkParms->uSyncPropPhase1Seg <= 16));

    //
    // The phase 2 segment must be in the range from 1 to 8.
    //
    ASSERT((pClkParms->uPhase2Seg >= 1) && (pClkParms->uPhase2Seg <= 8));

    //
    // The synchronous jump windows must be in the range from 1 to 4.
    //
    ASSERT((pClkParms->uSJW >= 1) && (pClkParms->uSJW <= 4));

    //
    // The CAN clock pre-divider must be in the range from 1 to 1024.
    //
    ASSERT((pClkParms->uQuantumPrescaler <= 1024) &&
           (pClkParms->uQuantumPrescaler >= 1));

    //
    // To set the bit timing register, the controller must be placed
    // in init mode (if not already), and also configuration change
    // bit enabled.  State of the init bit should be saved so it can
    // be restored at the end.
    //
    uSavedInit = CANReadReg(ulBase + CAN_O_CTL);
    CANWriteReg(ulBase + CAN_O_CTL, uSavedInit | CAN_CTL_INIT | CAN_CTL_CCE);

    //
    // Set the bit fields of the bit timing register according to the parms
    //
    uBitReg = ((pClkParms->uPhase2Seg - 1) << 12) & CAN_BIT_TSEG2;
    uBitReg |= ((pClkParms->uSyncPropPhase1Seg - 1) << 8) & CAN_BIT_TSEG1;
    uBitReg |= ((pClkParms->uSJW - 1) << 6) & CAN_BIT_SJW;
    uBitReg |= (pClkParms->uQuantumPrescaler - 1) & CAN_BIT_BRP;
    CANWriteReg(ulBase + CAN_O_BIT, uBitReg);

    //
    // Set the divider upper bits in the extension register
    //
    CANWriteReg(ulBase + CAN_O_BRPE,
                ((pClkParms->uQuantumPrescaler - 1) >> 6) & CAN_BRPE_BRPE);
    //
    // Clear the config change bit, and restore the init bit
    //
    uSavedInit &= ~CAN_CTL_CCE;

    //
    // If Init was not set before, then clear it.
    //
    if(uSavedInit & CAN_CTL_INIT)
    {
        uSavedInit &= ~CAN_CTL_INIT;
    }
    CANWriteReg(ulBase + CAN_O_CTL, uSavedInit);
}

//*****************************************************************************
//
//! Returns the CAN controller interrupt number.
//!
//! \param ulBase is the base address of the selected CAN controller
//!
//! Given a CAN controller base address, returns the corresponding interrupt
//! number.
//!
//! \return Returns a CAN interrupt number, or -1 if \e ulPort is invalid.
//
//*****************************************************************************
long
CANGetIntNumber(unsigned long ulBase)
{
    long lIntNumber;

    //
    // Return the interrupt number for the given CAN controller.
    //
    switch(ulBase)
    {
        //
        // Return the interrupt number for CAN 0
        //
        case CAN0_BASE:
        {
            lIntNumber = INT_CAN0;
            break;
        }

        //
        // Return the interrupt number for CAN 1
        //
        case CAN1_BASE:
        {
            lIntNumber = INT_CAN1;
            break;
        }

        //
        // Return -1 to indicate a bad address was passed in.
        //
        default:
        {
            lIntNumber = -1;
        }
    }
    return(lIntNumber);
}

//*****************************************************************************
//
//! Registers an interrupt handler for the CAN controller.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param pfnHandler is a pointer to the function to be called when the
//! enabled CAN interrupts occur.
//!
//! This function registers the interrupt handler in the interrupt vector
//! table, and enables CAN interrupts on the interrupt controller; specific
//! CAN interrupt sources must be enabled using CANIntEnable().  The
//! interrupt handler being registered must clear the source of the interrupt
//! using CANIntClear();
//!
//! If the application is using a static interrupt vector table stored
//! in flash, then it is not necessary to register the interrupt handler
//! this way.  Instead, IntEnable() should be used to enable CAN interrupts
//! on the interrupt controller.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
void
CANIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
{
    unsigned long ulIntNumber;

    //
    // Make sure that the address passed in is valid.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE));

    //
    // Get the actual interrupt number for this CAN controller.
    //
    ulIntNumber = CANGetIntNumber(ulBase);

    //
    // Register the interrupt handler.
    //
    IntRegister(ulIntNumber, pfnHandler);

    //
    // Enable the Ethernet interrupt.
    //
    IntEnable(ulIntNumber);
}

//*****************************************************************************
//
//! Unregisters an interrupt handler for the CAN controller.
//!
//! \param ulBase is the base address of the controller.
//!
//! This function unregisters the previously registered interrupt handler
//! and disables the interrupt on the interrupt controller.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
void
CANIntUnregister(unsigned long ulBase)
{
    unsigned long ulIntNumber;

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

    //
    // Get the actual interrupt number for this CAN controller.
    //
    ulIntNumber = CANGetIntNumber(ulBase);

    //
    // Register the interrupt handler.
    //
    IntUnregister(ulIntNumber);

    //
    // Disable the CAN interrupt.
    //
    IntDisable(ulIntNumber);
}

//*****************************************************************************
//
//! Enables individual CAN controller interrupt sources.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param ulIntFlags is the bit mask of the interrupt sources to be enabled.
//!
//! Enables specific interrupt sources of the CAN controller.  Only enabled
//! sources will cause a processor interrupt.
//!
//! The parameter \e ulIntFlags is the logical OR of any of the following:
//!
//! - CAN_INT_ERROR - controller error condition has occurred
//! - CAN_INT_STATUS - a message transfer completed, or bus error detected
//! - CAN_INT_MASTER - allow CAN controller to generate interrupts
//!
//! In order to generate any interrupts, CAN_INT_MASTER must be enabled.
//! Further, for any particular transaction from a message object to
//! generate an interrupt, that message object must have interrupts enabled
//! (see CANMessageSet()).  CAN_INT_ERROR will generate an interrupt if the
//! controller enters the "bus off" condition, or if the error counters reach a
//! limit.  CAN_INT_STATUS will generate an interrupt under quite a few status
//! conditions and may provide more interrupts than the application needs to
//! handle.  When an interrupt occurs, use CANIntStatus() to determine the
//! cause.
//!
//! \return None.
//
//*****************************************************************************
void
CANIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
{
    //
    // Check the arguments.
    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
18欧美亚洲精品| 精品国精品自拍自在线| 亚洲欧美在线视频观看| 成人app在线观看| 1区2区3区欧美| 欧美日韩精品一区视频| 日本成人在线不卡视频| 精品国产髙清在线看国产毛片| 久草中文综合在线| 久久精品亚洲乱码伦伦中文| 成人av午夜电影| 亚洲香肠在线观看| 欧美r级电影在线观看| 国产99久久久国产精品潘金| 亚洲欧美一区二区三区久本道91 | 国产麻豆精品theporn| 久久精品免费在线观看| 色欧美88888久久久久久影院| 亚洲高清不卡在线| 精品欧美一区二区三区精品久久| 国产精品一区二区久久不卡| 亚洲欧美日韩综合aⅴ视频| 7777精品伊人久久久大香线蕉的 | 欧美高清你懂得| 国产精一区二区三区| 亚洲欧美视频在线观看| 日韩亚洲欧美成人一区| 成人av在线看| 日韩av网站在线观看| 国产精品女同一区二区三区| 欧美老人xxxx18| 国产精品亚洲第一区在线暖暖韩国 | 久久久国产精品午夜一区ai换脸| 成人激情午夜影院| 免费一区二区视频| 最新不卡av在线| 精品成a人在线观看| 在线观看一区不卡| 国产成人综合在线播放| 午夜精品久久久久久久99樱桃| 欧美激情一区二区三区不卡| 欧美日韩三级视频| 成人av免费网站| 久久精品国产久精国产| 亚洲一区中文在线| 欧美高清一级片在线观看| 日韩欧美一级二级| 欧美午夜在线一二页| 成人免费av在线| 久久91精品国产91久久小草| 亚洲电影中文字幕在线观看| 中文字幕欧美国产| 精品区一区二区| 91精品国产综合久久福利软件 | 国产一区二三区| 亚洲第一激情av| 自拍偷拍欧美精品| 国产亚洲欧美激情| 久久欧美中文字幕| 欧美sm极限捆绑bd| 日韩欧美国产成人一区二区| 欧美日韩aaa| 欧美日韩一区二区三区不卡| 91麻豆精品视频| 99久久婷婷国产综合精品电影| 国模娜娜一区二区三区| 久久国产麻豆精品| 麻豆精品一二三| 美女视频黄久久| 久久99国产精品免费网站| 美脚の诱脚舐め脚责91| 免费在线观看成人| 久久精品久久综合| 国产一区二区在线观看视频| 久久草av在线| 国产一区不卡精品| 国产不卡在线一区| jvid福利写真一区二区三区| 成人va在线观看| 成人app软件下载大全免费| 成人丝袜18视频在线观看| 国产+成+人+亚洲欧洲自线| 国产成人午夜精品影院观看视频 | 日韩欧美国产麻豆| 欧美videossexotv100| 精品99一区二区| 久久亚洲欧美国产精品乐播| 久久久久久久久97黄色工厂| 久久一区二区三区国产精品| 精品99999| 国产清纯美女被跳蛋高潮一区二区久久w| 精品国产一区二区三区四区四| 精品国产一区二区三区久久影院 | 国产高清久久久久| 成人午夜视频免费看| 一本色道久久综合狠狠躁的推荐| 91丨porny丨首页| 欧美日韩日日摸| 欧美一级日韩不卡播放免费| 日韩精品一区二区三区视频在线观看 | 国产在线一区二区综合免费视频| 国产精品一区二区三区网站| 成人精品视频一区二区三区尤物| 91亚洲午夜精品久久久久久| 欧美日韩亚洲综合一区| 91精品国产乱| 国产精品麻豆一区二区| 一区二区三区四区视频精品免费| 午夜视频一区在线观看| 国产suv一区二区三区88区| 在线观看一区二区视频| 欧美不卡一区二区三区四区| 国产精品久久久久久久裸模| 亚洲 欧美综合在线网络| 国产剧情一区在线| 欧美三级视频在线观看| 久久精品亚洲国产奇米99| 一区二区三区免费在线观看| 免费精品视频在线| 99国产精品久久久久| 欧美一区二区三区婷婷月色| 国产精品久久久久精k8| 男女性色大片免费观看一区二区 | 欧美在线不卡一区| 久久久亚洲精华液精华液精华液| 一区二区久久久久久| 国产裸体歌舞团一区二区| 一道本成人在线| 久久看人人爽人人| 亚洲h在线观看| 91欧美激情一区二区三区成人| 日韩女优av电影在线观看| 亚洲人成网站色在线观看| 韩国av一区二区三区| 欧美日韩亚洲丝袜制服| 亚洲视频精选在线| 国产高清不卡二三区| 日韩一区二区视频| 亚洲一区电影777| 99re视频精品| 国产欧美日韩三区| 日韩成人精品在线观看| 在线精品视频一区二区| 国产精品久久网站| 国产激情视频一区二区在线观看| 欧美一级黄色片| 一区二区三区四区不卡在线| 成人综合激情网| 久久久一区二区| 激情综合网最新| 欧美一区二区三级| 午夜在线电影亚洲一区| 日本乱人伦一区| 国产精品久久久久影院亚瑟| 国产精品 欧美精品| 久久久不卡网国产精品二区| 黄色成人免费在线| 精品国内二区三区| 精品一区二区免费在线观看| 宅男噜噜噜66一区二区66| 亚洲国产精品久久不卡毛片| 欧美在线观看你懂的| 亚洲乱码中文字幕| 91老师国产黑色丝袜在线| 国产精品国产三级国产a| 国v精品久久久网| 国产偷国产偷精品高清尤物| 国产精品538一区二区在线| 精品国产成人在线影院 | 风流少妇一区二区| 久久精品一区八戒影视| 国产福利一区二区三区| 国产精品无遮挡| 成人丝袜视频网| 亚洲欧洲日韩综合一区二区| 成人高清av在线| 亚洲欧美日韩系列| 91福利国产成人精品照片| 亚洲一区二区3| 欧美高清dvd| 老司机精品视频一区二区三区| 91精品在线免费观看| 久久成人av少妇免费| 国产视频一区二区在线观看| av一区二区三区| 亚洲成人精品影院| 欧美精品一区视频| 成人黄色一级视频| 亚洲综合免费观看高清完整版 | 国产成人av电影在线观看| 欧美激情一区二区三区四区| 成人国产精品免费观看视频| 亚洲欧美怡红院| 欧美日韩精品一区二区| 久久精品久久精品| 中文一区在线播放| 欧美日韩国产美女| 粉嫩13p一区二区三区| 亚洲黄色录像片| 精品久久久久久无|