This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Serial driver


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]