summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c67
-rw-r--r--firmware/export/ascodec.h2
-rw-r--r--firmware/export/powermgmt.h2
-rw-r--r--firmware/target/arm/as3525/ascodec-as3525.c4
4 files changed, 37 insertions, 38 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 57ba9f5d0a..d35f40229e 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -111,7 +111,7 @@
111#endif 111#endif
112#include "appevents.h" 112#include "appevents.h"
113 113
114#if defined(HAVE_AS3514) && defined(CONFIG_CHARGING) 114#if defined(HAVE_AS3514) && CONFIG_CHARGING
115#include "ascodec.h" 115#include "ascodec.h"
116#endif 116#endif
117 117
@@ -119,8 +119,8 @@
119#include "pmu-target.h" 119#include "pmu-target.h"
120#endif 120#endif
121 121
122#ifdef HAVE_USBSTACK 122#ifdef HAVE_USBSTACK
123#include "usb_core.h" 123#include "usb_core.h"
124#endif 124#endif
125 125
126#if defined(IPOD_ACCESSORY_PROTOCOL) 126#if defined(IPOD_ACCESSORY_PROTOCOL)
@@ -374,7 +374,7 @@ static void dbg_audio_task(void)
374static bool dbg_buffering_thread(void) 374static bool dbg_buffering_thread(void)
375{ 375{
376 int button; 376 int button;
377 int line; 377 int line;
378 bool done = false; 378 bool done = false;
379 size_t bufused; 379 size_t bufused;
380 size_t bufsize = pcmbuf_get_bufsize(); 380 size_t bufsize = pcmbuf_get_bufsize();
@@ -389,10 +389,10 @@ static bool dbg_buffering_thread(void)
389 ticks = freq_sum = 0; 389 ticks = freq_sum = 0;
390 390
391 tick_add_task(dbg_audio_task); 391 tick_add_task(dbg_audio_task);
392 392
393 FOR_NB_SCREENS(i) 393 FOR_NB_SCREENS(i)
394 screens[i].setfont(FONT_SYSFIXED); 394 screens[i].setfont(FONT_SYSFIXED);
395 395
396 while(!done) 396 while(!done)
397 { 397 {
398 button = get_action(CONTEXT_STD,HZ/5); 398 button = get_action(CONTEXT_STD,HZ/5);
@@ -412,7 +412,7 @@ static bool dbg_buffering_thread(void)
412 buffering_get_debugdata(&d); 412 buffering_get_debugdata(&d);
413 bufused = bufsize - pcmbuf_free(); 413 bufused = bufsize - pcmbuf_free();
414 414
415 FOR_NB_SCREENS(i) 415 FOR_NB_SCREENS(i)
416 { 416 {
417 line = 0; 417 line = 0;
418 screens[i].clear_display(); 418 screens[i].clear_display();
@@ -489,7 +489,7 @@ static bool dbg_buffering_thread(void)
489 } 489 }
490 490
491 tick_remove_task(dbg_audio_task); 491 tick_remove_task(dbg_audio_task);
492 492
493 FOR_NB_SCREENS(i) 493 FOR_NB_SCREENS(i)
494 screens[i].setfont(FONT_UI); 494 screens[i].setfont(FONT_UI);
495 495
@@ -917,7 +917,7 @@ static bool view_battery(void)
917 } 917 }
918 /* print header */ 918 /* print header */
919#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE) 919#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
920 /* adjust grid scale */ 920 /* adjust grid scale */
921 if ((maxv - minv) > 50) 921 if ((maxv - minv) > 50)
922 grid = 50; 922 grid = 50;
923 else 923 else
@@ -929,7 +929,7 @@ static bool view_battery(void)
929 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000, 929 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
930 grid); 930 grid);
931#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE) 931#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
932 /* adjust grid scale */ 932 /* adjust grid scale */
933 if ((maxv - minv) > 10) 933 if ((maxv - minv) > 10)
934 grid = 10; 934 grid = 10;
935 else 935 else
@@ -937,31 +937,31 @@ static bool view_battery(void)
937 lcd_putsf(0, 0, "battery %d%%", power_history[0]); 937 lcd_putsf(0, 0, "battery %d%%", power_history[0]);
938 lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid); 938 lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
939#endif 939#endif
940 940
941 i = 1; 941 i = 1;
942 while ((y = (minv - (minv % grid)+i*grid)) < maxv) 942 while ((y = (minv - (minv % grid)+i*grid)) < maxv)
943 { 943 {
944 graph = ((y-minv)*BAT_YSPACE)/(maxv-minv); 944 graph = ((y-minv)*BAT_YSPACE)/(maxv-minv);
945 graph = LCD_HEIGHT-1 - graph; 945 graph = LCD_HEIGHT-1 - graph;
946 946
947 /* draw dotted horizontal grid line */ 947 /* draw dotted horizontal grid line */
948 for (x=0; x<LCD_WIDTH;x=x+2) 948 for (x=0; x<LCD_WIDTH;x=x+2)
949 lcd_drawpixel(x,graph); 949 lcd_drawpixel(x,graph);
950 950
951 i++; 951 i++;
952 } 952 }
953 953
954 x = 0; 954 x = 0;
955 /* draw plot of power history 955 /* draw plot of power history
956 * skip empty entries 956 * skip empty entries
957 */ 957 */
958 for (i = BAT_LAST_VAL - 1; i > 0; i--) 958 for (i = BAT_LAST_VAL - 1; i > 0; i--)
959 { 959 {
960 if (power_history[i] && power_history[i-1]) 960 if (power_history[i] && power_history[i-1])
961 { 961 {
962 y1 = (power_history[i] - minv) * BAT_YSPACE / 962 y1 = (power_history[i] - minv) * BAT_YSPACE /
963 (maxv - minv); 963 (maxv - minv);
964 y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE), 964 y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
965 LCD_HEIGHT-1); 965 LCD_HEIGHT-1);
966 y2 = (power_history[i-1] - minv) * BAT_YSPACE / 966 y2 = (power_history[i-1] - minv) * BAT_YSPACE /
967 (maxv - minv); 967 (maxv - minv);
@@ -971,13 +971,13 @@ static bool view_battery(void)
971 lcd_set_drawmode(DRMODE_SOLID); 971 lcd_set_drawmode(DRMODE_SOLID);
972 972
973 /* make line thicker */ 973 /* make line thicker */
974 lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)), 974 lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
975 y1, 975 y1,
976 (((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)), 976 (((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
977 y2); 977 y2);
978 lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1, 978 lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
979 y1+1, 979 y1+1,
980 (((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1, 980 (((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
981 y2+1); 981 y2+1);
982 x++; 982 x++;
983 } 983 }
@@ -988,7 +988,7 @@ static bool view_battery(void)
988#if CONFIG_CHARGING >= CHARGING_MONITOR 988#if CONFIG_CHARGING >= CHARGING_MONITOR
989 lcd_putsf(0, 0, "Pwr status: %s", 989 lcd_putsf(0, 0, "Pwr status: %s",
990 charging_state() ? "charging" : "discharging"); 990 charging_state() ? "charging" : "discharging");
991#else 991#else
992 lcd_puts(0, 0, "Power status: unknown"); 992 lcd_puts(0, 0, "Power status: unknown");
993#endif 993#endif
994 battery_read_info(&y, &z); 994 battery_read_info(&y, &z);
@@ -1107,8 +1107,7 @@ static bool view_battery(void)
1107 /* Conversion disabled */ 1107 /* Conversion disabled */
1108 lcd_puts(0, line++, "T Battery: ?"); 1108 lcd_puts(0, line++, "T Battery: ?");
1109 } 1109 }
1110 1110#elif defined(HAVE_AS3514) && CONFIG_CHARGING
1111#elif defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
1112 static const char * const chrgstate_strings[] = 1111 static const char * const chrgstate_strings[] =
1113 { 1112 {
1114 [CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled", 1113 [CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled",
@@ -1371,7 +1370,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1371 } 1370 }
1372 return btn; 1371 return btn;
1373} 1372}
1374#elif (CONFIG_STORAGE & STORAGE_ATA) 1373#elif (CONFIG_STORAGE & STORAGE_ATA)
1375static int disk_callback(int btn, struct gui_synclist *lists) 1374static int disk_callback(int btn, struct gui_synclist *lists)
1376{ 1375{
1377 (void)lists; 1376 (void)lists;
@@ -1740,7 +1739,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1740} 1739}
1741#endif 1740#endif
1742 1741
1743#if (CONFIG_STORAGE & STORAGE_ATA) 1742#if (CONFIG_STORAGE & STORAGE_ATA)
1744static bool dbg_identify_info(void) 1743static bool dbg_identify_info(void)
1745{ 1744{
1746 int fd = creat("/identify_info.bin", 0666); 1745 int fd = creat("/identify_info.bin", 0666);
@@ -1869,9 +1868,9 @@ static int database_callback(int btn, struct gui_synclist *lists)
1869 simplelist_addline("Commit delayed: %s", 1868 simplelist_addline("Commit delayed: %s",
1870 stat->commit_delayed ? "Yes" : "No"); 1869 stat->commit_delayed ? "Yes" : "No");
1871 1870
1872 simplelist_addline("Queue length: %d", 1871 simplelist_addline("Queue length: %d",
1873 stat->queue_length); 1872 stat->queue_length);
1874 1873
1875 if (synced) 1874 if (synced)
1876 { 1875 {
1877 synced = false; 1876 synced = false;
@@ -1896,7 +1895,7 @@ static bool dbg_tagcache_info(void)
1896 info.action_callback = database_callback; 1895 info.action_callback = database_callback;
1897 info.hide_selection = true; 1896 info.hide_selection = true;
1898 info.scroll_all = true; 1897 info.scroll_all = true;
1899 1898
1900 /* Don't do nonblock here, must give enough processing time 1899 /* Don't do nonblock here, must give enough processing time
1901 for tagcache thread. */ 1900 for tagcache thread. */
1902 /* info.timeout = TIMEOUT_NOBLOCK; */ 1901 /* info.timeout = TIMEOUT_NOBLOCK; */
@@ -2179,7 +2178,7 @@ static bool dbg_fm_radio(void)
2179 struct simplelist_info info; 2178 struct simplelist_info info;
2180#ifdef CONFIG_TUNER_MULTI 2179#ifdef CONFIG_TUNER_MULTI
2181 tuner_type = tuner_detect_type(); 2180 tuner_type = tuner_detect_type();
2182#endif 2181#endif
2183 info.scroll_all = true; 2182 info.scroll_all = true;
2184 simplelist_info_init(&info, "FM Radio", 1, NULL); 2183 simplelist_info_init(&info, "FM Radio", 1, NULL);
2185 simplelist_set_line_count(0); 2184 simplelist_set_line_count(0);
@@ -2446,7 +2445,7 @@ static bool dbg_isp1583(void)
2446 struct simplelist_info isp1583; 2445 struct simplelist_info isp1583;
2447 isp1583.scroll_all = true; 2446 isp1583.scroll_all = true;
2448 simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL); 2447 simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL);
2449 isp1583.timeout = HZ/100; 2448 isp1583.timeout = HZ/100;
2450 isp1583.hide_selection = true; 2449 isp1583.hide_selection = true;
2451 isp1583.get_name = dbg_usb_item; 2450 isp1583.get_name = dbg_usb_item;
2452 isp1583.action_callback = isp1583_action_callback; 2451 isp1583.action_callback = isp1583_action_callback;
@@ -2472,7 +2471,7 @@ static bool dbg_pic(void)
2472 struct simplelist_info pic; 2471 struct simplelist_info pic;
2473 pic.scroll_all = true; 2472 pic.scroll_all = true;
2474 simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL); 2473 simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL);
2475 pic.timeout = HZ/100; 2474 pic.timeout = HZ/100;
2476 pic.hide_selection = true; 2475 pic.hide_selection = true;
2477 pic.get_name = pic_dbg_item; 2476 pic.get_name = pic_dbg_item;
2478 pic.action_callback = pic_action_callback; 2477 pic.action_callback = pic_action_callback;
diff --git a/firmware/export/ascodec.h b/firmware/export/ascodec.h
index 94030a2b34..8697adb00d 100644
--- a/firmware/export/ascodec.h
+++ b/firmware/export/ascodec.h
@@ -45,7 +45,7 @@ int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data)
45 45
46void ascodec_wait_adc_finished(void); 46void ascodec_wait_adc_finished(void);
47 47
48#ifdef CONFIG_CHARGING 48#if CONFIG_CHARGING
49bool ascodec_endofch(void); 49bool ascodec_endofch(void);
50bool ascodec_chg_status(void); 50bool ascodec_chg_status(void);
51void ascodec_monitor_endofch(void); 51void ascodec_monitor_endofch(void);
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index d79d560150..f6b71a864e 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -49,7 +49,7 @@ enum charge_state_type
49/* tells what the charger is doing */ 49/* tells what the charger is doing */
50extern enum charge_state_type charge_state; 50extern enum charge_state_type charge_state;
51 51
52#ifdef CONFIG_CHARGING 52#if CONFIG_CHARGING
53/* 53/*
54 * Flag that the charger has been plugged in/removed: this is set for exactly 54 * Flag that the charger has been plugged in/removed: this is set for exactly
55 * one time through the power loop when the charger has been plugged in. 55 * one time through the power loop when the charger has been plugged in.
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c
index 634648afe4..d930d266a6 100644
--- a/firmware/target/arm/as3525/ascodec-as3525.c
+++ b/firmware/target/arm/as3525/ascodec-as3525.c
@@ -297,7 +297,7 @@ void ascodec_init(void)
297 297
298 /* Generate irq for usb+charge status change */ 298 /* Generate irq for usb+charge status change */
299 ascodec_write(AS3514_IRQ_ENRD0, 299 ascodec_write(AS3514_IRQ_ENRD0,
300#ifdef CONFIG_CHARGING /* m200v4 can't charge */ 300#if CONFIG_CHARGING /* m200v4 can't charge */
301 IRQ_CHGSTAT | IRQ_ENDOFCH | 301 IRQ_CHGSTAT | IRQ_ENDOFCH |
302#endif 302#endif
303 IRQ_USBSTAT); 303 IRQ_USBSTAT);
@@ -530,7 +530,7 @@ void ascodec_wait_adc_finished(void)
530 semaphore_wait(&adc_done_sem, TIMEOUT_BLOCK); 530 semaphore_wait(&adc_done_sem, TIMEOUT_BLOCK);
531} 531}
532 532
533#ifdef CONFIG_CHARGING 533#if CONFIG_CHARGING
534bool ascodec_endofch(void) 534bool ascodec_endofch(void)
535{ 535{
536 bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH; 536 bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH;