void SNP_close(void) { #ifndef SNP_LOCAL // Delete SNP semaphores Semaphore_delete(&syncReq_sem); Semaphore_delete(&waitRsp_sem); #endif //SNP_LOCAL }
/*! * ======== OffloadM3_exit ======== * * Finalize the OffloadM3 module, currently supported only on SysM3 */ Void OffloadM3_exit() { if (MultiProc_self() != sysm3ProcId) return; Task_delete(&module.tasks[OFFLOAD_CREATE_IDX]); Task_delete(&module.tasks[OFFLOAD_DELETE_IDX]); Semaphore_delete(&module.semaphores[OFFLOAD_CREATE_IDX]); Semaphore_delete(&module.semaphores[OFFLOAD_DELETE_IDX]); Semaphore_delete(&module.mutex); }
Int32 System_deInit() { Int32 status = FVID2_SOK; IpcInM3Link_deInit(); IpcOutM3Link_deInit(); IpcFramesInLink_deInit(); IpcFramesOutLink_deInit(); Utils_dmaDeInit(); Utils_dmTimerDeInit(); System_deInitLinks(); #ifdef SYSTEM_DEBUG Vps_printf(" %d: SYSTEM : System VPSS De-Init in progress !!!\n", Utils_getCurTimeInMsec()); #endif System_freeBlankFrame(); Semaphore_delete(&gSystem_objVpss.vipLock[SYSTEM_VIP_0]); Semaphore_delete(&gSystem_objVpss.vipLock[SYSTEM_VIP_1]); #ifdef TI816X_DVR status = Vps_tvp5158DeInit(); UTILS_assert(status == FVID2_SOK); #endif Vps_platformDeviceDeInit(); /* * FVID2 system de-init */ FVID2_deInit(NULL); Vps_platformDeInit(); #ifdef SYSTEM_USE_TILER Utils_tilerAllocatorDeInit(); #endif #ifdef SYSTEM_DEBUG Vps_printf(" %d: SYSTEM : System VPSS De-Init Done !!!\n", Utils_getCurTimeInMsec()); #endif return status; }
static Void OffloadM3_deleteTask(UArg sem, UArg arg1) { Semaphore_Handle semHandle = (Semaphore_Handle)sem; Int i; while (1) { Semaphore_pend(semHandle, BIOS_WAIT_FOREVER); Mutex_enter(); if (module.created) { /* * Since this task is higher priority than any of the subtasks, * they won't be in running state, so we can call Task_delete on * them */ for (i = OFFLOAD_AC_IDX; i < OFFLOAD_MAX_IDX; i++) { Task_delete(&module.tasks[i]); Semaphore_delete(&module.semaphores[i]); module.tasks[i] = NULL; module.semaphores[i] = NULL; } module.created = FALSE; } Mutex_leave(); } }
/* * ======== IpcPower_exit ======== */ Void IpcPower_exit() { --curInit; if (curInit == 0) { /* Unblock PM suspend task */ Semaphore_post(IpcPower_semSuspend); /* Wait for task completion */ Semaphore_pend(IpcPower_semExit, BIOS_WAIT_FOREVER); /* Delete the suspend task and semaphore */ Task_delete(&IpcPower_tskSuspend); Semaphore_delete(&IpcPower_semSuspend); Semaphore_delete(&IpcPower_semExit); } }
void osDeleteMutex(OsMutex *mutex) { //Make sure the handle is valid if(mutex->handle != NULL) { //Properly dispose the specified mutex Semaphore_delete(&mutex->handle); } }
void osDeleteSemaphore(OsSemaphore *semaphore) { //Make sure the handle is valid if(semaphore->handle != NULL) { //Properly dispose the specified semaphore Semaphore_delete(&semaphore->handle); } }
Int32 DisplayLink_drvDelete(DisplayLink_Obj * pObj) { FVID2_FrameList frameList; Int32 status; #ifdef SYSTEM_DEBUG_DEI Vps_printf(" %d: DISPLAY: Frames = %d (fps = %d) !!!\n", Utils_getCurTimeInMsec(), pObj->dequeCount, pObj->dequeCount * 100 / (pObj->totalTime / 10)); #endif #ifdef SYSTEM_DEBUG_DISPLAY Vps_printf(" %d: DISPLAY: Delete in progress !!!\n", Utils_getCurTimeInMsec()); #endif do { // dequeue queued buffer's status = FVID2_dequeue(pObj->displayHndl, &frameList, 0, BIOS_NO_WAIT); } while (status == FVID2_SOK); status = FVID2_delete(pObj->displayHndl, NULL); if (FVID2_SOK != status) { Vps_printf("%s: Error %d @ line %d\n", __FUNCTION__, status, __LINE__); return (status); } Semaphore_delete(&pObj->lock); Semaphore_delete(&pObj->complete); DisplayLink_drvDeleteFrameInfo(pObj); DisplayLink_drvDeleteRtParams(pObj); #ifdef SYSTEM_DEBUG_DISPLAY Vps_printf(" %d: DISPLAY: Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif return FVID2_SOK; }
Int32 DupLink_drvDelete(DupLink_Obj * pObj) { UInt32 outId; Int32 status; for (outId = 0; outId < DUP_LINK_MAX_OUT_QUE; outId++) { status = Utils_bufDelete(&pObj->outFrameQue[outId]); UTILS_assert(status == FVID2_SOK); } Semaphore_delete(&pObj->lock); #ifdef SYSTEM_DEBUG_DUP Vps_printf(" %d: DUP : Delete Done !!!\n", Utils_getCurTimeInMsec()); #endif return FVID2_SOK; }
/* ========================================================================== */ TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreDelete(TIMM_OSAL_PTR pSemaphore) { TIMM_OSAL_SEMAPHORE *pHandle = (TIMM_OSAL_SEMAPHORE *)pSemaphore; TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; if(pHandle == NULL) { bReturnStatus = TIMM_OSAL_ERR_PARAMETER; goto EXIT; } /* Delete the semaphore. */ Semaphore_delete(&(pHandle->sem)); /* Update sem counter */ gSemCnt--; TIMM_OSAL_Free(pSemaphore); EXIT: return bReturnStatus; }
Void DSKT2_exitLocks() { Int i; /* * Initialize the yielding context and lock create flags */ for (i = 0; i < DSKT2_NUM_SCRATCH_GROUPS; i++) { _DSKT2_yieldingContext[i] = NULL; /* * Note, an optimization could be to allow this array to be * sparse, and only create enough semaphores for the groups that * will be used. Might require some extra config on the user's part * but it would save on some resources in environments where sems * are heavy. */ Semaphore_delete(&(_locks[i])); _locks[i] = NULL; } }
Int IpcResource_disconnect(IpcResource_Handle handle) { Int status; if (!handle) { System_printf("IpcResource_disconnect: handle is NULL\n"); return IpcResource_E_INVALARGS; } NameMap_unregister("rpmsg-resmgr", handle->endPoint); status = MessageQCopy_delete(&handle->msgq); if (status) { System_printf("IpcResource_disconnect: MessageQCopy_delete " "failed status %d\n", status); return status; } Semaphore_delete(&handle->sem); Memory_free(NULL, handle, sizeof(*handle)); return IpcResource_S_SUCCESS; }
Void _semDelete(Void * sem) { Semaphore_delete((Semaphore_Handle*)&sem); }
/** * @b Description * @n * The function is used to delete a critical section. * * @param[in] semHandle * Semaphore handle to be deleted * * @retval * Not Applicable */ Void Osal_srioDeleteSem(Void* semHandle) { Semaphore_delete(semHandle); }
int FreeMutex(wolfSSL_Mutex* m) { Semaphore_delete(m); return 0; }
/* * ======== SyncSem_Instance_finalize ======== */ Void SyncSem_Instance_finalize(SyncSem_Object *obj, Int status) { if (!(obj->userSem)) { Semaphore_delete(&obj->sem); } }
/*----------------------------------------------------------------------------- * ccode - Called from a kernel wrapper * * Start another task running and then ping / pong back and forth between * this function task and the other function task using a semaphore. *----------------------------------------------------------------------------*/ void ccode(uint32_t *completion_code) { counter = 0; /*------------------------------------------------------------------------- * Create a task to run the compute routine *------------------------------------------------------------------------*/ Task_Params taskParams; Task_Params_init(&taskParams); taskParams.instance->name = "compute"; /*------------------------------------------------------------------------- * The task is provided with a new stack that we simply malloc from the heap. * OpenCL kernels and functions called from kernels are provided with a * limited heap. If the stack space required for the task is greater than * the malloc can provide, then a buffer passed to the kernel can provide * the underlying memory for the stack. *------------------------------------------------------------------------*/ taskParams.stackSize = T1_STKSZ; taskParams.stack = malloc(T1_STKSZ); if (!taskParams.stack) { *completion_code = APP_FAIL_STACK; return; } /*------------------------------------------------------------------------- * Since the new task priority will be higher than this function which runs * at a priority level between 5 and 10, the task start immediately after * creation function blocks with the semaphore pend. *------------------------------------------------------------------------*/ taskParams.priority = 11; /*------------------------------------------------------------------------- * Create a semaphore that we will post and the compute function will * pend on. The address of the semaphore will be passed to the task function. *------------------------------------------------------------------------*/ Semaphore_Handle sem = Semaphore_create(0, NULL, NULL); if (!sem) { *completion_code = APP_FAIL_SEMAPHORE; return; } taskParams.arg0 = (UArg)&sem; Task_Handle task = Task_create(compute, &taskParams, NULL); if (!task) { *completion_code = APP_FAIL_TASK; return; } /*------------------------------------------------------------------------- * for multiple iterations, ping/pong between tasks *------------------------------------------------------------------------*/ int i; uint32_t c1 = __clock(); for (i = 0; i < 1000; ++i) { counter++; Semaphore_post(sem); } uint32_t c2 = __clock() - c1; printf("%u task switches in %u cycles ==> %u cycles per switch\n", counter, c2, c2/counter); /*------------------------------------------------------------------------- * Cleanup the SysBios resources *------------------------------------------------------------------------*/ Task_delete (&task); Semaphore_delete (&sem); *completion_code = APP_OK; }
/** * \brief delete semaphore object * * Deletes the specified counting semaphore. * * \param[in] p_sem_handle Handle to semaphore control block * * \return e_SUCCESS on success, e_FAILURE on error * * \sa OS_semaphore_create, semaphore_put, OS_semaphore_get * \note * * \warning */ e_ret_status OS_semaphore_delete(handle p_sem_handle) { Semaphore_delete((Semaphore_Handle *)p_sem_handle); return e_SUCCESS; /* Semaphore_delete doesn't return the status */ }