Ben Pai | 44cee31 | 2020-03-16 15:24:46 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <errno.h> |
| 4 | #include <fcntl.h> |
| 5 | #include <stdint.h> |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | #include <string.h> |
| 9 | #include <sys/ioctl.h> |
| 10 | #include <unistd.h> |
| 11 | |
| 12 | namespace phosphor |
| 13 | { |
| 14 | namespace smbus |
| 15 | { |
| 16 | |
| 17 | class Smbus |
| 18 | { |
| 19 | public: |
| 20 | Smbus(){}; |
| 21 | |
| 22 | int open_i2c_dev(int i2cbus, char* filename, size_t size, int quiet); |
| 23 | |
| 24 | int smbusInit(int smbus_num); |
| 25 | |
| 26 | int set_slave_addr(int file, int address, int force); |
| 27 | |
| 28 | int SetSmbusCmdByte(int smbus_num, int8_t device_addr, int8_t smbuscmd, |
| 29 | int8_t data); |
| 30 | |
| 31 | int GetSmbusCmdByte(int smbus_num, int8_t device_addr, int8_t smbuscmd); |
| 32 | |
| 33 | void smbusClose(int smbus_num); |
| 34 | }; |
| 35 | |
| 36 | } // namespace smbus |
| 37 | } // namespace phosphor |