Changeset 111 for trunk/82802ab.c


Ignore:
Timestamp:
May 23, 2007 7:20:56 PM (6 years ago)
Author:
stepan
Message:

Original v2 revision: 2689

big cosmetic offensive on flashrom. (trivial)

  • Give decent names to virt_addr and virt_addr_2
  • add some comments
  • move virtual addresses to the end of the struct, so they dont mess up the initializer.

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Stefan Reinauer <stepan@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/82802ab.c

    r108 r111  
    4949int probe_82802ab(struct flashchip *flash) 
    5050{ 
    51         volatile uint8_t *bios = flash->virt_addr; 
     51        volatile uint8_t *bios = flash->virtual_memory; 
     52        volatile uint8_t *registers; 
    5253        uint8_t id1, id2; 
    5354 
     
    6667        id2 = *(volatile uint8_t *)(bios + 0x01); 
    6768 
    68 #if 1 
     69        /* Leave ID mode */ 
    6970        *(volatile uint8_t *)(bios + 0x5555) = 0xAA; 
    7071        *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; 
    7172        *(volatile uint8_t *)(bios + 0x5555) = 0xF0; 
    7273 
    73 #endif 
    7474        myusec_delay(10); 
    7575 
     
    7878        if (id1 == flash->manufacture_id && id2 == flash->model_id) { 
    7979                size_t size = flash->total_size * 1024; 
     80 
    8081                // we need to mmap the write-protect space.  
    81                 bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, 
     82                registers = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, 
    8283                            fd_mem, (off_t) (0 - 0x400000 - size)); 
    83                 if (bios == MAP_FAILED) { 
     84                if (registers == MAP_FAILED) { 
    8485                        // it's this part but we can't map it ... 
    8586                        perror("Error MMAP memory using " MEM_DEV); 
     
    8788                } 
    8889 
    89                 flash->virt_addr_2 = bios; 
     90                flash->virtual_registers = registers; 
    9091                return 1; 
    9192        } 
     
    124125int erase_82802ab_block(struct flashchip *flash, int offset) 
    125126{ 
    126         volatile uint8_t *bios = flash->virt_addr + offset; 
    127         volatile uint8_t *wrprotect = flash->virt_addr_2 + offset + 2; 
     127        volatile uint8_t *bios = flash->virtual_memory + offset; 
     128        volatile uint8_t *wrprotect = flash->virtual_registers + offset + 2; 
    128129        uint8_t status; 
    129130 
     
    142143        myusec_delay(10); 
    143144        // now let's see what the register is 
    144         status = wait_82802ab(flash->virt_addr); 
     145        status = wait_82802ab(flash->virtual_memory); 
    145146        //print_82802ab_status(status); 
    146147        printf("DONE BLOCK 0x%x\n", offset); 
     
    179180        int total_size = flash->total_size * 1024; 
    180181        int page_size = flash->page_size; 
    181         volatile uint8_t *bios = flash->virt_addr; 
     182        volatile uint8_t *bios = flash->virtual_memory; 
    182183 
    183184        erase_82802ab(flash); 
Note: See TracChangeset for help on using the changeset viewer.