/*FUNCTION********************************************************************** * * Function Name : OSA_MsgQDestroy * Description : This function is used to destroy the message queue. * Return kStatus_OSA_Success if the message queue is destroyed successfully, * otherwise return kStatus_OSA_Error. * *END**************************************************************************/ osa_status_t OSA_MsgQDestroy(msg_queue_handler_t handler) { vQueueDelete(handler); return kStatus_OSA_Success; }
/*---------------------------------------------------------------------------* * Routine: sys_sem_free *---------------------------------------------------------------------------* * Description: * Deallocates a semaphore * Inputs: * sys_sem_t sem -- Semaphore to free *---------------------------------------------------------------------------*/ void sys_sem_free( sys_sem_t *pxSemaphore ) { SYS_STATS_DEC(sem.used); vQueueDelete( *pxSemaphore ); }
static void prvTestAbortingQueueSend( void ) { TickType_t xTimeAtStart; BaseType_t xReturn; const UBaseType_t xQueueLength = ( UBaseType_t ) 1; QueueHandle_t xQueue; uint8_t ucItemToQueue; #if( configSUPPORT_STATIC_ALLOCATION == 1 ) { static StaticQueue_t xQueueBuffer; static uint8_t ucQueueStorage[ sizeof( uint8_t ) ]; /* Create the queue. Statically allocated memory is used so the creation cannot fail. */ xQueue = xQueueCreateStatic( xQueueLength, sizeof( uint8_t ), ucQueueStorage, &xQueueBuffer ); } #else { xQueue = xQueueCreate( xQueueLength, sizeof( uint8_t ) ); configASSERT( xQueue ); } #endif /* This function tests aborting when in the blocked state waiting to send, so the queue must be full. There is only one space in the queue. */ xReturn = xQueueSend( xQueue, &ucItemToQueue, xMaxBlockTime ); if( xReturn != pdPASS ) { xErrorOccurred = pdTRUE; } /* Note the time before the delay so the length of the delay is known. */ xTimeAtStart = xTaskGetTickCount(); /* This first delay should just time out. */ xReturn = xQueueSend( xQueue, &ucItemToQueue, xMaxBlockTime ); if( xReturn != pdFALSE ) { xErrorOccurred = pdTRUE; } prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); /* Note the time before the delay so the length of the delay is known. */ xTimeAtStart = xTaskGetTickCount(); /* This second delay should be aborted by the primary task half way through. */ xReturn = xQueueSend( xQueue, &ucItemToQueue, xMaxBlockTime ); if( xReturn != pdFALSE ) { xErrorOccurred = pdTRUE; } prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime ); /* Note the time before the delay so the length of the delay is known. */ xTimeAtStart = xTaskGetTickCount(); /* This third delay should just time out again. */ xReturn = xQueueSend( xQueue, &ucItemToQueue, xMaxBlockTime ); if( xReturn != pdFALSE ) { xErrorOccurred = pdTRUE; } prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime ); /* Not really necessary in this case, but for completeness. */ vQueueDelete( xQueue ); }
int os_queue_destroy(os_queue_t queue, void*) { vQueueDelete(queue); return 0; }
/** Delete a semaphore * @param pxMutex the mutex to delete */ void sys_mutex_free( sys_mutex_t *pxMutex ) { SYS_STATS_DEC( mutex.used ); vQueueDelete( *pxMutex ); }
inline void queue_destroy() { vQueueDelete(queue); queue = 0; }
/** * Destructor */ SockServ::~SockServ() { vQueueDelete(m_acceptQueue); // Delete the queue created in the constructor. } // ~SockServ
static void battery_task( void* p ) { TRACE_INFO("battery task %x\r\n", xTaskGetCurrentTaskHandle()); #ifdef CFG_PM Timer timer; Timer_init(&timer, 0); Timer_setHandler(&timer, battery_timer_handler, NULL); #endif while (true) { if(gasgauge_get_stats(&_stats)) { panic("battery_task"); } if (_stats.voltage > 0) { // TODO: BATTERY_STATE_CRITICAL // TODO: BATTERY_STATE_DISCHARGING if (_stats.state == GASGAUGE_STATE_NO_CHARGE) { if (_stats.voltage < 4050) { gasgauge_charge(true); event ev; ev.type = EVENT_BATTERY; ev.data.battery.state = BATTERY_STATE_CHARGING; event_post(&ev); } } else if (_stats.state == GASGAUGE_STATE_CHARGED) { gasgauge_charge(false); event ev; ev.type = EVENT_BATTERY; ev.data.battery.state = BATTERY_STATE_CHARGED; event_post(&ev); } } //Task_sleep(10000); uint8_t battery_event; #ifdef CFG_PM Timer_start(&timer, 10000, false, false); xQueueReceive(battery_queue, &battery_event, -1); Timer_stop(&timer); #else xQueueReceive(battery_queue, &battery_event, 10000); #endif if (battery_event == WAKEUP_EVENT_CLOSE) { break; } else if (battery_event == WAKEUP_EVENT_USB_DISCONNECTED) { event ev; ev.type = EVENT_BATTERY; ev.data.battery.state = BATTERY_STATE_DICHARGING; event_post(&ev); } else if (battery_event == WAKEUP_EVENT_USB_CONNECTED) { } } #ifdef CFG_PM Timer_close(&timer); #endif vQueueDelete(battery_queue); vTaskDelete(NULL); }
/** * * @brief Destroys an instance of @p struct pios_queue * * @param[in] queuep pointer to instance of @p struct pios_queue * */ void PIOS_Queue_Delete(struct pios_queue *queuep) { vQueueDelete((xQueueHandle)queuep->queue_handle); PIOS_free(queuep); }
void csp_queue_remove(csp_queue_handle_t queue) { vQueueDelete(queue); }
void os_xqueue_delete(xqueue_handle_t xQueue ) { vQueueDelete((xQueueHandle)xQueue); }
/*! \brief This function is used to delete the MsgQ \param pMsgQ - pointer to the message queue \return - OsiReturnVal_e \note \warning */ OsiReturnVal_e osi_MsgQDelete(OsiMsgQ_t* pMsgQ) { vQueueDelete((QueueHandle_t) *pMsgQ ); return OSI_OK; }
/** * @brief Delete a Mutex * @param mutex_id mutex ID obtained by \ref osMutexCreate. * @retval status code that indicates the execution status of the function. * @note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS. */ osStatus osMutexDelete (osMutexId mutex_id) { vQueueDelete(mutex_id); return osOK; }
void play_task(void *pvParameters) { esp_spiffs_init(); if (esp_spiffs_mount() != SPIFFS_OK) { printf("Error mount SPIFFS\n"); } int fd = open("sample.wav", O_RDONLY); if (fd < 0) { printf("Error opening file\n"); return; } dumb_wav_header_t wav_header; read(fd, (void*)&wav_header, sizeof(wav_header)); printf("Number of channels: %d\n", wav_header.num_channels); printf("Bits per sample: %d\n", wav_header.bits_per_sample); printf("Sample rate: %d\n", wav_header.sample_rate); printf("Data size: %d\n", wav_header.data_size); if (wav_header.bits_per_sample != 16) { printf("Only 16 bit per sample is supported\n"); return; } if (wav_header.num_channels != 2) { printf("Only 2 channels is supported\n"); return; } i2s_clock_div_t clock_div = i2s_get_clock_div( wav_header.sample_rate * 2 * 16); printf("i2s clock dividers, bclk=%d, clkm=%d\n", clock_div.bclk_div, clock_div.clkm_div); i2s_pins_t i2s_pins = {.data = true, .clock = true, .ws = true}; i2s_dma_init(dma_isr_handler, clock_div, i2s_pins); while (1) { init_descriptors_list(); i2s_dma_start(dma_block_list); lseek(fd, sizeof(dumb_wav_header_t), SEEK_SET); while (play_data(fd)) {}; i2s_dma_stop(); vQueueDelete(dma_queue); printf("underrun counter: %d\n", underrun_counter); vTaskDelay(1000 / portTICK_PERIOD_MS); } close(fd); } void user_init(void) { uart_set_baud(0, 115200); xTaskCreate(play_task, "test_task", 1024, NULL, 2, NULL); }
void OsMutexDestroy(THandle aMutex) { vQueueDelete(aMutex); }
inline void mutex_destroy() { vQueueDelete(mutex); mutex = 0; }
void OsSemaphoreDestroy(THandle aSem) { vQueueDelete(aSem); }
void vIOUtilsCreateTransferControlStructure( Transfer_Control_t **ppxTransferControl ) { Transfer_Control_t *pxTransferControl = *ppxTransferControl; /* Does the transfer control structure already exist? */ if( pxTransferControl == NULL ) { /* The transfer control structure does not exist. Create it. */ *ppxTransferControl = ( Transfer_Control_t * ) pvPortMalloc( sizeof( Transfer_Control_t ) ); } else { /* The transfer control structure does already exist, so there is no need to create it, however the state structure it points to is being changed, so delete the existing state structure, and anything it might contain. */ switch( pxTransferControl->ucType ) { case ioctlUSE_ZERO_COPY_TX : #if ioconfigUSE_ZERO_COPY_TX == 1 { Zero_Copy_Tx_State_t *pxZeroCopyState; /* In this case, the pvTransferState member points to a zero copy state structure, which in turn contains a mutex that needs to be deleted. */ pxZeroCopyState = ( Zero_Copy_Tx_State_t * ) ( pxTransferControl->pvTransferState ); vSemaphoreDelete( pxZeroCopyState->xWriteAccessMutex ); vPortFree( pxZeroCopyState ); } #endif /* ioconfigUSE_ZERO_COPY_TX */ break; case ioctlUSE_CHARACTER_QUEUE_TX : case ioctlUSE_CHARACTER_QUEUE_RX : #if ( ioconfigUSE_TX_CHAR_QUEUE == 1 ) || ( ioconfigUSE_RX_CHAR_QUEUE == 1 ) { Character_Queue_State_t *pxCharQueueState; /* In this case the pvTrasactionState member points to a character queue state structure, which in turn contains a queue that needs to be deleted. */ pxCharQueueState = ( Character_Queue_State_t * ) ( pxTransferControl->pvTransferState ); vQueueDelete( pxCharQueueState->xQueue ); vPortFree( pxCharQueueState ); } #endif /* ( ioconfigUSE_TX_CHAR_QUEUE == 1 ) || ( ioconfigUSE_RX_CHAR_QUEUE == 1 ) */ break; case ioctlUSE_CIRCULAR_BUFFER_RX : #if ioconfigUSE_CIRCULAR_BUFFER_RX == 1 { Circular_Buffer_Rx_State_t *pxCircularBufferState; /* In this case, the pvTransferState member points to a circular buffer structure, which in turn contains a semaphore and a buffer, both of which need to be deleted. */ pxCircularBufferState = ( Circular_Buffer_Rx_State_t * ) ( pxTransferControl->pvTransferState ); vSemaphoreDelete( pxCircularBufferState->xNewDataSemaphore ); vPortFree( ( void * ) ( pxCircularBufferState->pucBufferStart ) ); vPortFree( pxCircularBufferState ); } #endif /* ioconfigUSE_CIRCULAR_BUFFER_RX */ break; case ioctlUSE_POLLED_TX : /* Default assumes no specific kernel objects are being used. */ vPortFree( pxTransferControl->pvTransferState ); break; default : /* To get here a transfer structure must have existed, but with a valid pvTransferState member. This can happen when a peripheral is being polled, and both the Tx and Rx transfer structures use the same state structure (for example, in an NXP SSP/SPI driver where data cannot be received without data also being transmitted). There is nothing to do here. */ break; } pxTransferControl->pvTransferState = NULL; } }
void AJ_QueueDelete(struct AJ_Queue* q) { vQueueUnregisterQueue(q->q); vQueueDelete(q->q); }
void NLS_RTOS_deinit (struct NLS_HandleTypedef* hNLS) { vQueueDelete(hNLS->event_queue); vTaskDelete(hNLS->send_task_handle); vTaskDelete(hNLS->receive_task_handle); }
// Deallocates a semaphore void sys_sem_free(sys_sem_t sem) { vQueueDelete( sem ); }
~ThreadQueue() { vQueueDelete(queue); }