Пример #1
0
/*
*********************************************************************************************************
*                                Rx/Tx Communication handler for uC/OS-View
*
* Description: This function is  called in stm32f10x_it.c 
*********************************************************************************************************
*/ 
void  OSView_RxTxISRHandler (void)
{
    CPU_SR          cpu_sr;

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


    if (USART_GetITStatus(OS_VIEW_USART, USART_IT_RXNE) != RESET) {
                      /* Read one byte from the receive data register         */
        OSView_RxHandler( USART_ReceiveData(OS_VIEW_USART) & 0xFF );

        USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_RXNE);          /* Clear the USART Receive interrupt                   */

    }

    if (USART_GetITStatus(OS_VIEW_USART, USART_IT_TXE) != RESET) {
        OSView_TxHandler();

        USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_TXE);           /* Clear the USART transmit interrupt                  */

    }

    OSIntExit();                                                /* Tell uC/OS-II that we are leaving the ISR            */
}
Пример #2
0
static void  OSView_RxTxISRHandler (void)
{

    USART_TypeDef  *usart;
    CPU_INT08U      rx_data;
    CPU_SR          cpu_sr;


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


#if   (OS_VIEW_COMM_SEL == OS_VIEW_UART_1)
    usart = USART1;
#elif (OS_VIEW_COMM_SEL == OS_VIEW_UART_2)
    usart = USART2;
#elif (OS_VIEW_COMM_SEL == OS_VIEW_UART_3)
    usart = USART3;
#else
    OSIntExit();
    return;
#endif

    if (USART_GetITStatus(usart, USART_IT_RXNE) != RESET) 
	{
        rx_data = USART_ReceiveData(usart) & 0xFF;              /* Read one byte from the receive data register         */
        USART_SendData( USART1, rx_data);
        ////////////////////////////////////////////
        #if 1        
        if(com_app.com_cnt == 10) {
            com_app.buf_ok  =com_app.buf_ok | (1<<com_buf_cnt);
            com_buf_cnt++;
            if(com_buf_cnt == 3)  com_buf_cnt = 0;
            com_app.com_cnt = 0;                
        }
       
        sprintf(com_rev_tmp,"%x",rx_data);
        strcat(com_app.app_buf[com_buf_cnt], com_rev_tmp);
    
        
        com_app.com_cnt ++;
        #endif
        ////////////////////////////////////////////
        OSView_RxHandler(rx_data);

        USART_ClearITPendingBit(usart, USART_IT_RXNE);          /* Clear the USART1 Receive interrupt                   */
    }

    if (USART_GetITStatus(usart, USART_IT_TXE) != RESET) 
	{
        OSView_TxHandler();

        USART_ClearITPendingBit(usart, USART_IT_TXE);           /* Clear the USART1 transmit interrupt                  */
    }

    OSIntExit();                                                /* Tell uC/OS-II that we are leaving the ISR            */
}
Пример #3
0
static void  OSView_RxTxISRHandler (void)
{

    USART_TypeDef  *usart;
    CPU_INT08U      rx_data;
    CPU_SR          cpu_sr;


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


#if   (OS_VIEW_COMM_SEL == OS_VIEW_UART_1)
    usart = USART1;
#elif (OS_VIEW_COMM_SEL == OS_VIEW_UART_2)
    usart = USART2;
#elif (OS_VIEW_COMM_SEL == OS_VIEW_UART_3)
    usart = USART3;
#else
    OSIntExit();
    return;
#endif

    if (USART_GetITStatus(usart, USART_IT_RXNE) != RESET) 
	{
        rx_data = USART_ReceiveData(usart) & 0xFF;              /* Read one byte from the receive data register         */
        
        //////////////////hepeng//////////////////////////
        #if (GPRS_SEND_MODULE == DEF_ENABLED)
        USART_SendData( USART1, rx_data);
        //data_analysis(rx_data);
        #endif
        ////////////////////////////////////////////
        
        OSView_RxHandler(rx_data);

        USART_ClearITPendingBit(usart, USART_IT_RXNE);          /* Clear the USART1 Receive interrupt                   */
    }

    if (USART_GetITStatus(usart, USART_IT_TXE) != RESET) 
	{
        OSView_TxHandler();

        USART_ClearITPendingBit(usart, USART_IT_TXE);           /* Clear the USART1 transmit interrupt                  */
    }

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