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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? can.c

?? lm3s下lwip的udp
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
//*****************************************************************************
//
// can.c - Driver for the CAN module.
//
// Copyright (c) 2006-2008 Luminary Micro, Inc.  All rights reserved.
// 
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 3416 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup can_api
//! @{
//
//*****************************************************************************
#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_types.h"
#include "../hw_nvic.h"
#include "../hw_can.h"
#include "debug.h"
#include "interrupt.h"
#include "sysctl.h"
#include "can.h"

//*****************************************************************************
//
// This is the maximum number that can be stored as an 11bit Message
// identifier.
//
//*****************************************************************************
#define CAN_MAX_11BIT_MSG_ID    (0x7ff)

//*****************************************************************************
//
// This is used as the loop delay for accessing the CAN controller registers.
//
//*****************************************************************************
#define CAN_RW_DELAY            (5)

//*****************************************************************************
//
//! \internal
//! Checks a CAN base address.
//!
//! \param ulBase is the base address of the CAN controller.
//!
//! This function determines if a CAN controller base address is valid.
//!
//! \return Returns \b true if the base address is valid and \b false
//! otherwise.
//
//*****************************************************************************
#ifdef DEBUG
static tBoolean
CANBaseValid(unsigned long ulBase)
{
    return((ulBase == CAN0_BASE) || (ulBase == CAN1_BASE) ||
           (ulBase == CAN2_BASE));
}
#endif

