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

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

?? can.c

?? ucos_ii/tcpip to lm3s6965
?? C
?? 第 1 頁 / 共 4 頁
字號:
//! \e pClkParms->uSJW are in units of bit time quanta.
//! The actual quantum time is determined by the
//! \e pClkParms->uQuantumPrescaler value, which will be divided into 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 = 1 and a 6MHz CAN clock, that the bit rate will be
//! (8Mhz)/((5 + 2 + 1)/1) or 1 MBit/sec.
//!
//! \return None.
//
//*****************************************************************************
void
CANSetBitTiming(unsigned long ulBase,
                tCANBitClkParms *pClkParms)
{
    unsigned int uBitReg;
    unsigned int uSavedInit;

    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
    ASSERT(pClkParms != 0);
    ASSERT((pClkParms->uSyncPropPhase1Seg >= 2) &&
           (pClkParms->uSyncPropPhase1Seg <= 16));
    ASSERT((pClkParms->uPhase2Seg >= 1) && (pClkParms->uPhase2Seg <= 8));
    ASSERT((pClkParms->uSJW >= 1) && (pClkParms->uSJW <= 4));
    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);
}

//*****************************************************************************
//
//! Get CAN controller interrupt number.
//!
//! \param ulBase 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)
    {
        case CAN0_BASE:
        {
            lIntNumber = INT_CAN0;
            break;
        }
        case CAN1_BASE:
        {
            lIntNumber = INT_CAN1;
            break;
        }
        case CAN2_BASE:
        {
            lIntNumber = INT_CAN2;
            break;
        }
        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;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_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) ||
           (ulBase == CAN2_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 eIntFlags 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 eIntFlags 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 "busoff" 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.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
    ASSERT((ulIntFlags & ~(CAN_CTL_EIE | CAN_CTL_SIE | CAN_CTL_IE)) == 0);

    //
    // Enable the specified interrupts.
    //
    CANWriteReg(ulBase + CAN_O_CTL,
                CANReadReg(ulBase + CAN_O_CTL) | ulIntFlags);
}

//*****************************************************************************
//
//! Disables individual CAN controller interrupt sources.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param eIntFlags is the bit mask of the interrupt sources to be disabled.
//!
//! Disables the specified CAN controller interrupt sources.  Only enabled
//! interrupt sources can cause a processor interrupt.
//!
//! The parameter \e eIntFlags has the same definition as in the function
//! CANIntEnable().
//!
//! \return None.
//
//*****************************************************************************
void
CANIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
    ASSERT((ulIntFlags & ~(CAN_CTL_EIE | CAN_CTL_SIE | CAN_CTL_IE)) == 0);

    //
    // Disable the specified interrupts.
    //
    CANWriteReg(ulBase + CAN_O_CTL,
                CANReadReg(ulBase + CAN_O_CTL) & ~(ulIntFlags));
}

//*****************************************************************************
//
//! Gets the current CAN controller interrupt status.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param eIntStsReg indicates which interrupt status register to read
//!
//! Returns the value of one of two interrupt status registers.  The
//! interrupt status register read is determined by the parameter
//! \e eIntStsReg, which can have one of the following values:
//! - CAN_INT_STS_CAUSE - indicates the cause of the interrupt
//! - CAN_INT_STS_OBJECT - indicates pending interrupts of all message objects
//!
//! CAN_INT_STS_CAUSE returns the value of the controller interrupt register
//! and indicates the cause of the interrupt.  It will be a value of
//! CAN_INT_INTID_STATUS if the cause is a status interrupt.  In this case,
//! the status register should be read with the CANStatusGet() function.
//! Calling this function to read the status will also clear the status
//! interrupt.  If the value of the interrupt register is in the range 1-32,
//! then this indicates the number of the highest priority message object that
//! has an interrupt pending. The message object interrupt can be cleared by
//! using the CANIntClear() function, or by reading the message using
//! CANMessageGet() in the case of a received message.  The interrupt handler
//! can read the interrupt status again to make sure all pending interrupts are
//! cleared before returning from the interrupt.
//!
//! CAN_INT_STS_OBJECT returns a bit mask indicating which message objects
//! have pending interrupts.  This can be used to discover all of the
//! pending interrupts at once, as opposed to repeatedly reading the interrupt
//! register by using CAN_INT_STS_CAUSE.
//!
//! \return The value of one of the interrupt status registers.
//
//*****************************************************************************
unsigned long
CANIntStatus(unsigned long ulBase, tCANIntStsReg eIntStsReg)
{
    unsigned long ulStatus;

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

    //
    // See which status the caller is looking for.
    //
    switch(eIntStsReg)
    {
        //
        // The caller wants the global interrupt status for the CAN controller
        // specified by ulBase.
        //
        case CAN_INT_STS_CAUSE:
        {
            ulStatus = CANReadReg(ulBase + CAN_O_INT);
            break;
        }
        //
        // The caller wants the current message status interrupt for all
        // messages.
        //
        case CAN_INT_STS_OBJECT:
        {
            //
            // Read and combine both 16 bit values into one 32bit status.
            //
            ulStatus = (CANReadReg(ulBase + CAN_O_MSGINT1) &
                        CAN_MSGINT1_INTPND);
            ulStatus |= (CANReadReg(ulBase + CAN_O_MSGINT2) << 16);
            break;
        }
        default:
        {
            ulStatus = 0;
            break;
        }
    }
    //
    // Return the interrupt status value
    //
    return(ulStatus);
}

