1: int32_t AG903_I2CMgrReleaseHandle(
AG903_I2CMgrHandle* handle)
2: {
3: int32_t retval =
AG903_ENONE;
4: int32_t result;
5: uint32_t hdlnum;
6: uint8_t ch;
7:
8: result = I2CMgr_CheckHandle(handle, &ch, &hdlnum);
9:
if(
AG903_ENONE != result) {
10:
return -
AG903_EINVAL;
11: }
12:
if(AG903_I2C_HANDLE_IDLE != I2cHandleStat[ch][hdlnum].stat) {
13:
return -
AG903_EBUSY;
14: }
15:
16: I2cHandleStat[ch][hdlnum].clbk = NULL;
17: I2cHandleStat[ch][hdlnum].lock =
false;
18:
19:
return retval;
20: }