1: int32_t AG903_UARTMgrReleaseHandle(
AG903_UARTMgrHandle* handle)
2: {
3: int32_t retval =
AG903_ENONE;
4: int32_t result;
5: uint8_t ch;
6:
7: result = UARTMgr_CheckHandle(handle, &ch);
8:
if(
AG903_ENONE != result) {
9:
return -
AG903_EINVAL;
10: }
11:
if( (AG903_UART_STAT_IDLE != UartChStat[ch].snd.stat) ||
12: (AG903_UART_STAT_IDLE != UartChStat[ch].rcv.stat) ) {
13:
return -
AG903_EBUSY;
14: }
15:
16: UartHandleStat[ch].lock =
false;
17:
18:
return retval;
19: }