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


C++ DisableInterrupts函数代码示例

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


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

示例1: main

int main (void)
{
	// TODO: implement all destructors used in CKernel, otherwise cannot return from main()

	CKernel Kernel;
	if (!Kernel.Initialize ())
	{
		DisableInterrupts ();
		for (;;);
		return EXIT_HALT;
	}
	
	TShutdownMode ShutdownMode = Kernel.Run ();

	switch (ShutdownMode)
	{
	case ShutdownReboot:
		reboot ();
		return EXIT_REBOOT;

	case ShutdownHalt:
	default:
		DisableInterrupts ();
		for (;;);
		return EXIT_HALT;
	}
}
开发者ID:tufty,项目名称:circle,代码行数:27,代码来源:main.cpp

示例2: OS_Wait

// ******** OS_Wait ************
// decrement semaphore and spin/block if less than zero
// input:  pointer to a counting semaphore
// output: none
void OS_Wait(Sema4Type *s){
	DisableInterrupts();
	while( s->Value <= 0){
		//TODO: implement Blocking
		EnableInterrupts();
		DisableInterrupts();
	}
	s->Value--;
	EnableInterrupts();
}
开发者ID:AustinBlackstone,项目名称:EE345M-S2012,代码行数:14,代码来源:os.c

示例3: OS_bWait

// ******** OS_bWait ************
// if the semaphore is 0 then spin/block
// if the semaphore is 1, then clear semaphore to 0
// input:  pointer to a binary semaphore
// output: none
void OS_bWait(Sema4Type *semaPt){
	DisableInterrupts();
	while( semaPt->Value  != 1){
		//TODO: implement Blocking
		EnableInterrupts();
		OS_Suspend();
		DisableInterrupts();
	}
	semaPt->Value =0;
	EnableInterrupts();

return;
}
开发者ID:AustinBlackstone,项目名称:EE345M-S2012,代码行数:18,代码来源:os.c

示例4: OS_bWait

// ------------------------- OS_bWait --------------------------------
void OS_bWait(Sema4Type *semaPt){
  DisableInterrupts();
	
	while (semaPt->Value <= 0){
		unlinkTCB(&Actives, RunPt);
		linkTCB(&(semaPt->Blocked), RunPt);
		RunPt->blockSt = semaPt;
		OS_Suspend();
		EnableInterrupts();
	}
	DisableInterrupts();
	(*semaPt).Value = 0;
	EnableInterrupts();
}
开发者ID:c0lin91,项目名称:EE445M,代码行数:15,代码来源:OS.c

示例5: DisableInterrupts

static VoiceNode *GUSWAVE_GetVoice
   (
   int handle
   )

   {
   VoiceNode *voice;
   unsigned  flags;

   flags = DisableInterrupts();

   voice = VoiceList.start;

   while( voice != NULL )
      {
      if ( handle == voice->handle )
         {
         break;
         }

      voice = voice->next;
      }

   RestoreInterrupts( flags );

   if ( voice == NULL )
      {
      GUSWAVE_SetErrorCode( GUSWAVE_VoiceNotFound );
      }

   return( voice );
   }
开发者ID:Rockbox,项目名称:rockbox,代码行数:32,代码来源:guswave.c

示例6: OS_SysTick_Handler

// ******** OS_SysTick_Handler ************
// Thread Switcher, uses SysTick as periodic timer, calls PendSV to actually switch threads
// Implement Thread Manager implicitly here 
// input: none, uses globals RUNPT and NEXTRUNPT 
// output: none, should switch threads when finished
void OS_SysTick_Handler(void){
	tcbType *i, *j;
	int pri;
	int x;
  
  	DisableInterrupts();
    
	//Thread Scheduler
	if(RRSCHEDULER){
	//ROUND ROBBIN SCHEDULER
		for(i=RUNPT->next; i->sleep>0 || i->blockedOn!=0; i=i->next){
			//OLD SLEEP DECRIMENTER
			//if(i->sleep>0){//decriment sleep counter
			//	i->sleep=i->sleep-1;
			//}
		}
		NEXTRUNPT=i;
	}else if(PRIORITYSCHEDULER){
	//PRIORITY SCHEDULER
		pri=7;
		j=RUNPT->next;
		x=0;
		do{
			x++;
			//find thread with highest priority that isnt sleeping or blocked
			if(j->blockedOn==NULL && j->sleep==0 && j->workingPriority<pri){
				pri=j->workingPriority;
				i=j;	
			}
		
			j=j->next;
		//}while(j!=RUNPT->next);
		}while(x<NUMTHREADS);


	/* 	//Priority Scheduler, failed for case where lowest thread got blocked.
		for(i=RUNPT->next,pri=RUNPT->workingPriority,x=0; i->sleep>0 || i->blockedOn!=NULL || (i->workingPriority > pri); i=i->next, x++){ //Possible ERROR HERE, needs rethought //search for next thread untill you find one that is not sleeping, not blocked, and has a priority equal or less than the current RUNPT
			if(x>=NUMTHREADS && pri<7){
				x=0;
				pri++;
			}
		}
	*/
			//OLD SLEEP DECRIMENTER
			//if(i->sleep>0){//decriment sleep counter
			//	i->sleep=i->sleep-1;
			//}

		NEXTRUNPT=i;
		RUNPT->lastRun=OS_Time();
		RUNPT->workingPriority = RUNPT->realPriority;		
	
	}
	  
  	EnableInterrupts();
  
	//Switch Threads (trigger PendSV)
	NVIC_INT_CTRL_R = 0x10000000;
	//PendSV_Handler();
}
开发者ID:AustinBlackstone,项目名称:EE345M-S2012,代码行数:65,代码来源:os.c

