All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roberto Bielli <roberto.bielli@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] preemptive doesn't work
Date: Tue, 10 Apr 2012 14:05:11 +0200	[thread overview]
Message-ID: <4F8421F7.50807@domain.hid> (raw)
In-Reply-To: <4F8418C4.400@domain.hid>

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

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 = 0xffffffff;
> 	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.bielli@domain.hid	
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: info@domain.hid

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.  			
							
+------------------------------------------------------------------------------------------------+


[-- Attachment #2: testpreempt.c --]
[-- Type: text/plain, Size: 1696 bytes --]

#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( 2000000 );
		++ 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 );
	printf( "FD=%d", fd );
	fflush( stdout );

	Gpio2ValAddr = (unsigned long  *)mmap(  NULL, 0x1000, PROT_READ | PROT_WRITE,  MAP_SHARED, fd, 0x53FD0000 );
	GPIO6_ON;
	GPIO6_OFF;

	rt_task_create( &tsk2ms, "task2ms",0, 99, 0 );
	rt_task_start( &tsk2ms, funct2ms, NULL );
	
	ret = rt_task_shadow(&rt_task_desc, NULL, 1, 0);
	if( ret != 0 )
	{
		fprintf(stderr, "ERROR : rt_task_shadow: %s\n", strerror(-ret));
		exit( 1 );
	}

	for(;;)
	{
		for( x=0; x < 1000000; x++ );
		for( x=0; x < 1000000; x++ );
		//xntrace_user_freeze(0, 0);
		for( x=0; x < 1000000; x++ );
		for( x=0; x < 1000000; x++ );
		rt_task_sleep( 10000000 );
	}

	return 0;
}

  reply	other threads:[~2012-04-10 12:05 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02 10:42 [Xenomai-core] Xenomai server down Gilles Chanteperdrix
2012-03-06  7:55 ` [Xenomai-core] preemptive doesn't work Roberto Bielli
2012-03-06  9:22   ` Gilles Chanteperdrix
     [not found]     ` <4F55E390.8090706@domain.hid>
2012-03-06 12:09       ` [Xenomai-help] " Gilles Chanteperdrix
2012-03-06 13:00         ` Roberto Bielli
2012-03-06 13:04           ` Gilles Chanteperdrix
2012-03-06 15:14             ` Roberto Bielli
2012-03-06 15:20               ` Gilles Chanteperdrix
2012-03-06 15:35                 ` Roberto Bielli
2012-03-06 16:16                   ` Gilles Chanteperdrix
2012-03-07 12:59                     ` Roberto Bielli
2012-03-07 13:44                       ` Gilles Chanteperdrix
2012-03-07 18:13                         ` Roberto Bielli
2012-03-13 10:45                           ` [Xenomai-core] Fwd: " Roberto Bielli
2012-03-13 11:44                           ` [Xenomai-core] " Gilles Chanteperdrix
2012-03-13 12:10                             ` Gilles Chanteperdrix
2012-04-04  9:21                           ` Gilles Chanteperdrix
2012-04-04  9:29                             ` Roberto Bielli
2012-04-04  9:45                               ` Gilles Chanteperdrix
2012-04-06 15:35                                 ` Roberto Bielli
2012-04-06 15:40                                   ` Gilles Chanteperdrix
2012-04-06 16:59                                     ` Roberto Bielli
2012-04-07 22:17                                       ` Gilles Chanteperdrix
2012-04-10  8:18                                         ` Roberto Bielli
2012-04-10  8:22                                           ` Gilles Chanteperdrix
2012-04-10  8:43                                         ` Roberto Bielli
2012-04-10  8:45                                           ` Gilles Chanteperdrix
2012-04-10  8:58                                             ` Roberto Bielli
2012-04-10  9:00                                               ` Gilles Chanteperdrix
2012-04-10  9:06                                               ` Gilles Chanteperdrix
2012-04-10  9:11                                                 ` Gilles Chanteperdrix
2012-04-10  9:21                                                   ` Roberto Bielli
2012-04-10  9:27                                                     ` Gilles Chanteperdrix
2012-04-10  9:37                                                     ` Gilles Chanteperdrix
2012-04-10 10:39                                                       ` Roberto Bielli
2012-04-10 11:25                                                         ` Gilles Chanteperdrix
2012-04-10 12:05                                                           ` Roberto Bielli [this message]
2012-04-10 12:06                                                             ` Gilles Chanteperdrix
2012-04-10 12:11                                                               ` Roberto Bielli
2012-04-10 12:12                                                                 ` Gilles Chanteperdrix
2012-04-10 12:18                                                                   ` Roberto Bielli
2012-04-10 11:49                                                         ` Gilles Chanteperdrix
2012-04-10 12:33                                                           ` Roberto Bielli
2012-04-10 12:36                                                             ` Gilles Chanteperdrix
2012-04-10 12:58                                                               ` Roberto Bielli
2012-04-10 15:55                                                                 ` Gilles Chanteperdrix
2012-04-10 12:40                                                             ` Gilles Chanteperdrix
2012-04-11  6:59                                                               ` Roberto Bielli
2012-04-11 11:59                                                                 ` Gilles Chanteperdrix
2012-04-11 12:10                                                                 ` Gilles Chanteperdrix
2012-04-12 10:12                                                                   ` Roberto Bielli
2012-04-12 16:58                                                                     ` [Xenomai-core] porting xenomai on imx25 Roberto Bielli
2012-04-12 17:40                                                                       ` Gilles Chanteperdrix
2012-04-13  8:44                                                                         ` Roberto Bielli
2012-04-13 13:47                                                                           ` Gilles Chanteperdrix
2012-04-18  8:44                                                                             ` Roberto Bielli
2012-04-18  9:19                                                                               ` Gilles Chanteperdrix
2012-04-18 10:28                                                                                 ` Roberto Bielli
2012-04-18 11:51                                                                                   ` Gilles Chanteperdrix
2012-04-19  8:52                                                                                     ` Roberto Bielli
2012-04-19  8:54                                                                                       ` Gilles Chanteperdrix
2012-04-19  9:01                                                                                         ` Roberto Bielli
2012-04-19  9:02                                                                                           ` Gilles Chanteperdrix
2012-04-19 12:11                                                                                             ` Gilles Chanteperdrix
2012-04-12 17:32                                                                     ` [Xenomai-core] preemptive doesn't work Gilles Chanteperdrix
2012-04-10 12:52                                                             ` Gilles Chanteperdrix
2012-04-10  9:19                                                 ` Roberto Bielli
2012-04-10  9:19                                                   ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8421F7.50807@domain.hid \
    --to=roberto.bielli@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.