diff options
-rw-r--r-- | apps/debug_menu.c | 162 | ||||
-rw-r--r-- | apps/gui/list.c | 30 | ||||
-rw-r--r-- | apps/gui/list.h | 6 |
3 files changed, 99 insertions, 99 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index b332d5d821..a00dd48648 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1305,11 +1305,11 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1305 | card_name[i] = card_extract_bits(card->cid, (103-8*i), 8); | 1305 | card_name[i] = card_extract_bits(card->cid, (103-8*i), 8); |
1306 | } | 1306 | } |
1307 | strlcpy(card_name, card_name, sizeof(card_name)); | 1307 | strlcpy(card_name, card_name, sizeof(card_name)); |
1308 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1308 | simplelist_addline( |
1309 | "%s Rev %d.%d", card_name, | 1309 | "%s Rev %d.%d", card_name, |
1310 | (int) card_extract_bits(card->cid, 63, 4), | 1310 | (int) card_extract_bits(card->cid, 63, 4), |
1311 | (int) card_extract_bits(card->cid, 59, 4)); | 1311 | (int) card_extract_bits(card->cid, 59, 4)); |
1312 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1312 | simplelist_addline( |
1313 | "Prod: %d/%d", | 1313 | "Prod: %d/%d", |
1314 | #if (CONFIG_STORAGE & STORAGE_SD) | 1314 | #if (CONFIG_STORAGE & STORAGE_SD) |
1315 | (int) card_extract_bits(card->cid, 11, 4), | 1315 | (int) card_extract_bits(card->cid, 11, 4), |
@@ -1319,7 +1319,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1319 | (int) card_extract_bits(card->cid, 11, 4) + 1997 | 1319 | (int) card_extract_bits(card->cid, 11, 4) + 1997 |
1320 | #endif | 1320 | #endif |
1321 | ); | 1321 | ); |
1322 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1322 | simplelist_addline( |
1323 | #if (CONFIG_STORAGE & STORAGE_SD) | 1323 | #if (CONFIG_STORAGE & STORAGE_SD) |
1324 | "Ser#: 0x%08lx", | 1324 | "Ser#: 0x%08lx", |
1325 | card_extract_bits(card->cid, 55, 32) | 1325 | card_extract_bits(card->cid, 55, 32) |
@@ -1329,7 +1329,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1329 | #endif | 1329 | #endif |
1330 | ); | 1330 | ); |
1331 | 1331 | ||
1332 | simplelist_addline(SIMPLELIST_ADD_LINE, "M=%02x, " | 1332 | simplelist_addline("M=%02x, " |
1333 | #if (CONFIG_STORAGE & STORAGE_SD) | 1333 | #if (CONFIG_STORAGE & STORAGE_SD) |
1334 | "O=%c%c", | 1334 | "O=%c%c", |
1335 | (int) card_extract_bits(card->cid, 127, 8), | 1335 | (int) card_extract_bits(card->cid, 127, 8), |
@@ -1344,34 +1344,34 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1344 | 1344 | ||
1345 | #if (CONFIG_STORAGE & STORAGE_MMC) | 1345 | #if (CONFIG_STORAGE & STORAGE_MMC) |
1346 | int temp = card_extract_bits(card->csd, 125, 4); | 1346 | int temp = card_extract_bits(card->csd, 125, 4); |
1347 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1347 | simplelist_addline( |
1348 | "MMC v%s", temp < 5 ? | 1348 | "MMC v%s", temp < 5 ? |
1349 | mmc_spec_vers[temp] : "?.?"); | 1349 | mmc_spec_vers[temp] : "?.?"); |
1350 | #endif | 1350 | #endif |
1351 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1351 | simplelist_addline( |
1352 | "Blocks: 0x%08lx", card->numblocks); | 1352 | "Blocks: 0x%08lx", card->numblocks); |
1353 | output_dyn_value(pbuf, sizeof pbuf, card->speed / 1000, | 1353 | output_dyn_value(pbuf, sizeof pbuf, card->speed / 1000, |
1354 | kbit_units, false); | 1354 | kbit_units, false); |
1355 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1355 | simplelist_addline( |
1356 | "Speed: %s", pbuf); | 1356 | "Speed: %s", pbuf); |
1357 | output_dyn_value(pbuf, sizeof pbuf, card->taac, | 1357 | output_dyn_value(pbuf, sizeof pbuf, card->taac, |
1358 | nsec_units, false); | 1358 | nsec_units, false); |
1359 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1359 | simplelist_addline( |
1360 | "Taac: %s", pbuf); | 1360 | "Taac: %s", pbuf); |
1361 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1361 | simplelist_addline( |
1362 | "Nsac: %d clk", card->nsac); | 1362 | "Nsac: %d clk", card->nsac); |
1363 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1363 | simplelist_addline( |
1364 | "R2W: *%d", card->r2w_factor); | 1364 | "R2W: *%d", card->r2w_factor); |
1365 | #if (CONFIG_STORAGE & STORAGE_SD) | 1365 | #if (CONFIG_STORAGE & STORAGE_SD) |
1366 | int csd_structure = card_extract_bits(card->csd, 127, 2); | 1366 | int csd_structure = card_extract_bits(card->csd, 127, 2); |
1367 | if (csd_structure == 0) /* CSD version 1.0 */ | 1367 | if (csd_structure == 0) /* CSD version 1.0 */ |
1368 | #endif | 1368 | #endif |
1369 | { | 1369 | { |
1370 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1370 | simplelist_addline( |
1371 | "IRmax: %d..%d mA", | 1371 | "IRmax: %d..%d mA", |
1372 | i_vmin[card_extract_bits(card->csd, 61, 3)], | 1372 | i_vmin[card_extract_bits(card->csd, 61, 3)], |
1373 | i_vmax[card_extract_bits(card->csd, 58, 3)]); | 1373 | i_vmax[card_extract_bits(card->csd, 58, 3)]); |
1374 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1374 | simplelist_addline( |
1375 | "IWmax: %d..%d mA", | 1375 | "IWmax: %d..%d mA", |
1376 | i_vmin[card_extract_bits(card->csd, 55, 3)], | 1376 | i_vmin[card_extract_bits(card->csd, 55, 3)], |
1377 | i_vmax[card_extract_bits(card->csd, 52, 3)]); | 1377 | i_vmax[card_extract_bits(card->csd, 52, 3)]); |
@@ -1379,12 +1379,12 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1379 | } | 1379 | } |
1380 | else if (card->initialized == 0) | 1380 | else if (card->initialized == 0) |
1381 | { | 1381 | { |
1382 | simplelist_addline(SIMPLELIST_ADD_LINE, "Not Found!"); | 1382 | simplelist_addline("Not Found!"); |
1383 | } | 1383 | } |
1384 | #if (CONFIG_STORAGE & STORAGE_SD) | 1384 | #if (CONFIG_STORAGE & STORAGE_SD) |
1385 | else /* card->initialized < 0 */ | 1385 | else /* card->initialized < 0 */ |
1386 | { | 1386 | { |
1387 | simplelist_addline(SIMPLELIST_ADD_LINE, "Init Error! (%d)", card->initialized); | 1387 | simplelist_addline("Init Error! (%d)", card->initialized); |
1388 | } | 1388 | } |
1389 | #endif | 1389 | #endif |
1390 | snprintf(title, 16, "[" CARDTYPE " %d]", *cardnum); | 1390 | snprintf(title, 16, "[" CARDTYPE " %d]", *cardnum); |
@@ -1413,31 +1413,31 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1413 | /* kill trailing space */ | 1413 | /* kill trailing space */ |
1414 | for (i=39; i && buf[i]==' '; i--) | 1414 | for (i=39; i && buf[i]==' '; i--) |
1415 | buf[i] = 0; | 1415 | buf[i] = 0; |
1416 | simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", buf); | 1416 | simplelist_addline("Model: %s", buf); |
1417 | for (i=0; i < 4; i++) | 1417 | for (i=0; i < 4; i++) |
1418 | ((unsigned short*)buf)[i]=htobe16(identify_info[i+23]); | 1418 | ((unsigned short*)buf)[i]=htobe16(identify_info[i+23]); |
1419 | buf[8]=0; | 1419 | buf[8]=0; |
1420 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1420 | simplelist_addline( |
1421 | "Firmware: %s", buf); | 1421 | "Firmware: %s", buf); |
1422 | snprintf(buf, sizeof buf, "%ld MB", | 1422 | snprintf(buf, sizeof buf, "%ld MB", |
1423 | ((unsigned long)identify_info[61] << 16 | | 1423 | ((unsigned long)identify_info[61] << 16 | |
1424 | (unsigned long)identify_info[60]) / 2048 ); | 1424 | (unsigned long)identify_info[60]) / 2048 ); |
1425 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1425 | simplelist_addline( |
1426 | "Size: %s", buf); | 1426 | "Size: %s", buf); |
1427 | unsigned long free; | 1427 | unsigned long free; |
1428 | fat_size( IF_MV2(0,) NULL, &free ); | 1428 | fat_size( IF_MV2(0,) NULL, &free ); |
1429 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1429 | simplelist_addline( |
1430 | "Free: %ld MB", free / 1024); | 1430 | "Free: %ld MB", free / 1024); |
1431 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1431 | simplelist_addline( |
1432 | "Spinup time: %d ms", storage_spinup_time() * (1000/HZ)); | 1432 | "Spinup time: %d ms", storage_spinup_time() * (1000/HZ)); |
1433 | i = identify_info[83] & (1<<3); | 1433 | i = identify_info[83] & (1<<3); |
1434 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1434 | simplelist_addline( |
1435 | "Power mgmt: %s", i ? "enabled" : "unsupported"); | 1435 | "Power mgmt: %s", i ? "enabled" : "unsupported"); |
1436 | i = identify_info[83] & (1<<9); | 1436 | i = identify_info[83] & (1<<9); |
1437 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1437 | simplelist_addline( |
1438 | "Noise mgmt: %s", i ? "enabled" : "unsupported"); | 1438 | "Noise mgmt: %s", i ? "enabled" : "unsupported"); |
1439 | i = identify_info[82] & (1<<6); | 1439 | i = identify_info[82] & (1<<6); |
1440 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1440 | simplelist_addline( |
1441 | "Read-ahead: %s", i ? "enabled" : "unsupported"); | 1441 | "Read-ahead: %s", i ? "enabled" : "unsupported"); |
1442 | timing_info_present = identify_info[53] & (1<<1); | 1442 | timing_info_present = identify_info[53] & (1<<1); |
1443 | if(timing_info_present) { | 1443 | if(timing_info_present) { |
@@ -1445,27 +1445,27 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1445 | pio4[1] = 0; | 1445 | pio4[1] = 0; |
1446 | pio3[0] = (identify_info[64] & (1<<0)) ? '3' : 0; | 1446 | pio3[0] = (identify_info[64] & (1<<0)) ? '3' : 0; |
1447 | pio4[0] = (identify_info[64] & (1<<1)) ? '4' : 0; | 1447 | pio4[0] = (identify_info[64] & (1<<1)) ? '4' : 0; |
1448 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1448 | simplelist_addline( |
1449 | "PIO modes: 0 1 2 %s %s", pio3, pio4); | 1449 | "PIO modes: 0 1 2 %s %s", pio3, pio4); |
1450 | } | 1450 | } |
1451 | else { | 1451 | else { |
1452 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1452 | simplelist_addline( |
1453 | "No PIO mode info"); | 1453 | "No PIO mode info"); |
1454 | } | 1454 | } |
1455 | timing_info_present = identify_info[53] & (1<<1); | 1455 | timing_info_present = identify_info[53] & (1<<1); |
1456 | if(timing_info_present) { | 1456 | if(timing_info_present) { |
1457 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1457 | simplelist_addline( |
1458 | "Cycle times %dns/%dns", | 1458 | "Cycle times %dns/%dns", |
1459 | identify_info[67], | 1459 | identify_info[67], |
1460 | identify_info[68] ); | 1460 | identify_info[68] ); |
1461 | } else { | 1461 | } else { |
1462 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1462 | simplelist_addline( |
1463 | "No timing info"); | 1463 | "No timing info"); |
1464 | } | 1464 | } |
1465 | int sector_size = 512; | 1465 | int sector_size = 512; |
1466 | if((identify_info[106] & 0xe000) == 0x6000) | 1466 | if((identify_info[106] & 0xe000) == 0x6000) |
1467 | sector_size *= BIT_N(identify_info[106] & 0x000f); | 1467 | sector_size *= BIT_N(identify_info[106] & 0x000f); |
1468 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1468 | simplelist_addline( |
1469 | "Physical sector size: %d", sector_size); | 1469 | "Physical sector size: %d", sector_size); |
1470 | #ifdef HAVE_ATA_DMA | 1470 | #ifdef HAVE_ATA_DMA |
1471 | if (identify_info[63] & (1<<0)) { | 1471 | if (identify_info[63] & (1<<0)) { |
@@ -1474,15 +1474,15 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1474 | mdma0[0] = (identify_info[63] & (1<<0)) ? '0' : 0; | 1474 | mdma0[0] = (identify_info[63] & (1<<0)) ? '0' : 0; |
1475 | mdma1[0] = (identify_info[63] & (1<<1)) ? '1' : 0; | 1475 | mdma1[0] = (identify_info[63] & (1<<1)) ? '1' : 0; |
1476 | mdma2[0] = (identify_info[63] & (1<<2)) ? '2' : 0; | 1476 | mdma2[0] = (identify_info[63] & (1<<2)) ? '2' : 0; |
1477 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1477 | simplelist_addline( |
1478 | "MDMA modes: %s %s %s", mdma0, mdma1, mdma2); | 1478 | "MDMA modes: %s %s %s", mdma0, mdma1, mdma2); |
1479 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1479 | simplelist_addline( |
1480 | "MDMA Cycle times %dns/%dns", | 1480 | "MDMA Cycle times %dns/%dns", |
1481 | identify_info[65], | 1481 | identify_info[65], |
1482 | identify_info[66] ); | 1482 | identify_info[66] ); |
1483 | } | 1483 | } |
1484 | else { | 1484 | else { |
1485 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1485 | simplelist_addline( |
1486 | "No MDMA mode info"); | 1486 | "No MDMA mode info"); |
1487 | } | 1487 | } |
1488 | if (identify_info[53] & (1<<2)) { | 1488 | if (identify_info[53] & (1<<2)) { |
@@ -1495,36 +1495,36 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1495 | udma4[0] = (identify_info[88] & (1<<4)) ? '4' : 0; | 1495 | udma4[0] = (identify_info[88] & (1<<4)) ? '4' : 0; |
1496 | udma5[0] = (identify_info[88] & (1<<5)) ? '5' : 0; | 1496 | udma5[0] = (identify_info[88] & (1<<5)) ? '5' : 0; |
1497 | udma6[0] = (identify_info[88] & (1<<6)) ? '6' : 0; | 1497 | udma6[0] = (identify_info[88] & (1<<6)) ? '6' : 0; |
1498 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1498 | simplelist_addline( |
1499 | "UDMA modes: %s %s %s %s %s %s %s", udma0, udma1, udma2, | 1499 | "UDMA modes: %s %s %s %s %s %s %s", udma0, udma1, udma2, |
1500 | udma3, udma4, udma5, udma6); | 1500 | udma3, udma4, udma5, udma6); |
1501 | } | 1501 | } |
1502 | else { | 1502 | else { |
1503 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1503 | simplelist_addline( |
1504 | "No UDMA mode info"); | 1504 | "No UDMA mode info"); |
1505 | } | 1505 | } |
1506 | #endif /* HAVE_ATA_DMA */ | 1506 | #endif /* HAVE_ATA_DMA */ |
1507 | timing_info_present = identify_info[53] & (1<<1); | 1507 | timing_info_present = identify_info[53] & (1<<1); |
1508 | if(timing_info_present) { | 1508 | if(timing_info_present) { |
1509 | i = identify_info[49] & (1<<11); | 1509 | i = identify_info[49] & (1<<11); |
1510 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1510 | simplelist_addline( |
1511 | "IORDY support: %s", i ? "yes" : "no"); | 1511 | "IORDY support: %s", i ? "yes" : "no"); |
1512 | i = identify_info[49] & (1<<10); | 1512 | i = identify_info[49] & (1<<10); |
1513 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1513 | simplelist_addline( |
1514 | "IORDY disable: %s", i ? "yes" : "no"); | 1514 | "IORDY disable: %s", i ? "yes" : "no"); |
1515 | } else { | 1515 | } else { |
1516 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1516 | simplelist_addline( |
1517 | "No timing info"); | 1517 | "No timing info"); |
1518 | } | 1518 | } |
1519 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1519 | simplelist_addline( |
1520 | "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); | 1520 | "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); |
1521 | #ifdef HAVE_ATA_DMA | 1521 | #ifdef HAVE_ATA_DMA |
1522 | i = ata_get_dma_mode(); | 1522 | i = ata_get_dma_mode(); |
1523 | if (i == 0) { | 1523 | if (i == 0) { |
1524 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1524 | simplelist_addline( |
1525 | "DMA not enabled"); | 1525 | "DMA not enabled"); |
1526 | } else { | 1526 | } else { |
1527 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1527 | simplelist_addline( |
1528 | "DMA mode: %s %c", | 1528 | "DMA mode: %s %c", |
1529 | (i & 0x40) ? "UDMA" : "MDMA", | 1529 | (i & 0x40) ? "UDMA" : "MDMA", |
1530 | '0' + (i & 7)); | 1530 | '0' + (i & 7)); |
@@ -1538,16 +1538,16 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1538 | (void)lists; | 1538 | (void)lists; |
1539 | struct storage_info info; | 1539 | struct storage_info info; |
1540 | storage_get_info(0,&info); | 1540 | storage_get_info(0,&info); |
1541 | simplelist_addline(SIMPLELIST_ADD_LINE, "Vendor: %s", info.vendor); | 1541 | simplelist_addline("Vendor: %s", info.vendor); |
1542 | simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", info.product); | 1542 | simplelist_addline("Model: %s", info.product); |
1543 | simplelist_addline(SIMPLELIST_ADD_LINE, "Firmware: %s", info.revision); | 1543 | simplelist_addline("Firmware: %s", info.revision); |
1544 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1544 | simplelist_addline( |
1545 | "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024); | 1545 | "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024); |
1546 | unsigned long free; | 1546 | unsigned long free; |
1547 | fat_size( IF_MV2(0,) NULL, &free ); | 1547 | fat_size( IF_MV2(0,) NULL, &free ); |
1548 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1548 | simplelist_addline( |
1549 | "Free: %ld MB", free / 1024); | 1549 | "Free: %ld MB", free / 1024); |
1550 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1550 | simplelist_addline( |
1551 | "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); | 1551 | "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); |
1552 | return btn; | 1552 | return btn; |
1553 | } | 1553 | } |
@@ -1592,19 +1592,19 @@ static int dircache_callback(int btn, struct gui_synclist *lists) | |||
1592 | { | 1592 | { |
1593 | (void)lists; | 1593 | (void)lists; |
1594 | simplelist_set_line_count(0); | 1594 | simplelist_set_line_count(0); |
1595 | simplelist_addline(SIMPLELIST_ADD_LINE, "Cache initialized: %s", | 1595 | simplelist_addline("Cache initialized: %s", |
1596 | dircache_is_enabled() ? "Yes" : "No"); | 1596 | dircache_is_enabled() ? "Yes" : "No"); |
1597 | simplelist_addline(SIMPLELIST_ADD_LINE, "Cache size: %d B", | 1597 | simplelist_addline("Cache size: %d B", |
1598 | dircache_get_cache_size()); | 1598 | dircache_get_cache_size()); |
1599 | simplelist_addline(SIMPLELIST_ADD_LINE, "Last size: %d B", | 1599 | simplelist_addline("Last size: %d B", |
1600 | global_status.dircache_size); | 1600 | global_status.dircache_size); |
1601 | simplelist_addline(SIMPLELIST_ADD_LINE, "Limit: %d B", | 1601 | simplelist_addline("Limit: %d B", |
1602 | DIRCACHE_LIMIT); | 1602 | DIRCACHE_LIMIT); |
1603 | simplelist_addline(SIMPLELIST_ADD_LINE, "Reserve: %d/%d B", | 1603 | simplelist_addline("Reserve: %d/%d B", |
1604 | dircache_get_reserve_used(), DIRCACHE_RESERVE); | 1604 | dircache_get_reserve_used(), DIRCACHE_RESERVE); |
1605 | simplelist_addline(SIMPLELIST_ADD_LINE, "Scanning took: %d s", | 1605 | simplelist_addline("Scanning took: %d s", |
1606 | dircache_get_build_ticks() / HZ); | 1606 | dircache_get_build_ticks() / HZ); |
1607 | simplelist_addline(SIMPLELIST_ADD_LINE, "Entry count: %d", | 1607 | simplelist_addline("Entry count: %d", |
1608 | dircache_get_entry_count()); | 1608 | dircache_get_entry_count()); |
1609 | return btn; | 1609 | return btn; |
1610 | } | 1610 | } |
@@ -1630,24 +1630,24 @@ static int database_callback(int btn, struct gui_synclist *lists) | |||
1630 | 1630 | ||
1631 | simplelist_set_line_count(0); | 1631 | simplelist_set_line_count(0); |
1632 | 1632 | ||
1633 | simplelist_addline(SIMPLELIST_ADD_LINE, "Initialized: %s", | 1633 | simplelist_addline("Initialized: %s", |
1634 | stat->initialized ? "Yes" : "No"); | 1634 | stat->initialized ? "Yes" : "No"); |
1635 | simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s", | 1635 | simplelist_addline("DB Ready: %s", |
1636 | stat->ready ? "Yes" : "No"); | 1636 | stat->ready ? "Yes" : "No"); |
1637 | simplelist_addline(SIMPLELIST_ADD_LINE, "RAM Cache: %s", | 1637 | simplelist_addline("RAM Cache: %s", |
1638 | stat->ramcache ? "Yes" : "No"); | 1638 | stat->ramcache ? "Yes" : "No"); |
1639 | simplelist_addline(SIMPLELIST_ADD_LINE, "RAM: %d/%d B", | 1639 | simplelist_addline("RAM: %d/%d B", |
1640 | stat->ramcache_used, stat->ramcache_allocated); | 1640 | stat->ramcache_used, stat->ramcache_allocated); |
1641 | simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)", | 1641 | simplelist_addline("Progress: %d%% (%d entries)", |
1642 | stat->progress, stat->processed_entries); | 1642 | stat->progress, stat->processed_entries); |
1643 | simplelist_addline(SIMPLELIST_ADD_LINE, "Curfile: %s", | 1643 | simplelist_addline("Curfile: %s", |
1644 | stat->curentry ? stat->curentry : "---"); | 1644 | stat->curentry ? stat->curentry : "---"); |
1645 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d", | 1645 | simplelist_addline("Commit step: %d", |
1646 | stat->commit_step); | 1646 | stat->commit_step); |
1647 | simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s", | 1647 | simplelist_addline("Commit delayed: %s", |
1648 | stat->commit_delayed ? "Yes" : "No"); | 1648 | stat->commit_delayed ? "Yes" : "No"); |
1649 | 1649 | ||
1650 | simplelist_addline(SIMPLELIST_ADD_LINE, "Queue length: %d", | 1650 | simplelist_addline("Queue length: %d", |
1651 | stat->queue_length); | 1651 | stat->queue_length); |
1652 | 1652 | ||
1653 | if (synced) | 1653 | if (synced) |
@@ -1857,36 +1857,36 @@ static int radio_callback(int btn, struct gui_synclist *lists) | |||
1857 | simplelist_set_line_count(1); | 1857 | simplelist_set_line_count(1); |
1858 | 1858 | ||
1859 | #if (CONFIG_TUNER & LV24020LP) | 1859 | #if (CONFIG_TUNER & LV24020LP) |
1860 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1860 | simplelist_addline( |
1861 | "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT) ); | 1861 | "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT) ); |
1862 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1862 | simplelist_addline( |
1863 | "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT) ); | 1863 | "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT) ); |
1864 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1864 | simplelist_addline( |
1865 | "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM) ); | 1865 | "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM) ); |
1866 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1866 | simplelist_addline( |
1867 | "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF) ); | 1867 | "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF) ); |
1868 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1868 | simplelist_addline( |
1869 | "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD) ); | 1869 | "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD) ); |
1870 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1870 | simplelist_addline( |
1871 | "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET) ); | 1871 | "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET) ); |
1872 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1872 | simplelist_addline( |
1873 | "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET) ); | 1873 | "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET) ); |
1874 | #endif /* LV24020LP */ | 1874 | #endif /* LV24020LP */ |
1875 | #if (CONFIG_TUNER & S1A0903X01) | 1875 | #if (CONFIG_TUNER & S1A0903X01) |
1876 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1876 | simplelist_addline( |
1877 | "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL)); | 1877 | "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL)); |
1878 | /* This one doesn't return dynamic data atm */ | 1878 | /* This one doesn't return dynamic data atm */ |
1879 | #endif /* S1A0903X01 */ | 1879 | #endif /* S1A0903X01 */ |
1880 | #if (CONFIG_TUNER & TEA5767) | 1880 | #if (CONFIG_TUNER & TEA5767) |
1881 | struct tea5767_dbg_info nfo; | 1881 | struct tea5767_dbg_info nfo; |
1882 | tea5767_dbg_info(&nfo); | 1882 | tea5767_dbg_info(&nfo); |
1883 | simplelist_addline(SIMPLELIST_ADD_LINE, "Philips regs:"); | 1883 | simplelist_addline("Philips regs:"); |
1884 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1884 | simplelist_addline( |
1885 | " Read: %02X %02X %02X %02X %02X", | 1885 | " Read: %02X %02X %02X %02X %02X", |
1886 | (unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1], | 1886 | (unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1], |
1887 | (unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3], | 1887 | (unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3], |
1888 | (unsigned)nfo.read_regs[4]); | 1888 | (unsigned)nfo.read_regs[4]); |
1889 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1889 | simplelist_addline( |
1890 | " Write: %02X %02X %02X %02X %02X", | 1890 | " Write: %02X %02X %02X %02X %02X", |
1891 | (unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1], | 1891 | (unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1], |
1892 | (unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3], | 1892 | (unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3], |
@@ -1897,9 +1897,9 @@ static int radio_callback(int btn, struct gui_synclist *lists) | |||
1897 | { | 1897 | { |
1898 | struct si4700_dbg_info nfo; | 1898 | struct si4700_dbg_info nfo; |
1899 | si4700_dbg_info(&nfo); | 1899 | si4700_dbg_info(&nfo); |
1900 | simplelist_addline(SIMPLELIST_ADD_LINE, "SI4700 regs:"); | 1900 | simplelist_addline("SI4700 regs:"); |
1901 | for (int i = 0; i < 16; i += 4) { | 1901 | for (int i = 0; i < 16; i += 4) { |
1902 | simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X", | 1902 | simplelist_addline("%02X: %04X %04X %04X %04X", |
1903 | i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); | 1903 | i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); |
1904 | } | 1904 | } |
1905 | } | 1905 | } |
@@ -1909,9 +1909,9 @@ static int radio_callback(int btn, struct gui_synclist *lists) | |||
1909 | { | 1909 | { |
1910 | struct rda5802_dbg_info nfo; | 1910 | struct rda5802_dbg_info nfo; |
1911 | rda5802_dbg_info(&nfo); | 1911 | rda5802_dbg_info(&nfo); |
1912 | simplelist_addline(SIMPLELIST_ADD_LINE, "RDA5802 regs:"); | 1912 | simplelist_addline("RDA5802 regs:"); |
1913 | for (int i = 0; i < 16; i += 4) { | 1913 | for (int i = 0; i < 16; i += 4) { |
1914 | simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X", | 1914 | simplelist_addline("%02X: %04X %04X %04X %04X", |
1915 | i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); | 1915 | i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); |
1916 | } | 1916 | } |
1917 | } | 1917 | } |
@@ -1921,19 +1921,19 @@ static int radio_callback(int btn, struct gui_synclist *lists) | |||
1921 | { | 1921 | { |
1922 | struct stfm1000_dbg_info nfo; | 1922 | struct stfm1000_dbg_info nfo; |
1923 | stfm1000_dbg_info(&nfo); | 1923 | stfm1000_dbg_info(&nfo); |
1924 | simplelist_addline(SIMPLELIST_ADD_LINE, "STFM1000 regs:"); | 1924 | simplelist_addline("STFM1000 regs:"); |
1925 | simplelist_addline(SIMPLELIST_ADD_LINE,"chipid: 0x%x", nfo.chipid); | 1925 | simplelist_addline("chipid: 0x%x", nfo.chipid); |
1926 | } | 1926 | } |
1927 | #endif /* STFM1000 */ | 1927 | #endif /* STFM1000 */ |
1928 | 1928 | ||
1929 | #ifdef HAVE_RDS_CAP | 1929 | #ifdef HAVE_RDS_CAP |
1930 | simplelist_addline(SIMPLELIST_ADD_LINE, "PI:%04X PS:'%8s'", | 1930 | simplelist_addline("PI:%04X PS:'%8s'", |
1931 | rds_get_pi(), rds_get_ps()); | 1931 | rds_get_pi(), rds_get_ps()); |
1932 | simplelist_addline(SIMPLELIST_ADD_LINE, "RT:%s", | 1932 | simplelist_addline("RT:%s", |
1933 | rds_get_rt()); | 1933 | rds_get_rt()); |
1934 | time_t seconds = rds_get_ct(); | 1934 | time_t seconds = rds_get_ct(); |
1935 | struct tm* time = gmtime(&seconds); | 1935 | struct tm* time = gmtime(&seconds); |
1936 | simplelist_addline(SIMPLELIST_ADD_LINE, | 1936 | simplelist_addline( |
1937 | "CT:%4d-%02d-%02d %02d:%02d", | 1937 | "CT:%4d-%02d-%02d %02d:%02d", |
1938 | time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, | 1938 | time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, |
1939 | time->tm_hour, time->tm_min, time->tm_sec); | 1939 | time->tm_hour, time->tm_min, time->tm_sec); |
@@ -1949,7 +1949,7 @@ static bool dbg_fm_radio(void) | |||
1949 | info.scroll_all = true; | 1949 | info.scroll_all = true; |
1950 | simplelist_info_init(&info, "FM Radio", 1, NULL); | 1950 | simplelist_info_init(&info, "FM Radio", 1, NULL); |
1951 | simplelist_set_line_count(0); | 1951 | simplelist_set_line_count(0); |
1952 | simplelist_addline(SIMPLELIST_ADD_LINE, "HW detected: %s", | 1952 | simplelist_addline("HW detected: %s", |
1953 | radio_hardware_present() ? "yes" : "no"); | 1953 | radio_hardware_present() ? "yes" : "no"); |
1954 | 1954 | ||
1955 | info.action_callback = radio_hardware_present()?radio_callback : NULL; | 1955 | info.action_callback = radio_hardware_present()?radio_callback : NULL; |
diff --git a/apps/gui/list.c b/apps/gui/list.c index 26b6ae30e6..cc43843e46 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -831,17 +831,20 @@ bool list_do_action(int context, int timeout, | |||
831 | } | 831 | } |
832 | 832 | ||
833 | /* Simple use list implementation */ | 833 | /* Simple use list implementation */ |
834 | static int simplelist_line_count = 0; | 834 | static int simplelist_line_count = 0, simplelist_line_remaining; |
835 | static char simplelist_text[SIMPLELIST_MAX_LINES][SIMPLELIST_MAX_LINELENGTH]; | 835 | static int simplelist_line_pos; |
836 | static char simplelist_buffer[SIMPLELIST_MAX_LINES * SIMPLELIST_MAX_LINELENGTH]; | ||
837 | static char *simplelist_text[SIMPLELIST_MAX_LINES]; | ||
836 | /* set the amount of lines shown in the list */ | 838 | /* set the amount of lines shown in the list */ |
837 | void simplelist_set_line_count(int lines) | 839 | void simplelist_set_line_count(int lines) |
838 | { | 840 | { |
839 | if (lines < 0) | 841 | if (lines <= 0) { |
842 | simplelist_line_pos = 0; | ||
843 | simplelist_line_remaining = sizeof(simplelist_buffer); | ||
840 | simplelist_line_count = 0; | 844 | simplelist_line_count = 0; |
845 | } | ||
841 | else if (lines >= SIMPLELIST_MAX_LINES) | 846 | else if (lines >= SIMPLELIST_MAX_LINES) |
842 | simplelist_line_count = SIMPLELIST_MAX_LINES; | 847 | simplelist_line_count = SIMPLELIST_MAX_LINES; |
843 | else | ||
844 | simplelist_line_count = lines; | ||
845 | } | 848 | } |
846 | /* get the current amount of lines shown */ | 849 | /* get the current amount of lines shown */ |
847 | int simplelist_get_line_count(void) | 850 | int simplelist_get_line_count(void) |
@@ -851,20 +854,19 @@ int simplelist_get_line_count(void) | |||
851 | /* add/edit a line in the list. | 854 | /* add/edit a line in the list. |
852 | if line_number > number of lines shown it adds the line, | 855 | if line_number > number of lines shown it adds the line, |
853 | else it edits the line */ | 856 | else it edits the line */ |
854 | void simplelist_addline(int line_number, const char *fmt, ...) | 857 | void simplelist_addline(const char *fmt, ...) |
855 | { | 858 | { |
856 | va_list ap; | 859 | va_list ap; |
860 | size_t len = simplelist_line_remaining; | ||
861 | int line_number = simplelist_line_count++; | ||
857 | 862 | ||
858 | if (line_number > simplelist_line_count) | 863 | simplelist_text[line_number] = &simplelist_buffer[simplelist_line_pos]; |
859 | { | ||
860 | if (simplelist_line_count < SIMPLELIST_MAX_LINES) | ||
861 | line_number = simplelist_line_count++; | ||
862 | else | ||
863 | return; | ||
864 | } | ||
865 | va_start(ap, fmt); | 864 | va_start(ap, fmt); |
866 | vsnprintf(simplelist_text[line_number], SIMPLELIST_MAX_LINELENGTH, fmt, ap); | 865 | len = vsnprintf(simplelist_text[line_number], simplelist_line_remaining, fmt, ap); |
867 | va_end(ap); | 866 | va_end(ap); |
867 | len++; | ||
868 | simplelist_line_remaining -= len; | ||
869 | simplelist_line_pos += len; | ||
868 | } | 870 | } |
869 | 871 | ||
870 | static const char* simplelist_static_getname(int item, | 872 | static const char* simplelist_static_getname(int item, |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 162bb38e1a..8980573aa3 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -265,10 +265,8 @@ struct simplelist_info { | |||
265 | void simplelist_set_line_count(int lines); | 265 | void simplelist_set_line_count(int lines); |
266 | /* get the current amount of lines shown */ | 266 | /* get the current amount of lines shown */ |
267 | int simplelist_get_line_count(void); | 267 | int simplelist_get_line_count(void); |
268 | /* add/edit a line in the list. | 268 | /* add a line in the list. */ |
269 | if line_number > number of lines shown it adds the line, else it edits the line */ | 269 | void simplelist_addline(const char *fmt, ...); |
270 | #define SIMPLELIST_ADD_LINE (SIMPLELIST_MAX_LINES+1) | ||
271 | void simplelist_addline(int line_number, const char *fmt, ...); | ||
272 | 270 | ||
273 | /* setup the info struct. members not setup in this function need to be assigned manually | 271 | /* setup the info struct. members not setup in this function need to be assigned manually |
274 | members set in this function: | 272 | members set in this function: |