This is the mail archive of the
ecos-devel@sourceware.org
mailing list for the eCos project.
Re: Patch for CYGPKG_IO_SERIAL_ARM_LPC2XXX
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Martin Laabs <martin dot laabs at mailbox dot tu-dresden dot de>
- Cc: ecos-devel at ecos dot sourceware dot org
- Date: Sun, 23 Nov 2008 14:52:38 +0100
- Subject: Re: Patch for CYGPKG_IO_SERIAL_ARM_LPC2XXX
- References: <op.uk02z1bx724k7f@localhost>
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
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 <martin.laabs@mailbox.tu-dresden.de>
+ Andrew Lunn <andrew@lunn.ch>
+
+ * 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 <aaganichev@gmail.com>
* 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