All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] cmd_onenand.c, onenand_block_read (...)
@ 2009-10-20 13:27 Tuma
  2009-10-20 16:29 ` Scott Wood
  2009-10-21  9:40 ` Tuma
  0 siblings, 2 replies; 3+ messages in thread
From: Tuma @ 2009-10-20 13:27 UTC (permalink / raw)
  To: u-boot

Hi, All!

It seems I have a trouble.
I want to use onenand_block_read function. So I've written a cover for it:

int OneNANDBlockRead (loff_t _from, ssize_t _len,
 ssize_t *_retlen, u_char *_buf, int _oob)
{
  int lRet;

  return lRet;
}

When I do from this fuction:
  printf ("Reading from: 0x%X, Length: 0x%X\n", _from, _len);
I get _len and _form swapped.
What's wrong?

I tryed to pass _from and _len as pointers - pointer addresses are correct but 
  printf ("Reading from: 0x%X\n", *_from);
  printf ("Reading Length: 0x%X\n", *_len);
return swapped result again.

This is how I call OneNANDBlockRead function:
static const ssize_t lLen = 0x20;
static const ulong lLT = 0x00260000;
OneNANDBlockRead (&lLT, &lLen, &retlen, lEnvironment, 0);


I don't understand it.
Can someone help me please.

Of course if you need some more information on my problem - you can ask me.


-- 
Software Developer
General Satellite Corp.

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

* [U-Boot] cmd_onenand.c, onenand_block_read (...)
  2009-10-20 13:27 [U-Boot] cmd_onenand.c, onenand_block_read (...) Tuma
@ 2009-10-20 16:29 ` Scott Wood
  2009-10-21  9:40 ` Tuma
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Wood @ 2009-10-20 16:29 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 20, 2009 at 05:27:04PM +0400, Tuma wrote:
> Hi, All!
> 
> It seems I have a trouble.
> I want to use onenand_block_read function. So I've written a cover for it:
> 
> int OneNANDBlockRead (loff_t _from, ssize_t _len,
>  ssize_t *_retlen, u_char *_buf, int _oob)
> {
>   int lRet;
> 
>   return lRet;
> }

You wrote a function that does nothing but return an uninitialized stack
value?

> When I do from this fuction:
>   printf ("Reading from: 0x%X, Length: 0x%X\n", _from, _len);
> I get _len and _form swapped.
> What's wrong?

For one, if that's the same _from as in OneNANDBlockRead, you're using the
wrong printf formats.  You need %llX for loff_t (you may want to cast to
unsigned long long just in case the type of loff_t varies), and %zX for
ssize_t. Please pay attention to complier warnings.

> I tryed to pass _from and _len as pointers - pointer addresses are correct but 
>   printf ("Reading from: 0x%X\n", *_from);
>   printf ("Reading Length: 0x%X\n", *_len);
> return swapped result again.
> 
> This is how I call OneNANDBlockRead function:
> static const ssize_t lLen = 0x20;
> static const ulong lLT = 0x00260000;
> OneNANDBlockRead (&lLT, &lLen, &retlen, lEnvironment, 0);

You're passing pointers to integer arguments.  Please pay attention to
compiler warnings.

-Scott

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

* [U-Boot] cmd_onenand.c, onenand_block_read (...)
  2009-10-20 13:27 [U-Boot] cmd_onenand.c, onenand_block_read (...) Tuma
  2009-10-20 16:29 ` Scott Wood
@ 2009-10-21  9:40 ` Tuma
  1 sibling, 0 replies; 3+ messages in thread
From: Tuma @ 2009-10-21  9:40 UTC (permalink / raw)
  To: u-boot

Sorry, that was just printf format error. =)
I've corrected everything, works fine.


On Tuesday 20 October 2009 17:27:04 Tuma wrote:
> Hi, All!
>
> It seems I have a trouble.
> I want to use onenand_block_read function. So I've written a cover for it:
>
> int OneNANDBlockRead (loff_t _from, ssize_t _len,
>  ssize_t *_retlen, u_char *_buf, int _oob)
> {
>   int lRet;
>
>   return lRet;
> }
>
> When I do from this fuction:
>   printf ("Reading from: 0x%X, Length: 0x%X\n", _from, _len);
> I get _len and _form swapped.
> What's wrong?
>
> I tryed to pass _from and _len as pointers - pointer addresses are correct
> but printf ("Reading from: 0x%X\n", *_from);
>   printf ("Reading Length: 0x%X\n", *_len);
> return swapped result again.
>
> This is how I call OneNANDBlockRead function:
> static const ssize_t lLen = 0x20;
> static const ulong lLT = 0x00260000;
> OneNANDBlockRead (&lLT, &lLen, &retlen, lEnvironment, 0);
>
>
> I don't understand it.
> Can someone help me please.
>
> Of course if you need some more information on my problem - you can ask me.



-- 
Software Developer
General Satellite Corp.

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

end of thread, other threads:[~2009-10-21  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 13:27 [U-Boot] cmd_onenand.c, onenand_block_read (...) Tuma
2009-10-20 16:29 ` Scott Wood
2009-10-21  9:40 ` Tuma

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.