Changeset 1474 for trunk/flashrom.c
- Timestamp:
- Dec 18, 2011 4:01:24 PM (18 months ago)
- File:
-
- 1 edited
-
trunk/flashrom.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/flashrom.c
r1473 r1474 360 360 } 361 361 362 void chip_writeb(uint8_t val, chipaddr addr) 363 { 364 par_programmer->chip_writeb(val, addr); 365 } 366 367 void chip_writew(uint16_t val, chipaddr addr) 368 { 369 par_programmer->chip_writew(val, addr); 370 } 371 372 void chip_writel(uint32_t val, chipaddr addr) 373 { 374 par_programmer->chip_writel(val, addr); 375 } 376 377 void chip_writen(uint8_t *buf, chipaddr addr, size_t len) 378 { 379 par_programmer->chip_writen(buf, addr, len); 380 } 381 382 uint8_t chip_readb(const chipaddr addr) 383 { 384 return par_programmer->chip_readb(addr); 385 } 386 387 uint16_t chip_readw(const chipaddr addr) 388 { 389 return par_programmer->chip_readw(addr); 390 } 391 392 uint32_t chip_readl(const chipaddr addr) 393 { 394 return par_programmer->chip_readl(addr); 395 } 396 397 void chip_readn(uint8_t *buf, chipaddr addr, size_t len) 398 { 399 par_programmer->chip_readn(buf, addr, len); 362 void chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr) 363 { 364 par_programmer->chip_writeb(flash, val, addr); 365 } 366 367 void chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr) 368 { 369 par_programmer->chip_writew(flash, val, addr); 370 } 371 372 void chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr) 373 { 374 par_programmer->chip_writel(flash, val, addr); 375 } 376 377 void chip_writen(const struct flashctx *flash, uint8_t *buf, chipaddr addr, 378 size_t len) 379 { 380 par_programmer->chip_writen(flash, buf, addr, len); 381 } 382 383 uint8_t chip_readb(const struct flashctx *flash, const chipaddr addr) 384 { 385 return par_programmer->chip_readb(flash, addr); 386 } 387 388 uint16_t chip_readw(const struct flashctx *flash, const chipaddr addr) 389 { 390 return par_programmer->chip_readw(flash, addr); 391 } 392 393 uint32_t chip_readl(const struct flashctx *flash, const chipaddr addr) 394 { 395 return par_programmer->chip_readl(flash, addr); 396 } 397 398 void chip_readn(const struct flashctx *flash, uint8_t *buf, chipaddr addr, 399 size_t len) 400 { 401 par_programmer->chip_readn(flash, buf, addr, len); 400 402 } 401 403 … … 413 415 } 414 416 415 int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len) 416 { 417 chip_readn(buf, flash->virtual_memory + start, len); 417 int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, 418 int unsigned len) 419 { 420 chip_readn(flash, buf, flash->virtual_memory + start, len); 418 421 419 422 return 0; … … 536 539 537 540 /* start is an offset to the base address of the flash chip */ 538 int check_erased_range(struct flashctx *flash, unsigned int start, unsigned int len) 541 int check_erased_range(struct flashctx *flash, unsigned int start, 542 unsigned int len) 539 543 { 540 544 int ret; … … 559 563 * @return 0 for success, -1 for failure 560 564 */ 561 int verify_range(struct flashctx *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len,562 const char *message)565 int verify_range(struct flashctx *flash, uint8_t *cmpbuf, unsigned int start, 566 unsigned int len, const char *message) 563 567 { 564 568 unsigned int i; … … 1538 1542 * after the members copied from struct flashchip. 1539 1543 */ 1540 if (sizeof(struct flashchip) != offsetof(struct flashctx, virtual_memory)) { 1544 if (sizeof(struct flashchip) != 1545 offsetof(struct flashctx, virtual_memory)) { 1541 1546 msg_gerr("struct flashctx broken!\n"); 1542 1547 ret = 1; … … 1619 1624 * function signature. 1620 1625 */ 1621 int chip_safety_check(struct flashctx *flash, int force, int read_it, int write_it, int erase_it, int verify_it) 1626 int chip_safety_check(struct flashctx *flash, int force, int read_it, 1627 int write_it, int erase_it, int verify_it) 1622 1628 { 1623 1629 if (!programmer_may_write && (write_it || erase_it)) { … … 1680 1686 * Besides that, the function itself is a textbook example of abysmal code flow. 1681 1687 */ 1682 int doit(struct flashctx *flash, int force, const char *filename, int read_it, int write_it, int erase_it, int verify_it) 1688 int doit(struct flashctx *flash, int force, const char *filename, int read_it, 1689 int write_it, int erase_it, int verify_it) 1683 1690 { 1684 1691 uint8_t *oldcontents;
Note: See TracChangeset
for help on using the changeset viewer.