//*****************************************************************************
//
//! This call is used to clears a CAN interrupt source.
//!
//! \param ulBase is the base address of the CAN controller.
//! \param ulIntClr is a value indicating which interrupt source to clear
//!
//! This function can be used to clear a specific interrupt source.  The
//! parameter \e ulIntClr should be one of the following values:
//! - CAN_INT_INTID_STATUS - Clears a status interrupt.
//! - 1-32 - Clear the specified message object interrupt
//!
//! It is not necessary to use this function to clear an interrupt.  This
//! should only be used if the application wants to clear an interrupt source
//! without taking the normal interrupt action.
//!
//! Normally, the status interrupt is cleared by reading the controller status,
//! by calling CANStatusGet().  A specific message object interrupt is normally
//! cleared by reading the message object (see CANMessageGet()).
//!
//! \return None.
//
//*****************************************************************************
void
CANIntClear(unsigned long ulBase, unsigned long ulIntClr)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == CAN0_BASE) ||
           (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
    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.
        //
        CANReadReg(ulBase + CAN_O_STS);
    }
    else
    {
        //
        // Wait to be sure that this interface is not busy.
        //
        while(CANReadReg(ulBase + CAN_O_IF1CRQ) & CAN_IFCRQ_BUSY)
        {
        }

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

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美中文字幕公布| 日韩成人午夜精品| 91精品国产综合久久久久| 色噜噜狠狠色综合欧洲selulu| 成人免费视频播放| 国产成人精品亚洲777人妖| 国产在线不卡视频| 国产91在线观看| 欧美在线视频不卡| 精品伦理精品一区| 久久久精品2019中文字幕之3| 欧美mv和日韩mv国产网站| 国产精品欧美极品| 午夜精品久久久久久久99水蜜桃| 日本v片在线高清不卡在线观看| 国产精华液一区二区三区| 在线免费视频一区二区| 日韩欧美www| 有码一区二区三区| 国产一区二区三区四| 91亚洲精品久久久蜜桃| 久久午夜色播影院免费高清| 亚洲精品第一国产综合野| 国产精一品亚洲二区在线视频| www.视频一区| 国产精品色眯眯| 蜜臀久久久久久久| 色菇凉天天综合网| 亚洲男人的天堂在线aⅴ视频| 狠狠色综合播放一区二区| 欧美精品在线观看播放| 亚洲精品视频免费观看| 91网站在线播放| 亚洲精品乱码久久久久久日本蜜臀| 成人av中文字幕| 亚洲人成在线播放网站岛国| 成人开心网精品视频| 亚洲欧美日韩国产成人精品影院| 久久99九九99精品| 国产欧美一区视频| 99久久综合色| 日韩成人免费看| 8x8x8国产精品| 极品少妇一区二区三区精品视频 | 亚洲国产成人高清精品| 99久久精品国产精品久久| 国产精品三级久久久久三级| 91在线视频官网| 免费成人美女在线观看| xfplay精品久久| 色香色香欲天天天影视综合网| 日韩精品亚洲一区二区三区免费| 欧美美女喷水视频| 成人综合在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅 | 日本丰满少妇一区二区三区| 日韩av一级片| 亚洲一区视频在线| 国产欧美一区二区精品婷婷 | 91福利国产精品| 韩国一区二区三区| 日本女优在线视频一区二区| 欧美精品一区二区三区视频| 91久久久免费一区二区| 蜜桃传媒麻豆第一区在线观看| 亚洲精品免费在线| 亚洲欧洲日韩综合一区二区| 91精品国产丝袜白色高跟鞋| 99精品偷自拍| 国产成人精品影视| 久久99深爱久久99精品| 亚洲电影第三页| 亚洲成在线观看| 日韩中文字幕亚洲一区二区va在线| 亚洲人被黑人高潮完整版| 亚洲色图欧美激情| 亚洲一区在线播放| 香蕉成人伊视频在线观看| 中文字幕一区二区三区不卡在线 | 成人视屏免费看| 精品影院一区二区久久久| 国产精品国产三级国产普通话99| 亚洲人成亚洲人成在线观看图片 | 精品福利一区二区三区免费视频| 欧美日韩国产123区| 成人av午夜影院| 欧美精品一二三| 日韩伦理免费电影| 亚洲一区二区在线视频| 秋霞午夜鲁丝一区二区老狼| 国产麻豆一精品一av一免费 | 国产一区二区免费看| 色偷偷成人一区二区三区91| 综合久久国产九一剧情麻豆| 久久婷婷国产综合国色天香| 国产精品久久久久久久久晋中 | 欧美性生活大片视频| 久久久久一区二区三区四区| 天天综合色天天综合色h| eeuss鲁片一区二区三区在线观看| 久久99九九99精品| 精品福利av导航| 午夜视黄欧洲亚洲| 色94色欧美sute亚洲线路二| 国产夜色精品一区二区av| 亚洲综合色视频| 欧美性色黄大片| 午夜久久久久久久久久一区二区| 成人性色生活片免费看爆迷你毛片| 亚洲激情一二三区| 国产一区二区电影| 色吧成人激情小说| 亚洲精品成a人| 欧美午夜影院一区| 欧美精品久久久久久久多人混战| 亚洲欧美日韩在线| 水野朝阳av一区二区三区| 国产永久精品大片wwwapp| 精品成人佐山爱一区二区| 精品在线播放午夜| 国产欧美日本一区二区三区| 在线观看国产91| 亚洲风情在线资源站| 中文字幕精品一区二区精品绿巨人| 欧美一区二区大片| 日韩午夜激情电影| 国产精品不卡在线| 亚洲一区二区中文在线| 蜜臀av性久久久久av蜜臀妖精 | 日韩不卡手机在线v区| 日韩1区2区日韩1区2区| 丁香婷婷综合激情五月色| 成人性生交大合| 国产成人av电影在线| 免费成人在线观看| 一区二区三区精品在线| 国产日韩欧美精品电影三级在线| 色综合天天综合网国产成人综合天 | 五月婷婷激情综合网| 欧美三级日韩在线| 国产精品一级黄| 一本大道久久a久久综合婷婷| 男男视频亚洲欧美| 中文字幕一区二区三| 精品日本一线二线三线不卡| 99这里只有久久精品视频| 精品国产91亚洲一区二区三区婷婷| 激情综合色播激情啊| 免费观看30秒视频久久| 亚洲天天做日日做天天谢日日欢| 色先锋久久av资源部| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 天堂成人国产精品一区| 中文字幕五月欧美| 中文字幕在线不卡| 欧美国产在线观看| 中文字幕一区二区三| 毛片av中文字幕一区二区| 亚洲成人手机在线| 久久精品国产精品亚洲综合| 成人免费视频国产在线观看| 91美女在线看| 26uuu国产在线精品一区二区| 欧美一区二区三区在线观看视频 | 精品一区二区三区蜜桃| 精品国产一区二区三区四区四| 日本亚洲电影天堂| 亚洲同性同志一二三专区| 99re热这里只有精品免费视频| 一区二区三区av电影| 日韩欧美精品三级| 在线精品视频小说1| 日韩影院精彩在线| 日本一区二区三区在线不卡| 免费成人在线播放| 欧美一区二区三区免费大片| 亚洲综合激情网| 成人免费视频国产在线观看| 久久久久国产成人精品亚洲午夜| 精品一区二区av| 久久久久久久综合色一本| 激情综合一区二区三区| 久久久午夜精品| 91性感美女视频| 秋霞成人午夜伦在线观看| 欧美乱熟臀69xxxxxx| 亚洲综合偷拍欧美一区色| 高清在线观看日韩| 欧美大白屁股肥臀xxxxxx| 久久综合精品国产一区二区三区| 国产精品综合在线视频| 亚洲观看高清完整版在线观看| 懂色av中文字幕一区二区三区| www.日韩精品| 中文字幕乱码一区二区免费| 亚洲欧洲三级电影| 在线看国产一区二区| 亚洲欧洲中文日韩久久av乱码| 国产精品一区二区久激情瑜伽| 欧美日韩中文国产|