Author: stefanct Date: Sat Sep 22 03:38:06 2012 New Revision: 1602 URL: http://flashrom.org/trac/flashrom/changeset/1602
Log: Generify a25.c's SRWD printing function and move it to spi25.c.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at Acked-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at
Modified: trunk/a25.c trunk/chipdrivers.h trunk/spi25.c
Modified: trunk/a25.c ============================================================================== --- trunk/a25.c Fri Sep 21 14:52:50 2012 (r1601) +++ trunk/a25.c Sat Sep 22 03:38:06 2012 (r1602) @@ -23,12 +23,6 @@
/* Prettyprint the status register. Works for AMIC A25L series. */
-static void spi_prettyprint_status_register_amic_a25_srwd(uint8_t status) -{ - msg_cdbg("Chip status register: Status Register Write Disable " - "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); -} - int spi_prettyprint_status_register_amic_a25l05p(struct flashctx *flash) { uint8_t status; @@ -36,7 +30,7 @@ status = spi_read_status_register(flash); msg_cdbg("Chip status register is %02x\n", status);
- spi_prettyprint_status_register_amic_a25_srwd(status); + spi_prettyprint_status_register_srwd(status); spi_prettyprint_status_register_bit(status, 6); spi_prettyprint_status_register_bit(status, 5); spi_prettyprint_status_register_bit(status, 4); @@ -52,7 +46,7 @@ status = spi_read_status_register(flash); msg_cdbg("Chip status register is %02x\n", status);
- spi_prettyprint_status_register_amic_a25_srwd(status); + spi_prettyprint_status_register_srwd(status); spi_prettyprint_status_register_bit(status, 6); spi_prettyprint_status_register_bit(status, 5); spi_prettyprint_status_register_bp(status, 2); @@ -67,7 +61,7 @@ status = spi_read_status_register(flash); msg_cdbg("Chip status register is %02x\n", status);
- spi_prettyprint_status_register_amic_a25_srwd(status); + spi_prettyprint_status_register_srwd(status); msg_cdbg("Chip status register: Sector Protect Size (SEC) " "is %i KB\n", (status & (1 << 6)) ? 4 : 64); msg_cdbg("Chip status register: Top/Bottom (TB) " @@ -85,7 +79,7 @@ status = spi_read_status_register(flash); msg_cdbg("Chip status register is %02x\n", status);
- spi_prettyprint_status_register_amic_a25_srwd(status); + spi_prettyprint_status_register_srwd(status); msg_cdbg("Chip status register: Sector Protect Size (SEC) " "is %i KB\n", (status & (1 << 6)) ? 4 : 64); msg_cdbg("Chip status register: Top/Bottom (TB) "
Modified: trunk/chipdrivers.h ============================================================================== --- trunk/chipdrivers.h Fri Sep 21 14:52:50 2012 (r1601) +++ trunk/chipdrivers.h Sat Sep 22 03:38:06 2012 (r1602) @@ -53,6 +53,7 @@ int spi_write_status_register(struct flashctx *flash, int status); void spi_prettyprint_status_register_bit(uint8_t status, int bit); void spi_prettyprint_status_register_bp(uint8_t status, int bp); +void spi_prettyprint_status_register_srwd(uint8_t status); void spi_prettyprint_status_register_welwip(uint8_t status); int spi_prettyprint_status_register(struct flashctx *flash); int spi_disable_blockprotect(struct flashctx *flash);
Modified: trunk/spi25.c ============================================================================== --- trunk/spi25.c Fri Sep 21 14:52:50 2012 (r1601) +++ trunk/spi25.c Sat Sep 22 03:38:06 2012 (r1602) @@ -315,7 +315,13 @@ return readarr[0]; }
-/* Prettyprint the status register. Common definitions. */ +/* Common highest bit: Status Register Write Disable (SRWD). */ +void spi_prettyprint_status_register_srwd(uint8_t status) +{ + msg_cdbg("Chip status register: Status Register Write Disable (SRWD) is %sset\n", + (status & (1 << 7)) ? "" : "not "); +} + void spi_prettyprint_status_register_welwip(uint8_t status) { msg_cdbg("Chip status register: Write Enable Latch (WEL) is " @@ -366,10 +372,8 @@ */ void spi_prettyprint_status_register_st_m25p(uint8_t status) { - msg_cdbg("Chip status register: Status Register Write Disable " - "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); - msg_cdbg("Chip status register: Bit 6 is " - "%sset\n", (status & (1 << 6)) ? "" : "not "); + spi_prettyprint_status_register_srwd(status); + spi_prettyprint_status_register_bit(status, 6); spi_prettyprint_status_register_common(status); }