Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i learned the ipipe trace that i send you but i don't unserstand why i 
have three timer reprogramming in few useconds.


Can you explain me the behaviour ?



Il 08/04/2012 00:17, Gilles Chanteperdrix ha scritto:

On 04/06/2012 06:59 PM, Roberto Bielli wrote:

Hi Gilles,

i made all your modifies and re-read all corect register but the problem
is the same.

Ok. What I would do at this point is check whether linux has the same
issue. You can also check the processor errata to see if there is no
issue with the timer.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:18 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i learned the ipipe trace that i send you but i don't unserstand why i 
 have three timer reprogramming in few useconds.
 
 Can you explain me the behaviour ?

Can you resend the trace and give us the time where this happens?
Anyway, the timer function must work even if the timer has already been
programmed, it is normal to reprogram the timer while it has been
programmed for instance when adding or removing a timer.


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

I don't find the end of last __ipipe_grab_irq in the trace that i send you.
Is it correct ?

Il 08/04/2012 00:17, Gilles Chanteperdrix ha scritto:

On 04/06/2012 06:59 PM, Roberto Bielli wrote:

Hi Gilles,

i made all your modifies and re-read all corect register but the problem
is the same.

Ok. What I would do at this point is check whether linux has the same
issue. You can also check the processor errata to see if there is no
issue with the timer.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:43 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 I don't find the end of last __ipipe_grab_irq in the trace that i send you.
 Is it correct ?

Yes, because the timer interrupt reschedules and wakes up the periodic
task. I had a look at the timer programming events, it is true that the
timer ticks more often than it should. Generally, this is an indication
that the timer frequency is not what xenomai believe it is. xenomai idea
of the timer frequency is given by __ipipe_mach_ticks_per_jiffy. Anyway,
this should not cause the timer not to tick, only to tick it more often.

What you should do now is try and reproduce the same conditions under an
unpatched linux to see if you get the same phenomenon.

Did you have a look a the processor errata ?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata 
elements on timer.

I see that tsc uses the same timer.

Does xenomai use the tsc for the next timer period ?



Il 10/04/2012 10:45, Gilles Chanteperdrix ha scritto:

On 04/10/2012 10:43 AM, Roberto Bielli wrote:

Hi Gilles,

I don't find the end of last __ipipe_grab_irq in the trace that i send you.
Is it correct ?

Yes, because the timer interrupt reschedules and wakes up the periodic
task. I had a look at the timer programming events, it is true that the
timer ticks more often than it should. Generally, this is an indication
that the timer frequency is not what xenomai believe it is. xenomai idea
of the timer frequency is given by __ipipe_mach_ticks_per_jiffy. Anyway,
this should not cause the timer not to tick, only to tick it more often.

What you should do now is try and reproduce the same conditions under an
unpatched linux to see if you get the same phenomenon.

Did you have a look a the processor errata ?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.
 I see that tsc uses the same timer.
 
 Does xenomai use the tsc for the next timer period ?

If you look at the trace, you will see that with the timer@ event that
the timer is supposedly programmed for the right time. For instance at
-84748, the timer is programmed to tick at -83749, which is around
1000us later and is what we would expect. So, the tsc is out of the
issue. The issue is the timer.

For the third time I tell you, you should now try and reproduce the same
issue with an unpatched linux.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:06 AM, Gilles Chanteperdrix wrote:
 On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,

 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.
 
 It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
 support imx25.
 
 The I-pipe support has not been written for imx25, so, it is entirely
 possible that you have to adapt it. See:
 http://www.xenomai.org/index.php/I-pipe:ArmPorting
 
Latest kernels support imx25, and imx25 works like an mx3, not an mx2,
can you show me arch/arm/plat-mxc/time.c for your (undoubtedly) patched
kernel?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

the steps for supporting imx25 have been:
1. We buy a board with imx25
2. Our supplier made the porting of linux 2.6.31 freescale with  imx25
3. we put a xenomai  2.5.6 and we have adapted for imx25. The only 
changes is this (because imx25 registers are identical to mx3 ):


old:
#define timer_is_v2()(cpu_is_mx3() || cpu_is_mx5())

new:
#define timer_is_v2()(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())





Il 10/04/2012 11:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 10:58 AM, Roberto Bielli wrote:

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata
elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

here is my time.c



Il 10/04/2012 11:11, Gilles Chanteperdrix ha scritto:

On 04/10/2012 11:06 AM, Gilles Chanteperdrix wrote:

On 04/10/2012 10:58 AM, Roberto Bielli wrote:

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata
elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting


Latest kernels support imx25, and imx25 works like an mx3, not an mx2,
can you show me arch/arm/plat-mxc/time.c for your (undoubtedly) patched
kernel?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

/*
 *  linux/arch/arm/plat-mxc/time.c
 *
 *  Copyright (C) 2000-2001 Deep Blue Solutions
 *  Copyright (C) 2002 Shane Nay (sh...@minirl.com)
 *  Copyright (C) 2006-2007 Pavel Pisa (pp...@pikron.com)
 *  Copyright (C) 2008 Juergen Beisert (ker...@pengutronix.de)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#include linux/interrupt.h
#include linux/irq.h
#include linux/clockchips.h
#include linux/clk.h

#include mach/hardware.h
#include asm/mach/time.h
#include mach/common.h

/* defines common for all i.MX */
#define MXC_TCTL0x00
#define MXC_TCTL_TEN(1  0)
#define MXC_TPRER   0x04

/* MX1, MX21, MX27 */
#define MX1_2_TCTL_CLK_PCLK1(1  1)
#define MX1_2_TCTL_IRQEN(1  4)
#define MX1_2_TCTL_FRR  (1  8)
#define MX1_2_TCMP  0x08
#define MX1_2_TCN   0x10
#define MX1_2_TSTAT 0x14

/* MX21, MX27 */
#define MX2_TSTAT_CAPT  (1  1)
#define MX2_TSTAT_COMP  (1  0)

/* MX31, MX35, MX25 */
#define MX3_TCTL_WAITEN (1  3)
#define MX3_TCTL_CLK_IPG(1  6)
#define MX3_TCTL_CLK_PER(2  6)
#define MX3_TCTL_FRR(1  9)
#define MX3_IR  0x0c
#define MX3_TSTAT   0x08
#define MX3_TSTAT_OF1   (1  0)
#define MX3_TCN 0x24
#define MX3_TCMP0x10

#ifdef CONFIG_IPIPE
#ifdef CONFIG_NO_IDLE_HZ
#error dynamic tick timer not yet supported with IPIPE
#endif /* CONFIG_NO_IDLE_HZ */
int __ipipe_mach_timerint;

Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:19 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 the steps for supporting imx25 have been:
 1. We buy a board with imx25
 2. Our supplier made the porting of linux 2.6.31 freescale with  imx25
 3. we put a xenomai  2.5.6 and we have adapted for imx25. The only 
 changes is this (because imx25 registers are identical to mx3 ):
 
 old:
 #define timer_is_v2()(cpu_is_mx3() || cpu_is_mx5())
 
 new:
 #define timer_is_v2()(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())
 

Yes, but if you use the unchanged adeos patch, it uses if (cpu_is_mx3())
in tsc and timer code, whereas it should use if (timer_is_v2()),
timer_is_v2 is not present in vanilla linux code.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:21 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 here is my time.c

Looks fine, though I do not understand why you do not use timer_is_v2
instead of cpu_is_mx3 || cpu_is_mx25. I think the problem is elsewhere,
and I suggest you check whether linux without xenomai has or has not the
same issue.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:21 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 here is my time.c

Though you have not made all the changes I suggested. Here is the time.c
I would use.

-- 
Gilles.
/*
 *  linux/arch/arm/plat-mxc/time.c
 *
 *  Copyright (C) 2000-2001 Deep Blue Solutions
 *  Copyright (C) 2002 Shane Nay (sh...@minirl.com)
 *  Copyright (C) 2006-2007 Pavel Pisa (pp...@pikron.com)
 *  Copyright (C) 2008 Juergen Beisert (ker...@pengutronix.de)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#include linux/interrupt.h
#include linux/irq.h
#include linux/clockchips.h
#include linux/clk.h

#include mach/hardware.h
#include asm/mach/time.h
#include mach/common.h

/* defines common for all i.MX */
#define MXC_TCTL		0x00
#define MXC_TCTL_TEN		(1  0)
#define MXC_TPRER		0x04

/* MX1, MX21, MX27 */
#define MX1_2_TCTL_CLK_PCLK1	(1  1)
#define MX1_2_TCTL_IRQEN	(1  4)
#define MX1_2_TCTL_FRR		(1  8)
#define MX1_2_TCMP		0x08
#define MX1_2_TCN		0x10
#define MX1_2_TSTAT		0x14

/* MX21, MX27 */
#define MX2_TSTAT_CAPT		(1  1)
#define MX2_TSTAT_COMP		(1  0)

/* MX31, MX35, MX25 */
#define MX3_TCTL_WAITEN		(1  3)
#define MX3_TCTL_CLK_IPG	(1  6)
#define MX3_TCTL_CLK_PER	(2  6)
#define MX3_TCTL_FRR		(1  9)
#define MX3_IR			0x0c
#define MX3_TSTAT		0x08
#define MX3_TSTAT_OF1		(1  0)
#define MX3_TCN			0x24
#define MX3_TCMP		0x10

#ifdef CONFIG_IPIPE
#ifdef CONFIG_NO_IDLE_HZ
#error dynamic tick timer not yet supported with IPIPE
#endif /* CONFIG_NO_IDLE_HZ */
int __ipipe_mach_timerint;
EXPORT_SYMBOL(__ipipe_mach_timerint);

int __ipipe_mach_timerstolen = 0;
EXPORT_SYMBOL(__ipipe_mach_timerstolen);

unsigned int __ipipe_mach_ticks_per_jiffy = LATCH;
EXPORT_SYMBOL(__ipipe_mach_ticks_per_jiffy);

static int mxc_timer_initialized;
static unsigned mxc_min_delay;

union tsc_reg {
#ifdef __BIG_ENDIAN
	struct {
		unsigned long high;
		unsigned long low;
	};
#else /* __LITTLE_ENDIAN */
	struct {
		unsigned long low;
		unsigned long high;
	};
#endif /* __LITTLE_ENDIAN */
	unsigned long long full;
};

#ifdef CONFIG_SMP
static union tsc_reg tsc[NR_CPUS];

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
	info-type = IPIPE_TSC_TYPE_NONE;
}

#else /* !CONFIG_SMP */
static union tsc_reg *tsc;

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
	info-type = IPIPE_TSC_TYPE_FREERUNNING;
	if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
		info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
	} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
		info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
	} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
		info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
	}
	info-u.fr.mask = 0x;
	info-u.fr.tsc = tsc-full;
}
#endif /* !CONFIG_SMP */

static void ipipe_mach_update_tsc(void);
#endif /* CONFIG_IPIPE */

#define timer_is_v2()	(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())

static struct clock_event_device clockevent_mxc;
static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;

static void __iomem *timer_base;

static inline void gpt_irq_disable(void)
{
	unsigned int tmp;

	if (timer_is_v2())
		__raw_writel(0, timer_base + MX3_IR);
	else {
		tmp = __raw_readl(timer_base + MXC_TCTL);
		__raw_writel(tmp  ~MX1_2_TCTL_IRQEN, timer_base + MXC_TCTL);
	}
}

static inline void gpt_irq_enable(void)
{
	if (timer_is_v2())
		__raw_writel(10, timer_base + MX3_IR);
	else {
		__raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN,
			timer_base + MXC_TCTL);
	}
}

