public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <monstr@seznam.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] I2C Dummy Driver
Date: Fri, 11 Jul 2008 08:30:26 +0200	[thread overview]
Message-ID: <4876FE02.7080802@seznam.cz> (raw)
In-Reply-To: <1215712408-23567-3-git-send-email-ricardo.ribalda@uam.es>

Clean coding style. http://www.denx.de/wiki/UBoot/CodingStyle


> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
>  drivers/i2c/Makefile    |    1 +
>  drivers/i2c/dummy_i2c.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 85 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/i2c/dummy_i2c.c
> 
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index 534c015..322c822 100644
> --- a/drivers/i2c/Makefile
> +++ b/drivers/i2c/Makefile
> @@ -30,6 +30,7 @@ COBJS-y += omap1510_i2c.o
>  COBJS-y += omap24xx_i2c.o
>  COBJS-y += tsi108_i2c.o
>  COBJS-y += mxc_i2c.o
> +COBJS-y += dummy_i2c.o
>  
>  COBJS	:= $(COBJS-y)
>  SRCS	:= $(COBJS:.o=.c)
> diff --git a/drivers/i2c/dummy_i2c.c b/drivers/i2c/dummy_i2c.c
> new file mode 100644
> index 0000000..04f6edb
> --- /dev/null
> +++ b/drivers/i2c/dummy_i2c.c
> @@ -0,0 +1,84 @@
> +/*   
> +    (C) Copyright 2008
> +    Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
> +    This work has been supported by: Q-Technology  http://qtec.com/
> +
> +    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 3 of the License, or
> +    (at your option) any later version.
> +
> +    This program is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +    GNU General Public License for more details.
> +
> +    You should have received a copy of the GNU General Public License
> +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#include <common.h>
> +
> +#if defined(CONFIG_DUMMY_I2C)
> +
> +
> +#include <i2c.h>
> +u8 i2c_dummy_buffer[256]={0x80,0x8,0x8,0x0D,0x0A,0x60,0x40,0x0,0x5,0x3D,0x50,0x0,0x82,0x10,0x0,0x0,0x0C,0x4,0x18,0x1,0x4,0x0,0x1,0x50,0x50,0x0,0x0,0x3C,0x28,0x3C,0x2D,0x40,0x25,0x37,0x10,0x22,0x3C,0x1E,0x1E,0x0,0x0,0x3C,0x69,0x80,0x1E,0x28,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x12,0xC9,0x2C,'0','0','0','0','0','0','0',0x0,'4','H','T','F','3','2','6','4','H','Y','-','5','3','E','D','3',0x3,0x0,0x0,0x0,0x0};
> +	
> +
> +
> +void i2c_init(int speed, int slaveaddr){
> +	return ;
> +}
> +
> +
> +
> +int
> +i2c_read(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +	int i;
> +	if (alen!=1)
> +		return -1;
> +
> +	if (addr+len>0xff)
> +		return -1;
> +
> +	for(i=0;i<len;i++){
> +		buffer[i]=i2c_dummy_buffer[i+addr];
> +	}
> +
> +	return 0;
> +
> +
> +}
> +
> +
> +int
> +i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
> +{
> +	int i;
> +	if (alen!=1)
> +		return -1;
> +	if (addr+len>0xff)
> +		return -1;
> +
> +	for(i=0;i<len;i++){
> +		i2c_dummy_buffer[i+addr]=buffer[i];
> +	}
> +
> +	return 0;
> +}
> +
> +
> +int
> +i2c_probe(uchar chip)
> +{
> +	return 0;
> +}
> +
> +
> +
> +
> +
> +#endif
> +

  parent reply	other threads:[~2008-07-11  6:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 17:53 [U-Boot-Users] Support for the ML507 Xilinx Board Ricardo Ribalda Delgado
2008-07-10 17:53 ` [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip Ricardo Ribalda Delgado
2008-07-10 17:53   ` [U-Boot-Users] [PATCH] I2C Dummy Driver Ricardo Ribalda Delgado
     [not found]     ` <1215712408-23567-4-git-send-email-ricardo.ribalda@uam.es>
     [not found]       ` <1215712408-23567-5-git-send-email-ricardo.ribalda@uam.es>
     [not found]         ` <1215712408-23567-6-git-send-email-ricardo.ribalda@uam.es>
2008-07-10 17:53           ` [U-Boot-Users] [PATCH] Adds support for the PPC440x5 Processor on Virtex5 FX Ricardo Ribalda Delgado
2008-07-10 17:53             ` [U-Boot-Users] [PATCH] Adds support for Xilinx Uart Lite on ppc4xx Ricardo Ribalda Delgado
2008-07-10 18:41               ` Wolfgang Denk
2008-07-10 18:52                 ` Ricardo Ribalda Delgado
2008-07-10 19:02                   ` Wolfgang Denk
2008-07-11  6:57                   ` Michal Simek
2008-07-11  6:30               ` Michal Simek
2008-07-11  7:12                 ` Wolfgang Denk
2008-07-10 18:36             ` [U-Boot-Users] [PATCH] Adds support for the PPC440x5 Processor on Virtex5 FX Wolfgang Denk
2008-07-10 18:45               ` Ricardo Ribalda Delgado
2008-07-10 18:11     ` [U-Boot-Users] [PATCH] I2C Dummy Driver Jerry Van Baren
2008-07-10 20:03     ` Wolfgang Denk
2008-07-10 21:02       ` Ricardo Ribalda Delgado
2008-07-11  6:59         ` Michal Simek
2008-07-11  9:03       ` Andre Schwarz
2008-07-11  6:30     ` Michal Simek [this message]
2008-07-10 18:10   ` [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip Jerry Van Baren
2008-07-10 18:16     ` Ricardo Ribalda Delgado
2008-07-10 18:32       ` Ricardo Ribalda Delgado
2008-07-10 18:57         ` Wolfgang Denk
2008-07-10 19:58   ` Wolfgang Denk
2008-07-10 21:04     ` Ricardo Ribalda Delgado
2008-07-11  6:49   ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4876FE02.7080802@seznam.cz \
    --to=monstr@seznam.cz \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox