Esempio n. 1
0
/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */
void SysTick_Handler(void)
{
    OS_CPU_SR  cpu_sr;


    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();                                /* Call uC/OS-II's OSTimeTick()                       */

    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */

}
Esempio n. 2
0
void EXTI15_10_IRQHandler(void)
{ 
  	uint32_t Dout;
	OS_ERR 	err;
	OSIntEnter();
  	EXTI->PR &= EXTI_Line13;
//	EXTI->IMR &= ~EXTI_Line13;

	/*1---------------------------------------------*/
	/*ADS1255-1读数*/
	Dout = ads1255_rdata();	
	printf("v=%x v=%f\r\n", Dout, (Dout*5.0/8388606.0));
  	OSIntExit();	
}
void SysTick_Handler(void)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0;
#endif

    OS_ENTER_CRITICAL();  /* Tell uC/OS-II that we are starting an ISR */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();  /* Call uC/OS-II's OSTimeTick() */

    OSIntExit();  /* Tell uC/OS-II that we are leaving the ISR */	
}
Esempio n. 4
0
void  OS_CPU_SysTickHandler (void)
{
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();                                /* Call uC/OS-II's OSTimeTick()                       */

    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */
}
Esempio n. 5
0
/*******************************************************************************
* Function Name  : EXTI15_10_IRQHandler
* Description    : This function handles External lines 15 to 10 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI15_10_IRQHandler(void)
{
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

//    key_isr();
    
    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */
}
Esempio n. 6
0
void SDIO_IRQHandler(void)
{
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

 //   SD_ProcessIRQSrc();
  
    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */
}
Esempio n. 7
0
//*****************************************************************************
//
// The interrupt handler for the SysTick interrupt.
//
//*****************************************************************************
void
SysTickIntHandler(void)
{
    OS_ENTER_CRITICAL();
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();
    OSIntExit();

    //
    // Call the SoftI2C tick function.
    //
    //SoftI2CTimerTick(&g_sI2C);
}
Esempio n. 8
0
File: bsp.c Progetto: alisonjoe/qpc
void EXTI0_IRQHandler(void) {
#if OS_CRITICAL_METHOD == 3u  /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr = 0u;
#endif

    OS_ENTER_CRITICAL();
    OSIntEnter();  /* Tell uC/OS-II that we are starting an ISR */
    OS_EXIT_CRITICAL();

    /* perform the application work... */
    QACTIVE_POST(AO_Table, Q_NEW(QEvt, MAX_SIG), /* for testing... */
                 &l_EXTI0_IRQHandler);

    OSIntExit();   /* Tell uC/OS-II that we are leaving the ISR */
}
Esempio n. 9
0
void uart2Isr ( void )
{
#if OS_CRITICAL_METHOD ==3
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();
    //OSIntNesting++;
    OSIntEnter();
    OS_EXIT_CRITICAL();

    commBaseIsr ( 2 );

    OSIntExit();
 }
Esempio n. 10
0
/*******************************************************************************
*函数名:
  **isr
*功能:各中断跳转,方便代码部分升级
*输入:
*输出:
*说明:
*******************************************************************************/
void sysTickIsr ( void )
{
    #if OS_CRITICAL_METHOD ==3
    OS_CPU_SR  cpu_sr;
    #endif

    OS_ENTER_CRITICAL();
   // OSIntNesting++;
    OSIntEnter();
    OS_EXIT_CRITICAL();

    OSTimeTick();                        // Call uC/OS-II's OSTimeTick()  调用uC/OS-II的OSTimeTick()函数

    OSIntExit();
}
Esempio n. 11
0
//外部中断4处理函数
void EXTI4_IRQHandler(void)
{
    OSIntEnter();
    if(EXTI_GetITStatus(EXTI_Line4) != RESET)
    {
        PTO_Stop();
        PulseNum_Global = 0; 
        if(HomeFlag == 0)
        {           
            HomeFlag = 1;
        }    
        EXTI_ClearITPendingBit(EXTI_Line4);
    }
	OSIntExit();
}
Esempio n. 12
0
void USART1_IRQHandler(void)                	//串口1中断服务程序
{
		
#if SYSTEM_SUPPORT_OS 		//如果SYSTEM_SUPPORT_OS为真,则需要支持OS.
	OSIntEnter();    
#endif
	if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)  //接收中断(接收到的数据必须是0x0d 0x0a结尾)
		{	
			
			USART_ClearITPendingBit(USART1, USART_IT_RXNE);
		}
