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

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

?? i2c.c

?? FreeRTOS is a portable, open source, mini Real Time Kernel - a free to download and royalty free RTO
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// i2c.c - Driver for Inter-IC (I2C) bus block.
//
// Copyright (c) 2005,2006 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 Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  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 991 of the Stellaris Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup i2c_api
//! @{
//
//*****************************************************************************

#include "../hw_i2c.h"
#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_types.h"
#include "debug.h"
#include "i2c.h"
#include "interrupt.h"
#include "sysctl.h"

//*****************************************************************************
//
//! Initializes the I2C Master block.
//!
//! \param ulBase base address of the I2C Master module
//! \param bFast set up for fast data transfers
//!
//! This function initializes operation of the I2C Master block. Upon
//! successful initialization of the I2C block, this function will have
//! set the bus speed for the master, and will have enabled the I2C Master
//! block.
//!
//! If the parameter \e bFast is \b true, then the master block will be
//! set up to transfer data at 400 kbps; otherwise, it will be set up to
//! transfer data at 100 kbps.
//!
//! The I2C clocking is dependent upon the system clock rate returned by
//! SysCtlClockGet(); if it does not return the correct system clock rate then
//! the I2C clock rate will be incorrect.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterinit) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterInit(unsigned long ulBase, tBoolean bFast)
{
    unsigned long ulSysClk;
    unsigned long ulSCLFreq;
    unsigned long ulTPR;

    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Must enable the device before doing anything else.
    //
    I2CMasterEnable(ulBase);

    //
    // Get the system clock speed.
    //
    ulSysClk = SysCtlClockGet();

    //
    // Get the desired SCL speed.
    //
    if(bFast == true)
    {
        ulSCLFreq = I2C_SCL_FAST;
    }
    else
    {
        ulSCLFreq = I2C_SCL_STANDARD;
    }

    //
    // Compute the clock divider that achieves the fastest speed less than or
    // equal to the desired speed.  The numerator is biases to favor a larger
    // clock divider so that the resulting clock is always less than or equal
    // to the desired clock, never greater.
    //
    ulTPR = (((ulSysClk + (2 * I2C_MASTER_TPR_SCL * ulSCLFreq) - 1) /
              (2 * I2C_MASTER_TPR_SCL * ulSCLFreq)) - 1);
    HWREG(ulBase + I2C_MASTER_O_TPR) = ulTPR;
}
#endif

//*****************************************************************************
//
//! Initializes the I2C Slave block.
//!
//! \param ulBase base address of the I2C Slave module
//! \param ucSlaveAddr 7-bit slave address
//!
//! This function initializes operation of the I2C Slave block. Upon
//! successful initialization of the I2C blocks, this function will have
//! set the slave address and have enabled the I2C Slave block.
//!
//! The parameter \e ucSlaveAddr is the value that will be compared
//! against the slave address sent by an I2C master.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveinit) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);
    ASSERT(!(ucSlaveAddr & 0x80));

    //
    // Must enable the device before doing anything else.
    //
    I2CSlaveEnable(ulBase);

    //
    // Set up the slave address.
    //
    HWREG(ulBase + I2C_SLAVE_O_OAR) = ucSlaveAddr;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Master block.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This will enable operation of the I2C Master block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Enable the master block.
    //
    HWREG(ulBase + I2C_MASTER_O_CR) |= I2C_MASTER_CR_MFE;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Slave block.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This will enable operation of the I2C Slave block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Enable the clock to the slave block.
    //
    HWREG(ulBase - I2C_O_SLAVE + I2C_MASTER_O_CR) |= I2C_MASTER_CR_SFE;

    //
    // Enable the slave.
    //
    HWREG(ulBase + I2C_SLAVE_O_CSR) = I2C_SLAVE_CSR_DA;
}
#endif

//*****************************************************************************
//
//! Disables the I2C master block.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This will disable operation of the I2C master block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the master block.
    //
    HWREG(ulBase + I2C_MASTER_O_CR) &= ~(I2C_MASTER_CR_MFE);
}
#endif

//*****************************************************************************
//
//! Disables the I2C slave block.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This will disable operation of the I2C slave block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slavedisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Disable the slave.
    //
    HWREG(ulBase + I2C_SLAVE_O_CSR) = 0;

    //
    // Disable the clock to the slave block.
    //
    HWREG(ulBase - I2C_O_SLAVE + I2C_MASTER_O_CR) &= ~(I2C_MASTER_CR_SFE);
}
#endif

//*****************************************************************************
//
//! Registers an interrupt handler for the I2C module
//!
//! \param ulBase base address of the I2C module
//! \param pfnHandler is a pointer to the function to be called when the
//! synchronous serial interface interrupt occurs.
//!
//! This sets the handler to be called when an I2C interrupt occurs.  This
//! will enable the global interrupt in the interrupt controller; specific I2C
//! interrupts must be enabled via I2CMasterIntEnable() and
//! I2CSlaveIntEnable().  If necessary, it is the interrupt handler's
//! responsibility to clear the interrupt source via I2CMasterIntClear() and
//! I2CSlaveIntClear().
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_intregister) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Register the interrupt handler, returning an error if an error occurs.
    //
    IntRegister(INT_I2C, pfnHandler);

    //
    // Enable the I2C interrupt.
    //
    IntEnable(INT_I2C);
}
#endif

//*****************************************************************************
//
//! Unregisters an interrupt handler for the I2C module.
//!
//! \param ulBase base address of the I2C module
//!
//! This function will clear the handler to be called when an I2C
//! interrupt occurs.  This will also mask off the interrupt in the interrupt
//! controller so that the interrupt handler no longer is called.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_intunregister) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CIntUnregister(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the interrupt.
    //
    IntDisable(INT_I2C);

    //
    // Unregister the interrupt handler.
    //
    IntUnregister(INT_I2C);
}
#endif

//*****************************************************************************
//
//! Enables the I2C Master interrupt.
//!
//! \param ulBase base address of the I2C Master module
//!
//! Enables the I2C Master interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterintenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Enable the master interrupt.
    //
    HWREG(ulBase + I2C_MASTER_O_IMR) = 1;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Slave interrupt.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! Enables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveintenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Enable the slave interrupt.
    //
    HWREG(ulBase + I2C_SLAVE_O_IM) = 1;
}
#endif

//*****************************************************************************
//
//! Disables the I2C Master interrupt.
//!
//! \param ulBase base address of the I2C Master module
//!
//! Disables the I2C Master interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterintdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterIntDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the master interrupt.
    //
    HWREG(ulBase + I2C_MASTER_O_IMR) = 0;
}
#endif

//*****************************************************************************
//
//! Disables the I2C Slave interrupt.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! Disables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveintdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveIntDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Disable the slave interrupt.
    //
    HWREG(ulBase + I2C_SLAVE_O_IM) = 0;
}
#endif

