freemyipod r845 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r844‎ | r845 | r846 >
Date:22:40, 26 December 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Extend power management API
Modified paths:
  • /emcore/trunk/export/syscallapi.h (modified) (history)
  • /emcore/trunk/export/syscallwrappers.h (modified) (history)
  • /emcore/trunk/power.h (modified) (history)
  • /emcore/trunk/syscallapi.c (modified) (history)
  • /emcore/trunk/target/ipodnano2g/power.c (modified) (history)
  • /emcore/trunk/target/ipodnano3g/power.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano2g/power.c
@@ -105,11 +105,6 @@
106106 return -1;
107107 }
108108
109 -int read_input_mw(int battery)
110 -{
111 - return -1;
112 -}
113 -
114109 enum battery_state read_battery_state(int battery)
115110 {
116111 if (battery != 0) return BATTERY_STATE_INVALID;
@@ -117,3 +112,25 @@
118113 if (external_power_state()) return BATTERY_STATE_IDLE;
119114 return BATTERY_STATE_DISCHARGING;
120115 }
 116+
 117+int read_input_voltage(int input)
 118+{
 119+ return -1;
 120+}
 121+
 122+int read_input_current(int input)
 123+{
 124+ return -1;
 125+}
 126+
 127+int read_input_mw(int input)
 128+{
 129+ return -1;
 130+}
 131+
 132+enum input_state read_input_state(int input)
 133+{
 134+ if (input != 0) return INPUT_STATE_INVALID;
 135+ if (external_power_state()) return INPUT_STATE_ACTIVE;
 136+ return INPUT_STATE_NONPRESENT;
 137+}
Index: emcore/trunk/target/ipodnano3g/power.c
@@ -94,11 +94,6 @@
9595 return -1;
9696 }
9797
98 -int read_input_mw(int battery)
99 -{
100 - return -1;
101 -}
102 -
10398 enum battery_state read_battery_state(int battery)
10499 {
105100 if (battery != 0) return BATTERY_STATE_INVALID;
@@ -106,3 +101,25 @@
107102 if (external_power_state()) return BATTERY_STATE_IDLE;
108103 return BATTERY_STATE_DISCHARGING;
109104 }
 105+
 106+int read_input_voltage(int input)
 107+{
 108+ return -1;
 109+}
 110+
 111+int read_input_current(int input)
 112+{
 113+ return -1;
 114+}
 115+
 116+int read_input_mw(int input)
 117+{
 118+ return -1;
 119+}
 120+
 121+enum input_state read_input_state(int input)
 122+{
 123+ if (input != 0) return INPUT_STATE_INVALID;
 124+ if (external_power_state()) return INPUT_STATE_ACTIVE;
 125+ return INPUT_STATE_NONPRESENT;
 126+}
Index: emcore/trunk/export/syscallwrappers.h
@@ -217,8 +217,11 @@
218218 #define read_battery_mwh_full __emcore_syscall->read_battery_mwh_full
219219 #define read_battery_mwh_current __emcore_syscall->read_battery_mwh_current
220220 #define read_battery_mw __emcore_syscall->read_battery_mw
 221+#define read_battery_state __emcore_syscall->read_battery_state
 222+#define read_input_voltage __emcore_syscall->read_input_voltage
 223+#define read_input_current __emcore_syscall->read_input_current
221224 #define read_input_mw __emcore_syscall->read_input_mw
222 -#define read_battery_state __emcore_syscall->read_battery_state
 225+#define read_input_state __emcore_syscall->read_input_state
223226 #define tlsf_realign __emcore_syscall->tlsf_realign
224227 #define realign __emcore_syscall->realign
225228 #define fat_size_mv __emcore_syscall->fat_size_mv
Index: emcore/trunk/export/syscallapi.h
@@ -277,8 +277,11 @@
278278 typeof(read_battery_mwh_full) *read_battery_mwh_full;
279279 typeof(read_battery_mwh_current) *read_battery_mwh_current;
280280 typeof(read_battery_mw) *read_battery_mw;
 281+ typeof(read_battery_state) *read_battery_state;
 282+ typeof(read_input_voltage) *read_input_voltage;
 283+ typeof(read_input_current) *read_input_current;
281284 typeof(read_input_mw) *read_input_mw;
282 - typeof(read_battery_state) *read_battery_state;
 285+ typeof(read_input_state) *read_input_state;
283286 typeof(tlsf_realign) *tlsf_realign;
284287 typeof(realign) *realign;
285288 typeof(fat_size_mv) *fat_size_mv;
Index: emcore/trunk/power.h
@@ -38,7 +38,17 @@
3939 BATTERY_STATE_DISCHARGING
4040 };
4141
 42+enum input_state
 43+{
 44+ INPUT_STATE_UNKNOWN,
 45+ INPUT_STATE_INVALID,
 46+ INPUT_STATE_NONPRESENT,
 47+ INPUT_STATE_OUTOFRANGE,
 48+ INPUT_STATE_IDLE,
 49+ INPUT_STATE_ACTIVE
 50+};
4251
 52+
4353 void power_off(void);
4454 void power_init(void) INITCODE_ATTR;
4555 bool charging_state(void);
@@ -50,8 +60,11 @@
5161 int read_battery_mwh_full(int battery);
5262 int read_battery_mwh_current(int battery);
5363 int read_battery_mw(int battery);
54 -int read_input_mw(int battery);
5564 enum battery_state read_battery_state(int battery);
 65+int read_input_voltage(int input);
 66+int read_input_current(int input);
 67+int read_input_mw(int input);
 68+enum input_state read_input_state(int input);
5669
5770
5871 #endif
Index: emcore/trunk/syscallapi.c
@@ -240,8 +240,11 @@
241241 .read_battery_mwh_full = read_battery_mwh_full,
242242 .read_battery_mwh_current = read_battery_mwh_current,
243243 .read_battery_mw = read_battery_mw,
 244+ .read_battery_state = read_battery_state,
 245+ .read_input_voltage = read_input_voltage,
 246+ .read_input_current = read_input_current,
244247 .read_input_mw = read_input_mw,
245 - .read_battery_state = read_battery_state,
 248+ .read_input_state = read_input_state,
246249 .tlsf_realign = tlsf_realign,
247250 .realign = realign,
248251 #ifdef HAVE_STORAGE