#if SYSTEM_SUPPORT_OS 	//如果SYSTEM_SUPPORT_OS为真,则需要支持OS.
	OSIntExit();  											 
#endif
}
Esempio n. 13
0
/*********************************************************************************************************
*                                          SYS TICK HANDLER
*
* Description: Handle the system tick (SysTick) interrupt, which is used to generate the myos tick
*              interrupt.
*
* Arguments  : none.
*
* Note(s)    : 1) This function MUST be placed on entry 15 of the Cortex-M3 vector table.
*********************************************************************************************************
*/
void  SysTick_Handler (void)
{
    OS_CPU_SR  cpu_sr;

	cpu_sr++;

    OS_ENTER_CRITICAL();                         /* Tell myos that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();
	Decrement_TimingDelay();
//
    OSTimeTick();                                /* Call myos OSTimeTick()                       */
//
    OSIntExit();                                 /* Tell myos that we are leaving the ISR,在其中实现任务切换          */
}
Esempio n. 14
0
void USART3_IRQHandler(void)
{
	/* Handle the Interrupt … don’t forget to clear the interrupt source */

	/* Check the flag that shows the reason of interrupt */
	if (USART_GetITStatus( USART3, USART_IT_RXNE ) == SET)
	{
		/* Clear the interrupt pending bit */
		USART_ClearITPendingBit( USART3, USART_IT_RXNE );

		/* Read data */
		uint16_t usartData = USART_ReceiveData( USART3 );
	}
	OSIntExit(); /* Tell uC/OS-II that we are leaving the ISR */
}
Esempio n. 15
0
void FTM2_IRQHandler(void)
{
#if (UCOS_II > 0u)
    OS_CPU_SR  cpu_sr = 0u;
    OS_ENTER_CRITICAL(); //告知系统此时已经进入了中断服务子函数
    OSIntEnter();
    OS_EXIT_CRITICAL();
#endif

    FTM_ISR[2]();

#if (UCOS_II > 0u)
    OSIntExit();          //告知系统此时即将离开中断服务子函数
#endif
}
Esempio n. 16
0
/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */
void SysTick_Handler(void)
{
	OS_CPU_SR  cpu_sr;
  
	HAL_IncTick();
  if(OSRunning > 0u)						/*系统运行之后在开始调度*/					
  {
		OS_ENTER_CRITICAL();          /* Tell uC/OS-II that we are starting an ISR            */
		OSIntEnter();
		OS_EXIT_CRITICAL();
		
		OSTimeTick();                 /* Call uC/OS-II's OSTimeTick()                         */
		OSIntExit();
  }
}
Esempio n. 17
0
static void AFE_DFT_Callback(void *pCBParam, uint32_t Event, void *pArg) {
  OSIntEnter();
  
  if (pADI_AFE->AFE_DFT_RESULT_REAL != pADI_AFE->AFE_DFT_RESULT_REAL & 0xFF  
    || pADI_AFE->AFE_DFT_RESULT_IMAG != pADI_AFE->AFE_DFT_RESULT_IMAG & 0xFF) {
    FAIL("lost data");
  }

  pend_dft_results.parts.magnitude = pADI_AFE->AFE_DFT_RESULT_REAL;
  pend_dft_results.parts.phase = pADI_AFE->AFE_DFT_RESULT_IMAG;
  if (OS_ERR_NONE != OSQPost(dft_queue, pend_dft_results.pointer)) {
    FAIL("AFE_DFT_Callback: OSQPost");
  }

  OSIntExit();
}
__irq void SysTickHandler(void)
{
    OS_CPU_SR  cpu_sr;
	
    if (OSRunning == OS_TRUE) {
        if (OSIntNesting < 255u) {
            OS_ENTER_CRITICAL();  //保存全局中断标志,关总中断/* Tell uC/OS-II that we are starting an ISR*/
            OSIntNesting++;
            OS_EXIT_CRITICAL();   //恢复全局中断标志                    /* Increment ISR nesting level                        */
        }
    }

    OSTimeTick();      /* Call uC/OS-II's OSTimeTick(),在os_core.c文件里定义,主要判断延时的任务是否计时到*/

    OSIntExit();  //在os_core.c文件里定义,如果有更高优先级的任务就绪了,则执行一次任务切换             
}
Esempio n. 19
0
/**
  * @brief  This function handles USART3 interrupt request.
  * @param  None
  * @retval None
  */
void USART3_IRQHandler(void)
{
	uint16_t	State = USART3->SR;
	uint16_t	RxData = USART3->DR;

	OSIntEnter();
	if( State & USART_SR_RXNE ){

		if(GetUART1ConnectWith()==USART3){
			USART_SendData(USART1,RxData);
		}else{
			fpost(&file_usart3,RxData);
		}
	}
	OSIntExit();
}
Esempio n. 20
0
/*******************************************************************************
 * Function Name  : USART0_IRQHandler
 * Description    : This function handles USART0 global interrupt request.
 * Input          : None
 * Output         : None
 * Return         : None
 *******************************************************************************/
void USART0_IRQHandler(void)
{
//	rt_interrupt_enter();
//	//溢出错误
//	if (USART_GetFlagStatus(USART2, USART_FLAG_ORE) == SET)
//	{
//		prvvUARTRxISR();
//	}
//	//接收中断
//	if (USART_GetITStatus(USART2, USART_IT_RXNE) == SET)
//	{
//		USART_ClearITPendingBit(USART2, USART_IT_RXNE);
//		prvvUARTRxISR();
//	}
//	//发送中断
//	if (USART_GetITStatus(USART2, USART_IT_TXE) == SET)
//	{
//		prvvUARTTxReadyISR();
//	}
//	rt_interrupt_leave();
	
	uint32_t intsrc;
	uint8_t lineStatus;
	
	OSIntEnter();																		/****通知os进入中断*/
	
	intsrc=UART_GetIntId(UART_0);
	if((intsrc&0x0f)==UART_IIR_INTID_RLS)						/****接收线中断****/
	{
		//2.1 检查线状态
		lineStatus = UART_GetLineStatus(UART_0);//读取LSR时中断会被清除
		prvvUARTRxISR(RS485_1);
					
	}
	/****接收数据或者超时中断****/
	else if (((intsrc&0x0f) == UART_IIR_INTID_RDA) || ((intsrc&0x0f) == UART_IIR_INTID_CTI))
	{
		prvvUARTRxISR(RS485_1);
	}
	/******发送中断*************/
	else if((intsrc&0x0f) == UART_IIR_INTID_THRE)
	{	
		prvvUARTTxReadyISR(RS485_1);
	}
	OSIntExit();											/*****通知os退出中断******/
	
}
Esempio n. 21
0
void USART2_IRQHandler(void)
{ 
  OS_ERR 	err;
  OSIntEnter();
  if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
  {
    /* Read one byte from the receive data register */
    /*使能串口2的发送和接收中断*/
    RxBuffer2[RxCounter2++] = USART_ReceiveData(USART2);
	USART_ClearITPendingBit(USART2, USART_IT_RXNE);
	if (RxBuffer2[RxCounter2-1]=='$')
	{
	   RxCounter = 0;
	}
	if (RxCounter<6) 
	{
	  RxBuffer[RxCounter++] =RxBuffer2[RxCounter2-1];
	}
    if (RxCounter2 == NbrOfDataToRead2)
    {
	    RxCounter2 = NbrOfDataToRead2;
		RxCounter = 0;
     	USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);
		OSTaskSemPost((OS_TCB *)&task2TCB,        //这个是向系统软件定时任务//发送信号     
                      (OS_OPT  ) OS_OPT_POST_NONE,
                      (OS_ERR *)&err);
    } else
	if (RxBuffer2[RxCounter2-2]=='\r' && RxBuffer2[RxCounter2-1]=='\n')
	{
	    if ( RxBuffer[0]=='$' && RxBuffer[1]=='G' && RxBuffer[2]=='P'  
		     && RxBuffer[3]=='R' && RxBuffer[4]=='M'  && RxBuffer[5]=='C')
		{
			RxCounter = 0;
			RxCounter2 = NbrOfDataToRead2;
	     	USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);
			OSTaskSemPost((OS_TCB *)&task2TCB,        //这个是向系统软件定时任务//发送信号     
                      (OS_OPT  ) OS_OPT_POST_NONE,
                      (OS_ERR *)&err);
		}  else
		{
		  	RxCounter = 0;
		}
	  
	}
  } 
  OSIntExit();
}
Esempio n. 22
0
/*------------------------------------------激励脉冲-----------------------------------------------*/
void TIM3_IRQHandler(void)
{
	//ucoiii里面进入硬件中断服务函数需要以下函数
	OSIntEnter();//进入中断
	if(TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET)
	{
		PulseNumFlag++;
		if(PulseNumFlag == PulseNUM)
		{
			PulseNumFlag = 0;
			PulseNUM = 0;
			TIM_Cmd(TIM3,DISABLE);//达到脉冲个数之后就关闭定时器,停止发射
		}
		TIM_ClearITPendingBit(TIM3, TIM_IT_Update);
	}
	OSIntExit();//退出中断--ucosiii
}
Esempio n. 23
0
/* 串口1中断 */
void USART1_IRQHandler(void)
{
    OSIntEnter();
    if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
    {
        RxBuffer1[RxCounter1++] = USART_ReceiveData(USART1);
        if(RxCounter1 == 10)
        {
            /* Disable the USARTy Receive interrupt */
            USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
            RxCounter1=0;
            OSSemPost(A8_SEM);
        }
    }

    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
    OSIntExit();
}
Esempio n. 24
0
/**
 ******************************************************************************
 * @brief      intHandler -   根据传入的中断号找到并调用相应的ISR
 * @param[in]  id : 中断号
 * @param[out] None
 * @retval     None
 *
 * @details
 *
 * @note
 ******************************************************************************
 */
