4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11 * Cherepanov Vitaliy <v.cherepanov@samsung.com>
12 * Nikita Kalyazin <n.kalyazin@samsung.com>
14 * Licensed under the Apache License, Version 2.0 (the "License");
15 * you may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
18 * http://www.apache.org/licenses/LICENSE-2.0
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
28 * - Samsung RnD Institute Russia
40 #define CHARGERFD "/sys/class/power_supply/battery/charge_now"
41 #define VOLTAGEFD "/sys/class/power_supply/battery/voltage_now"
43 #define BRIGHTNESS_FILENAME "brightness"
44 #define MAX_BRIGHTNESS_FILENAME "max_brightness"
45 #define BRIGHTNESS_PARENT_DIR "/sys/class/backlight"
47 #define EMUL_BRIGHTNESSFD "/sys/class/backlight/emulator/brightness"
48 #define EMUL_MAX_BRIGHTNESSFD "/sys/class/backlight/emulator/max_brightness"
50 #define AUDIOFD "/sys/devices/platform/soc-audio/WM1811 Voice/dapm_widget"
52 #define MFCFD "/sys/devices/platform/samsung-pd.0/power/runtime_status"
54 #define FREQFD "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
56 #define CPUDIR "/sys/devices/system/cpu"
57 #define CPUFREQ_FILE "cpufreq/stats/time_in_state"
58 #define CPUNUM_OF_FREQ CPUDIR"/cpu0/"CPUFREQ_FILE
61 #define MEMINFOFD "/sys/class/memnotify/meminfo"
62 #define UMSFD "/mnt/ums"
63 #define MMCBLKFD "/dev/mmcblk1"
64 #define MMCFD "/mnt/mmc"
66 #define PROCSTAT "/proc/stat"
67 #define PROCMEMINFO "/proc/meminfo"
68 #define PROCCPUINFO "/proc/cpuinfo"
70 #define MEM_TYPE_TOTAL 1
71 #define MEM_TYPE_USED 2
72 #define MEM_TYPE_FREE 3
74 #define FSINFO_TYPE_TOTAL 1
75 #define FSINFO_TYPE_FREE 2
77 #define NWTYPE_SIZE 128
78 #define MAXNAMESIZE 16
82 #include "da_protocol.h"
84 typedef unsigned long long tic_t;
88 char command[MAXNAMESIZE];
96 unsigned long minor_fault;
97 unsigned long cminor_fault;
98 unsigned long major_fault;
99 unsigned long cmajor_fault;
100 unsigned long long utime;
101 unsigned long long stime;
102 unsigned long long cutime;
103 unsigned long long cstime;
108 unsigned long long start_time;
109 unsigned long vir_mem;
110 unsigned long sh_mem;
122 tic_t u, n, s, i, w, x, y, z;
123 tic_t u_sav, n_sav, s_sav, i_sav, w_sav, x_sav, y_sav, z_sav;
124 unsigned int id; // cpu id
125 float cpu_usage; // cpu load for this core
126 int sav_load_index; // saved cpu load sampling index
127 int cur_load_index; // current cpu load sampling index
128 cpufreq_t* pfreq; // frequency information of cpu
129 int sav_freq_index; // sav cpu frequency sampling index
130 int cur_freq_index; // current cpu frequency sampling index
131 long long idle_ticks;
132 long long total_ticks;
133 } CPU_t; // for each cpu core
135 typedef struct _mem_t {
136 const char* name; // memory slot name
137 unsigned long* slot; // memory value slot
140 struct target_info_t {
141 uint64_t sys_mem_size;
142 uint64_t storage_size;
143 uint32_t bluetooth_supp;
146 uint32_t camera_count;
147 char network_type[NWTYPE_SIZE];
148 uint32_t max_brightness;
149 uint32_t cpu_core_count;
152 int get_system_info(struct system_info_t *sys_info);
154 int get_device_info(char* buffer, int buffer_len);
156 int get_file_status(int* pfd, const char* filename);
158 int initialize_system_info(void);
160 int finalize_system_info(void);
162 int fill_target_info(struct target_info_t *target_info);
164 int init_system_file_descriptors(void);
165 void close_system_file_descriptors(void);
166 int sys_stat_prepare(void);