static void gpt_irq_acknowledge(void)
{
	if (!timer_is_v2()) {
		if (cpu_is_mx1())
			__raw_writel(0, timer_base + MX1_2_TSTAT);
		else
			__raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP, timer_base + MX1_2_TSTAT);
	} else
		__raw_writel(MX3_TSTAT_OF1, timer_base + MX3_TSTAT);
}

static cycle_t timer_v1_get_cycles(struct clocksource *cs)
{
	return __raw_readl(timer_base + MX1_2_TCN);
}

static cycle_t timer_v2_get_cycles(struct clocksource *cs)
{
	return __raw_readl(timer_base + MX3_TCN);
}

static struct clocksource clocksource_mxc = {
	.name		= mxc_timer1,
	.rating		= 200,
	.read		= timer_v1_get_cycles,
	.mask		= CLOCKSOURCE_MASK(32),
	.shift		= 20,
	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
};


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.






Il 10/04/2012 11:37, Gilles Chanteperdrix ha scritto:

On 04/10/2012 11:21 AM, Roberto Bielli wrote:

Hi Gilles,

here is my time.c

Though you have not made all the changes I suggested. Here is the time.c
I would use.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i tried your code but th behavior is the same.
 
 Then i tried a linux base app and works correctly.

The tsc physical address passed to user-space looks wrong.

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
info-type = IPIPE_TSC_TYPE_FREERUNNING;
if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
}
info-u.fr.mask = 0x;
info-u.fr.tsc = tsc-full;
}

Here cpu_is_mx2() will return true, and we will not go to cpu_is_mx25().

Are you using the tsc in user-space?

If you are passing --enable-arm-mach=mx2 to xenomai configure 
script, you are using the tsc in user-space, and it is a wonder 
how it works.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i tried your code but th behavior is the same.
 
 Then i tried a linux base app and works correctly.

In the exact same conditions? With the crunching task running with
SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
priority 99, and the linux real-time throttling disabled?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and 
imx25 is NOT mx2

#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i 
disable tsc and xenomai continue work correctly ?


However i cannot use tsc in my simple application. I resend the simple C 
application that doesn't work.



Il 10/04/2012 13:25, Gilles Chanteperdrix ha scritto:

On 04/10/2012 12:39 PM, Roberto Bielli wrote:

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.

The tsc physical address passed to user-space looks wrong.

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
info-type = IPIPE_TSC_TYPE_FREERUNNING;
if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
}
info-u.fr.mask = 0x;
info-u.fr.tsc =tsc-full;
}

Here cpu_is_mx2() will return true, and we will not go to cpu_is_mx25().

Are you using the tsc in user-space?

If you are passing --enable-arm-mach=mx2 to xenomai configure
script, you are using the tsc in user-space, and it is a wonder
how it works.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

#include stdio.h
#include stdint.h
#include fcntl.h
#include sys/ioctl.h
#include string.h

#include stdlib.h
#include stdio.h
#include sys/mman.h   /* for MCL_CURRENT and MCL_FUTURE */
#include rtdm/rtdm.h
#include native/task.h
#include nucleus/trace.h

#define GPIO6_ON*Gpio2ValAddr |= 1  6
#define GPIO6_OFF   *Gpio2ValAddr = ~(1  6);

static RT_TASK rt_task_desc;
static RT_TASK tsk2ms;

//dati per la gestione memoria mappata
static unsigned long * Gpio2ValAddr = NULL;

volatile int cnt2ms = 0;
volatile int cntmain = 0;
volatile int x;

void funct2ms( void * params )
{
for(;;)
{
GPIO6_ON;
rt_task_sleep( 200 );
++ cnt2ms;
GPIO6_OFF;
}
}

