···2728/*
29 NOTE: storage_idle_notify usage notes..
30-311) The callbacks are called in the ata thread, not main/your thread.
322) Asynchronous callbacks (like the buffer refill) should be avoided.
33 If you must use an async callback, remember to check storage_is_active() before
···46/* Enable storage callbacks everywhere except for bootloaders. Both
47 * hosted and native targets need this.
48 */
49-#define USING_STORAGE_CALLBACK !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__)
005051extern void register_storage_idle_func(void (*function)(void));
52-#if USING_STORAGE_CALLBACK
53extern void unregister_storage_idle_func(void (*function)(void), bool run);
54extern bool call_storage_idle_notifys(bool force);
55#else
···2728/*
29 NOTE: storage_idle_notify usage notes..
30+311) The callbacks are called in the ata thread, not main/your thread.
322) Asynchronous callbacks (like the buffer refill) should be avoided.
33 If you must use an async callback, remember to check storage_is_active() before
···46/* Enable storage callbacks everywhere except for bootloaders. Both
47 * hosted and native targets need this.
48 */
49+#if !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__)
50+#define USING_STORAGE_CALLBACK
51+#endif
5253extern void register_storage_idle_func(void (*function)(void));
54+#ifdef USING_STORAGE_CALLBACK
55extern void unregister_storage_idle_func(void (*function)(void), bool run);
56extern bool call_storage_idle_notifys(bool force);
57#else
+6-5
firmware/powermgmt.c
···131/* Time estimation requires 64 bit math so don't use it in the bootloader.
132 * Also we need to be able to measure current, and not have a better time
133 * estimate source available. */
134-#define HAVE_TIME_ESTIMATION \
135- (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \
136 (defined(CURRENT_NORMAL) || (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)))
00137138#if !(CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
139int _battery_level(void) { return -1; }
···146static int time_now; /* Cached to avoid polling too often */
147#endif
148149-#if HAVE_TIME_ESTIMATION
150static int time_now; /* reported time in minutes */
151static int64_t time_cnt; /* reported time in seconds */
152static int64_t time_err; /* error... it's complicated */
···186 * on the battery level and the actual current usage. */
187int battery_time(void)
188{
189-#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || HAVE_TIME_ESTIMATION
190 return time_now;
191#else
192 return -1;
···401402#if CONFIG_BATTERY_MEASURE & TIME_MEASURE
403 time_now = _battery_time();
404-#elif HAVE_TIME_ESTIMATION
405 /* TODO: This is essentially a bad version of coloumb counting,
406 * so in theory using coloumb counters when they are available
407 * should provide a more accurate result. Also note that this
···131/* Time estimation requires 64 bit math so don't use it in the bootloader.
132 * Also we need to be able to measure current, and not have a better time
133 * estimate source available. */
134+#if (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \
0135 (defined(CURRENT_NORMAL) || (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)))
136+#define HAVE_TIME_ESTIMATION
137+#endif
138139#if !(CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
140int _battery_level(void) { return -1; }
···147static int time_now; /* Cached to avoid polling too often */
148#endif
149150+#ifdef HAVE_TIME_ESTIMATION
151static int time_now; /* reported time in minutes */
152static int64_t time_cnt; /* reported time in seconds */
153static int64_t time_err; /* error... it's complicated */
···187 * on the battery level and the actual current usage. */
188int battery_time(void)
189{
190+#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || defined(HAVE_TIME_ESTIMATION)
191 return time_now;
192#else
193 return -1;
···402403#if CONFIG_BATTERY_MEASURE & TIME_MEASURE
404 time_now = _battery_time();
405+#elif defined(HAVE_TIME_ESTIMATION)
406 /* TODO: This is essentially a bad version of coloumb counting,
407 * so in theory using coloumb counters when they are available
408 * should provide a more accurate result. Also note that this
+1-1
tools/configure
···46144615 if test "$gccnum" -ge "700"; then
4616 # gcc 7 spews a bunch of warnings by default
4617- GCCOPTS="$GCCOPTS -Wno-expansion-to-defined -Wimplicit-fallthrough=0"
4618 fi
46194620 case "$GCCOPTS" in
···46144615 if test "$gccnum" -ge "700"; then
4616 # gcc 7 spews a bunch of warnings by default
4617+ GCCOPTS="$GCCOPTS -Wimplicit-fallthrough=0"
4618 fi
46194620 case "$GCCOPTS" in