1: int32_t AG903_I2CMgrReset(
AG903_I2CMgrHandle* handle)
2: {
3: int32_t retval =
AG903_ENONE;
4: int32_t result;
5: uint32_t hdlnum;
6: uint32_t status;
7: uint32_t loop;
8: uint8_t ch;
9:
10: result = I2CMgr_CheckHandle(handle, &ch, &hdlnum);
11:
if(
AG903_ENONE != result) {
12:
return -
AG903_EINVAL;
13: }
14:
15:
AG903_I2CPrmResetController(ch);
16:
17: I2cQue[ch].wp = 0;
18: I2cQue[ch].rp = 0;
19:
20: I2cChStat[ch].stat = AG903_I2C_CH_IDLE;
21:
for(loop=0; loop<
AG903_I2C_HANDLE_NUM; loop++) {
22: I2cHandleStat[ch][loop].stat = AG903_I2C_HANDLE_IDLE;
23: }
24:
25:
AG903_I2CPrmGetStatus(ch, &status);
26: retval = I2CMgr_SetFrequency(ch,
AG903_I2C_DFLT_SCL);
27:
28:
return retval;
29: }