这篇教程C++ taskENTER_CRITICAL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中taskENTER_CRITICAL函数的典型用法代码示例。如果您正苦于以下问题:C++ taskENTER_CRITICAL函数的具体用法?C++ taskENTER_CRITICAL怎么用?C++ taskENTER_CRITICAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了taskENTER_CRITICAL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _gettimeofday_rint _gettimeofday_r(struct _reent *, struct timeval *__tp, void *__tzp){ taskENTER_CRITICAL(); uint_t t = sdk_system_get_time(); if (s_lastSysTime > t) { s_timeAdj += (uint_t)-1; } s_lastSysTime = t; taskEXIT_CRITICAL(); uint64_t usec = s_lastSysTime + s_timeAdj; __tp->tv_usec = usec; __tp->tv_sec = usec / 1000000; // DEBUG_PRINT("_gettimeofday_r:__tp->tv_sec=%08X, __tp->tv_usec=%08X, s_lastSysTime=%08X, s_timeAdj=%016llX/n", __tp->tv_sec, __tp->tv_usec, s_lastSysTime, s_timeAdj); return 0;}
开发者ID:HclX,项目名称:HomeLink,代码行数:22,
示例2: vNetworkBufferReleasevoid vNetworkBufferRelease( xNetworkBufferDescriptor_t * const pxNetworkBuffer ){portBASE_TYPE xListItemAlreadyInFreeList; /* Ensure the buffer is returned to the list of free buffers before the counting semaphore is 'given' to say a buffer is available. */ taskENTER_CRITICAL(); { xListItemAlreadyInFreeList = listIS_CONTAINED_WITHIN( &xFreeBuffersList, &( pxNetworkBuffer->xBufferListItem ) ); if( xListItemAlreadyInFreeList == pdFALSE ) { vListInsertEnd( &xFreeBuffersList, &( pxNetworkBuffer->xBufferListItem ) ); } configASSERT( xListItemAlreadyInFreeList == pdFALSE ); } taskEXIT_CRITICAL(); xSemaphoreGive( xNetworkBufferSemaphore ); iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );}
开发者ID:DanielKristofKiss,项目名称:FreeRTOS,代码行数:22,
示例3: registerShellCommandvoid registerShellCommand(shellCommand * newCommand){ xCommandListItem * item = &xRegisteredCommands; xCommandListItem * newItem = (xCommandListItem *) pvPortMalloc(sizeof(xCommandListItem)); taskENTER_CRITICAL(); // Get to the last item in list while (item->next != NULL) { item = item->next; } // Create list item newItem->command = newCommand; newItem->next = NULL; // Add item to list item->next = newItem; taskEXIT_CRITICAL();}
开发者ID:mrnguyen211190,项目名称:freertos-cli,代码行数:22,
示例4: bmc_start_wd_timer/** * start wdt internal * * /param mode watchdog mode * /param action action * /param count countdown value */void bmc_start_wd_timer(unsigned char use, unsigned char action, unsigned short count){ if (!(wd_timer.timer_use & WD_TIMER_START)) { taskENTER_CRITICAL(); /* set watchdog timer values */ wd_timer.timer_use = use; wd_timer.timer_action = action; wd_timer.initial_count = count; wd_timer.present_count = count; wd_timer.timer_use |= WD_TIMER_START; /* start or restart watchdog timer */ watchdog_start(); taskEXIT_CRITICAL();#ifdef CFG_CPCI wd_set = 1;#endif }}
开发者ID:ryanSie,项目名称:Advantech,代码行数:29,
示例5: vParTestToggleLEDvoid vParTestToggleLED( unsigned portBASE_TYPE uxLED ){unsigned portBASE_TYPE uxLEDMask; if( uxLED < partstNUM_LEDs ) { uxLEDMask = 1UL << uxLED; taskENTER_CRITICAL(); { if( MCF_GPIO_PORTTC & uxLEDMask ) { MCF_GPIO_PORTTC &= ~uxLEDMask; } else { MCF_GPIO_PORTTC |= uxLEDMask; } } taskEXIT_CRITICAL(); }}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:22,
示例6: FreeRTOS_CLIRegisterCommandportBASE_TYPE FreeRTOS_CLIRegisterCommand( const CLI_Command_Definition_t * const pxCommandToRegister ){ static CLI_Definition_List_Item_t *pxLastCommandInList = &xRegisteredCommands; CLI_Definition_List_Item_t *pxNewListItem; portBASE_TYPE xReturn = pdFAIL; /* Check the parameter is not NULL. */ configASSERT( pxCommandToRegister ); /* Create a new list item that will reference the command being registered. */ pxNewListItem = ( CLI_Definition_List_Item_t * ) pvPortMalloc( sizeof( CLI_Definition_List_Item_t ) ); configASSERT( pxNewListItem ); if( pxNewListItem != NULL ) { taskENTER_CRITICAL(); { /* Reference the command being registered from the newly created list item. */ pxNewListItem->pxCommandLineDefinition = pxCommandToRegister; /* The new list item will get added to the end of the list, so pxNext has nowhere to point. */ pxNewListItem->pxNext = NULL; /* Add the newly created list item to the end of the already existing list. */ pxLastCommandInList->pxNext = pxNewListItem; /* Set the end of list marker to the new list item. */ pxLastCommandInList = pxNewListItem; } taskEXIT_CRITICAL(); xReturn = pdPASS; } return xReturn;}
开发者ID:romantao,项目名称:openlpc-deps,代码行数:39,
示例7: vParTestToggleLEDvoid vParTestToggleLED( unsigned portBASE_TYPE uxLED ){unsigned portBASE_TYPE uxLEDMask; if( uxLED < partstNUM_LEDs ) { uxLEDMask = xLEDs[ uxLED ]; taskENTER_CRITICAL(); { if( P3 & uxLEDMask ) { P3 &= ~uxLEDMask; } else { P3 |= uxLEDMask; } } taskEXIT_CRITICAL(); }}
开发者ID:DonjetaE,项目名称:FreeRTOS,代码行数:22,
示例8: vDebugStringvoid vDebugString( char *s ){/*----------------------------------------------------------Local variables----------------------------------------------------------*/portBASE_TYPE xStatus;/*----------------------------------------------------------Clear interrupts while copying the string----------------------------------------------------------*/taskENTER_CRITICAL();while ( *s ) { xStatus = xQueueSendToBack( xDebugQueue, s++, 0 ); if ( xStatus == errQUEUE_FULL ) { break; } }taskEXIT_CRITICAL();}
开发者ID:clkv5,项目名称:Quadrotor,代码行数:22,
示例9: vParTestSetLEDvoid vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ){unsigned portBASE_TYPE uxLEDMask; if( uxLED < partstNUM_LEDs ) { uxLEDMask = xLEDs[ uxLED ]; taskENTER_CRITICAL(); { if( xValue ) { P3 |= uxLEDMask; } else { P3 &= ~uxLEDMask; } } taskEXIT_CRITICAL(); }}
开发者ID:DonjetaE,项目名称:FreeRTOS,代码行数:22,
示例10: vWriteBufferToDiskvoid vWriteBufferToDisk( const char * const pcBuffer, unsigned long ulBufferLength ){#ifdef USE_STDIOconst char * const pcFileName = "c://trace.bin";FILE *pf; taskENTER_CRITICAL(); { pf = fopen( pcFileName, "wb" ); if( pf ) { fwrite( pcBuffer, ( size_t ) ulBufferLength, ( unsigned short ) 1, pf ); fclose( pf ); } } taskEXIT_CRITICAL();#else /* Stop warnings. */ ( void ) pcBuffer; ( void ) ulBufferLength;#endif /*USE_STDIO*/}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:22,
示例11: vParTestToggleLEDvoid vParTestToggleLED( unsigned portBASE_TYPE uxLED ){ if( uxLED < partstMAX_LEDS ) { /* A critical section is used as the LEDs are also accessed from an interrupt. */ taskENTER_CRITICAL(); { if( ( ulGPIOState & ( 1UL << uxLED ) ) != 0UL ) { ulGPIOState &= ~( 1UL << uxLED ); } else { ulGPIOState |= ( 1UL << uxLED ); } MSS_GPIO_set_outputs( ulGPIOState ); } taskEXIT_CRITICAL(); }}
开发者ID:caseykelso,项目名称:freertos,代码行数:22,
示例12: FreeRTOS_closesocketBaseType_t FreeRTOS_closesocket( xSocket_t xSocket ){xNetworkBufferDescriptor_t *pxNetworkBuffer;xFreeRTOS_Socket_t *pxSocket; pxSocket = ( xFreeRTOS_Socket_t * ) xSocket; configASSERT( pxSocket ); configASSERT( pxSocket != FREERTOS_INVALID_SOCKET ); /* Socket must be unbound first, to ensure no more packets are queued on it. */ if( socketSOCKET_IS_BOUND( pxSocket ) != pdFALSE ) { taskENTER_CRITICAL(); { uxListRemove( &( pxSocket->xBoundSocketListItem ) ); } taskEXIT_CRITICAL(); } /* Now the socket is not bound the list of waiting packets can be drained. */ if( pxSocket->xWaitingPacketSemaphore != NULL ) { while( listCURRENT_LIST_LENGTH( &( pxSocket->xWaitingPacketsList ) ) > 0U ) { pxNetworkBuffer = ( xNetworkBufferDescriptor_t * ) listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->xWaitingPacketsList ) ); uxListRemove( &( pxNetworkBuffer->xBufferListItem ) ); vNetworkBufferRelease( pxNetworkBuffer ); } vSemaphoreDelete( pxSocket->xWaitingPacketSemaphore ); } vPortFree( pxSocket ); return 0;} /* Tested */
开发者ID:Ryan311,项目名称:FreeRTOSV8.2.3,代码行数:38,
示例13: vtHandleFatalErrorvoid vtHandleFatalError(int code,int line,char file[]) { static unsigned int delayCounter = 0; // There are lots of ways you can (and may want to) handle a fatal error // In this implementation, I suspend tasks and then flash the LEDs. Note that the stop may not be // immediate because this task has to be scheduled first for that to happen. In fact, one task might // call this while another tries to get into taskENTER_CRITICAL(); taskDISABLE_INTERRUPTS(); /* LEDs on ports 1 and 2 to output (1). */ // Note that all LED access is through the proper LPC library calls (or my own routines that call them) // Print where error occured for debugging printf("ERROR: code %d on line %d in file %s",code,line,file); vtInitLED(); for (;;) { // Silly delay loop, but we really don't have much choice here w/o interrupts and FreeRTOS... // This won't be okay to do *anywhere* else in your code for (delayCounter=0; delayCounter<10000000; delayCounter++) { } // Turn off half and on half vtLEDOn(0xAA); vtLEDOff(0x55); // Delay again for (delayCounter=0; delayCounter<10000000; delayCounter++) { } // Toggle vtLEDOff(0xAA); vtLEDOn(0x55); // Here is some dumb code to make sure that the three input parameters are not optimized away by the compiler if ((code < -55) && (line < -55) && (file == NULL)) { vtLEDOff(0x0); // We won't get here } // End of dumb code } // We will never get here taskEXIT_CRITICAL();}
开发者ID:ECEEmbedded,项目名称:ARMCode_vIntegration,代码行数:38,
示例14: MessageQCopy_create/* * ======== MessageQCopy_create ======== */MessageQCopy_Handle MessageQCopy_create(UInt32 reserved, UInt32 * endpoint){ MessageQCopy_Object *obj = NULL; Bool found = FALSE; Int i; UInt16 queueIndex = 0; taskENTER_CRITICAL(&virtQueLock); if(reserved == MessageQCopy_ASSIGN_ANY){ /* Search the array for a free slot above reserved: */ for(i = MessageQCopy_MAX_RESERVED_ENDPOINT + 1; (i < MAXMESSAGEQOBJECTS) && (found == FALSE); i++){ if(!IS_VALID_MSGQUEOBJ(&mQueObj[i])){ queueIndex = i; found = TRUE; break; } } } else if((queueIndex = reserved) <= MessageQCopy_MAX_RESERVED_ENDPOINT){ if(!IS_VALID_MSGQUEOBJ(&mQueObj[queueIndex])){ found = TRUE; } } if(found){ if(MsgQueObjInit(&mQueObj[queueIndex]) != FALSE){ obj = &mQueObj[queueIndex]; *endpoint = queueIndex; } } taskEXIT_CRITICAL(&virtQueLock); return obj;}
开发者ID:HackLinux,项目名称:freertos-multicore,代码行数:41,
示例15: vPortFreevoid vPortFree( void *pv ){unsigned char *puc = ( unsigned char * ) pv;xBlockLink *pxLink; if( pv != NULL ) { /* The memory being freed will have an xBlockLink structure immediately before it. */ puc -= heapSTRUCT_SIZE; /* This casting is to keep the compiler from issuing warnings. */ pxLink = ( void * ) puc; taskENTER_CRITICAL( &xMemLock ); { /* Add this block to the list of free blocks. */ xFreeBytesRemaining += pxLink->xBlockSize; prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) ); } taskEXIT_CRITICAL( &xMemLock ); }}
开发者ID:HackLinux,项目名称:freertos-multicore,代码行数:23,
示例16: stop_PWM_hardwarevoid stop_PWM_hardware(){ taskENTER_CRITICAL(); pwmTCCRa = 0;#if defined( portUSE_TIMER0_PWM ) pwmTCCRb DDRD &= ~pwmDDRD; // PD6 OC0A (Pin 6) & PD5 OC0B (Pin 5)#elif defined( portUSE_TIMER1_PWM ) #if defined(__AVR_ATmega328P__) // Arduino DDRB &= ~pwmDDRB; // PB1 OC1A (Pin 9) & PB2 OC1B (Pin 10) #elif defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__)|| defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega644PA__)// Pololu SVP with 1284p DDRD &= ~pwmDDRD; // PD5 OC1A & PD4 OC1B #endif#endif taskEXIT_CRITICAL();}
开发者ID:CalPolyRobotics,项目名称:IGVC-firmware,代码行数:23,
示例17: vBSP430ledSetvoid vBSP430ledSet( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ){ if (uxLED < ( unsigned portBASE_TYPE ) ucLEDDefnCount) { const xLEDDefn * pxLED = pxLEDDefn + uxLED; taskENTER_CRITICAL(); if (xValue > 0) { *pxLED->pucPxOUT |= pxLED->ucBIT; } else if (xValue < 0) { *pxLED->pucPxOUT ^= pxLED->ucBIT; } else { *pxLED->pucPxOUT &= ~pxLED->ucBIT; } taskEXIT_CRITICAL(); }}
开发者ID:bilalo0073,项目名称:freertos-mspgcc,代码行数:23,
示例18: prvGetPrivatePortNumberstatic uint16_t prvGetPrivatePortNumber( void ){static uint16_t usNextPortToUse = socketAUTO_PORT_ALLOCATION_START_NUMBER - 1;uint16_t usReturn; /* Assign the next port in the range. */ taskENTER_CRITICAL(); usNextPortToUse++; taskEXIT_CRITICAL(); /* Has it overflowed? */ if( usNextPortToUse == 0U ) { /* Don't go right back to the start of the dynamic/private port range numbers as any persistent sockets are likely to have been create first so the early port numbers may still be in use. */ usNextPortToUse = socketAUTO_PORT_ALLOCATION_RESET_NUMBER; } usReturn = FreeRTOS_htons( usNextPortToUse ); return usReturn;} /* Tested */
开发者ID:CausticUC,项目名称:STM32-Bootloader,代码行数:23,
示例19: retrieve_framestruct eth_frame* retrieve_frame(void){ struct eth_frame *frame = NULL; taskENTER_CRITICAL(); if(eth_buffer.head) { frame = eth_buffer.head; if(eth_buffer.head->next) { eth_buffer.head = eth_buffer.head->next; eth_buffer.head->prev = NULL; } else { eth_buffer.head = NULL; eth_buffer.tail = NULL; } } taskEXIT_CRITICAL(); return frame;}
开发者ID:alex1818,项目名称:rtk-8711af,代码行数:23,
示例20: vWriteMessageToDiskvoid vWriteMessageToDisk( const char * const pcMessage ){#ifdef USE_STDIOconst char * const pcFileName = "c://RTOSlog.txt";const char * const pcSeparator = "/r/n-----------------------/r/n";FILE *pf; taskENTER_CRITICAL(); { pf = fopen( pcFileName, "a" ); if( pf != NULL ) { fwrite( pcMessage, strlen( pcMessage ), ( unsigned short ) 1, pf ); fwrite( pcSeparator, strlen( pcSeparator ), ( unsigned short ) 1, pf ); fclose( pf ); } } taskEXIT_CRITICAL();#else /* Stop warnings. */ ( void ) pcMessage;#endif /*USE_STDIO*/}
开发者ID:vmandrews,项目名称:CSDC-OBC-Software,代码行数:23,
示例21: vActivateQueueunsigned portSHORT vActivateQueue(TaskToken taskToken, unsigned portSHORT usNumElement){ taskENTER_CRITICAL(); { //detect queue already exist if (xTaskQueueHandles[taskToken->enTaskID] == NULL) { //trim requested queue size usNumElement = (usNumElement > MAX_QUEUE_REQ_SIZE) ? MAX_QUEUE_REQ_SIZE : usNumElement; //create task queue memory xTaskQueueHandles[taskToken->enTaskID] = xQueueCreate(usNumElement, sizeof(MessagePacket)); } else { //TODO work out how to return existing queue size usNumElement = 0; } } taskEXIT_CRITICAL(); return usNumElement;}
开发者ID:bluesat,项目名称:csc-software,代码行数:23,
示例22: xEventGroupClearBitsEventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ){EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;EventBits_t uxReturn; /* Check the user is not attempting to clear the bits used by the kernel itself. */ configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 ); taskENTER_CRITICAL(); { traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear ); /* The value returned is the event group value prior to the bits being cleared. */ uxReturn = pxEventBits->uxEventBits; /* Clear the bits. */ pxEventBits->uxEventBits &= ~uxBitsToClear; } taskEXIT_CRITICAL(); return uxReturn;}
开发者ID:lepton-distribution,项目名称:lepton,代码行数:24,
示例23: vTaskDelay vTaskDelay(100/portTICK_RATE_MS); receiver(); } } correction(); vTaskDelay(500/portTICK_RATE_MS); } }void sender(void){ #ifdef MASTERMODE uint8_t i; for(i=1;i<=MAX_SLAVE_CLOCK;i++){ taskENTER_CRITICAL(); unsigned long int timeSender=timeProt.saveTime[i].second; taskEXIT_CRITICAL(); if(timeSender!=0){ //printf("id : %d , delay response time second : %lu",i,timeSender);
开发者ID:morandbaptiste,项目名称:timeSynchoSerial,代码行数:24,
示例24: usedxNetworkBufferDescriptor_t *pxNetworkBufferGet( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks ){ xNetworkBufferDescriptor_t *pxReturn = NULL; /*_RB_ The current implementation only has a single size memory block, so the requested size parameter is not used (yet). */ ( void ) xRequestedSizeBytes; /* If there is a semaphore available, there is a network buffer available. */ if( xSemaphoreTake( xNetworkBufferSemaphore, xBlockTimeTicks ) == pdPASS ) { /* Protect the structure as it is accessed from tasks and interrupts. */ taskENTER_CRITICAL(); { pxReturn = ( xNetworkBufferDescriptor_t * ) listGET_OWNER_OF_HEAD_ENTRY( &xFreeBuffersList ); uxListRemove( &( pxReturn->xBufferListItem ) ); } taskEXIT_CRITICAL(); iptraceNETWORK_BUFFER_OBTAINED( pxReturn ); } else { iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER(); } return pxReturn;}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:24,
示例25: FreeRTOS_CLIRegisterCommandBaseType_t FreeRTOS_CLIRegisterCommand( const CLI_Command_Definition_t * const pxCommandToRegister ){static CLI_Definition_List_Item_t *pxLastCommandInList = &xRegisteredCommands;CLI_Definition_List_Item_t *pxNewListItem;BaseType_t xReturn = pdFAIL; // проверим не пустая ли команда configASSERT( pxCommandToRegister ); // Создать новый элемент списка, который будет ссылаться на команду pxNewListItem = ( CLI_Definition_List_Item_t * ) pvPortMalloc( sizeof( CLI_Definition_List_Item_t ) ); configASSERT( pxNewListItem ); if( pxNewListItem != NULL ) { taskENTER_CRITICAL(); { // ссылка на команду в списке pxNewListItem->pxCommandLineDefinition = pxCommandToRegister; // указатель на следующий элемент списка pxNewListItem->pxNext = NULL; // Добавим вновь созданный элемент списка в конец уже существующего списка pxLastCommandInList->pxNext = pxNewListItem; // Set the end of list marker to the new list item. pxLastCommandInList = pxNewListItem; } taskEXIT_CRITICAL(); xReturn = pdPASS; } return xReturn;}
开发者ID:sagok,项目名称:SmI_IEC104,代码行数:36,
示例26: xSerialPutCharsigned portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime ){portBASE_TYPE xReturn = pdFALSE; /* The ISR is processing characters is so just add to the end of the queue. */ if( pdTRUE == xQueueSend( xSerialTxQueue, &cOutChar, xBlockTime ) ) { xReturn = pdTRUE; } else { /* The queue is probably full. */ xReturn = pdFALSE; } /* Make sure that the interrupt will fire in the case where: Currently sending so the Tx Complete will fire. Not sending so the Empty will fire. */ taskENTER_CRITICAL(); UART_1_SetTxInterruptMode( UART_1_TX_STS_COMPLETE | UART_1_TX_STS_FIFO_EMPTY ); taskEXIT_CRITICAL(); return xReturn;}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:24,
示例27: StartFsTaskvoid StartFsTask(void const * argument){ printf("Fs task started/n"); taskENTER_CRITICAL(); TREEVIEW_Handle filesystem = TREEVIEW_CreateEx( 500, 0, 300, 480, 0, WM_CF_SHOW, TREEVIEW_CF_AUTOSCROLLBAR_V | TREEVIEW_CF_AUTOSCROLLBAR_H | TREEVIEW_CF_ROWSELECT, GUI_ID_TREEVIEW0 ); TREEVIEW_SetFont(filesystem, GUI_FONT_24_ASCII); scan_files("", &filesystem); TREEVIEW_ITEM_ExpandAll(TREEVIEW_GetItem(filesystem, 0, TREEVIEW_GET_FIRST)); WM_SetCallback(WM_HBKWIN, _cbHBKWIN); WM_SetFocus(filesystem); taskEXIT_CRITICAL(); while(1) { osDelay(5000); }}
开发者ID:Oxbern,项目名称:CCube_Firmware,代码行数:24,
示例28: ClockTimestamptime_t ClockTimestamp(){ t_RTCC myrtcc; time_t epoch_time; struct tm ts; //char rtccString[200]; RTCCRead(&myrtcc); /*sprintf(rtccString, "RTC %.4d-%.2d-%.2d / %.2d:%.2d.%.2d / %d/r/n",(myrtcc.year), myrtcc.month, myrtcc.day, myrtcc.hour, myrtcc.min, myrtcc.sec, myrtcc.dweek); UARTWrite(1, rtccString);*/ ts.tm_year = 100+myrtcc.year; ts.tm_mon = myrtcc.month-1; ts.tm_wday = myrtcc.dweek; ts.tm_mday = myrtcc.day; ts.tm_hour = myrtcc.hour; ts.tm_min = myrtcc.min; ts.tm_sec = myrtcc.sec; ts.tm_isdst = 0;//DST flag explicitly set to NULL to avoid random assigment during mktime call taskENTER_CRITICAL();//making it task critical as this function was making 3600 jump issue epoch_time = mktime(&ts);//jump was due to isdst flag in tm structure taskEXIT_CRITICAL(); return epoch_time;}
开发者ID:adarkhorse,项目名称:iiitd-flyport-development,代码行数:24,
示例29: prvCheckForValidListAndQueuestatic void prvCheckForValidListAndQueue( void ){ /* Check that the list from which active timers are referenced, and the queue used to communicate with the timer service, have been initialised. */ taskENTER_CRITICAL(); { if( xTimerQueue == NULL ) { vListInitialise( &xActiveTimerList1 ); vListInitialise( &xActiveTimerList2 ); pxCurrentTimerList = &xActiveTimerList1; pxOverflowTimerList = &xActiveTimerList2; xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ) ); configASSERT( xTimerQueue ); #if ( configQUEUE_REGISTRY_SIZE > 0 ) { if( xTimerQueue != NULL ) { vQueueAddToRegistry( xTimerQueue, "TmrQ" ); } else { mtCOVERAGE_TEST_MARKER(); } } #endif /* configQUEUE_REGISTRY_SIZE */ } else { mtCOVERAGE_TEST_MARKER(); } } taskEXIT_CRITICAL();}
开发者ID:AdamRLukaitis,项目名称:martink,代码行数:36,
示例30: vModeSmsStartvoid vModeSmsStart(uint8_t option){ if (state != MODE_SMS_STATE_STOP) return; taskENTER_CRITICAL(); { eep_params.mode_sms_use_slider_as_shutter = 0; if (option & MODE_SMS_OPTION_SHUTTER) { eep_params.mode_sms_use_slider_as_shutter = 1; } for (uint8_t motor = 0; motor < SM_MOTORS_USED; motor++) { if (eep_params.mode_sms_accel_count[motor] == 0) { eep_params.mode_sms_accel_count[motor] = 1; } if (eep_params.mode_sms_decel_count[motor] == 0) { eep_params.mode_sms_decel_count[motor] = 1; } while (true) { if (mode_smsCOUNT_SUM_TOO_HIGH(motor) && eep_params.mode_sms_leadin_count[motor] > 0) { eep_params.mode_sms_leadin_count[motor]--; } if (mode_smsCOUNT_SUM_TOO_HIGH(motor) && eep_params.mode_sms_leadout_count[motor] > 0) { eep_params.mode_sms_leadout_count[motor]--; } if (mode_smsCOUNT_SUM_TOO_HIGH(motor) && eep_params.mode_sms_accel_count[motor] > 1) { eep_params.mode_sms_accel_count[motor]--; } if (mode_smsCOUNT_SUM_TOO_HIGH(motor) && eep_params.mode_sms_decel_count[motor] > 1) { eep_params.mode_sms_decel_count[motor]--; } if (!mode_smsCOUNT_SUM_TOO_HIGH(motor)) { break; } } int32_t steps = eep_params.mode_sms_positions[1].pos[motor] - eep_params.mode_sms_positions[0].pos[motor]; //int32_t img_count = (int32_t)eep_params.mode_sms_count; int32_t step_count = (int32_t)eep_params.mode_sms_count - 1; int32_t ramp_count = (int32_t)eep_params.mode_sms_accel_count[motor] + (int32_t)eep_params.mode_sms_decel_count[motor]; int32_t lead_count = (int32_t)eep_params.mode_sms_leadin_count[motor] + (int32_t)eep_params.mode_sms_leadout_count[motor]; int32_t move_count = step_count - lead_count; int32_t run_count = step_count - lead_count - ramp_count; if (move_count > 0 && steps != 0) { run_steps[motor] = 2 * steps / (2 * run_count + ramp_count); accel_steps_x1000[motor] = run_steps[motor] * 1000 / (int32_t)eep_params.mode_sms_accel_count[motor]; decel_steps_x1000[motor] = run_steps[motor] * 1000 / (int32_t)eep_params.mode_sms_decel_count[motor]; } else { run_steps[motor] = 0; accel_steps_x1000[motor] = 0; decel_steps_x1000[motor] = 0; } } test_mode = mode_smsTEST_NONE; current_step = 0; current_loop = 0; step_timer = 0; interval_timer = 0; vModeSmsCalcTime(); overall_time = eep_params.mode_sms_count * eep_params.mode_sms_interval; state = MODE_SMS_STATE_WAKE_SM; xTimerStart(xModeSmsControlTimer, 0); } taskEXIT_CRITICAL();}
开发者ID:milindur,项目名称:MdkController,代码行数:86,
注:本文中的taskENTER_CRITICAL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ taskEXIT_CRITICAL函数代码示例 C++ taskDelay函数代码示例 |