[U-Boot] dfu: make data buffer size configurable
Pantelis Antoniou
panto at antoniou-consulting.com
Tue Jun 4 12:08:52 CEST 2013
Hi Heiko,
Just thinking out loud here. Can we have an extra option that
allocates the buffer dynamically based on an env variable?
Regards
-- Pantelis
On Jun 4, 2013, at 12:22 PM, Heiko Schocher wrote:
> Dfu transfer uses a buffer before writing data to the
> raw storage device. Make the size (in bytes) of this buffer
> configurable.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> Cc: Pantelis Antoniou <panto at antoniou-consulting.com>
> Cc: Tom Rini <trini at ti.com>
> Cc: Lukasz Majewski <l.majewski at samsung.com>
> Cc: Kyungmin Park <kyungmin.park at samsung.com>
> Cc: Marek Vasut <marex at denx.de>
> ---
> README | 5 +++++
> drivers/dfu/dfu.c | 2 +-
> include/dfu.h | 4 +++-
> 3 Dateien geändert, 9 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
>
> diff --git a/README b/README
> index b1b3e17..8550f34 100644
> --- a/README
> +++ b/README
> @@ -1360,6 +1360,11 @@ The following options need to be configured:
> CONFIG_DFU_NAND
> This enables support for exposing NAND devices via DFU.
>
> + CONFIG_SYS_DFU_DATA_BUF_SIZE
> + Dfu transfer uses a buffer before writing data to the
> + raw storage device. Make the size (in bytes) of this buffer
> + configurable.
> +
> CONFIG_SYS_DFU_MAX_FILE_SIZE
> When updating files rather than the raw storage device,
> we use a static buffer to copy the file into and then write
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index 6af6890..fe3a36e 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -42,7 +42,7 @@ static int dfu_find_alt_num(const char *s)
> }
>
> static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
> - dfu_buf[DFU_DATA_BUF_SIZE];
> + dfu_buf[CONFIG_SYS_DFU_DATA_BUF_SIZE];
>
> static int dfu_write_buffer_drain(struct dfu_entity *dfu)
> {
> diff --git a/include/dfu.h b/include/dfu.h
> index a107f4b..124653c 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -68,7 +68,9 @@ static inline unsigned int get_mmc_blk_size(int dev)
>
> #define DFU_NAME_SIZE 32
> #define DFU_CMD_BUF_SIZE 128
> -#define DFU_DATA_BUF_SIZE (1024*1024*8) /* 8 MiB */
> +#ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
> +#define CONFIG_SYS_DFU_DATA_BUF_SIZE (1024*1024*8) /* 8 MiB */
> +#endif
> #ifndef CONFIG_SYS_DFU_MAX_FILE_SIZE
> #define CONFIG_SYS_DFU_MAX_FILE_SIZE (4 << 20) /* 4 MiB */
> #endif
> --
> 1.7.11.7
>
More information about the U-Boot
mailing list