Daniel Lezcano | 03fc66b | 2011-08-25 15:46:13 +0200 | [diff] [blame^] | 1 | /******************************************************************************* |
| 2 | * Copyright (C) 2010, Linaro Limited. |
| 3 | * |
| 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 | * Daniel Lezcano <daniel.lezcano@linaro.org> (IBM Corporation) |
| 13 | * - initial API and implementation |
| 14 | *******************************************************************************/ |
| 15 | |
| 16 | #ifndef _GNU_SOURCE |
| 17 | #define _GNU_SOURCE |
| 18 | #include <stdio.h> |
| 19 | #undef _GNU_SOURCE |
| 20 | #endif |
| 21 | #include <mntent.h> |
| 22 | #include <string.h> |
| 23 | #include <stdbool.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <unistd.h> |
| 26 | #include <sys/param.h> |
| 27 | #include <sys/stat.h> |
| 28 | |
| 29 | #include "powerdebug.h" |
| 30 | #include "display.h" |
| 31 | #include "tree.h" |
| 32 | #include "utils.h" |
| 33 | |
| 34 | #define SYSFS_GPIO "/sys/class/gpio" |
| 35 | |
| 36 | static struct tree *gpio_tree = NULL; |
| 37 | |
| 38 | static int gpio_display(bool refresh) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static int gpio_select(void) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | static int gpio_find(const char *name) |
| 49 | { |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | static int gpio_selectf(void) |
| 54 | { |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | static struct display_ops gpio_ops = { |
| 59 | .display = gpio_display, |
| 60 | .select = gpio_select, |
| 61 | .find = gpio_find, |
| 62 | .selectf = gpio_selectf, |
| 63 | }; |
| 64 | |
| 65 | static inline int read_gpio_cb(struct tree *t, void *data) |
| 66 | { |
| 67 | return 0; |
| 68 | } |
| 69 | |
| 70 | static int read_gpio_info(struct tree *tree) |
| 71 | { |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | static int fill_gpio_cb(struct tree *t, void *data) |
| 76 | { |
| 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | static int fill_gpio_tree(void) |
| 81 | { |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | int gpio_dump(void) |
| 86 | { |
| 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | /* |
| 91 | * Initialize the gpio framework |
| 92 | */ |
| 93 | int gpio_init(void) |
| 94 | { |
| 95 | gpio_tree = tree_load(SYSFS_GPIO, NULL, false); |
| 96 | if (!gpio_tree) |
| 97 | return -1; |
| 98 | |
| 99 | if (fill_gpio_tree()) |
| 100 | return -1; |
| 101 | |
| 102 | return display_register(GPIO, &gpio_ops); |
| 103 | } |