public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] serial line ISR problem -- again:(
@ 2003-09-08 17:13 Piotr Trojanek
  2003-09-08 17:17 ` Piotr Trojanek
  2003-09-09  7:46 ` Eric Doenges
  0 siblings, 2 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-08 17:13 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

Hi,

I still have a problem with my ISR, which should simply act when signal
transition on DCD pin of COM1 serial port (i386 PC). I'm 100% signal
is 200ms 'high', and then 800ms 'low'. Tested with both linux, freebsd,
qnx.

The worst is that this code used to work on my another PC machine:(,
but only on _that_ one...

Please, help, what do I do wrong?

-- 
Piotr Trojanek

[-- Attachment #2: intr.c --]
[-- Type: text/x-csrc, Size: 2292 bytes --]

#include <cyg/kernel/kapi.h>
#include <cyg/hal/hal_arch.h>
#include <stdio.h>

volatile unsigned int c;

cyg_interrupt intr;
cyg_handle_t intr_handle;

/*
ttyS00 at 0x03f8 (irq = 4) is a 16550A
ttyS01 at 0x02f8 (irq = 3) is a 16550A
*/

#define	COM_IRQ		4
#define	COM_ADDR	0x3f8

#define CYGNUM_HAL_PRI_HIGH 0

#define PRODUCER_PRIORITY   0
#define PRODUCER_STACKSIZE  CYGNUM_HAL_STACK_SIZE_TYPICAL

unsigned char producer_stack[PRODUCER_STACKSIZE];
cyg_handle_t producer_handle;
cyg_thread producer_thread;

cyg_sem_t data_ready;

volatile cyg_uint8 ier;

cyg_uint32 isr(
	cyg_vector_t vector,
	cyg_addrword_t data)
{
	/* do the work... */
	int i;
	c++;

	/* reenable IRQ on UART */
	for (i = 0; i < 8; i++)
		HAL_READ_UINT8(COM_ADDR + i, ier);
	cyg_interrupt_acknowledge( vector );
	return CYG_ISR_HANDLED;
}

void dsr(
	cyg_vector_t vector,
	cyg_ucount32 count,
	cyg_addrword_t data)
{
	/* 0x08 means transition from low go high */
	if (ier == 0x08) {
       		cyg_semaphore_post( &data_ready );
	}
}

void
producer(cyg_addrword_t data)
{
	for (;;)
	{
		cyg_semaphore_wait( &data_ready );
		printf("c = %d\n", c);
	}
}

int dcd_main( void)
{
	cyg_vector_t intr_vector = CYGNUM_HAL_ISR_MIN + COM_IRQ;
	cyg_priority_t intr_priority = CYGNUM_HAL_PRI_HIGH;
	int in_use;

	cyg_semaphore_init( &data_ready, 0 );

	HAL_INTERRUPT_IN_USE( intr_vector, in_use );
	printf("in_use(%d) = %d\n", intr_vector, in_use);

	cyg_thread_create(PRODUCER_PRIORITY, &producer, 0, "producer",
		producer_stack, PRODUCER_STACKSIZE,
		&producer_handle, &producer_thread);
	cyg_thread_resume(producer_handle);
	
	cyg_interrupt_create(
			intr_vector,
			intr_priority,
			0,
			isr,
			dsr,
			&intr_handle,
			&intr);
	
	// Attach the interrupt created to the vector.
	cyg_interrupt_attach( intr_handle );

	// Unmask the interrupt we just configured.
	cyg_interrupt_unmask( intr_vector );

	/* get acces to Interrupt Enable Register */
	HAL_READ_UINT8 (COM_ADDR + 3, ier);
	HAL_WRITE_UINT8 (COM_ADDR + 3, ier & 0x7f);

	/* make UART interrupt on DCD transition */
	HAL_WRITE_UINT8 (COM_ADDR + 1, 0x08);

	HAL_INTERRUPT_IN_USE( intr_vector, in_use );
	printf("in_use(%d) = %d\n", intr_vector, in_use);

	printf("cyg_scheduler_start()\n");
	cyg_scheduler_start();
}

externC void
cyg_start( void )
{
	dcd_main();
}


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-08 17:13 [ECOS] serial line ISR problem -- again:( Piotr Trojanek
@ 2003-09-08 17:17 ` Piotr Trojanek
  2003-09-09  7:46 ` Eric Doenges
  1 sibling, 0 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-08 17:17 UTC (permalink / raw)
  To: ecos-discuss

On Mon, Sep 08, 2003 at 07:13:29PM +0200, Piotr Trojanek wrote:
> The worst is that this code used to work on my another PC machine:(,
> but only on _that_ one...

and to add, I was trying to /* comment */ everything, which could be a
problem (eg. semaphore operations), just to get my isr() working, but
it still doesn't:(

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-08 17:13 [ECOS] serial line ISR problem -- again:( Piotr Trojanek
  2003-09-08 17:17 ` Piotr Trojanek
@ 2003-09-09  7:46 ` Eric Doenges
  2003-09-09  8:44   ` Piotr Trojanek
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Doenges @ 2003-09-09  7:46 UTC (permalink / raw)
  To: Piotr Trojanek; +Cc: ecos-discuss

Piotr Trojanek wrote:

[ ... ]
> Please, help, what do I do wrong?
[ ... ]
> cyg_uint32 isr(
> 	cyg_vector_t vector,
> 	cyg_addrword_t data)
> {
> 	/* do the work... */
> 	int i;
> 	c++;
> 
> 	/* reenable IRQ on UART */
> 	for (i = 0; i < 8; i++)
> 		HAL_READ_UINT8(COM_ADDR + i, ier);
> 	cyg_interrupt_acknowledge( vector );
> 	return CYG_ISR_HANDLED;
> }
[ ... ]

If you want your DSR to run, I believe you have to
return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
here. This may be your problem.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-09  7:46 ` Eric Doenges
@ 2003-09-09  8:44   ` Piotr Trojanek
  2003-09-09 12:09     ` Eric Doenges
  2003-09-09 13:01     ` Robert Cragie
  0 siblings, 2 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-09  8:44 UTC (permalink / raw)
  To: ecos-discuss

On Tue, Sep 09, 2003 at 09:46:39AM +0200, Eric Doenges wrote:
> If you want your DSR to run, I believe you have to
> return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
> here. This may be your problem.

no, I was trying to live without any DSR  -- incrementing 'voilatile int'
in ISR and printing it in 'for(;;) printf(...)' thread. it doesnt work:(
ISR doesn't run at all.

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-09  8:44   ` Piotr Trojanek
@ 2003-09-09 12:09     ` Eric Doenges
  2003-09-10  8:37       ` Piotr Trojanek
  2003-09-09 13:01     ` Robert Cragie
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Doenges @ 2003-09-09 12:09 UTC (permalink / raw)
  To: Piotr Trojanek; +Cc: ecos-discuss

Piotr Trojanek wrote:
> On Tue, Sep 09, 2003 at 09:46:39AM +0200, Eric Doenges wrote:
> 
>>If you want your DSR to run, I believe you have to
>>return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
>>here. This may be your problem.
> 
> 
> no, I was trying to live without any DSR  -- incrementing 'voilatile int'
> in ISR and printing it in 'for(;;) printf(...)' thread. it doesnt work:(
> ISR doesn't run at all.
> 

Since I'm not familiar with 16550 programming, I don't know if you are
using it correctly (you might want to check your code against the
generic 16550 driver included with eCos). Are you sure COM1 is located
at IO address 0x3f8 and uses IRQ 4 ? Many boards' BIOSes allow you to
change at least the interrupt line used.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ECOS] serial line ISR problem -- again:(
  2003-09-09  8:44   ` Piotr Trojanek
  2003-09-09 12:09     ` Eric Doenges
@ 2003-09-09 13:01     ` Robert Cragie
  2003-09-10  8:40       ` Piotr Trojanek
  1 sibling, 1 reply; 20+ messages in thread
From: Robert Cragie @ 2003-09-09 13:01 UTC (permalink / raw)
  To: Piotr Trojanek, ecos-discuss

Some points on your code:

1) I don't see how you are 'living without any DSR' based on your posted
code.
2) You're signalling a semaphore in the DSR to kick the thread to print 'c',
so this won't work unless you do as Eric suggests.
3) Why are you reading 8 times into 'ier' (you will end up with the scratch
register in 'ier')? To clear the pending modem interrupt, you only need to
read the modem status register (base + 6).
4) You should be looking at IIR to determine if there is a pending
interrupt. Try something like the following for isr() and dsr():

volatile cyg_uint8 iir;
volatile cyg_uint8 msr;

cyg_uint32 isr(cyg_vector_t vector, cyg_addrword_t data)
{
    /* do the work... */
    c++;

    /* Read interrupt ident. register on UART */
    HAL_READ_UINT8(COM_ADDR + 2, iir);
    /* Read modem status register on UART - will clear interrupt too */
    HAL_READ_UINT8(COM_ADDR + 6, msr);
    cyg_interrupt_acknowledge( vector );
    return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
}

void dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    /* (iir == 0x00) -> modem interrupt, (msr & 0x88) -> DDCD=1, DCD=1 */
    if ((iir == 0x00) && (msr & 0x88)) {
        cyg_semaphore_post( &data_ready );
    }
}

Robert Cragie, Design Engineer
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
http://www.jennic.com  Tel: +44 (0) 114 281 2655
_______________________________________________________________

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Piotr
> Trojanek
> Sent: 09 September 2003 09:44
> To: ecos-discuss
> Subject: Re: [ECOS] serial line ISR problem -- again:(
>
>
> On Tue, Sep 09, 2003 at 09:46:39AM +0200, Eric Doenges wrote:
> > If you want your DSR to run, I believe you have to
> > return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
> > here. This may be your problem.
>
> no, I was trying to live without any DSR  -- incrementing 'voilatile int'
> in ISR and printing it in 'for(;;) printf(...)' thread. it doesnt work:(
> ISR doesn't run at all.
>
> --
> Piotr Trojanek
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-09 12:09     ` Eric Doenges
@ 2003-09-10  8:37       ` Piotr Trojanek
  2003-09-10 13:29         ` Eric Doenges
  0 siblings, 1 reply; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10  8:37 UTC (permalink / raw)
  To: ecos-discuss

On Tue, Sep 09, 2003 at 02:10:24PM +0200, Eric Doenges wrote:
> Since I'm not familiar with 16550 programming, I don't know if you are
> using it correctly (you might want to check your code against the
> generic 16550 driver included with eCos).

I use few references both printed and online and I thought I'm familiar
with UART programming until I started playing with ECOS:(

> Are you sure COM1 is located
> at IO address 0x3f8 and uses IRQ 4 ? Many boards' BIOSes allow you to
> change at least the interrupt line used.

I'm 100% sure address is correct. When I poll serial line status
register in for(;;) readen values corresponds to what I see on
osciloscope. The problem is I cannot get ISR to work. I thought it was
some mistake in ECOS interface -- ie. creating thread or assigning to a
wrong vector (actually I have to use CYGNUM_HAL_ISR_MIN + COM_IRQ
instead COM_IRQ).

Or that I have to cug_scheduler_start() to actually enable IRQs.

So if you don't see error in that portion, I belive there is some mistake
in UART initialization. Doesn't it hurd, that ECOS may have already
assigned some ISR to serial port? -- but it shouldn't, as I check it
with HAL_INTERRUPT_IN_USE(), right?

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-09 13:01     ` Robert Cragie
@ 2003-09-10  8:40       ` Piotr Trojanek
  2003-09-10  9:17         ` Robert Cragie
       [not found]         ` <008f01c377fa$b918b780$09496fa6@PredNotebook>
  0 siblings, 2 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10  8:40 UTC (permalink / raw)
  To: ecos-discuss

On Tue, Sep 09, 2003 at 02:01:24PM +0100, Robert Cragie wrote:
> 1) I don't see how you are 'living without any DSR' based on your posted
> code.

I just posted one from my 200 versions, which doesn't work:)

> 2) You're signalling a semaphore in the DSR to kick the thread to print 'c',
> so this won't work unless you do as Eric suggests.

I was trying without semaphore too.

> 3) Why are you reading 8 times into 'ier' (you will end up with the scratch
> register in 'ier')? To clear the pending modem interrupt, you only need to
> read the modem status register (base + 6).

Because I was trying, and reading (base + 6) doesn't work.
That's not the problem -- if it was, I would get my ISR to work only
once, but it doesn't run at all.

> 4) You should be looking at IIR to determine if there is a pending
> interrupt. Try something like the following for isr() and dsr():

But I would have to do it in ISR, which I can't make to work.

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [ECOS] serial line ISR problem -- again:(
  2003-09-10  8:40       ` Piotr Trojanek
@ 2003-09-10  9:17         ` Robert Cragie
  2003-09-10 11:11           ` Piotr Trojanek
       [not found]         ` <008f01c377fa$b918b780$09496fa6@PredNotebook>
  1 sibling, 1 reply; 20+ messages in thread
From: Robert Cragie @ 2003-09-10  9:17 UTC (permalink / raw)
  To: Piotr Trojanek, ecos-discuss

> On Tue, Sep 09, 2003 at 02:01:24PM +0100, Robert Cragie wrote:
> > 1) I don't see how you are 'living without any DSR' based on your posted
> > code.
>
> I just posted one from my 200 versions, which doesn't work:)

It would help if you post truly representative code, i.e the most basic set
which exhibits the problems. Anything else confuses the issue considerably.

Robert Cragie, Design Engineer
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
http://www.jennic.com  Tel: +44 (0) 114 281 2655
_______________________________________________________________


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-10  9:17         ` Robert Cragie
@ 2003-09-10 11:11           ` Piotr Trojanek
       [not found]             ` <00b301c3778e$eb2ecc80$500ba8c0@jasper>
  0 siblings, 1 reply; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 11:11 UTC (permalink / raw)
  To: Robert Cragie, ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

On Wed, Sep 10, 2003 at 10:17:06AM +0100, Robert Cragie wrote:
> It would help if you post truly representative code, i.e the most basic set
> which exhibits the problems. Anything else confuses the issue considerably.

you're right, so here it goes...

the output from my program is:
iid = 0x00, c = 0
msr = 0x88, c = 0
iid = 0x00, c = 0
msr = 0x08, c = 0
... [this loops forever, and this sequence takes about 1 second
(DCD is high for 0.2 second), which coresponds to signal I can see
on osciloscope and my test LED diode]

as you can see, I read Interrupt Identification Register (iid) in UART, and
when it says there is a pending interrupt (iid = 0x00, which also means
that it was interrupt was caused by change on input signal lines) I
simoply reads modem status register to reenable interrupts from UART.

values 0x08 and 0x88 coresponds to signal change on DCD line.

so, there is a proof, that my hardware works fine and exactly as I
expect. all works just fine in polling mode.

now I need to make it works in interrupt mode, but my ISR is not executed
by ECOS. under both Linux and FreeBSD COM1 works fine under IRQ4.

-- 
Piotr Trojanek

[-- Attachment #2: pollintr.c --]
[-- Type: text/x-csrc, Size: 1884 bytes --]

#include <cyg/kernel/kapi.h>
#include <cyg/hal/hal_arch.h>
#include <stdio.h>

volatile unsigned int c;

cyg_interrupt intr;
cyg_handle_t intr_handle;

/*
ttyS00 at 0x03f8 (irq = 4) is a 16550A
ttyS01 at 0x02f8 (irq = 3) is a 16550A
*/

#define	COM_IRQ		4
#define	COM_ADDR	0x3f8

#define CYGNUM_HAL_PRI_HIGH 0

#define PRODUCER_PRIORITY   0
#define PRODUCER_STACKSIZE  CYGNUM_HAL_STACK_SIZE_TYPICAL

unsigned char producer_stack[PRODUCER_STACKSIZE];
cyg_handle_t producer_handle;
cyg_thread producer_thread;
		
cyg_uint32 isr(
        cyg_vector_t vector,
        cyg_addrword_t data)
{
        /* do the work... */
        c++;

        cyg_interrupt_acknowledge( vector );
        return CYG_ISR_HANDLED;
}

void
producer(cyg_addrword_t data)
{
	cyg_uint8 iid;
	cyg_interrupt intr;
	cyg_handle_t intr_handle;
        cyg_vector_t intr_vector = CYGNUM_HAL_ISR_MIN + COM_IRQ;
        cyg_priority_t intr_priority = CYGNUM_HAL_PRI_HIGH;

	cyg_interrupt_create(
			intr_vector,
			intr_priority,
			0,
			isr,
			0,
			&intr_handle,
			&intr);

	cyg_interrupt_attach(intr_handle);
	cyg_interrupt_unmask(intr_vector);

        /* get acces to Interrupt Enable Register */
        HAL_WRITE_UINT8 (COM_ADDR + 3, 0x00);
	/* make UART interrupt on DCD transition */
	HAL_WRITE_UINT8 (COM_ADDR + 1, 0x08);

	printf("start\n");

	for (;;) {
		HAL_READ_UINT8 (COM_ADDR + 2, iid);
		if ((iid & 0x01) == 0x00) {
			/* interrupt pending */
			cyg_uint8 msr;

			printf("iid = 0x%02x, c = %u\n", iid, c);

			/*
			 * read modem status register
			 * to delete interrupt
			 */
			HAL_READ_UINT8 (COM_ADDR + 6, msr);
			printf ("msr = 0x%02x, c = %u\n", msr, c);
		}
	}
}

int main( void)
{
	cyg_thread_create(PRODUCER_PRIORITY, &producer, 0, "producer",
		producer_stack, PRODUCER_STACKSIZE,
		&producer_handle, &producer_thread);
	cyg_thread_resume(producer_handle);

	cyg_scheduler_start();
}


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
       [not found]             ` <00b301c3778e$eb2ecc80$500ba8c0@jasper>
@ 2003-09-10 11:35               ` Piotr Trojanek
       [not found]                 ` <00de01c37797$c3edbb50$500ba8c0@jasper>
  2003-09-11 13:37                 ` [ECOS] eCos demo: "scivoli" David N. Welton
  0 siblings, 2 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 11:35 UTC (permalink / raw)
  To: Chris Garry, ecos-discuss

On Wed, Sep 10, 2003 at 12:30:20PM +0100, Chris Garry wrote:
> What is the value of the UART's 'Interrupt Enable' register?

with this code I get:
ier = 0x00
ier = 0x08
so this is correct.

/* check InterruptEnableRegister value */
HAL_READ_UINT8 (COM_ADDR + 1, ier);
printf ("ier = 0x%02x\n", ier);

/* make UART interrupt only on DCD transition */
HAL_WRITE_UINT8 (COM_ADDR + 1, (ier & 0xf0) | 0x08);

/* check InterruptEnableRegister value */
HAL_READ_UINT8 (COM_ADDR + 1, ier);
printf ("ier = 0x%02x\n", ier);

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
       [not found]                 ` <00de01c37797$c3edbb50$500ba8c0@jasper>
@ 2003-09-10 12:55                   ` Piotr Trojanek
  2003-09-10 14:16                   ` Piotr Trojanek
  1 sibling, 0 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 12:55 UTC (permalink / raw)
  To: Chris Garry, ecos-discuss

On Wed, Sep 10, 2003 at 01:33:40PM +0100, Chris Garry wrote:
> Looking at your code, it looks good to me, I can't see anything really broken.
> I did notice however:
> 
> * intr and intr_handle are defined both globally and inside the producer function.
> 
> * You are calling cyg_scheduler_start() at the end of main() - you shouldn't need to
> do this as the scheduler will already be running when main() is executed.
> 
> * You have set PRODUCER_PRIORITY to 0, I would normally set it lower - say 10.

fixed all of these, still doesn't work:(

> I guess these things have been introduced while you have been trying different versions
> of the code out - but I don't think any of them are the cause of your problem.

exactly:)


> Sorry I can't be of more help.

Thanks.

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-10  8:37       ` Piotr Trojanek
@ 2003-09-10 13:29         ` Eric Doenges
  2003-09-10 13:41           ` Piotr Trojanek
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Doenges @ 2003-09-10 13:29 UTC (permalink / raw)
  To: Piotr Trojanek; +Cc: ecos-discuss

Piotr Trojanek wrote:
[ ... ]
> I'm 100% sure address is correct. When I poll serial line status
> register in for(;;) readen values corresponds to what I see on
> osciloscope. The problem is I cannot get ISR to work. I thought it was
> some mistake in ECOS interface -- ie. creating thread or assigning to a
> wrong vector (actually I have to use CYGNUM_HAL_ISR_MIN + COM_IRQ
> instead COM_IRQ).

The code you posted later in this thread looks OK to me regarding
the setting up of the ISR and should work if the interrupt is actually
triggered. One thing you could try is to configure the 16550 to
request interrupts for all possible interrupt sources to see if
your ISR works in principle.

> So if you don't see error in that portion, I belive there is some mistake
> in UART initialization. Doesn't it hurd, that ECOS may have already
> assigned some ISR to serial port? -- but it shouldn't, as I check it
> with HAL_INTERRUPT_IN_USE(), right?

Not sure about HAL_INTERRUPT_IN_USE, but did you build the eCos serial
driver for the i386 PC target ? If you did, it will most likely conflict
with your code.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-10 13:29         ` Eric Doenges
@ 2003-09-10 13:41           ` Piotr Trojanek
  0 siblings, 0 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 13:41 UTC (permalink / raw)
  To: Eric Doenges, ecos-discuss

On Wed, Sep 10, 2003 at 03:30:13PM +0200, Eric Doenges wrote:
> The code you posted later in this thread looks OK to me regarding
> the setting up of the ISR and should work if the interrupt is actually
> triggered. One thing you could try is to configure the 16550 to
> request interrupts for all possible interrupt sources to see if
> your ISR works in principle.

done -- but ISR still doesn't run. my test device is preety chatty on
TxD line, so I see both 0x08 (change of serial line status signals) and
0x06 code in Interrupt Identification Register -- exactly as I expected.

but 'voilatile unsigned int c' variable is still 0 -- so isn't
incremented in ISR as it should be.

> Not sure about HAL_INTERRUPT_IN_USE, but did you build the eCos serial
> driver for the i386 PC target ? If you did, it will most likely conflict
> with your code.

I was trying both with and without serial driver, both -2.0 and
-current.

As it was written -- I have ISR working on another PC machine, but only
on that one (unfortunately I don't own it any more...) Now I try to get
it work on three other machines and nothing happens.

Hardware is 100% OK -- it works great under Linux and FreeBSD.

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
       [not found]                 ` <00de01c37797$c3edbb50$500ba8c0@jasper>
  2003-09-10 12:55                   ` Piotr Trojanek
@ 2003-09-10 14:16                   ` Piotr Trojanek
  2003-09-10 14:21                     ` Gary Thomas
  1 sibling, 1 reply; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 14:16 UTC (permalink / raw)
  To: Chris Garry, ecos-discuss

On Wed, Sep 10, 2003 at 01:33:40PM +0100, Chris Garry wrote:
> Sorry I can't be of more help.

FOUND THE BUG!

the uart INTRPT pin is combined with OUT2 signal by gate logic.
I needed to set OUT2 (in ModemControlRegister, offset 6) to 1:)

Thanks! :)))

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-10 14:16                   ` Piotr Trojanek
@ 2003-09-10 14:21                     ` Gary Thomas
  2003-09-10 14:26                       ` Piotr Trojanek
  0 siblings, 1 reply; 20+ messages in thread
From: Gary Thomas @ 2003-09-10 14:21 UTC (permalink / raw)
  To: Piotr Trojanek; +Cc: Chris Garry, eCos Discussion

On Wed, 2003-09-10 at 08:15, Piotr Trojanek wrote:
> On Wed, Sep 10, 2003 at 01:33:40PM +0100, Chris Garry wrote:
> > Sorry I can't be of more help.
> 
> FOUND THE BUG!
> 
> the uart INTRPT pin is combined with OUT2 signal by gate logic.
> I needed to set OUT2 (in ModemControlRegister, offset 6) to 1:)

So, is this bug in your code (or platform), or in the common platform
support?  If so, please create a patch so we can update the repository.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] serial line ISR problem -- again:(
  2003-09-10 14:21                     ` Gary Thomas
@ 2003-09-10 14:26                       ` Piotr Trojanek
  0 siblings, 0 replies; 20+ messages in thread
From: Piotr Trojanek @ 2003-09-10 14:26 UTC (permalink / raw)
  To: Gary Thomas, ecos-discuss

On Wed, Sep 10, 2003 at 08:21:39AM -0600, Gary Thomas wrote:
> So, is this bug in your code (or platform), or in the common platform
> support?  If so, please create a patch so we can update the repository.

only in my code:( the problem was, because when playing with other
systems (even with QNX) the serial UART was already initialized, and
OUT2 in modem control register set to 1.

so I thought, I don't need to bother with it at all, but as I see now, I
need to do full UART initialization under ECOS.

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [ECOS] problem regarding exec command in redboot
       [not found]         ` <008f01c377fa$b918b780$09496fa6@PredNotebook>
@ 2003-09-11  0:22           ` Pred
  2003-09-11  2:24           ` Gary Thomas
  1 sibling, 0 replies; 20+ messages in thread
From: Pred @ 2003-09-11  0:22 UTC (permalink / raw)
  To: ecos-discuss

Dear ECOS experts,

I have done a basic HAL port of redboot to my own board, which is based on
pxa255. I enabled the "exec" command by inserting the definition of machine
type. But I encountered difficulty using this command. When I use it to
execute kernel, the system halts. When I use it to execute a image in RAM,
system halts too, while the "go" gets the right result. My port was based on
ECOS 2.0.

How to test if the exec is doing the correct thing? Thanks.

Best regards,
Pred




-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [ECOS] problem regarding exec command in redboot
       [not found]         ` <008f01c377fa$b918b780$09496fa6@PredNotebook>
  2003-09-11  0:22           ` [ECOS] problem regarding exec command in redboot Pred
@ 2003-09-11  2:24           ` Gary Thomas
  1 sibling, 0 replies; 20+ messages in thread
From: Gary Thomas @ 2003-09-11  2:24 UTC (permalink / raw)
  To: Pred; +Cc: eCos Discussion

On Wed, 2003-09-10 at 18:22, Pred wrote:
> Dear ECOS experts,
> 
> I have done a basic HAL port of redboot to my own board, which is based on
> pxa255. I enabled the "exec" command by inserting the definition of machine
> type. But I encountered difficulty using this command. When I use it to
> execute kernel, the system halts. When I use it to execute a image in RAM,
> system halts too, while the "go" gets the right result. My port was based on
> ECOS 2.0.
> 
> How to test if the exec is doing the correct thing? Thanks.

The 'exec' command is only useful for starting a Linux kernel.
Use 'go' to run eCos programs.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [ECOS] eCos demo: "scivoli"
  2003-09-10 11:35               ` Piotr Trojanek
       [not found]                 ` <00de01c37797$c3edbb50$500ba8c0@jasper>
@ 2003-09-11 13:37                 ` David N. Welton
  1 sibling, 0 replies; 20+ messages in thread
From: David N. Welton @ 2003-09-11 13:37 UTC (permalink / raw)
  To: ecos-discuss


I am going to go ahead and release my eCos demo "Scivoli" (a bad play
on words - it means 'slides', but the kind in a playground, not the
image kind).

    Scivoli is a demonstration of the eCos embedded operating
    system. It is a self-contained, bootable image viewer that can be
    written to a floppy disk together with an archive of jpeg's. It
    will then boot and loop through the jpeg images. It requires a VBE
    compatible video card to function. Many, but all modern video
    cards meet this criteria.

    The Scivoli distribution includes code to create your own image
    archives.

Both the code and a sample disk image are available from

    http://www.dedasys.com/freesoftware/

I don't think the license quite qualifies as free software - I ask
that if you use the application that you continue to use the splash
screen I have created, or give me visible credit in some other way.
Feel free to contact me if you want to use some bit of code for other
purposes though - I don't think that's not a problem.  Infact, I am
still interested in donating the floppy driver to eCos itself, if it's
not too ugly.

Scivoli will be featured in an upcoming article in "Hackers & Co." (
http://www.oltrelinux.com/ ) an Italian programming/security oriented
magazine.

A big thanks to everyone who has worked on eCos(*) and answered my
questions!

Ciao,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

* As I said earlier, dinner/wine/beer/whatever awaits you in Padova,
  Italy.

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2003-09-11  8:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 17:13 [ECOS] serial line ISR problem -- again:( Piotr Trojanek
2003-09-08 17:17 ` Piotr Trojanek
2003-09-09  7:46 ` Eric Doenges
2003-09-09  8:44   ` Piotr Trojanek
2003-09-09 12:09     ` Eric Doenges
2003-09-10  8:37       ` Piotr Trojanek
2003-09-10 13:29         ` Eric Doenges
2003-09-10 13:41           ` Piotr Trojanek
2003-09-09 13:01     ` Robert Cragie
2003-09-10  8:40       ` Piotr Trojanek
2003-09-10  9:17         ` Robert Cragie
2003-09-10 11:11           ` Piotr Trojanek
     [not found]             ` <00b301c3778e$eb2ecc80$500ba8c0@jasper>
2003-09-10 11:35               ` Piotr Trojanek
     [not found]                 ` <00de01c37797$c3edbb50$500ba8c0@jasper>
2003-09-10 12:55                   ` Piotr Trojanek
2003-09-10 14:16                   ` Piotr Trojanek
2003-09-10 14:21                     ` Gary Thomas
2003-09-10 14:26                       ` Piotr Trojanek
2003-09-11 13:37                 ` [ECOS] eCos demo: "scivoli" David N. Welton
     [not found]         ` <008f01c377fa$b918b780$09496fa6@PredNotebook>
2003-09-11  0:22           ` [ECOS] problem regarding exec command in redboot Pred
2003-09-11  2:24           ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).