diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2012-01-03 04:23:24 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2012-01-03 04:23:24 +0000 |
commit | a9b997708399263d5a2d1469b4c41f11513f12de (patch) | |
tree | 6d41266fdecdd6948ae5d20f6d575f742840d171 /firmware/target/arm/pp/ascodec-target.h | |
parent | 4ef988bfb469291ce018e7daafb99d41f71c35fc (diff) | |
download | rockbox-a9b997708399263d5a2d1469b4c41f11513f12de.tar.gz rockbox-a9b997708399263d5a2d1469b4c41f11513f12de.zip |
Move PP-specific headers to pp/ directory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31530 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/pp/ascodec-target.h')
-rw-r--r-- | firmware/target/arm/pp/ascodec-target.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/firmware/target/arm/pp/ascodec-target.h b/firmware/target/arm/pp/ascodec-target.h new file mode 100644 index 0000000000..68d9905a6b --- /dev/null +++ b/firmware/target/arm/pp/ascodec-target.h | |||
@@ -0,0 +1,103 @@ | |||
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 "as3514.h" | ||
35 | #include "i2c-pp.h" | ||
36 | |||
37 | static inline int ascodec_write(unsigned int reg, unsigned int value) | ||
38 | { | ||
39 | return pp_i2c_send(AS3514_I2C_ADDR, reg, value); | ||
40 | } | ||
41 | |||
42 | static inline int ascodec_read(unsigned int reg) | ||
43 | { | ||
44 | return i2c_readbyte(AS3514_I2C_ADDR, reg); | ||
45 | } | ||
46 | |||
47 | static inline int ascodec_readbytes(int addr, int len, unsigned char *data) | ||
48 | { | ||
49 | return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data); | ||
50 | } | ||
51 | |||
52 | static inline void ascodec_lock(void) | ||
53 | { | ||
54 | i2c_lock(); | ||
55 | } | ||
56 | |||
57 | static inline void ascodec_unlock(void) | ||
58 | { | ||
59 | i2c_unlock(); | ||
60 | } | ||
61 | |||
62 | static inline bool ascodec_chg_status(void) | ||
63 | { | ||
64 | return ascodec_read(AS3514_IRQ_ENRD0) & CHG_STATUS; | ||
65 | } | ||
66 | |||
67 | static inline bool ascodec_endofch(void) | ||
68 | { | ||
69 | return ascodec_read(AS3514_IRQ_ENRD0) & CHG_ENDOFCH; | ||
70 | } | ||
71 | |||
72 | static inline void ascodec_monitor_endofch(void) | ||
73 | { | ||
74 | ascodec_write(AS3514_IRQ_ENRD0, IRQ_ENDOFCH); | ||
75 | } | ||
76 | |||
77 | static inline void ascodec_wait_adc_finished(void) | ||
78 | { | ||
79 | /* | ||
80 | * FIXME: not implemented | ||
81 | * | ||
82 | * If irqs are not available on the target platform, | ||
83 | * this should be most likely implemented by polling | ||
84 | * AS3514_IRQ_ENRD2 in the same way powermgmt-ascodec.c | ||
85 | * is polling IRQ_ENDOFCH. | ||
86 | */ | ||
87 | } | ||
88 | |||
89 | static inline void ascodec_write_charger(int value) | ||
90 | { | ||
91 | ascodec_write(AS3514_CHARGER, value); | ||
92 | } | ||
93 | |||
94 | static inline int ascodec_read_charger(void) | ||
95 | { | ||
96 | return ascodec_read(AS3514_CHARGER); | ||
97 | } | ||
98 | |||
99 | extern void ascodec_suppressor_on(bool on); | ||
100 | |||
101 | #endif /* CPU_PP */ | ||
102 | |||
103 | #endif /* !_ASCODEC_TARGET_H */ | ||