Dear All,

I need a help.....

I have a problem during capture data stream with data rate(sampling) 782
kByte/s using PPI8255 Card(ISA Bus). To capture the data stream, i applied
IRQ triggering.

But, some times many byte of data are lost. How many maximum transfer rate
on RTLINUX ?

As info, there is no problem if applied this program to capture the data
stream with 100 kByte/S.

Rgrds,

Adolfo

This is the module:

#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/rtf.h>
#include <linux/errno.h>
#include <asm/rt_irq.h>
#include <linux/rt_sched.h>
#include <asm/io.h>
#include <linux/cons.h>
#include "control.h"

#define FIFO1 0
#define size1 16384
#define FIFO2 1
#define size2 16384
/*#define size2 65536*/
/*
#define FIFO3 2
#define size3 12
*/

#define PPI 0x300
#define PPB PPI+1
#define PPC PPI+2
#define CCW PPI+3


void intr_handler5()
{
   int data;
   
   data = inb(PPI);
   rtf_put(FIFO1, (char *) &data, sizeof(data));
}

void intr_handler7()
{
  int data1;
  
  data1 = inb(PPB);
  rtf_put(FIFO2,(char *) &data1, sizeof(data1));
}  


int init_module()
{
 
   rtf_create(FIFO1,size1);
   rtf_create(FIFO2,size2);

   request_RTirq(3,intr_handler7);
   request_RTirq(5,intr_handler5);
   outb(0xb6,CCW);
   outb(0x05,CCW);
   outb(0x09,CCW);
 
   return 0;
}

void cleanup_module()
{
   rtf_destroy(FIFO1);
   rtf_destroy(FIFO2);

   free_RTirq(3);
   free_RTirq(5);
}

==========
This is the application part:

#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/rtf.h>
#include <string.h>

int main()
{
   int fd;
   int n;
   int datu;
   int data1;
   int data2;
   
   FILE *file1;
   FILE *ftabel;
   
   short int ket_tge;
   short int ket_nol1;
   short int omc;
   
   time_t hari;
   char namafile[24];
   int i,j;
   int idx;
   char idx0[4];

   /*Initialization */
   
   i=8192;
   j=0;
   idx=0;
   
   strcpy(namafile,"dummy.mt20");
   ket_tge=0;
   ket_nol1=0;
   omc=0;
   datu=0;
   data1=0;
   data2=0;

   /* Open File */
   file1=fopen(namafile,"w");
   
   if ((fd=open("/dev/rtf0",O_RDONLY)) < 0 )
      {
        fprintf(stderr,"Error Opening MT20\n");
        exit(1);
      }
   while(1)
   {
        i++;
        if((i > 8192) && (omc > 31))
        {
                j++;
                i=0;
                idx++;

                fclose(file1);
                
                time(&hari);
                
                strftime(namafile,22,"/m2/%m%d%H%M.A%S",localtime(&hari));
                sprintf(idx0,"%04d",idx);
            strcat(namafile,idx0);      
                file1 = fopen(namafile,"w");
/*              omc=0;*/
        }
        n = read(fd,&datu,sizeof(datu));
        omc++;
        
        if((datu == 0x3e) || (datu==0x3d) || (datu==0x3f)) 
        {
          ket_tge=1;
          data1=datu;
        }
        else if ((datu == 0x00) && (ket_tge==1) && (ket_nol1 == 0))
        {
          data2=datu;
          ket_nol1=1;
        }
        else if ((datu == 0x00) && (ket_nol1==1))
        {
          fprintf(file1,"\n%02x%02x%02x",data1,data2,datu);
          ket_tge=0;
          ket_nol1=0;
          omc=2;
        }
        else if ((datu != 0x00) && (ket_nol1 == 1))
        {
          fprintf(file1,"%02x%02x%02x",data1,data2,datu);
          ket_tge=0;
          ket_nol1=0;
        }
        else if ((datu != 0x00) && (ket_tge == 1))
        {
         fprintf(file1,"%02x%02x",data1,datu);
         ket_tge  = 0;
         ket_nol1 = 0;
        }
        else
        {
          fprintf(file1,"%02x",datu);
          ket_tge=0;
        }
      }
      fclose(file1);
      return 0;
}

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to