All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] cmd_onenand.c, onenand_block_read (...)
Date: Tue, 20 Oct 2009 11:29:34 -0500	[thread overview]
Message-ID: <20091020162934.GA9991@loki.buserror.net> (raw)
In-Reply-To: <200910201727.04299.chernigovskiy@spb.gs.ru>

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

  reply	other threads:[~2009-10-20 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 13:27 [U-Boot] cmd_onenand.c, onenand_block_read (...) Tuma
2009-10-20 16:29 ` Scott Wood [this message]
2009-10-21  9:40 ` Tuma

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=20091020162934.GA9991@loki.buserror.net \
    --to=scottwood@freescale.com \
    --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 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.