Page 1 of 1

New function in SALVO

PostPosted: Thu Jun 14, 2001 7:55 am
by luben
Hello,

Because SALVO became more and more perfect I think that some complicated constructions could be implemented too, that will bring big advantages in the future.

One of them is to be able to redirect the events. Something like to redirect the standart printer output of PC to serial port... or console to COM1....

Think about this. You have some output devices like LCD display, RS232 port and thermal printer. Will be great if you can redirect the message or message queue to different tasks.

MESS_display
MESS_serial
MESS-printer

are 3 messages to different devices.

if you have one MESS_standard_OUTPUT and the function

OSRedirect(MESS_standart_OUTPUT, MESS_serial);

you can send messages to serial.

OSRedirect(MESS_standart_OUTPUT, MESS_display); // messages to LCD

Just ideas.....

Luben


Re: New function in SALVO

PostPosted: Sat Jun 16, 2001 7:54 am
by luben
Hi,

I even got vision of how could be implemented OSRedirect(X,Y) in future SALVO.
It's just one array of size equal to number of events, where the cell, addressed like ID contains the new ID. And when you use any of event functions you just take not the ID but the ID from array. In the beginning this array is initialized like

code:

static byte REDIRECTION[number of events];
// number of events includes virtual events too, that are not declared in SALVOCFG.H
...


for (i=0;i<number_of_events;i++)
REDIRECTION[i] = i;


....


after using OSRedirect(0,1) the event 0 ID becomes 1. I mean you can dinamically change the ID's.

Well, I agree that this could be very, very dangerous. SO additional care should be taken for using such redirection. The function should have protection agains redirect BinSem to Mess or one type of events to other.

So if you have 3 messages:

code:

#define MESS_Standard_IO 4 // virtual message

OSCreateMsg(MESS_Serial,......)
OSCreateMsg(MESS_Display,......)
OSCreateMsg(MESS_LEDs,......)

//and then

OSRedirect(MESS_Serial,MESS_Standard_IO);

// calling MESS_Standard_IO will redirect requests
// to MESS_Serial


Well, when SALVO checks the event IDs it should take not the ID, but the DESTINATION[ID] value.

In all cases this will grow the amount of RAM with number of event cells + number of virtual events.

Luben

[This message has been edited by luben (edited June 16, 2001).]