public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] hi, I could not understand the memsize.c, somebody help  me?
Date: Mon, 29 Jun 2009 13:54:42 +0200	[thread overview]
Message-ID: <m2vdmf2r25.fsf@ohwell.denx.de> (raw)
In-Reply-To: <2ae8403e0906290154s216ea12atc5cdbe688f2cb49b@mail.gmail.com> (iamaplayer@gmail.com's message of "Mon, 29 Jun 2009 16:54:52 +0800")

Hi,

> thanks for your reply.
> sorry for my ability of writing and understanding the code
> =D
>
> btw, How contribute my idea of this function, I means, it should be more
> ?clean or easy just like this:
>
>
> unsigned long get_ram_size(volatile long *base, long maxsize)
> {
>
> ??????? unsigned long mem;
> ??????? for (mem = (*base); mem < (maxsize); mem <<= 1)) {
> ??????????????? if (*(unsigned long *)((unsigned long)(get_ram_size) + mem) ==
> ??????????????????? *(unsigned long *)(get_ram_size))
> ??????????????????????? break;
> ??????? }
> }

This will not work at all, sorry .  Before suggesting changes which
should be "more clean or easy", at least test them on real hardware.
You will find out that this code has lots of errors.

Some hints: 

SW: What addresses is the original code accessing?  What addresses are
    you accessing?  What values do you expect there?

HW: How does the algorithm in get_ram_size work at all?  What
    transactions does it produce on the CPU busses?  What transactions
    will your code produce?  Do you know what the CPU will do if it
    accesses RAM that is not available?

Please believe me, there is definitely *quite a bit* of understanding of
hard- and software in the current code.  If you do not know what the
questions above mean, it is highly unlikely that you can improve the
code.

Best wishes
  Detlev

-- 
Thanks so much for Emacs.  What a wondrous system -- one of the real
seven wonders of the world.  Forced to choose between Emacs and, say,
any pyramid, I'd take Emacs.       -- Robert Boyer
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

  reply	other threads:[~2009-06-29 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25  3:14 [U-Boot] hi, I could not understand the memsize.c, somebody help me? IaMaPlAyEr
2009-06-25 12:56 ` Detlev Zundel
2009-06-29  8:54   ` IaMaPlAyEr
2009-06-29 11:54     ` Detlev Zundel [this message]
2009-06-30  2:53       ` IaMaPlAyEr
2009-06-30 13:50         ` Detlev Zundel
2009-07-24  6:11 ` Wolfgang Denk
2009-07-24 14:31   ` Aggrwal Poonam-B10812
2009-07-24 15:13     ` Detlev Zundel
2009-07-24 15:21     ` Kenneth Johansson

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=m2vdmf2r25.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --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