From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31364 invoked by alias); 23 Nov 2008 13:53:27 -0000 Received: (qmail 31316 invoked by uid 22791); 23 Nov 2008 13:53:26 -0000 X-Spam-Level: * X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 23 Nov 2008 13:52:51 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1L4FOA-0000nT-00; Sun, 23 Nov 2008 14:52:38 +0100 Date: Sun, 23 Nov 2008 13:53:00 -0000 From: Andrew Lunn To: Martin Laabs Cc: ecos-devel@ecos.sourceware.org Subject: Re: Patch for CYGPKG_IO_SERIAL_ARM_LPC2XXX Message-ID: <20081123135238.GB2813@lunn.ch> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2008-11/txt/msg00060.txt.bz2 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1192 On Sat, Nov 22, 2008 at 05:05:52PM +0100, Martin Laabs wrote: > Hi, > > the CYGPKG_IO_SERIAL_ARM_LPC2XXX package support up to two serial > devices. Therefore it uses the VIC (vectored interrupt controller) > of the LPC devices. If both channels are enables in the configtool > both will also get the same interrupt priority. This is not possible > with the LPC VIC and causes, that only the last interrupt is > enables and the first one generates "spurious interrupts" (from eCos > point of view) that leads to data fetch and illegal instruction > exeptions. > > I added support to assign the priority in the configtool/driver. Hi Martin I extended the patch a little. I added a ChangeLog entry and some CDL as i suggested to ensure the priorities are different between the serial ports. However if some other device is using the same priority this will not be detected. The correct place to fix that is in the HAL. Humm, interesting. If you have asserts enabled, which you should when developing, the function hal_interrupt_set_level() has: CYG_ASSERT((reg_val == 0) || (reg_val == (vector | 0x20)), "Priority already used by another vector"); Andrew --4Ckj6UjgE2iN1+kY Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="devs_serial_arm_lpc2xxx.diff" Content-length: 4157 Index: devs/serial/arm/lpc2xxx/current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/serial/arm/lpc2xxx/current/ChangeLog,v retrieving revision 1.3 diff -u -r1.3 ChangeLog --- devs/serial/arm/lpc2xxx/current/ChangeLog 22 Jun 2007 11:41:49 -0000 1.3 +++ devs/serial/arm/lpc2xxx/current/ChangeLog 23 Nov 2008 13:47:05 -0000 @@ -1,3 +1,10 @@ +2008-11-23 Martin Laabs + Andrew Lunn + + * cdl/ser_arm_lpc2xxx.cdl: + * include/arm_lpc2xxx_ser.inl: Ensure the serial interrupts are + using different priorities, otherwise we get spurious interrupts. + 2007-06-22 Alexander Aganichev * cdl/ser_arm_lpc2xxx.cdl: Index: devs/serial/arm/lpc2xxx/current/cdl/ser_arm_lpc2xxx.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/serial/arm/lpc2xxx/current/cdl/ser_arm_lpc2xxx.cdl,v retrieving revision 1.2 diff -u -r1.2 ser_arm_lpc2xxx.cdl --- devs/serial/arm/lpc2xxx/current/cdl/ser_arm_lpc2xxx.cdl 22 Jun 2007 11:41:49 -0000 1.2 +++ devs/serial/arm/lpc2xxx/current/cdl/ser_arm_lpc2xxx.cdl 23 Nov 2008 13:47:06 -0000 @@ -53,6 +53,8 @@ parent CYGPKG_IO_SERIAL_DEVICES active_if CYGPKG_IO_SERIAL active_if CYGPKG_HAL_ARM_LPC2XXX + implements CYGINT_IO_SERIAL_GENERIC_16X5X_CHAN_INTPRIO + requires CYGPKG_ERROR include_dir cyg/io @@ -121,6 +123,23 @@ This option specifies the size of the internal buffers used for the ARM LPC2XXX port 0." } + + cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_INTPRIO { + display "Interrupt priority of the serial port 0 ISR" + flavor data + legal_values 0 to 15 + default_value 14 + requires { is_active(CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_INTPRIO) + implies CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_INTPRIO != + CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_INTPRIO + } + description " + This option specifies the interrupt priority of the + ISR of the serial port 0 interrupt in the VIC. + Slot 0 has the highest priority and slot 15 the lowest." + } + + } cdl_component CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL1 { @@ -166,6 +185,18 @@ This option specifies the size of the internal buffers used for the ARM LPC2XXX port 1." } + + + cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_INTPRIO { + display "Interrupt priority of the serial port 1 ISR" + flavor data + legal_values 0 to 15 + default_value 15 + description " + This option specifies the interrupt priority of the + ISR of the serial port 1 interrupt in the VIC. + Slot 0 has the highest priority and slot 15 the lowest." + } } cdl_component CYGPKG_IO_SERIAL_ARM_LPC2XXX_TESTING { Index: devs/serial/arm/lpc2xxx/current/include/arm_lpc2xxx_ser.inl =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/serial/arm/lpc2xxx/current/include/arm_lpc2xxx_ser.inl,v retrieving revision 1.2 diff -u -r1.2 arm_lpc2xxx_ser.inl --- devs/serial/arm/lpc2xxx/current/include/arm_lpc2xxx_ser.inl 15 Nov 2004 09:20:27 -0000 1.2 +++ devs/serial/arm/lpc2xxx/current/include/arm_lpc2xxx_ser.inl 23 Nov 2008 13:47:06 -0000 @@ -87,7 +87,8 @@ #ifdef CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL0 static pc_serial_info lpc2xxx_serial_info0 = { CYGARC_HAL_LPC2XXX_REG_UART0_BASE, - CYGNUM_HAL_INTERRUPT_UART0 + CYGNUM_HAL_INTERRUPT_UART0, + CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_INTPRIO }; #if CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BUFSIZE > 0 @@ -135,7 +136,8 @@ #ifdef CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL1 static pc_serial_info lpc2xxx_serial_info1 = { CYGARC_HAL_LPC2XXX_REG_UART1_BASE, - CYGNUM_HAL_INTERRUPT_UART1 + CYGNUM_HAL_INTERRUPT_UART1, + CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_INTPRIO }; #if CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BUFSIZE > 0 static unsigned char --4Ckj6UjgE2iN1+kY--