Hi thomas,

>It can be a driver problem, but as you haven't posted your code source, 
>nobody is able to tell. Are you doing the correct things at module
>exit ?

These are some parts of my code.

within probe funcion
--------------------------------------------------------------------------------------------------------------------------------------
{
  gdma.dma_buf = (char*)kmalloc( GAIAPCI_DMABUF_SIZE, GFP_KERNEL|__GFP_DMA );
      if( gdma.dma_buf==0 ){
       printk( KERN_ALERT "@ ERROR - unable to allocate memory\n" );
       ret=-1;
      }
      else{
       /* clear RM7965 interrupt */
       gaiapci_int_clear( PCIDT_RM7965INTCLR );
       /* unmask RM7965 interrupt */
       gaiapci_int_enable( PCIDT_RM7965INTMSK );
       ret = 0;
  }
}
--------------------------------------------------------------------------------------------------------------------------------------

within remove function
--------------------------------------------------------------------------------------------------------------------------------------
{
     kfree(gdma.dma_buf);
     gdma.dma_buf = 0;

     free_irq(irq_no, irq_id);

     if( pciVmOffset ){
        iounmap((void*)(pciVmOffset & PAGE_MASK));
     }
     pci_release_region(dev, 0);

     pci_disable_device(dev);
     gaiapci_unregister_chr();
}

write function
--------------------------------------------------------------------------------------------------------------------------------------
{
    gdma.dma_dir = DMA_TO_DEVICE;
    bus_addr = dma_map_single( &gdev.pdev->dev, (void*)gdma.dma_buf, 
GAIAPCI_DMABUF_SIZE, gdma.dma_dir );
    gdma.dma_bus = bus_addr;
    
    /* set data size */
    /* set address */
    /* enable dma interrupt */
    /* dma start command */
}
--------------------------------------------------------------------------------------------------------------------------------------

interrupt routine
--------------------------------------------------------------------------------------------------------------------------------------
{
  gaiapci_int_clear( PCIDT_MDMAENDCLR );
  gaiapci_int_mask( PCIDT_MDMAENDMSK );

  dma_unmap_single(&gdev.pdev->dev, gdma.dma_bus, GAIAPCI_DMABUF_SIZE, 
gdma.dma_dir );
  ret = IRQ_HANDLED;
}
--------------------------------------------------------------------------------------------------------------------------------------

I think this gives you an idea how I hv done it.
Is there anything wrong with this method.

Thanx in advance.
Sumudu

Reply via email to