SCIOPTAKernelManual 5 0
SCIOPTAKernelManual 5 0
Copyright (C) 2018 by SCIOPTA Systems GmbH. All rights reserved. No part of this publication may be
reproduced, transmitted, stored in a retrieval system, or translated into any language or computer language,
in any form or by any means, electronic, mechanical, optical, chemical or otherwise, without the prior writ-
ten permission of SCIOPTA Systems GmbH. The Software described in this document is licensed under a
software license agreement and maybe used only in accordance with the terms of this agreement.
Disclaimer
SCIOPTA Systems GmbH, makes no representations or warranties with respect to the contents hereof and
specifically disclaims any implied warranties of merchantability of fitness for any particular purpose. Fur-
ther, SCIOPTA Systems GmbH, reserves the right to revise this publication and to make changes from time
to time in the contents hereof without obligation to SCIOPTA Systems GmbH to notify any person of such
revision or changes.
Trademark
Corporate Headquarters
SCIOPTA Systems GmbH
Hauptstrasse 293
79576 Weil am Rhein
Germany
Tel. +49 7621 940 919 0
Fax +49 7621 940 919 19
email: sales@[Link]
[Link]
Table of Contents
1. SCIOPTA Real Time Operating System ............................................................. 1-1
1.1 Introduction ........................................................................................................................................ 1-1
1.2 CPU Families ..................................................................................................................................... 1-2
1.3 SCIOPTA Kernels.............................................................................................................................. 1-2
1.4 About this Manual.............................................................................................................................. 1-2
1.5 SCIOPTA System Manuals................................................................................................................ 1-2
SCIOPTA - Kernel
Kernel Manual Version 5.0 I
Table of Contents
SCIOPTA - Kernel
II Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 III
Table of Contents
SCIOPTA - Kernel
IV Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 V
Table of Contents
SCIOPTA - Kernel
VI Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 VII
Table of Contents
SCIOPTA - Kernel
VIII Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 IX
Table of Contents
SCIOPTA - Kernel
X Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 XI
Table of Contents
SCIOPTA - Kernel
XII Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 XIII
Table of Contents
SCIOPTA - Kernel
XIV Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 XV
Table of Contents
SCIOPTA - Kernel
XVI Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 XVII
Table of Contents
SCIOPTA - Kernel
XVIII Version 5.0 Kernel Manual
Table of Contents
SCIOPTA - Kernel
Kernel Manual Version 5.0 XIX
Table of Contents
SCIOPTA - Kernel
XX Version 5.0 Kernel Manual
1 SCIOPTA Real Time Operating System
1.1 Introduction
SCIOPTA is a high performance fully pre-emptive real-time operating system for hard real-time application
available for many target platforms.
Available modules:
• Pre-emptive Multitasking Real-Time Kernel
• SCIOPTA Memory Management System - Support for MMU/MPU
SCIOPTA - Kernel Manual
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 1-1
1 SCIOPTA Real Time Operating System
SCIOPTA - Kernel
1-2 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2 SCIOPTA Architecture
2.1 Introduction
SCIOPTA is a pre-emptive multi-tasking high performance real-time operating system (RTOS) for using in em-
bedded systems. SCIOPTA is a so-called message based RTOS that is, interprocess communication and coordina-
tion are realized by messages.
A typical system controlled by SCIOPTA consists of
a number of more or less independent tasks called pro-
cesses. Each process can be seen as if it has the whole
SCIOPTA - Kernel Manual
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-1
2 SCIOPTA Architecture
SCIOPTA Real-Time Kernel V2 (Version 2) is the successor to the SCIOPTA standard kernel V1 (Version 1).
Differences between SCIOPTA Kernel V2 and V1:
• Module priority: No process inside a module is allowed to have a higher priority than modules’s maximum pri-
ority.
• Module friendship concept has been removed.
SCIOPTA - Kernel
2-2 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.2 Modules
2.2.1 Introduction
SCIOPTA allows you to group processes into functional units called modules. Very often you want to decompose
a complex application into smaller units which you can realize in SCIOPTA by using modules. This will improve
system structure. A SCIOPTA process can only be created from within a module.
A typical example would be to encapsulate a whole communication stack into one module and to protect it against
other function modules in a system.
SCIOPTA - Kernel Manual
When creating and defining modules the maximum number of pools and processes must be defined. There is a
maximum number of 128 modules per SCIOPTA system possible.
Kernel V1:
For process scheduling SCIOPTA uses a combination of the module priority and process priority called ef-
fective priority. The kernel determines the effective priority as follows:
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-3
2 SCIOPTA Architecture
In larger systems it is often necessary to protect certain areas to be accessed by others. In SCIOPTA the user can
achieve this by grouping processes into modules creating sub-systems which can be protected.
Full protection is achieved if memory segments are isolated by a hardware Memory Management Unit (MMU). In
SCIOPTA such protected memory segments would be laid down at module boundaries.
System protection and MMU support is optional in SCIOPTA.
Kernel V1:
SCIOPTA supports also the “friend” concept. Modules can be “friends” of other modules. This has mainly
consequences on whether message will be copied or not at message passing.
A module can be declared as friend by the sc_moduleFriendAdd system call. The friendship is only in one
direction. If module A declares module B as a friend, module A is not automatically also friend of Module
B. Module B would also need to declare Module A as friend by the sc_moduleFriendAdd system call.
Each module maintains a 128 bit wide bit field for the declared friends. For each friend a bit is set which
corresponds to its module ID.
Not supported!
SCIOPTA - Kernel
2-4 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Static modules are modules which are automatically created when the systems boots up. They are defined in the
SCONF configuration tool. Please consult the CPU-Specific SCIOPTA System Manuals for more information.
SCIOPTA - Kernel Manual
Modules can also be created dynamically by the “sc_moduleCreate” (Kernel V1) or the
“sc_moduleCreate2” (Kernels V2 and V2INT) system calls.
sc_moduleid_t sc_moduleCreate (
const char *name,
void (*init) (void),
sc_bufsize_t stacksize,
sc_prio_t moduleprio,
char *start,
sc_modulesize_t size,
sc_modulesize_t initsize,
unsigned int max_pools,
unsigned int max_procs
);
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-5
2 SCIOPTA Architecture
sc_moduleid_t sc_moduleCreate2 (
sc_mdb_t *mdb // Pointer to the module descriptor block
);
Please consult chapter 3.4 “Module System Calls” on page 3-6 for the list of Module System Calls.
SCIOPTA - Kernel
2-6 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.3 Processes
2.3.1 Introduction
An independent instance of a program running under the control of SCIOPTA is called process. SCIOPTA is as-
signing CPU time by the use of process priority and guarantees that at every instant of time, the most important
process ready to run is executing. The system interrupts processes if other processes with higher priority must ex-
ecute (become ready).
All SCIOPTA processes have system wide unique process identities.
SCIOPTA - Kernel Manual
A SCIOPTA process is always part of a SCIOPTA module. Please consult chapter 2.2 “Modules” on page 2-3 for
more information about SCIOPTA modules.
stop process
[Link] Ready RUNNING
If a process is in the ready state it is ready
to run meaning the process needs the message
transmit sleep
CPU, but another process with higher pri- message
ority is running. start process receive
(higher priority)
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-7
2 SCIOPTA Architecture
Static processes are created by the kernel at start-up. They are designed inside a configuration utility by defining
the name and all other process parameters. At start-up the kernel puts all static created processes into READY or
WAITING (stopped) state.
Static processes are supposed to stay alive as long as the whole system is alive. But nevertheless in SCIOPTA static
processes can be killed at run-time but they will not return their used memory.
Dynamic processes can be created and killed during run-time. Often dynamic processes are used to run multiple
instances of common code. The number of instances is only limited by system resources.
Another advantage of dynamic processes is that the resources such as stack space will be given back to the system
after a dynamic process is killed.
sc_pid_t sc_procPrioCreate (
const char *name,
void (*entry) (void),
sc_bufsize_t stacksize,
sc_ticks_t slice,
sc_prio_t prio,
int state,
sc_poolid_t plid
);
Figure 2-3: Create Process System Call (prioritzed process for Kernel V1)
SCIOPTA - Kernel
2-8 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
sc_pid_t sc_procCreate2(
sc_pdb_t *pdb,
int state,
sc_poolid_t plid
);
SCIOPTA - Kernel Manual
Each process has a unique process identity (process ID) which is used in SCIOPTA system calls when processes
need to be addressed.
The process ID will be allocated by the operating system for all processes which you have entered during SCIOP-
TA configuration (static processes) or will be returned when you are creating processes dynamically. The kernel
maintains a list with all process names and their process IDs.
The user can get Process IDs by using the “sc_procIdGet” system call including the process name.
In SCIOPTA a process can be seen as independent tasks. SCIOPTA guarantees that always the most important pro-
cess at a certain moment is executing. Each prioritized process has a priority and the SCIOPTA scheduler is giving
CPU time to processes according to these priorities. The process with higher priority runs (gets the CPU) before
the process with lower priority.
If a process has terminated its job for the moment by for example waiting on a message which has not yet been sent
or by calling the kernel sleep function, the process is put into the waiting state and is not any longer ready.
Most of the time in a SCIOPTA real-time system is spent in prioritized processes. It is where collected data is an-
alysed and complicated control structures are executed.
Prioritized processes respond much slower than interrupt processes, but they can spend a relatively long time to
work with data.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-9
2 SCIOPTA Architecture
Static prioritized processes are defined in the SCIOPTA configuration utility (SCONF) and created by the kernel
automatically at system startup. Please consult the CPU-Specific SCIOPTA System Manuals for more information.
Dynamic prioritized processes are created by using the “sc_procPrioCreate” (Kernel V1) or the “sc_procCreate2”
(Kernels V2 and V2INT) system call and killed dynamically with the “sc_procKill” system call.
Each SCIOPTA process has a specific priority. The user defines the priorities at system configuration or when cre-
ating the process. Process priorities can be modified during run-time.
By assigning a priority the user designs groups of processes or parts of systems according to response time require-
ments. Ready processes with high priority are always interrupting processes with lower priority. Subsystems with
high priority processes have therefore faster response time. Priority values for prioritized processes in SCIOPTA
can be from 0 to 31. 0 is the highest and 31 the lowest priority level.
Kernel V1:
For process scheduling SCIOPTA uses a combination of the module priority and process priority called ef-
fective priority. The kernel determines the effective priority as follows:
SCIOPTA - Kernel
2-10 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Process Template
#include <sciopta.h> /* SCIOPTA standard prototypes and definitions */
}
}
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-11
2 SCIOPTA Architecture
An interrupt is a system event generated by a hardware device. The CPU will suspend the current running program
and activates an interrupt service routine assigned to this interrupt.
Static interrupt processes are defined in the SCIOPTA configuration utility (SCONF) and created by the kernel au-
tomatically at system startup. See also chapter...
Kernel V1:
Dynamic interrupt process are created by using the “sc_procIntCreate” system call and killed dynamically
with the “sc_procKill” system call.
SCIOPTA - Kernel
2-12 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
This is the hardware interrupt vector which did activate the interrupt process.
See “sc_procIrqRegister” for more information.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-13
2 SCIOPTA Architecture
switch (irq_src) {
default:
/* Error handling sc_miscError() */
break;
}
}
SCIOPTA - Kernel
2-14 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
switch (irq_src) {
break;
default:
/* Error handling sc_miscError() */
break;
}
}
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-15
2 SCIOPTA Architecture
A timer process in SCIOPTA is a specific interrupt process connected to the tick timer of the operating system.
SCIOPTA is calling each timer process periodically.
Static timer processes are defined in the SCIOPTA configuration utility (SCONF) and created by the kernel auto-
matically at system startup.
Kernel V1:
Dynamic interrupt process are created by using the “sc_procTimCreate” system call and killed dynamically
with the “sc_procKill” system call.
The timer processes are bound to the system tick. Therefore they run with the same hardware priority as the tick
interrupt.
Timer processes are written exactly the same way as interrupt processes. Please consult chapter [Link] “Writing
Interrupt Processes” on page 2-13 for information how to write interrupt processes.
Unlike interrupts timer processes can be stopped and started also in Kernel V1.
SCIOPTA - Kernel
2-16 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
The init process is the first process in a module. Each module has at least one process and this is the init process.
At module start the init process gets automatically the highest priority (0). After the init process has done some
work, the user can change the process priority. If the user does not change the priority, SCIOPTA it will set the
priority to a specific lowest level (32) and enter an endless loop.
The init process acts therefore also as idle process which will run when all other processes of a module are in the
SCIOPTA - Kernel Manual
waiting state.
In static modules the init process is written, created and started automatically. Static modules are defined and con-
figured in the SCONF configuration utility. The code of the init process is generated automatically by the SCONF
configuration tool and included in the file sconf.c. The init process function name will be set automatically by the
kernel in sconf.c to: <module_name>_init. The init process of the system module will create all static SCIOPTA
objects such as other modules, processes and pools.
In dynamic modules the init process is also created and started automatically. But the code of the init process must
be written by the user. The entry point of the init process is given as parameter of the dynamic module create system
calls. Please see below for more information how to write init processes for dynamic modules.
Statically created init processes call a user function (module hook) which is named like the module. This user func-
tion can be empty or does not have to return.
Example: Module “dev”, module hook: void dev()
{
sc_procPrioSet(31);
for(;;){
heartBeat();
}
}
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-17
2 SCIOPTA Architecture
Only init processes of dynamic modules must be written by the user. The entry point of the init process is given as
parameter of the dynamic module create system calls. At start-up the init process gets the highest priority (0). The
user must set the priority to 32 at the end of the init process code.
Template of a minimal init process of a dynamic module:
SC_PROCESS(dynamicmodule_init)
{
/* Important init work on priority level 0 can be included here */
SCIOPTA - Kernel
2-18 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.3.13 Daemons
Daemons are internal processes in SCIOPTA and are structured the same way as ordinary processes. They have a
process control block (pcb), a process stack and a priority.
The process daemon (sc_procd) is identifying processes by name and supervises created and killed processes.
Whenever you are using the “sc_procIdGet” system call you need to start the process daemon.
SCIOPTA - Kernel Manual
Process Daemon
The process daemon is part of the kernel. But to use it you need to define and declare it in the SCONF configuration
utility.
The process daemon can only be created and placed in the system module.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-19
2 SCIOPTA Architecture
The Kernel Daemon (sc_kerneld) is creating and killing modules and processes. Some time consuming system
work of the kernel (such as module and process killing) returns to the caller without having finished all related
work. The Kernel Daemon is doing such work at appropriate level.
Whenever you are using process or module create or kill system calls you need to start the kernel daemon.
The kernel daemon is part of the kernel. But to use it you need to define and declare it in the SCONF configuration
utility.
The kernel daemon can only be cleared and placed in the system module.
SCIOPTA - Kernel
2-20 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
When creating processes either statically in the SCONF configuration tool or dynamically with the “sc_procPrio-
Create”, “sc_procIntCreate”, “sc_procTimCreate” in Kernel V1 or “sc_procCreate2” in Kernel V2 and V2INT
system calls you always need to give a stack size.
All process types (init, interrupt, timer, prioritized and daemon) need a stack.
The stack size given must be big enough to hold the call stack and the maximum used local data in the process.
When you start designing a system it is good design practice to define a the stack as large as possible. In a later
stage you can measure the used stack with the SCIOPTA DRUID system level debugger or the “sc_procAttrGet”
SCIOPTA - Kernel Manual
system call (Kernel V2 and V2INT only) and reduce the stacks if needed.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-21
2 SCIOPTA Architecture
[Link] Introduction
In a typical SCIOPTA design you need to address processes. For example you want to
• send SCIOPTA messages to a process
Static processes are created by the kernel at start-up. They are designed with the SCIOPTA SCONF configuration
utility by defining the name and all other process parameters such as priority and process stack sizes.
You can address static process by appending
_pid
to the process name if the process resides in the system module. If the static process resides inside another module
than the system module, you need to precede the process name with the module name and an underscore in be-
tween.
For instance if you have a static process defined in the system module with the name controller you can address it
by giving controller_pid. To send a message to that process you can use:
sc_msgTx (mymsg, controller_pid, myflags);
If you have a static process in the module tcs (which is not the system module) with the name display you can ad-
dress it by giving tcs_display_pid. To send a message to that process you can use:
sc_msgTx (mymsg, tcs_display_pid, myflags);
Dynamic processes can be created and killed during run-time. Often dynamic processes are used to run multiple
instances of common code.
The process IDs of dynamic processes can be retrieved by using the system call “sc_procIdGet”.
The process creation system calls “sc_procPrioCreate”, “sc_procIntCreate” and “sc_procTimCreate” in Kernel
V1 and the “sc_procCreate2” in Kernel V2 and V2INT will also return the process IDs which can be used for
further addressing.
SCIOPTA - Kernel
2-22 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Each process can store local variables inside a protected data area. Process variables are variables which can only
be accesses by functions wthin the context of the process.
The process variable are usually maintained inside a SCIOPTA message and managed by the kernel. The user can
access the process variable by specific system calls.
SCIOPTA - Kernel Manual
Pointer Message ID
Reserved by the kernel
TAG 1
Variable 1
TAG 2
Variable 2
Process Variables
TAG 3
Variable 3
TAG 4
Variable 4
TAG n
Variable n
There can be one process variable data area per process. The user needs to allocate a message to hold the process
variables. Each variable is preceded by a user defined tag which is used to access the variable. The tag and the pro-
cess variable have a fixed size large enough to hold a pointer.
It is the user´s responsibility to allocate a big enough message buffer to hold the maximum needed number of pro-
cess variables. The message buffer holding the variable array will be removed from the process. The process may
no longer access this buffer directly. But it can retrieve the buffer if for instance the number of variables must be
changed.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-23
2 SCIOPTA Architecture
Communication channels between processes in SCIOPTA can be observed no matter if the processes are local or
distributed over remote systems. The process calls “sc_procObserve” which includes the pointer to a return mes-
sage and the process ID of the process which should be observed.
If the observed process dies the kernel will send the defined message back to the requesting process to inform it.
This observation works also with remote process lists in connectors. This means that not only remote processes can
be observed but also connection problems in communication links if the connectors includes the necessary func-
Registration of observation of
process B requesting the mes-
Kernel
sage B_killed as returned in-
formation.
process B
process A B_killed
Message B_killed is returned
sc_procObserve() by the kernel to inform process
A of the killing of process B.
Observed link
SCIOPTA - Kernel
2-24 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.4 Messages
2.4.1 Introduction
SCIOPTA is a so called Message Based Real-Time Operating System. Interprocess communication and coordina-
tion is done by messages. Message passing is a very fast, secure, easy to use and good to debug method.
Messages are the preferred method for interprocess communication in SCIOPTA. SCIOPTA is specifically de-
signed to have a very high message passing performance. Messages can also be used for interprocess coordination
or synchronization duties to initiate different actions in processes. For this purposes messages can but do not need
to carry data.
SCIOPTA - Kernel Manual
A message buffer (the data area of a message) can only be accessed by one process at a time which is the owner of
the message. A process becomes owner of a message when it allocates the message by the “sc_msgAlloc” system
call or when it receives the message by the “sc_msgRx” system call.
Message passing is also possible between processes on different CPUs. In this case specific communication pro-
cess types on each side will be needed called SCIOPTA Connector Processes.
Every SCIOPTA message has a message identity and a range reserved for message data which can be freely ac-
cessed by the user. Additionally there is a hidden data structure which will be used by the kernel. The user can
access this information by specific SCIOPTA system calls. The following information are stored in the message
header:
• Process ID of message owner
• Message size
• Process ID of transmitting process
• Process ID of addressed process
DATA
owner
size message ID
transmitter
user accessible end mark
addressee
internal use
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-25
2 SCIOPTA Architecture
When a process allocates a message it becomes the owner of the message. If the process transmits the message to
another process, then this one becomes the owner. After transmitting, the sending process cannot access the mes-
sage any more. This message ownership feature eliminates access conflicts in a clean and efficient way.
Each process has a message queue for incoming and one for owned messages. Messages are not moved into these
queues but rather linked to it.
[Link] Example
A message pool is created with 8 buffer sizes with the following sizes: 4, 10, 20, 80, 200, 1000, 4048, 16000.
If a message is allocated from that pool which requests 300 bytes, the system will return a buffer with 1000 bytes.
The difference of 700 bytes is not accessible by the user.
If 300 bytes buffer are used more often, it would be good design to modify the buffer sizes for this pool by changing
the size 200 to 300.
Messages are the main data object in SCIOPTA. Messages are allocated by processes from message pools. If a pro-
cess does not need the messages any longer it will free the message and return it to the pool. After this the process
may no longer access the message.
Please consult chapter 2.5 “Pools” on page 2-36 for more information about message pools.
SCIOPTA - Kernel
2-26 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Message passing is the favourite method for interprocess communication in SCIOPTA. Contrary to mailbox inter-
process communication in traditional real-time operating systems SCIOPTA is passing messages directly from pro-
cess to process.
Only messages owned by the process can be transmitted. A process will become owner if the message is allocated
from the message pool or if the process has received the message. When allocating a message by the “sc_msgAl-
loc” system call the user has to define the message ID.
The “sc_msgAlloc” or the “sc_msgRx” calls returns a pointer to the allocated message. The pointer allows the user
to access the message data to initialize or modify it.
SCIOPTA - Kernel Manual
The sending process transmits the message by calling the “sc_msgTx” system call. SCIOPTA changes the owner
of the message to the kernel and puts the message in the queue of the receiver process. It is a linked list of all mes-
sages in the pool transmitted to this process.
If the receiving process is blocked at the “sc_msgRx” system call and is waiting on the transmitted message the
kernel is performing a process swap and activates the receiving process. After reception, the process becomes own-
er of the process and gets the pointer to access the message contents. The “sc_msgRx” call in SCIOPTA supports
selective receiving as every message includes a message ID and sender.
If the received message is not needed any longer or will not be forwarded to another process it shall be returned to
the system by “sc_msgFree”.
Process TX Process RX
sc_msgAlloc
sc_msgTx
sc_msgRx
sc_msgFree
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-27
2 SCIOPTA Architecture
The following method for declaring, accessing and writing message buffers minimizes the risk for bad message
accesses and provides standardized code which is easy to read and to reuse.
Very often designers of message passing real-time systems are using for each message type a separate message file
as include file. Every process can use specific messages by just using a simple include statement for this message.
The SCIOPTA message declaration syntax can be divided into three parts:
Description
The declaration of the message identifier is usually the first line in a message declaration file. The message number
can also be described as message class. Each message class should have a unique message number for identification
purposes.
We recommend to write the message name in upper case letters.
Syntax
#define MESSAGE_NAME (<msg_nr>)
Parameter
msg_nr Message Identifier (ID)
SCIOPTA - Kernel
2-28 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Description
Immediately after the message number declaration usually the message structure declaration follows. We recom-
mend to write the message structure name in lower case letters in order to avoid mixing up with message number
declaration.
The message ID (or message number) id must be the first declaration in the message structure. It is used by the
SCIOPTA kernel to identify SCIOPTA messages. After the message ID all structure members are declared. There
is no limit in structure complexity for SCIOPTA messages. It is only limited by the message size which you are
selecting at message allocation.
SCIOPTA - Kernel Manual
Syntax
struct <message_name>
{
sc_msgid_t id;
<member_type> <member>;
.
.
.
};
Parameter
message_name Name of the message
id This the place where the message number (or message ID) will be stored.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-29
2 SCIOPTA Architecture
Description
All processes which are using SCIOPTA messages should include the following message union declaration.
The union sc_msg is used to standardize a message declaration for files using SCIOPTA messages.
Syntax
Parameter
id Message ID
Must be included in this union declaration. It is used by the SCIOPTA kernel to identify SCIOP-
TA messages.
SCIOPTA - Kernel
2-30 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Message numbers (also called message IDs) should be well organized in a SCIOPTA project.
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.
SCIOPTA - Kernel Manual
2.4.8 Example
#define CHAR_MSG(5)
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 */
for (;;)
{
msg = sc_msgAlloc(sizeof (char_msg_t),
CHAR_MSG,
SC_DEFAULT_POOL,
SC_FATAL_IF_TMO); /* Allocates the message */
msg->char_msg.character = 0x40; /* Loads 0x40 */
sc_msgTx (&msg, to, SC_MSGTX_NO_FLAG); /* Sends message to process display */
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-31
2 SCIOPTA Architecture
A process can only allocate a message from a pool inside the same module.
Messages transmitted and received within a module are not copied, only the pointer to the message is transferred.
Messages which are transmitted across modules boundaries are always copied if the Inter-Module setting in the
system configuration utility is set to “always copy”. If it set to never copy, messages between modules are not
copied.
A module can be declared as friend of another module. A message sent to a process in a friend module will
not be copied. But the returned message will, as the friend ship unilateral. To avoid this the receiver needs
to declare the sender also as friend.
To copy such a message the kernel will allocate a buffer from the default pool of the module where the receiving
process resides. It must be guaranteed that there is a big enough buffer in the receiving module available to fit the
message.
Process Process
SCIOPTA - Kernel
2-32 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
There is a specific flag (SC_MSGTX_RTN2SNDR) in the “sc_msgTx” system call available to get messages back
if it was not possible to deliver it.
If this flag is set in “sc_msgTx” the message will be returned if the addressed process does not exist or there is not
enough space in the receiving message pool when sent to another module.
In this case the sender process must receive the message after it has been sent with the “sc_msgRx” system call.
SCIOPTA - Kernel Manual
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-33
2 SCIOPTA Architecture
SCIOPTA uses the pre-emptive prioritized scheduling for all prioritized process types. Timer process are sched-
uled on a periodic base at well defined time intervals.
The process with the highest priority is running (owning the CPU). SCIOPTA maintains a list of all prioritized pro-
cesses which are ready. If the running process becomes not ready (i.e. waiting on at a message receive which has
not yet arrived) SCIOPTA will activate the next prioritized process with the highest priority. If there are more than
one processes on the same priority ready SCIOPTA will activate the process which became ready in a first-in-first-
Will be activated
sc_msgRx every third tick.
Message not in input
queue. Process now sc_sleep(3)
swapped out and waiting.
Sleeping for 3 ticks. Process
now swapped out and waiting. interrupt tick
return
interrupt
tick+1
return
interrupt tick+3
return
tick+4
SCIOPTA - Kernel
2-34 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
If the kernel receives a message which was sent to an undefined process, this message is transferred by the kernel
to the default connector process. In the process where the default connector is registered, an error handling can then
take place.
This means that each application should contain a default connector process.
If the message is sent with the flag SC_MSGTX_RTN2SNDR, then the message will stay with the sender.
[Link] Example
SCIOPTA - Kernel Manual
SC_PROCESS (sweepbus)
{
sc_msg_t msg;
(void)sc_connectorRegister(1); /* Register as default connector */
for (;;){
msg = sc_msgRx(SC_ENDLESS_TMO, SC_MSGRX_ALL, MSGRX_MSGID);
/* Error handling */
sc_miscError(SC_ERR_SYSTEM_FATAL¦0x10000, (sc_extra_t)msg);
}
}
As soon a message does not have a correct receiver, the kernel is forwarding this message to process sweepbus. In
this process the error_hook is called.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-35
2 SCIOPTA Architecture
2.5 Pools
Messages are the main data object in SCIOPTA. Messages are allocated by processes from message pools. If a pro-
cess does not need the messages any longer it will free it.
There can be up to 127 pools per module for a standard kernel. Please consult chapter 2.2 “Modules” on page 2-3
for more information about the SCIOPTA module concept. The maximum number of pools will be defined at mod-
ule creation. A message pool always belongs to the module where it was created.
The minimum message pool size is the size of the maximum number of messages which ever are allocated at the
same time plus the pool control block (pool_cb).
The pool control block (pool_cb) can be calculated according to the following formula:
pool_cb = 68 + n * 20 + stat * n * 20
where:
stat Process statistics or message statistics are used (1) or not used (0)
SCIOPTA - Kernel
2-36 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Static pools are pools which are automatically created when the systems boots up. They are defined in the SCONF
configuration tool.
SCIOPTA - Kernel Manual
myPool_plid = sc_poolCreate(
/* start-address */ 0,
/* total size */ 4000,
/* number of buffers */ 8,
/* buffersizes */ bufsizes,
/* name */ "myPool"
);
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-37
2 SCIOPTA Architecture
2.6 Hooks
2.6.1 Introduction
Hooks are user written functions which are called by the kernel at different location. They are only called if the
user defined them at configuration. User hooks are used for a number of different purposes and are target system
dependent.
The Error Hook is the most important user hook function and should normally be included in most of the systems.
An error hook can be used to log the error and additional data on a logging device if the kernel has detected an error
condition.
The error hook is described in chapter 2.10 “Error Handling” on page 2-48.
In SCIOPTA you can configure Message Transmit Hooks and Message Receive Hooks. These hooks are called
each time a message is transmitted to any process or received by any process. Transmit and Receive Hooks are
mainly used by user written debugger to trace messages.
Message hooks must be registered by using the “sc_msgHookRegister” system call.
If the user has configured Process Create Hooks and Process Kill Hooks these hooks will be called each time if
the kernel creates or kills a process.
SCIOPTA allows to configure a Process Swap Hook. It is called by the kernel each time a new process is about
to be swapped in. This hook is also called if the kernel is entering idle mode.
Kernel V2: If the IRQ Swap hook is activated, then the swap hook is also called before an interrupt process is en-
tered.
Process hooks must be registered by using the “sc_procHookRegister” system call.
Kernel V1: Select MMU hook checkbox in the SCIOPTA kernel configuration SCONF to enable MMU/MPU sup-
port.
Each time a pool is created or killed, the kernel is calling the Pool Create Hooks and Pool Kill Hooks if thes hooks
have been registerred by the “sc_poolHookRegister” system call.
SCIOPTA - Kernel
2-38 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
After a system hardware reset the following sequence will be executed from point 1.
In the SCIOPTA SCSIM Simulator after Windows has started the SCIOPTA application by calling the sciop-
ta_start function inside the WinMain function the sequence will be executed from point 4.
1. The kernel calls the function reset_hook.
2. The kernel performs some internal initialization.
SCIOPTA - Kernel Manual
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-39
2 SCIOPTA Architecture
In SCIOPTA a reset hook must always be present and must have the name reset_hook.
The reset hook must be written by the user.
After system reset the SCIOPTA kernel initializes a small stack and jumps directly into the reset hook.
The reset hook is mainly used to do some basic chip and board settings. The C environment is not yet initialized
[Link] Syntax
[Link] Parameter
None.
If it is set to !=0 then the kernel will immediately call the dispatcher. This will initiate a warm start.
If it is set to 0 then the kernel will jump to the C startup function. This will initiate a cold start.
[Link] Location
Reset hooks are compiler manufacturer and board specific. Reset hook examples can be found in the SCIOPTA
Board Support Package deliveries.
resethook.S Very early hardware initialization code written in assembler.
The extension .S is used in GCC for assembler source files. For other compiler packages the ex-
tensions for assembler source files might be different.
SCIOPTA - Kernel
2-40 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.7.3 C Startup
After a cold start the kernel will call the C startup function. It initializes the C system and replaces the library C
startup function. C startup functions are compiler specific.
There is no C startup function needed in the SCIOPTA Simulator.
You need to write the WinMain method and include the “sciopta_start” system call to implement a SCIOPTA
WIN32 simulator application.
In the delivered SCIOPTA examples the WinMain method and the whole startup code is usually included in the
file system.c.
system.c SCIOPTA SCSIM Simulator setup including the WinMain method.
File location: <installation_folder>\sciopta\<version>\exp\krn\win32\hello\
In SCIOPTA system running in a real target CPU the module RAM memory map is defined in the linker scripts.
In the SCIOPTA SCSIM Simulator you need to declare the module RAM by a character array of the size of the
module.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-41
2 SCIOPTA Architecture
The start hook must always be present and must have the name start_hook. The start hook must be written by the
user. If a start hook is declared the kernel will jump into it after the C environment is initialized.
The start hook is mainly used to do chip, board and system initialization. As the C environment is initialized it can
be written in C. The start hook would also be the right place to include the registration of the system error hook
(see chapter 2.10.7 “Error Hook Registering” on page 2-51) and other kernel hooks.
[Link] Parameter
None.
None.
[Link] Location
In the delivered SCIOPTA examples the start hook is usually included in the file system.c
system.c System configuration file including hooks (e.g. start_hook) and other setup code.
File location:
<installation_folder>\sciopta\<version>\exp\<product>\<arch>\<example>\<board>\
The init process is the first process in a module. Each module has at least one process and this is the init process.
At module start the init process gets automatically the highest priority (0). After the init process has done some
important work it will change its priority to the lowest level (32) and enter an endless loop.
Priority 32 is only allowed for the init process. All other processes are using priority 0 - 31. The INIT process acts
therefore also as idle process which will run when all other processes of a module are in the waiting state.
The init process of the system module will first be swapped-in followed by the init processes of all other modules.
The code of the module init Processes are automatically generated by the SCONF configuration utility and placed
in the file sconf.c. The module init Processes will automatically be named to <module_name>_init and created.
SCIOPTA - Kernel
2-42 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
Please consult chapter 2.2 “Modules” on page 2-3 for general information about SCIOPTA modules.
After all static modules, pools and processes have been created by the init Process of the system module the kernel
will call a system module start function. This is function with the same name as the system module and must be
written by the user. Blocking system calls are not allowed in the system module start function. All other system
calls may be used.
SCIOPTA - Kernel Manual
In the delivered SCIOPTA examples the system module start function is usually included in the file system.c:
system.c System configuration file including hooks (e.g. start_hook) and other setup code.
File location:
<installation_folder>\sciopta\<version>\exp\<product>\<arch>\<example>\<board>\
All other user modules have also own individual module start functions. These are functions with the same name
of the respective defined and configured modules which will be called by the init Process of each respective mod-
ule.
After returning from the module start functions the init Processes of these modules will change its priority to 32
and go into sleep. These user module start functions can use all SCIOPTA system calls.
The user module start function does not have to be left. It does not have to become an idle process (set priority to
32).
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-43
2 SCIOPTA Architecture
2.8.1 Description
The trigger in SCIOPTA is a method which allows to synchronise processes even faster as with messages. With a
trigger a process will be notified and woken-up by another process. Trigger are used only for process coordination
and synchronisation and cannot carry data. Triggers should only be used if the designer has severe timing problems
and are intended for these rare cases where message passing would be to slow.
Process waiting
on the trigger
Trigger Process issuing a
trigger event
sc_triggerWait()
sc_trigger()
There are four system calls available to work with triggers. The “sc_triggerWait” call decrements the value of the
trigger and the calling process will be blocked and swapped out if the value gets negative or equal to zero. Only
the owner process of the trigger can wait for it. The process gets ready again when either the optional timeout ex-
pires or the trigger variable become greater than zero by other processes calling “sc_trigger”. In case of an timeout,
the trigger is incremented by the same amount as it has been decremented before. Note: “sc_trigger” calls which
do not increment the variable to a value greater than zero will not be lost.
If the now ready process has a higher priority than the actual running process the operating system will preempt
the running process and execute the triggered process.
The “sc_triggerValueSet” system call allows to sets the value of a trigger. Only the owner of the trigger can set the
value. Processes can also read their own or other's value of the trigger variable by the “sc_triggerValueGet” call.
Also interrupt processes have a trigger but they cannot wait on it. If a process is triggering an interrupt process, the
interrupt process gets a software event. This is the same as if an interrupt occurs. The user can investigate a flag
which informs if the interrupt process was activated by a real interrupt or woken-up by such a trigger event.
The trigger variable is bound to an upper limit of 0x7fffffff.
SCIOPTA - Kernel
2-44 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
SC_INT_PROCESS(myint, src)
{
if ( src == SC_PROC_WAKEUP_HARDWARE ){
sc_trigger(trigproc_pid);
}
}
SCIOPTA - Kernel Manual
SC_PROCESS (trigproc)
{
for (;;)
{
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-45
2 SCIOPTA Architecture
2.9.1 Introduction
Time management is one of the most important tasks of a real-time operating system. There are many functions in
SCIOPTA which depend on time. A process can for example wait a specific time for a message to arrive or can be
suspended for a specific time or timer processes can be defined which are activated at periodic time intervals.
Time is managed by SCIOPTA by a tick timer which can be selected and configured by the user.
Typical time values between two ticks range between one and 10 milliseconds.
The system tick is configured by the sciopta configuration utility SCONF (please consult the SCIOPTA Systems
Manuals for your specific CPU family).
An external tick interrupt process is usually included in the board support package.
systick.<ext> System tick interrupt process.
File location: <installation_folder>\sciopta\<version>\bsp\<arch>\<cpu>\
SCIOPTA - Kernel
2-46 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
[Link] Introduction
SCIOPTA has a built-in message based time-out server. Processes can register a time-out job with the time-out
server. This done by the “sc_tmoAdd” system call which requests a time-out message from the kernel after a de-
fined time.
The caller needs to allocate a message and include the pointer to this message in the call. The kernel will send this
message back to the caller after the time has expired.
A time-out is requested by the “sc_tmoAdd” system call.
This is an asynchronous call, the caller will not be blocked.
The registered time-out can be cancelled by the “sc_tmoRm” call before the time-out has expired.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-47
2 SCIOPTA Architecture
2.10.1 Introduction
SCIOPTA has many built-in error check functions. The following list shows some examples.
• When allocating a message it is checked if the requested buffer size is available and if there is still enough mem-
ory in the message pool.
In SCIOPTA all error conditions will end up in an Error Hook. This guarantees that all errors are treated and that
the error handling does not depend on individual error strategies which might vary from user to user.
There are two error hooks available:
A) Module Error Hook
B) Global Error Hook
If the kernel detect an error condition it will first call the module error hook and if it is not available call the global
error hook. Error hooks are normal error handling functions and must be written by the user. Depending on the type
of error (fatal or nonfatal) it will not be possible to return from an error hook. If there are no error hooks present
the kernel will enter an infinite loop (at label SC_ERROR) and all interrupts are disabled.
Note: The use of module error hooks is deprecated
For system wide fatal errors (error type: SC_ERR_SYSTEM_FATAL) the kernel will directly call the error hook.
For all other types of errors and warnings the error hook will be called if no error process is registered.
If there was a fatal module or process error (error types: SC_ERR_MODULE_FATAL or
SC_ERR_PROCESS_FATAL) and if an error process exists, the module or process will be stopped and then
the error process will be activated.
If there was a module or process warning (error types: SC_ERR_MODULE_WARNING or
SC_ERR_PROCESS_WARNING) and if an error process exists it will be activated.
For double faults (e.g. a fault during error handling) the kernel jumps to the label sc_fatal and loops for ever with
interrupts disabled.
SCIOPTA - Kernel
2-48 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
In SCIOPTA all error conditions will end up in the error hook. As already stated there are two error hooks availa-
ble: the Module Error Hook and the Global Error Hook.
An error hook can only use the following system calls:
sc_miscCrc Calculates a 16 bit CRC over a specified memory range.
sc_miscCrcContd Calculates a 16 bit CRC over an additional memory range.
sc_miscErrnoGet Returns the process error number (errno) variable.
SCIOPTA - Kernel Manual
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-49
2 SCIOPTA Architecture
SCIOPTA - Kernel
2-50 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
When the error hook is called from the kernel, all information about the error are transferred in 32-bit error word
(parameter errcode). Please consult chapter 5 “Kernel Error Reference” on page 5-1 for detailed description of the
SCIOPTA error word. There are also up to four additional 32-bit extra words (parameters extra1 ... extra3) avail-
able to the user.
SCIOPTA - Kernel Manual
32 Bits
The Function Code defines from which SCIOPTA system call the error was initiated.
The Error Code contains the specific error information.
The Error Type informs about the source and type of error.
There are three error types in a SCIOPTA kernel.
• SC_ERR_SYSTEM_FATAL, system wide fatal error.
• SC_ERR_MODULE_FATAL, module wide fatal error.
• SC_ERR_PROCESS_FATAL, process wide fatal error.
There are three error warnings in a SCIOPTA kernel.
• SC_ERR_SYSTEM_WARNING, system wide warning.
• SC_ERR_MODULE_WARNING, module wide warning.
• SC_ERR_PROCESS_WARNING, process wide warning.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-51
2 SCIOPTA Architecture
[Link] Description
For each registered error hook there must be a declared error hook function.
int <err_hook_name> (sc_errcode_t errcode, sc_extra_t extra, int user, sc_pcb_t *pcb)
{
};
[Link] Parameter
SCIOPTA - Kernel
2-52 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
#include "sconf.h"
#include <sciopta.h>
#include <ossys/errtxt.h>
#if SC_ERR_HOOK == 1
int error_hook(sc_errcode_t err,void *ptr,int user,sc_pcb_t *pcb)
{
kprintf(9,"Error\n %08lx(%s,line %d in %s) %08lx %8lx %08lx %08lx\n",
(int)pcb>1 ? pcb->pid:0,
(int)pcb>1 ? pcb->name:"xx",
SCIOPTA - Kernel Manual
(int)pcb>1 ?pcb->cline:0,
(int)pcb>1 ?pcb->cfile:"xx",
pcb,
err,
ptr,
user);
if ( user != 1 &&
((err>>12)&0xfff) <= SC_MAXERR &&
(err>>24) <= SC_MAXFUNC )
{
kprintf(0,"Function: %s\nError: %s\n",
func_txt[err>>24],
err_txt[(err>>12)&0xfff]);
}
return 0;
}
#endif
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-53
2 SCIOPTA Architecture
[Link] Description
For each registered error hook there must be a declared error hook function.
};
[Link] Parameter
SCIOPTA - Kernel
2-54 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-55
2 SCIOPTA Architecture
#include "sconf.h"
#include <sciopta.h>
#include <[Link]>
#include <ossys/errtxt.h>
kprintf(9,"%s-Error\n"
" %08lx(%s,line %d in %s)\n"
" pcb = %08lx err = %08lx extra = %08lx,%08lx,%08lx,%08lx\n",
errMsg->user ? "User" : "System",
pcb ? ERR_PCB_PID:0,
pcb ? ERR_PCB_NAME:"xx",
pcb ? pcb->cline:0,
pcb ? pcb->cfile:"xx",
pcb,
err,
errMsg->extra0,errMsg->extra1,errMsg->extra2,errMsg->extra3);
if ( errMsg->user != 1 &&
((err>>12)&0xfff) <= SC_MAXERR &&
(err>>24) <= SC_MAXFUNC )
{
kprintf(0,"Function: %s\nError: %s\n",
func_txt[err>>24],
err_txt[(err>>12)&0xfff]);
}
kprintf(0,"<stopped>\n");
}
SCIOPTA - Kernel
2-56 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
The actions of the kernel after returning from the module or global error hook depend on the error hook return val-
ues and the error types as described in the following table.
No - No - X Endless loop.
Yes Endless loop.
0 -
No Endless loop.
Yes No
Yes Kill module and swap out.
1 -
No Return & continue.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-57
2 SCIOPTA Architecture
Contrary to the error hook the error process can use all non-blocking SCIOPTA system calls. The error process
runs in the context of the init process.
Only one error process can be registered for the whole system.
#include "sconf.h"
#include <sciopta.h>
#include <[Link]>
#include <ossys/errtxt.h>
union sc_msg {
sc_msgid_t id;
sc_moduleKillMsg_t mKill;
sc_procKillMsg_t pKill;
};
SCIOPTA - Kernel
2-58 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
msg->[Link] = save_pidGet(&errMsg->pcb->pid);
msg->[Link] = 0;
} else {
return;
}
if ( errorProxy_pid && errorProxy_pid != SC_ILLEGAL_PID ){
sc_msgTx(&msg, errorProxy_pid, SC_MSGTX_RTN2SND);
}
if ( msg ){
sc_msgFree(&msg);
kprintf(0,"No errorProxy\n");
}
}
The error proxy is a normal prioritized process which works on behalf of the error process. The error proxy is op-
tional and can use all SCIOPTA system calls.
Communication between error process and error proxy is done by normal SCIOPTA messages.
For example an error proxy can kill and create modules and processes.
2.10.12.1Example
#include "sconf.h"
#include <sciopta.h>
#include <[Link]>
#include <ossys/errtxt.h>
union sc_msg {
sc_msgid_t id;
sc_moduleKillMsg_t mKill;
sc_procKillMsg_t pKill;
};
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-59
2 SCIOPTA Architecture
SC_PROCESS(errorProxy)
{
static const sc_msgid_t sel[3] = {
SC_MODULEKILLMSG,
SC_PROCKILLMSG,
0
};
sc_msg_t msg;
Each SCIOPTA process has an errno variable. This variable is used mainly by library functions. The errno variable
can only be accessed by some specific SCIOPTA system calls.
The errno variable will be copied into the observe messages if the process dies.
SCIOPTA - Kernel
2-60 Manual Version 5.0 Kernel Manual
2 SCIOPTA Architecture
2.11.1 Introduction
SCIOPTA is a message based systems and therefore very well suited to support distributed multi-CPU systems.
For an application programmer it does not matter if he is transmitting a message to a process on the same CPU or
on a remote CPU. He will use exactly the same system calls. The SCIOPTA kernels and the SCIOPTA CONNEC-
TOR processes have knowledge of the whole distributed environment and they take care of all details when mes-
sages need to be sent beyond CPU boundaries.
SCIOPTA - Kernel Manual
2.11.2 Connectors
CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA Systems.
There may be more than one CONNECTOR process in a system or module. CONNECTOR processes can be seen
globally inside a SCIOPTA system by other processes. The name of a CONNECTOR process represents the name
of the remote system.
There must be one connector per remote system.
SCIOPTA System B
Remote
SCIOPTA System A Process
CONNECTOR List
Remote Process
CONNECTOR B 02
Process Process
List B 01
Process
B 03
Process
A 01
Process
B 04
Process
A 02 Process
A 03
Process
B 01
Process
B 02
Process Process
A 21 Process
A 11
B 03
Process
A 12
Process
Process A 22
A 13
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 2-61
2 SCIOPTA Architecture
If a process in one system (CPU) wants to communicate with a process in another system (CPU) it first will search
for the remote process by using the “sc_procIdGet” system call. The parameter of this call includes the process
name and the path to where to find it in the form:
//remote-system/module/procname
If the process does not reside on the same CPU as the caller, the kernel transmits a message to the CONNECTOR
If the kernel receives a message which was sent to an undefined process, this message is transferred by the kernel
to the default connector process.
Please consult chapter 2.4.12 “Message Sent to Unknown Process” on page 2-35 for a detailed description.
SCIOPTA - Kernel
2-62 Manual Version 5.0 Kernel Manual
3 System Calls Overview
3.1 Introduction
This chapter list all SCIOPTA system calls in functional groups. Please consult chapter 4 “System Calls Reference”
on page 4-1 for an alphabetical list.
Please Note:
There are three Kernel Technologies within SCIOPTA: V1, V2 and V2INT. The V1 Kernels are written in 100%
Assembler and are specifically tuned for the ARM Architectures. V2 Kernels are mostly written in “C” and avail-
SCIOPTA - Kernel Manual
able for many CPUs and Architectures. V2INT kernels have built-in integrity of RTOS data to be used in safety
certified systems.
If nothing is noted in the following lists below, the system call is valid for all three Kernel Technologies.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 3-1
3 System Calls Overview
SCIOPTA - Kernel
3-2 Manual Version 5.0 Kernel Manual
3 System Calls Overview
sc_procCBChk Does a diagnostic test for all elements of the process control block of specific pro-
cess.
Only: Kernel Technologies: V2INT
Chapter 4.62 “sc_procCBChk” on page 4-104.
sc_procCreate2 Requests the kernel daemon to create process.
Only: Kernel Technologies: V2 and V2INT
Chapter 4.63 “sc_procCreate2” on page 4-106.
sc_procDaemonRegister Registers a process daemon which is responsible for pidGet request.
Chapter 4.64 “sc_procDaemonRegister” on page 4-114.
sc_procDaemonUnregister Unregisters a process daemon.
Chapter 4.65 “sc_procDaemonUnregister” on page 4-115.
sc_procFlowSignatureGet Gets the process program flow signature of the caller.
Only: Kernel Technologies: V2 and V2INT
Chapter 4.66 “sc_procFlowSignatureGet” on page 4-116.
sc_procFlowSignatureInit Initializes the process program flow signature of the caller.
Only: Kernel Technologies: V2 and V2INT
Chapter 4.67 “sc_procFlowSignatureInit” on page 4-117.
sc_procFlowSignatureUpdate Updates the process program flow signature of the caller.
Only: Kernel Technologies: V2 and V2INT
Chapter 4.68 “sc_procFlowSignatureUpdate” on page 4-118.
sc_procHookRegister Registers a process hook.
Chapter 4.69 “sc_procHookRegister” on page 4-119.
sc_procIdGet Returns the process ID of a process.
Chapter 4.70 “sc_procIdGet” on page 4-121.
sc_procIntCreate Request the kernel daemon to create an interrupt process.
Only: Kernel Technologies: V1
Chapter 4.71 “sc_procIntCreate” on page 4-123.
sc_procIrqRegister Registers an existing interrupt process for another interrupt vector.
Chapter 4.72 “sc_procIrqRegister” on page 4-125.
sc_procIrqUnregister Unregisters previously registered interrupts.
Chapter 4.73 “sc_procIrqUnregister” on page 4-127.
sc_procKill Requests the kernel daemon to kill a process.
Chapter 4.74 “sc_procKill” on page 4-128.
sc_procNameGet Returns the full name of a process.
Chapter 4.75 “sc_procNameGet” on page 4-130.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 3-3
3 System Calls Overview
sc_procObserve Request a message to be sent if the given process pid dies (process supervision).
Chapter 4.76 “sc_procObserve” on page 4-132.
sc_procPathCheck Checks if the construction of a path is correct.
Chapter 4.77 “sc_procPathCheck” on page 4-134.
sc_procPathGet Returns the path of a process.
Chapter 4.78 “sc_procPathGet” on page 4-135.
SCIOPTA - Kernel
3-4 Manual Version 5.0 Kernel Manual
3 System Calls Overview
group.
Chapter 4.99 “sc_procYield” on page 4-167.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 3-5
3 System Calls Overview
SCIOPTA - Kernel
3-6 Manual Version 5.0 Kernel Manual
3 System Calls Overview
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 3-7
3 System Calls Overview
SCIOPTA - Kernel
3-8 Manual Version 5.0 Kernel Manual
3 System Calls Overview
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 3-9
3 System Calls Overview
SCIOPTA - Kernel
3-10 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.1 Introduction
This chapter contains a detailed description of all SCIOPTA kernel system calls in alphabetical order.
4.2 sc_connectorRegister
4.2.1 Description
This system call is used to register a connector process. The caller becomes a connector process.
Connector processes are used to connect different target in distributed SCIOPTA systems. Messages sent to exter-
nal processes (residing on remote target or CPU) are sent by the kernel to the local connector processes.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.2.2 Syntax
sc_pid_t sc_connectorRegister(
int defaultConn
);
4.2.3 Parameter
4.2.5 Example
sc_pid_t connid;
connid = sc_connectorRegister(1);
4.2.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_SYSTEM_FATAL
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-1
4 System Calls Reference
KERNEL_EALREADY_DEFINED ¦ SC_ERR_SYSTEM_FATAL
Default CONNECTOR is already defined: e0 = pid
Process is already a CONNECTOR: e0 = 0
KERNEL_ENO_MORE_CONNECTOR
The maximum number of CONNECTORS is reached.
SCIOPTA - Kernel
SCIOPTA - Kernel
4-2 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.3 sc_connectorRemote2Local
4.3.1 Description
4.3.2 Syntax
void sc_connectorRemote2Local(void);
4.3.3 Parameter
SCIOPTA - Kernel
None
None
4.3.5 Example
sc_connectorRemote2Local;
4.3.6 Errors
KERNEL_ENO_CONNECTOR ¦ SC_ERR_SYSTEM_FATAL
Caller is not a connector process. e0 = 0
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-3
4 System Calls Reference
4.4 sc_connectorUnregister
4.4.1 Description
This system call is used to remove a registered connector process. The caller becomes a normal prioritized process.
Kernels: V1, V2 and V2INT
4.4.2 Syntax
void sc_connectorUnregister(void);
SCIOPTA - Kernel
4.4.3 Parameter
None
None
4.4.5 Example
sc_connectorUnregister;
4.4.6 Errors
KERNEL_ENO_CONNECTOR ¦ SC_ERR_SYSTEM_FATAL
Caller is not a connector process. e0 = 0
SCIOPTA - Kernel
4-4 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.5 sc_miscCrc
4.5.1 Description
This function calculates a 16 bit cyclic redundancy check value (CRC-16-CCITT) over a specified memory range.
The start value of the CRC is 0xFFFF.
Kernels: V1, V2 and V2INT
4.5.2 Syntax
uint16_t sc_miscCrc(
const uint8_t *data,
unsigned int len
SCIOPTA - Kernel
);
4.5.3 Parameter
4.5.5 Example
uint16_t crc;
ips_socket_t *ref;
4.5.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-5
4 System Calls Reference
4.6 sc_miscCrcContd
4.6.1 Description
This function calculates a 16 bit cyclic redundancy check value (CRC-16-CCITT) over an additional memory
range.
The variable start is the CRC start value.
4.6.2 Syntax
uint16_t sc_miscCrcContd(
SCIOPTA - Kernel
const uint8_t *data,
unsigned int len,
uint16_t start
);
4.6.3 Parameter
4.6.5 Example
4.6.6 Errors
None
SCIOPTA - Kernel
4-6 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.7 sc_miscCrc32
4.7.1 Description
This function calculates a 32 bit cyclic redundancy check value (CRC-32-IEEE 802.3, polynominal:
0x04C11DB7) over a specified memory range.
The start value of the CRC is 0xFFFFFFFF.
Kernels: V2 and V2INT
4.7.2 Syntax
uint32_t sc_miscCrc32(
const uint8_t *data,
SCIOPTA - Kernel
4.7.3 Parameter
4.7.5 Example
uint32_t bcrc;
uint32_t burst[4];
4.7.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-7
4 System Calls Reference
4.8 sc_miscCrc32Contd
4.8.1 Description
This function calculates a 32 bit cyclic redundancy check value (CRC-32-IEEE 802.3, polynomial: 0x04C11DB7)
over an additional memory range.
The variable init is the CRC32 start value.
Kernels: V2 and V2INT
4.8.2 Syntax
SCIOPTA - Kernel
uint32_t sc_miscCrc32Contd(
const uint8_t *data,
unsigned int len,
uint32_t init
);
4.8.3 Parameter
4.8.5 Example
uint32_t b2crc;
uint32_t burst2[4];
4.8.6 Errors
None
SCIOPTA - Kernel
4-8 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.9 sc_miscErrnoGet
4.9.1 Description
This system call is used to get the process error number (errno) variable.
Each SCIOPTA process has an errno variable. This variable is used mainly by library functions.
The errno variable will be copied into the observe messages if the process dies.
Kernels: V1, V2 and V2INT
4.9.2 Syntax
sc_errcode_t sc_miscErrnoGet(void);
SCIOPTA - Kernel
4.9.3 Parameter
None
4.9.5 Example
if ( sc_miscErrnoGet() != 104 ){
kprintf (0,"Can not connect: %d\n",sc_miscErrnoGet ());
}
4.9.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-9
4 System Calls Reference
4.10 sc_miscErrnoSet
4.10.1 Description
This system call is used to set the process error number (errno) variable.
Each SCIOPTA process has an errno variable.
The errno variable will be copied into the observe messages if the process dies.
Kernels: V1, V2 and V2INT
4.10.2 Syntax
SCIOPTA - Kernel
void sc_miscErrnoSet(
sc_errcode_t err
);
4.10.3 Parameter
None.
4.10.5 Example
sc_miscErrnoSet(ENODEV);
4.10.6 Errors
None
SCIOPTA - Kernel
4-10 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.11 sc_miscError
4.11.1 Description
This system call is used to call the error hooks with an user error.
The SCIOPTA error hooks is usually called when the kernel detects a system error. But the user can also call the
error hook and including own error codes and additional information.
This system call will not return if there is no error hook. If an error hook is available the code of the error hook can
decide to return or not.
Kernels: V1, V2 and V2INT
4.11.2 Syntax
SCIOPTA - Kernel
void sc_miscError(
sc_errcode_t err,
sc_extra_t misc
);
4.11.3 Parameter
None.
4.11.5 Example
4.11.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-11
4 System Calls Reference
4.12 sc_miscError2
4.12.1 Description
This system call is used to call the error hooks with an user error.
4.12.2 Syntax
SCIOPTA - Kernel
void sc_miscError2(
sc_errcode_t err,
sc_extra_t extra0,
sc_extra_t extra1,
sc_extra_t extra2,
sc_extra_t extra3
);
4.12.3 Parameter
None.
4.12.5 Example
4.12.6 Errors
None
SCIOPTA - Kernel
4-12 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.13 sc_miscErrorHookRegister
4.13.1 Description
4.13.2 Syntax
SCIOPTA - Kernel
sc_errHook_t *sc_miscErrorHookRegister(
sc_errHook_t *newhook
);
4.13.3 Parameter
Function pointer to the previous error hook if error hook was registered.
0 if no error hook was registered.
4.13.5 Example
sc_errHook_t error_hook;
sc_miscErrorHookRegister( error_hook );
4.13.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_SYSTEM_FATAL
Process ID of caller is not valid (SC_ILLEGAL_PID) e0 = pid
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-13
4 System Calls Reference
4.14 sc_miscFlowSignatureGet
4.14.1 Description
This system call is used to get a global program flow signature at index id.
Kernels: V2 and V2INT
4.14.2 Syntax
uint32_t sc_miscFlowSignatureGet(
unsigned int id,
);
SCIOPTA - Kernel
4.14.3 Parameter
Signature value.
4.14.5 Example
---
4.14.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Flow signature ID not valid (id >= SC_MAX_GFS_IDS). e0 = Flow signature ID (id)
SCIOPTA - Kernel
4-14 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.15 sc_miscFlowSignatureInit
4.15.1 Description
This system call is used to initialize a global program flow signature at index id.
Kernels: V2 and V2INT
4.15.2 Syntax
void sc_miscFlowSignatureInit(
unsigned int id,
uint32_t signature
);
SCIOPTA - Kernel
4.15.3 Parameter
None.
4.15.5 Example
---
4.15.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Flow signature ID not valid (id >= SC_MAX_GFS_IDS). e0 = Flow signature ID (id)
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-15
4 System Calls Reference
4.16 sc_miscFlowSignatureUpdate
4.16.1 Description
4.16.2 Syntax
uint32_t sc_miscFlowSignatureUpdate(
unsigned int id,
uint32_t token
SCIOPTA - Kernel
);
4.16.3 Parameter
Signature value.
4.16.5 Example
---
4.16.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Flow signature ID not valid (id >= SC_MAX_GFS_IDS). e0 = Flow signature ID (id)
SCIOPTA - Kernel
4-16 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.17 sc_moduleCBChk
4.17.1 Description
System call to do diagnostic test for all elements of the module control block of specific module.
Kernels: V2INT
4.17.2 Syntax
int sc_moduleCBChk(
sc_moduleid_t mid,
uint32_t *addr,
unsigned int *size
)
SCIOPTA - Kernel
4.17.3 Parameter
4.17.5 Example
---
4.17.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_PROCESS_FATAL
Parameter mid not valid (>= SC_MAX_MODULE). e0 = mid
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-17
4 System Calls Reference
4.18 sc_moduleCreate
4.18.1 Description
This system call is used to request the kernel daemon to create a module. The standard kernel daemon (sc_kerneld)
needs to be defined and started at system configuration.
When creating a module the maximum number of pools and processes must be defined. There is a maximum num-
ber of 128 modules per SCIOPTA system possible.
Each module has a priority which can range between 0 (highest) to 31 (lowest) priority. For process scheduling
SCIOPTA uses a combination of the module priority and process priority called effective priority. The kernel de-
termines this effective priority as follows:
SCIOPTA - Kernel
p(eff) = min(p(module) + p(process), 31)
This technique assures that process with highest process priority (0) cannot disturb processes in modules with low-
er module priority (module protection).
Each module contains an init process with process priority=0 which will be created automatically.
If the module priority of the created module is higher than the effective priority of the caller the init process of the
created module will be swapped in.
Kernels: V1
4.18.2 Syntax
sc_moduleid_t sc_moduleCreate(
const char *name,
void (*init) (void),
sc_bufsize_t stacksize,
sc_prio_t moduleprio,
char *start,
sc_modulesize_t size,
sc_modulesize_t initsize,
unsigned int max_pools,
unsigned int max_procs
);
SCIOPTA - Kernel
4-18 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.18.3 Parameter
Module ID.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-19
4 System Calls Reference
4.18.5 Example
my_mid = sc_moduleCreate(
/* name */ "m2mod",
/* init function */ m2mod_init,
/* init stacksize */ 512,
/* module prio */ 2,
/* module start */ (char *)[Link],
/* module size */ (uint32_t)[Link],
/* init size */ (uint32_t)[Link],
/* max. pools */ 4,
/* max. process */ 32);
}
SCIOPTA - Kernel
4.18.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EMODULE_TOO_SMALL ¦ SC_ERR_SYSTEM_FATAL
Process control blocks and pool control blocks
do not fit in module size. Module size
KERNEL_EILL_NAME ¦ SC_ERR_SYSTEM_FATAL
Requested name does not comply with SCIOPTA naming rules
or does already exist.
KERNEL_ENO_MORE_MODULE ¦ SC_ERR_SYSTEM_FATAL
Maximum number of modules reached. Number of modules
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Module addresses or sizes not valid.
Start address, size or initsize unaligned.
initsize > size.
SCIOPTA - Kernel
4-20 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.19 sc_moduleCreate2
4.19.1 Description
This system call is used to request the kernel daemon to create a module. The standard kernel daemon (sc_kerneld)
needs to be defined and started at system configuration.
When creating a module the maximum number of pools and processes must be defined. There is a maximum num-
ber of 128 modules per SCIOPTA system possible.
Each module has also a priority which can range between 0 (highest) to 31 (lowest) priority. This module priority
defines a maximum priority level for all processes contained inside that module. The kernel will generate an error,
if a process is created which has a higher priority than the module priority.
Each module contains an init process with process priority = 0 which will be created automatically.
Kernels: V2 and V2INT
SCIOPTA - Kernel
4.19.2 Syntax
sc_moduleid_t sc_moduleCreate2(
sc_mdb_t *mdb
);
4.19.3 Parameter
mdb Pointer to the module descriptor block (mdb) which defines the module to create.
See chapter 4.19.5 “Module Descriptor Block mdb” on page 4-22.
Module ID.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-21
4 System Calls Reference
SCIOPTA - Kernel
uint8_t spare_b;
uint16_t spare_h;
uint32_t *pt;
};
typedef struct sc_mdb_s sc_mdb_t;
SCIOPTA - Kernel
4-22 Manual Version 5.0 Kernel Manual
4 System Calls Reference
This is a structure which is defining the module addresses and the module size to be created. It is usually generated
by the linker script.
It is defined in the header file modules.h.
typedef struct sc_module_addr_s {
char *start;
uint32_t size;
uint32_t initsize;
} sc_module_addr_t;
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-23
4 System Calls Reference
4.19.9 Example
SCIOPTA - Kernel
(void) sc_moduleCreate2(&mdb,0);
4.19.10 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter mdb not valid. 0 or SC_NIL.
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EMODULE_TOO_SMALL ¦ SC_ERR_SYSTEM_FATAL
Process control blocks and pool control blocks
do not fit in module size. e0 = Module size
KERNEL_EILL_NAME ¦ SC_ERR_SYSTEM_FATAL
Requested name does not comply with SCIOPTA naming rules
or does already exist.
KERNEL_ENO_MORE_MODULE ¦ SC_ERR_SYSTEM_FATAL
Maximum number of modules reached. e0 = Number of modules
SCIOPTA - Kernel
4-24 Manual Version 5.0 Kernel Manual
4 System Calls Reference
KERNEL_EILL_PARAMETER ¦ SC_ERR_SYSTEM_FATAL
Parameter of module descriptor block not valid.
- maddr 0, SC_NIL or unaligned.
- maxPrio > 31
- maxPools > 128
- maxProcs > (MAX_PID+1)
- init = 0
- init not 4-byte alligned
- stacksize < SC_MIN_STACKSIZE
- safetyFlag neither true nor false
- pt not valid
- spares not 0
SCIOPTA - Kernel
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Module addresses or sizes not valid.
Start address, size or initsize unaligned.
initsize > size.
KERNEL_EMODULE_OVERLAP ¦ SC_ERR_SYSTEM_FATAL
Modules do overlap. e0 = Requested start address
e1 = Module start address
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-25
4 System Calls Reference
4.20 sc_moduleFriendAdd
4.20.1 Description
This system call is used to add a module to the friendlist. The caller defines the module mid as friend. The module
is entered in the friend set of the caller.
Messages sent to a process in module which is "friend" will not be copied.
Kernels: V1
4.20.2 Syntax
SCIOPTA - Kernel
void sc_moduleFriendAdd(
sc_moduleid_t mid
);
4.20.3 Parameter
None.
4.20.5 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_SYSTEM_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). Module ID
SCIOPTA - Kernel
4-26 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.21 sc_moduleFriendAll
4.21.1 Description
This system call is used to define all existing modules in a system as friend.
Kernels: V1
4.21.2 Syntax
void sc_moduleFriendAll(void);
4.21.3 Parameter
None.
SCIOPTA - Kernel
None.
4.21.5 Errors
None.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-27
4 System Calls Reference
4.22 sc_moduleFriendGet
4.22.1 Description
This system call is used to check if a module is a friend. The caller will be informed if the module in parameter
mid is a friend.
Kernels: V1
4.22.2 Syntax
SCIOPTA - Kernel
4.22.3 Parameter
4.22.5 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_SYSTEM_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). Module ID
SCIOPTA - Kernel
4-28 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.23 sc_moduleFriendNone
4.23.1 Description
This system call is used to remove all modules from the friendlist.
Kernels: V1
4.23.2 Syntax
void sc_moduleFriendNone(void);
4.23.3 Parameter
None.
SCIOPTA - Kernel
None.
4.23.5 Errors
None.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-29
4 System Calls Reference
4.24 sc_moduleFriendRm
4.24.1 Description
This system call is used to remove a module from the friendlist. The caller removes the module in parameter mid
as friend.
Kernels: V1
4.24.2 Syntax
void sc_moduleFriendRm(
sc_moduleid_t mid
SCIOPTA - Kernel
);
4.24.3 Parameter
None.
4.24.5 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_SYSTEM_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). Module ID
SCIOPTA - Kernel
4-30 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.25 sc_moduleIdGet
4.25.1 Description
4.25.2 Syntax
sc_moduleid_t sc_moduleIdGet(
const char *name
);
SCIOPTA - Kernel
4.25.3 Parameter
4.25.5 Example
sc_moduleid_t mid;
mid = sc_moduleIdGet("user_01");
sc_moduleStop(mid);
[Link] Errors
KERNEL_EILL_MODULE_NAME ¦ SC_ERR_PROCESS_WARNING
String pointed to by name too long. e0 = name
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-31
4 System Calls Reference
4.26 sc_moduleInfo
4.26.1 Description
This system call is used to get a snap-shot of a module control block (mcb).
SCIOPTA maintains a module control block (mcb) per module and a process control block (pcb) per process which
contains information about the module and process. A system level debugger or run-time debug code can use this
system call to get a copy of the control blocks.
The caller supplies a module control block structure in a local variable. The kernel will fill this structure with the
module control block data.
You cannot directly access the module control blocks.
SCIOPTA - Kernel
The structure of the module control block is defined in the module.h include file.
Kernels: V1, V2 and V2INT
4.26.2 Syntax
int sc_moduleInfo(
sc_moduleid_t mid,
sc_moduleInfo_t *info
);
4.26.3 Parameter
1 if the module was found. In this case the info structure is filled with valid data.
0 if the module was not found.
SCIOPTA - Kernel
4-32 Manual Version 5.0 Kernel Manual
4 System Calls Reference
The module info is a structure containing a snap-shot of the module control block.
It is included in the header file modules.h.
For Kernels V1:
typedef struct sc_moduleInfo_s{
sc_moduleid_t mid;
char name[SC_MODULE_NAME_SIZE+1];
char *text;
sc_modulesize_t textsize;
char *data;
sc_modulesize_t datasize;
unsigned int max_process;
unsigned int nprocess;
unsigned int max_pools;
unsigned int npools;
SCIOPTA - Kernel
}sc_moduleInfo_t;
ppid ID of the parent process. Process from where the module was created.
textsize Size of module text segment (initialized data asi t does also contain static variables).
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-33
4 System Calls Reference
SCIOPTA - Kernel
max_pools Maximum defined number of pools in the module.
4.26.7 Example
sc_moduleid_t mid;
sc_moduleInfo_t usr_info;
int check;
mid = sc_moduleIdGet("user_01");
check = sc_moduleInfo(mid, &usr_info);
4.26.8 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter info not valid (info == 0).
KERNEL_EILL_MODULE ¦ SC_ERR_PROCESS_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). e0 = mid
SCIOPTA - Kernel
4-34 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.27 sc_moduleKill
4.27.1 Description
4.27.2 Syntax
void sc_moduleKill(
SCIOPTA - Kernel
sc_moduleid_t mid,
flags_t flags
);
4.27.3 Parameter
None.
4.27.5 Example
sc_moduleid_t mid;
sc_moduleInfo_t usr_info;
int check;
mid = sc_moduleIdGet("user_01");
sc_moduleKill(mid, 0);
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-35
4 System Calls Reference
4.27.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_MODULE ¦ SC_ERR_SYSTEM_FATAL
Module to be killed is the system module. e0 = mid.
MID is not valid (mid >= SC_MAX_MODULE).
MID is not valid ( mcb ==SC_NIL).
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_SYSTEM_FATAL
SCIOPTA - Kernel
Caller is not a prioritized process. e0 = pcb.
SCIOPTA - Kernel
4-36 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.28 sc_moduleNameGet
4.28.1 Description
4.28.2 Syntax
4.28.3 Parameter
4.28.5 Example
sc_moduleid_t mid;
mid = sc_moduleIdGet("user_01");
printf("Module :%s\n", sc_moduleNameGet (mid));
4.28.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_PROCESS_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). e0 = mid
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-37
4 System Calls Reference
4.29 sc_modulePrioGet
4.29.1 Description
4.29.2 Syntax
sc_prio_t sc_modulePrioGet(
sc_moduleid_t mid
SCIOPTA - Kernel
);
4.29.3 Parameter
4.29.5 Example
sc_moduleid_t mid;
mid = sc_moduleIdGet("user_01");
printf("Module Priority :%u\n", sc_modulePrioGet (mid));
4.29.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_PROCESS_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). e0 = mid
SCIOPTA - Kernel
4-38 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.30 sc_moduleStop
4.30.1 Description
4.30.2 Syntax
SCIOPTA - Kernel
void sc_moduleStop(
sc_moduleid_t mid
);
4.30.3 Parameter
None.
4.30.5 Example
sc_moduleid_t mid;
mid = sc_moduleIdGet("user_01");
sc_moduleStop (mid);
4.30.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_SYSTEM_FATAL
Module ID not valid (mid >= SC_MAX_MODULE). e0 = mid
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Stopcounter overrun. e0 = pcb
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-39
4 System Calls Reference
4.31 sc_msgAcquire
4.31.1 Description
This system call is used to change the owner of a message. The caller becomes the owner of the message.
The kernel will copy the message into a new message buffer allocated from the default pool if the message resides
not in a pool of the callers module and the callers module is not friend to the module where the message resides.
In this case the message pointer (msgptr) will be modified.
Please use sc_msgAcquire with care. Transferring message buffers without proper ownership control by using
sc_msgAcquire instead of transmitting and receiving messages with sc_msgTx and sc_msgRx will cause problems
if you are killing processes.
SCIOPTA - Kernel
Kernels: V1, V2 and V2INT
4.31.2 Syntax
void sc_msgAcquire(
sc_msgptr_t msgptr
);
4.31.3 Parameter
None.
4.31.5 Example
sc_msg_t msg;
sc_msg_t msg2;
SCIOPTA - Kernel
4-40 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.31.6 Errors
KERNEL_EMSG_HD_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message header is corrupt. Kernel is the message owner. e0 = Pointer to message.
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero.
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-41
4 System Calls Reference
4.32 sc_msgAddrGet
4.32.1 Description
This system call is used to get the process ID of the addressee of a message.
This system call is used in communication software of distributed multi-CPU systems (using connector processes).
It allows to retrieve the original addressee when you are forwarding a message by using the sc_msgTxAlias system
call.
Kernels: V1, V2 and V2INT
4.32.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_msgAddrGet(
sc_msgptr_t msgptr
);
4.32.3 Parameter
4.32.5 Example
sc_msg_t msg;
sc_pid_t addr;
SCIOPTA - Kernel
4-42 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.32.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero.
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-43
4 System Calls Reference
4.33 sc_msgAlloc
4.33.1 Description
This system call will allocate a memory buffer of selectable size from a message pool.
SCIOPTA supports ownership of messages. The new allocated buffer is owned by the caller process.
SCIOPTA is not returning a buffer with the exact amount of bytes requested but will select the best fit from a list
of fixed buffer sizes. This list can contain 4, 8 or 16 different sizes which will be defined when a message pool is
created. The content of the allocated message buffer is not initialized and can have any random value.
As SCIOPTA supports multiple pools the caller has to state the pool ID (plid) from where to allocate the message.
The pool can only be in the same module as the caller process.
SCIOPTA - Kernel
The caller can define how the system will respond to memory shortage in message pools (tmo).
Kernels: V1, V2 and V2INT
4.33.2 Syntax
sc_msg_t sc_msgAlloc(
sc_bufsize_t size,
sc_msgid_t id,
sc_poolid_t plid,
sc_ticks_t tmo
);
4.33.3 Parameter
id Message ID.
The message ID which will be placed at the beginning of the data buffer of the message.
SCIOPTA - Kernel
4-44 Manual Version 5.0 Kernel Manual
4 System Calls Reference
SC_NO_TMO A NIL pointer will be returned if there is memory shortage in the message pool.
SC_FATAL_IF_TMO A (fatal) kernel error will be generated if a message buffer of the requested size is
not available. The function will not return.
0 < tmo =< SC_TMO_MAX Timeout value in system ticks. Alloc with timeout. Blocks and waits the specified
number of ticks to get a message buffer.
4.33.5 Example
sc_msg_t msg;
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-45
4 System Calls Reference
4.33.6 Errors
KERNEL_EILL_POOL_ID ¦ SC_ERR_PROCESS_FATAL
Pool index is not available. e0 = Pool index
KERNEL_EILL_BUFSIZE ¦ SC_ERR_PROCESS_FATAL
Illegal message size was requested. e0 = Requested size
e1 = Pool CB (or -1)
KERNEL_EOUT_OF_MEMORY ¦ SC_ERR_MODULE_FATAL
Request for number of bytes could not be fulfilled. e0 = size
SCIOPTA - Kernel
e1 = Pool CB
KERNEL_EILL_SLICE ¦ SC_ERR_PROCESS_FATAL
tmo value not valid. e0 = tmo value
KERNEL_EILL_DEFPOOL_ID ¦ SC_ERR_PROCESS_WARNING
Illegal default pool index. This is a warning and will continue
with pool 0 upon return from error hook. e0 = Pool index
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Process would swap but interrupts and/or e0 = Lock counter value or
scheduler are/is locked. -1 if interrupt are locked.
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Illegal process type. e0 = Process type
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
tmo-flag with wrong value. Likely system is corrupt. e0 = tmo-flag
SCIOPTA - Kernel
4-46 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.34 sc_msgAllocClr
4.34.1 Description
This system call works exactly the same as sc_msgAlloc but it will initialize the data area of the message to 0.
Kernels: V1, V2 and V2INT
4.34.2 Syntax
sc_msg_t sc_msgAllocClr(
sc_bufsize_t size,
sc_msgid_t id,
sc_poolid_t plidx,
sc_ticks_t tmo
SCIOPTA - Kernel
);
4.34.3 Parameter
Parameter values are the same as in chapter 4.33 “sc_msgAlloc” on page 4-44.
Return values are the same as in chapter 4.33 “sc_msgAlloc” on page 4-44.
4.34.5 Example
sc_msg_t msg;
4.34.6 Error
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-47
4 System Calls Reference
4.35 sc_msgAllocTx
4.35.1 Description
This function allocate a message of 12 bytes (32bit systems) from the default pool of the addressee and stores id,
data1 and data2 in this message. Then the message is transmitted to the addressee.
This call combines sc_msgAlloc() with sc_msgTx() and no copying is involved if the message is sent across mod-
ule boundaries.
Kernels: V1, V2 and V2INT
4.35.2 Syntax
SCIOPTA - Kernel
void sc_msgAllocTx(
sc_msgid_t id,
int data1,
int data2,
sc_pid_t addressee);
4.35.3 Parameter
id Message ID.
The message ID which will be placed at the beginning of the data buffer of the message.
None.
4.35.5 Example
SCIOPTA - Kernel
4-48 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.35.6 Error
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Addressee pid not valid (is init0). e0 = Addressee process ID
bigger than MODULE_MAXPROCESS).
Illegal CONNECTOR pid.
Illegal addressees module-index.
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = Process type
KERNEL_EILL_DEFPOOL_ID ¦ SC_ERR_PROCESS_WARNING
Illegal default pool index. This is a warning and will continue e0 = Pool index
SCIOPTA - Kernel
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Pool index in message header has an illegal value. e0 = Pool index
Thrown in the addressee's module.
KERNEL_EOUTSIDE_POOL ¦ SC_ERR_MODULE_FATAL
The pointer is outside the pool. Possible pool id corruption. e0 = Pointer to message header
Thrown in the addressee's module.
KERNEL_EOUT_OF_MEMORY ¦ SC_ERR_MODULE_FATAL
Request for number of bytes could not be fulfilled. e0 = size
Thrown in the addressee's module. e1 = Pool CB
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-49
4 System Calls Reference
4.36 sc_msgDataCrcDis
4.36.1 Description
This system call is used to disable the message data CRC check for the message in the parameter..
Kernels: V2 and V2INT
4.36.2 Syntax
void sc_msgDataCrcDis(
sc_msgptr_t msg
);
SCIOPTA - Kernel
4.36.3 Parameter
None.
4.36.5 Example
---
SCIOPTA - Kernel
4-50 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.36.6 Error
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = PID of owner
e1 = Pointer to message header
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-51
4 System Calls Reference
4.37 sc_msgDataCrcGet
4.37.1 Description
4.37.2 Syntax
SCIOPTA - Kernel
_u32 sc_msgDataCrcGet(
sc_msgptr_t msg
);
4.37.3 Parameter
4.37.5 Example
---
SCIOPTA - Kernel
4-52 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.37.6 Error
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = PID of owner
e1 = Pointer to message header
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-53
4 System Calls Reference
4.38 sc_msgDataCrcSet
4.38.1 Description
In the SCIOPTA Safety Kernel INT the message header may contain a CRC32 value of the message.
This system call is used to calculate a CRC32 over the message data and store it in the message header.
Kernels: V2 and V2INT
4.38.2 Syntax
_u32 sc_msgDataCrcSet(
SCIOPTA - Kernel
sc_msgptr_t msg
);
4.38.3 Parameter
4.38.5 Example
---
SCIOPTA - Kernel
4-54 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.38.6 Error
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = PID of owner
e1 = Pointer to message header
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-55
4 System Calls Reference
4.39 sc_msgFind
4.39.1 Description
This system call is used to find messages which have been allocated or already received. The allocated-messages
queue of the caller will be searched for the desired messages. This call is similar to sc_msgRx (see chapter 4.46
“sc_msgRx” on page 4-69) but instead of searching the messages-input queue the allocated-messages queue will
be scanned. This queue holds the messages which have already been received (by sc_msgRx) or messages which
have been allocated by the caller process.
If a message matching the conditions is found the kernel will return to the caller. If the allocated-messages queue
is empty or no wanted messages are available in the queue a NULL will be returned. The call sc_msgFind will not
block the system.
SCIOPTA - Kernel
A pointer to an array (wanted) containing the messages and/or process IDs which will be scanned by sc_msgFind
must be given. The array must be terminated by 0.
A parameter flag (flag) controls different searching methods:
1. The messages to be searched are listed in a message ID array.
2. The array can also contain process IDs. In this case all messages sent by the listed processes are searched.
3. You can also build an array of message ID and process ID pairs to find specific messages sent from specific
processes.
4. Also a message array with reversed logic can be given. In this case any message is searched except the mes-
sages specified in the array.
If the pointer wanted to the array is NULL or the array is empty (contains only a zero element) all messages will
be searched.
Kernels: V2 and V2INT
4.39.2 Syntax
sc_msg_t sc_msgFind(
sc_msgptr_t mp,
void *wanted,
flags_t flag
);
4.39.3 Parameter
SCIOPTA - Kernel
4-56 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.39.5 Examples
TBD
4.39.6 Errors
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Illegal flags. e0 = flags
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
tmo-flag with wrong value. Likely system is corrupt. e0 = tmo-flag
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-57
4 System Calls Reference
4.40 sc_msgFlowSignatureUpdate
4.40.1 Description
This system call is used to update a global message flow signature with message header elements: message ID,
sender process ID and addressee process ID. The result is returned and also stored back to the global flow signature.
Kernels: V2 and V2INT
4.40.2 Syntax
uint32_t sc_msgFlowSignatureUpdate(
unsigned int id,
SCIOPTA - Kernel
sc_msgptr_t msg
);
4.40.3 Parameter
Signature value.
4.40.5 Example
---
SCIOPTA - Kernel
4-58 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.40.6 Error
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Flow signature ID not valid (id >= SC_MAX_GFS_IDS). e0 = Flow signature ID (id)
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer are zero.
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Message pointer.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-59
4 System Calls Reference
4.41 sc_msgFree
4.41.1 Description
This system call is used to return a newly allocated message to the message pool. Message buffers which have been
returned can be used again.
Only the owner of a message is allowed to free it by calling sc_msgFree. It is a fatal error to free a message owned
by another process. If you have, for example transmitted a message to another process it is the responsibility of the
receiving process to free the message.
Another process actually waiting to allocate a message of a full pool will become ready and therefore the caller
process pre-empted on condition that:
SCIOPTA - Kernel
1. the returned message buffer of the caller process has the same fixed size as the one of the waiting process and
2. the priority of the waiting process is higher than the priority of the caller and
3. the waiting process waits on the same pool as the caller will return the message.
Kernels: V1, V2 and V2INT
4.41.2 Syntax
void sc_msgFree(
sc_msgptr_t msgptr
);
4.41.3 Parameter
None.
4.41.5 Example
/* Free a message */
sc_msg_t msg;
SCIOPTA - Kernel
4-60 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.41.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Process ID is wrong. e0 = Process ID
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Pool index in message header has an illegal value. e0 = Pointer to message header
KERNEL_EMSG_HD_CORRUPT ¦ SC_ERR_MODULE_FATAL
Either pool ID or buffersize index are corrupted. e0 = Pointer to message header
KERNEL_EOUTSIDE_POOL ¦ SC_ERR_MODULE_FATAL
The pointer is outside the pool. Possible pool id corruption. e0 = Pointer to message header
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Message is a timout message.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-61
4 System Calls Reference
4.42 sc_msgHdCheck
4.42.1 Description
It is used to check the message header. The header will be checked for plausibility.
Checks include message ownership, valid module, message endmarks, size and others.
Kernels: V2 and V2INT
4.42.2 Syntax
SCIOPTA - Kernel
int sc_msgHdCheck(
sc_msgptr_t msgptr,
);
4.42.3 Parameter
4.42.5 Example
sc_msg_t msg:
msg = sc_msgRx( SC_ENDLESS_TMO, SC_MSGRX_ALL , SC_MSGRX_MSGID );
if (sc_msgHdCheck(&msg)) {
printf ("Message ok!"
} else {
printf ("Message corrupted!"
};
4.42.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message pointer or pointer to message are zero.
SCIOPTA - Kernel
4-62 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.43 sc_msgHookRegister
4.43.1 Description
4.43.2 Syntax
sc_msgHook_t *sc_msgHookRegister(
int type,
sc_msgHook_t *newhook
);
4.43.3 Parameter
Function pointer to the previous message hook. if the message hook was registered.
0 if no message hook was registered.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-63
4 System Calls Reference
4.43.5 Example
sc_msgHook_t oldMsgHook;
4.43.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
SCIOPTA - Kernel
Wrong type (unknown or not active) e0 = Requested message hook type.
SCIOPTA - Kernel
4-64 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.44 sc_msgOwnerGet
4.44.1 Description
This system call is used to get the process ID of the owner of a message.
The kernel will examine the message buffer to determine the process who owns the message buffer.
Kernels: V1, V2 and V2INT
4.44.2 Syntax
sc_pid_t sc_msgOwnerGet(
sc_msgptr_t msgptr
);
SCIOPTA - Kernel
4.44.3 Parameter
4.44.5 Example
sc_msg_t msg;
sc_pid_t owner;
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-65
4 System Calls Reference
4.44.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
SCIOPTA - Kernel
4-66 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.45 sc_msgPoolIdGet
4.45.1 Description
4.45.2 Systax
sc_poolid_t sc_msgPoolIdGet(
sc_msgptr_t msgptr
SCIOPTA - Kernel
);
4.45.3 Parameter
Pool ID where the message resides if the message is in the same module than the caller.
SC_DEFAULT_POOL if the message is not in the same module than the caller.
4.45.5 Example
sc_msg_t msg;
sc_poolid_t idx;
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-67
4 System Calls Reference
4.45.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
4-68 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.46 sc_msgRx
4.46.1 Description
This system call is used to receive messages. The receive message queue of the caller will be searched for the de-
sired messages.
If a message matching the conditions is received the kernel will return to the caller. If the message queue is empty
or no wanted messages are available in the queue the process will be swapped out and another ready process with
the highest priority will run. If a desired message arrives the process will be swapped in and the wanted list will
be scanned again.
A pointer to an array (wanted) containing the messages (and/or process IDs) which will be scanned by sc_msgRx.
The array must be terminated by 0. Kernel V2 only: The kernel stores the pointer to the array in the process control
block for debugging.
A parameter flag (flag) controls different receiving methods:
SCIOPTA - Kernel
4.46.2 Syntax
sc_msg_t sc_msgRx(
sc_ticks_t tmo,
void *wanted,
flags_t flag
);
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-69
4 System Calls Reference
4.46.3 Parameter
SCIOPTA - Kernel
flag Receive flag.
More than one value can be defined and must be separated by OR instructions.
SC_MSGRX_MSGID An array of wanted message IDs is given.
SC_MSGRX_PID An array of process ID´s from where sent messages are received is given.
SC_MSGRX_BOTH An array of pairs of message ID´s and process ID´s are given to receive specific
messages from specific transmitting processes.
SC_MSGRX_NOT An array of message ID’s is given which will be excluded from receive.
Pointer to the received message if the message has been received. The caller becomes owner of the received mes-
sage.
NULL if timeout expired. The process will be made ready again.
4.46.5 Examples
sc_msg_t msg;
sc_msgid_t sel[2] = { TEST_MSG, 0 };
msg = sc_msgRx( 1000, /* timeout in ticks */
sel, /* selection array, here message IDs */
SC_MSGRX_MSGID); /* type of selection */
SCIOPTA - Kernel
4-70 Manual Version 5.0 Kernel Manual
4 System Calls Reference
sc_msg_t msg;
sc_pid_t sel[2];
sel[0] = sndr_pid;
sel[1] = 0;
msg = sc_msgRx( SC_ENDLESS_TMO, /* timeout in ticks, here endless*/
sel, /* selection array, here process IDs */
SC_MSGRX_PID|SC_MSGRX_NOT); /* type of selection, inverted */
sc_msg_t msg;
sc_msg_rx_t sel[3];
sel[0].msgid = TEST_MSG;
sel[0].pid = testerA_pid;
SCIOPTA - Kernel
sel[1].msgid = TEST_MSG;
sel[1].pid = testerB_pid;
sel[2].msgid = 0;
sel[2].pid = 0;
msg = sc_msgRx( SC_ENDLESS_TMO, /* timeout in ticks, here endless */
sel, /* selection array, here process IDs */
SC_MSGRX_PID|SC_MSGRX_MSGID); /* type of selection */
sc_msg_t msg:
msg = sc_msgRx( SC_ENDLESS_TMO, SC_MSGRX_ALL , SC_MSGRX_MSGID);
4.46.6 Errors
KERNEL_EILL_SLICE ¦ SC_ERR_PROCESS_FATAL
tmo value not valid. e0 = tmo value
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Process would swap but interrupts and/or scheduler e0 = Lock counter value or
are/is locked. -1 if interrupt are locked.
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Illegal flags. e0 = flags
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
tmo-flag with wrong value. Likely system is corrupt. e0 = tmo-flag
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
The calling process uses a timeout and is not a prioritized process.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-71
4 System Calls Reference
4.47 sc_msgSizeGet
4.47.1 Description
This system call is used to get the requested size of a message. The requested size is the size of the message buffer
when it was allocated. The actual kernel internal used fixed size might be larger.
Kernels: V1, V2 and V2INT
4.47.2 Syntax
sc_bufsize_t sc_msgSizeGet(
SCIOPTA - Kernel
sc_msgptr_t msgptr);
4.47.3 Parameter
4.47.5 Example
sc_msg_t msg:
sc_bufsize_t size;
msg = sc_msgRx( SC_ENDLESS_TMO, SC_MSGRX_ALL , SC_MSGRX_MSGID );
SCIOPTA - Kernel
4-72 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.47.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
SCIOPTA - Kernel
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-73
4 System Calls Reference
4.48 sc_msgSizeSet
4.48.1 Description
This system call is used to decrease the requested size of a message buffer.
The originally requested message buffer size is smaller (or equal) than the SCIOPTA internal used fixed buffer
size. If the need of message data decreases with time it is sometimes favourable to decrease the requested message
buffer size as well. Some internal operation are working on the requested buffer size.
The fixed buffer size for the message will not be modified. The system does not support increasing the buffer size.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.48.2 Syntax
sc_bufsize_t sc_msgSizeSet(
sc_msgptr_t msgptr,
sc_bufsize_t newsz
);
4.48.3 Parameter
4.48.5 Example
sc_msg_t msg:
SCIOPTA - Kernel
4-74 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.48.6 Errors
KERNEL_EILL_BUFSIZE ¦ SC_ERR_MODULE_FATAL
Illegal buffer sizes. e0 = Buffer sizes
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_EILL_VALUE ¦ SC_ERR_MODULE_FATAL
Parameter size is smaller than the size of a message id. e0 = Buffer sizes
KERNEL_EENLARGE_MSG ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-75
4 System Calls Reference
4.49 sc_msgSndGet
4.49.1 Description
This system call is used to get the process ID of the sender of a message.
The kernel will examine the message buffer to determine the process who has transmitted the message buffer.
Kernels: V1, V2 and V2INT
4.49.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_msgSndGet(
sc_msgptr_t msgptr
);
4.49.3 Parameter
Process ID of the sender of the message if the message was sent at least once.
Process ID of the owner of the message if the message was never sent.
4.49.5 Example
sc_msg_t msg;
sc_pid_t sndr;
SCIOPTA - Kernel
4-76 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.49.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
SCIOPTA - Kernel
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-77
4 System Calls Reference
4.50 sc_msgTx
4.50.1 Description
This system call is used to transmit a SCIOPTA message to a process (the addressee process).
Each SCIOPTA process has one message queue for messages which have been sent to the process. The sc_msgTx
system call will enter the message at the end of the receivers message queue.
The caller cannot access the message buffer any longer as it is not any more the owner. The kernel will become the
owner of the message. NULL is loaded into the caller´s message pointer msgptr to avoid unintentional message
access by the caller after transmitting.
The receiving process will be swapped-in if it has a higher priority than the sending process.
SCIOPTA - Kernel
If the addressee of the message resides not in the caller’s module and this module is not registered as a friend mod-
ule then the message will be copied before the transmit call will be executed. Messages which are transmitted
across modules boundaries are always copied except if the modules are “friends”. To copy such a message the ker-
nel will allocate a buffer from the default pool of the addressee big enough to fit the message and copy the whole
message. Message buffer copying depends on the friendship settings of the module where the buffer was originally
allocated.
If the receiving process is not within the same target (CPU) as the caller the message will be sent to the connector
process where the (distributed) receiving process is registered.
Kernels: V1, V2 and V2INT
4.50.2 Syntax
void sc_msgTx(
sc_msgptr_t msgptr,
sc_pid_t addr,
flags_t flags
);
4.50.3 Parameter
SCIOPTA - Kernel
4-78 Manual Version 5.0 Kernel Manual
4 System Calls Reference
None.
4.50.5 Example
sc_msg_t msg;
sc_pid_t addr;
/* ... */
msg = sc_msgAlloc( sizeof(test_msg_t),TEST_MSG, SC_DEFAULT_POOL, SC_FATAL_IF_TMO );
4.50.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_MODULE_FATAL
Either pointer to message or pointer to message pointer
are zero. e0 = Pointer to message pointer
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
KERNEL_EMSG_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Message endmark is corrupt. e0 = Pointer to message.
KERNEL_EMSG_PREV_ENDMARK_CORRUPT ¦ SC_ERR_MODULE_FATAL
Endmark of previous message is corrupt. e0 = Pointer to previous message.
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Process type not valid. e0 = pid of addressee
e1 = Process type
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Flag is neither 0 nor SC_MSGTX_RTN2SND e0 = Flag value
e1 = 2 (position)
KERNEL_EALREADY_DEFINED ¦ SC_ERR_PROCESS_FATAL
Caller tries to send a timeout message but e0 = Pointer to message header
message is already a timeout message.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-79
4 System Calls Reference
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Module in message header has an illegal value. e0 = Pointer to message header
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Pool index in message header has an illegal value. e0 = Pointer to message header
KERNEL_EMSG_HD_CORRUPT ¦ SC_ERR_MODULE_FATAL
Either pool ID or buffersize index are corrupted. e0 = Pointer to message header
KERNEL_EOUTSIDE_POOL ¦ SC_ERR_MODULE_FATAL
SCIOPTA - Kernel
The pointer is outside the pool. Possible pool id corruption. e0 = Pointer to message header
SCIOPTA - Kernel
4-80 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.51 sc_msgTxAlias
4.51.1 Description
This system call is used to transmit a SCIOPTA message to a process by setting a process ID as sender.
The usual sc_msgTx system call sets always the calling process as sender. If you need to set another process ID as
sender you can use this sc_msgTxAlias call.
This call is used in communication software such as SCIOPTA connector processes where processes on other
CPU´s are addressed. CONNECTOR processes will use this system call to enter the original sender of the other
CPU.
Otherwise sc_msgTxAlias works the same way as sc_msgTx.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.51.2 Syntax
void sc_msgTxAlias(
sc_msgptr_t msgptr,
sc_pid_t addr,
flags_t flags,
sc_pid_t alias
);
4.51.3 Parameter
None.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-81
4 System Calls Reference
4.51.5 Example
sc_msg_t msg;
sc_pid_t addr;
sc_pid_t other;
/* ... */
SCIOPTA - Kernel
4.51.6 Errors
SCIOPTA - Kernel
4-82 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.52 sc_poolCBChk
4.52.1 Description
System call to do diagnostic test for all elements of the pool control block of specific message pool.
Kernels: V2INT
4.52.2 Syntax
int sc_poolCBChk(
sc_modulid_t mid,
sc_plid_t idx,
uint32_t *addr,
unsigned int *size
)
SCIOPTA - Kernel
4.52.3 Parameter
4.52.5 Example
---
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-83
4 System Calls Reference
4.52.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_PROCESS_FATAL
Parameter mid not valid (>= SC_MAX_MODULE). e0 = mid
KERNEL_EILL_POOL_ID ¦ SC_ERR_PROCESS_FATAL
Pool index too large. e0 = pool index
SCIOPTA - Kernel
SCIOPTA - Kernel
4-84 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.53 sc_poolCreate
4.53.1 Description
This system call is used to create a new message pool inside the callers module.
Kernels: V1, V2 and V2INT
4.53.2 Syntax
sc_poolid_t sc_poolCreate(
char *start,
sc_plsize_t size,
unsigned int nbufs,
sc_bufsize_t *bufsize,
const char *name
SCIOPTA - Kernel
);
4.53.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-85
4 System Calls Reference
4.53.5 Example
SCIOPTA - Kernel
128,
256,
700
};
myPool_plid = sc_poolCreate(
/* start-address */ 0,
/* total size */ 4000,
/* number of buffers */ 8,
/* buffersizes */ bufsizes,
/* name */ "myPool"
);
4.53.6 Errors
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Illegal module. e0 = Module ID
module >= SC_MAX_MODULE
module == SC_NIL
KERNEL_EILL_BUF_SIZES ¦ SC_ERR_MODULE_FATAL
Illegal buffer sizes. e0 = Requested buffer sizes.
KERNEL_EILL_NAME ¦ SC_ERR_MODULE_FATAL
Illegal pool name requested. e0 = Requested pool name
KERNEL_ENO_MORE_POOL ¦ SC_ERR_MODULE_FATAL
Maximum number of pools for module reached. e0 = Number of pools in module cb.
KERNEL_EILL_NUM_SIZES ¦ SC_ERR_MODULE_FATAL
Illegal number of buffer sizes. e0 = Number of requested buffer sizes.
SCIOPTA - Kernel
4-86 Manual Version 5.0 Kernel Manual
4 System Calls Reference
KERNEL_EOUT_OF_MEMORY ¦ SC_ERR_MODULE_FATAL
No more memory in module for pool. e0 = Requested pool size.
KERNEL_EILL_POOL_SIZE ¦ SC_ERR_MODULE_FATAL
Size is not 4-byte aligned e0 = Requested pool size.
Even the biggest buffer does not fit.
KERNEL_EILL_PARAMETER ¦ SC_ERR_MODULE_FATAL
Pool start address is not 4-byte aligned. e0 = Requested pool start address.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-87
4 System Calls Reference
4.54 sc_poolDefault
4.54.1 Description
SCIOPTA - Kernel
4.54.2 Syntax
sc_poolid_t sc_poolDefault(
int idx
);
4.54.3 Parameter
4.54.5 Example
pl = sc_poolIdGet( "fs_pool" );
if ( pl != SC_ILLEGAL_POOLID ){
sc_poolDefault( pl );
}
4.54.6 Errors
KERNEL_EILL_POOL_ID ¦ SC_ERR_PROCESS_WARNING
Pool index not valid. e0 = Requested pool index.
Pool index > 16
Pool index > MODULE_MAXPOOLS
SCIOPTA - Kernel
4-88 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.55 sc_poolHookRegister
4.55.1 Description
This system call will register a pool create or pool kill hook.
V1 only: There can be one pool create and one pool kill hook per module. If sc_poolHookRegister is called from
within a module a module pool hook will be registered.
A global pool hook will be registered when sc_poolHookRegister is called from the start hook function which is
called before SCIOPTA is initialized.
Each time a pool is created or killed (depending on the setting of parameter type) the pool hook of the caller will
be called if such a hook exists.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.55.2 Syntax
sc_poolHook_t *sc_poolHookRegister(
int type,
sc_poolHook_t *newhook
);
4.55.3 Parameter
Function pointer to the previous pool hook if the pool hook was registered.
NULL if no pool hook was registered.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-89
4 System Calls Reference
4.55.5 Example
sc_poolHook_t oldPoolHook;
4.55.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Pool hook type not defined. e0 = Pool hook type.
SCIOPTA - Kernel
e1 = 0
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Pool hook function pointer not valid. e0 = Pool hook type.
e1 = 1
SCIOPTA - Kernel
4-90 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.56 sc_poolIdGet
4.56.1 Description
This system call is used to get the ID of a message pool by its name.
In contrast to the call sc_poolIdGet, you can just give the name as parameter and not a path.
Kernels: V1, V2 and V2INT
4.56.2 Syntax
sc_poolid_t sc_poolIdGet(
const char *name
);
SCIOPTA - Kernel
4.56.3 Parameter
4.56.5 Example
sc_poolid_t pl;
pl = sc_poolIdGet( "fs_pool" );
if ( pl != SC_ILLEGAL_POOLID ){
sc_poolDefault(pl);
}
4.56.6 Errors
KERNEL_EILL_NAME ¦ SC_ERR_PROCESS_FATAL
Illegal pool name. e0 = pointer to pool name.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-91
4 System Calls Reference
4.57 sc_poolInfo
4.57.1 Description
SCIOPTA - Kernel
4.57.2 Syntax
int sc_poolInfo(
sc_moduleid_t mid,
sc_poolid_t plid,
sc_pool_cb_t *info
);
4.57.3 Parameter
mid Module ID where the pool resides of which the control block will be returned.
plid ID of the pool of which the pool control block data will be returned.
SCIOPTA - Kernel
4-92 Manual Version 5.0 Kernel Manual
4 System Calls Reference
The pool info is a structure containing a snap-shot of the pool control block.
It is included in the header file pool.h.
struct sc_pool_cb_s{
sc_save_poolid_t poolid;
sc_save_voidptr_t start;
sc_save_voidptr_t end;
sc_save_voidptr_t cur;
sc_save_uint_t lock;
sc_save_uint_t nbufsizes;
sc_save_plsize_t size;
sc_save_pid_t creator;
SCIOPTA - Kernel
sc_save_bufsize_t bufsizes[SC_MAX_NUM_BUFFERSIZES];
idbl_t freed[SC_MAX_NUM_BUFFERSIZES];
idbl_t waiter[SC_MAX_NUM_BUFFERSIZES];
char name[SC_POOL_NAME_SIZE+1];
#if SC_MSG_STAT == 1
sc_pool_stat_t stat;
#endif
} sc_pool_cb_t;
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-93
4 System Calls Reference
SCIOPTA - Kernel
stat Statistics information. See chapter 4.57.7 “Pool Statistics Info Structure” on page 4-94.
The pool statistics info is a structure inside the pool control block containing containing pool statistics information.
It is included in the header file pool.h.
struct sc_pool_stat_s{
uint32_t cnt_req[SC_MAX_NUM_BUFFERSIZES]; /* No. requests for a spec. size */
uint32_t cnt_alloc[SC_MAX_NUM_BUFFERSIZES]; /* No. allocation of a spec. size */
uint32_t cnt_free[SC_MAX_NUM_BUFFERSIZES]; /* No. releases of a spec. size */
uint32_t cnt_wait[SC_MAX_NUM_BUFFERSIZES]; /* No. unfullfilled allocations */
sc_bufsize_t maxalloc[SC_MAX_NUM_BUFFERSIZES]; /* largest wanted size */
} sc_pool_stat_t;
SCIOPTA - Kernel
4-94 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.57.9 Example
sc_moduleid_t modid;
sc_poolid_t pl;
sc_pool_cb_t pool_info;
int check;
modid = sc_moduleIdGet(“my_module”)
pl = sc_poolIdGet("my_pool");
4.57.10 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
SCIOPTA - Kernel
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Illegal pool ID. e0 = pool ID.
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Illegal module. e0 = module ID.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-95
4 System Calls Reference
4.58 sc_poolKill
4.58.1 Description
SCIOPTA - Kernel
4.58.2 Syntax
void sc_poolKill(
sc_poolid_t plid
);
4.58.3 Parameter
None.
4.58.5 Example
sc_poolid_t pl;
pl = sc_poolIdGet( "my_pool" );
sc_poolKill( pl );
SCIOPTA - Kernel
4-96 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.58.6 Errors
KERNEL_EPOOL_IN_USE ¦ SC_ERR_MODULE_FATAL
Pool is in use and cannot be killed. e0 = pool cb.
e1 = pool lock counter.
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Illegal pool ID. e0 = pool ID.
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Illegal module. e0 = module ID.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-97
4 System Calls Reference
4.59 sc_poolReset
4.59.1 Description
This system call is used to reset a message pool in its original state.
All messages in the pool must be freed and returned before a sc_poolReset call can be used.
The structure of the pool will be re-initialized. The message buffers in free-lists will be transformed back into un-
used memory. This “fresh” memory can now be used by sc_msgAlloc to allocate new messages.
Each process in a module can reset a pool.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.59.2 Syntax
void sc_poolReset(
sc_poolid_t plid
);
4.59.3 Parameter
None.
4.59.5 Example
sc_poolid_t pl;
pl = sc_poolIdGet( "my_pool" );
sc_poolReset ( pl );
4.59.6 Errors
KERNEL_EPOOL_IN_USE ¦ SC_ERR_MODULE_FATAL
Pool is in use and no reset can be performed. e0 = pool cb.
e1 = pool lock counter.
KERNEL_EILL_POOL_ID ¦ SC_ERR_MODULE_FATAL
Illegal pool ID. e0 = pool ID.
SCIOPTA - Kernel
4-98 Manual Version 5.0 Kernel Manual
4 System Calls Reference
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-99
4 System Calls Reference
4.60 sc_procAtExit
4.60.1 Description
This system call is used to register a function to be called if a prioritized process is killed.
This allows to do some cleaning work if a process is killed. The sc_procAtExit system call is also used to register
an error process from a module’s init process.
The function runs in the context of the caller but has no access to variables on the stack (stack is rewound)!
Kernels: V2 and V2INT
4.60.2 Syntax
SCIOPTA - Kernel
sc_atExitFunc_t sc_procAtExit(
void (*func)(void)
);
4.60.3 Parameter
Returns the pointer to the old function or NULL if none was registerred.
4.60.5 Example
SCIOPTA - Kernel
4-100 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.60.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Illegal function pointer. e0 = function pointer.
KERNEL_EILL_PROCTYPE ¦ SC_ERR_PROCESS_FATAL
Can only be called within a prioritized process. e0 = process type.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-101
4 System Calls Reference
4.61 sc_procAttrGet
4.61.1 Description
4.61.2 Syntax
int sc_procAttrGet(
sc_pid_t pid,
sc_procAttr_t attribute,
SCIOPTA - Kernel
void *value
)
4.61.3 Parameter
SCIOPTA - Kernel
4-102 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.61.5 Example
int msg_number
SCIOPTA - Kernel
4.61.6 Errors
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Illegal process attribute. e0 = process attribute.
e1 = 1
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Pointer to value not valid (NULL).
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-103
4 System Calls Reference
4.62 sc_procCBChk
4.62.1 Description
System call to do diagnostic test for all elements of the process control block of specific process.
Kernels: V2INT
4.62.2 Syntax
int sc_procCBChk(
sc_pid_t pid,
uint32_t *addr,
SCIOPTA - Kernel
unsigned int *size
)
4.62.3 Parameter
pid Process ID
<pid> Process ID of the process to get the pcb.
SC_CURRENT_PID Current running (caller) process.
SCIOPTA - Kernel
4-104 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.62.5 Example
TBD.
4.62.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Parameter pid not valid (== SC_ILLEGAL_PID). e0 = pid
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-105
4 System Calls Reference
4.63 sc_procCreate2
4.63.1 Description
This system call is used to request the kernel daemon to create a process. The standard kernel daemon (sc_kerneld)
needs to be defined and started at system configuration.
The process will be created within the callers module.
The maximum number of processes for a specific module is defined at module creation.
Kernels: V2 and V2INT
4.63.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_procCreate2(
const sc_pdb_t *pdb,
int state,
sc_poolid_t plid
);
4.63.3 Parameter
pdb Pointer to the process descriptor block (pdb) which defines the process to create.
SCIOPTA - Kernel
4-106 Manual Version 5.0 Kernel Manual
4 System Calls Reference
uint16_t spare
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-107
4 System Calls Reference
sc_ticks_t slice;
unsigned int prio;
} sc_pdbprio_t;
SCIOPTA - Kernel
4.63.6 Structure Members Common for all Process Types
SCIOPTA - Kernel
4-108 Manual Version 5.0 Kernel Manual
4 System Calls Reference
super Mode.
SC_KRN_FLAG_TRUE Supervisor mode.
SC_KRN_FLAG_FALSE User mode.
initdelay Initial delay in ticks before the first time call to the timer process.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-109
4 System Calls Reference
4.63.10 Example
SCIOPTA - Kernel
proc_A_pid = sc_procCreate2( (const sc_pdb_t *)&pdb, SC_PDB_STATE_RUN, 0x0) ;
4.63.11 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter pdb not valid (0 or SC_NIL).
KERNEL_EOUT_OF_MEMORY ¦ SC_ERR_MODULE_FATAL
mcb->freesize <= SIZEOF_PCB: e0 = mcb->freesize
mcb->freesize <= stacksize element of pdb: e0 = stacksize element of pdb
e1 = mcb->freesize
KERNEL_EILL_VECTOR ¦ SC_ERR_MODULE_FATAL
Parameter vector (interrupt process) of pdb not valid e0 = parameter: vector
(>SC_MAX_INT_VECTOR). e1 = pdb
e2 = 9
KERNEL_EILL_SLICE ¦ SC_ERR_MODULE_FATAL
Parameter slice (prioritized process) of pdb not valid: e0 = parameter: slice
Parameter period (timer process) of pdb not valid: e0 = parameter: period (timer process)
e1 = pdb
e2 = 9
KERNEL_EILL_SLICE ¦ SC_ERR_MODULE_FATAL
Parameter initial_dealy (timer process) of pdb not valid. e0 = parameter: initial_delay
e1 = pdb
e2 = 10
SCIOPTA - Kernel
4-110 Manual Version 5.0 Kernel Manual
4 System Calls Reference
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Parameter type of pdb not valid. e0 = parameter: type
e1 = pdb
e2 = 0
KERNEL_ENO_MORE_PROC ¦ SC_ERR_MODULE_FATAL
Number of maximum processes reached. e0 = No of process element of mcb
e1 = pdb
e2 = mcb
SCIOPTA - Kernel
KERNEL_EILL_PROC_NAME ¦ SC_ERR_MODULE_FATAL
Parameter name of pdb not valid. e0 = pdb parameter: name
e1 = pdb
e2 = 1
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Module cb is not valid (mcb == SC_NIL). e0 = mid
e1 = 0
e2 = 1
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Message which holds pcb or stack is e0 = Pointer to pcb or stack.
not within current module. e1 = Pointer to mcb of current module.
e2 = Pointer to mcb of pcb/stack
message buffer.
KERNEL_EILL_PRIORITY ¦ SC_ERR_MODULE_FATAL
Module cb is not valid (mcb == SC_NIL). e0 = pdb parameter: priority
e1 = pdb
e2 = 10
KERNEL_EILL_STACKSIZE ¦ SC_ERR_MODULE_FATAL
Parameter stack of pdb not valid. e0 = pdb parameter: stack
e1 = pdb
e2 = 3
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-111
4 System Calls Reference
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter pdb not valid (!pdb || pdb == SC_NIL). e0 = Parameter pdb
e1 = 0
e2 = 0
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter state not valid. e0 = Parameter state
e1 = 0
e2 = 1
SCIOPTA - Kernel
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Illegal module ID. e0 = mid
mid low 24 bits != 0 or e1 = 0
midx >= SC_MAX_MODULES e2 = 2
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter pcb of pdb not valid (==0). e0 = pdb parameter: pcb
e1 = 0
e2 = 4
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter stack of pdb not valid (==0). e0 = pdb parameter: stack
e1 = 0
e2 = 5
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter entry of pdb not valid. e0 = pdb parameter: entry
e1 = pdb
e2 = 2
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter super not valid. e0 = pdb parameter: super
e1 = pdb
e2 = 6
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter fpu not valid. e0 = pdb parameter: fpu
e1 = pdb
e2 = 7
SCIOPTA - Kernel
4-112 Manual Version 5.0 Kernel Manual
4 System Calls Reference
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Parameter spare not valid. e0 = 0
e1 = pdb
e2 = 8
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Not enough space for pcb or stack in e0 = Pointer to pcb or stack.
selected message buffer. e1 = Pointer to mcb of current module.
e2 = Size of PCB or stacksize.
KERNEL_EALREADY_DEFINED ¦ SC_ERR_MODULE_FATAL
Parameter vector (interrupt process) of pdb e0 = pdb parameter: vector
vector already defined. e1 = pdb
SCIOPTA - Kernel
e2 = 9
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-113
4 System Calls Reference
4.64 sc_procDaemonRegister
4.64.1 Description
SCIOPTA - Kernel
Kernels: V1, V2 and V2INT
4.64.2 Syntax
4.64.3 Parameter
None.
4.64.5 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Calling process is not a prioritized process.
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Calling process is not in system module.
SCIOPTA - Kernel
4-114 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.65 sc_procDaemonUnregister
4.65.1 Description
4.65.2 Syntax
4.65.3 Parameter
SCIOPTA - Kernel
None
4.65.5 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-115
4 System Calls Reference
4.66 sc_procFlowSignatureGet
4.66.1 Description
This system call is used to get the caller’s process program flow signature.
Kernels: V2 and V2INT
4.66.2 Syntax
SCIOPTA - Kernel
4.66.3 Parameter
None.
Signature value.
4.66.5 Example
---
4.66.6 Errors
None.
SCIOPTA - Kernel
4-116 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.67 sc_procFlowSignatureInit
4.67.1 Description
This system call is used to initialize the caller’s process program flow signature.
The process flow signature calculates a 16 bit CRC over given tokens. It uses the same polynomial as sc_miscCrc
/ sc_miscCrcContd.
Kernels: V2 and V2INT
4.67.2 Syntax
void sc_procFlowSignatureInit(
uint16_t signature
);
SCIOPTA - Kernel
4.67.3 Parameter
None.
4.67.5 Example
---
4.67.6 Errors
None.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-117
4 System Calls Reference
4.68 sc_procFlowSignatureUpdate
4.68.1 Description
System call to update the caller’s program flow signature with the token given as parameter.
The result is returned.
Kernels: V2 and V2INT
4.68.2 Syntax
uint16_t sc_procFlowSignatureUpdate(
SCIOPTA - Kernel
uint32_t token
);
4.68.3 Parameter
Signature value.
4.68.5 Example
---
4.68.6 Errors
None.
SCIOPTA - Kernel
4-118 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.69 sc_procHookRegister
4.69.1 Description
This system call will register a process hook of the type defined in parameter type. The type can be a create hook,
kill hook or swap hook.
Each time a process will be created the create hook will be called if there is one installed.
Each time a process will be killed the kill hook will be called if there is one installed.
Each time a process swap is initiated by the kernel the swap hook will be called if there is one installed.
Kernels: V1, V2 and V2INT
V2 Only: If enabled, the swap hook is also called when an interrupt is activated by hardware event.
SCIOPTA - Kernel
4.69.2 Syntax
sc_procHook_t *sc_procHookRegister(
int type,
sc_procHook_t *newhook
);
4.69.3 Parameter
Function pointer to the previous process hook if process hook was registered.
NULL if no process hook was registered.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-119
4 System Calls Reference
4.69.5 Example
4.69.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_SYSTEM_FATAL
Illegal process hook type. e0 = type
SCIOPTA - Kernel
SCIOPTA - Kernel
4-120 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.70 sc_procIdGet
4.70.1 Description
This call is used to get the process ID of a process by providing the name of the process.
In SCIOPTA processes are organized in systems (CPUs) and modules within systems. There is always at least one
module called system module (module 0). Depending where the process resides (system, module) not only the pro-
cess name needs to be supplied but also the including system and module name.
This call forwards the request to the process daemon. The standard process daemon (sc_procd) needs to be defined
and started at system configuration. In case of an external process, the request is forwarded to the respective Con-
nector process.
Kernels: V1, V2 and V2INT
4.70.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_procIdGet(
const char *path,
sc_ticks_t tmo
);
4.70.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-121
4 System Calls Reference
Process ID of the found process if the process was found within the tmo time period or empty.
Current process ID (process ID of the caller) if parameter path is NULL.
SC_ILLEGAL_PID if process was not found within the tmo time period.
The sc_procIdGet system call can also be used in an interrupt process. The process daemon sends a reply message
to the interrupt process (interrupt process src parameter == 1).
The reply message is defined as follows:
SCIOPTA - Kernel
#define SC_PROCIDGETMSG_REPLY (SC_MSG_BASE+0x10d)
4.70.6 Example
sc_pid_t slave_pid;
4.70.7 Errors
KERNEL_EILL_PROC_NAME ¦ SC_ERR_PROCESS_FATAL
Illegal path. e0 = pointer to path
KERNEL_EILL_PROCTYPE ¦ SC_ERR_PROCESS_FATAL
Process is PCB_TYPE_IDL. e0 = process type
SCIOPTA - Kernel
4-122 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.71 sc_procIntCreate
4.71.1 Description
This system call is used to request the kernel daemon to create an interrupt process. The standard kernel daemon
(sc_kerneld) needs to be defined and started at system configuration. The interrupt process will be of type Sciopta.
Interrupt processes of type Sciopta are handled by the kernel and may use (not blocking) system calls.
The process will be created within the callers module.
The maximum number of processes for a specific module is defined at module creation.
Kernels: V1
4.71.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_procIntCreate(
const char *name,
void (*entry) (int),
sc_bufsize_t stacksize,
int vector,
sc_prio_t prio,
int state,
sc_poolid_t plid
);
4.71.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-123
4 System Calls Reference
state N/A
Must be set to 0 (reserved for later use).
SCIOPTA - Kernel
4.71.4 Return Value
4.71.5 Example
hello_pid = sc_procIntCreate(
/* process name */ "SCI_tick",
/* process func */ (void (*) (void))SCI_tick,
/* stacksize */ 256,
/* vector */ 25,
/* priority */ 0,
/* state */ 0,
/* pool-id */ SC_DEFAULT_POOL
);
4.71.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_PROC_NAME ¦ SC_ERR_MODULE_FATAL
Parameter name not valid. e0 = Pointer to process name
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Illegal process type. e0 = Process type
KERNEL_EILL_PARAMETER ¦ SC_ERR_MODULE_FATAL
Illegal interrupt vector. e0 = Interrupt vector
SCIOPTA - Kernel
4-124 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.72 sc_procIrqRegister
4.72.1 Description
This system call is used to register an existing interrupt process for one more more other interrupt vectors.
Called from an interrupt process, registers the caller to be activated also if interrupt “vector” fires.
Intention of this system call is to allow handling of interrupts in the non-safe part of an application. To do so, a
(safe) interrupt process may register for multiple interrupts and notify a (non-safe) priority process.
To minimize the overhead, the sc_msgAllocTx() system call can be used, which can carry enough information to
handle the interrupt. Since allocation is done in the receivers pool, no copying is needed if the message is sent
across module boundaries.
It is a fatal error, if “vector” is already used.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.72.2 Syntax
void sc_procIrqRegister(
uint32_t vector
);
4.72.3 Parameter
None.
4.72.5 Example
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-125
4 System Calls Reference
4.72.6 Errors
KERNEL_EILL_PROCTYPE|SC_ERR_PROCESS_FATAL
Not an interrupt process. e0 = Process ID
KERNEL_EILL_VECTOR|SC_ERR_PROCESS_FATAL
Illegal Interrupt Vector e0 = vector
SCIOPTA - Kernel
SCIOPTA - Kernel
4-126 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.73 sc_procIrqUnregister
4.73.1 Description
4.73.2 Syntax
void sc_procIrqUnregister(
uint32_t vector
SCIOPTA - Kernel
);
4.73.3 Parameter
None.
4.73.5 Example
4.73.6 Errors
KERNEL_EILL_PROCTYPE|SC_ERR_PROCESS_FATAL
Not an interrupt process. e0 = Process ID
KERNEL_EILL_VECTOR|SC_ERR_PROCESS_FATAL
Illegal Interrupt Vector e0 = vector
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-127
4 System Calls Reference
4.74 sc_procKill
4.74.1 Description
This system call is used to request the kernel daemon to kill a process.
The standard kernel daemon (sc_kerneld) needs to be defined and started at system configuration.
Any process type (prioritized, interrupt, timer) can be killed. No external processes (on a remote CPU) can be
killed.
If a cleaning-up is executed (depending on the flag parameter) all message buffers owned by the process will be
returned to the message pool. If an observe is active on that process the observe messages will be sent to the ob-
serving processes. A significant time can elapse before a possible observe message is posted.
SCIOPTA - Kernel
Kernels: V1, V2 and V2INT
4.74.2 Syntax
void sc_procKill(
sc_pid_t pid,
flags_t flag
);
4.74.3 Parameter
None
4.74.5 Example
sc_procKill( SC_CURRENT_PID,0 );
SCIOPTA - Kernel
4-128 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.74.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_FATAL
pid == 0 e0 = pid
pid == SC_ILLEGAL_PID
mid too large
process index too large.
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_WARNING
Process killed or pid not valid. e0 = pid
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-129
4 System Calls Reference
4.75 sc_procNameGet
4.75.1 Description
SCIOPTA - Kernel
a fatal error. If there is no error hook, he system loops at the error label.
Kernels: V1, V2 and V2INT
4.75.2 Syntax
sc_msg_t sc_procNameGet(
sc_pid_t pid
);
4.75.3 Parameter
SCIOPTA - Kernel
4-130 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.75.5 Example
sc_msg_t senderName;
4.75.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-131
4 System Calls Reference
4.76 sc_procObserve
4.76.1 Description
SCIOPTA - Kernel
4.76.2 Syntax
void sc_procObserve(
sc_msgptr_t msgptr,
sc_pid_t pid
);
4.76.3 Parameter
None.
SCIOPTA - Kernel
4-132 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.76.5 Example
struct dead_s {
sc_msgid_t id;
sc_errcode_t errcode;
};
union sc_msg{
sc_msgid_t id;
struct dead_s dead;
};
sc_msg_t msg;
4.76.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Either pointer to message or pointer to message pointer
are zero.
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-133
4 System Calls Reference
4.77 sc_procPathCheck
4.77.1 Description
This call is used to check if the construction of a path is correct. It checks the lengths of the system, module and
process names and the number of slashes and if it contains only valid character (A-Z,a-z,0-9 and underscore)..
Kernels: V1, V2 and V2INT
4.77.2 Syntax
sc_errcode_t sc_procPathCheck(
SCIOPTA - Kernel
const char *path
);
4.77.3 Parameter
4.77.5 Example
if ( !sc_procPathCheck("//target0//target1/module/slave") ){
sc_miscError(0x1002,0);
}
4.77.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_SYSTEM_FATAL
Illegal path (pointer to path == 0). e0 = pointer to path name.
SCIOPTA - Kernel
4-134 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.78 sc_procPathGet
4.78.1 Description
4.78.2 Syntax
sc_msg_t sc_procPathGet(
sc_pid_t pid,
flags_t flags
);
4.78.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-135
4 System Calls Reference
SCIOPTA - Kernel
4.78.5 Example
sc_msg_t msg;
4.78.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
4-136 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.79 sc_procPpidGet
4.79.1 Description
This call is used to get the process ID of the parent (creator) of a process.
Kernels: V1, V2 and V2INT
4.79.2 Syntax
sc_pid_t sc_procPpidGet(
sc_pid_t pid
);
SCIOPTA - Kernel
4.79.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-137
4 System Calls Reference
4.79.5 Example
SCIOPTA - Kernel
msg = sc_msgAlloc( sizeof(keyb_msg_t), KEYB_MSG, 0, SC_ENDLESS_TMO );
if ( msg ){
msg->[Link] = key;
msg->[Link] = control_keys;
(&msg,ttyd_pid,0);
}
4.79.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
4-138 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.80 sc_procPrioCreate
4.80.1 Description
This system call is used to request the kernel daemon to create a prioritized process. The standard kernel daemon
(sc_kerneld) needs to be defined and started at system configuration.
The process will be created within the callers module.
Only supervisor-processes will be created (and no FPU).
The maximum number of processes for a specific module is defined at module creation.
Kernels: V1
4.80.2 Syntax
SCIOPTA - Kernel
sc_pid_t sc_procPrioCreate(
const char *name,
void (*entry) (void),
sc_bufsize_t stacksize,
sc_ticks_t slice,
sc_prio_t prio,
int state,
sc_poolid_t plid
);
4.80.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-139
4 System Calls Reference
SCIOPTA - Kernel
ID of the created process.
4.80.5 Example
hello_pid = sc_procPrioCreate(
/* process name */ "hello",
/* process func */ (void (*) (void))hello,
/* stacksize */ 512,
/* slice */ 0,
/* priority */ 16,
/* run-state */ SC_PDB_STATE_RUN,
/* pool-id */ SC_DEFAULT_POOL
);
4.80.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_PROC_NAME ¦ SC_ERR_MODULE_FATAL
Parameter name not valid. e0 = Pointer to process name
KERNEL_EILL_PRIORITY ¦ SC_ERR_MODULE_FATAL
Illegal priority (>=31) e0 = Requested priority
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Illegal process type. e0 = Process type
KERNEL_EILL_SLICE ¦ SC_ERR_MODULE_FATAL
Illegal slice value e0 = Slice
SCIOPTA - Kernel
4-140 Manual Version 5.0 Kernel Manual
4 System Calls Reference
KERNEL_EILL_STACKSIZE ¦ SC_ERR_MODULE_FATAL
Stack not valid. e0 = Requested stacksize
KERNEL_EILL_MODULE ¦ SC_ERR_MODULE_FATAL
Module cb is not valid. e0 = Module ID
KERNEL_ENO_MORE_PROC ¦ SC_ERR_MODULE_FATAL
Number of maximum processes reached. e0 = No of processes
KERNEL_EOUT_OF_MEMORY ¦ SC_ERR_MODULE_FATAL
Size does not fir into module memory.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-141
4 System Calls Reference
4.81 sc_procPrioGet
4.81.1 Description
4.81.2 Syntax
SCIOPTA - Kernel
sc_prio_t sc_procPrioGet(
sc_pid_t pid
);
4.81.3 Parameter
SCIOPTA - Kernel
4-142 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.81.5 Example
sc_pid_t proc_A_pid;
/* time-slice */ 0,
/* priority */ prio
};
4.81.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Illegal pid. e0 = pid
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = pid
e1 = process type
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-143
4 System Calls Reference
4.82 sc_procPrioSet
4.82.1 Description
SCIOPTA - Kernel
process can set its priority on level 32. This will redefine the process and it becomes an idle process. The idle pro-
cess will be called by the kernel if there are no processes ready.
Kernels: V1, V2 and V2INT
4.82.2 Syntax
void sc_procPrioSet(
sc_prio_t prio
);
4.82.3 Parameter
None.
4.82.5 Example
sc_procPrioSet( 31 );
SCIOPTA - Kernel
4-144 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.82.6 Errors
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = process type
KERNEL_EILL_PRIORITY ¦ SC_ERR_PROCESS_FATAL
Illegal priority. Priority == 32. e0 = process type
e1 = module priority
KERNEL_EILL_PRIORITY ¦ SC_ERR_PROCESS_FATAL
Illegal priority. e0 = process type
Priority > 32. e1 = -1
priority > max_prio.
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-145
4 System Calls Reference
4.83 sc_procSchedLock
4.83.1 Description
This system call will lock the scheduler and return the number of times it has been locked before.
SCIOPTA maintains a scheduler lock counter. If the counter is 0 scheduling is activated. Each time a process calls
sc_procSchedLock the counter will be incremented.
Interrupts are not blocked if the scheduler is locked.
Kernels: V1, V2 and V2INT
4.83.2 Syntax
SCIOPTA - Kernel
int sc_procSchedLock(void);
4.83.3 Parameter
None
Internal scheduler lock counter. Number of times the scheduler has been locked.
4.83.5 Example
// count instances
sc_procSchedLock();
++counter;
sc_procSchedUnlock();
4.83.6 Errors
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = process type
SCIOPTA - Kernel
4-146 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.84 sc_procSchedUnlock
4.84.1 Description
4.84.2 Syntax
SCIOPTA - Kernel
void sc_procSchedUnlock(void);
4.84.3 Parameter
None.
None
4.84.5 Example
// count instances
sc_procSchedLock();
++counter;
sc_procSchedUnlock();
4.84.6 Errors
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = process type
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Interrupts are locked.
KERNEL_EUNLOCK_WO_LOCK ¦ SC_ERR_MODULE_FATAL
Lockcounter == 0.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-147
4 System Calls Reference
4.85 sc_procSliceGet
4.85.1 Description
This call is used to get the time slice of a prioritized or timer process.
The time slice is the period of time between calls to the timer process in ticks or the the slice of round-robin sched-
uled prioritized processes on the same priority.
Kernels: V1, V2 and V2INT
4.85.2 Syntax
SCIOPTA - Kernel
sc_ticks_t sc_procSliceGet(
sc_pid_t pid
);
4.85.3 Parameter
4.85.5 Example
sc_ticks_t new_ticks;
new_ticks = sc_procSliceGet( SC_CURRENT_PID );
4.85.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Process/Module disappeared e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
4-148 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.86 sc_procSliceSet
4.86.1 Description
This call is used to set the time slice of a prioritized or timer process.
The modified time slice will become active after the current time slice expired or if the timer gets started. It can
only be activated after the old time slice has elapsed.
Kernels: V1, V2 and V2INT
4.86.2 Syntax
void sc_procSliceSet(
sc_pid_t pid,
SCIOPTA - Kernel
sc_ticks_t slice
);
4.86.3 Parameter
slice New period of time between calls to the timer process in ticks.
!=0 0 is only allowed for priortized processes and disables the time-slice.
4.86.4
Return Value
None.
4.86.5 Example
sc_procSliceSet( SC_CURRENT_PID, 5 );
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-149
4 System Calls Reference
4.86.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Process/Module disappeared e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Illegal pid. e0 = pid
SCIOPTA - Kernel
SCIOPTA - Kernel
4-150 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.87 sc_procStart
4.87.1 Description
4.87.2 Syntax
void sc_procStart(
sc_pid_t pid
);
4.87.3 Parameter
None.
4.87.5 Example
sc_procStart( proc_A_pid );
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-151
4 System Calls Reference
4.87.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized or timer process. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Illegal pcb e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Process is caller. e0 = pid
SCIOPTA - Kernel
Process is init process.
KERNEL_ESTART_NOT_STOPPED ¦ SC_ERR_MODULE_FATAL
Stop counter already 0 e0 = pid
SCIOPTA - Kernel
4-152 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.88 sc_procStop
4.88.1 Description
4.88.2 Syntax
void sc_procStop(
sc_pid_t pid
);
4.88.3 Parameter
None.
4.88.5 Example
sc_procStop( SC_CURRENT_PID );
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-153
4 System Calls Reference
4.88.6 Errors
KERNEL_EILL_PROC ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized or timer process. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Illegal pcb e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Process is caller. e0 = pid
SCIOPTA - Kernel
Process is init process.
KERNEL_EILL_VALUE ¦ SC_ERR_MODULE_FATAL
Stop counter already 0
SCIOPTA - Kernel
4-154 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.89 sc_procTimCreate
4.89.1 Description
This system call is used to request the kernel daemon to create a timer process. The standard kernel daemon (sc_k-
erneld) needs to be defined and started at system configuration.
The process will be created within the callers module.
The maximum number of processes for a specific module is defined at module creation.
Kernels: V1
4.89.2 Syntax
sc_pid_t sc_procTimCreate(
SCIOPTA - Kernel
4.89.3 Parameter
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-155
4 System Calls Reference
SCIOPTA - Kernel
4.89.4 Return Value
4.89.5 Example
hello_pid = sc_procTimCreate(
/* process name */ "SCI_tick",
/* process func */ (void (*) (void))SCI_tick,
/* stacksize */ 256,
/* period */ 10,
/* initdelay */ 0,
/* state */ SC_PDB_STATE_RUN,
/* pool-id */ SC_DEFAULT_POOL
);
4.89.6 Errors
KERNEL_ENO_KERNELD ¦ SC_ERR_PROCESS_FATAL
There is no kernel daemon defined in the system.
KERNEL_EILL_PROC_NAME ¦ SC_ERR_MODULE_FATAL
Parameter name not valid. e0 = Pointer to process name
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Illegal process type. e0 = Process type
KERNEL_EILL_SLICE ¦ SC_ERR_MODULE_FATAL
Illegal slice valueSlice e0 = Slice
SCIOPTA - Kernel
4-156 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.90 sc_procUnobserve
4.90.1 Description
4.90.2 Syntax
void sc_procUnobserve(
sc_pid_t pid,
sc_pid_t observer
SCIOPTA - Kernel
);
4.90.3 Parameter
None.
4.90.5 Example
4.90.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Illegal pcb e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Process is caller. e0 = pid
Process is init process.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-157
4 System Calls Reference
4.91 sc_procVarDel
4.91.1 Description
This system call is used to remove a process variable from the process variable data area.
Kernels: V1, V2 and V2INT
4.91.2 Syntax
int sc_procVarDel(
sc_tag_t tag
SCIOPTA - Kernel
);
4.91.3 Parameter
0 if the system call fails and the process variable could not be removed.
!=0 if the process variable was successfully removed.
4.91.5 Example
---
4.91.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
No process variable set
SCIOPTA - Kernel
4-158 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.92 sc_procVarGet
4.92.1 Description
4.92.2 Syntax
int sc_procVarGet(
sc_tag_t tag,
sc_var_t *value
);
SCIOPTA - Kernel
4.92.3 Parameter
0 if the system call fails and the process variable could not be found and read.
!=0 if the process variable was successfully read.
4.92.5 Example
---
4.92.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
No procVar set or value == NULL
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-159
4 System Calls Reference
4.93 sc_procVarInit
4.93.1 Description
This system call is used to setup and initialize a process variable area.
Kernel V1: The user should allocate a message that can hold (n+1) variable:
size = sizeof(sc_local_t)*(n+1);
Kernels V2: The user should allocate a message for n variables plus controll block:
size = sizeof(sc_varpool_t)+sizeof(sc_local_t)*n.
SCIOPTA - Kernel
Kernels: V1, V2 and V2INT
4.93.2 Syntax
void sc_procVarInit(
sc_msgptr_t varpool,
unsigned int n
);
4.93.3 Parameter
None.
4.93.5 Example
---
SCIOPTA - Kernel
4-160 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.93.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
No procVar set or value == NULL
KERNEL_ENOT_OWNER ¦ SC_ERR_PROCESS_FATAL
Process does not own the buffer e0 = owner
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Size too small. e0 = size
KERNEL_EALREADY_DEFINED ¦ SC_ERR_PROCESS_FATAL
Process variable already set. e0 = pointer to message buffer
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-161
4 System Calls Reference
4.94 sc_procVarRm
4.94.1 Description
4.94.2 Syntax
SCIOPTA - Kernel
4.94.3 Parameter
None
4.94.5 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
No procVar set or value == NULL
SCIOPTA - Kernel
4-162 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.95 sc_procVarSet
4.95.1 Description
4.95.2 Syntax
int sc_procVarSet(
sc_tag_t tag,
sc_var_t value
);
SCIOPTA - Kernel
4.95.3 Parameter
0 if the system call fails and the process variable could not be defined or modified.
!=0 if the process variable was successfully defined or modified.
4.95.5 Example
---
4.95.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
No procVar set
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-163
4 System Calls Reference
4.96 sc_procVectorGet
4.96.1 Description
This system call is used to get the interrupt vector of an interrupt process.
Kernels: V1, V2 and V2INT
4.96.2 Syntax
int sc_procVectorGet(
sc_pid_t pid
SCIOPTA - Kernel
);
4.96.3 Parameter
4.96.5 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not an interrupt process. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Illegal pcb e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_MODULE_FATAL
Process is caller. e0 = pid
Process is init process.
SCIOPTA - Kernel
4-164 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.97 sc_procWakeupEnable
4.97.1 Description
This system call is used to enable the wakeup of a timer or interrupt process.
Kernels: V1, V2 and V2INT
Please Note:
In V1 wakeup is active by default. In V2 and V2INT sc_procWakeupEnable must be called explicitely.
4.97.2 Syntax
4.97.3 Parameter
None.
None.
4.97.5 Example
---
4.97.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not an interrupt or timer process. e0 = process type
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-165
4 System Calls Reference
4.98 sc_procWakeupDisable
4.98.1 Description
This system call is used to disable the wakeup of a timer or interrupt process.
Kernels: V1, V2 and V2INT
4.98.2 Syntax
SCIOPTA - Kernel
4.98.3 Parameter
None.
None.
4.98.5 Example
---
4.98.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_MODULE_FATAL
Caller is not an interrupt or timer process. e0 = process type
SCIOPTA - Kernel
4-166 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.99 sc_procYield
4.99.1 Description
This system call is used to yield the CPU to the next ready process within the current process's priority group.
Kernels: V1, V2 and V2INT
4.99.2 Syntax
4.99.3 Parameter
SCIOPTA - Kernel
None.
None.
4.99.5 Example
sc_procYield ();
4.99.6 Errors
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Scheduling not possible as it is locked.
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process. e0 = process type
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-167
4 System Calls Reference
4.100 sc_safe_charGet
4.100.1 Description
System call to get safe data of specific char types. The data is stored once in normal and in inverted format.
Kernels: V2 and V2INT
4.100.2 Syntax
SCIOPTA - Kernel
unsigned char sc_safe_ucharGet( sc_safe_uchar_t *si )
int8_t sc_safe_s8Get( sc_safe_s8_t *si )
uint8_t sc_safe_u8Get( sc_safe_u8_t *si )
4.100.3 Parameter
None.
4.100.5 Example
---
4.100.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
4-168 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.101 sc_safe_charSet
4.101.1 Description
System call to set safe data of specific char types at a given address in memory. The data is stored once in normal
and in inverted format.
Kernels: V2 and V2INT
4.101.2 Syntax
4.101.3 Parameter
v Safe data.
Safe data of specific char types to be stored.
None.
4.101.5 Example
---
4.101.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-169
4 System Calls Reference
4.102 sc_safe_<type>Get
4.102.1 Description
System call to get safe data of specific types. The data is stored once in normal and in inverted format.
Kernels: V2 and V2INT
4.102.2 Syntax
SCIOPTA - Kernel
long sc_safe_intGet( sc_safe_long_t *si );
unsigned long sc_safe_intGet( sc_safe_ulong_t *si );
__s32 sc_safe_intGet( sc_safe_s32_t *si );
uint32_t sc_safe_intGet( sc_safe_u32_t *si );
sc_pool_cb_t *sc_safe_poolcb_ptrGet( sc_safe_poolcb_ptr_t *si );
sc_pcb_t *sc_safe_pcbptrGet( sc_safe_pcbptr_t *si );
sc_module_cb_t *sc_safe_mcbptrGet( sc_safe_mcbptr_t *si );
sc_modulesize_t sc_safe_modulesizeGet( sc_safe_modulesize_t*si );
sc_ticks_t sc_safe_ticksGet( sc_safe_ticks_t *si );
sc_time_t sc_safe_timeGet( sc_safe_time_t *si );
sc_pid_t sc_safe_pidGet( sc_safe_pid_t *si );
sc_mid_t sc_safe_midGet( sc_safe_mid_t *si );
sc_errcode_t sc_safe_errcodeGet( sc_safe_errcode_t *si );
void *sc_safe_voidptrGet( sc_safe_voidptr_t *si );
sc_triggerval_t sc_safe_triggervalGet( sc_safe_triggerval_t *si );
sc_plsize_t sc_safe_plsizeGet( sc_safe_plsize_t *si );
sc_poolid_t sc_safe_poolidGet( sc_safe_poolid_t *si );
sc_bufsize_t sc_safe_bufsizeGet( sc_safe_bufsize_t *si );
sc_prio_t sc_safe_prioGet( sc_safe_prio_t *si );
4.102.3 Parameter
SCIOPTA - Kernel
4-170 Manual Version 5.0 Kernel Manual
4 System Calls Reference
None.
4.102.5 Example
---
4.102.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-171
4 System Calls Reference
4.103 sc_safe_<type>Set
4.103.1 Description
System call to set safe data of specific types at a given address in memory. The data is stored once in normal and
in inverted format.
Kernels: V2 and V2INT
4.103.2 Syntax
SCIOPTA - Kernel
void sc_safe_uintSet( sc_safe_uint_t *si, unsigned int v );
void sc_safe_longSet( sc_safe_long_t *si, long v );
void sc_safe_ulongSet( sc_safe_ulong_t *si, unsigned long v );
void sc_safe_s32Set( sc_safe_s32_t *si, __s32 v );
void sc_safe_u32Set( sc_safe_u32_t *si, uint32_t v );
void sc_safe_poolcb_ptrSet( sc_safe_poolcb_ptr_t *si, sc_pool_cb_t *v );
void sc_safe_pcbptrSet( sc_safe_pcbptr_t *si, sc_pcb_t *v );
void sc_safe_mcbptrSet( sc_safe_mcbptr_t *si, sc_module_cb_t *v );
void sc_safe_modulesizeSet( sc_safe_modulesize_t *si, sc_modulesize_t v );
void sc_safe_ticksSet( sc_safe_ticks_t *si, sc_ticks_t v );
void sc_safe_timeSet( sc_safe_time_t *si, sc_time_t v );
void sc_safe_pidSet( sc_safe_pid_t *si, sc_pid_t v );
void sc_safe_midSet( sc_safe_mid_t *si, sc_mid_t v );
void sc_safe_errcodeSet( sc_safe_errcode_t *si, sc_errcode_t v );
void sc_safe_voidptrSet( sc_safe_voidptr_t *si, void *v );
void sc_safe_triggervalSet( sc_safe_triggerval_t *si, sc_triggerval_t v );
void sc_safe_plsizeSet( sc_safe_plsize_t *si, sc_plsize_t v );
void sc_safe_poolidSet( sc_safe_poolid_t *si, sc_poolid_t v );
void sc_safe_bufsizeSet( sc_safe_bufsize_t *si, sc_bufsize_t v );
void sc_safe_prioSet( sc_safe_prio_t *si, sc_prio_t v );
4.103.3 Parameter
v Safe data.
Safe data of specific int types to be stored.
SCIOPTA - Kernel
4-172 Manual Version 5.0 Kernel Manual
4 System Calls Reference
None.
4.103.5 Example
---
4.103.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-173
4 System Calls Reference
4.104 sc_safe_shortGet
4.104.1 Description
System call to get safe data of specific short types. The data is stored once in normal and in inverted format.
Kernels: V2 and V2INT
4.104.2 Syntax
SCIOPTA - Kernel
__s16 sc_safe_s16Get( sc_safe_s16_t *si )
uint16_t sc_safe_u16Get( sc_safe_u16_t *si )
4.104.3 Parameter
4.104.5 Example
---
4.104.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
4-174 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.105 sc_safe_shortSet
4.105.1 Description
System call to set safe data of specific short types at a given address in memory. The data is stored once in normal
and in inverted format.
Kernels: V2 and V2INT
4.105.2 Syntax
4.105.3 Parameter
v Safe data.
Safe data of specific short types to be stored.
None.
4.105.5 Example
---
4.105.6 Errors
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Parameter si not valid (== 0).
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-175
4 System Calls Reference
4.106 sc_sleep
4.106.1 Description
This call is used to suspend the calling process for a defined time. The requested time must be given in number of
system ticks.
The calling process will get into a waiting state and swapped out. After the timeout has elapsed the process will
become ready again and will be swapped in if it has the highest priority of all ready processes.
The process will be waiting for at least the requested time minus one system tick.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.106.2 Syntax
Kernels V1:
void sc_sleep(
sc_ticks_t tmo
);
Kernels V2:
sc_time_t sc_sleep(
sc_ticks_t tmo
);
4.106.3 Parameter
tmo Timeout.
Number of system ticks to wait.
Kernels V2 only: Activation time. The absolute time (tick counter) value when the calling process became ready.
4.106.5 Example
void resetPHY(){
// Setup some I/O pins
sc_sleep( 2 );
// Setup some other I/O pins
sc_sleep( 2 );
// Setup last I/O pins
sc_sleep( 2 );
}
SCIOPTA - Kernel
4-176 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.106.6 Errors
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Scheduler is locked.
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_MODULE_FATAL
Caller is not a prioritized process.
KERNEL_EILL_SLICE ¦ SC_ERR_MODULE_FATAL
Illegal timeout value. e0 = tmo
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-177
4 System Calls Reference
4.107 sc_tick
4.107.1 Description
This function calls directly the kernel tick function and advances the kernel tick counter by 1.
The kernel maintains a counter to control the timing functions. The timer needs to be incremented in regular inter-
vals.
The user shall setup an periodic interrupt process and call sc_tick. The lenght of the period shall be published by
the sc_tickLength system call. sc_tick must be called explicitly.
This system call is only allowed in hardware activated interrupt processes.
Note: A SCIOPTA system can be used tickless. In this case, sc_tick will not be called. Consequently, no timeouts
SCIOPTA - Kernel
are allowed.
Kernels: V1, V2 and V2INT
4.107.2 Syntax
void sc_tick(void);
4.107.3 Parameter
None.
None.
4.107.5 Example
4.107.6 Errors
None
SCIOPTA - Kernel
4-178 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.108 sc_tickActivationGet
4.108.1 Description
This functions returns the tick time of last activation of the calling process.
Kernels: V2 and V2INT
4.108.2 Syntax
sc_time_t sc_tickActivationGet(void)
4.108.3 Parameter
None
SCIOPTA - Kernel
Activation time. The absolute time (tick counter) value when the calling process became ready.
4.108.5 Example
---
4.108.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-179
4 System Calls Reference
4.109 sc_tickGet
4.109.1 Description
This call is used to get the actual kernel tick counter value. The number of system ticks from the system start are
returned.
Kernels: V1, V2 and V2INT
4.109.2 Syntax
SCIOPTA - Kernel
4.109.3 Parameter
None
4.109.5 Example
t = sc_tickGet();
for(i = 0; i < 100; ++i ){
cache_flush_range((char *)0x3000000,0x8000);
memcpy32B((char *)0x2000000,(char *)0x3000000,0x100000);
}
t = sc_tickGet()-t;
kprintf(0,"Copy in 100MB in %d ms\n",sc_tickTick2Ms(t));
4.109.6 Errors
None
SCIOPTA - Kernel
4-180 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.110 sc_tickLength
4.110.1 Description
This system call is used to set or get the current system tick length in microseconds.
Note: This value is informational only and has no impact on the kernel behaviour like scheduling. But the function
sc_tickMs2Tick and sc_tickTick2Ms rely on it.
Kernels: V1, V2 and V2INT
4.110.2 Syntax
uint32_t sc_tickLength(
uint32_t ticklength
SCIOPTA - Kernel
);
4.110.3 Parameter
4.110.5 Example
sc_tickLength( 4999 );
pic_irqEnable( PIC_SRC_PIT0 );
kprintf( 0, "done\n" );
4.110.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-181
4 System Calls Reference
4.111 sc_tickMs2Tick
4.111.1 Description
This system call is used to convert a time from milliseconds into system ticks.
Note: This function may round input values larger then UINT32_MAX/1000.
Kernels: V1, V2 and V2INT
4.111.2 Syntax
SCIOPTA - Kernel
sc_time_t sc_tickMs2Tick(
uint32_t ms
);
4.111.3 Parameter
ms Time in milliseconds.
4.111.5 Example
4.111.6 Errors
None
SCIOPTA - Kernel
4-182 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.112 sc_tickTick2Ms
4.112.1 Description
This system call is used to convert a time from system ticks into milliseconds.
The calculation is based on tick-length and limited to 32 bit.
Note: This function may round input values larger then UINT32_MAX/1000.
Kernels: V1, V2 and V2INT
4.112.2 Syntax
uint32_t sc_tickTick2Ms(
sc_ticks_t t
SCIOPTA - Kernel
);
4.112.3 Parameter
Time in milliseconds.
4.112.5 Example
t0 = sc_tickGet();
for(cnt = 0 ; cnt < 1000000; ++cnt){
sc_procYield();
}
t1 = sc_tickGet();
t2 = sc_tickTick2Ms( t1-t0 );
4.112.6 Errors
None
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-183
4 System Calls Reference
4.113 sc_tmoAdd
4.113.1 Description
This system call is used to request a timeout message from the kernel after a defined time.
The caller needs to allocate a message and include the pointer to this message in the call. The kernel will send this
message back to the caller after the time has expired.
This is an asynchronous call, the caller will not be blocked.
The registered timeout can be cancelled by the sc_tmoRm call before the timeout has expired. This system call
returns the timeout ID which could be used later to cancel the timeout.
Kernels: V1, V2 and V2INT
SCIOPTA - Kernel
4.113.2 Syntax
sc_tmoid_t sc_tmoAdd(
sc_ticks_t tmo,
sc_msgptr_t msgptr
);
4.113.3 Parameter
tmo Timeout.
Number of system tick after which the message will be sent back by the kernel.
Timeout ID.
4.113.5 Example
sc_tmoid_t tmoid;
SCIOPTA - Kernel
4-184 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.113.6 Errors
KERNEL_EPROC_NOT_PRIO ¦ SC_ERR_PROCESS_FATAL
Caller is not a prioritized process. e0 = process type
KERNEL_EILL_SLICE ¦ SC_ERR_PROCESS_FATAL
Illegal timeout value. e0 = tmo
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Either pointer to message or pointer to message pointer
are zero.
KERNEL_EALREADY_DEFINED ¦ SC_ERR_PROCESS_FATAL
Message is already a timeout message. e0 = Pointer to the message
SCIOPTA - Kernel
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = Owner
e1 = Pointer to message
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-185
4 System Calls Reference
4.114 sc_tmoRm
4.114.1 Description
SCIOPTA - Kernel
Kernels: V1, V2 and V2INT
4.114.2 Syntax
sc_msg_t sc_tmoRm(
sc_tmoid_t *id
);
4.114.3 Parameter
id Timeout ID.
Pointer to timeout ID which was given when the timeout was registered by the sc_tmoAdd call.
Pointer to the timeout message which was defined at registering it by the sc_tmoAdd call.
4.114.5 Example
sc_msg_t tmomsg;
sc_msgFree( &tmomsg );
SCIOPTA - Kernel
4-186 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.114.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Timeout expired, but not received (not in the queue)
KERNEL_EILL_PARAMETER ¦ SC_ERR_PROCESS_FATAL
Timeout ID is already cleared. e0 = Pointer to timeout ID
KERNEL_ENIL_PTR ¦ SC_ERR_PROCESS_FATAL
Either pointer to message or pointer to message pointer
are zero.
KERNEL_ENOT_OWNER ¦ SC_ERR_MODULE_FATAL
Process does not own the message. e0 = pid of the owner
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-187
4 System Calls Reference
4.115 sc_trigger
4.115.1 Description
4.115.2 Syntax
SCIOPTA - Kernel
void sc_trigger(
sc_pid_t pid
);
4.115.3 Parameter
None.
4.115.5 Example
sc_pid_t slave_pid;
sc_trigger( slave_pid );
SCIOPTA - Kernel
4-188 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.115.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_PROCESS_FATAL
Illegal process type. e0 = pid
e1 = process type
KERNEL_EILL_PID ¦ SC_ERR_MODULE_WARNING
Process disappeared e0 = pid
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_FATAL
Process is an init or external process e0 = pid
SCIOPTA - Kernel
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-189
4 System Calls Reference
4.116 sc_triggerValueGet
4.116.1 Description
4.116.2 Syntax
SCIOPTA - Kernel
sc_triggerval_t sc_triggerValueGet(
sc_pid_t pid
);
4.116.3 Parameter
Trigger value.
INT_MAX if no valid process.
4.116.5 Example
sc_pid_t slave_pid;
sc_triggerval_t slavetrig;
4.116.6 Errors
KERNEL_EILL_PID ¦ SC_ERR_PROCESS_FATAL
Process is an init or external process e0 = pid
SCIOPTA - Kernel
4-190 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.117 sc_triggerValueSet
4.117.1 Description
This system call is used to set the value of a process trigger to any positive value.
The caller can only set the trigger value of its own trigger.
Kernels: V1, V2 and V2INT
4.117.2 Syntax
void sc_triggerValueSet(
sc_triggerval_t value
);
SCIOPTA - Kernel
4.117.3 Parameter
None.
4.117.5 Example
sc_triggerValueSet( 1 );
sc_triggerWait( 1, SC_ENDLESS_TMO );
4.117.6 Errors
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Illegal trigger value. e0 = Trigger value
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-191
4 System Calls Reference
4.118 sc_triggerWait
4.118.1 Description
SCIOPTA - Kernel
it has been decrement before.
Kernels V2 only: The activation time is saved for sc_triggerWait in prioritized processes. The activation time is
the absolute time (tick counter) value when the process became ready.
Kernels: V1, V2 and V2INT
4.118.2 Syntax
int sc_triggerWait(
sc_triggerval_t dec,
sc_ticks_t tmo
);
4.118.3 Parameter
tmo Timeout.
SC_ENDLESS_TMO Timeout is not used. Blocks and waits endless until trigger.
SC_NO_TMO Generates a system error.
SC_FATAL_IF_TMO Generates a system error.
0 < tmo =< SC_TMO_MAX Timeout value in system ticks. Waiting on trigger with timeout. Blocks and waits
the specified number of ticks for trigger.
SCIOPTA - Kernel
4-192 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.118.5 Example
sc_triggerValueSet( 1 );
sc_triggerWait( 1, SC_ENDLESS_TMO );
4.118.6 Errors
KERNEL_EILL_PROCTYPE ¦ SC_ERR_PROCESS_FATAL
Illegal process type. e0 = Process type
KERNEL_ELOCKED ¦ SC_ERR_MODULE_FATAL
Interrupts and/or scheduler are/is locked. e0 = Lock counter value or
SCIOPTA - Kernel
KERNEL_EILL_VALUE ¦ SC_ERR_PROCESS_FATAL
Illegal trigger decrement value (<=0). e0 = Decrement value
KERNEL_EILL_SLICE ¦ SC_ERR_PROCESS_FATAL
tmo value not valid. e0 = tmo value
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-193
4 System Calls Reference
4.119 sciopta_end
4.119.1 Desription
4.119.2 Syntax
SCIOPTA - Kernel
void sciopta_end (void);
4.119.3 Parameter
None.
None.
4.119.5 Errors
None.
SCIOPTA - Kernel
4-194 Manual Version 5.0 Kernel Manual
4 System Calls Reference
4.120 sciopta_start
This function starts a SCIOPTA Kernel Simulator application. It must be placed in the startup code of your Win-
dows application.
This system call is only available in the SCIOPTA V1 Simulator.
Kernel: V1
4.120.1 Syntax
int sciopta_start (
char *cmdline,
sciopta_t *psciopta,
sc_pcb_t **connectors,
sc_pcb_t **pirq_vectors,
sc_module_cb_t **modules,
SCIOPTA - Kernel
void (*start_hook)(void),
void (*TargetSetup)(void),
void (*sysPutchar)(int ),
void (*idle_hook)(void)
);
4.121 Parameter
cmdline Command line of the application. This parameter is not used so far.
sysPutchar Function pointer to a put-character function. This is used by the kernel internal debug functions.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 4-195
4 System Calls Reference
SCIOPTA - Kernel
SCIOPTA - Kernel
4-196 Manual Version 5.0 Kernel Manual
5 Kernel Error Reference
5.1 Introduction
SCIOPTA has many built-in error check functions.
Contrary to most conventional real-time operating systems, SCIOPTA uses a centralized mechanism for error re-
porting, called Error Hook. In traditional real-time operating systems, the user needs to check return values of sys-
tem calls for a possible error condition. In SCIOPTA all error conditions will end up in the Error Hook. This
guarantees that all errors are treated and that the error handling does not depend on individual error strategies which
might vary from user to user.
Please consult chapter 2.10 “Error Handling” on page 2-48 for more information about the SCIOPTA error han-
dling.
When the error hook is called from the kernel, all information about the error are transferred in 32-bit error word
parameter. There are also additional 32-bit extra words (parameters e0, e1, e2, ...) available to the user.
SCIOPTA - Kernel
32 Bits
The Function Code defines from what SCIOPTA system call the error was initiated. The Error Code contains the
specific error information and the Error Type informs about the severeness of the error.
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 5-1
5 Kernel Error Reference
SCIOPTA - Kernel
SC_MSGTXALIAS 0x09 sc_msgTxAlias
SC_MSGRX 0x0A sc_msgRx
SC_MSGPOOLIDGET 0x0B sc_poolIdGet
SC_MSGACQUIRE 0x0C sc_msgAcquire
SC_MSGALLOCCLR 0x0D sc_msgAllocClr
SC_MSGHOOKREGISTER 0x0E sc_msgHookRegister
SC_MSGHDCHECK 0x0F sc_msgHdCheck
SC_POOLCREATE 0x10 sc_poolCreate
SC_POOLRESET 0x11 sc_poolReset
SC_POOLKILL 0x12 sc_poolKill
SC_POOLINFO 0x13 sc_poolInfo
SC_POOLDEFAULT 0x14 sc_poolDefault
SC_POOLIDGET 0x15 sc_poolIdGet
SC_SYSPOOLKILL 0x16 sc_sysPoolKill (Internal)
SC_POOLHOOKREGISTER 0x17 sc_poolHookRegister
SC_MISCERRORHOOKREGISTER 0x18 sc_miscErrorHookRegister
SC_MISCKERNELDREGISTER 0x19 sc_miscKerneldRegister (Internal)
SC_MISCCRCCONTD 0x1A sc_miscCrcContd
SC_MISCCRC 0x1B sc_miscCrc
SC_MISCERRNOSET 0x1C sc_miscErrnoSet
SC_MISCERRNOGET 0x1D sc_miscErrnoGet
SC_PROCWAKEUPENABLE 0x1E sc_procWakeupEnable
SC_PROCWAKEUPDISABLE 0x1F sc_procWakeupDisable
SC_PROCPRIOGET 0x20 sc_procPrioGet
SC_PROCPRIOSET 0x21 sc_procPrioSet
SC_PROCSLICEGET 0x22 sc_procSliceGet
SC_PROCSLICESET 0x23 sc_procSliceSet
SC_PROCIDGET 0x24 sc_procIdGet
SC_PROCPPIDGET 0x25 sc_procPpidGet
SC_PROCNAMEGET 0x26 sc_procNameGet
SCIOPTA - Kernel
5-2 Manual Version 5.0 Kernel Manual
5 Kernel Error Reference
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 5-3
5 Kernel Error Reference
SCIOPTA - Kernel
SC_TMOADD 0x58 sc_tmoAdd
SC_TMO 0x59 sc_tmo (Internal)
SC_SLEEP 0x5A sc_sleep
SC_TMORM 0x5B sc_tmoRm
SC_TICKGET 0x5C sc_tickGet
SC_TICKLENGTH 0x5D sc_tickLength
SC_TICKMS2TICK 0x5E sc_tickMs2Tick
SC_TICKTICK2MS 0x5F sc_tickTick2Ms
SC_CONNECTORREGISTER 0x60 sc_connectorRegister
SC_CONNECTORUNREGISTER 0x61 sc_connectorUnregister
0x62 <dispatcher>
0x63 reserved
0x64 reserved
SC_MSGALLOCTX 0x65 sc_msgAllocTx
SC_CONNECTORREMOTE2LOCAL 0x66 sc_connectorRemote2local (Internal)
SCIOPTA - Kernel
5-4 Manual Version 5.0 Kernel Manual
5 Kernel Error Reference
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 5-5
5 Kernel Error Reference
SCIOPTA - Kernel
SC_PROCWAKEUPENABLE 0x30 sc_procWakeupEnable
SC_PROCWAKEUPDISABLE 0x31 sc_procWakeupDisable
SC_PROCPRIOGET 0x32 sc_procPrioGet
SC_PROCPRIOSET 0x33 sc_procPrioSet
SC_PROCSLICEGET 0x34 sc_procSliceGet
SC_PROCSLICESET 0x35 sc_procSliceSet
SC_PROCIDGET 0x36 sc_procIdGet
SC_PROCPPIDGET 0x37 sc_procPpidGet
SC_PROCNAMEGET 0x38 sc_procNameGet
SC_PROCPATHGET 0x39 sc_procPathGet
SC_PROCATTRGET 0x3A sc_procAttrGet
SC_PROCVECTORGET 0x3B sc_procVectorGet
SC_PROCPATHCHECK 0x3C sc_procPathCheck
SC_PROCIRQREGISTER 0x3D sc_procIrqRegister
SC_PROCIRQUNREGISTER 0x3E sc_procIrqUnregister
0x3F reserved
SC_PROCSTART 0x40 sc_procStart
SC_PROCSTOP 0x41 sc_procStop
SC_PROCSCHEDLOCK 0x42 sc_procSchedLock
SC_PROCSCHEDUNLOCK 0x43 sc_procSchedUnlock
SC_PROCYIELD 0x44 sc_procYield
SC_PROCCREATE2 0x45 sc_procCreate2
SC_PROCKILL 0x46 sc_procKill
SC_PROCOBSERVE 0x47 sc_procObserve
SC_PROCUNOBSERVE 0x48 sc_procUnobserve
SC_PROCVARINIT 0x49 sc_procVarInit
SC_PROCVARGET 0x4A sc_procVarGet
SC_PROCVARSET 0x4B sc_procVarSet
SC_PROCVARDEL 0x4C sc_procVarDel
SC_PROCVARRM 0x4D sc_procVarRm
SCIOPTA - Kernel
5-6 Manual Version 5.0 Kernel Manual
5 Kernel Error Reference
0x9A
0x9B
SC_PROCCBCHK 0x5C sc_procCBChk
SC_PROCFLOWSIGNATUREINIT 0x5D sc_procFlowSignatureInit
SC_PROCFLOWSIGNATUREUPDATE 0x5E sc_procFlowSignatureUpdate
SC_PROCFLOWSIGNATUREGET 0x5F sc_procFlowSignatureGet
SC_MODULECREATE2 0x60 sc_moduleCreate2
SC_MODULEKILL 0x61 sc_moduleKill
SC_MODULENAMEGET 0x62 sc_moduleNameGet
SC_MODULEIDGET 0x63 sc_moduleIdGet
SC_MODULEINFO 0x64 sc_moduleInfo
SC_MODULEPRIOGET 0x65 sc_modulePrioGet
SC_MODULEFRIENDADD 0x66 sc_moduleFriendAdd
SC_MODULEFRIENDRM 0x67 sc_moduleFriendRm
SC_MODULEFRIENDGET 0x68 sc_moduleFriendGet
SC_MODULEFRIENDNONE 0x69 sc_moduleFriendNone
SC_MODULEFRIENDALL 0x6A sc_moduleFriendAll
SC_MODULESTART 0x6B sc_moduleStart (Internal)
SC_MODULESTOP 0x6C sc_moduleStop
0x6D reserved
0x6E reserved
SC_MODULECBCHK 0x6F sc_moduleCBChk
SC_TRIGGERVALUESET 0x70 sc_triggerValueSet
SC_TRIGGERVALUEGET 0x71 sc_triggerValueGet
SC_TRIGGER 0x72 sc_trigger
SC_TRIGGERWAIT 0x73 sc_triggerWait
0x74 reserved
0x75 reserved
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 5-7
5 Kernel Error Reference
SCIOPTA - Kernel
SC_CONNECTORREGISTER 0x80 sc_connectorRegister
SC_CONNECTORUNREGISTER 0x81 sc_connectorUnregister
0x82 reserved
0x83 reserved
0x84 reserved
0x85 reserved
0x86 reserved
0x87 reserved
0x88 dispatcher (Internal)
0x89 irq_dispatcher (Internal)
0x8A kernel_private (Internal)
SC_SYSERROR 0x8B sc_sysError (many)
0x8C sc_safe_* (many)
SC_SYSLDATACORRUPT 0x8D many
0x8E reserved
0x8F reserved
SCIOPTA - Kernel
5-8 Manual Version 5.0 Kernel Manual
5 Kernel Error Reference
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 5-9
5 Kernel Error Reference
SCIOPTA - Kernel
5.6 Error Types
SCIOPTA - Kernel
5-10 Manual Version 5.0 Kernel Manual
6 Manual Versions
6 Manual Versions
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 6-1
6 Manual Versions
SCIOPTA - Kernel
SCIOPTA - Kernel
6-2 Manual Version 5.0 Kernel Manual
7 Index
7 Index
A
Activate a Process Trigger ............................................................................................................................. 4-188
Add a Friend Module ....................................................................................................................................... 4-26
Add a Time-Out Request ............................................................................................................................... 4-184
Addressee of a Message ................................................................................................................................... 4-42
Allocate a Message .......................................................................................................................................... 4-44
Allocate a Message and Clear Content ............................................................................................................ 4-47
Allocate a Message with Time-Out ................................................................................................................. 4-44
Allocate Memory ............................................................................................................................................. 4-44
allocated-messages queue ................................................................................................................................ 4-56
C
Calculate a 16 Bit CRC ...................................................................................................................................... 4-5
Calculate a 32 Bit CRC ...................................................................................................................................... 4-7
SCIOPTA - Kernel
D
Default Pool ..................................................................................................................................................... 4-88
Define a Process Variable .............................................................................................................................. 4-163
Define all Modules as Friends ......................................................................................................................... 4-27
Delete Process Variable ................................................................................................................................. 4-158
Disable wakeup of a timer or interrupt process ............................................................................................. 4-166
E
Enable wakeup of a timer or interrupt process .............................................................................................. 4-165
err.h .................................................................................................................................................................... 5-1
errno Variable .......................................................................................................................................... 4-9, 4-10
Error Check ........................................................................................................................................................ 5-1
Error Code .......................................................................................................................................................... 5-1
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 7-1
7 Index
F
Find a message in the allocated-messages queue ............................................................................................. 4-56
Free a Message ................................................................................................................................................. 4-60
SCIOPTA - Kernel
Function Code ..................................................................................................................................................... 5-1
G
Get a Process Variable .................................................................................................................................... 4-159
Get Information About a Message Pool ........................................................................................................... 4-92
Get Information About a Module ..................................................................................................................... 4-32
Get Module Friend Information ........................................................................................................................ 4-28
Get the Addressee of a Message ....................................................................................................................... 4-42
Get the Creator Process .................................................................................................................................. 4-137
Get the ID of a Message Pool ........................................................................................................................... 4-91
Get the ID of a Module ..................................................................................................................................... 4-31
Get the ID of a Process ................................................................................................................................... 4-121
Get the Interrupt Vector .................................................................................................................................. 4-164
Get the Name of a Module ................................................................................................................................ 4-37
Get the Name of Process ................................................................................................................................. 4-130
Get the Owner of a Message ............................................................................................................................. 4-65
Get the Parent Process .................................................................................................................................... 4-137
Get the Path of a Process ................................................................................................................................ 4-135
Get the Pool ID of a Message ........................................................................................................................... 4-67
Get the Priority of a Process ........................................................................................................................... 4-142
Get the Process Error Number ............................................................................................................................ 4-9
Get the Requested Size of a Message ............................................................................................................... 4-72
Get the Sender of a Message ............................................................................................................................ 4-76
Get the Tick Counter Value ............................................................................................................................ 4-180
Get the Time Slice of a Timer Process ........................................................................................................... 4-148
Get the Value of a Process Trigger ................................................................................................................. 4-190
Get time of last activation ............................................................................................................................... 4-179
I
Initialize Process Variable Area ..................................................................................................................... 4-160
Installed files ....................................................................................................................................................... 6-1
Interrupt Source Parameter ............................................................................................................................... 2-13
Interrupt Vector Parameter ............................................................................................................................... 2-13
K
Kernel Daemon .................................................................................................. 4-18, 4-21, 4-35, 4-106, 4-128
Kernel Error Codes ............................................................................................................................................. 5-1
SCIOPTA - Kernel
7-2 Manual Version 5.0 Kernel Manual
7 Index
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 7-3
7 Index
L
Lock the Scheduler ......................................................................................................................................... 4-146
M
mdb ................................................................................................................................................................... 4-22
Message Ownership .......................................................................................................................................... 4-44
Message Pool ......................................................................................................................................... 4-44, 4-67
Message pool .................................................................................................................................................... 4-85
Message Pool Calls ............................................................................................................................................. 3-7
Message Queue ................................................................................................................................................. 4-69
Message Sent to Unknown Process .................................................................................................................. 2-35
SCIOPTA - Kernel
Message Size .................................................................................................................................................... 4-74
Message System Calls ........................................................................................................................................ 3-1
Miscellaneous and Error Calls ................................................................................................................. 3-9, 3-10
Modify a Process Variable .............................................................................................................................. 4-163
Module Address and Size ................................................................................................................................. 4-23
Module Control Block ...................................................................................................................................... 4-32
Module Descriptor Block ................................................................................................................................. 4-22
Module Info Structure ....................................................................................................................................... 4-33
Module System Calls .......................................................................................................................................... 3-6
module.h ........................................................................................................................................................... 4-32
N
Name of a process ........................................................................................................................................... 4-130
O
Observe a Process ........................................................................................................................................... 4-132
Owner of a Message .............................................................................................................................. 4-40, 4-65
P
Path of a process ............................................................................................................................................. 4-135
Plausibility check .............................................................................................................................................. 4-62
Pool Control Block ........................................................................................................................................... 4-92
Pool Create Hook .............................................................................................................................................. 4-89
Pool ID .............................................................................................................................................................. 4-67
Pool Info Structure ............................................................................................................................................ 4-93
Pool Kill Hook .................................................................................................................................................. 4-89
Pool Statistics Info Structure ............................................................................................................................ 4-94
Priority Range ................................................................................................................................................. 4-142
Process Daemon ................................................................................................................................. 4-114, 4-121
Process Hook .................................................................................................................................................. 4-119
Process ID ....................................................................................................................................................... 4-121
Process Path .......................................................................................................................... 4-121, 4-128, 4-134
Process System Calls .......................................................................................................................................... 3-3
Process Ticks .................................................................................................................................................. 4-148
Process Trigger ............................................................................................................................................... 4-188
Process Trigger Calls .......................................................................................................................................... 3-9
SCIOPTA - Kernel
7-4 Manual Version 5.0 Kernel Manual
7 Index
R
Read a Process Variable ................................................................................................................................. 4-159
Receive a Message ................................................................................................................................. 4-56, 4-69
Receive a Message with Time-Out .................................................................................................................. 4-69
Register a CONNECTOR Process ..................................................................................................................... 4-1
Register a Message Hook ................................................................................................................................. 4-63
Register a Pool Hook ....................................................................................................................................... 4-89
Register a Process Daemon ............................................................................................................................ 4-114
Register a process exit function ............................................................................................ 4-100, 4-117, 4-118
Register a Process Hook ................................................................................................................................ 4-119
Register an Error Hook .................................................................................................................................... 4-13
Remove a CONNECTOR Process ............................................................................................................. 4-3, 4-4
Remove a Module from Friends ...................................................................................................................... 4-30
Remove a Process Variable ........................................................................................................................... 4-158
Remove a Time-Out Request ......................................................................................................................... 4-186
Remove a Whole Process Variable Area ....................................................................................................... 4-162
Reset a Message Pool ....................................................................................................................................... 4-98
SCIOPTA - Kernel
S
SC_CONNECTORREGISTER ................................................................................................................. 5-4, 5-8
sc_connectorRegister ......................................................................................................................................... 4-1
SC_CONNECTORUNREGISTER ........................................................................................................... 5-4, 5-8
sc_connectorUnregister .............................................................................................................................. 4-3, 4-4
SC_DEFAULT_POOL .................................................................................................................................... 4-88
SC_DISPATCHER .................................................................................................................................... 5-4, 5-8
SC_ENDLESS_TMO ............................................................................................................................ 4-45, 4-70
SC_ERR_MODULE_FATAL ......................................................................................................................... 5-10
SC_ERR_MODULE_WARNING .................................................................................................................. 5-10
SC_ERR_PROC_WARNING ......................................................................................................................... 5-10
SC_ERR_PROCESS_FATAL ......................................................................................................................... 5-10
SC_ERR_TARGET_FATAL .......................................................................................................................... 5-10
SC_ERR_TARGET_WARNING .................................................................................................................... 5-10
SC_FATAL_IF_TMO ..................................................................................................................................... 4-45
SC_INT_PROCESS ......................................................................................................................................... 2-13
SC_INT_PROCESS_EX ................................................................................................................................. 2-13
SC_IRQDISPATCHER ............................................................................................................................. 5-4, 5-8
SC_MISCCRC ........................................................................................................................................... 5-2, 5-5
sc_miscCrc ......................................................................................................................................................... 4-5
SC_MISCCRC32 ............................................................................................................................................... 5-5
sc_miscCrc32 ..................................................................................................................................................... 4-7
SC_MISCCRC32CONTD ................................................................................................................................. 5-5
sc_miscCrc32Contd ........................................................................................................................................... 4-8
SC_MISCCRCCONTD ............................................................................................................................. 5-2, 5-5
sc_miscCrcContd ............................................................................................................................................... 4-6
SC_MISCERRNOGET .............................................................................................................................. 5-2, 5-6
sc_miscErrnoGet ................................................................................................................................................ 4-9
SC_MISCERRNOSET .............................................................................................................................. 5-2, 5-6
sc_miscErrnoSet .............................................................................................................................................. 4-10
SC_MISCERROR .............................................................................................................................................. 5-6
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 7-5
7 Index
SCIOPTA - Kernel
SC_MODULEKILL .................................................................................................................................. 5-3, 5-7
sc_moduleKill ................................................................................................................................................... 4-35
SC_MODULENAMEGET ........................................................................................................................ 5-3, 5-7
sc_moduleNameGet .......................................................................................................................................... 4-37
SC_MODULEPRIOGET .......................................................................................................................... 5-3, 5-7
sc_modulePrioGet ............................................................................................................................................. 4-38
SC_MODULESTOP .................................................................................................................................. 5-4, 5-7
sc_moduleStop .................................................................................................................................................. 4-39
SC_MSGACQUIRE .................................................................................................................................. 5-2, 5-5
sc_msgAcquire ................................................................................................................................................. 4-40
SC_MSGADDRGET ................................................................................................................................. 5-2, 5-5
sc_msgAddrGet ................................................................................................................................................ 4-42
SC_MSGALLOC ...................................................................................................................................... 5-2, 5-5
sc_msgAlloc ..................................................................................................................................................... 4-44
sc_msgAllocClr ................................................................................................................................................ 4-47
SC_MSGDATACRCDIS ................................................................................................................................... 5-5
SC_MSGDATACRCGET .................................................................................................................................. 5-5
SC_MSGDATACRCSET .................................................................................................................................. 5-5
sc_msgFind ....................................................................................................................................................... 4-56
SC_MSGFLOWSIGNATUREUPDATE ........................................................................................................... 5-5
SC_MSGFREE .......................................................................................................................................... 5-2, 5-5
sc_msgFree ....................................................................................................................................................... 4-60
sc_msgHookRegister ........................................................................................................................................ 4-63
SC_MSGOWNERGET ............................................................................................................................. 5-2, 5-5
sc_msgOwnerGet .............................................................................................................................................. 4-65
SC_MSGPOOLIDGET ............................................................................................................................. 5-2, 5-5
sc_msgPoolIdGet .............................................................................................................................................. 4-67
SC_MSGRX .............................................................................................................................................. 5-2, 5-5
sc_msgRx .......................................................................................................................................................... 4-69
SC_MSGRX_ALL ................................................................................................................................ 4-57, 4-70
SC_MSGRX_BOTH ............................................................................................................................. 4-57, 4-70
SC_MSGRX_MSGID ........................................................................................................................... 4-57, 4-70
SC_MSGRX_NOT ................................................................................................................................ 4-57, 4-70
SC_MSGRX_PID .................................................................................................................................. 4-57, 4-70
SC_MSGSIZEGET .................................................................................................................................... 5-2, 5-5
sc_msgSizeGet .................................................................................................................................................. 4-72
SC_MSGSIZESET .................................................................................................................................... 5-2, 5-5
sc_msgSizeSet .................................................................................................................................................. 4-74
SCIOPTA - Kernel
7-6 Manual Version 5.0 Kernel Manual
7 Index
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 7-7
7 Index
SCIOPTA - Kernel
sc_procSchedLock .......................................................................................................................................... 4-146
SC_PROCSCHEDUNLOCK .................................................................................................................... 5-3, 5-6
sc_procSchedUnLock ..................................................................................................................................... 4-147
SC_PROCSLICEGET ............................................................................................................................... 5-2, 5-6
sc_procSliceGet .............................................................................................................................................. 4-148
SC_PROCSLICESET ................................................................................................................................ 5-2, 5-6
sc_procSliceSet ............................................................................................................................................... 4-149
SC_PROCSTART ..................................................................................................................................... 5-3, 5-6
sc_procStart .................................................................................................................................................... 4-151
SC_PROCSTOP ........................................................................................................................................ 5-3, 5-6
sc_procStop ..................................................................................................................................................... 4-153
sc_procUnobserve ........................................................................................................................................... 4-157
SC_PROCVARDEL .................................................................................................................................. 5-3, 5-6
sc_procVarDel ................................................................................................................................................ 4-158
SC_PROCVARGET .................................................................................................................................. 5-3, 5-6
sc_procVarGet ................................................................................................................................................ 4-159
SC_PROCVARINIT ........................................................................................................................................... 5-6
sc_procVarInit ................................................................................................................................................ 4-160
SC_PROCVARRM ................................................................................................................................... 5-3, 5-6
sc_procVarRm ................................................................................................................................................ 4-162
SC_PROCVARSET .................................................................................................................................. 5-3, 5-6
sc_procVarSet ................................................................................................................................................. 4-163
SC_PROCVECTORGET ................................................................................................................................... 5-6
sc_procVectorGet ........................................................................................................................................... 4-164
SC_PROCWAKEUPDISABLE ................................................................................................................ 5-2, 5-6
sc_procWakeupDisable .................................................................................................................................. 4-166
SC_PROCWAKEUPENABLE ................................................................................................................. 5-2, 5-6
sc_procWakeupEnable ................................................................................................................................... 4-165
SC_PROCYIELD ...................................................................................................................................... 5-3, 5-6
sc_procYield ...................................................................................................................................... 4-167, 4-168
SC_SET_MSGRX_HOOK ............................................................................................................................... 4-63
SC_SET_MSGTX_HOOK ............................................................................................................................... 4-63
SC_SET_POOLCREATE_HOOK ................................................................................................................... 4-89
SC_SET_POOLKILL_HOOK ......................................................................................................................... 4-89
SC_SET_PROCCREATE_HOOK ................................................................................................................. 4-119
SC_SET_PROCKILL_HOOK ....................................................................................................................... 4-119
SC_SET_PROCSWAP_HOOK ..................................................................................................................... 4-119
SC_SLEEP .......................................................................................................................................................... 5-8
SCIOPTA - Kernel
7-8 Manual Version 5.0 Kernel Manual
7 Index
SCIOPTA - Kernel
Kernel Manual Manual Version 5.0 7-9
7 Index
T
Time-out Expired ............................................................................................................................................ 4-186
Timing Calls ....................................................................................................................................................... 3-7
Transmitt a Message .............................................................................................................................. 4-78, 4-83
Trigger ............................................................................................................................................................ 4-188
U
Unknown Process ............................................................................................................................................. 2-35
Unlock the Scheduler ...................................................................................................................................... 4-147
Unregister a Process Daemon ......................................................................................................................... 4-115
W
Wait on the Process Trigger ........................................................................................................................... 4-192
SCIOPTA - Kernel
Wanted Array in Receive Call .......................................................................................................................... 4-69
Y
Yield the CPU .................................................................... 4-167, 4-168, 4-169, 4-170, 4-172, 4-174, 4-175
SCIOPTA - Kernel
7-10 Manual Version 5.0 Kernel Manual