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

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

?? i2c.c

?? freertosV4.40 是一種small的嵌入式系統。利于嵌入式開好者入門學習嵌入式操作系統。通過對于源碼的學習可以很好的掌握freertos的運行機制。
?? 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一区二区三区免费野_久草精品视频
不卡的av电影| 亚洲欧洲三级电影| 国产欧美精品一区| 亚洲三级免费电影| 五月天亚洲婷婷| 丰满少妇在线播放bd日韩电影| 成人网在线播放| 欧美精品vⅰdeose4hd| 国产欧美在线观看一区| 亚洲国产精品久久久久婷婷884| 老司机精品视频线观看86| 9久草视频在线视频精品| 制服丝袜国产精品| 国产精品女主播av| 欧美a一区二区| www.亚洲精品| 欧美日韩精品一区二区| 久久久久久久久久看片| 亚洲国产视频网站| 丰满白嫩尤物一区二区| 69堂成人精品免费视频| 国产日韩欧美精品综合| 五月婷婷激情综合| 成人av网址在线| 日韩午夜电影av| 亚洲免费在线电影| 亚洲成人高清在线| 精品国免费一区二区三区| 综合在线观看色| 久热成人在线视频| 色88888久久久久久影院野外| 精品日韩一区二区三区免费视频| 亚洲女人****多毛耸耸8| 精品一区二区综合| 欧美丝袜丝交足nylons| 中文字幕永久在线不卡| 久久aⅴ国产欧美74aaa| 欧美少妇xxx| 国产精品国产三级国产普通话99 | 国内成人精品2018免费看| 91久久奴性调教| 亚洲国产精品成人久久综合一区| 久久成人精品无人区| 欧美日韩国产美女| 亚洲男人的天堂在线观看| 国产高清成人在线| 欧美不卡在线视频| 天堂蜜桃91精品| 91九色02白丝porn| 国产精品久久久久精k8| 丁香网亚洲国际| 久久九九国产精品| 国内精品久久久久影院一蜜桃| 欧美视频精品在线观看| 亚洲一区二区在线播放相泽| 成年人国产精品| 国产亚洲一本大道中文在线| 精品在线一区二区三区| 日韩一区二区在线看| 图片区小说区区亚洲影院| 欧美日韩亚洲综合在线| 一区二区免费视频| 欧美亚洲图片小说| 亚洲成a人v欧美综合天堂| 欧美私模裸体表演在线观看| 亚洲网友自拍偷拍| 欧美三级中文字| 亚洲一二三四在线| 欧美军同video69gay| 亚洲v精品v日韩v欧美v专区| 欧美精品久久久久久久多人混战| 亚洲成人免费在线观看| 欧美日韩视频专区在线播放| 亚洲国产精品久久人人爱蜜臀| 欧美日韩激情一区二区| 亚洲成人av资源| 欧美一区二区三区影视| 蜜桃视频一区二区三区| 337p日本欧洲亚洲大胆色噜噜| 国产一区二区三区香蕉| 国产欧美日韩亚州综合 | 亚洲欧美日韩精品久久久久| 91美女片黄在线观看| 亚洲欧美另类综合偷拍| 在线观看不卡一区| 丝袜诱惑制服诱惑色一区在线观看| 91.com在线观看| 久久精品免费看| 中文字幕精品一区二区精品绿巨人| proumb性欧美在线观看| 亚洲黄色av一区| 91麻豆精品国产无毒不卡在线观看 | 精品一区二区三区影院在线午夜| 亚洲精品在线电影| 成人爱爱电影网址| 亚洲免费观看高清在线观看| 欧美日精品一区视频| 男女男精品网站| 久久精品视频在线免费观看| 99精品国产视频| 午夜视频一区二区| 精品对白一区国产伦| 不卡在线视频中文字幕| 亚洲一区影音先锋| 日韩欧美亚洲另类制服综合在线| 国产一区二区不卡在线| 亚洲视频一区二区在线观看| 欧美日韩大陆在线| 国产美女av一区二区三区| 亚洲色图欧美在线| 91精品国产综合久久精品| 国产高清精品网站| 亚洲第四色夜色| 国产午夜一区二区三区| 国产成人在线看| 中文字幕一区二区在线观看| 欧美日韩精品一区二区| 欧美日韩一区视频| 青青草国产精品亚洲专区无| 国产精品看片你懂得| 成人午夜又粗又硬又大| 中文字幕一区二区三区视频| 欧美一级高清片| 97久久精品人人澡人人爽| 本田岬高潮一区二区三区| 日韩精品成人一区二区在线| 亚洲国产精品成人综合色在线婷婷 | 国产成人综合在线| 一区二区三国产精华液| 国产亚洲成aⅴ人片在线观看 | 欧美一区二区视频在线观看2022| 精品一区二区三区av| 一区二区三区免费观看| 久久人人97超碰com| 久久综合久久鬼色| 欧美二区三区的天堂| aa级大片欧美| 国产又黄又大久久| 亚洲欧美一区二区久久| 欧美国产日韩精品免费观看| 欧美一级电影网站| 国产成人精品午夜视频免费| 亚洲精品亚洲人成人网在线播放| www国产精品av| 欧美一区二区三区精品| 欧美亚洲综合在线| 91污在线观看| 成人午夜在线免费| 国产一区二区三区免费| 蜜臀久久99精品久久久久久9| 一区二区三区四区在线免费观看 | 成人污视频在线观看| 久久69国产一区二区蜜臀| 国产区在线观看成人精品| 成人福利电影精品一区二区在线观看| 九一九一国产精品| 亚洲六月丁香色婷婷综合久久| 国产精品99久久久久久有的能看| 蜜桃一区二区三区在线| 视频一区二区国产| 韩日av一区二区| 精品在线一区二区三区| 麻豆成人久久精品二区三区小说| 中日韩av电影| 日韩理论片中文av| 亚洲成va人在线观看| 中文字幕国产精品一区二区| 久久综合色之久久综合| 国产精品视频免费看| 日韩一区二区在线观看| 91精品国产欧美一区二区18| 国产精品美女久久福利网站| 在线免费观看不卡av| 色88888久久久久久影院野外| 91免费精品国自产拍在线不卡| 成人黄色免费短视频| 不卡视频一二三| 91成人免费在线视频| 91日韩一区二区三区| 91丨国产丨九色丨pron| 欧美一区二区三区婷婷月色| 欧美大片在线观看一区二区| 日韩一区二区精品葵司在线| 日韩精品一区二区三区视频 | 久久99九九99精品| 青青草精品视频| 久久久精品综合| 成人深夜在线观看| 白白色 亚洲乱淫| 欧美一级欧美一级在线播放| 亚洲精品第一国产综合野| 国内一区二区在线| 免费观看成人av| 国产自产高清不卡| 亚洲精品中文在线影院| 国产精品高潮呻吟久久| 99久久99久久综合| 捆绑调教一区二区三区| 国产曰批免费观看久久久| 七七婷婷婷婷精品国产|