- From: Ȳ½Âȯ <aihwang_at_hanmail.net>
- Date: Mon, 05 Aug 2002 14:39:03 +0900 (KST)
Hi, I'm korean.
sorry for both hesitating english expression and linux beginner. please understand...
I did a periodic task for rtlinux. At the compilation step everythings ok but I have the 'segmentation fault' error when my rt_task module is inserted to kernel space. I read the related mailing list contents but I never found out the solution about this problem.
I'm using debian, rtlinux-3.1, linux kernel-2.4.4, comedi-0.7.65, comedilib-0.7.19
source code(analog out) is following
//====================================================================
#include
#include
#include
#include
#include
#include
int dev = 0; // device: 0
int subdev = 1; // analog output
pthread_t daq_run;
#define milisec 1000000
void *daq_th1(void)
{
lsampl_t data;
struct sched_param daq_p;
daq_p.sched_priority = 1;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&daq_p);
pthread_setfp_np(pthread_self(),1);
pthread_make_periodic_np (pthread_self(),gethrtime(),milisec*1000);
data = 1000;
while(1){
pthread_wait_np();
if (data >= 4000) data = 4000;
comedi_data_write(dev,subdev,0,0,AREF_GROUND,&data);
data = data + 100;
}
return 0;
}
int init_module(void)
{
comedi_lock(dev,subdev);
comedi_open(dev);
pthread_create(&daq_run,NULL,daq_th1,0);
return 0;
}
void cleanup_module(void)
{
pthread_delete_np(daq_run);
comedi_cancel(dev,subdev);
comedi_unlock(dev,subdev);
comedi_close(dev);
}
===============================================================//
makefile is following
//==============================================================
all: daqtest.o
COMEDI = -I/root/hwang/DAQ_test/comedi/comedi-0.7.65/include
include ../../rtl.mk
daqtest.o: daqtest.c
$(CC) $(COMEDI) $(INCLUDE) $(CFLAGS) -c daqtest.c
test: all
_at_echo "type 'return' to continue"
_at_read junk
(cd ../../; scripts/rmrtl)
_at_echo "type 'return' to insert rt_components"
_at_read junk
(cd ../../; scripts/insrtl)
_at_echo "type 'return' to insert your module"
_at_read junk
_at_insmod daqtest.o # (_at___at_) -------> occur 'segmentation fault' error at this point
_at_sleep 3
_at_echo "type 'return' to rmmod"
_at_read junk
-rmmod daqtest
clean:
rm -f *.o
include $(RTL_DIR)/Rules.make
==============================================================//
I did execute the following before executing the upper step
1) modprobe comedi
2) modprobe ni_pcimio
3) modprobe kcomedilib
what's the problem?
please teaching me!!!!!
thank you
sorry for both hesitating english expression and linux beginner. please understand...
I did a periodic task for rtlinux. At the compilation step everythings ok but I have the 'segmentation fault' error when my rt_task module is inserted to kernel space. I read the related mailing list contents but I never found out the solution about this problem.
I'm using debian, rtlinux-3.1, linux kernel-2.4.4, comedi-0.7.65, comedilib-0.7.19
source code(analog out) is following
//====================================================================
#include
#include
#include
#include
#include
#include
int dev = 0; // device: 0
int subdev = 1; // analog output
pthread_t daq_run;
#define milisec 1000000
void *daq_th1(void)
{
lsampl_t data;
struct sched_param daq_p;
daq_p.sched_priority = 1;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&daq_p);
pthread_setfp_np(pthread_self(),1);
pthread_make_periodic_np (pthread_self(),gethrtime(),milisec*1000);
data = 1000;
while(1){
pthread_wait_np();
if (data >= 4000) data = 4000;
comedi_data_write(dev,subdev,0,0,AREF_GROUND,&data);
data = data + 100;
}
return 0;
}
int init_module(void)
{
comedi_lock(dev,subdev);
comedi_open(dev);
pthread_create(&daq_run,NULL,daq_th1,0);
return 0;
}
void cleanup_module(void)
{
pthread_delete_np(daq_run);
comedi_cancel(dev,subdev);
comedi_unlock(dev,subdev);
comedi_close(dev);
}
===============================================================//
makefile is following
//==============================================================
all: daqtest.o
COMEDI = -I/root/hwang/DAQ_test/comedi/comedi-0.7.65/include
include ../../rtl.mk
daqtest.o: daqtest.c
$(CC) $(COMEDI) $(INCLUDE) $(CFLAGS) -c daqtest.c
test: all
_at_echo "type 'return' to continue"
_at_read junk
(cd ../../; scripts/rmrtl)
_at_echo "type 'return' to insert rt_components"
_at_read junk
(cd ../../; scripts/insrtl)
_at_echo "type 'return' to insert your module"
_at_read junk
_at_insmod daqtest.o # (_at___at_) -------> occur 'segmentation fault' error at this point
_at_sleep 3
_at_echo "type 'return' to rmmod"
_at_read junk
-rmmod daqtest
clean:
rm -f *.o
include $(RTL_DIR)/Rules.make
==============================================================//
I did execute the following before executing the upper step
1) modprobe comedi
2) modprobe ni_pcimio
3) modprobe kcomedilib
what's the problem?
please teaching me!!!!!
thank you
|
"¿ì¸® ÀÎÅͳÝ, Daum" http://www.daum.net |
|
ºü¸£´Ù! ÆíÇÏ´Ù! Daum¸Þ½ÅÀú ¸ÅÀϸÅÀÏ ¾²°í °è½ÃÁÒ? |
Daum¿£ÅÍÄ«µå Daumȸ¿øÀÇ Çʼöǰ! ¿Â¿ÀÇÁ ÃÖ°íÀÇ ÇýÅÃÀ» ´©¸®ÀÚ! |
Received on 2002-08-05Z04:39:03