is useful, if some of the configured banks are only
optionally available.
+- CONFIG_FLASH_SHOW_PROGRESS
+ If defined (must be an integer), print out countdown
+ digits and dots. Recommended value: 45 (9..1) for 80
+ column displays, 15 (3..1) for 40 column displays.
+
- CFG_RX_ETH_BUFFER:
Defines the number of ethernet receive buffers. On some
ethernet controllers it is recommended to set this value
return;
}
+/*-----------------------------------------------------------------------
+ * This is used in a few places in write_buf() to show programming
+ * progress. Making it a function is nasty because it needs to do side
+ * effect updates to digit and dots. Repeated code is nasty too, so
+ * we define it once here.
+ */
+#define FLASH_SHOW_PROGRESS(scale, dots, digit) \
+ if ((scale > 0) && (dots <= 0)) { \
+ if ((digit % 5) == 0) \
+ printf ("%d", digit / 5); \
+ else \
+ putc ('.'); \
+ digit--; \
+ dots += scale; \
+ }
+
/*-----------------------------------------------------------------------
* Copy memory to flash, returns:
* 0 - OK
int aln;
cfiword_t cword;
int i, rc;
-
#ifdef CFG_FLASH_USE_BUFFER_WRITE
int buffered_size;
#endif
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+ int digit = CONFIG_FLASH_SHOW_PROGRESS;
+ int scale = 0;
+ int dots = 0;
+
+ /*
+ * Suppress if there are fewer than CONFIG_FLASH_SHOW_PROGRESS writes.
+ */
+ if (cnt >= CONFIG_FLASH_SHOW_PROGRESS) {
+ scale = (int)((cnt + CONFIG_FLASH_SHOW_PROGRESS - 1) /
+ CONFIG_FLASH_SHOW_PROGRESS);
+ }
+#endif
+
/* get lower aligned address */
wp = (addr & ~(info->portwidth - 1));
return rc;
wp += i;
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+ dots -= i;
+ FLASH_SHOW_PROGRESS(scale, dots, digit);
+#endif
}
/* handle the aligned part */
wp += i;
src += i;
cnt -= i;
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+ dots -= i;
+ FLASH_SHOW_PROGRESS(scale, dots, digit);
+#endif
}
#else
while (cnt >= info->portwidth) {
return rc;
wp += info->portwidth;
cnt -= info->portwidth;
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+ dots -= info->portwidth;
+ FLASH_SHOW_PROGRESS(scale, dots, digit);
+#endif
}
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
+
if (cnt == 0) {
return (0);
}