示例#1
0
/* Function required in order to link UARTCommandConsole.c - which is used by
multiple different demo application. */
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
    ( void ) ulWantedBaud;
    ( void ) uxQueueLength;

    /* Characters received from the UART are stored in this queue, ready to be
    received by the application.  ***NOTE*** Using a queue in this way is very
    convenient, but also very inefficient.  It can be used here because
    characters will only arrive slowly.  In a higher bandwidth system a circular
    RAM buffer or DMA should be used in place of this queue. */
    xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );
    configASSERT( xRxQueue );

    /* Set up SCI1 receive buffer */
    R_SCI7_Serial_Receive((uint8_t *) &g_rx_char, 1);

    /* Ensure the interrupt priority is at or below
    configMAX_SYSCALL_INTERRUPT_PRIORITY. */
    IPR(SCI7, RXI7) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
    IPR(SCI7, TXI7) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
    IPR(ICU,GROUPBL0) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;

    /* Enable SCI1 operations */
    R_SCI7_Start();

    /* Only one UART is supported, so it doesn't matter what is returned
    here. */
    return 0;
}
示例#2
0
/***********************************************************************************************************************
* Function Name: r_sci7_callback_receiveend
* Description  : This function is a callback function when SCI7 finishes reception.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
static void r_sci7_callback_receiveend(void)
{
    /* Start user code. Do not edit comment generated here */
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;

    configASSERT( xRxQueue );

    /* Transmitting generates an interrupt for each character, which consumes
    CPU time, and can cause standard demo RTOS tasks that monitor their own
    performance to fail asserts - so don't receive new CLI commands if a
    transmit is not already in progress. */
    if( sci7_txdone == TRUE )
    {
        /* Characters received from the UART are stored in this queue, ready to be
        received by the application.  ***NOTE*** Using a queue in this way is very
        convenient, but also very inefficient.  It can be used here because
        characters will only arrive slowly.  In a higher bandwidth system a circular
        RAM buffer or DMA should be used in place of this queue. */
        xQueueSendFromISR( xRxQueue, &g_rx_char, &xHigherPriorityTaskWoken );
    }

    /* Set up SCI7 receive buffer again */
    R_SCI7_Serial_Receive((uint8_t *)&g_rx_char, 1);

    /* See http://www.freertos.org/xQueueOverwriteFromISR.html for information
    on the semantics of this ISR. */
    portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
    /* End user code. Do not edit comment generated here */
}
示例#3
0
文件: main.c 项目: HclX/freertos
static void prvSetupHardware( void )
{
    /* Set up SCI7 receive buffer and callback function. */
    R_SCI7_Serial_Receive((uint8_t *)&g_rx_char, 1);

    /* Enable SCI7 operations. */
    R_SCI7_Start();
}
示例#4
0
/***********************************************************************************************************************
* Function Name: r_sci7_callback_receiveend
* Description  : This function is a callback function when SCI7 finishes reception.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
static void r_sci7_callback_receiveend(void)
{
    /* Start user code. Do not edit comment generated here */
    /* Check the contents of g_rx_char */
    if (('c' == g_rx_char) || ('C' == g_rx_char))
    {
//_RB_        g_adc_trigger = TRUE;
    }

    /* Set up SCI7 receive buffer and callback function again */
    R_SCI7_Serial_Receive((uint8_t *)&g_rx_char, 1);

    /* End user code. Do not edit comment generated here */
}