module.h error
Hi everybody!
I have xenomai-2.6.1 with kernel 3.2.32 over an i7.
I'm trying to compile the attached files, but with make I get this message:
cc -I/lib/modules/3.2.32/build/include/xenomai -I/lib/modules/3.2.32/build/include/xenomai/compat
-I/lib/modules/3.2.32/build/include/xenomai/posix -c -o sinus.o sinus.c
sinus.c:2:26: fatal error: linux/module.h: No such file or directory
compilation terminated.
make: *** [sinus.o] Error 1
How could I fix this?? This mean that I have some problems with xenomai's installation?? or did I overlook something??
Thank you for your time and disposition
Seba
-------------- next part --------------
###### CONFIGURATION ######
### List of applications to be build
APPLICATIONS =
### Note: to override the search path for the xeno-config script, use "make XENO=..."
### List of modules to be build
MODULES = sinus
### Note: to override the kernel source path, use "make KSRC=..."
###### USER SPACE BUILD (no change required normally) ###### ifeq ($(KERNELRELEASE),)
ifneq ($(APPLICATIONS),)
### Default Xenomai installation path
XENO ?= /usr/xenomai
XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config 2>/dev/null)
### Sanity check
ifeq ($(XENOCONFIG),)
all::
@echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<" @echo
endif
CC=$(shell $(XENOCONFIG) --cc)
CPPFLAGS=$(shell $(XENOCONFIG) --xeno-cflags) $(MY_CFLAGS)
LOADLIBES=$(shell $(XENOCONFIG) --xeno-ldflags) $(MY_LDFLAGS) -lnative -lrtdm
# This includes the library path of given Xenomai into the binary to make live
# easier for beginners if Xenomai's libs are not in any default search path. LOADLIBES+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
all:: $(APPLICATIONS)
clean::
$(RM) $(APPLICATIONS) *.o
endif
endif
###### KERNEL MODULE BUILD (no change required normally) ###### ifneq ($(MODULES),)
### Default to sources of currently running kernel KSRC ?= /lib/modules/$(shell uname -r)/build
OBJS := ${patsubst %, %.o, $(MODULES)}
CLEANMOD := ${patsubst %, .%*, $(MODULES)}
PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
### Kernel 2.6
ifeq ($(findstring 2.6,$(KSRC)),2.6)
obj-m := $(OBJS)EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS)
all::
$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
### Kernel 2.4
else
ARCH ?= $(shell uname -i)
INCLUDE := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix CFLAGS += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) modules) $(INCLUDE)
all:: $(OBJS)
endif
## Target for capturing 2.4 module CFLAGS
modules:
@echo "$(CFLAGS)"
clean::
$(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers modules.order $(RM) -R .tmp*
endif
-------------- next part --------------
#ifndef REG_PCI1711_h
#define REG_PCI1711_h
#define PCI171x_AD_DATA 0 /* R: A/D data */ #define PCI171x_SOFTTRG 0 /* W: soft trigger for A/D */ #define PCI171x_RANGE 2 /* W: A/D gain/range register */ #define PCI171x_MUX_sta 4 /* W: A/D multiplexor control */ #define PCI171x_MUX_sto 5 /* W: A/D multiplexor control */
#define PCI171x_STATUS 7 /* R: status register */ #define PCI171x_CONTROL 6 /* W: control register */ #define PCI171x_CLRINT 8 /* W: clear interrupts request */ #define PCI171x_CLRFIFO 9 /* W: clear FIFO */ #define PCI171x_DA0 10 /* W: D/A register */ #define PCI171x_DA1 12 /* W: D/A register */ #define PCI171x_DAREF 14 /* W: D/A reference control */ #define PCI171x_DI 16 /* R: digi inputs */ #define PCI171x_DO 16 /* R: digi inputs */ #define PCI171x_CNT0 24 /* R/W: 8254 couter 0 */ #define PCI171x_CNT1 26 /* R/W: 8254 couter 1 */ #define PCI171x_CNT2 28 /* R/W: 8254 couter 2 */ #define PCI171x_CNTCTRL 30 /* W: 8254 counter control */
// upper bits from status register (PCI171x_STATUS) (lower is same woth control reg)
#define Status_FE 0x01 /* 1=FIFO is empty */ #define Status_FH 0x02 /* 1=FIFO is half full */ #define Status_FF 0x04 /* 1=FIFO is full, fatal error */ #define Status_IRQ 0x08 /* 1=IRQ occured */
// bits from control register (PCI171x_CONTROL)
#define Control_CNT0 0x0040 /* 1=CNT0 have external source, 0=have internal 100kHz source */ #define Control_ONEFH 0x0020 /* 1=IRQ on FIFO is half full, 0=every sample */ #define Control_IRQEN 0x0010 /* 1=enable IRQ */ #define Control_GATE 0x0008 /* 1=enable external trigger GATE (8254?) */ #define Control_EXT 0x0004 /* 1=external trigger source */ #define Control_PACER 0x0002 /* 1=enable internal 8254 trigger source */ #define Control_SW 0x0001 /* 1=enable software trigger source */
//bits from d/a reference control
#define DA_Control_DA1_I_E 0x08 //1=external reference
#define DA_Control_DA0_I_E 0x02
#define DA_Control_DA1_5_10 0x04 //1=10V
#define DA_Control_DA0_5_10 0x01
#define AD_Range_S_D 0x0020
#define AD_Range_B_U 0x0010
#endif
-------------- next part --------------
#include <linux/pci.h>
#include <linux/module.h>
#include <rtdm/rtdm_driver.h>
#include <time.h>
//#include <math.h>
MODULE_LICENSE("GPL");
#define PERIOD 10000 /* 10us */
#define PORT_PARALLEL 0x378
#define SPEAKER_DATA 0x61
#include "REG_PCI1711.h"
#define PCI_VENDOR_ 0x13fe
#define PCI_DEVICE_ 0x1711
#define NREG 32 /*Espai reservat per registres*/
unsigned int PCI_BASE_ADRESS_1711;
static rtdm_task_t periodic_task;
static int end = 0;
//*************************************************************************** //*********************************************************************
int detecta_PCI (void){
/*
unsigned char pci_bus, pci_device_fn;
int pci_index;
pci_index=0;
pcibios_find_device (PCI_VENDOR, PCI_DEVICE, pci_index, &pci_bus, &pci_device_fn); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_2, &PCI_BASE_ADRESS); PCI_BASE_ADRESS &= PCI_BASE_ADDRESS_IO_MASK; request_region(PCI_BASE_ADRESS, 32, "Advantech PCI-1710");
*/
struct pci_dev *pcidev;
printk("PCI-1711 DETECT PCI \n");
pcidev=NULL;
pcidev =pci_get_device (PCI_VENDOR_, PCI_DEVICE_, pcidev );
if (pcidev==NULL){
printk("PCI-1711 CANNOT BE FOUND \n");
}
else{
printk("PCI-1711 LOCATED \n");
if (pci_enable_device(pcidev)){
printk("PCI-1711 NOT ENABLED \n");
return(-EIO);
}
else{
printk("PCI-1711 ENABLED \n");
} PCI_BASE_ADRESS_1711= pci_resource_start(pcidev, 2);
printk("PCI-1711 DETECT PCI %x \n",PCI_BASE_ADRESS_1711);
}
return (0);
} //*********************************************************************
void periodic(void *cookie)
{
unsigned int yint;
double t,w,y;
struct timespec time;
outw(0x0000,PCI_BASE_ADRESS_1711 + PCI171x_DAREF);
while (!end) {
//clock_gettime(CLOCK_REALTIME,&time); //t=(double)time.tv_nsec*1.0E-9+(double)time.tv_sec; //y=(double)0.5+(double)0.5*sin( w*t); //yint=ceil( y* ( (double) 4095 )); yint=yint+1;
outw(yint,PCI_BASE_ADRESS_1711 + PCI171x_DA0); rtdm_task_wait_period();
}
}
int __init init_heartbeat(void)
{
detecta_PCI ();
return rtdm_task_init(&periodic_task, "periodic", periodic, NULL,
99, PERIOD);
}void __exit cleanup_heartbeat(void)
{
end = 1;
rtdm_task_join_nrt(&periodic_task, 100);
}module_init(init_heartbeat);module_exit(cleanup_heartbeat);
Quoted 12 lines · Sebastian Pavez
Hi everybody!
I have xenomai-2.6.1 with kernel 3.2.32 over an i7.
I'm trying to compile the attached files, but with make I get this message:cc -I/lib/modules/3.2.32/build/include/xenomai
(quoted diff) +0
-2-I/lib/modules/3.2.32/build/include/xenomai/compat -I/lib/modules/3.2.32/build/include/xenomai/posix -c -o sinus.o sinus.csinus.c:2:26: fatal error:
linux/module.h: No such file or directory compilation terminated.
make: *** [sinus.o] Error 1
Quoted 2 lines
How could I fix this?? This mean that I have some problems with xenomai's installation?? or did I overlook something??
The makefiles in xenomai examples are makefiles for you to reuse, but to reuse them, you have to understand how they work.
See Documentation/kbuild/modules.txt in the linux kernel sources to understand how to compile modules.
Signature · 1 line
Gilles.