示例7: shutdown

/*
 * This routine will shutdown a serial port; interrupts are disabled, and
 * DTR is dropped if the hangup on close termio flag is on.
 */
static void shutdown(struct xmb_serial * info)
{
	volatile unsigned int *uartp;
	unsigned long		flags;

	if (!(info->flags & ASYNC_INITIALIZED))
		return;

#ifdef SERIAL_DEBUG_OPEN
	printk("Shutting down serial port %d (irq %d)....\n", info->line,
	       info->irq);
#endif
	
	uartp = (volatile unsigned int *) info->addr;
	save_flags_cli(flags); 		/* Disable interrupts */

	/* Disable interrupts and clear RX FIFO */
	DisableInterrupts(uartp);
	Reset_RX_FIFO(uartp);

	if (info->xmit_buf) {
		free_page((unsigned long) info->xmit_buf);
		info->xmit_buf = 0;
	}

	if (info->tty)
		set_bit(TTY_IO_ERROR, &info->tty->flags);
	
	info->flags &= ~ASYNC_INITIALIZED;
	restore_flags(flags);
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:35,代码来源:xmbserial.c

示例8: xmbrs_irqinit

/*
 *	Based on the line number set up the internal interrupt stuff.
 */
static void xmbrs_irqinit(struct xmb_serial *info)
{
	volatile unsigned int *uartp;

	switch (info->line) {
	case 0:
	case 1:
		break;
	default:
		printk("SERIAL: don't know how to handle UART %d interrupt?\n",
			info->line);
		return;
	}

	uartp = (volatile unsigned int *) info->addr;

	/* Clear mask, so no surprise interrupts. */
	DisableInterrupts(uartp);

	if (request_irq(info->irq, xmbrs_interrupt, SA_INTERRUPT,
	    "Microblaze UARTlite", NULL)) {
		printk("SERIAL: Unable to attach Xilinx UARTlite %d interrupt "
			"vector=%d\n", info->line, info->irq);
	}
	
	/* Populate the fast IRQ lookup table */
	irq_lookup[info->irq] = info;

	/* UART still can't generate interrupts - leave it this way
	   until it is actually opened */

	return;
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:36,代码来源:xmbserial.c

示例9: EXTI0_IRQHandler

void EXTI0_IRQHandler(void)
{
   DisableInterrupts(); 
   PressButtom = TRUE;
   EXTI_ClearITPendingBit(EXTI_Line0);
   EnableInterrupts();
}
开发者ID:bzdegluk,项目名称:ACQ,代码行数:7,代码来源:DZ-SBD-MB01.c

示例10: main

int main(void){
	DisableInterrupts();
  TExaS_Init(SSI0_Real_Nokia5110_Scope);  // set system clock to 80 MHz
	Random_Init(1);
  Nokia5110_Init();
	PF1Init();
  //SysTick_Init(2666666); //Initialize SysTick with 30 Hz interrupts
	SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
  Nokia5110_ClearBuffer();
	Nokia5110_DisplayBuffer();      // draw buffer
	ADC0_Init();
	Game_Init();
	SwitchLed_Init();
	Sound_Init();
	Timer2_Init(&Sound_Play,7256); //11.025 kHz. 80,000,000/11,025 cycles, which is about 7256
	GameOverFlag = 0;
	EnableInterrupts();
	
  while(1){
		while(Semaphore==0){};
    Semaphore = 0;
		if(GameOverFlag){
			State_GameOver();
		}
		else{
			Draw_GameFrame(); // update the LCD
		}	
		if((GameOverFlag == 0) && (Check_GameOver())){ //just detected game over
			Delay100ms(2);//Delay 200ms
			GameOverFlag = Check_GameOver();
			//SysTick_Init(2666666);//Re-initialize with 30 Hz interrupt
			SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
		}
	}
}
开发者ID:AbdallahNasser,项目名称:Space_Invaders_TivaC,代码行数:35,代码来源:SpaceInvaders.c

示例11: prvSetupTimerInterrupt

/*
 * Setup the timer 0 to generate the tick interrupts at the required frequency.
 */
static void prvSetupTimerInterrupt( void )
{
	uint32_t ulCompareMatch;
	

	/* Calculate the match value required for our wanted tick rate. */
	ulCompareMatch = 1000000 / configTICK_RATE_HZ;

	/* Protect against divide by zero.  Using an if() statement still results
	in a warning - hence the #if. */
	#if portPRESCALE_VALUE != 0
	{
		ulCompareMatch /= ( portPRESCALE_VALUE + 1 );
	}
	#endif

	DisableInterrupts();

	pRegs->CTL = 0x003E0000;
	pRegs->LOD = ulCompareMatch;
	pRegs->RLD = ulCompareMatch;
	pRegs->DIV = portTIMER_PRESCALE;
	pRegs->CLI = 0;
	pRegs->CTL = 0x003E00A2;

	RegisterInterrupt(64, vTickISR, NULL);

	EnableInterrupt(64);

	EnableInterrupts();
}
开发者ID:Giraudux,项目名称:FreeRTOS-EDF,代码行数:34,代码来源:port.c

示例12: MHD_Bridge_detect

byte MHD_Bridge_detect(void)
{
    byte temp = 0;
    byte BridgeOn = 0;
    DisableInterrupts();
    msleep(180);
    if(!gpio_get_value(GPIO_ACCESSORY_INT)&& MHD_HW_IsOn())
    {
        temp = ReadIndexedRegister(INDEXED_PAGE_0, 0x09);
        if ((temp & RSEN) == 0x00)
        {
            BridgeOn = FALSE;
            //ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4); //force HPD to 0
            ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4);
        }
        else
        {
            BridgeOn = TRUE;
            //ReadModifyWriteTPI(0x79, BIT_5 | BIT_4, 0); //back to current state
        }
        printk("[MHD] Bridge detect %x :: HPD %d\n",BridgeOn,gpio_get_value(GPIO_HDMI_HPD));
        //ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, 0); //back to current state
        ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, 0);
    }
    MHD_INT_clear();
    EnableInterrupts();
    printk("[MHD]MHD_Bridge_detect -- \n");
    return BridgeOn;
}
开发者ID:humcycles,项目名称:galaxy-tab-modified,代码行数:29,代码来源:MHD_SiI9234.c

