⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cspi2c.c

📁 freescale i.mx31 BSP CE5.0全部源码
💻 C
字号:
//-----------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//-----------------------------------------------------------------------------
//
//  Copyright (C) 2004, Freescale Semiconductor, Inc. All Rights Reserved
//  THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
//  BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
//  Freescale Semiconductor, Inc.
//
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
//  File:  cspi2c.c
//
//  Provides SoC-specific configuration routines for
//  the I2C (Inter IC Communication).
//
//-----------------------------------------------------------------------------
#include <windows.h>
#include <nkintr.h>
#include <ceddk.h>
#include "csp.h"

//-----------------------------------------------------------------------------
// External Functions


//-----------------------------------------------------------------------------
// External Variables


//-----------------------------------------------------------------------------
// Defines


//-----------------------------------------------------------------------------
// Types


//-----------------------------------------------------------------------------
// Global Variables


//-----------------------------------------------------------------------------
// Local Variables


//-----------------------------------------------------------------------------
// Local Functions


//-----------------------------------------------------------------------------
//
// Function:  I2CGetBaseRegAddr
//
// This function returns the physical base address for the
// I2C registers based on the device index requested.
//
// Parameters:
//      index
//          [in] Index of the I2C device requested.
//
// Returns:
//      Physical base address for I2C registers, or 0 if an
//      invalid index was passed.
//
//-----------------------------------------------------------------------------
UINT32 I2CGetBaseRegAddr(UINT32 index)
{
    switch (index)
    {
        case 1:
            return CSP_BASE_REG_PA_I2C;
        case 2:
            return CSP_BASE_REG_PA_I2C2;
        case 3:
            return CSP_BASE_REG_PA_I2C3;
        default:
            return 0;
    }
}


//-----------------------------------------------------------------------------
//
// Function:  I2CGetIRQ
//
// This function returns the IRQ number for the
// I2C based on the device index requested.
//
// Parameters:
//      index
//          [in] Index of the I2C device requested.
//
// Returns:
//      IRQ number for I2C, or 0 if an
//      invalid index was passed.
//
//-----------------------------------------------------------------------------
UINT32 I2CGetIRQ(UINT32 index)
{
    switch (index)
    {
        case 1:
            return IRQ_I2C;
        case 2:
            return IRQ_I2C2;
        case 3:
            return IRQ_I2C3;
        default:
            return 0;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -