_mqx_int _io_pipe_close ( /* [IN] the file handle for the device being closed */ FILE_DEVICE_STRUCT_PTR fd_ptr ) { /* Body */ IO_PIPE_INFO_STRUCT_PTR io_pipe_info_ptr; int_32 result = MQX_OK; io_pipe_info_ptr = fd_ptr->DEV_DATA_PTR; /* Destroy the mutexes - doesn't free memory*/ _mutex_destroy(&io_pipe_info_ptr->READ_MUTEX); _mutex_destroy(&io_pipe_info_ptr->WRITE_MUTEX); _mutex_destroy(&io_pipe_info_ptr->ACCESS_MUTEX); /* Start CR 2237 */ /* Derstroy the lightweight semaphores */ _lwsem_destroy(&io_pipe_info_ptr->FULL_SEM); _lwsem_destroy(&io_pipe_info_ptr->EMPTY_SEM); /* End CR 2237 */ /* Free Pipe data structures */ _mem_free(io_pipe_info_ptr->QUEUE); _mem_free(io_pipe_info_ptr); return(result); } /* Endbody */
int FreeMutex(wolfSSL_Mutex* m) { if (_mutex_destroy(m) == MQX_EOK) return 0; else return BAD_MUTEX_E; }
/*! * \brief Deallocates drive context structure. * * \param drive_ptr * * \return _mfs_error */ _mfs_error MFS_Destroy_drive( MFS_DRIVE_STRUCT_PTR drive_ptr) { if (drive_ptr->DEV_OPEN) { return MFS_SHARING_VIOLATION; } #if MFSCFG_USE_MUTEX _mutex_destroy(&drive_ptr->MUTEX); #else _lwsem_destroy(&drive_ptr->LWSEM); #endif MFS_mem_free(drive_ptr); return MFS_NO_ERROR; }
_mqx_int _io_asrc_uninstall ( /* [IN] The IO device structure for the device */ IO_DEVICE_STRUCT_PTR io_dev_ptr ) { /* Body */ IO_ASRC_DEVICE_STRUCT_PTR asrc_io_dev_ptr = io_dev_ptr->DRIVER_INIT_PTR; if (asrc_io_dev_ptr->COUNT == 0) { if (asrc_io_dev_ptr->DEV_DEINIT) { (*asrc_io_dev_ptr->DEV_DEINIT)(asrc_io_dev_ptr); } _mutex_destroy(&asrc_io_dev_ptr->DEV_MUTEX); _mem_free (asrc_io_dev_ptr); io_dev_ptr->DRIVER_INIT_PTR = NULL; return IO_OK; } else { return IO_ERROR_DEVICE_BUSY; } } /* Endbody */
uint32_t OS_Mutex_destroy(os_mutex_handle mutex) { _mutex_destroy((MUTEX_STRUCT_PTR)mutex); _mem_free(mutex); return OS_MUTEX_OK; }