| ??? 10/03/02 16:48 Read: times |
#30138 - RE: RTX51-Full Convert function to task |
This is pretty easy to do except that you need to figure out exactly what kind of inter-task comunication you require.
Basically, your new task executes as follows: 1. Wait for parameters. 2. Do whatever parameters indicate. 3. Return to step 1. One way to handle this is to... 1. Create a structure that holds the parameters. For example: struct stuff_st
{
uchar type;
SND_MSG sdnMsg;
PRTCL_FLD prtclFld;
uchar protocol;
};
2. Use the memory pool functions to create a pool of stuff_st's. 3. In your protocol task, call the os_wait function and wait for a message. The message will be a pointer to a stuff_st that was allocated from the memory pool. 4. In your protocol task, when you are finished with the stuff_st, you must free it (and return the memory to the pool). 5. Tasks that want to "call" your protocol task must first, allocate a block from the stuff_st memory pool, fill in the struct, and call os_send_message using the address of the struct and the ID of the protocol task. There are numerous other ways you could handle this. For example, you could create a FIFO and use a counting semaphore. But, I don't know enough about your requirements (like how many tasks call your protocol task, how fast it has to be, and so on). Jon |
| Topic | Author | Date |
| RTX51-Full Convert function to task | 01/01/70 00:00 | |
| RE: RTX51-Full Convert function to task | 01/01/70 00:00 | |
RE: RTX51-Full Convert function to task | 01/01/70 00:00 |



