diff options
author | Lorenzo Miori <memoryS60@gmail.com> | 2013-12-28 19:00:57 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-05 21:57:31 +0100 |
commit | f005d841f292287326b8b9d1a74aac9bf3abbfc3 (patch) | |
tree | 4839b0a83e9af55a372610d65916aecbf06c563a /firmware/target/hosted/samsungypr/gpio-ypr.c | |
parent | e32ace831af98fd50bf0c08999802ce0f6a51bc8 (diff) | |
download | rockbox-f005d841f292287326b8b9d1a74aac9bf3abbfc3.tar.gz rockbox-f005d841f292287326b8b9d1a74aac9bf3abbfc3.zip |
Samsung YP-R0/YP-R1 refactoring
This patch includes some refactoring:
- renaming according to Rockbox guidelines
- GPIO code merging, still with target defines
- some simplification in firmware/SOURCES
Change-Id: I7fd95aece53f40efdf8caac22348376615795431
Diffstat (limited to 'firmware/target/hosted/samsungypr/gpio-ypr.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/gpio-ypr.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/gpio-ypr.c b/firmware/target/hosted/samsungypr/gpio-ypr.c new file mode 100644 index 0000000000..e5abc4cdc9 --- /dev/null +++ b/firmware/target/hosted/samsungypr/gpio-ypr.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Module wrapper for GPIO, using kernel module of Samsung YP-R0/YP-R1 | ||
10 | * | ||
11 | * Copyright (c) 2011 Lorenzo Miori | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <unistd.h> | ||
25 | #include <fcntl.h> | ||
26 | #include <gpio-ypr.h> /* includes common ioctl device definitions */ | ||
27 | #include <sys/ioctl.h> | ||
28 | |||
29 | static int gpio_dev = 0; | ||
30 | |||
31 | void gpio_init(void) | ||
32 | { | ||
33 | gpio_dev = open(GPIO_DEVICE, O_RDONLY); | ||
34 | if (gpio_dev < 0) | ||
35 | printf("GPIO device open error!"); | ||
36 | } | ||
37 | |||
38 | void gpio_close(void) | ||
39 | { | ||
40 | if (gpio_dev >= 0) | ||
41 | close(gpio_dev); | ||
42 | } | ||
43 | |||
44 | int gpio_control(int request, int num, int mode, int val) | ||
45 | { | ||
46 | struct gpio_info r = { .num = num, .mode = mode, .val = val, }; | ||
47 | return ioctl(gpio_dev, request, &r); | ||
48 | } | ||