blob: 8fd2775f16f8f16573a521cf37bdf812696ecf3d [file] [log] [blame]
Amit Arora39f29542010-09-14 12:03:22 +05301/*******************************************************************************
Amit Kucheriac0e17fc2011-01-17 09:35:52 +02002 * Copyright (C) 2010, Linaro Limited.
Amit Arora39f29542010-09-14 12:03:22 +05303 *
4 * This file is part of PowerDebug.
5 *
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors:
12 * Amit Arora <amit.arora@linaro.org> (IBM Corporation)
13 * - initial API and implementation
14 *******************************************************************************/
15
Amit Arorae9e16b02010-08-03 10:15:20 +053016#include <stdio.h>
17#include <stdlib.h>
18#include <unistd.h>
19#include <string.h>
20#include <dirent.h>
21#include <getopt.h>
22#include <errno.h>
Amit Arora47fd9182010-08-24 13:26:06 +053023#include <ncurses.h>
Amit Arorae9e16b02010-08-03 10:15:20 +053024
Amit Kucheria5bd36f82011-01-24 13:15:27 +020025#define VERSION "0.4.1"
Amit Arorafefe8bf2010-08-05 13:31:20 +053026
Amit Arorac93e0712010-10-07 13:51:53 +053027#define TOTAL_FEATURE_WINS 3 /* Regulator, Clock and Sensor (for now) */
Amit Kucheriaee851a12011-01-12 04:57:48 +053028enum {CLOCK, REGULATOR, SENSOR};
Amit Aroraa06a7302010-12-02 15:59:37 +053029enum {CLOCK_SELECTED = 1, REFRESH_WINDOW};
Amit Arorae9e16b02010-08-03 10:15:20 +053030
Daniel Lezcano2adc48d2011-06-08 23:30:01 +020031extern int read_and_dump_clock_info(char *clk);
Daniel Lezcano897f7332011-03-26 22:06:06 +010032extern void find_parents_for_clock(char *clkname, int complete);
Daniel Lezcano05916f82011-06-08 23:30:01 +020033extern int read_and_print_clock_info(void);
Daniel Lezcano2adc48d2011-06-08 23:30:01 +020034extern int print_clock_info(int hrow, int selected);
Amit Aroradca56d02010-08-05 14:57:22 +053035extern void print_string_val(char *name, char *val);
Amit Aroraac4e8652010-11-09 11:16:53 +053036extern void print_clock_header(void);
Daniel Lezcano2adc48d2011-06-08 23:30:01 +020037
Daniel Lezcanob3e6e812011-06-15 15:45:12 +020038extern int display_print_line(int window, int line, char *str,
39 int bold, void *data);
Daniel Lezcano2adc48d2011-06-08 23:30:01 +020040
Daniel Lezcanob3e6e812011-06-15 15:45:12 +020041extern int display_refresh_pad(int window);
42extern int display_reset_cursor(int window);
43extern int display_next_line(int window);
44extern int display_prev_line(int window);
45extern void *display_get_row_data(int window);
Daniel Lezcano2adc48d2011-06-08 23:30:01 +020046
47extern int clock_toggle_expanded(void);
Daniel Lezcanob3e6e812011-06-15 15:45:12 +020048extern int display_clock_select(int window, int line);
49extern int display_clock_unselect(int window, int line, bool bold);
Amit Arora47fd9182010-08-24 13:26:06 +053050
Amit Arora17552782010-12-02 12:23:14 +053051extern void get_sensor_info(char *path, char *name, char *sensor, int verbose);
52extern int read_and_print_sensor_info(int verbose);
53extern void print_sensor_header(void);
54
Amit Arorac93e0712010-10-07 13:51:53 +053055extern void killall_windows(int all);
Daniel Lezcano558a6d52011-03-23 14:37:41 +010056extern void show_header(int selectedwindow);
57extern void create_windows(int selectedwindow);
58extern void create_selectedwindow(int selectedwindow);
Daniel Lezcano691d5562011-03-26 22:05:57 +010059
60struct regulator_info;
Daniel Lezcano833b63a2011-03-26 22:06:00 +010061extern void show_regulator_info(struct regulator_info *reg_info,
62 int nr_reg, int verbose);