[Armadeus-commitlog] SF.net SVN: armadeus:[1189] trunk/target/demos/real_time
Brought to you by:
sszy
|
From: <gwe...@us...> - 2009-03-24 14:46:59
|
Revision: 1189
http://armadeus.svn.sourceforge.net/armadeus/?rev=1189&view=rev
Author: gwenhael
Date: 2009-03-24 14:46:53 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
[DEMOS] translations and typographic corrections
Modified Paths:
--------------
trunk/target/demos/real_time/fractal/main.c
trunk/target/demos/real_time/interrupt/linux/kernel/interrupt_linux_kernel.c
trunk/target/demos/real_time/interrupt/linux/user_space/interrupt_linux_us.c
trunk/target/demos/real_time/interrupt/xenomai/kernel/interrupt_xeno_kernel.c
trunk/target/demos/real_time/interrupt/xenomai/user_space/interrupt_xeno_userspace.c
trunk/target/demos/real_time/pulse/linux/kernel/sleep_kernel/pulse_linux_kernel_sleep.c
trunk/target/demos/real_time/pulse/linux/kernel/timer_kernel/pulse_linux_kernel_timer.c
trunk/target/demos/real_time/pulse/linux/user_space/sleep/pulse_linux_userspace_sleep.c
trunk/target/demos/real_time/pulse/linux/user_space/timer/pulse_linux_userspace_timer.c
trunk/target/demos/real_time/pulse/xenomai/kernel/rt_timer/pulse_xeno_kernel_rt_timer.c
trunk/target/demos/real_time/pulse/xenomai/kernel/timer_kernel/pulse_xeno_kernel_timer.c
Modified: trunk/target/demos/real_time/fractal/main.c
===================================================================
--- trunk/target/demos/real_time/fractal/main.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/fractal/main.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -56,9 +56,7 @@
} elemPict;
-/* methode utilisee pour le fils pour
- * faire son calcul
- */
+/* used by children process */
void workChildren(elemPict *ep) {
float ii,ri,r,i;
int yy = 0,y=0;
@@ -98,11 +96,11 @@
}
-/* Travail fait par le maitre */
+/* Used by the master */
void workMaster(int *tabChildPipe, int global) {
int nbChild = NB_CHILD;
int i,lignDeb;
- // Envoi de la commande de traitement
+ // Sending the command processing
elemPict ep;
for (i=0,lignDeb=0;i<NB_CHILD;i++,lignDeb+=24) {
ep.x=0;
@@ -112,8 +110,8 @@
write(tabChildPipe[i],&ep,sizeof(elemPict));
}
- // Mise en attente de l'ensemble des calculs
- do {
+ // Queuing of all the calculations
+ do {
int size = read(global,&ep,sizeof(elemPict)+1);
printf("recu de %d debut %d fin %d\n",ep.numFils,ep.y,ep.height+ep.numFils);
if (size != sizeof(elemPict)) {
@@ -141,20 +139,16 @@
close(reception[LECTURE]);
}
-/* pipe : 0 => lecture dans le pipe , 1 => ecriture dans le pipe */
-
int main(int argc, char **argv) {
int global[2];
int tabChildPipe[NB_CHILD];
int pidChildPipe[NB_CHILD];
- /* Preparation de la pipe commune
- * enfant vers pere
- */
+
if (pipe(global) == -1) {
perror("pipeToMaster");
return(EXIT_FAILURE);
}
- /* Création de tous les processus fils */
+ /* Children process creation */
int pos;
int receptionFils[2];
for (pos = 0; pos < NB_CHILD; pos ++ ) {
@@ -168,30 +162,26 @@
printf("ca merde\n");
return -1;
break;
- case 0: // Fiston
+ case 0:
prepareChild(receptionFils, global);
return EXIT_SUCCESS;
break;
- default: // C'est le pere
- // Fermeture de la lecture
+ default:
close(receptionFils[LECTURE]);
tabChildPipe[pos] = receptionFils[ECRITURE];
pidChildPipe[pos] = pid;
break;
}
}
- // C'est plus que le code du pere
close(global[ECRITURE]);
int fbfd = init_lcd();
workMaster(tabChildPipe,global[LECTURE]);
- close(global[LECTURE]); // Fermeture du pipe d'ecoute
- // Fermeture des pipes des enfants
+ close(global[LECTURE]);
+
for (pos = 0; pos < 1; pos++) {
close (tabChildPipe[pos]);
}
- // Fermeture du framebuffer
close(fbfd);
- // Mise en attente de la fin des autres
for (pos = 0; pos<1;pos ++) {
waitpid(pidChildPipe[pos],NULL,0);
}
Modified: trunk/target/demos/real_time/interrupt/linux/kernel/interrupt_linux_kernel.c
===================================================================
--- trunk/target/demos/real_time/interrupt/linux/kernel/interrupt_linux_kernel.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/interrupt/linux/kernel/interrupt_linux_kernel.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -38,7 +38,7 @@
/* irq handler */
irqreturn_t interrupt_handler (int irqn, void *dev){
- printk("toto plop\n");
+ printk("IT !\n");
return IRQ_HANDLED;
}
@@ -46,9 +46,9 @@
static int __init irq_init(void) {
int err;
printk("irq init\n");
- err =request_irq(IRQ_NB, interrupt_handler, 0/*IRQF_SHARED*/,"test irq", NULL);
+ err =request_irq(IRQ_NB, interrupt_handler, 0,"test irq", NULL);
if (err!=0){
- printk(KERN_INFO "erreur de request_irq\n");
+ printk(KERN_INFO "request_irq : error ");
switch (err) {
case -EINVAL:
printk("EINVAL\n");
@@ -65,7 +65,7 @@
}
return err;
}
- set_irq_type( IRQ_NB, IRQF_TRIGGER_FALLING ); //pour changer le front
+ set_irq_type( IRQ_NB, IRQF_TRIGGER_FALLING );
return 0;
}
Modified: trunk/target/demos/real_time/interrupt/linux/user_space/interrupt_linux_us.c
===================================================================
--- trunk/target/demos/real_time/interrupt/linux/user_space/interrupt_linux_us.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/interrupt/linux/user_space/interrupt_linux_us.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -1,3 +1,26 @@
+/*
+* linux userspace apps for handling interrupts
+*
+* Copyright (C) 2009 <gwe...@ar...>
+* Armadeus Project / Armadeus Systems
+*
+*
+* 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -23,15 +46,7 @@
int fd, res, oflags, retval = 0;
unsigned int buffer;
char buf[255];
-//struct sigaction oa;
-// struct sigaction sa;
- // sa.sa_sigaction = action;
- //sa.sa_flags = 0;
- //sa.sa_restorer = NULL;
- //sigemptyset(&sa.sa_mask);
- //sigaction (SIGIO, &sa, &oa);
-
// Open gpio file device for communication;
fd = open ("/dev/gpio/PA6", O_RDONLY);
if (fd < 0)
@@ -46,14 +61,6 @@
{
printf ("F_SETOWN fails \n");
}
- //retval = 0;
- // enable the gpio async notifications
- //oflags = fcntl (fd, F_GETFL);
- //retval = fcntl (fd, F_SETFL, oflags | FASYNC);
- /*if (retval < 0)
- {
- printf ("F_SETFL Fails \n");
- }*/
while (STOP == FALSE)
{
usleep (100000);
Modified: trunk/target/demos/real_time/interrupt/xenomai/kernel/interrupt_xeno_kernel.c
===================================================================
--- trunk/target/demos/real_time/interrupt/xenomai/kernel/interrupt_xeno_kernel.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/interrupt/xenomai/kernel/interrupt_xeno_kernel.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -32,7 +32,7 @@
MODULE_LICENSE("GPL");
-#define IRQ_NUMBER 70 /* Intercept interrupt #7 */
+#define IRQ_NUMBER 70 /* Intercept interrupt on portA6 */
#define TASK_PRIO 99 /* Highest RT priority */
#define TASK_MODE 0 /* No flags */
#define TASK_STKSZ 0 /* Stack size (use default one) */
@@ -45,25 +45,24 @@
}
static int __init irq_init(void) {
- int err;
+ int err;
- /* Version With 6 param only on kernel space */
- err = rt_intr_create(&intr_desc,"MyIrq", IRQ_NUMBER, irq_server, NULL, 0);
- if (err !=0){
- printk("rt_intr_create : error\n");
- return err;
- }
-
- err = rt_intr_enable(&intr_desc);
- if (err != 0)
- printk("rt_intr_enable : error\n");
- else
- printk("rt_intr_create : ok\n");
- return err;
+ /* Version With 6 param only on kernel space */
+ err = rt_intr_create(&intr_desc,"MyIrq", IRQ_NUMBER, irq_server, NULL, 0);
+ if (err !=0){
+ printk("rt_intr_create : error\n");
+ return err;
+ }
+ err = rt_intr_enable(&intr_desc);
+ if (err != 0)
+ printk("rt_intr_enable : error\n");
+ else
+ printk("rt_intr_create : ok\n");
+ return err;
}
void __init irq_exit(void) {
- rt_intr_delete(&intr_desc);
+ rt_intr_delete(&intr_desc);
}
module_init(irq_init);
Modified: trunk/target/demos/real_time/interrupt/xenomai/user_space/interrupt_xeno_userspace.c
===================================================================
--- trunk/target/demos/real_time/interrupt/xenomai/user_space/interrupt_xeno_userspace.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/interrupt/xenomai/user_space/interrupt_xeno_userspace.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -25,7 +25,7 @@
#include <native/task.h>
#include <native/intr.h>
-#define IRQ_NUMBER 70 /* Intercept interrupt #7 */
+#define IRQ_NUMBER 70 /* Intercept interrupt on PA6 */
#define TASK_PRIO 99 /* Highest RT priority */
#define TASK_MODE 0 /* No flags */
#define TASK_STKSZ 0 /* Stack size (use default one) */
@@ -42,7 +42,7 @@
return;
}
for (;;) {
- /* Wait for the next interrupt on channel #7. */
+ /* Wait for the next interrupt on channel 70. */
err = rt_intr_wait(&intr_desc,TM_INFINITE);
printf("tata plop\n");
if (err > 0) {
Modified: trunk/target/demos/real_time/pulse/linux/kernel/sleep_kernel/pulse_linux_kernel_sleep.c
===================================================================
--- trunk/target/demos/real_time/pulse/linux/kernel/sleep_kernel/pulse_linux_kernel_sleep.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/linux/kernel/sleep_kernel/pulse_linux_kernel_sleep.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -1,3 +1,26 @@
+/*
+* linux kernel driver for generation signal with sleep
+*
+* Copyright (C) 2009 <gwe...@ar...>
+* Armadeus Project / Armadeus Systems
+*
+*
+* 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
Modified: trunk/target/demos/real_time/pulse/linux/kernel/timer_kernel/pulse_linux_kernel_timer.c
===================================================================
--- trunk/target/demos/real_time/pulse/linux/kernel/timer_kernel/pulse_linux_kernel_timer.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/linux/kernel/timer_kernel/pulse_linux_kernel_timer.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -1,9 +1,25 @@
-/***********************************
- * Pulse generator
- *
- * author : Gwenhael GOAVEC-MEROU
- *
- ***********************************/
+/*
+* linux kernel driver for generation signal with timer
+*
+* Copyright (C) 2009 <gwe...@ar...>
+* Armadeus Project / Armadeus Systems
+*
+*
+* 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
#include <linux/module.h>
Modified: trunk/target/demos/real_time/pulse/linux/user_space/sleep/pulse_linux_userspace_sleep.c
===================================================================
--- trunk/target/demos/real_time/pulse/linux/user_space/sleep/pulse_linux_userspace_sleep.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/linux/user_space/sleep/pulse_linux_userspace_sleep.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -1,3 +1,26 @@
+/*
+* linux user space apps for generating signl with sleep
+*
+* Copyright (C) 2009 <gwe...@ar...>
+* Armadeus Project / Armadeus Systems
+*
+*
+* 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
Modified: trunk/target/demos/real_time/pulse/linux/user_space/timer/pulse_linux_userspace_timer.c
===================================================================
--- trunk/target/demos/real_time/pulse/linux/user_space/timer/pulse_linux_userspace_timer.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/linux/user_space/timer/pulse_linux_userspace_timer.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -1,3 +1,26 @@
+/*
+* linux user space apps for generating signl with timer
+*
+* Copyright (C) 2009 <gwe...@ar...>
+* Armadeus Project / Armadeus Systems
+*
+*
+* 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -17,12 +40,10 @@
iomask ^=1;
}
-int main(int argc, char **argv) {
- printf("**** G\xE9n\xE9rateur d'impulsions avec timer en mode utilisateur ****\n");
-
+int main(int argc, char **argv) {
fd = open(PORT,O_RDWR);
if (fd < 0) {
- printf("erreur\n");
+ printf("open : error\n");
return 1;
}
iomask = 1;
Modified: trunk/target/demos/real_time/pulse/xenomai/kernel/rt_timer/pulse_xeno_kernel_rt_timer.c
===================================================================
--- trunk/target/demos/real_time/pulse/xenomai/kernel/rt_timer/pulse_xeno_kernel_rt_timer.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/xenomai/kernel/rt_timer/pulse_xeno_kernel_rt_timer.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -42,52 +42,52 @@
#define PORT_ADDR VA_GPIO_BASE + MXC_DR(0)
void blink(void *arg){
- int err, iomask;
- printk(KERN_INFO "entrering blink\n");
+ int err, iomask;
+ printk(KERN_INFO "entrering blink\n");
- if (imx_gpio_request(GPIO_PORTA | MINOR_PORT, "blink") < 0) {
- gpio_free(MINOR_PORT);
- return ;
- }
- imx_gpio_direction_output(GPIO_PORTA | MINOR_PORT,1);
+ if (imx_gpio_request(GPIO_PORTA | MINOR_PORT, "blink") < 0) {
+ gpio_free(MINOR_PORT);
+ return ;
+ }
+ imx_gpio_direction_output(GPIO_PORTA | MINOR_PORT,1);
- if ((err = rt_task_set_periodic(NULL, TM_NOW,rt_timer_ns2ticks(TIMESLEEP)))){
- printk("rt task set periodic failed \n");
- return;
- }
- iomask=0;
+ if ((err = rt_task_set_periodic(NULL, TM_NOW,rt_timer_ns2ticks(TIMESLEEP)))){
+ printk("rt task set periodic failed \n");
+ return;
+ }
+ iomask=0;
- while(!end){
- rt_task_wait_period(NULL);
- imx_gpio_set_value(GPIO_PORTA | MINOR_PORT, iomask);
- iomask^=1;
- }
- printk("fin\n");
+ while(!end){
+ rt_task_wait_period(NULL);
+ imx_gpio_set_value(GPIO_PORTA | MINOR_PORT, iomask);
+ iomask^=1;
+ }
+ printk("end\n");
}
-
+/* loading (insmod) */
static int __init blink_init(void) {
- printk(KERN_INFO "blink_init\n");
- if (rt_task_create(&blink_task, "blink", 0, 99, 0)) {
- printk("task create error\n");
- return -EBUSY;
- }
- if (rt_task_start(&blink_task, &blink, NULL)) {
- printk("task start error\n");
- return -EBUSY;
- }
- return 0;
+ printk(KERN_INFO "blink_init\n");
+ if (rt_task_create(&blink_task, "blink", 0, 99, 0)) {
+ printk("task create error\n");
+ return -EBUSY;
+ }
+ if (rt_task_start(&blink_task, &blink, NULL)) {
+ printk("task start error\n");
+ return -EBUSY;
+ }
+ return 0;
}
-/* Fin de la tache (rmmod) */
+/* unloading (rmmod) */
static void __init blink_exit(void) {
- end = 1;
- printk(KERN_INFO "blink_exit\n");
- rt_task_delete(&blink_task);
- rt_timer_stop();
- gpio_free(MINOR_PORT);
+ end = 1;
+ printk(KERN_INFO "blink_exit\n");
+ rt_task_delete(&blink_task);
+ rt_timer_stop();
+ gpio_free(MINOR_PORT);
}
-/* Points d'entrée API modules Linux */
+/* API kernel driver */
module_init(blink_init);
module_exit(blink_exit);
Modified: trunk/target/demos/real_time/pulse/xenomai/kernel/timer_kernel/pulse_xeno_kernel_timer.c
===================================================================
--- trunk/target/demos/real_time/pulse/xenomai/kernel/timer_kernel/pulse_xeno_kernel_timer.c 2009-03-24 14:07:40 UTC (rev 1188)
+++ trunk/target/demos/real_time/pulse/xenomai/kernel/timer_kernel/pulse_xeno_kernel_timer.c 2009-03-24 14:46:53 UTC (rev 1189)
@@ -42,38 +42,37 @@
#define PORT_ADDR VA_GPIO_BASE + MXC_DR(0)
void blink(void *arg){
- int iomask;
- printk(KERN_INFO "entrering blink\n");
- iomask=0;
- while(!end){
- rtdm_task_wait_period();
- gpio_set_value(MINOR_PORT, iomask);
- iomask^=1;
- }
- printk("fin\n");
+ int iomask;
+ printk(KERN_INFO "entrering blink\n");
+ iomask=0;
+ while(!end){
+ rtdm_task_wait_period();
+ gpio_set_value(MINOR_PORT, iomask);
+ iomask^=1;
+ }
+ printk("end\n");
}
-
+/* module load (insmod) */
static int __init blink_init(void) {
- printk(KERN_INFO "blink_init\n");
- if (gpio_request(MINOR_PORT, "blink") < 0) {
- gpio_free(MINOR_PORT);
- return -EBUSY;
- }
- gpio_direction_output(MINOR_PORT,1);
-
- return rtdm_task_init(&blink_task, "blink", blink, NULL,
+ printk(KERN_INFO "blink_init\n");
+ if (gpio_request(MINOR_PORT, "blink") < 0) {
+ gpio_free(MINOR_PORT);
+ return -EBUSY;
+ }
+ gpio_direction_output(MINOR_PORT,1);
+ return rtdm_task_init(&blink_task, "blink", blink, NULL,
99, TIMESLEEP);
}
-/* Fin de la tache (rmmod) */
+/* module unload (rmmod) */
static void __init blink_exit(void) {
- end = 1;
- printk(KERN_INFO "blink_exit\n");
- rtdm_task_join_nrt(&blink_task,100);
- gpio_free(MINOR_PORT);
+ end = 1;
+ printk(KERN_INFO "blink_exit\n");
+ rtdm_task_join_nrt(&blink_task,100);
+ gpio_free(MINOR_PORT);
}
-/* Points d'entrée API modules Linux */
+/* API kernel driver */
module_init(blink_init);
module_exit(blink_exit);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|