/* $Id$ */
/** @file
*/
/*
* Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*
This code is based on:
I2C Bus implementation upon CirrusLogic.
Copyright (c) 2008 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include "VBoxVga.h"
#include "VBoxVgaI2c.h"
#define I2CCLK_OUT 0
/**
PCI I/O byte write function.
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param Address The bit map of I2C Data or I2C Clock pins.
@param Data The date to write.
**/
I2cOutb (
)
{
1,
&Data
);
}
/**
PCI I/O byte read function.
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param Address The bit map of I2C Data or I2C Clock pins.
return byte value read from PCI I/O space.
**/
I2cInb (
)
{
1,
&Data
);
return Data;
}
/**
Read status of I2C Data and I2C Clock Pins.
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param Blt The bit map of I2C Data or I2C Clock pins.
@retval 0 Low on I2C Data or I2C Clock Pin.
@retval 1 High on I2C Data or I2C Clock Pin.
**/
)
{
}
/**
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param Blt The bit map to controller I2C Data or I2C Clock pins.
@param Value 1 or 0 stands for Set or Clear I2C Data and I2C Clock Pins.
**/
)
{
return;
}
/**
**/
I2cDelay (
)
{
}
/**
Write a 8-bit data onto I2C Data Pin.
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param Data The byte data to write.
**/
)
{
//
// Send byte data onto I2C Bus
//
I2cDelay ();
}
}
/**
Read a 8-bit data from I2C Data Pin.
@param PciIo The pointer to PCI_IO_PROTOCOL.
Return the byte data read from I2C Data Pin.
**/
)
{
Data = 0;
//
// Read byte data from I2C Bus
//
I2cDelay ();
}
return Data;
}
/**
Receive an ACK signal from I2C Bus.
@param PciIo The pointer to PCI_IO_PROTOCOL.
**/
)
{
//
// Wait for ACK signal
//
I2cDelay ();
return TRUE;
} else {
return FALSE;
}
}
/**
Send an ACK signal onto I2C Bus.
@param PciIo The pointer to PCI_IO_PROTOCOL.
**/
)
{
}
/**
Start a I2C transfer on I2C Bus.
@param PciIo The pointer to PCI_IO_PROTOCOL.
**/
I2cStart (
)
{
//
// Init CLK and DAT pins
//
//
// Start a I2C transfer, set SDA low from high, when SCL is high
//
}
/**
Stop a I2C transfer on I2C Bus.
@param PciIo The pointer to PCI_IO_PROTOCOL.
**/
I2cStop (
)
{
//
// Stop a I2C transfer, set SDA high from low, when SCL is high
//
}
/**
Read one byte data on I2C Bus.
Read one byte data from the slave device connected to I2C Bus.
If Data is NULL, then ASSERT().
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param DeviceAddress Slave device's address.
@param RegisterAddress The register address on slave device.
@param Data The pointer to returned data if EFI_SUCCESS returned.
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
)
{
//
// Start I2C transfer
//
//
// Send slave address with enabling write flag
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Send register address
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Send slave address with enabling read flag
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Read byte data from I2C Bus
//
//
// Send ACK signal onto I2C Bus
//
I2cSendAck (PciIo);
//
// Stop a I2C transfer
//
return EFI_SUCCESS;
}
/**
Write one byte data onto I2C Bus.
Write one byte data to the slave device connected to I2C Bus.
If Data is NULL, then ASSERT().
@param PciIo The pointer to PCI_IO_PROTOCOL.
@param DeviceAddress Slave device's address.
@param RegisterAddress The register address on slave device.
@param Data The pointer to write data.
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
)
{
//
// Send slave address with enabling write flag
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Send register address
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Send byte data onto I2C Bus
//
//
// Wait for ACK signal
//
return EFI_DEVICE_ERROR;
}
//
// Stop a I2C transfer
//
return EFI_SUCCESS;
}