//*****************************************************************************
//
//! Gets the current I2C Master interrupt status.
//!
//! \param ulBase base address of the I2C Master module
//! \param bMasked is false if the raw interrupt status is requested and
//! true if the masked interrupt status is requested.
//!
//! This returns the interrupt status for the I2C Master module.
//! Either the raw interrupt status or the status of interrupts that are
//! allowed to reflect to the processor can be returned.
//!
//! \return The current interrupt status, returned as \b true if active
//! or \b false if not active.
//
//*****************************************************************************
#if defined(GROUP_masterintstatus) || defined(BUILD_ALL) || defined(DOXYGEN)
tBoolean
I2CMasterIntStatus(unsigned long ulBase, tBoolean bMasked)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //
    if(bMasked)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本色道亚洲精品aⅴ| 久久噜噜亚洲综合| 欧美一区二区日韩| 国产蜜臀97一区二区三区| 亚洲一二三区视频在线观看| 国产在线精品一区二区夜色 | 精品1区2区3区| 精品久久久久一区| 亚洲综合小说图片| 成人黄色777网| 精品久久国产老人久久综合| 亚洲大尺度视频在线观看| www.久久久久久久久| 精品福利一区二区三区免费视频| 亚洲国产精品麻豆| av亚洲产国偷v产偷v自拍| 2021国产精品久久精品| 日产国产高清一区二区三区| 91高清视频在线| 亚洲欧美综合在线精品| 国产ts人妖一区二区| 2023国产精品| 精品一区免费av| 日韩三级高清在线| 午夜国产精品一区| 欧美综合久久久| 亚洲图片欧美视频| 一本久久a久久免费精品不卡| 国产精品网站一区| 国产 日韩 欧美大片| 国产日韩亚洲欧美综合| 国产乱码一区二区三区| 精品黑人一区二区三区久久| 狠狠狠色丁香婷婷综合激情 | 美女网站在线免费欧美精品| 日韩欧美一区二区视频| 青青草国产成人99久久| 日韩一区二区影院| 精品无人码麻豆乱码1区2区| 久久久综合视频| 国产成人免费在线视频| 欧美激情一区二区三区四区| 99综合电影在线视频| 国产精品女同一区二区三区| 99久久综合国产精品| 亚洲蜜臀av乱码久久精品| 91成人国产精品| 日韩国产成人精品| 在线播放日韩导航| 丝袜美腿亚洲色图| 日韩一区二区精品| 国产精品一区二区三区99| 国产精品乱码久久久久久| 91香蕉视频在线| 亚洲第四色夜色| 精品美女一区二区三区| 高清国产午夜精品久久久久久| **性色生活片久久毛片| 欧美天天综合网| 国产一区二区三区四| 国产精品久久久久久久久晋中| 欧美性色黄大片| 日韩精品一二三区| 久久在线观看免费| 99热精品一区二区| 一区二区三区四区在线播放| 91精品国产福利在线观看| 国产黄色精品网站| 一区二区三区欧美亚洲| 老司机免费视频一区二区| 亚洲欧美日韩久久| 欧美日韩另类国产亚洲欧美一级| 日韩精品亚洲一区| 欧美精品一区二区三区久久久| 成人美女视频在线看| 亚洲香肠在线观看| 精品国产一区二区三区av性色| a级高清视频欧美日韩| 午夜a成v人精品| 亚洲欧洲美洲综合色网| 这里只有精品99re| 波多野结衣中文一区| 久久国产精品99久久人人澡| 亚洲伦理在线精品| 久久麻豆一区二区| 91精品国产入口在线| 91偷拍与自偷拍精品| 国产精品影视网| 蜜桃av一区二区三区| 一区二区三区中文字幕精品精品| 久久久午夜精品理论片中文字幕| 欧美日韩精品一区二区在线播放| 国产成人精品影院| 蜜桃视频第一区免费观看| 亚洲图片一区二区| 国产精品视频九色porn| www国产精品av| 精品国精品国产尤物美女| 欧美日韩一卡二卡| 在线视频国内一区二区| 成人av在线一区二区三区| 国产在线播放一区二区三区| 免费观看一级特黄欧美大片| 亚洲成a人片在线观看中文| 国产精品欧美一区喷水| 欧美高清一级片在线观看| 欧美精品一区二区三区蜜桃| 日韩精品一区二区三区三区免费| 7777精品伊人久久久大香线蕉的| 欧美美女喷水视频| 色婷婷国产精品| 色综合久久精品| 日本电影亚洲天堂一区| 99国产精品久久久久久久久久| av一区二区三区四区| 成人免费视频caoporn| 成人午夜视频网站| 国产99久久久久久免费看农村| 国产九色sp调教91| 国内成人精品2018免费看| 久久99热这里只有精品| 美女免费视频一区| 久久国内精品自在自线400部| 青娱乐精品视频在线| 麻豆91精品91久久久的内涵| 精品一二三四区| 国产激情一区二区三区四区| 成人午夜视频在线| 91在线免费看| 欧美视频在线一区| 欧美日韩精品一区二区在线播放| 日韩一区国产二区欧美三区| 久久九九久久九九| 国产精品理伦片| 亚洲成av人片一区二区梦乃| 亚洲风情在线资源站| 久久99精品久久久久久动态图| 国产精品影视网| 色呦呦一区二区三区| 欧美日韩午夜在线视频| 日韩精品自拍偷拍| 国产肉丝袜一区二区| 亚洲人一二三区| 天堂蜜桃91精品| 国产一区91精品张津瑜| kk眼镜猥琐国模调教系列一区二区| 色吧成人激情小说| 制服丝袜中文字幕亚洲| 国产欧美日韩在线| 亚洲激情男女视频| 免费成人结看片| 99视频一区二区| 欧美一区二区大片| 国产欧美一区二区三区网站 | 亚洲电影第三页| 麻豆精品新av中文字幕| 成人免费视频一区| 欧美精品日韩一本| 国产日产欧美一区| 婷婷激情综合网| 成人黄页在线观看| 欧美一区二区三区视频免费| 国产精品区一区二区三区| 亚洲高清视频中文字幕| 国产福利精品导航| 欧美偷拍一区二区| 国产精品美女一区二区在线观看| 免费成人性网站| 在线观看日韩av先锋影音电影院| 欧美激情一区二区三区四区| 奇米在线7777在线精品| 91丨porny丨最新| 久久蜜桃av一区二区天堂| 亚洲福利电影网| 色嗨嗨av一区二区三区| 中文字幕第一页久久| 精品无人码麻豆乱码1区2区 | 欧美三级日韩在线| 欧美激情资源网| 九九国产精品视频| 欧美日韩在线播放三区四区| 亚洲欧洲日韩av| 国产风韵犹存在线视精品| 91精品免费在线| 亚洲成va人在线观看| 色综合网色综合| 国产精品久久久久影院亚瑟 | 国产成人在线网站| 欧美一区二区三区人| 亚洲精品日韩综合观看成人91| 成人av高清在线| 欧美激情综合网| 岛国精品在线观看| 欧美精品一区二区在线观看| 久久99久久精品| 日韩一区二区三区三四区视频在线观看| 亚洲成人av一区二区三区| 欧美视频中文字幕| 亚洲高清视频中文字幕| 欧美日韩精品欧美日韩精品|