head/sys/contrib/octeon-sdk/cvmx-interrupt.c
/**
 * version of printf that works better in exception context.
 *
 * @param format
 */
version of printf that works better in exception context.
@param format
version of printf that works better in exception context . @param format
void cvmx_safe_printf(const char *format, ...)
{
    char buffer[256];
    char *ptr = buffer;
    int count;
    va_list args;
    va_start(args, format);
#ifndef __U_BOOT__
    count = vsnprintf(buffer, sizeof(buffer), format, args);
#else
    count = vsprintf(buffer, format, args);
#endif
    va_end(args);
    while (count-- > 0)
    {
        cvmx_uart_lsr_t lsrval;
        do
        {
            lsrval.u64 = cvmx_read_csr(CVMX_MIO_UARTX_LSR(0));
#if !defined(CONFIG_OCTEON_SIM_SPEED)
            if (lsrval.s.temt == 0)
                cvmx_wait(10000);   
#endif
        }
        while (lsrval.s.temt == 0);
        if (*ptr == '\n')
            cvmx_write_csr(CVMX_MIO_UARTX_THR(0), '\r');
        cvmx_write_csr(CVMX_MIO_UARTX_THR(0), *ptr++);
    }
}
void cvmx_safe_printf ( const char * format , ... ) { char buffer [ 256 ] ; char * ptr = buffer ; int count ; va_list args ; va_start ( args , format ) ; #ifndef __U_BOOT__ count = vsnprintf ( buffer , sizeof ( buffer ) , format , args ) ; #else count = vsprintf ( buffer , format , args ) ; #endif va_end ( args ) ; while ( count -- > 0 ) { cvmx_uart_lsr_t lsrval ; do { lsrval . u64 = cvmx_read_csr ( CVMX_MIO_UARTX_LSR ( 0 ) ) ; #if ! defined ( CONFIG_OCTEON_SIM_SPEED ) if ( lsrval . s . temt == 0 ) cvmx_wait ( 10000 ) ; #endif } while ( lsrval . s . temt == 0 ) ; if ( * ptr == ' \n ' ) cvmx_write_csr ( CVMX_MIO_UARTX_THR ( 0 ) , ' \r ' ) ; cvmx_write_csr ( CVMX_MIO_UARTX_THR ( 0 ) , * ptr ++ ) ; } }
version of printf that works better in exception context.
version of printf that works better in exception context .
/* Spin until there is room */ /* Just to reduce the load on the system */