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

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

?? can.c

?? lm3s下lwip的udp
?? C
?? 第 1 頁 / 共 5 頁
字號:
//*****************************************************************************
void
CANInit(unsigned long ulBase)
{
    int iMsg;

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

    //
    // Place CAN controller in init state, regardless of previous state.  This
    // will put controller in idle, and allow the message object RAM to be
    // programmed.
    //
    CANRegWrite(ulBase + CAN_O_CTL, CAN_CTL_INIT);

    //
    // 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)
{
    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));

    //
    // 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)
{
    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));

    //
    // 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;

    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));
    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;

    //
    // Check the arguments.
    //
    ASSERT(CANBaseValid(ulBase));
    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;

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

    //
    // 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(CANBaseValid(ulBase));

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

    //
    // Register the interrupt handler.
    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美va亚洲va在线观看蝴蝶网| 欧美猛男gaygay网站| 色婷婷av久久久久久久| 日韩激情在线观看| 在线不卡免费av| 日韩精品久久理论片| 日韩一区二区三区免费观看| 美腿丝袜在线亚洲一区| 久久综合久久鬼色| 成人精品鲁一区一区二区| 国产精品久久久久久久岛一牛影视 | 亚洲一区二区黄色| 91精品在线观看入口| 国产福利精品导航| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 国产欧美日韩激情| 欧美日本视频在线| 国产精品1024| 午夜成人免费视频| 久久久久国产精品厨房| 在线观看日韩国产| 成人永久aaa| 九九**精品视频免费播放| 综合婷婷亚洲小说| 久久久噜噜噜久久中文字幕色伊伊 | 欧美一区二区三区啪啪| 成人动漫视频在线| 蜜臀av性久久久久av蜜臀妖精| 国产精品欧美一区二区三区| 欧美精品vⅰdeose4hd| aaa欧美色吧激情视频| 蜜臀精品久久久久久蜜臀| 中文字幕免费观看一区| 日韩一区二区三区精品视频| 色婷婷精品大在线视频| 99精品国产91久久久久久| 国产成人午夜精品影院观看视频 | 欧美精品久久一区| 在线亚洲人成电影网站色www| 成人激情午夜影院| 91在线一区二区| 99re亚洲国产精品| 91亚洲午夜精品久久久久久| 成人国产精品免费观看动漫| 成人app软件下载大全免费| 99久久精品费精品国产一区二区| 丁香天五香天堂综合| www.在线欧美| 色噜噜狠狠一区二区三区果冻| 色婷婷综合久色| 欧美乱妇15p| 久久日韩精品一区二区五区| 亚洲欧美一区二区三区国产精品 | 中文字幕的久久| 专区另类欧美日韩| 亚洲综合久久久| 男男视频亚洲欧美| 国产成人综合亚洲91猫咪| 不卡的av中国片| 欧美性一级生活| 91网上在线视频| 久久国产精品第一页| 国产麻豆午夜三级精品| 99re热视频这里只精品 | 黄一区二区三区| 91福利社在线观看| 日韩精品一区二区三区在线 | 波多野结衣中文字幕一区| 精品视频一区二区三区免费| 精品99999| 日日夜夜精品视频免费| 高清在线成人网| 91精品国产美女浴室洗澡无遮挡| 久久精品一区二区| 日韩高清在线观看| 99国产精品久久久| 久久久精品人体av艺术| 日本美女一区二区| 在线观看视频一区| 日韩一区在线看| 粉嫩高潮美女一区二区三区| 884aa四虎影成人精品一区| 亚洲女同一区二区| 久久精品国产999大香线蕉| 国产大片一区二区| 久久综合丝袜日本网| 美女任你摸久久| 日韩一区二区精品葵司在线 | 自拍偷拍国产亚洲| 成人sese在线| 国产精品久久久久婷婷二区次| 国产一区在线观看视频| www欧美成人18+| 成人性生交大片免费| 国产欧美精品日韩区二区麻豆天美| 狠狠色综合色综合网络| 欧美一级精品大片| 日本成人中文字幕| 久久九九影视网| 成人aa视频在线观看| 亚洲第一会所有码转帖| 欧美视频一区二区三区四区| 亚洲成人av免费| 国产亚洲人成网站| 91在线视频免费91| 亚洲一区二区三区美女| 日韩亚洲电影在线| 高清不卡一二三区| 亚洲综合999| 久久亚洲综合av| 国产亚洲一区二区三区在线观看| av网站一区二区三区| 欧美aaa在线| 亚洲蜜臀av乱码久久精品蜜桃| 欧美日韩国产bt| 福利电影一区二区| 午夜影院在线观看欧美| 欧美国产一区二区在线观看| 欧美狂野另类xxxxoooo| 成人免费视频免费观看| 日日摸夜夜添夜夜添国产精品| 国产精品成人一区二区三区夜夜夜| 欧美日韩视频一区二区| 成人不卡免费av| 激情综合网天天干| 日产欧产美韩系列久久99| 亚洲天堂中文字幕| 91福利精品第一导航| 国产成人在线观看免费网站| 日本视频中文字幕一区二区三区| 一区二区三区影院| 亚洲视频你懂的| 国产精品久久久久久久裸模| 精品国产精品网麻豆系列| 欧美不卡激情三级在线观看| 欧美美女视频在线观看| 欧美亚洲综合久久| www.日韩精品| av在线不卡免费看| 99国产一区二区三精品乱码| 91亚洲精华国产精华精华液| 91麻豆自制传媒国产之光| 色偷偷88欧美精品久久久| 91黄色激情网站| 欧美日韩精品免费观看视频| 在线不卡欧美精品一区二区三区| 欧美日韩二区三区| 欧美大片在线观看一区二区| 欧美xxxxxxxx| 成人欧美一区二区三区黑人麻豆 | 全国精品久久少妇| 精品一区二区三区不卡| 成人免费毛片aaaaa**| 色女孩综合影院| 91精品欧美综合在线观看最新| 欧美r级在线观看| 国产99久久久国产精品免费看| 91网站最新地址| 在线观看成人小视频| 欧美剧在线免费观看网站| 精品久久久影院| 国产精品久久久久毛片软件| 五月天中文字幕一区二区| 极品少妇xxxx精品少妇| 色综合天天综合网天天狠天天| 欧美日韩综合在线免费观看| 欧美一二区视频| 亚洲三级电影网站| 久久99精品网久久| 91激情在线视频| 亚洲丝袜制服诱惑| 国产在线视频精品一区| 91高清在线观看| 亚洲特黄一级片| 成人精品视频网站| 久久久久九九视频| 亚洲国产成人91porn| 成人的网站免费观看| 久久久久综合网| 国产自产视频一区二区三区| 欧美年轻男男videosbes| 成人免费一区二区三区在线观看| 国产一区二区主播在线| 91精品国产综合久久精品图片| 亚洲精品中文字幕在线观看| 懂色av噜噜一区二区三区av| 国产日产精品一区| 国产成人精品一区二| 久久亚洲私人国产精品va媚药| 麻豆专区一区二区三区四区五区| 日韩一区二区在线播放| 久久99精品国产麻豆婷婷洗澡| 3atv一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 日韩精品专区在线影院观看| 国产美女在线观看一区| 国产欧美日本一区视频| 成人av电影免费观看| 一区二区三区在线免费| 欧美精品在线观看播放|