Esempio n. 1
0
static void
console_write(struct console *co, const char *buf, unsigned int len)
{
	if (!port)
		return;

#ifdef CONFIG_SVINTO_SIM
	/* no use to simulate the serial debug output */
	SIMCOUT(buf, len);
	return;
#endif

	start_port();

#ifdef CONFIG_ETRAX_KGDB
	/* kgdb needs to output debug info using the gdb protocol */
	putDebugString(buf, len);
	return;
#endif

	if (debug_write_function)
		debug_write_function(co->index, buf, len);
	else
		console_write_direct(co, buf, len);
}
Esempio n. 2
0
static void
console_write(struct console *co, const char *buf, unsigned int len)
{
    unsigned long flags;
#ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
    /* no debug printout at all */
    return;
#endif

#ifdef CONFIG_SVINTO_SIM
    /* no use to simulate the serial debug output */
    SIMCOUT(buf,len);
    return;
#endif

#ifdef CONFIG_ETRAX_KGDB
    /* kgdb needs to output debug info using the gdb protocol */
    putDebugString(buf, len);
    return;
#endif

    local_irq_save(flags);
    if (debug_write_function)
        if (debug_write_function(co->index, buf, len))
            return;
    console_write_direct(co, buf, len);
    local_irq_restore(flags);
}
static void
console_write(struct console *co, const char *buf, unsigned int len)
{
	if (!port)
		return;

#ifdef CONFIG_SVINTO_SIM
	/* no use to simulate the serial debug output */
	SIMCOUT(buf, len);
	return;
#endif

        console_write_direct(co, buf, len);
}
static void
console_write(struct console *co, const char *buf, unsigned int len)
{
	if (!port)
		return;

#ifdef CONFIG_SVINTO_SIM
	/*                                            */
	SIMCOUT(buf, len);
	return;
#endif

        console_write_direct(co, buf, len);
}
static void 
console_write(struct console *co, const char *buf, unsigned int len)
{
	static struct etrax_dma_descr descr;
	static struct etrax_dma_descr descr2;
	static char tmp_buf[MIN_SIZE];
	static int tmp_size = 0;

	unsigned long flags; 
	
#ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
        /* no debug printout at all */
        return;
#endif

#ifdef CONFIG_SVINTO_SIM
	/* no use to simulate the serial debug output */
	SIMCOUT(buf,len);
	return;
#endif
	
	save_flags(flags);
	cli();

#ifdef CONFIG_ETRAX_KGDB
	/* kgdb needs to output debug info using the gdb protocol */
	putDebugString(buf, len);
	restore_flags(flags);
	return;
#endif
	/* To make this work together with the real serial port driver
	 * we have to make sure that everything is flushed when we leave
	 * here. The following steps are made to assure this:
	 * 1. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
	 * 2. Write at least half the FIFO to trigger flush to serial port.
	 * 3. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
         */

	/* Do we have enough characters to make the DMA/FIFO happy? */
	if (tmp_size + len < MIN_SIZE)
	{
		int size = min((int)(MIN_SIZE - tmp_size),(int)len);
		memcpy(&tmp_buf[tmp_size], buf, size);
		tmp_size += size;
		len -= size;
        
		/* Pad with space if complete line */
		if (tmp_buf[tmp_size-1] == '\n')
		{
			memset(&tmp_buf[tmp_size-1], ' ', MIN_SIZE - tmp_size);
			tmp_buf[MIN_SIZE - 1] = '\n';
			tmp_size = MIN_SIZE;
			len = 0;
		}
		else
		{
                  /* Wait for more characters */
			restore_flags(flags);
			return;
		}
	}

	/* make sure the transmitter is enabled. 
	 * NOTE: this overrides any setting done in ttySx, to 8N1, no auto-CTS.
	 * in the future, move the tr/rec_ctrl shadows from etrax100ser.c to
	 * shadows.c and use it here as well...
	 */

	*DEBUG_TR_CTRL = 0x40;
	while(*DEBUG_OCMD & 7); /* Until DMA is not running */
	while(*DEBUG_STATUS & 0x7f); /* wait until output FIFO is empty as well */
	udelay(200); /* Wait for last two characters to leave the serial transmitter */

	if (tmp_size)
	{
		descr.ctrl = len ?  0 : d_eop | d_wait | d_eol;
		descr.sw_len = tmp_size;
		descr.buf = virt_to_phys(tmp_buf);
		descr.next = virt_to_phys(&descr2);
		descr2.ctrl = d_eop | d_wait | d_eol;
		descr2.sw_len = len;
		descr2.buf = virt_to_phys((char*)buf);
	}
	else
	{
		descr.ctrl = d_eop | d_wait | d_eol;
		descr.sw_len = len;
		descr.buf = virt_to_phys((char*)buf);
	}

	*DEBUG_FIRST = virt_to_phys(&descr); /* write to R_DMAx_FIRST */
	*DEBUG_OCMD = 1;       /* dma command start -> R_DMAx_CMD */

	/* wait until the output dma channel is ready again */
	while(*DEBUG_OCMD & 7);
	while(*DEBUG_STATUS & 0x7f);
	udelay(200);

	tmp_size = 0;
	restore_flags(flags);
}