From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21280 invoked by alias); 3 Jul 2008 19:11:27 -0000 Received: (qmail 21266 invoked by uid 22791); 3 Jul 2008 19:11:26 -0000 X-Spam-Check-By: sourceware.org Received: from yw-out-1718.google.com (HELO yw-out-1718.google.com) (74.125.46.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 03 Jul 2008 19:10:39 +0000 Received: by yw-out-1718.google.com with SMTP id 9so364324ywk.66 for ; Thu, 03 Jul 2008 12:10:29 -0700 (PDT) Received: by 10.114.56.1 with SMTP id e1mr1224824waa.204.1215112228396; Thu, 03 Jul 2008 12:10:28 -0700 (PDT) Received: from ubuntu.local ( [86.57.204.73]) by mx.google.com with ESMTPS id m5sm967428gve.3.2008.07.03.12.09.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Jul 2008 12:10:27 -0700 (PDT) Message-ID: <486D2404.2010108@gmail.com> Date: Thu, 03 Jul 2008 19:11:00 -0000 From: Sergei Gavrikov User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: thekyz@gmail.com CC: eCos Mailing List References: <20080703101011.GC27831@lunn.ch> <20080703140339.GG27831@lunn.ch> <20080703153938.GB31275@lunn.ch> In-Reply-To: Content-Type: multipart/mixed; boundary="------------050300090502060609060504" X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Can excessive/intensive serial flow cause stack overflow? X-SW-Source: 2008-07/txt/msg00025.txt.bz2 --------------050300090502060609060504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2104 Alexandre wrote: > On Thu, Jul 3, 2008 at 5:39 PM, Andrew Lunn wrote: >> Duh... Didn't read the message correctly, so missed the obvious problem.... >> >> I thought vector, then the problem is priority..... >> >> This is easy to explain. The actual serial driver is in >> /packages/devs/serial/generic/16x5x/current/src. >> >> It registers the interrupt handler with: >> >> cyg_drv_interrupt_create(ser_chan->int_num, >> CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY, >> (cyg_addrword_t)chan, >> pc_serial_ISR, >> pc_serial_DSR, >> &ser_chan->serial_interrupt_handle, >> &ser_chan->serial_interrupt); >> >> The priority is hard coded for all serial devices as 4. >> >> You can sort of override this. The same file says: >> >> #ifndef CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY >> # define CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY 4 >> #endif >> >> but you don't appear to be able to override it per device, just for >> all devices. So i think you are not going to be able to benefit from >> vectored interrupts and will have to use a priority of 16. Or you need >> to have the serial driver to allow you to specify a priority level per >> device. >> >> Humm, actually, you could do something a little horrible like: >> >> #define CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY \ >> (ser_chan->int_num == CYGNUM_HAL_INTERRUPT_UART0 ? 4 : 5) >> >> in arm_lpc2xxx_ser.inl >> >> Andrew > > That does the trick. > The program stops there (after cyg_user_start(), some scheduler, clock > and thread work) : If I remember, in a past I did catch same asserts on LPC2XXX UARTS ASSERT FAIL: (1) lpc2xxx_misc.c[472]hal_interrupt_set_level() Priority already used by another vector So, I just dirty tweaked the lpc2xxx_misc.c to shift priority to next free slot. I found that my patch. Try to apply the patch and rebuild eCos build tree. Today, I have no LPC2XXX hardware to test it. Sergei --------------050300090502060609060504 Content-Type: text/x-diff; name="lpc2xxx_misc.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="lpc2xxx_misc.c.patch" Content-length: 1097 diff -ur A/hal/arm/lpc2xxx/var/current/src/lpc2xxx_misc.c B/hal/arm/lpc2xxx/var/current/src/lpc2xxx_misc.c --- A/hal/arm/lpc2xxx/var/current/src/lpc2xxx_misc.c +++ B/hal/arm/lpc2xxx/var/current/src/lpc2xxx_misc.c @@ -462,12 +462,18 @@ // if (level < 16) { + int i; cyg_uint32 addr_offset = level << 2; cyg_uint32 reg_val; - HAL_READ_UINT32(CYGARC_HAL_LPC2XXX_REG_VIC_BASE + - CYGARC_HAL_LPC2XXX_REG_VICVECTCNTL0 + - addr_offset, reg_val); + for (i = level; i < 16; i++) { + addr_offset = i << 2; + HAL_READ_UINT32(CYGARC_HAL_LPC2XXX_REG_VIC_BASE + + CYGARC_HAL_LPC2XXX_REG_VICVECTCNTL0 + + addr_offset, reg_val); + if ((reg_val == 0) || (reg_val == (vector | 0x20))) + break; + } CYG_ASSERT((reg_val == 0) || (reg_val == (vector | 0x20)), "Priority already used by another vector"); HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_VIC_BASE + --------------050300090502060609060504 Content-Type: text/plain; charset=us-ascii Content-length: 148 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss --------------050300090502060609060504--