This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Serial driver
Hi Andrew,
Thank you very much for your reply.
For my problem 1 :
You are right. I want to echo that character. Please tell me how can I
enable echo.
I am not using any tty layer.
I am sending you DEVTAB_ENTRY for your reference.
DEVTAB_ENTRY( test_serial_iol,
/dev/ser0,
0,
&cyg_io_serial_devio,
test_serial_init,
test_serial_lookup, // Serial driver may need
initializing
&test_serial_channel
);
I only use this single entry. Hope , i do not need two entries (one for
RX and one for TX). Single entry should be good enough.
Also CYGDAT_IO_SERIAL_TTY_CONSOLE = /dev/ser0
Please tell me how can I use tty layer so that I get the echo support.
For my problem 2 :
Yes you are again right. It tries to read a block. But why ?
My scanf is like this ---- scanf("%c", &c); SO it should try to read
single character.
But i have noticed that size = 256 in "while (size< *len) {".
Please tell me why the control does not come out and why I am not able
to print the value of variable 'c'.
Thanks in advance
Regards,
Tatha
Andrew Lunn wrote:
On Mon, Aug 14, 2006 at 11:35:32AM +0530, Tathagata Das wrote:
Hi ,
I am using two different IRQ number for RX and TX in serial driver.
My init function of serial driver looks like this ---
static bool test_serial_init(struct cyg_devtab_entry *tab)
{
serial_channel *chan = (serial_channel *)tab->priv;
(chan->callbacks->serial_init)(chan); // Really only required
for interrupt driven devices
/* Allocate the IRQs */
if (chan->out_cbuf.len != 0) {
/* TX interrupt */
cyg_drv_interrupt_create(TX_IRQ,
0,
// IRQ priority
(cyg_addrword_t)chan,
// Data item passed to interrupt handler
&test_tx_serial_ISR,
&test_tx_serial_DSR,
&tx_serial_interrupt_handle,
&tx_serial_interrupt);
cyg_drv_interrupt_attach(tx_serial_interrupt_handle);
cyg_drv_interrupt_unmask(TX_IRQ);
}
if (chan->in_cbuf.len != 0) {
/* RX interrupt */
cyg_drv_interrupt_create(RX_IRQ,
0,
// IRQ priority
(cyg_addrword_t)chan,
// Data item passed to interrupt handler
&test_rx_serial_ISR,
&test_rx_serial_DSR,
&rx_serial_interrupt_handle,
&rx_serial_interrupt);
cyg_drv_interrupt_attach(rx_serial_interrupt_handle);
cyg_drv_interrupt_unmask(RX_IRQ);
}
return true;
}
My problems are :
1. when I press any key from keyboard test_rx_serial_ISR and
test_rx_serial_DSR are called one by one.
But that charcter is not displayed.
You mean there is no echo? Do you have echo'ing enabled? Are you even
using the tty layer in eCos which provides echo support?
2. In scanf function --- control is stuck into " while (size
< *len) {" this loop in serial_read function.
So this layer is trying to read a block of charactors, not a single
charactor read. Nothing wrong here.
You might want to read more of
http://ecos.sourceware.org/docs-latest/ref/io-serial-driver-details.html
It sounds like you want to use the tty driver.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss