Hello,

I would like to get some help on RT FIFOS synchronisation problems.

At that time, I use linux version 2.2.13-rtl2.0 on a Mandrake
distribution v7 on a PIII machine with 61 Mo RAM (using append='mem=61M'
option with lilo).

I am developping a software to sort data incomming from a acquisition board.
I got two tasks in a rt module. The first one, waked up by hardware
interruption from the acquisition board,
catches data from DMA channel buffer and put them on a RT FIFO. The second
one is a fifo handler which
i have initialized to wake up on data reception on RT fifo. But it seems to
do not work properly,
because my fifo handler does not wake up, and my RT fifo is full after two
interruptions.

I wonder if this kind of RT tasks synchronisation (by the means of RT fifos)
is possible ?
If not, which kind if IPC method do i have to use ?

Thanks for your help and support.

Best regards.

David JOUBARD


PS : follows parts of my source code of my RT module.

----------------------------------------------------------------------------
---------

#define  BASE_CFG  ( 63 * 0x100000 )
#define  ADRESSE_DMA_0  ( BASE_CFG  )

#define  FIFO_CANAL_0  0

int handler_sort( unsigned int fifo )
{
 // declaration
 ...

 // fifo reception
 err = rtf_get( FIFO_CANAL_0 , buffer, 65536 );

 if ( err > 0 )
 {
  // sorting algorihtm
  ...

 }
 else
  return -EINVAL;

 return 0;
}


unsigned int handler_int( unsigned int irq_number, struct pt_regs *p )
{ 
 // declaration
 ...

 if ( gbShutdown_ant == 1 )
  gbShutdown_ant = 2;
  
 cEtatBuffer = *carte_ptrEtat;
      
 switch( cEtatBuffer )
 {
  case 0x05 :
  case 0x07 : // buffer 1 moitie plein
     if ( rtf_put( FIFO_CANAL_0 , (u8 *) __va( ADRESSE_DMA_0 ) , 65536 ) < 0 )
      rtl_printf("ACQUISITION > fifo CANAL 0 full" );
    
  ...     
 }

 rtl_hard_enable_irq( carte_LigneIrq );
 return 0;
}


int init_module(void)
{
 int old_irq_state;
 . . .
 
 // card detection
 if ( pci_present())
 {

  unsigned int VendorID = ...;
  unsigned int DeviceID = ...;

  // card localisation
  struct pci_dev * dev = NULL;
  dev = pci_find_device( VendorID, DeviceID, dev );

  if ( dev == NULL )
  { printk( KERN_WARNING "Carte PCI not found!\n" );
   return 1;
  }

  // getting Ligne IRQ + BAR0 + BAR1
  carte_LigneIrq = dev->irq;
  carte_BAR0 = (u32) ioremap( dev->base_address[0] , 0x100 );
  carte_BAR1 = (u32) ioremap( dev->base_address[1] , 0x100 );

  // card configuration
...
 }
 else
  return 1;
 ...

 // creation interruption handler
 rtl_no_interrupts( old_irq_state );
 rtl_request_global_irq( carte_LigneIrq , handler_int );
 rtl_hard_enable_irq( carte_LigneIrq );
 rtl_restore_interrupts( old_irq_state );

 // creation  thread for sorting
 rtf_create_handler( FIFO_CANAL_0, &handler_sort );

 return 0;
}

void cleanup_module(void)
{
 int old_irq_state;
 int timeout = 100000;
 gbShutdown_ant = 1;

 *carte_ptrEtat = 0x00;

 while(( gbShutdown_ant == 1 ) && timeout-- );
 /* so it's kinda sloppy, wait for timeout or for
    interrupt routine to ack shutdown, whatever comes
    first */

 rtl_no_interrupts( old_irq_state );
 rtl_free_global_irq( carte_LigneIrq );
 rtl_restore_interrupts( old_irq_state );
}

----------------------------------------------------------------------------
---------


SASI SA
Centre Regain, Route de Marseille
04220 Sainte TULLE
Tel : (33) (0)4 92 70 76 80 fax : (33) (0)4 92 70 76 90
e-mail : [EMAIL PROTECTED]

-- [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