User`s manual

SCIOPTA - Real-Time Kernel
User’s Manual Manual Version 4.1 6-7
SCIOPTA - Real-Time Kernel
6 Messages
6.7 Message Number (ID) organization
Message numbers (also called message IDs) should be well organized in a SCIOPTA project.
6.7.1 Global Message Number Defines File
All message IDs greater than 0x8000000 are reserved for SCIOPTA internal modules and functions and may not
be used by the application. These messages are defined in the file defines.h. Please consult this file for managing
and organizing the message IDs of your application.
defines.h System wide constant definitions.
File location: <installation_folder>\sciopta\<version>\include\ossys\
6.8 Example
This is a very small example showing how to handle messages in a SCIOPTA process. The process “keyboard”
just allocates a messages fills it with a character and sends it to a process “display”.
#define CHAR_MSG (5)
typedef struct char_msg_s
{
sc_msgid_t id;
char character;
} char_msg_t;
union sc_msg
{
sc_msgid_t id;
char_msg_t char_msg;
};
SC_PROCESS (keyboard)
{
sc_msg_t msg; /* Process message pointer */
sc_pid_t to; /* Receiving process ID */
to = sc_procIdGet (“display”, SC_NO_TMO); /* Get process ID */
/* for process display */
for (;;)
{
msg = msgAlloc(sizeof (char_msg_t), CHAR_MSG, SC_DEAFULT_POOL, SC_NO_TMO);
/* Allocates the message */
msg->char_msg.character = 0x40 /* Loads 0x40 */
sc_msgTx (&msg, to, 0); /* Sends message to process display */
sc_sleep (1000); /* Waits 1000 ticks */
}
}