From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: linuxppc-embedded@ozlabs.org
Cc: Sachin Rane <SRane@alphion.com>
Subject: Re: I2C: Getting Compiation Error for application program
Date: Thu, 21 Sep 2006 11:13:15 +0200 [thread overview]
Message-ID: <200609211113.15457.matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <8584FDC94AFF7640B17B8A89B23B19B34F6571@sbsserver.AlphionCorp.local>
On Wednesday 20 September 2006 14:51, Sachin Rane wrote:
> Hi,
>
> I am trying to compile simple program (appended), but getting lots of
compilation error.
It's always helpful to see the compiler output. Could you post it?
> I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
>
> Command used for compilation:
> $> gcc eeprom-client.c -o eeprom-client.o
Are you crosscompiling? Doesn't look like that...
>
> Could you help me to find out the reason behind getting the errors?
>
> Regards,
> Sachin Rane
>
>
>
8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
>
> #include <linux/i2c.h>
> #include <linux/i2c-dev.h>
>
> int main()
> {
> int file;
> int adapter_nr = 0; /* probably dynamically determined */
> char filename[20];
> int addr = 0xA1; /* The I2C address */
You propably have to use 0x50 here.
>
> sprintf(filename,"/dev/i2c-%d",adapter_nr);
> if ((file = open(filename,O_RDWR)) < 0)
> {
> exit(1);
> }
>
> if (ioctl(file,I2C_SLAVE,addr) < 0)
> {
> exit(1);
> }
> else
> {
> printf("\n Able to bind the adapter");
> }
> return 0;
> }
Matthias
next prev parent reply other threads:[~2006-09-21 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-20 12:51 I2C: Getting Compiation Error for application program Sachin Rane
2006-09-21 9:13 ` Matthias Fuchs [this message]
2006-09-21 11:10 ` Sachin Rane
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=200609211113.15457.matthias.fuchs@esd-electronics.com \
--to=matthias.fuchs@esd-electronics.com \
--cc=SRane@alphion.com \
--cc=linuxppc-embedded@ozlabs.org \
/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;
as well as URLs for NNTP newsgroup(s).