Changeset 579 for trunk/dummyflasher.c


Ignore:
Timestamp:
Jun 5, 2009 8:32:07 PM (4 years ago)
Author:
hailfinger
Message:

Sometimes we want to read/write more than 4 bytes of chip content at
once.
Add chip_{read,write}n to the external flasher infrastructure which
read/write n bytes at once.

Fix a few places where the code used memcpy/memcmp although that is
strictly impossible with external flashers.
Place a FIXME in the layout.c code because usage is not totally clear
and needs to be fixed to support external flashers.

As a nice side benefit, we get a noticeable speedup for builtin flash
reading which is now a memcpy() of the full flash area instead of a
series of single-byte reads.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Urja Rannikko <urjaman@…>
Acked-by: Uwe Hermann <uwe@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dummyflasher.c

    r577 r579  
    104104} 
    105105 
     106void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len) 
     107{ 
     108        size_t i; 
     109        printf_debug("%s: addr=0x%lx, len=0x%08lx, writing data (hex):", 
     110                     __func__, addr, (unsigned long)len); 
     111        for (i = 0; i < len; i++) { 
     112                if ((i % 16) == 0) 
     113                        printf_debug("\n"); 
     114                printf_debug("%02x ", buf[i]) 
     115        } 
     116} 
     117 
    106118uint8_t dummy_chip_readb(const chipaddr addr) 
    107119{ 
     
    120132        printf_debug("%s:  addr=0x%lx, returning 0xffffffff\n", __func__, addr); 
    121133        return 0xffffffff; 
     134} 
     135 
     136void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len) 
     137{ 
     138        printf_debug("%s:  addr=0x%lx, len=0x%lx, returning array of 0xff\n", 
     139                     __func__, addr, (unsigned long)len); 
     140        memset(buf, 0xff, len); 
     141        return; 
    122142} 
    123143 
Note: See TracChangeset for help on using the changeset viewer.