Statistics
| Branch: | Revision:

root / hw / smbus.h @ 86cc1ce0

History | View | Annotate | Download (1.7 kB)

1 3fffc223 ths
/*
2 3fffc223 ths
 * QEMU SMBus API
3 3fffc223 ths
 * 
4 3fffc223 ths
 * Copyright (c) 2007 Arastra, Inc.
5 3fffc223 ths
 * 
6 3fffc223 ths
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 3fffc223 ths
 * of this software and associated documentation files (the "Software"), to deal
8 3fffc223 ths
 * in the Software without restriction, including without limitation the rights
9 3fffc223 ths
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 3fffc223 ths
 * copies of the Software, and to permit persons to whom the Software is
11 3fffc223 ths
 * furnished to do so, subject to the following conditions:
12 3fffc223 ths
 *
13 3fffc223 ths
 * The above copyright notice and this permission notice shall be included in
14 3fffc223 ths
 * all copies or substantial portions of the Software.
15 3fffc223 ths
 *
16 3fffc223 ths
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 3fffc223 ths
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 3fffc223 ths
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 3fffc223 ths
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 3fffc223 ths
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 3fffc223 ths
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 3fffc223 ths
 * THE SOFTWARE.
23 3fffc223 ths
 */
24 3fffc223 ths
25 3fffc223 ths
typedef struct SMBusDevice SMBusDevice;
26 3fffc223 ths
27 3fffc223 ths
struct SMBusDevice {
28 3fffc223 ths
    uint8_t addr;
29 3fffc223 ths
    void (*quick_cmd)(SMBusDevice *dev, uint8_t read);
30 3fffc223 ths
    void (*send_byte)(SMBusDevice *dev, uint8_t val);
31 3fffc223 ths
    uint8_t (*receive_byte)(SMBusDevice *dev);
32 3fffc223 ths
    void (*write_byte)(SMBusDevice *dev, uint8_t cmd, uint8_t val);
33 3fffc223 ths
    uint8_t (*read_byte)(SMBusDevice *dev, uint8_t cmd);
34 3fffc223 ths
    void (*write_word)(SMBusDevice *dev, uint8_t cmd, uint16_t val);
35 3fffc223 ths
    uint16_t (*read_word)(SMBusDevice *dev, uint8_t cmd);
36 3fffc223 ths
    void (*write_block)(SMBusDevice *dev, uint8_t cmd, uint8_t len, uint8_t *buf);
37 3fffc223 ths
    uint8_t (*read_block)(SMBusDevice *dev, uint8_t cmd, uint8_t *buf);
38 3fffc223 ths
};