Problem with FIFO in 2.6.9rtlfree

[email protected] Wed, 29 Mar 2006 11:48:59 +0200
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------060709030809050003000900
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

When working with fifos my machine hangs. The code I attach (a rtl 
module and a linux file) hangs my machine
after something.

It seems like that when I try to read from and empty fifo the system 
hangs. Does anyone has any idea ?

Is there any problem with fifos ?


Best wishes,
Ramon

--------------060709030809050003000900
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
 name="module.c"
Content-Disposition: inline;
 filename="module.c"


#include <linux/pci.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <rtl_sched.h>
#include <rtl_fifo.h>
#include <math.h>
#include <string.h>

#include <rtl.h>
#include <time.h>
#include <pthread.h>
#include <asm/io.h>


int a;
pthread_t thread_control;

void * control_routine(void *arg) {
    int i=10;
    struct sched_param p;
    p.sched_priority = 1;
    pthread_setschedparam(pthread_self(), SCHED_FIFO, &p);

    pthread_make_periodic_np (pthread_self(), gethrtime(), 1000000000);

    while(1) {
            rtf_put(10, &i, sizeof(i));
            printk("%d\n", i);
       pthread_wait_np ();
        }

    return 0;
}



int init_module(void) {
    a = 0;

    rtf_create(10, 1000); 

    pthread_create (&thread_control, NULL, control_routine, 0);

    return 0;
}


void cleanup_module(void) {

    pthread_delete_np (thread_control);


    rtf_destroy(10);
}

--------------060709030809050003000900
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
 name="comunica.c"
Content-Disposition: inline;
 filename="comunica.c"

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>



int main (int argc, char **argv) {
  int fd_out, fd_in, fd_out_mod, fd_in_mod;
  int tamread=0;
  int lecturas=0;
  int i;

  if ((fd_in = open("/dev/rtf10", O_RDONLY)) < 0) {
    fprintf(stderr,"KO: \n");
    exit(1);
  }

    while ((tamread < sizeof(i)) && (lecturas < 9)) {
        tamread = read(fd_in, &i, sizeof(i));
        lecturas++;
    }
    
  close(fd_in);

  return 0;
} 

--------------060709030809050003000900
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/
--------------060709030809050003000900--