亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
2019国产精品| 日韩高清一区在线| 午夜久久电影网| 国产精品18久久久久久久网站| 色哟哟一区二区在线观看| 欧美一级黄色片| 亚洲另类在线一区| 国产精一品亚洲二区在线视频| 欧美色国产精品| 一区二区三区在线视频观看 | 欧美tickling挠脚心丨vk| 中文字幕一区免费在线观看| 精品一二线国产| 欧美高清视频在线高清观看mv色露露十八| 国产精品污www在线观看| 久久国产免费看| 7777精品伊人久久久大香线蕉的 | 国产欧美日韩视频一区二区 | 欧美一区二区三区成人| 最好看的中文字幕久久| 国产一区二区三区香蕉| 欧美精品国产精品| 午夜欧美在线一二页| 色视频成人在线观看免| 日韩美女视频一区二区| 成人app网站| 欧美—级在线免费片| 国产乱人伦精品一区二区在线观看 | 韩国v欧美v日本v亚洲v| 69堂国产成人免费视频| 亚洲电影激情视频网站| 在线视频国内一区二区| 亚洲麻豆国产自偷在线| 色婷婷国产精品| 亚洲影院免费观看| 欧美日韩成人一区| 青青草97国产精品免费观看 | 国模冰冰炮一区二区| 久久亚洲捆绑美女| 国产精品91一区二区| 欧美国产激情二区三区| 成人手机电影网| 亚洲视频在线观看三级| 色猫猫国产区一区二在线视频| 有码一区二区三区| 欧美日韩在线一区二区| 欧美bbbbb| 久久精品视频网| 97久久精品人人做人人爽50路| 亚洲欧洲精品天堂一级| 欧美性猛交xxxx乱大交退制版 | 国产精品18久久久久| 欧美激情在线看| 一本到一区二区三区| 亚洲成人777| 精品国产欧美一区二区| 懂色av噜噜一区二区三区av| 亚洲精品写真福利| 3d成人动漫网站| 国产不卡在线一区| 亚洲一区二区三区四区五区黄| 欧美一区二区三级| 成人一区在线看| 日韩电影在线观看一区| 久久噜噜亚洲综合| 91美女在线观看| 麻豆91在线看| 亚洲小说春色综合另类电影| 日韩你懂的在线观看| 91麻豆高清视频| 狂野欧美性猛交blacked| 亚洲视频在线观看一区| 欧美精品一区二区三区蜜臀 | 国产精品一线二线三线精华| 亚洲欧美激情在线| 精品国产乱码久久久久久1区2区 | 成人亚洲一区二区一| 亚洲国产欧美一区二区三区丁香婷| 精品久久久久久久久久久久久久久 | 欧美日韩亚洲另类| 丰满岳乱妇一区二区三区| 亚洲成人先锋电影| 中文字幕在线播放不卡一区| 欧美日本精品一区二区三区| 成人激情免费网站| 美女一区二区久久| 亚洲一区二区在线观看视频| 国产午夜精品福利| 日韩一卡二卡三卡国产欧美| 日本精品视频一区二区| 国产mv日韩mv欧美| 久久99热这里只有精品| 亚洲国产成人tv| 国产精品久久久久久久久搜平片 | 韩国av一区二区三区| 亚洲高清中文字幕| 亚洲美女免费在线| 中文字幕精品一区二区精品绿巨人 | 午夜私人影院久久久久| 国产精品午夜电影| 欧美不卡在线视频| 欧美日韩三级一区二区| 色哟哟一区二区三区| 国产98色在线|日韩| 美女看a上一区| 亚洲成a人在线观看| 亚洲欧美日本在线| 国产精品欧美经典| 久久久久久9999| 国产无一区二区| 国产亚洲午夜高清国产拍精品| 欧美一级高清大全免费观看| 欧美丝袜丝nylons| 欧美日韩精品一区视频| 欧美猛男男办公室激情| 欧美自拍偷拍午夜视频| 色美美综合视频| 91麻豆高清视频| 日本高清不卡一区| 在线精品视频免费观看| 欧美综合在线视频| 色av一区二区| 欧美视频日韩视频| 欧美剧情电影在线观看完整版免费励志电影 | 国产一本一道久久香蕉| 麻豆一区二区三区| 久久国产精品99久久久久久老狼| 日韩av网站在线观看| 日韩电影免费一区| 另类欧美日韩国产在线| 精品系列免费在线观看| 国产一区二区三区免费| 国产乱人伦偷精品视频不卡| aaa亚洲精品| 在线国产电影不卡| 欧美日韩精品欧美日韩精品一 | 99re成人精品视频| 在线观看一区二区视频| 在线播放亚洲一区| 欧美一级日韩免费不卡| 久久婷婷成人综合色| 国产精品伦一区| 五月激情综合婷婷| 国产在线播放一区二区三区| 成人动漫在线一区| 欧美性猛片aaaaaaa做受| 欧美一区二区日韩| 国产精品久线观看视频| 亚洲一区二区在线免费看| 麻豆久久久久久久| 91在线云播放| 日韩欧美国产1| 国产精品第一页第二页第三页| 亚洲福利视频三区| 国产中文字幕精品| 91色乱码一区二区三区| 日韩一区二区三区电影在线观看 | 成人午夜av影视| 555夜色666亚洲国产免| 国产农村妇女毛片精品久久麻豆| 一区二区三区不卡视频在线观看| 免费高清成人在线| 在线看不卡av| 久久久www成人免费毛片麻豆| 亚洲制服丝袜在线| 国产高清精品网站| 欧美日韩精品二区第二页| 国产精品女上位| 免费精品视频在线| 91成人网在线| 国产丝袜美腿一区二区三区| 日本va欧美va精品| 91美女视频网站| 久久久精品一品道一区| 午夜精品一区二区三区电影天堂| 国产69精品久久久久毛片| 色天使久久综合网天天| 欧美国产精品一区二区| 久久电影国产免费久久电影| 欧美午夜一区二区三区| 亚洲欧美日韩中文字幕一区二区三区| 狠狠色综合日日| 日韩一区二区影院| 亚洲综合久久久久| 91在线视频播放| 国产精品天美传媒沈樵| 国内精品国产成人| 欧美大片日本大片免费观看| 亚洲人成人一区二区在线观看| 国产成人精品综合在线观看| 日韩一级高清毛片| 首页亚洲欧美制服丝腿| 欧美又粗又大又爽| 一区二区三区四区激情| 99精品视频中文字幕| 国产日韩欧美制服另类| 国产精品亚洲一区二区三区妖精| 日韩欧美在线1卡| 免费观看91视频大全| 欧美一级久久久|