5 - Declarations
5.1 - Process
A process is implicitly declared in the architecture of the system (Cf. "Architecture" on page 8) since the communication channels need to be connected.
A process has an initial number of instances at startup and a maximum number of instances. A process can also be an instance of a process class (Cf. "Object orientation" on page 65), in that case the name of the class follows the name of the instance after a colon.
The general syntax is:
<process instance name>[:<process class>][(<initial number of instances>, <maximum number of instances>)] [PRIO <priority>]
The priority is the one of the target RTOS.
Please note the stack size can be defined in the process or process class additional heading symbol as described in paragraph "Additional heading symbol" on page 31.
When a process is an instance of a process class the gates of the process class need to be connected in the architecture diagram. The names of the gates appear in the process symbol with a black circle representing the connection point.
The messages defined in the package going through the gates must be consistent with the messages listed in the architecture diagram where the process instance is defined.
Example:
5.2 - Procedure declaration
An SDL-RT procedure can be defined in any diagram: system, block, or process. It is usually not connected to the architecture but since it can output messages a channel can be connected to it for informational purpose.
The declaration syntax is the same as a C function. A procedure definition can be done graphically with SDL-RT or textually in a standard C file.
5.2.1 SDL-RT defined procedure
If defined with SDL-RT the calling process context is implicitly given to the procedure. So if a message output is done, the message will be output from the process calling the procedure. That is why the message should be defined in one of the channels connected to the process instead of a channel connected to a procedure. To call such a procedure the procedure call symbol should be used.
5.2.2 C defined procedure
If defined in C language the process context is not present. To call such a procedure a standard C statement should be used in a action symbol.
Example:
5.3 - Messages
Messages are declared at any architecture level in the additional heading symbol. A message declaration may include one or several parameters. The parameters data types are declared in C. The syntax is:
MESSAGE <message name> [(<parameter type> {,parameter type}*)] {,<message name> [(<parameter type>)]}*;
It is also possible to declare message lists to make the architecture view more synthetic. Such a declaration can be made at any architecture level in the additional heading symbol. The syntax is:
MESSAGE_LIST <message list name> = <message name> {, <message name>}*{, (<message list name>)}*;
The message parameters are not present when defining a message list. A message list can contain a message list, in that case the included message list name is surrounded by parenthesis.
Example:
5.4 - Timers
There is no need to declare timers. They are self declared when used in a diagram.
5.5 - Semaphores
Semaphores can be declared at any architectural level. The general syntax in the declaration symbol is:
Where the types and options are:
- BINARY <semaphore name> ( [ PRIO | FIFO ], [ INITIAL_EMPTY | INITIAL_FULL ] )
- MUTEX <semaphore name> ( [ PRIO | FIFO ] [, DELETE_SAFE ] [, INVERSION_SAFE ] )
- COUNTING <semaphore name> ( [ PRIO | FIFO ], <initial count> )
It is important to note the semaphore is identified by its name.
http://www.sdl-rt.org info@sdl-rt.org |