#include <stdio.h> /* standard I/O .h-file */ #include <stdlib.h> /* standard I/O .h-file */ #include <ctype.h> /* character functions */ #include <string.h> /* string and memory functions */ #include <AT91SAM7X256.H> /* AT91SAM7X256 definitions */ #include <lib_AT91SAM7X256.h> #include <RTL.h> /* RTX kernel functions & defines */ os_mbx_declare (MsgBox, 16); /* Declare an RTX mailbox */ U32 mpool[16*(2*sizeof(U32))/4 + 3]; /* Reserve a memory for 16 messages */ void rec_task (void) __task; void send_task (void) __task { /* This task will send a message. */ U32 *mptr; os_tsk_create (rec_task, 0); os_mbx_init (MsgBox, sizeof(MsgBox)); mptr = _alloc_box (mpool); /* Allocate a memory for the message */ mptr[0] = 0x3215fedc; /* Set the message content. */ mptr[1] = 0x00000015; os_mbx_send (MsgBox, mptr, 0xffff); /* Send a message to a 'MsgBox' */ os_tsk_delete_self (); } void rec_task (void) __task { /* This task will receive a message. */ U32 *rptr, rec_val[2]; os_mbx_wait (MsgBox, &rptr, 0xffff); /* Wait for the message to arrive. */ rec_val[0] = rptr[0]; /* Store the content to 'rec_val' */ rec_val[1] = rptr[1]; _free_box (mpool, rptr); /* Release the memory block */ os_tsk_delete_self (); } void main (void) { _init_box (mpool, sizeof(mpool), sizeof(U32)); os_sys_init(send_task); }
And there's error: #167: argument of type "U32 **" is incompatible with parameter of type "void **" .. and this is example from the guide. What I'm making wrong? Please help. Thx
You are remembering that these functions returns results? You never seem to look at any results to verify if there is a problem with any call...
os_mbx_wait (MsgBox, (void **) &rptr, 0xffff); /* Wait for the message to arrive. */