All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tolunay Orkun <listmember@orkun.us>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Adding new commands
Date: Mon, 16 Oct 2006 15:45:56 -0500	[thread overview]
Message-ID: <4533EF84.4020608@orkun.us> (raw)
In-Reply-To: <20061016200628.E6AC6353DB7@atlas.denx.de>



Wolfgang Denk wrote:
> In message <453368A1.5050407@dave-tech.it> you wrote:
>> I have to add two new commands so I have to add something like this to 
>> cmd_confdefs.h:
>>
>> #define CFG_CMD_NEW1 0x8000000000000000ULL
>> #define CFG_CMD_NEW2 ???
>>
>> IIUC we have 64 bits available for the commands and 63 commands are 
>> already defined. So how to define more than 64 commands?
> 
> We have to rework this whole configuration setup.  At  the  moment  I
> don't have a good and quick solution available.
> 

One possibility is to get rid of existing bitmap scheme. A 
cmd_defaults.h would define all default CFG_COMMAND_XXX. And board 
configs would add remove commands by defining more or remove from 
defaults by undefining the corresponding macros after the inclusion of 
cmd_defaults.h.

Another quick solution would be to use Most Significant Bit as an 
expansion flag and use up to 63 more commands via CONFIG_COMMANDS2 macro.

The test logic will need to be modified but it could be wrapped to a 
macro like:

Instead of this:

#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
#include <rtc.h>
#endif

Use this:

#if IS_CONFIG_COMMAND(CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
#include <rtc.h>
#endif

And IS_CONFIG_COMMAND macro defined something like:

#define IS_CONFIG_COMMAND(x)	((x) & 0x8000000000000000ULL) ? \
				((x) & CONFIG_COMMANDS2) | \
				((x) & CONFIG_COMMANDS))

And if we get to 63+62=126 commands we can use next to MSB in 
CONFIG_COMMANDS2 as another expansion bit along with CONFIG_COMMANDS3 
(if we ever get that far).

Actually we do not even need to modify the existing (CONFIG_COMMAND & 
....) but any new configuration options needs to test for enabling via 
the new macro.

Best regards,
Tolunay

  parent reply	other threads:[~2006-10-16 20:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16 11:10 [U-Boot-Users] Adding new commands llandre
2006-10-16 11:48 ` Andreas Schweigstill
2006-10-16 18:09   ` Ulf Samuelsson
2006-10-16 20:06 ` Wolfgang Denk
2006-10-16 20:24   ` Ulf Samuelsson
2006-10-16 21:19     ` Wolfgang Denk
2006-10-16 20:45   ` Tolunay Orkun [this message]
2006-10-17  7:19   ` llandre
2006-10-17  9:57     ` Brent Cook
2006-10-17 10:35       ` llandre

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=4533EF84.4020608@orkun.us \
    --to=listmember@orkun.us \
    --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.