2006-02-05 16:52:22 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2007-02-27 21:22:29 +00:00
|
|
|
* PP502X and PP5002 I2C driver
|
|
|
|
*
|
|
|
|
* Based on code from the ipodlinux project - http://ipodlinux.org/
|
|
|
|
* Adapted for Rockbox in November 2005
|
|
|
|
*
|
|
|
|
* Original file: linux/arch/armnommu/mach-ipod/hardware.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
|
2006-02-05 16:52:22 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-02-05 16:52:22 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2007-01-27 20:09:57 +00:00
|
|
|
* PortalPlayer i2c driver
|
2006-02-05 16:52:22 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-01-27 20:09:57 +00:00
|
|
|
#ifndef _I2C_PP_H
|
|
|
|
#define _I2C_PP_H
|
2006-02-05 16:52:22 +00:00
|
|
|
|
2007-01-27 15:20:30 +00:00
|
|
|
#define I2C_CTRL (*(volatile unsigned char*)(I2C_BASE+0x00))
|
|
|
|
#define I2C_ADDR (*(volatile unsigned char*)(I2C_BASE+0x04))
|
|
|
|
#define I2C_DATA(X) (*(volatile unsigned char*)(I2C_BASE+0xc+(4*X)))
|
|
|
|
#define I2C_STATUS (*(volatile unsigned char*)(I2C_BASE+0x1c))
|
|
|
|
|
|
|
|
/* I2C_CTRL bit definitions */
|
|
|
|
#define I2C_SEND 0x80
|
|
|
|
|
|
|
|
/* I2C_STATUS bit definitions */
|
|
|
|
#define I2C_BUSY (1<<6)
|
|
|
|
|
2006-02-05 16:52:22 +00:00
|
|
|
/* TODO: Fully implement i2c driver */
|
|
|
|
|
2007-10-16 01:25:17 +00:00
|
|
|
/* To be used by drivers that need to do multiple i2c operations
|
|
|
|
atomically */
|
2007-11-12 07:58:54 +00:00
|
|
|
void i2c_lock(void);
|
|
|
|
void i2c_unlock(void);
|
2007-10-16 01:25:17 +00:00
|
|
|
|
2006-02-05 16:52:22 +00:00
|
|
|
void i2c_init(void);
|
|
|
|
int i2c_readbyte(unsigned int dev_addr, int addr);
|
2006-10-27 11:24:23 +00:00
|
|
|
int pp_i2c_send(unsigned int addr, int data0, int data1);
|
2006-03-09 19:47:12 +00:00
|
|
|
int i2c_readbytes(unsigned int dev_addr, int addr, int len, unsigned char *data);
|
2006-02-05 16:52:22 +00:00
|
|
|
|
|
|
|
#endif
|