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

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

?? i2c.c

?? Stellaris公司推出1美元ARM,這是Stellaris驅(qū)動庫源程序
?? 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 920 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);

    //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美少妇xxx| 91麻豆精品国产无毒不卡在线观看 | 国产成人精品一区二区三区四区| √…a在线天堂一区| 日韩女优电影在线观看| 91女神在线视频| 国产毛片精品一区| 香蕉影视欧美成人| 亚洲视频免费在线观看| 国产欧美精品一区aⅴ影院 | 日本不卡高清视频| 亚洲美女偷拍久久| 国产欧美精品国产国产专区| 日韩免费一区二区| 欧美日韩一区二区在线视频| av资源站一区| 国产成人免费视频精品含羞草妖精| 五月天亚洲精品| 亚洲一区二区三区美女| 中文字幕一区二区三区乱码在线| 久久影院午夜片一区| 4438成人网| 欧美日韩夫妻久久| 欧美三级日韩三级国产三级| 91久久国产最好的精华液| 成人av在线播放网站| 高清在线成人网| 黄页视频在线91| 麻豆精品久久精品色综合| 日韩精品午夜视频| 亚瑟在线精品视频| 亚洲大片精品永久免费| 亚洲永久免费av| 亚洲在线视频免费观看| 亚洲免费色视频| 亚洲男人的天堂一区二区| 中文字幕一区二区在线观看| 中文字幕一区二区三区精华液| 中文av一区特黄| 国产精品久久久一本精品| 国产精品污www在线观看| 中文字幕国产一区二区| 国产精品三级av| 亚洲欧洲在线观看av| 亚洲欧洲综合另类| 亚洲主播在线观看| 午夜伊人狠狠久久| 麻豆精品一区二区综合av| 狠狠色丁香久久婷婷综合_中| 久久精品国产亚洲一区二区三区| 久久99精品久久久久婷婷| 激情小说欧美图片| 成人性生交大合| 色综合久久中文字幕| 精品视频一区二区三区免费| 日韩一区二区三区视频在线| 26uuu国产一区二区三区| 国产亲近乱来精品视频| 最新久久zyz资源站| 亚洲一区二区高清| 蜜臀91精品一区二区三区 | 成人手机电影网| 色婷婷亚洲一区二区三区| 欧美影院精品一区| 日韩一区二区三区三四区视频在线观看| 欧美sm极限捆绑bd| 亚洲欧洲av在线| 五月激情综合网| 国产一区二区在线看| 波多野结衣亚洲一区| 欧美三级日韩三级国产三级| 欧美大肚乱孕交hd孕妇| 欧美极品美女视频| 亚洲国产视频一区二区| 精品一区精品二区高清| 99久久久久久| 欧美一区三区二区| 欧美激情综合五月色丁香小说| 亚洲免费在线电影| 美女视频一区在线观看| www.视频一区| 欧美乱妇15p| 欧美国产精品久久| 五月天网站亚洲| 成人免费黄色在线| 欧美一激情一区二区三区| 欧美激情综合在线| 免费精品视频在线| 91麻豆成人久久精品二区三区| 日韩一区二区精品| 一区二区三区四区五区视频在线观看| 日韩不卡一二三区| 成人一道本在线| 日韩欧美123| 亚洲成人手机在线| 国产v综合v亚洲欧| 91精品国产综合久久精品| 国产精品免费视频观看| 免费视频一区二区| 欧美亚洲动漫制服丝袜| 中文字幕精品一区二区三区精品 | av成人动漫在线观看| 日韩欧美精品在线| 亚洲第一久久影院| 99久久精品久久久久久清纯| 精品成人佐山爱一区二区| 亚洲不卡一区二区三区| gogo大胆日本视频一区| 亚洲精品在线免费观看视频| 午夜影院在线观看欧美| 色av综合在线| 国产精品久久久一本精品| 国产又粗又猛又爽又黄91精品| 欧美精品乱码久久久久久| 亚洲精品日韩一| 成人免费高清视频| 国产午夜亚洲精品午夜鲁丝片| 日韩福利视频导航| 欧美三级中文字| 亚洲精品你懂的| 99精品久久99久久久久| 国产欧美精品区一区二区三区| 经典三级在线一区| 欧美一级理论片| 青青草国产精品97视觉盛宴| 欧美三级电影在线观看| 亚洲一区二区三区四区的| 91美女在线观看| 亚洲区小说区图片区qvod| 91在线精品秘密一区二区| 国产精品国产三级国产| 成人涩涩免费视频| 欧美激情一区二区三区| 成人福利视频网站| 国产精品久久久久9999吃药| 成人黄色软件下载| 国产精品色哟哟| 不卡视频在线看| 国产精品久久久久久亚洲毛片| 波多野结衣中文字幕一区二区三区| 国产欧美日韩久久| av激情成人网| 亚洲精品美腿丝袜| 欧美色电影在线| 视频一区二区中文字幕| 日韩精品中文字幕一区二区三区| 免播放器亚洲一区| 久久精品一二三| k8久久久一区二区三区| 亚洲欧美日韩国产另类专区| 色综合久久88色综合天天| 亚洲永久免费av| 欧美一区二区在线播放| 精品在线免费视频| 国产精品麻豆一区二区| 色欧美日韩亚洲| 日本怡春院一区二区| 久久久久久久久蜜桃| 成人黄动漫网站免费app| 一区二区三区美女| 欧美一级淫片007| 国产一区三区三区| 最好看的中文字幕久久| 欧美日韩午夜精品| 精品无人区卡一卡二卡三乱码免费卡| 欧美极品xxx| 欧美日韩综合不卡| 国产一区三区三区| 亚洲视频免费在线观看| 69堂国产成人免费视频| 国产精品一区二区三区网站| 亚洲欧美一区二区视频| 4438x亚洲最大成人网| 国产91丝袜在线观看| 有坂深雪av一区二区精品| 日韩欧美国产三级电影视频| av成人免费在线| 青青青爽久久午夜综合久久午夜| 国产欧美日产一区| 欧美久久婷婷综合色| 成人午夜精品在线| 午夜精品久久久久久不卡8050| 久久人人爽爽爽人久久久| 欧美性淫爽ww久久久久无| 国产成人综合网| 视频一区二区三区在线| 国产精品美女久久久久aⅴ| 日韩欧美中文字幕制服| 99精品黄色片免费大全| 极品少妇一区二区| 夜夜嗨av一区二区三区| 久久久国产午夜精品| 777色狠狠一区二区三区| 91在线精品一区二区三区| 国内精品伊人久久久久av一坑| 亚洲一本大道在线| 国产精品情趣视频| 精品美女被调教视频大全网站| 欧美性猛片xxxx免费看久爱| 国产不卡免费视频|