summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-10-15 11:51:56 +0000
committerJens Arnold <amiconn@rockbox.org>2006-10-15 11:51:56 +0000
commit450f619dcf4904e5aee00b89c417a5ba8a1bf23f (patch)
treedf3b7a0db52b7c782ec8c48c06100ba597436300 /apps
parent10befc8e6ed2129143af79cfcfbc0fd5a4fe3d85 (diff)
downloadrockbox-450f619dcf4904e5aee00b89c417a5ba8a1bf23f.tar.gz
rockbox-450f619dcf4904e5aee00b89c417a5ba8a1bf23f.zip
Ondios: Slightly more verbose MMC info.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11225 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9b04cfafd8..9f6bc98998 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1593,6 +1593,7 @@ bool dbg_mmc_info(void)
1593{ 1593{
1594 bool done = false; 1594 bool done = false;
1595 int currval = 0; 1595 int currval = 0;
1596 int line;
1596 tCardInfo *card; 1597 tCardInfo *card;
1597 unsigned char pbuf[32], pbuf2[32]; 1598 unsigned char pbuf[32], pbuf2[32];
1598 unsigned char card_name[7]; 1599 unsigned char card_name[7];
@@ -1601,6 +1602,8 @@ bool dbg_mmc_info(void)
1601 static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 }; 1602 static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1602 static const unsigned char *kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" }; 1603 static const unsigned char *kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" };
1603 static const unsigned char *nsec_units[] = { "ns", "µs", "ms" }; 1604 static const unsigned char *nsec_units[] = { "ns", "µs", "ms" };
1605 static const char *spec_vers[] = { "1.0-1.2", "1.4", "2.0-2.2",
1606 "3.1-3.31", "4.0" };
1604 1607
1605 card_name[6] = '\0'; 1608 card_name[6] = '\0';
1606 1609
@@ -1611,64 +1614,73 @@ bool dbg_mmc_info(void)
1611 { 1614 {
1612 card = mmc_card_info(currval / 2); 1615 card = mmc_card_info(currval / 2);
1613 1616
1617 line = 0;
1614 lcd_clear_display(); 1618 lcd_clear_display();
1615 snprintf(pbuf, sizeof(pbuf), "[MMC%d p%d]", currval / 2, 1619 snprintf(pbuf, sizeof(pbuf), "[MMC%d p%d]", currval / 2,
1616 (currval % 2) + 1); 1620 (currval % 2) + 1);
1617 lcd_puts(0, 0, pbuf); 1621 lcd_puts(0, line++, pbuf);
1618 1622
1619 if (card->initialized) 1623 if (card->initialized)
1620 { 1624 {
1621 if (!(currval % 2)) /* General info */ 1625 if (!(currval % 2)) /* General info */
1622 { 1626 {
1627 int temp;
1628
1623 strncpy(card_name, ((unsigned char*)card->cid) + 3, 6); 1629 strncpy(card_name, ((unsigned char*)card->cid) + 3, 6);
1624 snprintf(pbuf, sizeof(pbuf), "%s Rev %d.%d", card_name, 1630 snprintf(pbuf, sizeof(pbuf), "%s Rev %d.%d", card_name,
1625 (int) mmc_extract_bits(card->cid, 72, 4), 1631 (int) mmc_extract_bits(card->cid, 72, 4),
1626 (int) mmc_extract_bits(card->cid, 76, 4)); 1632 (int) mmc_extract_bits(card->cid, 76, 4));
1627 lcd_puts(0, 1, pbuf); 1633 lcd_puts(0, line++, pbuf);
1628 snprintf(pbuf, sizeof(pbuf), "Prod: %d/%d", 1634 snprintf(pbuf, sizeof(pbuf), "Prod: %d/%d",
1629 (int) mmc_extract_bits(card->cid, 112, 4), 1635 (int) mmc_extract_bits(card->cid, 112, 4),
1630 (int) mmc_extract_bits(card->cid, 116, 4) + 1997); 1636 (int) mmc_extract_bits(card->cid, 116, 4) + 1997);
1631 lcd_puts(0, 2, pbuf); 1637 lcd_puts(0, line++, pbuf);
1632 snprintf(pbuf, sizeof(pbuf), "Ser#: 0x%08lx", 1638 snprintf(pbuf, sizeof(pbuf), "Ser#: 0x%08lx",
1633 mmc_extract_bits(card->cid, 80, 32)); 1639 mmc_extract_bits(card->cid, 80, 32));
1634 lcd_puts(0, 3, pbuf); 1640 lcd_puts(0, line++, pbuf);
1635 snprintf(pbuf, sizeof(pbuf), "M=%02x, O=%04x", 1641 snprintf(pbuf, sizeof(pbuf), "M=%02x, O=%04x",
1636 (int) mmc_extract_bits(card->cid, 0, 8), 1642 (int) mmc_extract_bits(card->cid, 0, 8),
1637 (int) mmc_extract_bits(card->cid, 8, 16)); 1643 (int) mmc_extract_bits(card->cid, 8, 16));
1638 lcd_puts(0, 4, pbuf); 1644 lcd_puts(0, line++, pbuf);
1645 temp = mmc_extract_bits(card->csd, 2, 4);
1646 snprintf(pbuf, sizeof(pbuf), "MMC v%s", temp < 5 ?
1647 spec_vers[temp] : "?.?");
1648 lcd_puts(0, line++, pbuf);
1639 snprintf(pbuf, sizeof(pbuf), "Blocks: 0x%06lx", card->numblocks); 1649 snprintf(pbuf, sizeof(pbuf), "Blocks: 0x%06lx", card->numblocks);
1640 lcd_puts(0, 5, pbuf); 1650 lcd_puts(0, line++, pbuf);
1641 snprintf(pbuf, sizeof(pbuf), "Blksz.: %d", card->blocksize); 1651 snprintf(pbuf, sizeof(pbuf), "Blksz.: %d P:%c%c", card->blocksize,
1642 lcd_puts(0, 6, pbuf); 1652 mmc_extract_bits(card->csd, 48, 1) ? 'R' : '-',
1653 mmc_extract_bits(card->csd, 106, 1) ? 'W' : '-');
1654 lcd_puts(0, line++, pbuf);
1643 } 1655 }
1644 else /* Technical details */ 1656 else /* Technical details */
1645 { 1657 {
1646 output_dyn_value(pbuf2, sizeof pbuf2, card->speed / 1000, 1658 output_dyn_value(pbuf2, sizeof pbuf2, card->speed / 1000,
1647 kbit_units, false); 1659 kbit_units, false);
1648 snprintf(pbuf, sizeof pbuf, "Speed: %s", pbuf2); 1660 snprintf(pbuf, sizeof pbuf, "Speed: %s", pbuf2);
1649 lcd_puts(0, 1, pbuf); 1661 lcd_puts(0, line++, pbuf);
1650 1662
1651 output_dyn_value(pbuf2, sizeof pbuf2, card->tsac, 1663 output_dyn_value(pbuf2, sizeof pbuf2, card->tsac,
1652 nsec_units, false); 1664 nsec_units, false);
1653 snprintf(pbuf, sizeof pbuf, "Tsac: %s", pbuf2); 1665 snprintf(pbuf, sizeof pbuf, "Tsac: %s", pbuf2);
1654 lcd_puts(0, 2, pbuf); 1666 lcd_puts(0, line++, pbuf);
1655 1667
1656 snprintf(pbuf, sizeof(pbuf), "Nsac: %d clk", card->nsac); 1668 snprintf(pbuf, sizeof(pbuf), "Nsac: %d clk", card->nsac);
1657 lcd_puts(0, 3, pbuf); 1669 lcd_puts(0, line++, pbuf);
1658 snprintf(pbuf, sizeof(pbuf), "R2W: *%d", card->r2w_factor); 1670 snprintf(pbuf, sizeof(pbuf), "R2W: *%d", card->r2w_factor);
1659 lcd_puts(0, 4, pbuf); 1671 lcd_puts(0, line++, pbuf);
1660 snprintf(pbuf, sizeof(pbuf), "IRmax: %d..%d mA", 1672 snprintf(pbuf, sizeof(pbuf), "IRmax: %d..%d mA",
1661 i_vmin[mmc_extract_bits(card->csd, 66, 3)], 1673 i_vmin[mmc_extract_bits(card->csd, 66, 3)],
1662 i_vmax[mmc_extract_bits(card->csd, 69, 3)]); 1674 i_vmax[mmc_extract_bits(card->csd, 69, 3)]);
1663 lcd_puts(0, 5, pbuf); 1675 lcd_puts(0, line++, pbuf);
1664 snprintf(pbuf, sizeof(pbuf), "IWmax: %d..%d mA", 1676 snprintf(pbuf, sizeof(pbuf), "IWmax: %d..%d mA",
1665 i_vmin[mmc_extract_bits(card->csd, 72, 3)], 1677 i_vmin[mmc_extract_bits(card->csd, 72, 3)],
1666 i_vmax[mmc_extract_bits(card->csd, 75, 3)]); 1678 i_vmax[mmc_extract_bits(card->csd, 75, 3)]);
1667 lcd_puts(0, 6, pbuf); 1679 lcd_puts(0, line++, pbuf);
1668 } 1680 }
1669 } 1681 }
1670 else 1682 else
1671 lcd_puts(0, 1, "Not found!"); 1683 lcd_puts(0, line++, "Not found!");
1672 1684
1673 lcd_update(); 1685 lcd_update();
1674 1686