int FS_X_OS_Exit (void) { INT8U err; OSSemDel(FS_SemFileHandle, OS_DEL_ALWAYS, &err); OSSemDel(FS_SemFileOps , OS_DEL_ALWAYS, &err); OSSemDel(FS_SemDirHandle , OS_DEL_ALWAYS, &err); OSSemDel(FS_SemMemManager , OS_DEL_ALWAYS, &err); OSSemDel(FS_SemDirOps , OS_DEL_ALWAYS, &err); return (0); }
/********************************************************************************************************* ** Function name: zySemDel ** Descriptions: 删除信号量 ** input parameters: ulSem: zySemCreate返回值 ** output parameters: none ** Returned value: ZY_OK: 成功 ** 负数: 错误,绝对值参考zy_if.h ** Created by: Chenmingji ** Created Date: 2009-07-23 **-------------------------------------------------------------------------------------------------------- ** Modified by: ** Modified date: *********************************************************************************************************/ INT32S zySemDel (unsigned long ulSem) { INT8U ucErr; /* 错误代码 */ #if OS_ARG_CHK_EN == 0 /* * 参数检查 */ if (ulSem == 0) { return -ZY_PARAMETER_ERR; } #endif /* OS_ARG_CHK_EN */ OSSemDel((OS_EVENT *)ulSem, OS_DEL_ALWAYS, &ucErr); switch (ucErr) { case OS_ERR_PEVENT_NULL: return -ZY_PARAMETER_ERR; case OS_ERR_EVENT_TYPE: return -ZY_NO_FIND_OBJECT; case OS_ERR_DEL_ISR: return -ZY_NOT_OK; case OS_NO_ERR: return 0; default: return -ZY_NOT_OK; } }
/* Deallocates a semaphore */ void sys_sem_free(sys_sem_t sem) { u8_t ucErr; (void)OSSemDel( (OS_EVENT *)sem, OS_DEL_ALWAYS, &ucErr ); LWIP_ASSERT( "OSSemDel ", ucErr == OS_ERR_NONE ); }
status_t DSPI_RTOS_Deinit(dspi_rtos_handle_t *handle) { OS_ERR err; DSPI_Deinit(handle->base); OSFlagDel(&handle->event, OS_OPT_DEL_ALWAYS, &err); OSSemDel(&handle->mutex, OS_OPT_DEL_ALWAYS, &err); return kStatus_Success; }
void sys_sem_free(sys_sem_t *sem) { u8_t ucErr; (void)OSSemDel(*sem,OS_DEL_ALWAYS,&ucErr); if(ucErr != OS_ERR_NONE) { LWIP_ASSERT("OSSemDel ",ucErr==OS_ERR_NONE); } *sem = NULL; }
void osDeleteSemaphore(OsSemaphore *semaphore) { OS_ERR err; //Make sure the operating system is running if(OSRunning == OS_STATE_OS_RUNNING) { //Properly dispose the specified semaphore OSSemDel(semaphore, OS_OPT_DEL_ALWAYS, &err); } }
/* * This function waits for a mutual exclusion semaphore. */ extern status_t semDelete ( SEM_ID semId /* semaphore ID to take */ ) { uint8_t status_err; OSSemDel(semId, OS_DEL_ALWAYS, &status_err); if (OS_NO_ERR == status_err) return OK; return ERROR; }
/*FUNCTION********************************************************************** * * Function Name : OSA_SemaDestroy * Description : This function is used to destroy a semaphore. * Return kStatus_OSA_Success if the semaphore is destroyed successfully, otherwise * return kStatus_OSA_Error. * *END**************************************************************************/ osa_status_t OSA_SemaDestroy(semaphore_t *pSem) { OS_ERR err; OSSemDel(pSem, OS_OPT_DEL_ALWAYS, &err); if (OS_ERR_NONE == err) { return kStatus_OSA_Success; } else { return kStatus_OSA_Error; } }
void SerialOS_SemDel (void *psem) { LIB_ERR lib_err; OS_ERR os_err; OSSemPendAbort((OS_SEM *)psem, (OS_OPT )OS_OPT_PEND_ABORT_ALL, (OS_ERR *)&os_err); OSSemDel((OS_SEM *)psem, (OS_OPT )OS_OPT_DEL_ALWAYS, (OS_ERR *)&os_err); Mem_PoolBlkFree((MEM_POOL *)&OS_SemPool, (void *) psem, (LIB_ERR *)&lib_err); }
status_t DSPI_RTOS_Init(dspi_rtos_handle_t *handle, SPI_Type *base, const dspi_master_config_t *masterConfig, uint32_t srcClock_Hz) { OS_ERR err; if (handle == NULL) { return kStatus_InvalidArgument; } if (base == NULL) { return kStatus_InvalidArgument; } memset(handle, 0, sizeof(dspi_rtos_handle_t)); OSSemCreate(&handle->mutex, "DSPI", (OS_SEM_CTR)1, &err); if (OS_ERR_NONE != err) { return kStatus_Fail; } OSFlagCreate(&handle->event, "DSPI", (OS_FLAGS)0, &err); if (OS_ERR_NONE != err) { OSSemDel(&handle->mutex, OS_OPT_DEL_ALWAYS, &err); return kStatus_Fail; } handle->base = base; DSPI_MasterInit(handle->base, masterConfig, srcClock_Hz); DSPI_MasterTransferCreateHandle(handle->base, &handle->drv_handle, DSPI_RTOS_Callback, (void *)handle); return kStatus_Success; }
/** @memo Free a semaphore. @doc Free a semaphore using the handle returned from a successful call to _rtp_sig_semaphore_alloc. @precondition Must not call directly. Use the <b>rtp_sig_semaphore_free</b> macro in rtpsignl.h. @return void */ void _rtp_sig_semaphore_free ( RTP_HANDLE semHandle /** Handle to the semaphore to be freed. */ ) { INT8U err; if (!(OS_EVENT *)OSSemDel ( (OS_EVENT *) semHandle, OS_DEL_NO_PEND, &err) ) { /* success, return */ return; } #if RTP_DEBUG_SIGNAL if (err == OS_ERR_DEL_ISR) { RTP_DEBUG_OUTPUT_STR("attempted to delete the semaphore from an ISR"); } if (err == OS_ERR_INVALID_OPT) { RTP_DEBUG_OUTPUT_STR("An invalid option was specified"); } if (err == OS_ERR_TASK_WAITING) { RTP_DEBUG_OUTPUT_STR("One or more tasks were waiting on the semaphore"); } if (err == OS_ERR_EVENT_TYPE) { RTP_DEBUG_OUTPUT_STR("didn't pass a pointer to a semaphore"); } if (err == OS_ERR_PEVENT_NULL) { RTP_DEBUG_OUTPUT_STR("pevent is a NULL pointer"); } #endif return; }
int DINGOO_OpenAudio(_THIS, SDL_AudioSpec *spec) { int valid_datatype = 0; waveout_args waveformat; memset(&waveformat, 0, sizeof(waveformat)); Uint16 test_format = SDL_FirstAudioFormat(spec->format); while ((!valid_datatype) && (test_format)) { valid_datatype = 1; spec->format = test_format; switch (test_format) { //case AUDIO_U8: // waveformat.format = 8; // break; case AUDIO_S16LSB: waveformat.format = 16; break; default: valid_datatype = 0; test_format = SDL_NextAudioFormat(); break; } } if (!valid_datatype) { /* shouldn't happen, but just in case... */ SDL_SetError("Unsupported audio format"); return (-1); } if (spec->channels > 2) spec->channels = 2; /* no more than stereo on the Dingoo. */ waveformat.sample_rate = spec->freq; waveformat.channel = spec->channels; waveformat.volume = 30; /* Update the fragment size as size in bytes */ SDL_CalculateAudioSpec(spec); audio_sem = OSSemCreate(1); if (audio_sem == NULL) { SDL_SetError("Unable to start Dingoo Sound (audio_sem == NULL)"); return(-1); } if (dingooSoundInit(waveformat, spec->size, FillSound) < 0) { SDL_SetError("Unable to start Dingoo Sound (init failed)"); Uint8 tempError; OSSemDel(audio_sem, OS_DEL_ALWAYS, &tempError); return(-1); } dingooSoundPause(false); sdl_dingoo_audiodevice = this; /* Ready to go! */ return(1); }
void DINGOO_CloseAudio(_THIS) { dingooSoundClose(); Uint8 tempError; audio_sem = OSSemDel(audio_sem, OS_DEL_ALWAYS, &tempError); }