int main(int argc, char *argv[])
{
int count = 0;
int traceOn = 0;
int fd, ret;

// no memory-swapping for this programm
ret = mlockall(MCL_CURRENT | MCL_FUTURE);
if( ret )
{
perror(ERROR : mlockall has failled);
exit(1);
}


fd = open( /dev/mem, O_RDWR | O_SYNC );

Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Il 10/04/2012 14:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:05 PM, Roberto Bielli wrote:

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
  tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and
imx25 is NOT mx2
#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i
disable tsc and xenomai continue work correctly ?

Xenomai needs the tsc in kernel-space. Obviously, if you do not use the
tsc in user-space, you will not see that it is wrong. Correct physical
address is only needed for user-space.


However i cannot use tsc in my simple application. I resend the simple C
application that doesn't work.

What do you mean you can not use the tsc in your application? What
happens if you use it?


If i use tsc i have no error and i read a correct value.

--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

here is some logs.

status=on:setup=616:clock=509343446344:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509413956366:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=50946186:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509493738137:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509642692217:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509889401336:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509959233537:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510033716418:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510083589650:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510145433674:timerdev=mxc_timer1:clockdev=mxc_timer1

Il 10/04/2012 14:12, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:11 PM, Roberto Bielli wrote:

Il 10/04/2012 14:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:05 PM, Roberto Bielli wrote:

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
   tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and
imx25 is NOT mx2
#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i
disable tsc and xenomai continue work correctly ?

Xenomai needs the tsc in kernel-space. Obviously, if you do not use the
tsc in user-space, you will not see that it is wrong. Correct physical
address is only needed for user-space.


However i cannot use tsc in my simple application. I resend the simple C
application that doesn't work.

What do you mean you can not use the tsc in your application? What
happens if you use it?


If i use tsc i have no error and i read a correct value.


So, it works. Good news. To know if it works as expected, you can try
the latency test.

Something I have not asked, could you type:
cat /proc/xenomai/timer

on the mx25 board?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 02:33 PM, Roberto Bielli wrote:
 Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,

 i tried your code but th behavior is the same.

 Then i tried a linux base app and works correctly.
 In the exact same conditions? With the crunching task running with
 SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
 priority 99, and the linux real-time throttling disabled?

 Yes, and i see that every LATCH ( about ~10ms ) period the task with 
 higher priority is wakeup.
 So a task with lower priority is interrupted by timer interrupt and 
 reschedule the task with higher priority.
 
You need CONFIG_HIGH_RES_TIMERS to be in the same case as xenomai.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli
In the xenomai example the task periodic is 2ms not 200us. ( 
rt_task_sleep( 2ms 000us 000ns ) );
And the 10ms is because the default system time period of the timer 
without xenomai is ~10ms.
So a process that execute in linux base can be re-scheduled only when 
the timer generate an interrupt , the task makes I/O, or sleeps.




Il 10/04/2012 14:36, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:33 PM, Roberto Bielli wrote:

Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:

On 04/10/2012 12:39 PM, Roberto Bielli wrote:

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.

In the exact same conditions? With the crunching task running with
SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
priority 99, and the linux real-time throttling disabled?


Yes, and i see that every LATCH ( about ~10ms ) period the task with
higher priority is wakeup.

In the example you sent the periodic task was running with a 200us
period, not 10ms.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 02:58 PM, Roberto Bielli wrote:
 In the xenomai example the task periodic is 2ms not 200us. ( 
 rt_task_sleep( 2ms 000us 000ns ) );

sorry, I misred.

 And the 10ms is because the default system time period of the timer 
 without xenomai is ~10ms.
 So a process that execute in linux base can be re-scheduled only when 
 the timer generate an interrupt , the task makes I/O, or sleeps.

That is only if you do not use CONFIG_HIGH_RES_TIMERS, in which case you
are not in the same configuration as xenomai, and the test does not mean
anything.

 
 
 
 Il 10/04/2012 14:36, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 02:33 PM, Roberto Bielli wrote:
 Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,

 i tried your code but th behavior is the same.

 Then i tried a linux base app and works correctly.
 In the exact same conditions? With the crunching task running with
 SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
 priority 99, and the linux real-time throttling disabled?

 Yes, and i see that every LATCH ( about ~10ms ) period the task with
 higher priority is wakeup.
 In the example you sent the periodic task was running with a 200us
 period, not 10ms.

 
 


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core