//*****************************************************************************
//
//! \internal
//!
//! 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.
//!
//! This function replaces the original CANGetIntNumber() API and performs the
//! same actions.  A macro is provided in <tt>can.h</tt> to map the original
//! API to this API.
//!
//! \return Returns a CAN interrupt number, or -1 if \e ulPort is invalid.
//
//*****************************************************************************
static long
CANIntNumberGet(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 the interrupt number for CAN 2
        //
        case CAN2_BASE:
        {
            lIntNumber = INT_CAN2;
            break;
        }

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

//*****************************************************************************
//
//! \internal
//!
//! Reads a CAN controller register.
//!
//! \param ulRegAddress is the full address of the CAN register to be read.
//!
//! This function performs the necessary synchronization to read from a CAN
//! controller register.
//!
//! This function replaces the original CANReadReg() API and performs the same
//! actions.  A macro is provided in <tt>can.h</tt> to map the original API to
//! this API.
//!
//! \note This function provides the delay required to access CAN registers.
//! This delay is required when accessing CAN registers directly.
//!
//! \return Returns the value read from the register.
//
//*****************************************************************************
static unsigned long
CANRegRead(unsigned long ulRegAddress)
{
    volatile int iDelay;
    unsigned long ulRetVal;
    unsigned long ulIntNumber;
    unsigned long ulReenableInts;

    //
    // Get the CAN interrupt number from the register base address.
    //
    ulIntNumber = CANIntNumberGet(ulRegAddress & 0xfffff000);

    //
    // Make sure that the CAN base address was valid.
    //
    ASSERT(ulIntNumber != (unsigned long)-1);

    //
    // Remember current state so that CAN interrupts are only re-enabled if
    // they were already enabled.
    //
    ulReenableInts = HWREG(NVIC_EN1) & (1 << (ulIntNumber - 48));

    //
    // If the CAN interrupt was enabled then disable it.
    //
    if(ulReenableInts)
    {
        IntDisable(ulIntNumber);
    }

    //
    // Trigger the inital read to the CAN controller.  The value returned at
    // this point is not valid.
    //
    HWREG(ulRegAddress);

    //
    // This delay is necessary for the CAN have the correct data on the bus.
    //
    for(iDelay = 0; iDelay < CAN_RW_DELAY; iDelay++)
    {
    }

    //
    // Do the final read that has the valid value of the register.
    //
    ulRetVal = HWREG(ulRegAddress);

    //
    // Reenable CAN interrupts if they were enabled before this call.
    //
    if(ulReenableInts)
    {
        IntEnable(ulIntNumber);
    }

    return(ulRetVal);
}

//*****************************************************************************
//
//! \internal
//!
//! Writes a CAN controller register.
//!
//! \param ulRegAddress is the full address of the CAN register to be written.
//! \param ulRegValue is the value to write into the register specified by
//! \e ulRegAddress.
//!
//! This function takes care of the synchronization necessary to write to a
//! CAN controller register.
//!
//! This function replaces the original CANWriteReg() API and performs the same
//! actions.  A macro is provided in <tt>can.h</tt> to map the original API to
//! this API.
//!
//! \note The delays in this function are required when accessing CAN registers
//! directly.
//!
//! \return None.
//
//*****************************************************************************
static void
CANRegWrite(unsigned long ulRegAddress, unsigned long ulRegValue)
{
    volatile int iDelay;

    //
    // Trigger the inital write to the CAN controller.  The value will not make
    // it out to the CAN controller for CAN_RW_DELAY cycles.
    //
    HWREG(ulRegAddress) = ulRegValue;

    //
    // Delay to allow the CAN controller to receive the new data.
    //
    for(iDelay = 0; iDelay < CAN_RW_DELAY; iDelay++)
    {
    }
}

//*****************************************************************************
//
//! \internal
//!
//! Copies data from a buffer to the CAN Data registers.
//!
//! \param pucData is a pointer to the data to be written out to the CAN
//! controller's data registers.
//! \param pulRegister is an unsigned long pointer to the first register of the
//! CAN controller's data registers.  For example, in order to use the IF1
//! register set on CAN controller 0, the value would be: \b CAN0_BASE \b +
//! \b CAN_O_IF1DA1.
//! \param iSize is the number of bytes to copy into the CAN controller.
//!
//! This function takes the steps necessary to copy data from a contiguous
//! buffer in memory into the non-contiguous data registers used by the CAN
//! controller.  This function is rarely used outside of the CANMessageSet()
//! function.
//!
//! This function replaces the original CANWriteDataReg() 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.
//
//*****************************************************************************
static void
CANDataRegWrite(unsigned char *pucData, unsigned long *pulRegister, int iSize)
{
    int iIdx;
    unsigned long ulValue;

    //
    // Loop always copies 1 or 2 bytes per iteration.
    //
    for(iIdx = 0; iIdx < iSize; )
    {

        //
        // Write out the data 16 bits at a time since this is how the registers
        // are aligned in memory.
        //
        ulValue = pucData[iIdx++];

        //
        // Only write the second byte if needed otherwise it will be zero.
        //
        if(iIdx < iSize)
        {
            ulValue |= (pucData[iIdx++] << 8);
        }
        CANRegWrite((unsigned long)(pulRegister++), ulValue);
    }
}

//*****************************************************************************
//
//! \internal
//!
//! Copies data from a buffer to the CAN Data registers.
//!
//! \param pucData is a pointer to the location to store the data read from the
//! CAN controller's data registers.
//! \param pulRegister is an unsigned long pointer to the first register of the
//! CAN controller's data registers.  For example, in order to use the IF1
//! register set on CAN controller 1, the value would be: \b CAN0_BASE \b +
//! \b CAN_O_IF1DA1.
//! \param iSize is the number of bytes to copy from the CAN controller.
//!
//! This function takes the steps necessary to copy data to a contiguous buffer
//! in memory from the non-contiguous data registers used by the CAN
//! controller.  This function is rarely used outside of the CANMessageGet()
//! function.
//!
//! This function replaces the original CANReadDataReg() 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.
//
//*****************************************************************************
static void
CANDataRegRead(unsigned char *pucData, unsigned long *pulRegister, int iSize)
{
    int iIdx;
    unsigned long ulValue;

    //
    // Loop always copies 1 or 2 bytes per iteration.
    //
    for(iIdx = 0; iIdx < iSize; )
    {
        //
        // Read out the data 16 bits at a time since this is how the registers
        // are aligned in memory.
        //
        ulValue = CANRegRead((unsigned long)(pulRegister++));

        //
        // Store the first byte.
        //
        pucData[iIdx++] = (unsigned char)ulValue;

        //
        // Only read the second byte if needed.
        //
        if(iIdx < iSize)
        {
            pucData[iIdx++] = (unsigned char)(ulValue >> 8);
        }
    }
}

//*****************************************************************************
//
//! Initializes the CAN controller after reset.
//!
//! \param ulBase is the base address of the CAN controller.
//!
//! After reset, the CAN controller is left in the disabled state.  However,
//! the memory used for message objects contains undefined values and must be
//! cleared prior to enabling the CAN controller the first time.  This prevents
//! unwanted transmission or reception of data before the message objects are
//! configured.  This function must be called before enabling the controller
//! the first time.
//!
//! \return None.
//

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一卡二卡三卡四卡| 不卡一区二区中文字幕| 久久精品视频在线看| jizz一区二区| 日本不卡1234视频| 亚洲欧美国产高清| 久久先锋影音av鲁色资源| 欧美三级电影在线看| 成人性视频免费网站| 亚洲国产乱码最新视频| 国产精品成人一区二区艾草| wwwwww.欧美系列| 欧美日本不卡视频| 色婷婷av一区二区三区软件 | 免费日本视频一区| 亚洲男人天堂一区| 中文字幕欧美激情| 久久先锋影音av| 精品精品欲导航| 欧美美女视频在线观看| 日本高清不卡aⅴ免费网站| 国模一区二区三区白浆| 天天影视网天天综合色在线播放| 亚洲视频在线观看一区| 久久精品视频免费| 日韩一级黄色片| 4hu四虎永久在线影院成人| 日本高清不卡一区| 色视频成人在线观看免| 不卡av免费在线观看| 欧美zozo另类异族| 91精品国产免费| 欧美裸体bbwbbwbbw| 在线观看亚洲成人| 在线亚洲+欧美+日本专区| 99这里只有久久精品视频| 国产精品1区2区3区在线观看| 麻豆成人在线观看| 久久国产精品无码网站| 欧美aaaaa成人免费观看视频| 日韩国产欧美在线播放| 日韩国产欧美一区二区三区| 日韩电影网1区2区| 另类综合日韩欧美亚洲| 久久成人综合网| 国产乱人伦精品一区二区在线观看| 久久 天天综合| 国产一区高清在线| 丁香啪啪综合成人亚洲小说 | 国产综合色在线视频区| 国产一区二区三区在线观看免费视频 | 欧美日韩精品一区视频| 欧美日韩国产经典色站一区二区三区| 在线观看三级视频欧美| 欧美视频日韩视频在线观看| 欧美日韩视频在线观看一区二区三区 | 国产91丝袜在线观看| 国产69精品久久777的优势| 成人久久视频在线观看| 99视频一区二区| 色94色欧美sute亚洲线路一ni| 国产精品久久久久久福利一牛影视 | 国产在线精品国自产拍免费| 国产综合色在线| 99精品久久久久久| 在线视频国内自拍亚洲视频| 日韩一级成人av| 亚洲国产成人在线| 亚洲一区二区在线观看视频| 免费人成黄页网站在线一区二区| 国产麻豆精品theporn| 不卡av在线网| 欧美一级夜夜爽| 中文字幕第一区二区| 亚洲国产精品一区二区www| 麻豆国产精品一区二区三区| 国产成人欧美日韩在线电影| 色综合天天狠狠| 欧美变态tickling挠脚心| 国产精品美女久久久久高潮 | 国产成人综合在线播放| 91国偷自产一区二区三区成为亚洲经典| 欧美日韩国产在线播放网站| 久久久综合网站| 一区二区三区产品免费精品久久75| 欧美美女一区二区在线观看| 国产夜色精品一区二区av| 亚洲午夜激情av| 国产精品一品视频| 欧美日本在线播放| 国产精品女上位| 免费看欧美美女黄的网站| 99在线精品观看| 日韩欧美一级二级| 亚洲精品第一国产综合野| 国产一区在线观看麻豆| 欧美色倩网站大全免费| 日本一区二区成人在线| 毛片av一区二区三区| 欧洲精品中文字幕| 亚洲欧美在线另类| 狠狠色丁香婷婷综合久久片| 欧美日韩在线播放| 中文字幕亚洲在| 韩国理伦片一区二区三区在线播放 | 国产99精品视频| 日韩欧美亚洲一区二区| 亚洲主播在线观看| 91在线视频在线| 国产视频视频一区| 久久精品二区亚洲w码| 欧美午夜宅男影院| 亚洲色图色小说| va亚洲va日韩不卡在线观看| 26uuu国产一区二区三区| 日韩成人午夜电影| 欧美三级日韩三级| 一个色妞综合视频在线观看| 成a人片亚洲日本久久| 中文一区二区完整视频在线观看| 久色婷婷小香蕉久久| 8v天堂国产在线一区二区| 伊人开心综合网| 色哟哟精品一区| 综合分类小说区另类春色亚洲小说欧美| 国产乱子伦视频一区二区三区| 日韩欧美视频一区| 美美哒免费高清在线观看视频一区二区 | 精品乱码亚洲一区二区不卡| 婷婷综合另类小说色区| 日韩一区二区三区视频| 国产成人免费9x9x人网站视频| 亚洲欧美日韩国产一区二区三区| 成人小视频在线| 亚洲卡通动漫在线| 久久这里只有精品首页| 99久久婷婷国产综合精品电影| 日韩精品一区二区在线| 91麻豆精品在线观看| 奇米影视7777精品一区二区| 99re66热这里只有精品3直播 | 中文字幕亚洲一区二区av在线| 国产激情一区二区三区四区 | 欧美日韩国产乱码电影| 亚洲午夜在线观看视频在线| 91福利视频久久久久| 一区二区三区在线观看网站| 色综合色综合色综合色综合色综合 | 成人动漫av在线| 自拍偷自拍亚洲精品播放| 99re亚洲国产精品| 亚洲精品videosex极品| 欧美视频在线观看一区二区| 亚洲18女电影在线观看| 日韩免费性生活视频播放| 精品一区免费av| 久久久久久亚洲综合| 成人少妇影院yyyy| 亚洲欧美日韩人成在线播放| 欧美日韩国产美| 欧美一区二区三区在线观看视频 | 日韩在线卡一卡二| 欧美一级淫片007| 国产白丝网站精品污在线入口| 国产精品免费人成网站| 一本久久a久久免费精品不卡| 亚洲午夜在线观看视频在线| 欧美一级精品大片| 高清不卡一二三区| 亚洲自拍都市欧美小说| 欧美videofree性高清杂交| 丁香桃色午夜亚洲一区二区三区| 亚洲综合在线免费观看| 欧美一级日韩一级| 成人晚上爱看视频| 日韩精品色哟哟| 国产亚洲欧美一区在线观看| 色猫猫国产区一区二在线视频| 日韩黄色小视频| 国产精品久久久久久久久图文区| 在线中文字幕一区| 国产在线国偷精品产拍免费yy | 中文字幕中文乱码欧美一区二区 | 欧美片网站yy| 国产成人自拍网| 午夜伊人狠狠久久| 国产精品久久久久久户外露出| 欧美一区二区三区婷婷月色| 成人性生交大片免费看在线播放| 午夜精品久久久久久久蜜桃app| 欧美mv日韩mv国产网站| 色婷婷综合五月| 国产一区二区91| 亚洲小说春色综合另类电影| 久久久综合九色合综国产精品| 欧美日韩国产一级二级| av一区二区不卡| 国产精品888| 青青草国产成人99久久| 一区二区三区日韩精品|