Fix leaking file descriptors on error.
[kugel-rb.git] / firmware / export / pcf50606.h
blob4ae3d83f97e0a1c9b3fbd458b73a7bbff304658a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef PCF50606_H
22 #define PCF50606_H
24 #include "pcf5060x.h"
25 #include "system.h"
27 /* The following functions may either be implemented by an optimised driver
28 in the target tree, or by the generic drivers/pcf50606.c */
30 void pcf50606_init(void);
31 int pcf50606_write_multiple(int address, const unsigned char* buf, int count);
32 int pcf50606_write(int address, unsigned char val);
33 int pcf50606_read_multiple(int address, unsigned char* buf, int count);
34 int pcf50606_read(int address);
35 void pcf50606_set_usb_charging(bool on);
36 bool pcf50606_usb_charging_enabled(void);
38 /* internal low level calls used by the eeprom driver for h300 */
39 void pcf50606_i2c_init(void);
40 void pcf50606_i2c_recalc_delay(int cpu_clock);
41 void pcf50606_i2c_start(void);
42 void pcf50606_i2c_stop(void);
43 void pcf50606_i2c_ack(bool ack);
44 bool pcf50606_i2c_getack(void);
45 #if defined(IRIVER_H300_SERIES)
46 /* USB charging support */
47 void pcf50606_i2c_outb(unsigned char byte);
48 unsigned char pcf50606_i2c_inb(bool ack);
49 #endif
51 #if (defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(COWON_D2)) && !defined (SIMULATOR)
52 void pcf50606_reset_timeout(void);
53 #endif
55 void pcf50606_read_adc(int adc, short* res1, short* res2);
57 #endif /* PCF50606_H */