From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7814 invoked by alias); 14 Aug 2006 06:04:10 -0000 Received: (qmail 7804 invoked by uid 22791); 14 Aug 2006 06:04:09 -0000 X-Spam-Check-By: sourceware.org Received: from static124-190.staticcal.vsnl.net.in (HELO alumnux.com) (203.197.124.190) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 14 Aug 2006 07:04:07 +0100 Received: from [192.168.10.157] (IDENT:U2FsdGVkX1/MTghz/wf3q/pRygNEVm7Lh+d8uzU+s80@[192.168.10.157]) by alumnux.com (8.9.3/8.9.3) with ESMTP id LAA00903 for ; Mon, 14 Aug 2006 11:37:57 +0530 Message-ID: <44E012AC.2000707@alumnux.com> Date: Mon, 14 Aug 2006 06:04:00 -0000 From: Tathagata Das User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: ecos-discuss@ecos.sourceware.org References: <44DC6C39.1060309@alumnux.com> <44DC6E2B.2090209@mlbassoc.com> In-Reply-To: <44DC6E2B.2090209@mlbassoc.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Serial driver X-SW-Source: 2006-08/txt/msg00121.txt.bz2 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. 2. In scanf function --- control is stuck into " while (size < *len) {" this loop in serial_read function. Here is my DSR for RX: static void test_rx_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; cyg_uint8 _c; unsigned int fifocnt; fifocnt = *FSTAT & RXFFLMASK; if(fifocnt--) { _c = *ASC_RBUF; (chan->callbacks->rcv_char)(chan, _c); /* I print this "_c" variable by diag_printf and I have seen it get correct key which I type from keyboard */ /* RX happened ... so try to print that char */ if(((*FSTAT & TXFFLMASK) >> TXFFLOFF) != TXFIFO_FULL) { cbuf_t *tx_cbuf = &chan->out_cbuf; diag_printf("TX: %d\n", tx_cbuf->nb); /* I got 0 here */ (chan->callbacks->xmt_char)(chan); /* nothing is printed */ } } cyg_drv_interrupt_unmask(RX_IRQ); } Thanks in advance Regards, Tatha -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss