Skip to contentSkip to conversation

Fix loads command

RFC-PATCH Antony Pavlov 2 participants 3 messages Aug 21, 2011 – Aug 22, 2011

lore
Share & tools
lore
#0 lore raw
---
 commands/Kconfig  |    7 +-
 commands/Makefile |    1 -
 commands/loads.c  |  295 ++++++++++++++++++++++++++++++-----------------------
 common/Makefile   |    1 +
 4 files changed, 171 insertions(+), 133 deletions(-)
commands/Kconfig +5 -2
index 5c270a9..40b9cfe 100644
@@ -203,16 +203,19 @@ config CMD_LOADY
 	prompt "loady"
 
 config CMD_LOADS
-	depends on BROKEN
 	tristate
 	prompt "loads"
 
 config CMD_SAVES
-	depends on BROKEN
 	tristate
 	depends on CMD_LOADS
 	prompt "saves"
 
+config LOADS_BAUD_CHANGE
+	tristate
+	depends on CMD_LOADS
+	prompt "loads/saves baud change"
+
 config CMD_MEMINFO
 	tristate
 	prompt "meminfo"
commands/Makefile +0 -1
index d862ea5..07e0d3a 100644
@@ -5,7 +5,6 @@ obj-$(CONFIG_CMD_LOADY)		+= loadb.o xyzModem.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
-obj-$(CONFIG_CMD_LOADS)		+= s_record.o
 obj-$(CONFIG_CMD_MTEST)		+= memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
commands/loads.c +165 -130

514 lines not on this page · raw message

common/Makefile +1 -0
index 9fed2ae..74946e9 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_ENV_HANDLING)	+= environment.o
 obj-$(CONFIG_AUTO_COMPLETE)	+= complete.o
 obj-$(CONFIG_POLLER)		+= poller.o
 obj-$(CONFIG_BLOCK)		+= block.o
+obj-$(CONFIG_CMD_LOADS)		+= s_record.o
 
 obj-y += memory.o
 obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi Antony,

Quoted 7 lines · Antony Pavlov
---
 commands/Kconfig  |    7 +-
 commands/Makefile |    1 -
 commands/loads.c  |  295 ++++++++++++++++++++++++++++++-----------------------
 common/Makefile   |    1 +
 4 files changed, 171 insertions(+), 133 deletions(-)

There seem to be many whitespace cleanups in this patch. Can you please post a seperate patch for these for easier review?
I think the baudrate change can be made in unconditionally.

I don't know if you are interested in doing this and I don't mind at all if you don't, but for a full fixing of these commands I would suggest the following:

- There should be an internal C API for each load/save function for noninteractive use.
- Instead of writing to some sdram offset the commands should write to a file descriptor.
- There should be no more than one positional argument to each command.

A good start would be to cleanup the coding style and to make it compile again.

I just saw that you copied baudrate switching code from loadb.c. It tries to get the current baudrate with:

(int)simple_strtoul(dev_get_param(&cdev->class_dev, "baudrate"), NULL, 10);

I wonder if it wouldn't be simpler not to change the baudrate when no baudrate change is requested.

Another thing: since the loads stuff depends on broken and obviously was never used since U-Boot it would also be acceptable to remove it completely and to do a fresh start.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 13 lines · Sascha Hauer

Hi Antony,

Quoted 7 lines · Antony Pavlov

---
 commands/Kconfig  |    7 +-
 commands/Makefile |    1 -
 commands/loads.c  |  295 ++++++++++++++++++++++++++++++----------------------- common/Makefile   |    1 +

 4 files changed, 171 insertions(+), 133 deletions(-)

There seem to be many whitespace cleanups in this patch. Can you please post a seperate patch for these for easier review?

...

Quoted 2 lines

A good start would be to cleanup the coding style and to make it compile again.

I shall send the new patch series in a few minutes.

This patch series will make loads compile again and fix coding style / compiler's warning.

For simplicity baudrate switching code was removed.
We can add it in the future. Also it isn't very difficult to switch from direct memory writing to file descriptor writing.

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox