On Tuesday 19 May 2009 12:54:31 Raúl Sánchez Siles wrote:
>   Hello:
>
>   This is my first try to implement the x16_as_x8 flash bank option. It is
> working for me as I would expect flash to work, but please consider this
> patchset as work in progress since it may still has some flaws.
>
>   Al patches touch just src/flash/cfi.c file and should apply in this order
> to trunk.
>
>   The patchset consists of 4 patches, whose interest areas I
> explain and comment below:
>
> 02-x16_as_x8-command_address
>   · Creation of a command_address function intended as flash addresses
> arranger depending on the x16_as_x8 parameter existence or not. This is
> basically an override of flash_address function, only that takes into
> account the x16_as_x8 parameter. The other options for this functionality
> would be adding an additional parameter to flash_address function or, if it
> is shown that it is an equivalent of flash_address, include x16_as_x8
> functionality into flash_address.
>

-- 
Raúl Sánchez Siles

Departamento de Montaje

INFOGLOBAL, S. A.

* C/ Virgilio, 2. Ciudad de la Imagen.
28223 Pozuelo de Alarcón (Madrid), España
* T: +34 91 506 40 00
* F: +34 91 506 40 01


--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -127,6 +127,26 @@
 
 }
 
+/* inline u32 command_address(flash_bank_t *bank, int sector, u32 offset) */
+static __inline__ u32 command_address(flash_bank_t *bank, int sector, u32 offset)
+{
+	cfi_flash_bank_t *cfi_info = bank->driver_priv;
+
+	/* while the sector list isn't built, only accesses to sector 0 work */
+	if (sector == 0)
+		return bank->base + (offset * bank->bus_width << cfi_info->x16_as_x8 );
+	else
+	{
+		if (!bank->sectors)
+		{
+			LOG_ERROR("BUG: sector list not yet built");
+			exit(-1);
+		}
+		return bank->base + bank->sectors[sector].offset + (offset * bank->bus_width << cfi_info->x16_as_x8 );
+	}
+
+}
+
 static void cfi_command(flash_bank_t *bank, u8 cmd, u8 *cmd_buf)
 {
 	int i;
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to