void DRV_USART_Close ( DRV_HANDLE handle) { /* This function closes the client, The client object is de-allocated and returned to the pool. */ DRV_USART_CLIENT_OBJ * clientObj; DRV_USART_OBJ * dObj; /* Validate the handle */ clientObj = _DRV_USART_DriverHandleValidate(handle); if(clientObj == NULL) { /* Driver handle is not valid */ SYS_DEBUG(0, "Invalid Driver Handle"); return; } dObj = (DRV_USART_OBJ *)clientObj->hDriver; /* Remove all buffers that this client owns from the driver queue. This function will map to _DRV_USART_ClientBufferQueueObjectsRemove() if the driver was built for buffer queue support. Else this condition always maps to true. */ if(!_DRV_USART_CLIENT_BUFFER_QUEUE_OBJECTS_REMOVE(clientObj)) { /* The function could fail if the mutex time out occurred */ SYS_DEBUG(0, "Could not remove client buffer objects"); clientObj->status = DRV_USART_CLIENT_STATUS_ERROR; return; } /* Deallocate all semaphores */ OSAL_ASSERT((OSAL_SEM_Delete(&(clientObj->semWriteDone)) == OSAL_RESULT_TRUE), "Unable to delete client write done semaphore"); OSAL_ASSERT((OSAL_SEM_Delete(&(clientObj->semReadDone)) == OSAL_RESULT_TRUE), "Unable to delete client read done semaphore"); /* Reduce the number of clients */ dObj->nClients --; /* De-allocate the object */ clientObj->status = DRV_USART_CLIENT_STATUS_CLOSED; clientObj->inUse = false; return; }
void WDRV_SemDeInit(OSAL_SEM_HANDLE_TYPE *SemID) { OSAL_SEM_Delete(SemID); }
static __inline__ void __attribute__((always_inline)) _UserGblLockDelete(void) { OSAL_SEM_Delete(&sSysTmrObject.userSem); }