Page 1 of 1

Thread function 'tfunc_t' or 'msg_t'?

Posted: Tue Dec 11, 2012 4:40 am
by jscott
Should the thread function be typed a 'msg_t' or a 'tfunc_t'. All the demo programs are typed 'msg_t' but I am getting the error:

myMisc.c:353:5: warning: passing argument 4 of 'chThdCreateStatic' from incompatible pointer type [enabled by default]
C:\ChibiStudio\chibios/os/kernel/include/chthreads.h:356:11: note: expected 'tfunc_t' but argument is of type 'msg_t (*)(char *)'

Line 353 is the chThdCreateStatic line.

This is working just fine for other thread functions in this program...

--------------------------------------------------------------

static WORKING_AREA(waSendMorse, 128);
static msg_t SendMorse(char *msg)
{
uint8_t j;

chRegSetThreadName("SendMorse");

while(TRUE)
{
for ( j=0; j<strlen(msg); j++)
{
send(msg[j]); // Send each character in the message.
}
}
return 0;
}

void startMorse( char *msg)
{

// Start SendMorse thread and send pointer of messsage we want to send
chThdCreateStatic(waSendMorse, sizeof(waSendMorse), NORMALPRIO, SendMorse, msg);

}

Thanks
-John

Re: Thread function 'tfunc_t' or 'msg_t'?

Posted: Tue Dec 11, 2012 7:50 am
by Giovanni
Hi,

The type of a thread function is tfunc_t, msg_t is used for messages and is also the return type of a tfunc_t.

Giovanni