diff options
author | Lorenzo Miori <memorys60@gmail.com> | 2012-04-07 10:30:23 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-05-28 19:39:14 +0200 |
commit | 3cad5573b68917442564dc4f210fac056447c5cd (patch) | |
tree | 16e7f637a7bf9a22b00fde445a97f267b5467cc2 /firmware/target/hosted/ypr0/si4709.h | |
parent | 9c33f93c1c9bfd37f33f638eccceefa4c0d5b5e6 (diff) | |
download | rockbox-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>
Diffstat (limited to 'firmware/target/hosted/ypr0/si4709.h')
-rw-r--r-- | firmware/target/hosted/ypr0/si4709.h | 82 |
1 files changed, 82 insertions, 0 deletions
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 | |||
51 | typedef struct { | ||
52 | int addr; | ||
53 | uint16_t value; | ||
54 | }__attribute__((packed)) sSi4709_t; | ||
55 | |||
56 | typedef struct { | ||
57 | int size; | ||
58 | unsigned char *buf; | ||
59 | }__attribute__((packed)) sSi4709_i2c_t; | ||
60 | |||
61 | typedef 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 | ||