summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Miori <memorys60@gmail.com>2012-04-07 10:30:23 +0200
committerThomas Martitz <kugel@rockbox.org>2012-05-28 19:39:14 +0200
commit3cad5573b68917442564dc4f210fac056447c5cd (patch)
tree16e7f637a7bf9a22b00fde445a97f267b5467cc2
parent9c33f93c1c9bfd37f33f638eccceefa4c0d5b5e6 (diff)
downloadrockbox-3cad5573b68917442564dc4f210fac056447c5cd.tar.gz
rockbox-3cad5573b68917442564dc4f210fac056447c5cd.zip
ypr0: This patch adds radio support to Samsung YP-R0
Basically it uses the default SI4700 radio chip driver, the only thing that's different is the I2C access, written specifically to interact with my kernel module. Next things to add are: - RDS support! Change-Id: I0ed125641e00f93124d7a34f90dd508e7f1db5a4 Signed-off-by: Lorenzo Miori <memorys60@gmail.com>
-rw-r--r--apps/audio_path.c2
-rw-r--r--apps/debug_menu.c5
-rw-r--r--apps/keymaps/keymap-ypr0.c19
-rw-r--r--apps/radio/radio.c10
-rw-r--r--firmware/SOURCES6
-rw-r--r--firmware/drivers/audio/as3514.c5
-rw-r--r--firmware/export/config/samsungypr0.h15
-rw-r--r--firmware/target/hosted/ypr0/audio-ypr0.c69
-rw-r--r--firmware/target/hosted/ypr0/powermgmt-ypr0.c29
-rw-r--r--firmware/target/hosted/ypr0/radio-ypr0.c66
-rw-r--r--firmware/target/hosted/ypr0/radio-ypr0.h36
-rw-r--r--firmware/target/hosted/ypr0/si4709.h82
12 files changed, 335 insertions, 9 deletions
diff --git a/apps/audio_path.c b/apps/audio_path.c
index dab43ebf42..9ef748382f 100644
--- a/apps/audio_path.c
+++ b/apps/audio_path.c
@@ -42,7 +42,7 @@
42#endif 42#endif
43#endif 43#endif
44 44
45#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 45#if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SAMSUNG_YPR0))
46 46
47#ifdef AUDIO_CPU_BOOST 47#ifdef AUDIO_CPU_BOOST
48static void audio_cpu_boost(bool state) 48static void audio_cpu_boost(bool state)
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index e611694b5b..aec0a9a1a6 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -78,6 +78,11 @@
78#endif 78#endif
79#include "power.h" 79#include "power.h"
80 80
81#if defined(SAMSUNG_YPR0) && defined(CONFIG_TUNER)
82#include "tuner.h"
83#include "radio.h"
84#endif
85
81#ifdef HAVE_LCD_BITMAP 86#ifdef HAVE_LCD_BITMAP
82#include "scrollbar.h" 87#include "scrollbar.h"
83#include "peakmeter.h" 88#include "peakmeter.h"
diff --git a/apps/keymaps/keymap-ypr0.c b/apps/keymaps/keymap-ypr0.c
index b5706760ba..306fd91e34 100644
--- a/apps/keymaps/keymap-ypr0.c
+++ b/apps/keymaps/keymap-ypr0.c
@@ -212,7 +212,24 @@ static const struct button_mapping button_context_keyboard[] = {
212}; /* button_context_keyboard */ 212}; /* button_context_keyboard */
213 213
214static const struct button_mapping button_context_radio[] = { 214static const struct button_mapping button_context_radio[] = {
215 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) 215 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
216 { ACTION_FM_PRESET, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE },
217 { ACTION_FM_STOP, BUTTON_POWER | BUTTON_REL, BUTTON_POWER },
218 { ACTION_FM_MODE, BUTTON_MENU | BUTTON_REL, BUTTON_MENU },
219 { ACTION_FM_EXIT, BUTTON_BACK | BUTTON_REL, BUTTON_BACK },
220 { ACTION_FM_PLAY, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT },
221 { ACTION_FM_NEXT_PRESET, BUTTON_USER | BUTTON_RIGHT, BUTTON_NONE },
222 { ACTION_FM_PREV_PRESET, BUTTON_USER | BUTTON_LEFT, BUTTON_NONE },
223 /* Volume */
224 { ACTION_SETTINGS_INC, BUTTON_UP | BUTTON_REPEAT, BUTTON_NONE },
225 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP, BUTTON_NONE },
226 { ACTION_SETTINGS_DEC, BUTTON_DOWN | BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN, BUTTON_NONE },
228 /* Tuning */
229 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
230 { ACTION_STD_PREVREPEAT, BUTTON_LEFT | BUTTON_REPEAT, BUTTON_NONE },
231 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
232 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT | BUTTON_REPEAT, BUTTON_NONE },
216}; /* button_context_radio */ 233}; /* button_context_radio */
217 234
218const struct button_mapping* get_context_mapping(int context) 235const struct button_mapping* get_context_mapping(int context)
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index 9f139f49a6..326e6a3bb0 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -127,6 +127,16 @@
127#define FM_MODE 127#define FM_MODE
128#define FM_STOP 128#define FM_STOP
129 129
130#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
131#define FM_MENU
132#define FM_PRESET
133#define FM_STOP
134#define FM_MODE
135#define FM_EXIT
136#define FM_PLAY
137#define FM_PREV_PRESET
138#define FM_NEXT_PRESET
139
130#endif 140#endif
131 141
132/* presets.c needs these so keep unstatic or redo the whole thing! */ 142/* presets.c needs these so keep unstatic or redo the whole thing! */
diff --git a/firmware/SOURCES b/firmware/SOURCES
index eb49e3e581..54fde546dc 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -92,6 +92,10 @@ target/hosted/ypr0/backlight-ypr0.c
92target/hosted/ypr0/ascodec-ypr0.c 92target/hosted/ypr0/ascodec-ypr0.c
93target/hosted/ypr0/powermgmt-ypr0.c 93target/hosted/ypr0/powermgmt-ypr0.c
94target/hosted/ypr0/gpio_ypr0.c 94target/hosted/ypr0/gpio_ypr0.c
95target/hosted/ypr0/audio-ypr0.c
96#if CONFIG_TUNER
97target/hosted/ypr0/radio-ypr0.c
98#endif
95#endif 99#endif
96 100
97/* Maemo specific files */ 101/* Maemo specific files */
@@ -309,7 +313,7 @@ drivers/rtc/rtc_imx233.c
309/* Tuner */ 313/* Tuner */
310#if CONFIG_TUNER 314#if CONFIG_TUNER
311tuner.c 315tuner.c
312#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 316#if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SAMSUNG_YPR0))
313#if (CONFIG_TUNER & LV24020LP) 317#if (CONFIG_TUNER & LV24020LP)
314drivers/tuner/lv24020lp.c 318drivers/tuner/lv24020lp.c
315#endif /* (CONFIG_TUNER & LV24020LP) */ 319#endif /* (CONFIG_TUNER & LV24020LP) */
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 22609621df..5f18bc6ec1 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -156,8 +156,13 @@ void audiohw_preinit(void)
156 as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_on | AUDIOSET3_HP_LONGSTART); 156 as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_on | AUDIOSET3_HP_LONGSTART);
157 157
158 as3514_write(AS3543_DAC_IF, AS3543_DAC_INT_PLL); 158 as3514_write(AS3543_DAC_IF, AS3543_DAC_INT_PLL);
159#ifdef SAMSUNG_YPR0
160 /* Select Line 1 for FM radio */
161 as3514_clear(AS3514_LINE_IN1_R, LINE_IN_R_LINE_SELECT);
162#else
159 /* Select Line 2 for FM radio */ 163 /* Select Line 2 for FM radio */
160 as3514_set(AS3514_LINE_IN1_R, LINE_IN_R_LINE_SELECT); 164 as3514_set(AS3514_LINE_IN1_R, LINE_IN_R_LINE_SELECT);
165#endif
161 /* Output SUM of microphone/line/DAC */ 166 /* Output SUM of microphone/line/DAC */
162 as3514_write(AS3514_HPH_OUT_R, HPH_OUT_R_HEADPHONES | HPH_OUT_R_HP_OUT_SUM); 167 as3514_write(AS3514_HPH_OUT_R, HPH_OUT_R_HEADPHONES | HPH_OUT_R_HP_OUT_SUM);
163 168
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 48e98e5b46..10d7aaecb8 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -75,7 +75,6 @@
75//#define HAVE_RTC_RAM 75//#define HAVE_RTC_RAM
76 76
77/* define this if you have a real-time clock */ 77/* define this if you have a real-time clock */
78//#define CONFIG_RTC APPLICATION
79#define CONFIG_RTC RTC_AS3514 78#define CONFIG_RTC RTC_AS3514
80#define HAVE_RTC_ALARM 79#define HAVE_RTC_ALARM
81 80
@@ -103,9 +102,17 @@
103 102
104#define HAVE_SW_TONE_CONTROLS 103#define HAVE_SW_TONE_CONTROLS
105 104
106/* TODO: Make use of the si4703 tuner hardware */ 105#define CONFIG_TUNER SI4700
107/* #define CONFIG_TUNER SI4700 */ 106#define HAVE_TUNER_PWR_CTRL
108/* #define HAVE_TUNER_PWR_CTRL*/ 107
108/* TODO: next step: enable RDS
109#define HAVE_RDS_CAP
110#define RDS_ISR_PROCESSING
111*/
112
113/* Define this for FM radio input available */
114#define HAVE_FMRADIO_IN
115#define INPUT_SRC_CAPS SRC_CAP_FMRADIO
109 116
110/* We have a GPIO that detects it */ 117/* We have a GPIO that detects it */
111#define HAVE_HEADPHONE_DETECTION 118#define HAVE_HEADPHONE_DETECTION
diff --git a/firmware/target/hosted/ypr0/audio-ypr0.c b/firmware/target/hosted/ypr0/audio-ypr0.c
new file mode 100644
index 0000000000..dfd63ef5cd
--- /dev/null
+++ b/firmware/target/hosted/ypr0/audio-ypr0.c
@@ -0,0 +1,69 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bertrik Sikken
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "system.h"
23#include "cpu.h"
24#include "audio.h"
25#include "audiohw.h"
26#include "sound.h"
27
28int audio_channels = 2;
29int audio_output_source = AUDIO_SRC_PLAYBACK;
30
31void audio_set_output_source(int source)
32{
33 if ((unsigned)source >= AUDIO_NUM_SOURCES)
34 source = AUDIO_SRC_PLAYBACK;
35
36 audio_output_source = source;
37} /* audio_set_output_source */
38
39void audio_input_mux(int source, unsigned flags)
40{
41 static int last_source = AUDIO_SRC_PLAYBACK;
42
43 (void)flags;
44
45 switch (source)
46 {
47 default: /* playback - no recording */
48 source = AUDIO_SRC_PLAYBACK;
49 case AUDIO_SRC_PLAYBACK:
50 audio_channels = 2;
51 if (source != last_source)
52 {
53 audiohw_set_monitor(false);
54
55 }
56 break;
57
58 case AUDIO_SRC_FMRADIO: /* recording and playback */
59 audio_channels = 2;
60 if (source == last_source)
61 break;
62
63 audiohw_set_monitor(true);
64 break;
65 } /* end switch */
66
67 last_source = source;
68} /* audio_input_mux */
69
diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/ypr0/powermgmt-ypr0.c
index 45ff2ae737..347e5fa146 100644
--- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c
+++ b/firmware/target/hosted/ypr0/powermgmt-ypr0.c
@@ -24,6 +24,7 @@
24#include "file.h" 24#include "file.h"
25#include "adc.h" 25#include "adc.h"
26#include "sc900776.h" 26#include "sc900776.h"
27#include "radio-ypr0.h"
27 28
28const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 29const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
29{ 30{
@@ -37,7 +38,6 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
37}; 38};
38 39
39/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
40/* FIXME: This is guessed. Make proper curve using battery_bench */
41const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
42{ 42{
43 { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 } 43 { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 }
@@ -45,7 +45,6 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
45 45
46#if CONFIG_CHARGING 46#if CONFIG_CHARGING
47/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 47/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
48/* FIXME: This is guessed. Make proper curve using battery_bench */
49const unsigned short const percent_to_volt_charge[11] = 48const unsigned short const percent_to_volt_charge[11] =
50{ 49{
51 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 50 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
@@ -81,3 +80,29 @@ bool charging_state(void)
81 /* dont indicate for > ~95% */ 80 /* dont indicate for > ~95% */
82 return ret && (_battery_voltage() <= charged_thres); 81 return ret && (_battery_voltage() <= charged_thres);
83} 82}
83
84#if CONFIG_TUNER
85static bool tuner_on = false;
86
87bool tuner_power(bool status)
88{
89 if (status != tuner_on)
90 {
91 tuner_on = status;
92 status = !status;
93 if (tuner_on) {
94 radiodev_open();
95 }
96 else {
97 radiodev_close();
98 }
99 }
100
101 return status;
102}
103
104bool tuner_powered(void)
105{
106 return tuner_on;
107}
108#endif /* #if CONFIG_TUNER */ \ No newline at end of file
diff --git a/firmware/target/hosted/ypr0/radio-ypr0.c b/firmware/target/hosted/ypr0/radio-ypr0.c
new file mode 100644
index 0000000000..c3597bd18c
--- /dev/null
+++ b/firmware/target/hosted/ypr0/radio-ypr0.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) of Samsung YP-R0
10 *
11 * Copyright (c) 2012 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 <unistd.h>
24#include <fcntl.h>
25#include <sys/ioctl.h>
26#include "stdint.h"
27#include "string.h"
28
29#include "radio-ypr0.h"
30
31static int radio_dev = -1;
32
33void radiodev_open(void) {
34 radio_dev = open("/dev/si470x", O_RDWR);
35}
36
37void radiodev_close(void) {
38 close(radio_dev);
39}
40
41/* High-level registers access */
42void si4709_write_reg(int addr, uint16_t value) {
43 sSi4709_t r = { .addr = addr, .value = value };
44 ioctl(radio_dev, IOCTL_SI4709_WRITE_BYTE, &r);
45}
46
47uint16_t si4709_read_reg(int addr) {
48 sSi4709_t r = { .addr = addr, .value = 0 };
49 ioctl(radio_dev, IOCTL_SI4709_READ_BYTE, &r);
50 return r.value;
51}
52
53/* Low-level i2c channel access */
54int fmradio_i2c_write(unsigned char address, unsigned char* buf, int count)
55{
56 (void)address;
57 sSi4709_i2c_t r = { .size = count, .buf = buf };
58 return ioctl(radio_dev, IOCTL_SI4709_I2C_WRITE, &r);
59}
60
61int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
62{
63 (void)address;
64 sSi4709_i2c_t r = { .size = count, .buf = buf };
65 return ioctl(radio_dev, IOCTL_SI4709_I2C_READ, &r);
66} \ No newline at end of file
diff --git a/firmware/target/hosted/ypr0/radio-ypr0.h b/firmware/target/hosted/ypr0/radio-ypr0.h
new file mode 100644
index 0000000000..13bcb6dc72
--- /dev/null
+++ b/firmware/target/hosted/ypr0/radio-ypr0.h
@@ -0,0 +1,36 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) of Samsung YP-R0
10 *
11 * Copyright (c) 2012 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#ifndef __RADIO_YPR0_H__
24#define __RADIO_YPR0_H__
25
26#include "si4709.h"
27#include "stdint.h"
28#include "rds.h"
29#include "si4700.h"
30
31void radiodev_open(void);
32void radiodev_close(void);
33void si4709_write_reg(int addr, uint16_t value);
34uint16_t si4709_read_reg(int addr);
35
36#endif /*__RADIO-YPR0_H__*/ \ No newline at end of file
diff --git a/firmware/target/hosted/ypr0/si4709.h b/firmware/target/hosted/ypr0/si4709.h
new file mode 100644
index 0000000000..c27472e856
--- /dev/null
+++ b/firmware/target/hosted/ypr0/si4709.h
@@ -0,0 +1,82 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Module header for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) of Samsung YP-R0
10 *
11 * Copyright (c) 2012 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#ifndef __SI4709_H__
24#define __SI4709_H__
25
26#include "stdint.h"
27
28/* 7bits I2C address */
29#define SI4709_I2C_SLAVE_ADDR 0x10
30
31#define SI4702_DEVICEID 0x00
32#define SI4702_CHIPID 0x01
33#define SI4702_POWERCFG 0x02
34#define SI4702_CHANNEL 0x03
35#define SI4702_SYSCONFIG1 0x04
36#define SI4702_SYSCONFIG2 0x05
37#define SI4702_SYSCONFIG3 0x06
38#define SI4702_TEST1 0x07
39#define SI4702_TEST2 0x08
40#define SI4702_B00TCONFIG 0x09
41#define SI4702_STATUSRSSI 0x0A
42#define SI4702_READCHAN 0x0B
43#define SI4709_REG_NUM 0x10
44#define SI4702_REG_BYTE (SI4709_REG_NUM * 2)
45#define SI4702_DEVICE_ID 0x1242
46#define SI4702_RW_REG_NUM (SI4702_STATUSRSSI - SI4702_POWERCFG)
47#define SI4702_RW_OFFSET \
48 (SI4709_REG_NUM - SI4702_STATUSRSSI + SI4702_POWERCFG)
49#define BYTE_TO_WORD(hi, lo) (((hi) << 8) & 0xFF00) | ((lo) & 0x00FF)
50
51typedef struct {
52 int addr;
53 uint16_t value;
54}__attribute__((packed)) sSi4709_t;
55
56typedef struct {
57 int size;
58 unsigned char *buf;
59}__attribute__((packed)) sSi4709_i2c_t;
60
61typedef enum
62{
63 IOCTL_SI4709_INIT = 0,
64 IOCTL_SI4709_CLOSE,
65 IOCTL_SI4709_WRITE_BYTE,
66 IOCTL_SI4709_READ_BYTE,
67 IOCTL_SI4709_I2C_WRITE,
68 IOCTL_SI4709_I2C_READ,
69
70 E_IOCTL_SI4709_MAX
71} eSi4709_ioctl_t;
72
73#define DRV_IOCTL_SI4709_MAGIC 'S'
74
75#define IOCTL_SI4709_INIT _IO(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_INIT)
76#define IOCTL_SI4709_CLOSE _IO(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_CLOSE)
77#define IOCTL_SI4709_WRITE_BYTE _IOW(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_WRITE_BYTE, sSi4709_t)
78#define IOCTL_SI4709_READ_BYTE _IOR(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_READ_BYTE, sSi4709_t)
79#define IOCTL_SI4709_I2C_WRITE _IOW(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_I2C_WRITE, sSi4709_i2c_t)
80#define IOCTL_SI4709_I2C_READ _IOR(DRV_IOCTL_SI4709_MAGIC, IOCTL_SI4709_I2C_READ, sSi4709_i2c_t)
81
82#endif /* __SI4709_H__ */ \ No newline at end of file