您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xTaskGetSchedulerState函数代码示例

51自学网 2021-06-03 10:14:44
  C++
这篇教程C++ xTaskGetSchedulerState函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xTaskGetSchedulerState函数的典型用法代码示例。如果您正苦于以下问题:C++ xTaskGetSchedulerState函数的具体用法?C++ xTaskGetSchedulerState怎么用?C++ xTaskGetSchedulerState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xTaskGetSchedulerState函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: xSemaphoreTake

int CharDev::printf(const char *format, ...){    if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) {        xSemaphoreTake(mPrintfSemaphore, portMAX_DELAY);    }        int len = 0;        va_list args;        va_start(args, format);        do {            va_list args_copy;            va_copy(args_copy, args);            len = vsnprintf(mpPrintfMem, mPrintfMemSize, format, args_copy);            va_end(args_copy);            if (len >= mPrintfMemSize) {                const int align = 16;                mPrintfMemSize = (align + ((len/align) * align));                /* TO DO :                 * Do not know why realloc() doesn't work.  It is a combination of C++ class                 * use combined with va_args and realloc itself.  It seems to work in vector                 * and str classes though.                 */                if (0) {                    if (mpPrintfMem) {                        free(mpPrintfMem);                    }                    mpPrintfMem = (char*) malloc(mPrintfMemSize);                }                else {                    mpPrintfMem = (char*) realloc(mpPrintfMem, mPrintfMemSize);                }            }            else {                break;            }        } while (mpPrintfMem);        va_end(args);        this->put(mpPrintfMem);    if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) {        xSemaphoreGive(mPrintfSemaphore);    }    return len;}
开发者ID:dhruvkakadiya,项目名称:Self_Driving_Car_TopGun,代码行数:48,


示例2: putChar

bool UartDev::putChar(char out, unsigned int timeout){    /* If OS not running, just send data using polling and return */    if (taskSCHEDULER_RUNNING != xTaskGetSchedulerState()) {        mpUARTRegBase->THR = out;        while(! (mpUARTRegBase->LSR & (1 << 6)));        return true;    }    /* FreeRTOS running, so send to queue and if queue is full, return false */    if(! xQueueSend(mTxQueue, &out, timeout)) {        return false;    }    /* If transmitter is not busy, send out the oldest char from the queue,     * and let the transmitter empty interrupt empty out the queue thereafter.     */    const int uart_tx_is_idle = (1 << 6);    if (mpUARTRegBase->LSR & uart_tx_is_idle)    {        if (xQueueReceive(mTxQueue, &out, 0)) {            mpUARTRegBase->THR = out;        }    }    return true;}
开发者ID:liveusr,项目名称:selfdriving,代码行数:27,


示例3: SDCardSendCommand

