当前位置: 首页>>代码示例>>C++>>正文


C++ DISABLE_INTERRUPTS函数代码示例

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


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

示例1: PRIMITIVE_CLOSE

int
PRIMITIVE_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,代码来源:xprim_close.c

示例2: output_buffer_index_write_increment

uint16_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,代码来源:openserial.c

示例3: schedule_advanceSlot

void schedule_advanceSlot() {
   INTERRUPT_DECLARATION();
   DISABLE_INTERRUPTS();
   // advance to next active slot
   schedule_vars.currentScheduleEntry = schedule_vars.currentScheduleEntry->next;
   ENABLE_INTERRUPTS();
}
开发者ID:giu7ppe,项目名称:openwsn,代码行数:7,代码来源:schedule.c

示例4: StartApplication

void 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,代码来源:portBooter.cpp

示例5: openserial_printError

error_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,代码来源:openserial.c

示例6: RITQueue_Get_Element

sRITqueue 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,代码来源:openqueue.c

示例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,代码来源:openqueue.c

示例8: drvSysTick_getUptime

int 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,代码来源:drvSysTick.c

示例9: uart0_in

int 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,代码来源:uart.c

示例10: Gyro_Calculation

void 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,代码来源:Gyro.c

示例11: Gyro_GetTotalAngle

inline 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,代码来源:Gyro.c

示例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,代码来源:schedule.c

示例13: GM_Level

void 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,代码来源:level.cpp

示例14: hal_aci_tl_send

bool 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,代码来源:hal_aci_tl.cpp

示例15: openserial_printData

owerror_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,代码来源:openserial.c


注:本文中的DISABLE_INTERRUPTS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。