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

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

?? can.c

?? iar 安裝使用的方法。其中包括一些工程模板
?? C
?? 第 1 頁 / 共 5 頁
字號:
    //
    // Wait for busy bit to clear
    //
    while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
    {
    }

    //
    // Clear the message value bit in the arbitration register.  This indicates
    // the message is not valid and is a "safe" condition to leave the message
    // object.  The same arb reg is used to program all the message objects.
    //
    CANRegWrite(ulBase + CAN_O_IF1CMSK, CAN_IF1CMSK_WRNRD | CAN_IF1CMSK_ARB |
                CAN_IF1CMSK_CONTROL);
    CANRegWrite(ulBase + CAN_O_IF1ARB2, 0);
    CANRegWrite(ulBase + CAN_O_IF1MCTL, 0);

    //
    // Loop through to program all 32 message objects
    //
    for(iMsg = 1; iMsg <= 32; iMsg++)
    {
        //
        // Wait for busy bit to clear
        //
        while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
        {
        }

        //
        // Initiate programming the message object
        //
        CANRegWrite(ulBase + CAN_O_IF1CRQ, iMsg);
    }

    //
    // Make sure that the interrupt and new data flags are updated for the
    // message objects.
    //
    CANRegWrite(ulBase + CAN_O_IF1CMSK, CAN_IF1CMSK_NEWDAT |
                CAN_IF1CMSK_CLRINTPND);

    //
    // Loop through to program all 32 message objects
    //
    for(iMsg = 1; iMsg <= 32; iMsg++)
    {
        //
        // Wait for busy bit to clear.
        //
        while(CANRegRead(ulBase + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
        {
        }

        //
        // Initiate programming the message object
        //
        CANRegWrite(ulBase + CAN_O_IF1CRQ, iMsg);
    }

    //
    // Acknowledge any pending status interrupts.
    //
    CANRegRead(ulBase + CAN_O_STS);
}

//*****************************************************************************
//
//! Enables the CAN controller.
//!
//! \param ulBase is the base address of the CAN controller to enable.
//!
//! Enables the CAN controller for message processing.  Once enabled, the
//! controller will automatically transmit any pending frames, and process any
//! received frames.  The controller can be stopped by calling CANDisable().
//! Prior to calling CANEnable(), CANInit() should have been called to
//! initialize the controller and the CAN bus clock should be configured by
//! calling CANBitTimingSet().
//!
//! \return None.
//
//*****************************************************************************
void
CANEnable(unsigned long ulBase)
{
    //
    // Make sure that the address passed in is valid.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));

    //
    // Clear the init bit in the control register.
    //
    CANRegWrite(ulBase + CAN_O_CTL,
                CANRegRead(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) ||
           (ulBase == CAN2_BASE));

    //
    // Set the init bit in the control register.
    //
    CANRegWrite(ulBase + CAN_O_CTL,
                CANRegRead(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 CANBitTimingSet() for the meaning of the
//! values that are returned in the structure pointed to by \e pClkParms.
//!
//! This function replaces the original CANGetBitTiming() API and performs the
//! same actions.  A macro is provided in <tt>can.h</tt> to map the original
//! API to this API.
//!
//! \return None.
//
//*****************************************************************************
void
CANBitTimingGet(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) ||
           (ulBase == CAN2_BASE));
    ASSERT(pClkParms != 0);

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

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

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

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

    //
    // Set the pre-divider for the CAN bus bit clock.
    //
    pClkParms->uQuantumPrescaler =
        ((uBitReg & CAN_BIT_BRP_M) |
         ((CANRegRead(ulBase + CAN_O_BRPE) & CAN_BRPE_BRPE_M) << 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
//! \e pClkParms->uSyncPropPhase1Seg parameter.  Phase Buffer 2 is determined
//! from the \e pClkParms->uPhase2Seg parameter.  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 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 an 8 MHz CAN clock, that the bit rate will be
//! (8 MHz) / ((5 + 2 + 1) * 2) or 500 Kbit/sec.
//!
//! This function replaces the original CANSetBitTiming() API and performs the
//! same actions.  A macro is provided in <tt>can.h</tt> to map the original
//! API to this API.
//!
//! \return None.
//
//*****************************************************************************
void
CANBitTimingSet(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) ||
           (ulBase == CAN2_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 = CANRegRead(ulBase + CAN_O_CTL);
    CANRegWrite(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_M;
    uBitReg |= ((pClkParms->uSyncPropPhase1Seg - 1) << 8) & CAN_BIT_TSEG1_M;
    uBitReg |= ((pClkParms->uSJW - 1) << 6) & CAN_BIT_SJW_M;
    uBitReg |= (pClkParms->uQuantumPrescaler - 1) & CAN_BIT_BRP_M;
    CANRegWrite(ulBase + CAN_O_BIT, uBitReg);

    //
    // Set the divider upper bits in the extension register.
    //
    CANRegWrite(ulBase + CAN_O_BRPE,
                ((pClkParms->uQuantumPrescaler - 1) >> 6) & CAN_BRPE_BRPE_M);
    //
    // 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;
    }
    CANRegWrite(ulBase + CAN_O_CTL, uSavedInit);
}

//*****************************************************************************
//
//! 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) ||
           (ulBase == CAN2_BASE));

    //
    // Get the actual interrupt number for this CAN controller.
    //
    ulIntNumber = CANIntNumberGet(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) ||
           (ulBase == CAN2_BASE));

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合色之久久综合| 93久久精品日日躁夜夜躁欧美| 久久久久久久综合日本| 欧美肥妇bbw| 欧美视频一二三区| 欧美巨大另类极品videosbest| 欧美性大战久久久| 欧美美女直播网站| 欧美一区二区视频在线观看2020| 欧美日韩高清一区二区不卡 | 亚洲裸体在线观看| 91精品国产综合久久婷婷香蕉| 亚洲欧美日韩国产一区二区三区| 欧美一区二区三区在线观看 | 91精品国产欧美一区二区成人| 欧美美女bb生活片| 91福利在线播放| 欧美一区二区性放荡片| 欧美一区二区啪啪| 91精品国产美女浴室洗澡无遮挡| 欧美三级韩国三级日本一级| 91超碰这里只有精品国产| 91精品国产色综合久久久蜜香臀| 欧美电影精品一区二区| 久久久青草青青国产亚洲免观| 国产精品少妇自拍| 一个色在线综合| 久久国产精品露脸对白| 成人黄色小视频| 欧美性色欧美a在线播放| 欧美精品一区二区三区一线天视频 | 制服丝袜亚洲网站| 日韩精品一区二区三区在线播放| 久久久夜色精品亚洲| 国产精品婷婷午夜在线观看| 亚洲综合色噜噜狠狠| 久久91精品久久久久久秒播| 成人免费av在线| 3d动漫精品啪啪一区二区竹菊 | 色综合一个色综合亚洲| 日韩欧美高清在线| 亚洲男女毛片无遮挡| 国产一区二区三区在线观看免费视频| 99re热视频这里只精品| 日韩精品中文字幕一区| 一区二区三区小说| 国产成人小视频| 日韩一区二区影院| 亚洲国产欧美日韩另类综合| 国产成人午夜精品影院观看视频 | 久久亚洲捆绑美女| 亚洲成av人**亚洲成av**| 丁香天五香天堂综合| 91麻豆精品国产综合久久久久久| 亚洲丝袜另类动漫二区| 国产麻豆视频一区二区| 日韩午夜在线播放| 五月天婷婷综合| 91在线免费看| 国产精品久久久久久久浪潮网站 | 亚洲va在线va天堂| 国产馆精品极品| 欧美一三区三区四区免费在线看| 一级中文字幕一区二区| 九色综合狠狠综合久久| 欧美女孩性生活视频| 亚洲综合色噜噜狠狠| 成人国产精品视频| 欧美一级高清片在线观看| 成人爱爱电影网址| 国产一区视频导航| 91精品国产丝袜白色高跟鞋| 亚洲一区二区三区在线看| 久久久青草青青国产亚洲免观| 丁香六月综合激情| 日韩亚洲欧美一区二区三区| 亚洲国产日产av| 欧美系列在线观看| 午夜精品福利在线| 欧美精品粉嫩高潮一区二区| 亚洲一区二区视频在线| 136国产福利精品导航| 一区二区三区中文字幕精品精品| 国产精品高清亚洲| 成人网男人的天堂| 一区二区三区在线看| 91福利在线观看| 日韩国产欧美三级| 欧美一区二区性放荡片| 日韩电影在线观看电影| 欧美精品亚洲一区二区在线播放| 亚洲午夜影视影院在线观看| 欧美三电影在线| 美女诱惑一区二区| 久久综合久久99| av电影天堂一区二区在线| 亚洲男同性视频| 宅男噜噜噜66一区二区66| 国产乱一区二区| 亚洲乱码中文字幕| 日韩精品一区在线| 成人精品小蝌蚪| 天天综合天天做天天综合| 久久蜜桃香蕉精品一区二区三区| 成人激情校园春色| 日韩国产一区二| 国产女人aaa级久久久级| 91免费版在线| 久久99精品国产.久久久久| 中日韩免费视频中文字幕| 欧美日韩国产一级二级| 国产福利精品一区二区| 亚洲一区二区三区爽爽爽爽爽| 久久影视一区二区| 欧美精品tushy高清| 国产一区欧美日韩| 亚洲一区二区偷拍精品| 久久精品视频免费| 欧美精品777| 99re成人在线| 国产在线精品一区在线观看麻豆| 亚洲激情第一区| 2022国产精品视频| 欧美精品自拍偷拍| 97aⅴ精品视频一二三区| 激情综合色丁香一区二区| 亚洲精品菠萝久久久久久久| 国产无遮挡一区二区三区毛片日本| 欧美网站一区二区| 色一区在线观看| 成人理论电影网| 狠狠久久亚洲欧美| 免费成人av资源网| 亚洲已满18点击进入久久| 一区二区中文视频| 久久亚洲影视婷婷| 日韩精品一区二区三区视频播放 | 精品国产乱码久久久久久1区2区 | 欧美三级韩国三级日本一级| 99久久久无码国产精品| 国产精品66部| 精品综合久久久久久8888| 日本伊人午夜精品| 亚洲第一在线综合网站| 亚洲黄一区二区三区| 中文字幕一区二区三区色视频 | 成人av在线一区二区| 国产乱妇无码大片在线观看| 日韩精品亚洲一区| 日韩中文字幕1| 婷婷国产在线综合| 首页综合国产亚洲丝袜| 五月天激情小说综合| 天堂va蜜桃一区二区三区| 亚洲成人动漫在线观看| 亚洲www啪成人一区二区麻豆| 性做久久久久久免费观看| 亚洲国产美国国产综合一区二区| 亚洲男人天堂av| 亚洲一区中文在线| 视频精品一区二区| 美女脱光内衣内裤视频久久影院| 青青草97国产精品免费观看无弹窗版| 天天操天天色综合| 奇米影视7777精品一区二区| 久久99国产精品久久99果冻传媒| 精品在线观看免费| 国产91富婆露脸刺激对白| 91福利在线导航| 欧美性xxxxx极品少妇| 欧美一级片在线| 久久尤物电影视频在线观看| 亚洲欧洲三级电影| 一区二区三区在线免费观看| 日韩av在线播放中文字幕| 国产精品一二三四区| 99精品久久99久久久久| 欧美日韩综合色| 亚洲精品一区二区三区香蕉| 国产欧美精品一区aⅴ影院| 亚洲免费在线观看| 蜜臀av一区二区在线观看 | 欧美亚洲丝袜传媒另类| 欧美日韩国产首页| 欧美激情一区二区三区不卡| 亚洲综合一区二区精品导航| 久久精品国产在热久久| 国v精品久久久网| 欧美日韩国产三级| 欧美国产日韩亚洲一区| 亚洲在线成人精品| 国产精品 日产精品 欧美精品| 日本韩国欧美一区二区三区| 精品对白一区国产伦| 亚洲精品免费一二三区| 国产真实乱对白精彩久久| 欧洲一区在线观看| 精品国产91洋老外米糕| 亚洲国产一区视频| 国产99久久久久久免费看农村|