[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Module compilation problems / redefinitions of sigset_t






Hi,
I'm working on a driver that will be loaded as a module, and i have some problem with include files.
When i compile the following code (see below source code) i obtain the following error message (see below).

It seem there is a problem of redefinitions of some type of variables, and i don't know how to solve it.
Thanks for help.



PS;
Option used for the compilation 

gcc-cris -mlinux -isystem /home/axis/etrax_lx/axis/devboard_lx/target/cris-axis-
linux-gnu/include -mlinux -fno-leading-underscore -D__KERNEL__ -D__linux__ -DCRI
SMMU -I/home/axis/etrax_lx/axis/devboard_lx/os/linux/include -c sram_driver.c -o
sram_driver.o


/**************************************** Error Message **********************************************************/

/usr/local/cris/lib/gcc-lib/cris/2.96/linux/include/sys/time.h:33: warning: redefinition of `suseconds_t'
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/types.h:22: warning: `suseconds_t' previously declared here
/usr/local/cris/lib/gcc-lib/cris/2.96/linux/include/sys/time.h:57: redefinition of `struct timezone'
/usr/local/cris/lib/gcc-lib/cris/2.96/linux/include/sys/time.h:94: parse error before `0'
/usr/local/cris/lib/gcc-lib/cris/2.96/linux/include/sys/time.h:108: redefinition of `struct itimerval'
In file included from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/coda_fs_i.h:14,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/fs.h:300,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/capability.h:17,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/binfmts.h:5,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/sched.h:9,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/mm.h:4,
                 from sram_driver.c:35:
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/coda.h:111: warning: redefinition of `u_quad_t'
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/coda.h:82: warning: `u_quad_t' previously declared here
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/coda.h:125: warning: redefinition of `u_quad_t'
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/coda.h:111: warning: `u_quad_t' previously declared here
In file included from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/signal.h:4,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/sched.h:26,
                 from /home/axis/etrax_lx/axis/devboard_lx/os/linux/include/linux/mm.h:4,
                 from sram_driver.c:35:
/home/axis/etrax_lx/axis/devboard_lx/os/linux/include/asm/signal.h:21: conflicting types for `sigset_t'
/usr/local/cris/lib/gcc-lib/cris/2.96/linux/include/sys/select.h:38: previous declaration of `sigset_t'
make: *** [sram_driver.o] Erreur 1

/****************************************** Source Code *********************************************************/



#ifndef __KERNEL__
#define __KERNEL__
#endif

#ifndef MODULE
#define MODULE
#endif

#include <linux/module.h>
#include <linux/version.h>

#if 	CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/config.h>
#include <linux/kernel.h>   


#include <linux/init.h>     
#include <linux/mm.h>       

#include <linux/fs.h>       


#include <linux/wrapper.h>  
#include <asm/io.h>         


/* fichiers d'inclusion liés au projet ebox */


#ifndef EBOX
#define EBOX
#endif


#ifndef SRAM_DRIVER_NAME
#define SRAM_DRIVER_NAME "sram"
#endif



#include "../hardware/shared/shram.h"         

#define VMA_OFFSET(vma)  ((vma)->vm_pgoff << PAGE_SHIFT)


#ifndef MEMORY_PAGE_SIZE
#define MEMORY_PAGE_SIZE 8192
#endif

#ifndef SRAM_MAJOR_NUMBER
#define SRAM_MAJOR_NUMBER 126
#endif



long physical_memory_base_adress = 0; 

MODULE_PARM(physical_memory_base_adress,"l");


/* déclarations des fonctions  */
static int  __init init_shram(void);
void __exit cleanup_shram(void);
static int shram_open(struct inode *inode, struct file *filp);
static int shram_release(struct inode *inode, struct file *filp);
static int shram_mmap(struct file *filp, struct vm_area_struct *vma);





/* Structure file_operations */
static struct file_operations sram_fops = {
      open    :   shram_open,
      release :   shram_release,
      mmap    :   shram_mmap
};





/*  init_module  */

static int  __init init_shram(void)
{
  if( register_chrdev((unsigned int) SRAM_MAJOR_NUMBER , SRAM_DRIVER_NAME , & sram_fops ) < 0 )
  {
   printk("<1> Erreur lors de l enregistrement du module"); 
  }

  return 0;
}


/*  exit_module  */

void __exit cleanup_shram(void)
{
  unregister_chrdev((unsigned int) SRAM_MAJOR_NUMBER , SRAM_DRIVER_NAME );
  return ;
}


module_init(init_shram);
module_exit(cleanup_shram);


/* shram_open */
static int shram_open(struct inode *inode, struct file *filp)
{
      MOD_INC_USE_COUNT;  /* incrémentation du compteur d'utlisation du module */
      return 0;  
}

/* shram_release */
static int shram_release(struct inode *inode, struct file *filp)
{
      MOD_DEC_USE_COUNT;  /* décrémentation du compteur d'utlisation du module */
      return 0;  
}


/* shram_mmap */
static int shram_mmap(struct file *filp, struct vm_area_struct *vma)
{
  /* initialisation de l'adresse de base et de la taille de la mémoire */
  unsigned long base_adresse = physical_memory_base_adress ? physical_memory_base_adress : SHRAM_BASE;
  
    unsigned long size = vma->vm_end - vma->vm_start;
 
 
   /* test */
  printk("<1> Appel de la fonction de mappage");
  
  vma->vm_flags |= VM_RESERVED | VM_IO ;
  /* VM_IO indique que la VMA est une region e/s mappée en mémoire. */
  /* VM_RESERVED demande au système de ne pa swapper cette VMA */

  if (remap_page_range(vma->vm_start, base_adresse, size ,
           vma->vm_page_prot))
  return -EAGAIN; 


 
}


Pro-Active --- We put Linux, PHP, LonWorks and SmardCards everywhere ---
http://www.pro-active.fr