int SDCardSendCommand(uint8_t command, uint32_t param, uint8_t crc, void* buffer, size_t recvSize) {	Chip_GPIO_SetPinState(LPC_GPIO, 0, 2, !Chip_GPIO_GetPinState(LPC_GPIO, 0, 2));	if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)		xSemaphoreTake(xMutexSDCard, portMAX_DELAY);	int result = SDCARD_ERROR_GENERIC;	int wait = SDCARD_SPI_MAX_WAIT;	int i;	uint8_t read = 0;	uint8_t* data = (uint8_t*) buffer;	command += 0x40;	SDCardSetSS();	for (i = 0; i < SDCARD_IDLE_PRE_WAIT_ATTEMPTS; i++) {		if (spi_transceive_byte(SDCARD_SPI_DEVICE, 0xff) == 0xff) break;	}	result = SDCARD_ERROR_TRANSMIT_INTERRUPTED;	CommandBuffer[0] = command;	CommandBuffer[1] = param >> 24;	CommandBuffer[2] = param >> 16;	CommandBuffer[3] = param >> 8;	CommandBuffer[4] = param;	CommandBuffer[5] = (crc_crc7(CommandBuffer, 5) << 1) | 1;	spi_transceive(SDCARD_SPI_DEVICE, CommandBuffer, 6);	for (i = 0; i < 6; i++) {		if (CommandBuffer[i] != 0xff) {//			MSS_GPIO_set_output(MSS_GPIO_27, 0);			__asm volatile ("nop");//			MSS_GPIO_set_output(MSS_GPIO_27, 1);			goto fail;		}	}
开发者ID:jmeed,项目名称:teamRocket,代码行数:34,


示例4: mmem_init

/** * /brief      Initialize the managed memory module * /author     Adam Dunkels * *             This function initializes the managed memory module and *             should be called before any other function from the *             module. * */intmmem_init(void){	/* Only execute the initalisation before the scheduler was started.	 * So there exists only one thread and	 * no locking is needed for the initialisation	 */	configASSERT(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED);	/* cancle, if initialisation was already done */	if(mutex != NULL) {		return -1;	}	/* Do not use an recursive mutex,	 * because mmem_check() will not work vital then.	 */	mutex = xSemaphoreCreateMutex();	if(mutex == NULL) {		return -2;	}	list_init(mmemlist);	avail_memory = MMEM_SIZE;	return 0;}
开发者ID:twischer,项目名称:miniDTN,代码行数:35,


示例5: ASSERT

/*------------------------------------------------------------------------------ * MSS_I2C_wait_complete() * See "mss_i2c.h" for details of how to use this function. */mss_i2c_status_t MSS_I2C_wait_complete(    mss_i2c_instance_t * this_i2c){    ASSERT( (this_i2c == &g_mss_i2c0) || (this_i2c == &g_mss_i2c1) );#ifdef USE_OLD_I2C_POLLING_CODE    while ( this_i2c->status == MSS_I2C_IN_PROGRESS ) {        /* Wait for transaction to compltete.*/        ;    }#else    configASSERT( ( this_i2c->xI2CCompleteSemaphore ) );    if( xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED ) {        while ( this_i2c->status == MSS_I2C_IN_PROGRESS ) {            /* Wait for transaction to compltete.*/            ;        }    } else {        xSemaphoreTake( this_i2c->xI2CCompleteSemaphore, portMAX_DELAY );    }#endif    return this_i2c->status;}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:30,


示例6: wireless_service

void wireless_service(void){    /*     * If FreeRTOS is running, then a task should be calling us, so we can block on     * the nordic activity semaphore.     *     * There are three cases of block time :     *  1 - If nordic interrupt signal is still pending, then we haven't read     *      all Nordic FIFO, so we don't block on semaphore at all.     *  2 - There are pending packets that need either ACK or retry, so we     *      block just for one tick to carry out mesh logic.     *  3 - No RX and no TX, so block until either a packet is sent, or until     *      we receive a packet; both cases will give the semaphore.     */    if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) {        if (!nordic_intr_signal()) {            const TickType_t blockTime = mesh_get_pnd_pkt_count() ? 1 : portMAX_DELAY;            xSemaphoreTake(g_nrf_activity_sem, blockTime);        }        mesh_service();    }    /* A timer ISR is calling us, so we can't use FreeRTOS API, hence we poll */    else {        if (nordic_intr_signal() || mesh_get_pnd_pkt_count() > 0) {            mesh_service();        }    }}
开发者ID:PWDawgy,项目名称:lpc1758_freertos,代码行数:28,


示例7: SysTick_Handler

/**  * @brief  This function handles SysTick Handler.  * @param  None  * @retval None  */void SysTick_Handler(void){  if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)  {    xPortSysTickHandler();  }}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:12,


示例8: while

char I2C_Base::writeReg(char deviceAddress, char registerAddress, char value){    if(mDisableOperation) {        return 0;    }    // If scheduler not running , perform polling transaction    if(taskSCHEDULER_RUNNING != xTaskGetSchedulerState())    {        NVIC_DisableIRQ(mIRQ);        {            i2cKickOffTransfer(i2cWrite, deviceAddress, registerAddress, &value, 1);            do {                // Wait until SI flag is set, then call i2cStateMachine()                while(! (mpI2CRegs->I2CONSET & (1 << 3)) )                {                    ;                }            }while (writeComplete != i2cStateMachine());        }        NVIC_EnableIRQ(mIRQ);        return true;    }    // Wait for I2C Access, and just return, I2C Lock will be given by ISR()    xSemaphoreTake(mI2CMutex, portMAX_DELAY);    i2cKickOffTransfer(i2cWrite, deviceAddress, registerAddress, &value, 1);    return 0;}
开发者ID:montoya332,项目名称:Solar-Panel-Tracker,代码行数:29,


示例9: hl_periodic_service

/* If FreeRTOS is not running, then we rely on RIT service to call this function, * otherwise we rely on FreeRTOS tick hook to provide system timer */static void hl_periodic_service(void){    sys_watchdog_feed();    /* If FreeRTOS is running, user should use a dedicated task to call mesh service,     * so we will not call it if freertos is running     */    if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) {        g_system_uptime_ms += MS_PER_TICK();        /* We don't need RIT if FreeRTOS is running */        if (sys_rit_running()) {            sys_rit_disable();            /* The timer value so far may be an odd number, and if MS_PER_TICK() is not 1             * then we may increment it like 12, 22, 32, etc. so round this number once.             */            g_system_uptime_ms = (g_system_uptime_ms / 10) * 10;        }    }    else {        g_system_uptime_ms += g_time_per_rit_isr_ms;        wireless_service();        /**         * Small hack to support interrupts if FreeRTOS is not running :         * FreeRTOS API resets our base priority register, then all         * interrupts higher priority than IP_SYSCALL will not get locked out.         *   @see more notes at isr_priorities.h.  @see IP_SYSCALL         */        __set_BASEPRI(0);    }}
开发者ID:Bento007,项目名称:SJSU-Superway-2014,代码行数:36,


示例10: __malloc_unlock

extern "C" void __malloc_unlock ( struct _reent *_r ){	if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)		// don't release mutex if scheduler not started or suspended	{		mallocMutex.Release();	}}
开发者ID:dc42,项目名称:RepRapFirmware,代码行数:7,


示例11: prvTraceIsSchedulerSuspended

unsigned char prvTraceIsSchedulerSuspended(void){    /* Assumed to be available in FreeRTOS. According to the FreeRTOS docs, 	INCLUDE_xTaskGetSchedulerState or configUSE_TIMERS must be set to 1 in	FreeRTOSConfig.h for this function to be available. */	return xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED;}
开发者ID:ErichStyger,项目名称:McuOnEclipse_PEx,代码行数:8,


示例12: isFreeRtosRunning

char isFreeRtosRunning(){    if (!critialRegionSemaphore) {        critialRegionSemaphore = xSemaphoreCreateMutex();    }    return (taskSCHEDULER_RUNNING == xTaskGetSchedulerState());}
开发者ID:montoya332,项目名称:Solar-Panel-Tracker,代码行数:8,


示例13: ff_rel_grant

void ff_rel_grant (	_SYNC_t sobj	/* Sync object to be signaled */){    if(taskSCHEDULER_RUNNING == xTaskGetSchedulerState())    {        xSemaphoreGive(sobj);	/* FreeRTOS */    }}
开发者ID:Bento007,项目名称:SJSU-Superway-2014,代码行数:9,


示例14: __env_unlock

void __env_unlock ( struct _reent *_r ){#if OS_THREAD_SAFE_NEWLIB	if (!xTaskGetSchedulerState())		return;	  	xSemaphoreGiveRecursive(alt_envsem);#endif /* OS_THREAD_SAFE_NEWLIB */}
开发者ID:AlexShiLucky,项目名称:FreeLwIP-Nios-II,代码行数:9,


示例15: SysTick_Handler

/**  * @brief  This function handles SysTick Handler.  * @param  None  * @retval None  */void SysTick_Handler (void){  HAL_IncTick();  if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)  {    xPortSysTickHandler();  }  Toggle_Leds();}
开发者ID:ClintHaerinck,项目名称:STM32Cube_FW_F4,代码行数:14,


示例16: osResumeAllTasks

void osResumeAllTasks(void){   //Make sure the operating system is running   if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)   {      //Resume all tasks      xTaskResumeAll();   }}
开发者ID:Velleman,项目名称:VM204-Firmware,代码行数:9,


示例17: osSuspendAllTasks

void osSuspendAllTasks(void){   //Make sure the operating system is running   if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)   {      //Suspend all tasks      vTaskSuspendAll();   }}
开发者ID:Velleman,项目名称:VM204-Firmware,代码行数:9,


示例18: MPU_xTaskGetSchedulerState

	BaseType_t MPU_xTaskGetSchedulerState( void )	{	BaseType_t xReturn;	BaseType_t xRunningPrivileged = xPortRaisePrivilege();		xReturn = xTaskGetSchedulerState();		vPortResetPrivilege( xRunningPrivileged );		return xReturn;	}
开发者ID:sean93park,项目名称:freertos,代码行数:9,


示例19: MPU_xTaskGetSchedulerState

BaseType_t MPU_xTaskGetSchedulerState( void ){    BaseType_t xReturn;    BaseType_t xRunningPrivileged = prvRaisePrivilege();    xReturn = xTaskGetSchedulerState();    portRESET_PRIVILEGE( xRunningPrivileged );    return xReturn;}
开发者ID:RitikaGupta1207,项目名称:freertos,代码行数:9,


示例20: MPU_xTaskGetSchedulerState

	portBASE_TYPE MPU_xTaskGetSchedulerState( void )	{	portBASE_TYPE xReturn;    portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();		xReturn = xTaskGetSchedulerState();        portRESET_PRIVILEGE( xRunningPrivileged );		return xReturn;	}
开发者ID:ADTL,项目名称:ARMWork,代码行数:9,


示例21: SysTick_Handler

/**  * @brief  This function handles SysTick Handler.  * @param  None  * @retval None  */void SysTick_Handler(void){	HAL_IncTick();	if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)	{		xPortSysTickHandler();	}	// HAL_SYSTICK_IRQHandler();	systick_count++;}
开发者ID:Alexander-Wilms,项目名称:STM32F429I-DISCO,代码行数:15,


示例22: flush

bool UartDev::flush(void){    if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) {        while (getTxQueueSize() > 0) {            vTaskDelay(1);        }    }    return true;}
开发者ID:liveusr,项目名称:selfdriving,代码行数:10,


示例23: _cbSendTaskList

/********************************************************************* * *       _cbSendTaskList()**  Function description*    This function is part of the link between FreeRTOS and SYSVIEW.*    Called from SystemView when asked by the host, it uses SYSVIEW*    functions to send the entire task list to the host.*/static void _cbSendTaskList(void) {  TaskStatus_t*         pxTaskStatusArray;  UBaseType_t           uxArraySize;  UBaseType_t           x;  char                  cStatus;#if INCLUDE_xTaskGetIdleTaskHandle  TaskHandle_t          hIdle;  hIdle = xTaskGetIdleTaskHandle();#endif  /* Take a snapshot of the number of tasks in case it changes while this  function is executing. */  uxArraySize = uxTaskGetNumberOfTasks();  /* Allocate an array index for each task. */  pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );  if( pxTaskStatusArray != NULL ) {    /* Generate the (binary) data. */    uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );#if INCLUDE_xTaskGetIdleTaskHandle    /* only get Idle task handle if scheduler has been started */    if (xTaskGetSchedulerState()!=taskSCHEDULER_NOT_STARTED) {      hIdle = xTaskGetIdleTaskHandle();    } else {      hIdle = NULL;    }#endif        /* Create a human readable table from the binary data. */    for( x = 0; x < uxArraySize; x++ ) {      uint8_t* pStack;#if INCLUDE_pxTaskGetStackStart      pStack = pxTaskGetStackStart(pxTaskStatusArray[x].xHandle);#else      pStack = (uint8_t*)0;#endif#if INCLUDE_xTaskGetIdleTaskHandle      if (pxTaskStatusArray[x].xHandle != hIdle) {        SYSVIEW_SendTaskInfo((unsigned)pxTaskStatusArray[x].xHandle, pxTaskStatusArray[x].pcTaskName, pxTaskStatusArray[x].uxCurrentPriority, (unsigned int)pStack, 0);      }#else      if (memcmp(pxTaskStatusArray[x].pcTaskName, "IDLE", 5) != 0) {        SYSVIEW_SendTaskInfo((unsigned)pxTaskStatusArray[x].xHandle, pxTaskStatusArray[x].pcTaskName, pxTaskStatusArray[x].uxCurrentPriority, (unsigned int)pStack, 0);      }#endif    }    /* Free the array again. */    vPortFree( pxTaskStatusArray );  }}
开发者ID:xueliu,项目名称:nRF51822,代码行数:64,


示例24: log

 void log(String text) {     // ToDo: Add other debug outputs     if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {         if (xSemaphoreTake(serialPortMutex, ( TickType_t ) 10) == pdTRUE ) {             DEBUG_SERIAL.println(text);         }         xSemaphoreGive(serialPortMutex);     } else {         DEBUG_SERIAL.println(text);     } }
开发者ID:marekventur,项目名称:Mk2-Firmware,代码行数:11,


示例25: SysTick_Handler

万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。