diff options
author | Sergi Granell | 2017-06-15 13:39:18 +0200 |
---|---|---|
committer | Sergi Granell | 2017-06-15 13:39:18 +0200 |
commit | 26201ea1c3a9b69828b1743c9d968079172b4a8e (patch) | |
tree | 1d3d957a882921960a4d3eee0dcb335ca9001d25 /include/kernel/lowio/i2c.h | |
parent | Named anonymous enums in psp2. (#179) (diff) | |
download | vds-libraries-26201ea1c3a9b69828b1743c9d968079172b4a8e.tar.gz |
Add UART, syscon, I2C nids. Add I2C header.
Diffstat (limited to 'include/kernel/lowio/i2c.h')
-rw-r--r-- | include/kernel/lowio/i2c.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/kernel/lowio/i2c.h b/include/kernel/lowio/i2c.h new file mode 100644 index 0000000..6d500f6 --- /dev/null +++ b/include/kernel/lowio/i2c.h @@ -0,0 +1,39 @@ +#ifndef _PSP2_LOWIO_I2C_H_ +#define _PSP2_LOWIO_I2C_H_ + +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum SceI2cErrorCode { + SCE_I2C_ERROR_INVALID_BUS = 0x803F0300, + SCE_I2C_ERROR_INVALID_SIZE = 0x803F0302, + SCE_I2C_ERROR_INVALID_DEVICE = 0x803F0303 +} SceI2cErrorCode; + +typedef struct SceI2cDebugHandlers { + unsigned int size; + void (*write_start)(int bus, int device, unsigned char *buffer, int size); + void (*write_error)(int bus, int error, int result); + void (*read_start)(int bus, int device, unsigned char *buffer, int size); + void (*read_error)(int bus, int error, int result); + void (*write_read_start)(int bus, int write_device, unsigned char *write_buffer, int write_size); + void (*write_read_error)(int bus, int error, int result); +} SceI2cDebugHandlers; + +int sceI2cTransferRead(int bus, unsigned int address, unsigned char *buffer, int size); +int sceI2cTransferWrite(int bus, unsigned int device, const unsigned char *buffer, int size); +int sceI2cTransferWriteRead(int bus, + unsigned int write_device, const unsigned char *write_buffer, int write_size, + unsigned int read_device, unsigned char *read_buffer, int read_size); + +int sceI2cSetDebugHandlers(int bus, SceI2cDebugHandlers *debug_handlers); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_LOWIO_I2C_H_ */ + |