这篇教程C++ DISABLE_INTERRUPTS函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DISABLE_INTERRUPTS函数的典型用法代码示例。如果您正苦于以下问题:C++ DISABLE_INTERRUPTS函数的具体用法?C++ DISABLE_INTERRUPTS怎么用?C++ DISABLE_INTERRUPTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DISABLE_INTERRUPTS函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PRIMITIVE_CLOSEintPRIMITIVE_CLOSE(int fileID){ interrupt_state istate; _LOCK_PRIMIO(); PrimIOCB.op = PRIM_CLOSE; PrimIOCB.fileID = fileID; PrimIOCB.flags = 0; /* (not used) */ PrimIOCB.more = NULL; DISABLE_INTERRUPTS(istate);#if defined(__ADSPBLACKFIN__) FLUSH_CACHE_PRIMIOCB(); DISABLE_CACHE(); SYNCH_MEMORY();#endif _primIO();#if defined(__ADSPBLACKFIN__) ENABLE_CACHE();#endif ENABLE_INTERRUPTS(istate); _UNLOCK_PRIMIO(); return 0;}
开发者ID:webom2008,项目名称:BF512.VDK,代码行数:27,
示例2: output_buffer_index_write_incrementuint16_t output_buffer_index_write_increment() { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.output_buffer_index_write=(openserial_vars.output_buffer_index_write+1)%SERIAL_OUTPUT_BUFFER_SIZE; ENABLE_INTERRUPTS(); return openserial_vars.output_buffer_index_write;}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:7,
示例3: schedule_advanceSlotvoid schedule_advanceSlot() { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); // advance to next active slot schedule_vars.currentScheduleEntry = schedule_vars.currentScheduleEntry->next; ENABLE_INTERRUPTS();}
开发者ID:giu7ppe,项目名称:openwsn,代码行数:7,
示例4: StartApplicationvoid StartApplication( void (*StartAddress)() ){ PortBooterLoadProgram((void**)&StartAddress); hal_printf( "Starting main application at 0x%08x/r/n", (size_t)StartAddress ); LCD_Clear(); USART_Flush( ConvertCOM_ComPort(g_State.UsartPort) ); if(g_State.UsingUsb) { USB_Flush( ConvertCOM_UsbStream( g_State.UsbPort ) ); USB_CloseStream( ConvertCOM_UsbStream(g_State.UsbPort) ); USB_Uninitialize( ConvertCOM_UsbController(g_State.UsbPort) ); //disable the USB for the next application } DISABLE_INTERRUPTS(); LCD_Uninitialize(); CPU_DisableCaches(); (*StartAddress)();}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:26,
示例5: openserial_printErrorerror_t openserial_printError(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2) { leds_error_toggle(); INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.somethingInOutputBuffer=TRUE; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'E'; //this is an error openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)calling_component; //component generating error openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)error_code; //error_code openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg1 & 0xff00)>>8); //arg1 openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg1 & 0x00ff); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg2 & 0xff00)>>8); //arg2 openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg2 & 0x00ff); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; ENABLE_INTERRUPTS(); return E_SUCCESS;}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:27,
示例6: RITQueue_Get_ElementsRITqueue RITQueue_Get_Element(uint8_t pos){ sRITqueue elem; //EnterCriticalSection INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); if (RITQueue_IsEmpty() == false) { if ( pos < maxElements) { elem = pvObjList[pos]; } else { elem.frameType = 0; RITQueue_ClearAddress(&elem.destaddr); } } else { elem.frameType = 0; RITQueue_ClearAddress(&elem.destaddr); } //LeaveCriticalSection ENABLE_INTERRUPTS(); return elem;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:31,
示例7: RITQueue_ExistFramePending/* * Verifica se existe algum frame pendente */bool RITQueue_ExistFramePending(void){ bool ret = false; uint8_t i; //EnterCriticalSection INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); for (i = 0; i < maxElements; i++) { if (pvObjList[i].pending) { if (pvObjList[i].countretry < 3) { ret = true; break; } else //REMOVO O ELEMENTO QUE JA ESTA A TEMPOS AQUI { RITQueue_Free(i); } } } if (coappending) ret = true; //LeaveCriticalSection ENABLE_INTERRUPTS(); return ret;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:37,
示例8: drvSysTick_getUptimeint drvSysTick_getUptime(struct timeval* uptime){ unsigned int sysTickValue; // System Tick counter counts down! CHECK_STARTED_INT(&sInstDscr, 0); CHECK_POINTER_INT(uptime); /* Note that SysTick->VAL counts down and rolls over to SysTick->LOAD * when reaching 0 even if interrupts are disabled. * Therefore, if SysTick->VAL rolls over while reading out uptime, * try again. Could use outdated uptime otherwise. */ do { SysTick->CTRL &= ~SysTick_CTRL_COUNTFLAG_Msk; DISABLE_INTERRUPTS(); sysTickValue = SysTick->VAL; *uptime = sInstDscr.uptime; ENABLE_INTERRUPTS(); } while (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk); sysTickValue = SysTick->LOAD - sysTickValue; /* Initial code, when uptime was of type unsigned long long: * *uptime += (unsigned long long)sysTickValue * 1000000 / SystemCoreClock; * However, this invokes the function __aeabi_uldivmod() for the 64bit * integer division. Takes quite long. With a simple trick (divide * numerator and divisor by 1000) the division can be kept in the integer * range. That causes the compiler to use the UDIV instruction, which is * much faster executed than the __aeabi_uldivmod() function. */ uptime->tv_usec += sysTickValue * 1000UL / (SystemCoreClock / 1000UL); uptime->tv_sec += uptime->tv_usec / 1000000UL; uptime->tv_usec %= 1000000UL; return R_SUCCESS;}
开发者ID:bitcontrol,项目名称:STM32,代码行数:34,
示例9: uart0_inint uart0_in (ECTX ectx, WORD count, BYTEPTR pointer){ unsigned short imask; int reschedule; DISABLE_INTERRUPTS (imask); if (rx_pending) { write_byte (pointer, (BYTE) rx_buffer); rx_pending = 0; BARRIER; reschedule = 0; } else { rx_channel = ectx->wptr; rx_ptr = pointer; BARRIER; reschedule = 1; } ENABLE_INTERRUPTS (imask); if (reschedule) { /* Lower (set) CTS */ *pPORTHIO_CLEAR = CTS_MASK; /* Save instruction pointer */ WORKSPACE_SET (ectx->wptr, WS_IPTR, (WORD) ectx->iptr); /* Reschedule */ return ectx->run_next_on_queue (ectx); } else { return ECTX_CONTINUE; }}
开发者ID:bsmr-misc-forks,项目名称:kroc,代码行数:32,
示例10: Gyro_Calculationvoid Gyro_Calculation(Gyro * gyro){ short velocity; short angular_velocity; CPU_MSR msr; //gyro.velocityBack = pid.currentVelocityBack; msr = DISABLE_INTERRUPTS(); velocity = raw_gyro_data.velocity; angular_velocity = raw_gyro_data.angular_velocity; RESTORE_INTERRUPTS(msr); // V_b gyro->backVelocity = raw_gyro_data.velocity; // W gyro->omega = (CONVERT_TO_RAD_SEC * raw_gyro_data.angular_velocity); //R_b gyro->backRadius = gyro->backVelocity/gyro->omega; // K_b gyro->backCurvature = gyro->omega/gyro->backVelocity; // V_f gyro->frontVelocity = gyro->backVelocity * sqrt(1+((gyro->backCurvature)*gyro->backCurvature*(gyro->wheelBase)*gyro->wheelBase)); // K_f gyro->frontCurvature = gyro->omega/gyro->frontVelocity; //R_b gyro->frontRadius = gyro->frontVelocity/gyro->omega; // Delta gyro->steeringAngle = asin(gyro->wheelBase * (1/gyro->frontRadius));}
开发者ID:CultOfSkaro,项目名称:CultOfSkaro,代码行数:32,
示例11: Gyro_GetTotalAngleinline int Gyro_GetTotalAngle(){ CPU_MSR msr = DISABLE_INTERRUPTS(); int millidegrees = raw_gyro_data.total_angle; //raw_gyro_data.total_angle = 0; RESTORE_INTERRUPTS(msr); return millidegrees * 8.75;}
开发者ID:CultOfSkaro,项目名称:CultOfSkaro,代码行数:7,
示例12: schedule_indicateTx/**/brief Indicate the transmission of a packet. */ void schedule_indicateTx(asn_t* asnTimestamp, bool succesfullTx) { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); // increment usage statistics if (schedule_vars.currentScheduleEntry->numTx==0xFF) { schedule_vars.currentScheduleEntry->numTx/=2; schedule_vars.currentScheduleEntry->numTxACK/=2; } schedule_vars.currentScheduleEntry->numTx++; if (succesfullTx==TRUE) { schedule_vars.currentScheduleEntry->numTxACK++; } // update last used timestamp memcpy(&schedule_vars.currentScheduleEntry->lastUsedAsn, asnTimestamp, sizeof(asn_t)); // update this slot's backoff parameters if (succesfullTx==TRUE) { // reset backoffExponent schedule_vars.currentScheduleEntry->backoffExponent = MINBE-1; // reset backoff schedule_vars.currentScheduleEntry->backoff = 0; } else { // increase the backoffExponent if (schedule_vars.currentScheduleEntry->backoffExponent<MAXBE) { schedule_vars.currentScheduleEntry->backoffExponent++; } // set the backoff to a random value in [0..2^BE] schedule_vars.currentScheduleEntry->backoff = openrandom_get16b()%(1<<schedule_vars.currentScheduleEntry->backoffExponent); } ENABLE_INTERRUPTS();}
开发者ID:Bug-bear,项目名称:g_nf_vs_pdr,代码行数:38,
示例13: GM_Levelvoid GM_Level(){_restart: v_gamemode |= GameMode_PreLevel; // flag that we're in pre-level sequence if(f_demo != DemoMode_Credits) PlaySound_Special(BGM_Fade); ClearPLC(); PaletteFadeOut(); // If we're not doing an ending sequence demo... if(f_demo != DemoMode_Credits) { DISABLE_INTERRUPTS(); NemDec(Nem_TitleCard, 0xB000); ENABLE_INTERRUPTS(); auto plc1 = LevelHeaders[v_zone].gfx >> 24; if(plc1 != 0) AddPLC(plc1); // load level patterns AddPLC(PLC_Main2); // load standard patterns }
开发者ID:JarrettBillingsley,项目名称:DecompilingSonic1,代码行数:25,
示例14: hal_aci_tl_sendbool hal_aci_tl_send(hal_aci_data_t *p_aci_cmd){ uint8_t length = p_aci_cmd->buffer[0]; if (!spi_transmit_requested) {// ASSERT(ERROR_CODE_HAL_ACI_TL_OVERFLOW,(p_aci_cmd->buffer[0] <= HAL_ACI_MAX_LENGTH)); if (length > HAL_ACI_MAX_LENGTH) { return(false); } { bool is_interrupt_enabled_before_send = ARE_INTERRUPTS_ENABLED(); DISABLE_INTERRUPTS(); /*disable interrupts to protects the modification of the buffer pointer*/ lib_mem_copy((uint8_t *) data_to_send.buffer, p_aci_cmd->buffer, length+1); spi_transmit_requested = true; // Request transmission if (is_interrupt_enabled_before_send) { ENABLE_INTERRUPTS(); /*eventually re-enable the interrupts if they were enabled*/ } } digitalWrite(reqn, LOW); return(true); } else { return(false); }}
开发者ID:MattiasTswe,项目名称:mcrobot,代码行数:30,
示例15: openserial_printDataowerror_t openserial_printData(uint8_t* buffer, uint8_t length) { uint8_t i; uint8_t asn[5]; INTERRUPT_DECLARATION(); // retrieve ASN ieee154e_getAsn(asn);// byte01,byte23,byte4 DISABLE_INTERRUPTS(); openserial_vars.outputBufFilled = TRUE; outputHdlcOpen(); outputHdlcWrite(SERFRAME_MOTE2PC_DATA); outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); outputHdlcWrite(asn[0]); outputHdlcWrite(asn[1]); outputHdlcWrite(asn[2]); outputHdlcWrite(asn[3]); outputHdlcWrite(asn[4]); for (i=0;i<length;i++){ outputHdlcWrite(buffer[i]); } outputHdlcClose(); ENABLE_INTERRUPTS(); return E_SUCCESS;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:27,
示例16: idmanager_setIsDAGrootvoid idmanager_setIsDAGroot(bool newRole) { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); idmanager_vars.isDAGroot = newRole; neighbors_updateMyDAGrankAndNeighborPreference(); ENABLE_INTERRUPTS();}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:7,
示例17: openqueue_removeAllOwnedBy/**/brief Free all the packet buffers owned by a specific module./param owner The identifier of the component, taken in COMPONENT_*.*/void openqueue_removeAllOwnedBy(uint8_t owner) { uint8_t i; uint8_t count=0; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); for (i=0;i<QUEUELENGTH;i++){ if (openqueue_vars.queue[i].owner==owner) { count++; openqueue_reset_entry(&(openqueue_vars.queue[i])); } } ENABLE_INTERRUPTS();#if ((ENABLE_DEBUG_RFF ==1) && (DBG_OPENQUEUE == 1)) { uint8_t pos=0; rffbuf[pos++]= RFF_OPENQUEUE_FREE; rffbuf[pos++]= 0x03; rffbuf[pos++]= owner; rffbuf[pos++]= count; openserial_printStatus(STATUS_RFF,(uint8_t*)&rffbuf,pos); }#endif}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:31,
示例18: idmanager_setIsBridgevoid idmanager_setIsBridge(bool newRole) { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); idmanager_vars.isBridge = newRole; ENABLE_INTERRUPTS();}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:7,
示例19: RITQueue_PutPendingbool RITQueue_PutPending(uint8_t elementpos){ bool ret = false; uint8_t i; //EnterCriticalSection INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); if (RITQueue_IsEmpty() == false) { if (elementpos < maxElements) { pvObjList[elementpos].pending = 1; pvObjList[elementpos].countretry++; ret = true; } } else { //printf("LISTA VAZIA!!!!! /n"); } //LeaveCriticalSection ENABLE_INTERRUPTS(); return ret;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:29,
示例20: idmanager_getMyIDopen_addr_t* idmanager_getMyID(uint8_t type) { open_addr_t* res; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); switch (type) { case ADDR_16B: res= &idmanager_vars.my16bID; break; case ADDR_64B: res= &idmanager_vars.my64bID; break; case ADDR_PANID: res= &idmanager_vars.myPANID; break; case ADDR_PREFIX: res= &idmanager_vars.myPrefix; break; case ADDR_128B: // you don't ask for my full address, rather for prefix, then 64b default: openserial_printCritical(COMPONENT_IDMANAGER,ERR_WRONG_ADDR_TYPE, (errorparameter_t)type, (errorparameter_t)0); res= NULL; break; } ENABLE_INTERRUPTS(); return res;}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:29,
示例21: RITQueue_Freebool RITQueue_Free(uint8_t elementpos){ bool ret = false; uint8_t i; //EnterCriticalSection INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); if (elementpos < maxElements) { RITQueue_ClearAddress(&pvObjList[elementpos].destaddr); pvObjList[elementpos].timestamp = 0; pvObjList[elementpos].msglength = 0; pvObjList[elementpos].frameType = 0; pvObjList[elementpos].pending = 0; pvObjList[elementpos].numTargetParents = 0; pvObjList[elementpos].countretry = 0; pvObjList[elementpos].lasttxduration = 0; pvObjList[elementpos].isBroadcastMulticast = 0; if (numAvailableElements > 0) numAvailableElements--; ret = true; } //LeaveCriticalSection ENABLE_INTERRUPTS(); return ret;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:33,
示例22: idmanager_setMyIDowerror_t idmanager_setMyID(open_addr_t* newID) { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); switch (newID->type) { case ADDR_16B: memcpy(&idmanager_vars.my16bID,newID,sizeof(open_addr_t)); break; case ADDR_64B: memcpy(&idmanager_vars.my64bID,newID,sizeof(open_addr_t)); break; case ADDR_PANID: memcpy(&idmanager_vars.myPANID,newID,sizeof(open_addr_t)); break; case ADDR_PREFIX: memcpy(&idmanager_vars.myPrefix,newID,sizeof(open_addr_t)); break; case ADDR_128B: //don't set 128b, but rather prefix and 64b default: openserial_printCritical(COMPONENT_IDMANAGER,ERR_WRONG_ADDR_TYPE, (errorparameter_t)newID->type, (errorparameter_t)1); ENABLE_INTERRUPTS(); return E_FAIL; } ENABLE_INTERRUPTS(); return E_SUCCESS;}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:28,
示例23: new/**/brief Request a new (free) packet buffer.Component throughout the protocol stack can call this function is they want toget a new packet buffer to start creating a new packet./note Once a packet has been allocated, it is up to the creator of the packet to free it using the openqueue_freePacketBuffer() function./returns A pointer to the queue entry when it could be allocated, or NULL when it could not be allocated (buffer full or not synchronized).*/OpenQueueEntry_t* openqueue_getFreePacketBuffer(uint8_t creator) { uint8_t i; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); // refuse to allocate if we're not in sync if (ieee154e_isSynch()==FALSE && creator > COMPONENT_IEEE802154E){ ENABLE_INTERRUPTS(); return NULL; } // if you get here, I will try to allocate a buffer for you // walk through queue and find free entry for (i=0;i<QUEUELENGTH;i++) { if (openqueue_vars.queue[i].owner==COMPONENT_NULL) { openqueue_vars.queue[i].creator=creator; openqueue_vars.queue[i].owner=COMPONENT_OPENQUEUE; ENABLE_INTERRUPTS(); return &openqueue_vars.queue[i]; } } ENABLE_INTERRUPTS(); return NULL;}
开发者ID:engalex,项目名称:6TiSCH,代码行数:37,
示例24: usl_stack_push/* * Record a usimple_lock just acquired on * the current processor. * * MACH_RT: Preemption has been disabled by lock * acquisition, so it's safe to use the cpu number * specified by the caller. */voidusl_stack_push( usimple_lock_t l, int mycpu){ spl_t s; if (uslock_stack_enabled == FALSE) return; DISABLE_INTERRUPTS(s); assert(uslock_stack_index[mycpu] >= 0); assert(uslock_stack_index[mycpu] < USLOCK_STACK_DEPTH); if (uslock_stack_index[mycpu] >= USLOCK_STACK_DEPTH) { printf("usl_stack_push (cpu 0x%x): too many locks (%d)", mycpu, uslock_stack_index[mycpu]); printf(" disabling stacks/n"); uslock_stack_enabled = FALSE; ENABLE_INTERRUPTS(s); return; } uslock_stack[mycpu][uslock_stack_index[mycpu]] = l; uslock_stack_index[mycpu]++; ENABLE_INTERRUPTS(s);}
开发者ID:rohsaini,项目名称:mkunity,代码行数:33,
示例25: openserial_printDataerror_t openserial_printData(uint8_t* buffer, uint8_t length) { uint8_t counter; uint8_t asn[5]; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.somethingInOutputBuffer=TRUE; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'D'; //this is data openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); //asn to serial .. asnWriteToSerial(asn);// byte01,byte23,byte4 openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[0]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[1]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[2]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[3]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[4]; for (counter=0; counter<length; counter++) { openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)buffer[counter]; } openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; ENABLE_INTERRUPTS(); return E_SUCCESS;}
开发者ID:apullin,项目名称:openwsn-fw,代码行数:31,
示例26: usl_stack_pop/* * Eliminate the entry for a usimple_lock * that had been active on the current processor. * * MACH_RT: Preemption has been disabled by lock * acquisition, and we haven't yet actually * released the hardware lock associated with * this usimple_lock, so it's safe to use the * cpu number supplied by the caller. */voidusl_stack_pop( usimple_lock_t l, int mycpu){ unsigned int i, index; spl_t s; if (uslock_stack_enabled == FALSE) return; DISABLE_INTERRUPTS(s); assert(uslock_stack_index[mycpu] > 0); assert(uslock_stack_index[mycpu] <= USLOCK_STACK_DEPTH); if (uslock_stack_index[mycpu] == 0) { printf("usl_stack_pop (cpu 0x%x): not enough locks (%d)", mycpu, uslock_stack_index[mycpu]); printf(" disabling stacks/n"); uslock_stack_enabled = FALSE; ENABLE_INTERRUPTS(s); return; } index = --uslock_stack_index[mycpu]; for (i = 0; i <= index; ++i) { if (uslock_stack[mycpu][i] == l) { if (i != index) uslock_stack[mycpu][i] = uslock_stack[mycpu][index]; ENABLE_INTERRUPTS(s); return; } } ENABLE_INTERRUPTS(s); panic("usl_stack_pop: can't find usimple_lock 0x%x", l);}
开发者ID:rohsaini,项目名称:mkunity,代码行数:45,
示例27: openqueue_macGetDataPacket OpenQueueEntry_t* openqueue_macGetDataPacket(open_addr_t* toNeighbor) { uint8_t i; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); if (toNeighbor->type==ADDR_64B) { // a neighbor is specified, look for a packet unicast to that neigbhbor for (i=0;i<QUEUELENGTH;i++) { if (openqueue_vars.queue[i].owner==COMPONENT_RES_TO_IEEE802154E && packetfunctions_sameAddress(toNeighbor,&openqueue_vars.queue[i].l2_nextORpreviousHop)) { ENABLE_INTERRUPTS(); return &openqueue_vars.queue[i]; } } } else if (toNeighbor->type==ADDR_ANYCAST) { // anycast case: look for a packet which is either not created by RES // or an KA (created by RES, but not broadcast) for (i=0;i<QUEUELENGTH;i++) { if (openqueue_vars.queue[i].owner==COMPONENT_RES_TO_IEEE802154E && ( openqueue_vars.queue[i].creator!=COMPONENT_RES || ( openqueue_vars.queue[i].creator==COMPONENT_RES && packetfunctions_isBroadcastMulticast(&(openqueue_vars.queue[i].l2_nextORpreviousHop))==FALSE ) ) ) { ENABLE_INTERRUPTS(); return &openqueue_vars.queue[i]; } } } ENABLE_INTERRUPTS(); return NULL;}
开发者ID:Bug-bear,项目名称:g_nf_vs_pdr,代码行数:33,
示例28: openserial_printInfoErrorCriticalowerror_t openserial_printInfoErrorCritical( char severity, uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2 ) { INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.outputBufFilled = TRUE; outputHdlcOpen(); outputHdlcWrite(severity); outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); outputHdlcWrite(calling_component); outputHdlcWrite(error_code); outputHdlcWrite((uint8_t)((arg1 & 0xff00)>>8)); outputHdlcWrite((uint8_t) (arg1 & 0x00ff)); outputHdlcWrite((uint8_t)((arg2 & 0xff00)>>8)); outputHdlcWrite((uint8_t) (arg2 & 0x00ff)); outputHdlcClose(); ENABLE_INTERRUPTS(); return E_SUCCESS;}
开发者ID:renfernand,项目名称:OWSNRIT,代码行数:26,
示例29: schedule_getOkToSend/**/brief Check whether I can send on this slot.This function is called at the beginning of every TX slot.If the slot is *not* a shared slot, it always return TRUE.If the slot is a shared slot, it decrements the backoff counter and returns TRUE only if it hits 0.Note that the backoff counter is global, not per slot./returns TRUE if it is OK to send on this slot, FALSE otherwise. */bool schedule_getOkToSend() { bool returnVal; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); if (schedule_vars.currentScheduleEntry->shared==FALSE) { // non-shared slot: backoff does not apply returnVal = TRUE; } else { // non-shared slot: check backoff before answering // decrement backoff if (schedule_vars.backoff>0) { schedule_vars.backoff--; } // only return TRUE if backoff hit 0 if (schedule_vars.backoff==0) { returnVal = TRUE; } else { returnVal = FALSE; } } ENABLE_INTERRUPTS(); return returnVal;}
开发者ID:giu7ppe,项目名称:openwsn,代码行数:41,
示例30: DISABLE_INTERRUPTS//Wakes the thread with the ID tidvoid CALLING_CONVENTION CX86Scheduler::wakeThread(pid_t tid, size_t count){ if (count == 0) return; bool islocked = false; DISABLE_INTERRUPTS(); //Turn off preemption m_lock.acquireSpinlock(); iterator_t itr = m_blockedList.findValue((PTHREAD)tid); if (!m_blockedList.isEntry(itr)) { m_lock.releaseSpinlock(); ENABLE_INTERRUPTS(); return; } //OK, we found the thread PTHREAD thread = (PTHREAD)tid; if (count > thread->waitcount) thread->waitcount = 0; else thread->waitcount -= count; if (thread->waitcount == 0) { m_blockedList.removeAt(itr); m_runningList.insertToHead(thread); } m_lock.releaseSpinlock(); ENABLE_INTERRUPTS();}
开发者ID:JamesLinus,项目名称:ChaiOS,代码行数:30,
注:本文中的DISABLE_INTERRUPTS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DISABLE_PHRASE函数代码示例 C++ DIRTY函数代码示例 |