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

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

?? i2c.c

?? 開源實時操作系統
?? 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一区二区三区免费野_久草精品视频
日韩精品五月天| 欧美日韩高清一区二区不卡| 精品福利一二区| 1024国产精品| 高清shemale亚洲人妖| 26uuu另类欧美亚洲曰本| 免费观看30秒视频久久| 欧美日韩dvd在线观看| 日本亚洲最大的色成网站www| 欧美日韩在线电影| 婷婷丁香激情综合| 91精品国产乱| 全部av―极品视觉盛宴亚洲| 久久综合色婷婷| 国产99久久精品| 日韩精品一区国产麻豆| 蜜桃一区二区三区在线| 精品卡一卡二卡三卡四在线| 激情综合网激情| 国产色91在线| 国产黄人亚洲片| 亚洲自拍偷拍网站| 91精品午夜视频| 九九**精品视频免费播放| 久久蜜桃av一区精品变态类天堂 | 免费观看久久久4p| 精品裸体舞一区二区三区| 日本系列欧美系列| 欧美国产日韩一二三区| 色狠狠av一区二区三区| 亚洲国产成人精品视频| 欧美一区二区三区播放老司机| 美女爽到高潮91| 亚洲欧美日韩国产综合| 欧美喷水一区二区| 美女精品自拍一二三四| 欧美高清在线精品一区| 色狠狠一区二区| 欧美高清在线精品一区| 欧美一区二区网站| 丁香婷婷综合五月| 亚洲伊人伊色伊影伊综合网| 欧美成人艳星乳罩| 国产电影一区二区三区| 天堂va蜜桃一区二区三区漫画版| 精品久久久久久最新网址| 成人av高清在线| 天堂va蜜桃一区二区三区| 欧美激情中文字幕一区二区| 欧美日韩视频一区二区| 国产99精品视频| 天天影视色香欲综合网老头| 国产亚洲欧美在线| 91精品国产高清一区二区三区 | 一道本成人在线| 日本麻豆一区二区三区视频| 国产精品不卡视频| 在线不卡a资源高清| 成人网男人的天堂| 日韩激情中文字幕| 最新不卡av在线| 精品国产乱码久久久久久牛牛| 成人免费av在线| 国产一区二区三区在线观看免费 | 捆绑变态av一区二区三区| 亚洲一区二区欧美日韩| 成人欧美一区二区三区视频网页 | 亚洲一二三区在线观看| 日韩美女精品在线| 国产精品久久久久久久久动漫| 国产日韩欧美综合一区| 久久色在线观看| 久久久久久久久蜜桃| 久久亚洲综合色| 久久影音资源网| 国产夜色精品一区二区av| 久久婷婷国产综合国色天香| 久久久久久亚洲综合影院红桃| 日韩免费看网站| 欧美xxx久久| 久久综合99re88久久爱| 亚洲国产精品av| 综合久久综合久久| 一区二区三区在线观看动漫| 一区二区高清免费观看影视大全| 亚洲一区二区综合| 五月综合激情日本mⅴ| 日韩不卡手机在线v区| 精彩视频一区二区三区| 成人午夜激情片| 一本到不卡免费一区二区| 欧美色大人视频| 欧美久久久久久久久| 精品日韩在线观看| 欧美国产精品专区| 亚洲理论在线观看| 亚洲成va人在线观看| 激情文学综合插| 9人人澡人人爽人人精品| 91成人免费电影| 欧美一级一级性生活免费录像| 欧美电影免费观看高清完整版在线观看| 日韩欧美国产午夜精品| 国产目拍亚洲精品99久久精品| 亚洲激情网站免费观看| 日韩在线a电影| 风间由美中文字幕在线看视频国产欧美| 成人做爰69片免费看网站| 欧美亚洲另类激情小说| 久久综合网色—综合色88| 综合欧美亚洲日本| 毛片基地黄久久久久久天堂| 成人精品鲁一区一区二区| 91极品视觉盛宴| 久久综合狠狠综合久久激情| 亚洲夂夂婷婷色拍ww47| 精品一区二区三区在线观看国产| 97精品久久久午夜一区二区三区| 欧美精品一卡二卡| 国产精品区一区二区三区| 一区二区久久久久久| 国精品**一区二区三区在线蜜桃| 色视频成人在线观看免| 久久久国际精品| 天天综合天天综合色| 99久久精品国产毛片| 欧美大尺度电影在线| 亚洲综合免费观看高清在线观看| 韩日av一区二区| 欧美精品一级二级| 国产精品色噜噜| 极品少妇一区二区三区精品视频| 色av综合在线| 欧美国产一区视频在线观看| 美女高潮久久久| 欧美另类高清zo欧美| 中文字幕一区二区在线播放| 国模一区二区三区白浆| 91精品国产综合久久精品性色| 亚洲色图丝袜美腿| 国产一区欧美日韩| 91精品国产综合久久婷婷香蕉| 亚洲激情在线激情| www.在线成人| 中文字幕精品综合| 国产一区二区三区不卡在线观看| 欧美电影一区二区| 夜夜亚洲天天久久| 91丨porny丨首页| 国产精品亲子伦对白| 国产综合久久久久久鬼色| 日韩欧美一级二级三级久久久| 亚洲一区二区三区四区的| av影院午夜一区| 国产精品污www在线观看| 国产精品一二三在| 2021国产精品久久精品| 久久国产欧美日韩精品| 欧美一区二区视频观看视频| 五月激情综合色| 91精品久久久久久蜜臀| 日韩在线a电影| 日韩亚洲欧美中文三级| 欧美bbbbb| 欧美一级理论片| 美女一区二区视频| 日韩欧美电影一二三| 狠狠色综合色综合网络| 欧美哺乳videos| 国产一区二区三区综合| 中文字幕精品三区| 色综合天天综合在线视频| 亚洲免费成人av| 精品污污网站免费看| 一区二区成人在线视频| 欧美卡1卡2卡| 久久成人久久鬼色| 国产清纯在线一区二区www| 成人激情黄色小说| |精品福利一区二区三区| 色婷婷久久久亚洲一区二区三区| 亚洲综合在线视频| 欧美顶级少妇做爰| 国产精品一区二区果冻传媒| 亚洲欧洲国产日韩| 欧美亚洲国产怡红院影院| 日韩精品福利网| 精品99999| 一本色道**综合亚洲精品蜜桃冫| 五月天中文字幕一区二区| 欧美变态tickle挠乳网站| 国产成人精品一区二| 亚洲女女做受ⅹxx高潮| 欧美日韩激情一区二区三区| 久久99精品久久久久久国产越南| 久久精品日产第一区二区三区高清版| 99国产精品久久| 蜜臂av日日欢夜夜爽一区| 国产精品久久看| 欧美高清www午色夜在线视频|