[flashrom] [PATCH 5/5] Let the dummy programmer emulate SPI payload limitations.

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Oct 15 22:35:22 CEST 2012


Am 03.10.2012 06:13 schrieb Stefan Tauner:
> --- a/dummyflasher.c
> +++ b/dummyflasher.c
> @@ -119,7 +119,7 @@ static uint32_t dummy_chip_readl(const struct flashctx *flash,
>  static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf,
>  			     const chipaddr addr, size_t len);
>  
> -static const struct spi_programmer spi_programmer_dummyflasher = {
> +static struct spi_programmer spi_programmer_dummyflasher = {
>  	.type		= SPI_CONTROLLER_DUMMY,
>  	.max_data_read	= MAX_DATA_READ_UNLIMITED,
>  	.max_data_write	= MAX_DATA_UNSPECIFIED,
> @@ -373,6 +373,19 @@ int dummy_init(void)
>  		msg_pdbg("Initial status register is set to 0x%02x.\n",
>  			 emu_status);
>  	}
> +	tmp = extract_programmer_param("spi_prog");
> +	if (tmp) {
> +		if (!strcmp(tmp, "wbsio")) {
> +			spi_programmer_dummyflasher.check_trans = wbsio_spi_check_trans;

This will cause compile failures if CONFIG_INTERNAL=no
A similar #ifdef guard is needed for the programmer.h chunk unless we
decide that it's ok to have prototypes for unavailable functions.

> +			msg_pdbg("Using SPI payload limitations of the %s programmer.\n", tmp);
> +		} else {
> +			msg_perr("Error: emulation of a programmer requested, "
> +				 "but the programmer could not be parsed \"%s\".\n", tmp);
> +			free(tmp);
> +			return 1;
> +		}
> +	}
> +	free(tmp);
>  #endif
>  
>  	msg_pdbg("Filling fake flash chip with 0xff, size %i\n", emu_chip_size);

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list