亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一区二区三区在线视频观看| 亚洲激情自拍偷拍| 一本一道综合狠狠老| 午夜精品福利视频网站| 一区二区三区在线免费视频| 4438成人网| 成人av在线影院| 蜜乳av一区二区三区| 亚洲免费观看高清完整版在线观看 | 色噜噜狠狠成人中文综合| 蜜桃在线一区二区三区| 一区二区三区**美女毛片| 亚洲国产高清aⅴ视频| 欧美日韩三级在线| av在线不卡免费看| 国产综合色视频| 肉色丝袜一区二区| 亚洲欧美另类在线| 国产午夜精品福利| 精品国产亚洲一区二区三区在线观看 | 国产精品全国免费观看高清 | 国产精品久久久久婷婷| 日韩一二三四区| 欧美在线一区二区三区| 在线亚洲高清视频| 色视频成人在线观看免| 精品亚洲欧美一区| 日韩福利电影在线观看| 亚洲国产成人91porn| 亚洲一区二区视频在线观看| 国产精品初高中害羞小美女文| 久久―日本道色综合久久| 91精品国产麻豆国产自产在线| 欧美亚洲综合另类| 色综合 综合色| 在线看日韩精品电影| 色综合久久久网| 日本精品裸体写真集在线观看 | 一区二区三区四区亚洲| 亚洲欧美偷拍卡通变态| 亚洲视频一区二区免费在线观看| 欧美韩国日本不卡| 国产日韩三级在线| 欧美激情一区二区三区四区| 久久精品在这里| 久久久精品免费网站| 久久嫩草精品久久久久| 国产亚洲污的网站| 国产精品日韩精品欧美在线| 国产欧美一区二区在线| 欧美国产一区二区| 亚洲特级片在线| 亚洲欧美激情在线| 亚洲国产中文字幕在线视频综合 | 国产精品亚洲综合一区在线观看| 国产成人免费视频一区| 国产福利一区二区三区视频 | 欧美丰满少妇xxxxx高潮对白| 欧美群妇大交群中文字幕| 91精品在线观看入口| 欧美成人国产一区二区| 日本一区二区三区四区 | 极品瑜伽女神91| 国产成人免费视频精品含羞草妖精 | 秋霞电影网一区二区| 精一区二区三区| 成人黄色大片在线观看| 91麻豆产精品久久久久久| 欧美三级乱人伦电影| 日韩三级精品电影久久久 | 51久久夜色精品国产麻豆| 亚洲精品一区二区三区影院| 国产欧美精品国产国产专区| 亚洲免费观看高清完整版在线观看熊| 亚洲综合精品久久| 久久99精品视频| thepron国产精品| 欧美高清精品3d| 欧美国产禁国产网站cc| 亚洲成人av免费| 精品中文字幕一区二区| 99re这里都是精品| 日韩一级完整毛片| 国产精品毛片a∨一区二区三区 | 国产一区二区三区最好精华液 | 欧美一区二区三区在线| 国产女同性恋一区二区| 亚洲小少妇裸体bbw| 激情欧美日韩一区二区| 在线亚洲欧美专区二区| 精品日韩一区二区三区| 亚洲黄色片在线观看| 美女尤物国产一区| 色狠狠色狠狠综合| 国产亚洲一区字幕| 午夜视频一区二区| 成人午夜精品一区二区三区| 69av一区二区三区| 亚洲视频你懂的| 国产在线播精品第三| 欧美精三区欧美精三区| 国产精品国产三级国产普通话三级| 香蕉影视欧美成人| 99久久综合99久久综合网站| 精品国精品国产| 亚洲韩国精品一区| a在线播放不卡| 26uuu国产在线精品一区二区| 一区二区高清免费观看影视大全 | 制服丝袜成人动漫| 亚洲视频一二三区| 国产成人自拍在线| 欧美成人精品1314www| 亚洲高清免费视频| 91色.com| 国产精品美女久久久久aⅴ国产馆| 久久激情五月激情| 欧美日韩aaaaaa| 一区二区三区日韩在线观看| 成人黄色大片在线观看| 久久色在线观看| 美美哒免费高清在线观看视频一区二区 | 日韩一区欧美小说| 国内成人免费视频| 欧美mv和日韩mv国产网站| 亚洲国产综合人成综合网站| 3751色影院一区二区三区| 综合色中文字幕| 成人av在线播放网址| 久久久久99精品一区| 国产精品996| 久久久精品国产免大香伊| 国产一区二区三区av电影 | 亚洲欧美日韩国产中文在线| eeuss鲁一区二区三区| 中文字幕一区二区三中文字幕| 成人夜色视频网站在线观看| 国产欧美日韩一区二区三区在线观看| 国产精品99久久久| 中文字幕不卡在线| av毛片久久久久**hd| 亚洲精品国产无天堂网2021| 日本高清成人免费播放| 亚洲综合一区二区精品导航| 欧美性受xxxx| 日韩不卡一二三区| 日韩精品一区二区三区蜜臀| 国产一区 二区 三区一级| 久久亚洲二区三区| 丰满放荡岳乱妇91ww| 国产精品福利影院| 在线中文字幕一区| 亚洲第一久久影院| 日韩免费在线观看| 国产精品一色哟哟哟| 国产精品高潮久久久久无| 色婷婷久久99综合精品jk白丝| 一区二区三区四区高清精品免费观看| 在线亚洲一区二区| 午夜电影一区二区| 欧美一区二区福利在线| 精品一区二区三区在线播放视频| 精品久久久久久久久久久久包黑料| 毛片基地黄久久久久久天堂| 久久久亚洲综合| 91视频观看免费| 日本成人在线一区| 国产亚洲综合色| 在线日韩av片| 国产综合成人久久大片91| 国产情人综合久久777777| 色猫猫国产区一区二在线视频| 亚洲一区二区欧美日韩| 日韩美女一区二区三区四区| 成人免费av在线| 亚洲电影在线免费观看| 精品成人免费观看| 91蜜桃婷婷狠狠久久综合9色| 婷婷开心激情综合| 国产三级三级三级精品8ⅰ区| 99久久久精品免费观看国产蜜| 天使萌一区二区三区免费观看| 日韩三级.com| 色婷婷av一区二区三区软件| 午夜精品aaa| 日韩经典一区二区| 国产精品女同互慰在线看| 91精品国产综合久久蜜臀| 成人免费不卡视频| 蜜臀av一区二区| 一区二区三区日韩在线观看| 久久久国产午夜精品| 在线视频一区二区免费| 国产最新精品精品你懂的| 亚洲一区二区三区影院| 久久女同性恋中文字幕| 欧美日韩一区精品| 成人高清伦理免费影院在线观看| 热久久免费视频| 亚洲最大成人网4388xx|