示例13: GetAllEvents

// gets all events
EventMaskType GetAllEvents()
{
  DisableInterrupts();
  EventMaskType tmpevents = eventmemory;
  EnableInterrupts();
  return tmpevents;
}
开发者ID:PhilmacFLy,项目名称:ti-chronos-foo,代码行数:8,代码来源:event.c

示例14: GetEvent

// gets all events which are set in "eventmask" and returns them
EventMaskType GetEvent(EventMaskType eventmask)
{
  DisableInterrupts();
  EventMaskType tmpevents = eventmask & eventmemory;
  EnableInterrupts();
  return tmpevents;
}
开发者ID:PhilmacFLy,项目名称:ti-chronos-foo,代码行数:8,代码来源:event.c

示例15: Touch_BeginWaitForTouch

void Touch_BeginWaitForTouch(void){
    // XP = 1  XN = DIG IN, INT ON FALL EDGE YP = Hi-Z YN = 0
    DisableInterrupts();
    
    // Set XP high
    TOUCH_XP = 0xFF;
    
    // Set YN low
    TOUCH_YN = 0x00;
    
    // Configure XN (PA3) for digital input
    GPIO_PORTA_DIR_R &= ~0x08;
    
    // Configure YP (PE5) for analog Hi-Z
    GPIO_PORTE_DIR_R &= ~0x20;
    GPIO_PORTE_DEN_R &= ~0x20;
   
    // Setup falling edge interrupt on XN (PA3)
    GPIO_PORTA_PUR_R |=  0x08;   // enable weak pull up
    GPIO_PORTA_IS_R  &= ~0x08;     // (d) PF4 is edge-sensitive
    GPIO_PORTA_IBE_R &= ~0x08;    //     PF4 is not both edges
    GPIO_PORTA_IEV_R &= ~0x08;    //     PF4 falling edge event
    GPIO_PORTA_ICR_R  =  0x08;      // (e) clear flag4
    GPIO_PORTA_IM_R  |=  0x08;      // (f) arm interrupt on PF4


    NVIC_PRI0_R = (NVIC_PRI7_R&0xFFFFFF00)|0x000000a0;
    NVIC_EN0_R = NVIC_EN0_INT0;  // (h) enable interrupt 30 in NVIC


    EnableInterrupts();
}
开发者ID:c0lin91,项目名称:EE445M,代码行数:32,代码来源:adc.c


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