AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: 9: 10: 14: 15: #ifndef _I2CMGR_H_ 16: #define _I2CMGR_H_ 17: 18: 19: #include <stdint.h> 20: #include "lib_common/AG903_common.h" 21: 22: #ifdef __cplusplus 23: extern "C" { 24: #endif 25: 26: 27: #define AG903_I2C_CLK (100000000) 28: 29: 30: #define AG903_I2C_DFLT_SCL (100000) 31: 32: 33: #define AG903_I2C_DFLT_GSR (8) 34: 35: 36: #define AG903_I2C_DFLT_TSR (64) 37: 38: 39: #define AG903_I2C_HANDLE_NUM (4) 40: 41: 42: #define AG903_I2C_QUENUM (6) 43: 44: 58: typedef uint32_t AG903_I2CMgrHandle; 59: 60: 73: typedef void (*AG903_I2CMgrClbk)(AG903_I2CMgrHandle* handle, uint32_t event); 74: 75: 76: typedef struct _AG903_I2CMgrWriteParam { 77: uint8_t* buf; 78: uint32_t size; 79: uint16_t addr; 80: uint8_t stop; 81: uint8_t reserve; 82: } AG903_I2CMgrWriteParam; 83: 84: 85: typedef struct _AG903_I2CMgrReadParam { 86: uint8_t* buf; 87: uint32_t size; 88: uint16_t addr; 89: uint8_t reserve[2]; 90: } AG903_I2CMgrReadParam; 91: 92: 93: typedef struct _AG903_I2CMgrClkPrm { 94: uint32_t cdr_val; 95: uint16_t tsr_val; 96: uint8_t gsr_val; 97: uint8_t reserve; 98: } AG903_I2CMgrClkPrm; 99: 100: 101: int32_t AG903_I2CMgrInit(uint8_t ch); 102: int32_t AG903_I2CMgrSetClock(uint8_t ch, AG903_I2CMgrClkPrm* param); 103: int32_t AG903_I2CMgrSetSlaveAddress(uint8_t ch, uint16_t saddr); 104: int32_t AG903_I2CMgrGetHandle(uint8_t ch, AG903_I2CMgrHandle** handle); 105: int32_t AG903_I2CMgrReleaseHandle(AG903_I2CMgrHandle* handle); 106: int32_t AG903_I2CMgrSetCallback(AG903_I2CMgrHandle* handle, AG903_I2CMgrClbk clbk); 107: int32_t AG903_I2CMgrMasterWrite(AG903_I2CMgrHandle* handle, AG903_I2CMgrWriteParam* param); 108: int32_t AG903_I2CMgrMasterRead(AG903_I2CMgrHandle* handle, AG903_I2CMgrReadParam* param); 109: int32_t AG903_I2CMgrSlaveWrite(AG903_I2CMgrHandle* handle, uint8_t* buf, uint32_t size); 110: int32_t AG903_I2CMgrSlaveRead(AG903_I2CMgrHandle* handle, uint8_t* buf, uint32_t size); 111: int32_t AG903_I2CMgrReset(AG903_I2CMgrHandle* handle); 112: int32_t AG903_I2CMgrGetQueCount(AG903_I2CMgrHandle* handle, uint32_t* count); 113: 114: #ifdef __cplusplus 115: } 116: #endif 117: #endif
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.