Hi all,
When i am compiling my module i am getting these
problems. can anybody help me please..
Regards
Venkat
The program
===========
#include <linux/errno.h>
#include <rtl.h>
#include <time.h>
#include <rtl_sched.h>
#include <rtl_fifo.h>
#include "control.h"
pthread_t tasks;
int *thread_code(void )
{
char str[100];
// int fifo=(int)t;
struct my_msg_struct msg;
struct sched_param p;
p.sched_priority=2;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&p);
while(1)
{
int ret;
int err;
ret=pthread_wait_np();
if((err=rtf_get(5,&msg,sizeof(msg)))==sizeof(msg))
{
rtf_put(4,&msg,sizeof(msg));
switch(msg.command)
{
case START_TASK:
pthread_make_periodic_np(pthread_self(),gethrtime(),4000000);
break;
case STOP_TASK:
pthread_suspend_np(pthread_self());
break;
default:
rtl_printf("RTLinux task : bad command\n");
return 0;
}
}
rtf_get(1,str,100);
rtf_put(2,str,sizeof(str));
}
return 0;
}
int my_handler(unsigned int fifo)
{
struct my_msg_struct msg;
int err;
while((err=rtf_get(COMMAND_FIFO,&msg,sizeof(msg)))==sizeof(msg))
{
rtf_put(5,&msg,sizeof(msg));
rtl_printf("FIFO handler : Sending the
command to task\n");
pthread_wakeup_np(tasks);
}
if(err != 0)
return -EINVAL;
return 0;
} //End of fifo handler
int init_module(void)
{
rtf_destroy(1);
rtf_destroy(2);
rtf_destroy(3);
rtf_destroy(4);
rtf_destroy(5);
// rtf_destroy(6);
rtf_create(1,4000); // for data transfer
rtf_create(2,4000); // for data transfer
rtf_create(3,400); // for control info
between rtmodule and process1
rtf_create(4,400); // for control info
between rtmodule and process2
rtf_create(5,400); // for control info bet
thread and handler
// rtf_create(6,400);
pthread_create(&tasks,NULL,thread_code,NULL);
rtf_create_handler(3,my_handler);
return 0;
} // End of init module
void cleanup_module(void)
{
rtf_destroy(1);
rtf_destroy(2);
rtf_destroy(3);
rtf_destroy(4);
rtf_destroy(5);
pthread_delete_np(tasks);
} // End of cleanup_module
Messages when compiling
=======================
gcc -D__KERNEL__ -Wall -Wstrict-prototypes
-fno-strict-aliasing -D__SMP__ -pipe
-fno-strength-reduce -m486 -malign-loops=2
-malign-jumps=2 -malign-functions=2 -DCPU=686 -g
-D__RTL__ -DMODULE -D_LOOSE_KERNEL_NAMES -O2
-I/usr/src/rtlinux/linux/include
-I/usr/src/rtlinux/include
-I/usr/src/rtlinux/include/compat
-I/usr/src/rtlinux/include/posix -c -o fifomodule.o
fifomodule.c
fifomodule.c:8: parse error before `tasks'
fifomodule.c:8: warning: type defaults to `int' in
declaration of `tasks'
fifomodule.c:8: warning: data definition has no type
or storage class
fifomodule.c: In function `my_handler':
fifomodule.c:57: warning: passing arg 1 of
`pthread_wakeup_np' makes pointer from integer without
a cast
fifomodule.c: In function `init_module':
fifomodule.c:80: warning: passing arg 1 of
`__pthread_create' from incompatible pointer type
fifomodule.c:80: warning: passing arg 3 of
`__pthread_create' from incompatible pointer type
fifomodule.c: In function `cleanup_module':
fifomodule.c:94: warning: passing arg 1 of
`pthread_delete_np' makes pointer from integer without
a cast
make: *** [fifomodule.o] Error 1
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
-- [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/