static void
intHandler(uint32_t int_num)
{
    INT_RTN int_rtn = intRtnTbl[int_num - 16];

    OSIntEnter();

    if ((uint32_t)NULL != int_rtn.parameter)
    {
        int_rtn.routine(int_rtn.parameter);
    }
    else
    {
        int_rtn.routine();
    }

    OSIntExit();
}
Esempio n. 25
0
void PIT3_IRQHandler(void)
{
#if (UCOS_II > 0u)
  OS_CPU_SR  cpu_sr = 0u;
  OS_ENTER_CRITICAL(); //告知系统此时已经进入了中断服务子函数
  OSIntEnter();
  OS_EXIT_CRITICAL();
#endif
  
  //调用用户自定义中断服务
  PIT_ISR[3]();  
  //清除中断标志位
  PIT->CHANNEL[3].TFLG |= PIT_TFLG_TIF_MASK;
  
#if (UCOS_II > 0u)
  OSIntExit();          //告知系统此时即将离开中断服务子函数
#endif
}
Esempio n. 26
0
/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */
void SysTick_Handler(void)					  /*系统SysTick中断处理函数,系统心脏*/
{	
	static INT8U i;

	OSIntEnter();
	OSTime++;
	for(i=0; i<OS_TASK_MAX; i++)
	{
		if(TCB[i].OSTCBDly)
		{
			TCB[i].OSTCBDly--;
			if(TCB[i].OSTCBDly==0)
			{
				OSSetPrioRdy(i); 
			}
		}
	}
	OSIntExit();
}
Esempio n. 27
0
void SysTickISR (void)
{
#if APP_OS_EN > 0
    
#if OS_CRITICAL_METHOD == 3u
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR               */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();                                /* Call uC/OS-II's OSTimeTick()                            */

    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR               */
#else
    SysTickTimimg();
#endif  
}
Esempio n. 28
0
/*******************************************************************************
* Function Name  : USART3_IRQHandler
* Description    : This function handles USART3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART3_IRQHandler(void)
{
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr;
#endif

    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

	if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) {
//		uart3_rx_isr();
		}
	if(USART_GetITStatus(USART3, USART_IT_TXE) != RESET) {
//		uart3_tx_isr();
		}

    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */
}
Esempio n. 29
0
void USART2_IRQHandler(void)
{
	u8 res;	
#ifdef OS_CRITICAL_METHOD 	//如果OS_CRITICAL_METHOD定义了,说明使用ucosII了.
	OSIntEnter();    
#endif
	if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) //接收到数据
	{	 
		res =USART_ReceiveData(USART2);//(USART1->DR);	//读取接收到的数据
		USART_RX_BUF[0]=res;
		if (USART_RX_BUF[0] & 0X04)
	    {
		    USART_RX_STA = 1;
		}		 									     
	}
#ifdef OS_CRITICAL_METHOD 	//如果OS_CRITICAL_METHOD定义了,说明使用ucosII了.
	OSIntExit();  											 
#endif
} 
Esempio n. 30
0
/**
  * @brief  This function handles UART5 interrupt request.
  * @param  None
  * @retval None
  */
void UART5_IRQHandler(void)
{
	uint16_t	State = UART5->SR;
	uint16_t	RxData = UART5->DR;

	OSIntEnter();
	if( State & USART_SR_RXNE ){

		if(GetUART1ConnectWith()==UART5){
			USART_SendData(USART1,RxData);
		}else{
			if(file_uart5.isPending){
				file_uart5.isPending = false;
				OSSemPost(file_UART5.semaphore);
			}
		}
	}
	OSIntExit();
}