[ECOS] turn off diag_printf?

Gary Thomas gary@mlbassoc.com
Tue Oct 6 10:53:00 GMT 2009

On 10/06/2009 01:33 AM, Dave Milter wrote:
> I used arm cpu from at91 family and its DBGU channel for working with redboot.
> When my application starting it used dbgu for diag_printf and also
> ordinary printf working via
> this channel, now I want interrupt driven IO via this DBGU serial
> port, but only after full initialization.
> So I want such scheme:
> redboot - diag_printf working
> ecos app:
> - initialization - diag_printf working
> - main function is called - diag_printf working
> - somehow switch off diag_printf - now it nothing print to DBGU port (1)
> - interrupt driven IO via DBGU port is activated
> I have problem with (1), how should I do it?
> I find such code:
>      CYGACC_COMM_IF_CH_DATA_SET(*comm,&at91_ser_channels[0]);
>      CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_dbg_write);
>      CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_dbg_read);
>      CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_dbg_putc);
>      CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_dbg_getc);
>      CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_dbg_control);
>      CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_dbg_isr);
>      CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_dbg_getc_timeout);
> if I replace in this code function like cyg_hal_plf_serial_dbg_write
> with empty functions,
> diag_printf stop send something to DBGU?

The easiest way to handle this is to call this function
   diag_init_putc(void (*putc)(char c, void **param))
Pass it a function (not NULL as that's how you reset to
the default) that takes a character and "prints".  This
will then prevent diag_printf() from accessing your device.

Note: I'd suggest that you make this function at least save
the last few characters that might be "printed" in case there's
something important that is trying to make its way out :-)

Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list