diff options
Diffstat (limited to 'firmware/target/arm/ascodec-target.h')
-rw-r--r-- | firmware/target/arm/ascodec-target.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/target/arm/ascodec-target.h b/firmware/target/arm/ascodec-target.h new file mode 100644 index 0000000000..19b1644541 --- /dev/null +++ b/firmware/target/arm/ascodec-target.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for AS3514 audio codec | ||
11 | * | ||
12 | * Copyright (c) 2007 Daniel Ankers | ||
13 | * Copyright (c) 2007 Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | #ifndef _ASCODEC_TARGET_H | ||
26 | #define _ASCODEC_TARGET_H | ||
27 | |||
28 | #include "config.h" | ||
29 | |||
30 | #ifdef CPU_PP | ||
31 | /* TODO: This header is actually portalplayer specific, and should be | ||
32 | * moved into an appropriate subdir */ | ||
33 | |||
34 | #include "i2c-pp.h" | ||
35 | |||
36 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) | ||
37 | #define AS3514_I2C_ADDR 0x46 | ||
38 | #else | ||
39 | #error Unknown target! | ||
40 | #endif | ||
41 | |||
42 | static inline int ascodec_write(unsigned int reg, unsigned int value) | ||
43 | { | ||
44 | return pp_i2c_send(AS3514_I2C_ADDR, reg, value); | ||
45 | } | ||
46 | |||
47 | static inline int ascodec_read(unsigned int reg) | ||
48 | { | ||
49 | return i2c_readbyte(AS3514_I2C_ADDR, reg); | ||
50 | } | ||
51 | |||
52 | static inline int ascodec_readbytes(int addr, int len, unsigned char *data) | ||
53 | { | ||
54 | return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data); | ||
55 | } | ||
56 | |||
57 | static inline void ascodec_lock(void) | ||
58 | { | ||
59 | i2c_lock(); | ||
60 | } | ||
61 | |||
62 | static inline void ascodec_unlock(void) | ||
63 | { | ||
64 | i2c_unlock(); | ||
65 | } | ||
66 | |||
67 | #endif /* CPU_PP */ | ||
68 | |||
69 | #endif /* !_ASCODEC_TARGET_H */ | ||