mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
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
This commit is contained in:
parent
e32ace831a
commit
f005d841f2
11 changed files with 231 additions and 413 deletions
48
firmware/target/hosted/samsungypr/gpio-ypr.c
Normal file
48
firmware/target/hosted/samsungypr/gpio-ypr.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Module wrapper for GPIO, using kernel module of Samsung YP-R0/YP-R1
|
||||
*
|
||||
* Copyright (c) 2011 Lorenzo Miori
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <gpio-ypr.h> /* includes common ioctl device definitions */
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
static int gpio_dev = 0;
|
||||
|
||||
void gpio_init(void)
|
||||
{
|
||||
gpio_dev = open(GPIO_DEVICE, O_RDONLY);
|
||||
if (gpio_dev < 0)
|
||||
printf("GPIO device open error!");
|
||||
}
|
||||
|
||||
void gpio_close(void)
|
||||
{
|
||||
if (gpio_dev >= 0)
|
||||
close(gpio_dev);
|
||||
}
|
||||
|
||||
int gpio_control(int request, int num, int mode, int val)
|
||||
{
|
||||
struct gpio_info r = { .num = num, .mode = mode, .val = val, };
|
||||
return ioctl(gpio_dev, request, &r);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue