9
0
Fork 0

Fix QEMU timer interrupts

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3387 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-03-16 17:17:58 +00:00
parent 99f2763449
commit f1aa78093d
6 changed files with 40 additions and 34 deletions

View File

@ -1573,3 +1573,5 @@
* drivers/net/slip.c -- SLIP is now basically functional on the
LPC17xx with some caveats as described in the TODO list under
LPC17xx.
* arch/x86/include/i486/irq.h -- Fix irqrestore() macro... it was not
correctly re-enabling interrupts.

View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated March 15, 2011)
NuttX TODO List (Last updated March 16 2011)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(5) Task/Scheduler (sched/)
@ -8,7 +8,7 @@ NuttX TODO List (Last updated March 15, 2011)
(1) pthreads (sched/)
(1) C++ Support
(5) Binary loaders (binfmt/)
(17) Network (net/, drivers/net)
(16 Network (net/, drivers/net)
(5) Network Utilities (netutils/)
(2) USB (drivers/usbdev, drivers/usbhost)
(5) Libraries (lib/)
@ -30,7 +30,7 @@ NuttX TODO List (Last updated March 15, 2011)
(3) ARM/STR71x (arch/arm/src/str71x/)
(4) ARM/LM3S6918 (arch/arm/src/lm3s/)
(4) ARM/STM32 (arch/arm/src/stm32/)
(1) Intel x86 (arch/x86)
(0) Intel x86 (arch/x86)
(4) 8051 / MCS51 (arch/8051/)
(2) Hitachi/Renesas SH-1 (arch/sh/src/sh1)
(4) Renesas M16C/26 (arch/sh/src/m16c)
@ -308,21 +308,6 @@ o Network (net/, drivers/net)
the mechanism for leaving and joining groups is hidden behind a wrapper
function so that little of this incompatibilities need be exposed.
Description: The SLIP driver (drivers/net/slip.c) has had only the most superficial
testing. Issues/Notes:
(1) A minor issue is that SLIP requires hardware handshake and
that has not been implemented in the UART drivers on most platforms.
You can use the slattach' option -L which enables "3-wire
operation." NOTE: This may also result in data overrun errors.
(2) Current State: The driver connects and responds to PINGs (ICMP
ECHO) commands. However, when used with the TCP stack and THTTPD,
there is some condition that causes a hang. So the SLIP driver
is still not ready for prime-time.
(3) Finally, the Linux slip driver is hard-coded to use an MTU of 296
so setting CONFIG_NET_BUFSIZE to a 296 is also advised.
Status: Open
Priority: Medium
o Network Utilities (netutils/)
Description: One critical part of netutils/ apps is untested: The uIP
@ -949,10 +934,6 @@ o ARM/STM32 (arch/arm/src/stm32/)
o Intel x86 (arch/x86)
^^^^^^^^^^^^^^^^^^^^
Description: No timer interrupts in the QEMU configuration.
Status: Open
Priorty: Medium-High
o 8051 / MCS51 (arch/8051/)
^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -121,7 +121,7 @@
#define PIC2_OCW2 0xa0
# define PIC_OCW2_ACT_SHIFT (0)
# define PIC_OCW2_ACT_SHIFT (7 << PIC_OCW2_ACT_SHIFT)
# define PIC_OCW2_ACT_MASK (7 << PIC_OCW2_ACT_SHIFT)
# define PIC1_OCW2_ACT_IRQ0 (0 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 0 */
# define PIC1_OCW2_ACT_IRQ1 (1 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 1 */
# define PIC1_OCW2_ACT_IRQ2 (2 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 2 */
@ -141,7 +141,7 @@
# define PIC2_OCW2_ACT_IRQ15 (7 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 15 */
# define PIC_OCW2_EOI_SHIFT (5)
# define PIC_OCW2_EOI_SHIFT (7 << PIC_OCW2_EOI_SHIFT)
# define PIC_OCW2_EOI_MASK (7 << PIC_OCW2_EOI_SHIFT)
# define PIC_OCW2_EOI_AUTO (0 << PIC_OCW2_EOI_SHIFT) /* Rotate in Auto EOI Mode (Clear) */
# define PIC_OCW2_EOI_NONSPEC (1 << PIC_OCW2_EOI_SHIFT) /* Non Specific EOI */
# define PIC_OCW2_EOI_SPEC (3 << PIC_OCW2_EOI_SHIFT) /* Specific EOI */
@ -171,7 +171,7 @@
# define PIC_OCW3_POLLCMD (1 << 2) /* Poll command */
# define PIC_OCW3_ONE (1 << 3) /* Must be set to 1 */
# define PIC_OCW3_SM_SHIFT (5)
# define PIC_OCW3_SM_SHIFT (3 << PIC_OCW3_SM_SHIFT)
# define PIC_OCW3_SM_MASK (3 << PIC_OCW3_SM_SHIFT)
# define PIC_OCW3_RSM (2 << PIC_OCW3_SM_SHIFT) /* Reset Special Mask */
# define PIC_OCW3_SSM (3 << PIC_OCW3_SM_SHIFT) /* Set Special Mask */

View File

@ -135,9 +135,17 @@ static inline irqstate_t irqflags()
return flags;
}
/* Get a sample of the FLAGS register, determine if interrupts are disabled */
/* Get a sample of the FLAGS register, determine if interrupts are disabled.
* If the X86_FLAGS_IF is cleared by cli, then interrupts are disabled. If
* if the X86_FLAGS_IF is set by sti, then interrupts are enable.
*/
static inline bool irqdisabled(irqstate_t flags)
{
return ((flags & X86_FLAGS_IF) == 0);
}
static inline bool irqenabled(irqstate_t flags)
{
return ((flags & X86_FLAGS_IF) != 0);
}
@ -169,9 +177,9 @@ static inline irqstate_t irqsave(void)
static inline void irqrestore(irqstate_t flags)
{
if (irqdisabled(flags))
if (irqenabled(flags))
{
irqdisable();
irqenable();
}
}

View File

@ -178,16 +178,16 @@ uint32_t *irq_handler(uint32_t *regs)
* involved the slave.
*/
if (irq >= 40)
if (irq >= IRQ8)
{
/* Send reset signal to slave */
idt_outb(0x20, 0xa0);
idt_outb(PIC_OCW2_EOI_NONSPEC, PIC2_OCW2);
}
/* Send reset signal to master */
idt_outb(0x20, 0x20);
idt_outb(PIC_OCW2_EOI_NONSPEC, PIC1_OCW2);
/* Dispatch the interrupt */

View File

@ -68,7 +68,8 @@
/* NOTE: Slip requires UART hardware handshake. If hardware handshake is
* not available with your UART, then you might try the 'slattach' option
* -L which is supposed to enable "3-wire operation."
* -L which enable "3-wire operation." That allows operation without the
* hardware handshake (but with the possibility of data overrun).
*/
/* Configuration ************************************************************/
@ -93,8 +94,15 @@
# define CONFIG_SLIP_DEFPRIO 128
#endif
/* The Linux slip module hard-codes its MTU size to 296. So you might as
* well set CONFIG_NET_BUFSIZE to 296 as well.
/* The Linux slip module hard-codes its MTU size to 296 (40 bytes for the
* IP+TPC headers plus 256 bytes of data). So you might as well set
* CONFIG_NET_BUFSIZE to 296 as well.
*
* There may be an issue with this setting, however. I see that Linux uses
* a MTU of 296 and window of 256, but actually only sends 168 bytes of data:
* 40 + 128. I believe that is to allow for the 2x worst cast packet
* expansion. Ideally we would like to advertise the 256 MSS, but restrict
* uIP to 128 bytes (possibly by modifying the uip_mss() macro).
*/
#if CONFIG_NET_BUFSIZE < 296
@ -995,6 +1003,13 @@ int slip_initialize(int intf, const char *devname)
/* Register the device with the OS so that socket IOCTLs can be performed */
(void)netdev_register(&priv->dev);
/* When the RX and TX tasks were created, the TTY file descriptor was
* dup'ed for each task. This task no longer needs the file descriptor
* and we can safely close it.
*/
close(priv->fd);
return OK;
}