All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] probably bug in ds1621.c
@ 2003-07-02  5:42 Palkin Andrey
  2003-07-14 10:59 ` [U-Boot-Users] " Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Palkin Andrey @ 2003-07-02  5:42 UTC (permalink / raw)
  To: u-boot

In dtt/ds1621.c file:

1.
int dtt_write(int sensor, int reg, int val)
{
    int dlen;
    uchar data[2];

    /*
     * Calculate sensor address and register.
     *
     */
    sensor = DTT_I2C_DEV_CODE + (sensor & sensor);

I think it should be:

int dtt_write(int sensor, int reg, int val)
{
    int dlen;
    uchar data[2];

    /*
     * Calculate sensor address and register.
     *
     */
    sensor = DTT_I2C_DEV_CODE + (sensor & 0x07);


2.
    else if ((reg == DTT_WRITE_START_CONV) || (reg == DTT_WRITE_STOP_CONV)) {
        dlen = 0;
        data[0] = (char)0;
        data[1] = (char)0;
    }

I think it should be:

    else if ((reg == DTT_WRITE_START_CONV) || (reg == DTT_WRITE_STOP_CONV)) {
        dlen = 1;
        data[0] = (char)0;
        data[1] = (char)0;
    }

differently MPC8260 I2C controller go in down

--
Palkin Andrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changes.diff
Type: application/octet-stream
Size: 656 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20030702/21468bc8/attachment.obj 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] Re: probably bug in ds1621.c
  2003-07-02  5:42 [U-Boot-Users] probably bug in ds1621.c Palkin Andrey
@ 2003-07-14 10:59 ` Wolfgang Denk
  2003-07-17  2:18   ` Erik Theisen
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2003-07-14 10:59 UTC (permalink / raw)
  To: u-boot

Hello,

in message <3812591505.20030702114201@morion.ru> you wrote:
> 
> In dtt/ds1621.c file:
> 
> 1.
> int dtt_write(int sensor, int reg, int val)
> {
>     int dlen;
>     uchar data[2];
> 
>     /*
>      * Calculate sensor address and register.
>      *
>      */
>     sensor = DTT_I2C_DEV_CODE + (sensor & sensor);
> 
> I think it should be:
> 
> int dtt_write(int sensor, int reg, int val)
> {
>     int dlen;
>     uchar data[2];
> 
>     /*
>      * Calculate sensor address and register.
>      *
>      */
>     sensor = DTT_I2C_DEV_CODE + (sensor & 0x07);


I think you are right. Added.


> 2.
>     else if ((reg == DTT_WRITE_START_CONV) || (reg == DTT_WRITE_STOP_CONV)) {
>         dlen = 0;
>         data[0] = (char)0;
>         data[1] = (char)0;
>     }
> 
> I think it should be:
> 
>     else if ((reg == DTT_WRITE_START_CONV) || (reg == DTT_WRITE_STOP_CONV)) {
>         dlen = 1;
>         data[0] = (char)0;
>         data[1] = (char)0;
>     }
> 
> differently MPC8260 I2C controller go in down

I'm not sure about this one. Erik, maybe you can comment?  It's  your
code after all...

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
The day-to-day travails of the IBM programmer are so amusing to  most
of us who are fortunate enough never to have been one - like watching
Charlie Chaplin trying to cook a shoe.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] Re: probably bug in ds1621.c
  2003-07-14 10:59 ` [U-Boot-Users] " Wolfgang Denk
@ 2003-07-17  2:18   ` Erik Theisen
  2003-07-17  7:38     ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Theisen @ 2003-07-17  2:18 UTC (permalink / raw)
  To: u-boot

On Monday, Jul 14, 2003, at 06:59 US/Eastern, Wolfgang Denk wrote:

> Hello,
>
> in message <3812591505.20030702114201@morion.ru> you wrote:
>>
>> In dtt/ds1621.c file:
>>
>> 1.
>> int dtt_write(int sensor, int reg, int val)
>> {
>>     int dlen;
>>     uchar data[2];
>>
>>     /*
>>      * Calculate sensor address and register.
>>      *
>>      */
>>     sensor = DTT_I2C_DEV_CODE + (sensor & sensor);
>>
>> I think it should be:
>>
>> int dtt_write(int sensor, int reg, int val)
>> {
>>     int dlen;
>>     uchar data[2];
>>
>>     /*
>>      * Calculate sensor address and register.
>>      *
>>      */
>>     sensor = DTT_I2C_DEV_CODE + (sensor & 0x07);
>
>
> I think you are right. Added.
>
>
>> 2.
>>     else if ((reg == DTT_WRITE_START_CONV) || (reg == 
>> DTT_WRITE_STOP_CONV)) {
>>         dlen = 0;
>>         data[0] = (char)0;
>>         data[1] = (char)0;
>>     }
>>
>> I think it should be:
>>
>>     else if ((reg == DTT_WRITE_START_CONV) || (reg == 
>> DTT_WRITE_STOP_CONV)) {
>>         dlen = 1;
>>         data[0] = (char)0;
>>         data[1] = (char)0;
>>     }
>>
>> differently MPC8260 I2C controller go in down
>
> I'm not sure about this one. Erik, maybe you can comment?  It's  your
> code after all...
>
> Best regards,
>
> Wolfgang Denk
>
> -- 
> Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
> Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
> The day-to-day travails of the IBM programmer are so amusing to  most
> of us who are fortunate enough never to have been one - like watching
> Charlie Chaplin trying to cook a shoe.
>

Sorry folks,

I've been quite busy lately with several new hardware designs.

Now to the issues:

#1 - Yes it is a bug

#2 - I believe the dlen of 0 is correct as it stands. The DS1621 has a 
special start
and stop conversion "command".  This has a  data length of 0.

If someone is trying these routines on non 405 hardware, the code may 
require
some adjustment due to minor differences in the low level I2C routines.

Erik

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] Re: probably bug in ds1621.c
  2003-07-17  2:18   ` Erik Theisen
@ 2003-07-17  7:38     ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2003-07-17  7:38 UTC (permalink / raw)
  To: u-boot

Dear Erik,

in message <EF650850-B7FC-11D7-86FA-000393DC6DE0@mindspring.com> you wrote:
> 
> I've been quite busy lately with several new hardware designs.

Guess where I heard this before ;-)

> Now to the issues:
> 
> #1 - Yes it is a bug

Thanks for the confirmation.

> #2 - I believe the dlen of 0 is correct as it stands. The DS1621 has a 
> special start
> and stop conversion "command".  This has a  data length of 0.

This was what I thought from reading the code and the comments.

> If someone is trying these routines on non 405 hardware, the code may 
> require
> some adjustment due to minor differences in the low level I2C routines.

Andrey - which hardware are you using?

I understand that this code as is did not  work  for  you,  and  your
modification made it work?

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Horses just naturally have mohawk haircuts.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-17  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02  5:42 [U-Boot-Users] probably bug in ds1621.c Palkin Andrey
2003-07-14 10:59 ` [U-Boot-Users] " Wolfgang Denk
2003-07-17  2:18   ` Erik Theisen
2003-07-17  7:38     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.