From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tolunay Orkun Date: Mon, 16 Oct 2006 15:45:56 -0500 Subject: [U-Boot-Users] Adding new commands In-Reply-To: <20061016200628.E6AC6353DB7@atlas.denx.de> References: <20061016200628.E6AC6353DB7@atlas.denx.de> Message-ID: <4533EF84.4020608@orkun.us> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.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 #endif Use this: #if IS_CONFIG_COMMAND(CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #include #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