void console_alloc_kfifo(void) { if(console_fifo==NULL){ console_fifo =&g_console_fifo; kfifo_init_static(console_fifo,console_buffer,console_buffer_size); } }
/* ********************************************************************************************************* * App_TaskDebugInfo() * * Description : Check DBG_UART_Send_Buffer[] and Send debug data if kFIFO buffer is not empty * * Argument(s) : p_arg Argument passed to 'App_TaskUserIF()' by 'OSTaskCreate()'. * * Return(s) : none. * * Note(s) : (1) The first line of code is used to prevent a compiler warning because 'p_arg' is not * used. The compiler should not generate any code for this statement. ********************************************************************************************************* */ void App_TaskDebugInfo (void *p_arg) { CPU_INT16U i, size ; CPU_CHAR uart_data[ DBG_UART_BUF_SIZE ] ; (void)p_arg; debug_uart_fifo_data_max = 0; debug_uart_fifo_oveflow_counter = 0; kfifo_init_static( &DBG_UART_Send_kFIFO, (unsigned char *)DBG_UART_Send_Buffer, DBG_UART_Send_Buf_Size); while ( DEF_TRUE ) { /* Task body, always written as an infinite loop. */ size = kfifo_get_data_size( &DBG_UART_Send_kFIFO ); if( size ) { if( size > debug_uart_fifo_data_max ) { debug_uart_fifo_data_max = size; } size = size < DBG_UART_BUF_SIZE ? size : DBG_UART_BUF_SIZE; kfifo_get( &DBG_UART_Send_kFIFO, (unsigned char *)uart_data, size ) ; for( i = 0; i < size; i++ ){ BSP_Ser_WrByte( uart_data[i] ) ; } } else { OSTimeDly(1); } } }