On Thu, Jul 7, 2011 at 16:47, Jonathan Stroud wrote:
> +_URJ_BUS(spimem)

how about just plain "spi" ?

> +#define ASHIFT  ((bus_params_t *) bus->params)->ashift
> +#define DSHIFT  ((bus_params_t *) bus->params)->dshift

i'm not grasping why the shift info needs to be in the SPI bus layer.
could you elaborate on that ?

> +    bus = calloc (1, sizeof (urj_bus_t));
> +    if (!bus)
> +        return NULL;
> +
> +    bus = urj_bus_generic_new (chain, driver, sizeof (bus_params_t));

pretty sure that first calloc() should be deleted

> +    ASHIFT=1;
> +    DSHIFT=0;

spaces around the "="

> +            case 0:     // "auto"
> +                ASHIFT = 1;
> +                break;

we should be able to figure out the address shift based on the flash
type.  although every one

> +            case 0:     // "auto"
> +                DSHIFT = 1;
> +                break;

i think this means the default is 16bit ?  defaulting to 8bit is
probably safer (it's what i've always seen/used in my spi flash work).

> +    CS = SCK = MOSI = MISO = NULL;

i think the previous suggestion of defaulting to "CS", "SCK", "MOSI",
and "MISO" is missing

> +    if (!CS) {

uncuddle the braces

(there's a bunch more throughout the patch too)

> +    }
> +
> +
> +    return bus;

only one newline needed

> +    asize = (uint64_t)1<<asize;

spaces around the "<<"

> +        urj_part_set_signal (p, MOSI, 1, (data & (1 << i) ? 1 : 0 ));

no space before the ")" at the end

> +        spimem_write_byte( bus, (uint8_t)(adr >> (i * 8)));

space before the first "(" and not after

> +    for (i=0; i <= DSHIFT; i++) {

spaces around the "="

> +        spimem_write_byte (bus, (uint8_t)(data));

no need for the uint8_t cast

i'll have to review the spi flash driver independently.  there's quite
a bit to digest, and i think the current code is hardcoding
assumptions for a specific flash.
-mike

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to