diff options
author | Lorenzo Miori <memorys60@gmail.com> | 2013-02-23 16:59:49 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-03-06 00:21:22 +0100 |
commit | 60592165ca998875e4bc46c4396c5a123a7e9dbb (patch) | |
tree | 60b53e6b733fd49bef249761789e97a4bedbef03 /firmware/target/hosted | |
parent | 3e4be68f8b596cf3467f993dc9a210a3d901ca1c (diff) | |
download | rockbox-60592165ca998875e4bc46c4396c5a123a7e9dbb.tar.gz rockbox-60592165ca998875e4bc46c4396c5a123a7e9dbb.zip |
Samsung YP-R0 hosted target code refactoring
As per title this patch aims at splitting common target
code and specific target code in a better way to
support future ports within the same environment
(e.g. Samsung YP-R1 where the Linux and the SoC
are the same, with differences in hardware devices
handling)
Change-Id: I67b4918c46403b184d3d8f42ab5aae7d01037fd0
Reviewed-on: http://gerrit.rockbox.org/409
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Tested-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r-- | firmware/target/hosted/samsungypr/adc-target.h (renamed from firmware/target/hosted/ypr0/adc-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/backlight-target.h (renamed from firmware/target/hosted/ypr0/backlight-target.h) | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/dir-target.h (renamed from firmware/target/hosted/ypr0/dir-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/gpio_ypr.c (renamed from firmware/target/hosted/ypr0/gpio_ypr0.c) | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/lcd-target.h (renamed from firmware/target/hosted/ypr0/lcd-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/lcd-ypr.c (renamed from firmware/target/hosted/ypr0/lcd-ypr0.c) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/radio-ypr.c (renamed from firmware/target/hosted/ypr0/radio-ypr0.c) | 5 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/radio-ypr.h (renamed from firmware/target/hosted/ypr0/radio-ypr0.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/si4709.h (renamed from firmware/target/hosted/ypr0/si4709.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/system-target.h (renamed from firmware/target/hosted/ypr0/system-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c (renamed from firmware/target/hosted/ypr0/ascodec-ypr0.c) | 26 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/audio-ypr0.c (renamed from firmware/target/hosted/ypr0/audio-ypr0.c) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c (renamed from firmware/target/hosted/ypr0/backlight-ypr0.c) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/button-target.h (renamed from firmware/target/hosted/ypr0/button-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/button-ypr0.c (renamed from firmware/target/hosted/ypr0/button-ypr0.c) | 2 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/gpio-target.h (renamed from firmware/target/hosted/ypr0/gpio_ypr0.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c (renamed from firmware/target/hosted/ypr0/powermgmt-ypr0.c) | 3 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h (renamed from firmware/target/hosted/ypr0/r0GPIOIoctl.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/sc900776.h (renamed from firmware/target/hosted/ypr0/sc900776.h) | 0 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/system-ypr0.c (renamed from firmware/target/hosted/ypr0/system-ypr0.c) | 6 | ||||
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/ypr0.make (renamed from firmware/target/hosted/ypr0/ypr0.make) | 0 |
21 files changed, 25 insertions, 21 deletions
diff --git a/firmware/target/hosted/ypr0/adc-target.h b/firmware/target/hosted/samsungypr/adc-target.h index e69de29bb2..e69de29bb2 100644 --- a/firmware/target/hosted/ypr0/adc-target.h +++ b/firmware/target/hosted/samsungypr/adc-target.h | |||
diff --git a/firmware/target/hosted/ypr0/backlight-target.h b/firmware/target/hosted/samsungypr/backlight-target.h index 561e159e8c..21db75c8c9 100644 --- a/firmware/target/hosted/ypr0/backlight-target.h +++ b/firmware/target/hosted/samsungypr/backlight-target.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: backlight-target.h 19322 2008-12-04 04:16:53Z jethead71 $ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2011 by Lorenzo Miori | 10 | * Copyright (C) 2011 by Lorenzo Miori |
11 | * | 11 | * |
diff --git a/firmware/target/hosted/ypr0/dir-target.h b/firmware/target/hosted/samsungypr/dir-target.h index 7df9554e92..7df9554e92 100644 --- a/firmware/target/hosted/ypr0/dir-target.h +++ b/firmware/target/hosted/samsungypr/dir-target.h | |||
diff --git a/firmware/target/hosted/ypr0/gpio_ypr0.c b/firmware/target/hosted/samsungypr/gpio_ypr.c index 3ee371d562..0d4a7eceae 100644 --- a/firmware/target/hosted/ypr0/gpio_ypr0.c +++ b/firmware/target/hosted/samsungypr/gpio_ypr.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
26 | #include <gpio_ypr0.h> /* includes r0GPIOioctl.h */ | 26 | #include <gpio-target.h> /* includes common ioctl device definitions */ |
27 | #include <sys/ioctl.h> | 27 | #include <sys/ioctl.h> |
28 | 28 | ||
29 | static int r0_gpio_dev = 0; | 29 | static int r0_gpio_dev = 0; |
diff --git a/firmware/target/hosted/ypr0/lcd-target.h b/firmware/target/hosted/samsungypr/lcd-target.h index c8a6de74f9..c8a6de74f9 100644 --- a/firmware/target/hosted/ypr0/lcd-target.h +++ b/firmware/target/hosted/samsungypr/lcd-target.h | |||
diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/samsungypr/lcd-ypr.c index 40528c298a..40528c298a 100644 --- a/firmware/target/hosted/ypr0/lcd-ypr0.c +++ b/firmware/target/hosted/samsungypr/lcd-ypr.c | |||
diff --git a/firmware/target/hosted/ypr0/radio-ypr0.c b/firmware/target/hosted/samsungypr/radio-ypr.c index 14d56826c1..1929bb7c90 100644 --- a/firmware/target/hosted/ypr0/radio-ypr0.c +++ b/firmware/target/hosted/samsungypr/radio-ypr.c | |||
@@ -6,7 +6,8 @@ | |||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * | 8 | * |
9 | * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) of Samsung YP-R0 | 9 | * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) |
10 | * Samsung YP-R0 & Samsung YP-R1 | ||
10 | * | 11 | * |
11 | * Copyright (c) 2012 Lorenzo Miori | 12 | * Copyright (c) 2012 Lorenzo Miori |
12 | * | 13 | * |
@@ -27,7 +28,7 @@ | |||
27 | #include "string.h" | 28 | #include "string.h" |
28 | #include "kernel.h" | 29 | #include "kernel.h" |
29 | 30 | ||
30 | #include "radio-ypr0.h" | 31 | #include "radio-ypr.h" |
31 | #include "rds.h" | 32 | #include "rds.h" |
32 | #include "si4700.h" | 33 | #include "si4700.h" |
33 | #include "power.h" | 34 | #include "power.h" |
diff --git a/firmware/target/hosted/ypr0/radio-ypr0.h b/firmware/target/hosted/samsungypr/radio-ypr.h index 13bcb6dc72..13bcb6dc72 100644 --- a/firmware/target/hosted/ypr0/radio-ypr0.h +++ b/firmware/target/hosted/samsungypr/radio-ypr.h | |||
diff --git a/firmware/target/hosted/ypr0/si4709.h b/firmware/target/hosted/samsungypr/si4709.h index c27472e856..c27472e856 100644 --- a/firmware/target/hosted/ypr0/si4709.h +++ b/firmware/target/hosted/samsungypr/si4709.h | |||
diff --git a/firmware/target/hosted/ypr0/system-target.h b/firmware/target/hosted/samsungypr/system-target.h index 1ef8b9aeda..1ef8b9aeda 100644 --- a/firmware/target/hosted/ypr0/system-target.h +++ b/firmware/target/hosted/samsungypr/system-target.h | |||
diff --git a/firmware/target/hosted/ypr0/ascodec-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c index cc923842df..24362af0c0 100644 --- a/firmware/target/hosted/ypr0/ascodec-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c | |||
@@ -5,10 +5,10 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * | 8 | * |
9 | * Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0 | 9 | * Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0 |
10 | * | 10 | * |
11 | * Copyright (c) 2011 Lorenzo Miori | 11 | * Copyright (c) 2011-2013 Lorenzo Miori |
12 | * | 12 | * |
13 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
@@ -29,11 +29,10 @@ | |||
29 | 29 | ||
30 | #include "ascodec.h" | 30 | #include "ascodec.h" |
31 | 31 | ||
32 | int afe_dev = -1; | 32 | static int afe_dev = -1; |
33 | 33 | ||
34 | /* ioctl parameter struct */ | 34 | /* Structure used for ioctl module call */ |
35 | struct codec_req_struct { | 35 | struct codec_req_struct { |
36 | /* This works for every kind of afe.ko module requests */ | ||
37 | unsigned char reg; /* Main register address */ | 36 | unsigned char reg; /* Main register address */ |
38 | unsigned char subreg; /* Set this only if you are reading/writing a PMU register*/ | 37 | unsigned char subreg; /* Set this only if you are reading/writing a PMU register*/ |
39 | unsigned char value; /* To be read if reading a register; to be set if writing to a register */ | 38 | unsigned char value; /* To be read if reading a register; to be set if writing to a register */ |
@@ -49,28 +48,31 @@ struct codec_req_struct { | |||
49 | /* Read from a PMU register */ | 48 | /* Read from a PMU register */ |
50 | #define IOCTL_SUBREG_READ 0x80034103 | 49 | #define IOCTL_SUBREG_READ 0x80034103 |
51 | 50 | ||
52 | 51 | /* Open device */ | |
53 | void ascodec_init(void) | 52 | void ascodec_init(void) |
54 | { | 53 | { |
55 | afe_dev = open("/dev/afe", O_RDWR); | 54 | afe_dev = open("/dev/afe", O_RDWR); |
56 | } | 55 | } |
57 | 56 | ||
57 | /* Close device */ | ||
58 | void ascodec_close(void) | 58 | void ascodec_close(void) |
59 | { | 59 | { |
60 | if (afe_dev >= 0) { | 60 | if (afe_dev >= 0) |
61 | close(afe_dev); | 61 | close(afe_dev); |
62 | } | ||
63 | } | 62 | } |
64 | 63 | ||
65 | /* Read functions returns -1 if fail, otherwise the register's value if success */ | 64 | /* Write register. |
66 | /* Write functions return >= 0 if success, otherwise -1 if fail */ | 65 | * Returns >= 0 if success, -1 if fail |
67 | 66 | */ | |
68 | int ascodec_write(unsigned int reg, unsigned int value) | 67 | int ascodec_write(unsigned int reg, unsigned int value) |
69 | { | 68 | { |
70 | struct codec_req_struct r = { .reg = reg, .value = value }; | 69 | struct codec_req_struct r = { .reg = reg, .value = value }; |
71 | return ioctl(afe_dev, IOCTL_REG_WRITE, &r); | 70 | return ioctl(afe_dev, IOCTL_REG_WRITE, &r); |
72 | } | 71 | } |
73 | 72 | ||
73 | /* Read register. | ||
74 | * Returns -1 if fail, otherwise the register's value if success | ||
75 | */ | ||
74 | int ascodec_read(unsigned int reg) | 76 | int ascodec_read(unsigned int reg) |
75 | { | 77 | { |
76 | struct codec_req_struct r = { .reg = reg }; | 78 | struct codec_req_struct r = { .reg = reg }; |
@@ -81,6 +83,7 @@ int ascodec_read(unsigned int reg) | |||
81 | return retval; | 83 | return retval; |
82 | } | 84 | } |
83 | 85 | ||
86 | /* Write PMU register */ | ||
84 | void ascodec_write_pmu(unsigned int index, unsigned int subreg, | 87 | void ascodec_write_pmu(unsigned int index, unsigned int subreg, |
85 | unsigned int value) | 88 | unsigned int value) |
86 | { | 89 | { |
@@ -88,6 +91,7 @@ void ascodec_write_pmu(unsigned int index, unsigned int subreg, | |||
88 | ioctl(afe_dev, IOCTL_SUBREG_WRITE, &r); | 91 | ioctl(afe_dev, IOCTL_SUBREG_WRITE, &r); |
89 | } | 92 | } |
90 | 93 | ||
94 | /* Read PMU register */ | ||
91 | int ascodec_read_pmu(unsigned int index, unsigned int subreg) | 95 | int ascodec_read_pmu(unsigned int index, unsigned int subreg) |
92 | { | 96 | { |
93 | struct codec_req_struct r = { .reg = index, .subreg = subreg, }; | 97 | struct codec_req_struct r = { .reg = index, .subreg = subreg, }; |
diff --git a/firmware/target/hosted/ypr0/audio-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/audio-ypr0.c index dfd63ef5cd..dfd63ef5cd 100644 --- a/firmware/target/hosted/ypr0/audio-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/audio-ypr0.c | |||
diff --git a/firmware/target/hosted/ypr0/backlight-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c index 551b386f19..551b386f19 100644 --- a/firmware/target/hosted/ypr0/backlight-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c | |||
diff --git a/firmware/target/hosted/ypr0/button-target.h b/firmware/target/hosted/samsungypr/ypr0/button-target.h index 3a3866932a..3a3866932a 100644 --- a/firmware/target/hosted/ypr0/button-target.h +++ b/firmware/target/hosted/samsungypr/ypr0/button-target.h | |||
diff --git a/firmware/target/hosted/ypr0/button-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c index e66ca22737..e3ad309187 100644 --- a/firmware/target/hosted/ypr0/button-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "button-target.h" | 26 | #include "button-target.h" |
27 | #include <gpio_ypr0.h> /* For headphones sense and buttons */ | 27 | #include <gpio-target.h> /* For headphones sense and buttons */ |
28 | 28 | ||
29 | int button_read_device(void) | 29 | int button_read_device(void) |
30 | { | 30 | { |
diff --git a/firmware/target/hosted/ypr0/gpio_ypr0.h b/firmware/target/hosted/samsungypr/ypr0/gpio-target.h index 3c2033baff..3c2033baff 100644 --- a/firmware/target/hosted/ypr0/gpio_ypr0.h +++ b/firmware/target/hosted/samsungypr/ypr0/gpio-target.h | |||
diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c index 347e5fa146..6e04d25f58 100644 --- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: powermgmt-sim.c 29543 2011-03-08 19:33:30Z thomasjfox $ | ||
9 | * | 8 | * |
10 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
@@ -24,7 +23,7 @@ | |||
24 | #include "file.h" | 23 | #include "file.h" |
25 | #include "adc.h" | 24 | #include "adc.h" |
26 | #include "sc900776.h" | 25 | #include "sc900776.h" |
27 | #include "radio-ypr0.h" | 26 | #include "radio-ypr.h" |
28 | 27 | ||
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 28 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
30 | { | 29 | { |
diff --git a/firmware/target/hosted/ypr0/r0GPIOIoctl.h b/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h index e77f35fbb7..e77f35fbb7 100644 --- a/firmware/target/hosted/ypr0/r0GPIOIoctl.h +++ b/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h | |||
diff --git a/firmware/target/hosted/ypr0/sc900776.h b/firmware/target/hosted/samsungypr/ypr0/sc900776.h index 32eb90f797..32eb90f797 100644 --- a/firmware/target/hosted/ypr0/sc900776.h +++ b/firmware/target/hosted/samsungypr/ypr0/sc900776.h | |||
diff --git a/firmware/target/hosted/ypr0/system-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c index 11275c7809..7ee2697a24 100644 --- a/firmware/target/hosted/ypr0/system-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c | |||
@@ -5,9 +5,8 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: system-sdl.c 29925 2011-05-25 20:11:03Z thomasjfox $ | ||
9 | * | 8 | * |
10 | * Copyright (C) 2006 by Daniel Everton <dan@iocaine.org> | 9 | * Copyright (C) 2011-2013 by Lorenzo Miori |
11 | * | 10 | * |
12 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 12 | * modify it under the terms of the GNU General Public License |
@@ -31,7 +30,7 @@ | |||
31 | #endif | 30 | #endif |
32 | 31 | ||
33 | #include "ascodec.h" | 32 | #include "ascodec.h" |
34 | #include "gpio_ypr0.h" | 33 | #include "gpio-target.h" |
35 | 34 | ||
36 | void power_off(void) | 35 | void power_off(void) |
37 | { | 36 | { |
@@ -52,6 +51,7 @@ void system_init(void) | |||
52 | #if defined(HAVE_SDL_AUDIO) || defined(HAVE_SDL_THREADS) || defined(HAVE_SDL) | 51 | #if defined(HAVE_SDL_AUDIO) || defined(HAVE_SDL_THREADS) || defined(HAVE_SDL) |
53 | SDL_Init(0); /* need this if using any SDL subsystem */ | 52 | SDL_Init(0); /* need this if using any SDL subsystem */ |
54 | #endif | 53 | #endif |
54 | |||
55 | /* Here begins our platform specific initilization for various things */ | 55 | /* Here begins our platform specific initilization for various things */ |
56 | ascodec_init(); | 56 | ascodec_init(); |
57 | gpio_init(); | 57 | gpio_init(); |
diff --git a/firmware/target/hosted/ypr0/ypr0.make b/firmware/target/hosted/samsungypr/ypr0/ypr0.make index 67ff326de0..67ff326de0 100644 --- a/firmware/target/hosted/ypr0/ypr0.make +++ b/firmware/target/hosted/samsungypr/ypr0/ypr0.make | |||