RtosVM-UserManual
RtosVM-UserManual
SOFTWARE
User Manual
Edition: 2021-02-15
1 of 208
Content
1 ACONTIS RTOS VIRTUAL MACHINE OVERVIEW.......................................................................... 5
1.1 SHARED MODE OPERATION ....................................................................................................................... 5
1.2 EXCLUSIVE MODE OPERATION .................................................................................................................. 6
2 VIRTUAL MACHINE FRAMEWORK ................................................................................................... 7
2.1.1 VMF Architecture ............................................................................................................................ 8
2.1.2 Basic VMF Services (Hardware Abstraction Layer) ....................................................................... 9
2.2 PORTABILITY ........................................................................................................................................... 10
2.3 VMF MANAGEMENT ANCHOR.................................................................................................................. 10
2.4 MEMORY LAYOUT ................................................................................................................................... 11
2.5 THE RTOS LIBRARY ............................................................................................................................... 12
3 REAL-TIME DEVICE MANAGEMENT............................................................................................... 13
3.1 OVERVIEW............................................................................................................................................... 13
3.2 ASSIGN A DEVICE TO A RTOS ................................................................................................................. 14
3.2.1 Using System Manager.................................................................................................................. 14
3.2.2 Using RtosUpload.exe or RtosLib API .......................................................................................... 15
3.3 INTERRUPT SHARING CONFLICTS ............................................................................................................. 16
3.3.1 Principle ........................................................................................................................................ 16
3.3.2 Understanding interrupt conflicts ................................................................................................. 16
3.3.3 Resolving interrupt conflicts ......................................................................................................... 18
3.4 CONFIGURATION ..................................................................................................................................... 19
3.4.1 Properties dialog ........................................................................................................................... 19
3.4.2 RtosUpload.exe / RtosLib API ....................................................................................................... 21
3.4.3 Windows INF file........................................................................................................................... 21
3.4.4 RTOS config file ............................................................................................................................ 27
3.5 DRIVER SIGNING ..................................................................................................................................... 28
3.5.1 Driver Package Signing ................................................................................................................ 28
3.5.2 Certificate Pre-Installation ........................................................................................................... 30
4 RTOS OPERATION MODE .................................................................................................................... 32
4.1 SHARED MODE OPERATION (SINGLE CORE) ............................................................................................. 33
4.2 SHARED MODE OPERATION (MULTI CORE)............................................................................................... 34
4.3 EXCLUSIVE MODE OPERATION ................................................................................................................ 35
4.4 SMP EXCLUSIVE MODE OPERATION ........................................................................................................ 36
4.5 SMP SHARED MODE OPERATION............................................................................................................. 37
5 RTOS VM CONFIGURATION FILES (*.CONFIG FILES) ............................................................... 38
5.1 PROCESSOR CONFIGURATION (RTOS) ..................................................................................................... 38
5.2 INTERRUPT PROCESSOR VECTOR RANGES ............................................................................................... 39
5.3 MEMORY CONFIGURATION ...................................................................................................................... 40
5.3.1 Advantages and disadvantages of different OS memory reservation methods .............................. 41
5.4 TIME/DATE AND TIMEZONE SYNCHRONIZATION ..................................................................................... 42
5.4.1 Windows ........................................................................................................................................ 43
5.4.2 RTOS ............................................................................................................................................. 43
5.4.3 Windows / RTOS ........................................................................................................................... 43
5.5 SECTION [VMF] ....................................................................................................................................... 44
5.6 SECTION [UPLOAD] ................................................................................................................................. 46
5.7 MULTI PURPOSE SHARED MEMORY ........................................................................................................ 48
5.8 OS COMMUNICATION .............................................................................................................................. 49
5.8.1 Settings .......................................................................................................................................... 49
5.8.2 Enable / Disable Comm Interrupt ................................................................................................. 50
5.8.3 System does not boot using configuring Comm interrupt .............................................................. 51
5.8.4 Comm configuration error ............................................................................................................ 51
5.8.5 Interrupt conflict ........................................................................................................................... 52
5.9 RESOURCE DESCRIPTOR TECHNOLOGY (RDT) ........................................................................................ 54
5.10 VIRTUALIZATION TECHNOLOGY (VT) ................................................................................................ 55
6 START/STOP THE RTOS: UPLOADER UTILITY ............................................................................. 56
6.1 INTRODUCTION ........................................................................................................................................ 56
6.2 UPLOADER OPERATION, COMMAND LINE OPTIONS ................................................................................... 57
7 RTOS TRAY-ICON APPLICATION (RTOSCONTROL.EXE) .......................................................... 59
8 THE RTOS SERVICE APPLICATION (RTOSSERVICE.EXE) ........................................................ 60
8.1 CLOCK CORRECTION ............................................................................................................................... 60
8.2 DATE AND TIME SYNCHRONIZATION ....................................................................................................... 60
8.3 RTOS FILE SERVER FOR RTOSFILE SUPPORT .......................................................................................... 60
15.02.2021 Page 2/208
8.4 RTOS GATEWAY..................................................................................................................................... 60
9 THE REALTIME OS VIRTUAL NETWORK ADAPTER (RTOSVNET.SYS) ................................ 62
9.1 CONFIGURATION ..................................................................................................................................... 62
9.1.1 Windows ........................................................................................................................................ 62
9.1.2 RTOS ............................................................................................................................................. 67
10 THE RTOS LIBRARY ............................................................................................................................. 68
10.1 RTOS LIBRARY – APPLICATION LAYER API ...................................................................................... 68
10.1.1 Windows applications ............................................................................................................... 68
10.1.2 RTOS applications .................................................................................................................... 68
10.1.3 RTOS Library – initialization and shutdown ............................................................................ 69
10.1.4 RTOS Library – events ............................................................................................................. 74
10.1.5 RTOS Library – interlocked data access .................................................................................. 79
10.1.6 RTOS Library – shared memory ............................................................................................... 83
10.1.7 RTOS Library – date and time synchronization (clock synchronization) ................................. 88
10.1.8 RTOS Library – OS scheduling ................................................................................................ 89
10.1.9 RTOS Library – notification events .......................................................................................... 90
10.1.10 RTOS Library – uploader API .................................................................................................. 94
10.1.11 RTOS Library – result value................................................................................................... 100
10.1.12 RTOS Library – licensing ....................................................................................................... 102
10.1.13 RTOS Library – file server ..................................................................................................... 103
10.1.14 RTOS Library – files ............................................................................................................... 104
10.1.15 RTOS Library – files advanced (6.1) ...................................................................................... 119
10.1.16 RTOS Library – generic object functions ............................................................................... 133
10.1.17 RTOS Library – message queue functions .............................................................................. 137
10.1.18 RTOS Library – pipe functions ............................................................................................... 140
10.1.19 RTOS Library – socket functions ............................................................................................ 143
10.1.20 RTOS Library – device functions............................................................................................ 151
10.1.21 RTOS Library – memory reservation functions ...................................................................... 155
10.1.22 RTOS Library – virtual I/O (VIO) functions........................................................................... 156
10.2 RTOS LIBRARY EXAMPLE APPLICATIONS ......................................................................................... 157
10.3 RTOS LIBRARY – COMPATIBILITY ISSUES FOR VXWIN AND CEWIN 3.5 .......................................... 158
10.3.1 Compatibility mode ................................................................................................................ 158
10.3.2 Initialization ........................................................................................................................... 158
10.3.3 Time/date and timezone synchronization................................................................................ 158
10.3.4 Function SetOutputStream ..................................................................................................... 158
11 LICENSING............................................................................................................................................. 159
11.1 EC-MASTER (MAC-ID) ................................................................................................................... 159
11.1.1 General ................................................................................................................................... 159
11.1.2 Required steps ........................................................................................................................ 159
11.2 CODEMETER ..................................................................................................................................... 160
11.2.1 USB or virtual Dongle ............................................................................................................ 160
11.2.2 USB dongle already containing a License .............................................................................. 160
11.2.3 USB dongle not yet containing a License ............................................................................... 160
11.2.4 Virtual Dongle ........................................................................................................................ 162
11.2.5 Update a license ..................................................................................................................... 164
11.2.6 Sharing a License ................................................................................................................... 167
11.2.7 Troubleshooting...................................................................................................................... 168
12 RTOSWIN OEM BRANDING ............................................................................................................... 169
12.1 GENERAL .......................................................................................................................................... 169
12.2 MODULE SPECIFIC BRANDING........................................................................................................... 169
12.2.1 RtosDrv.sys ............................................................................................................................. 169
12.2.2 RtosVnet.sys and RTOS_xxx.inf .............................................................................................. 169
12.2.3 RtosService.exe ....................................................................................................................... 169
12.2.4 RtosControl.exe ...................................................................................................................... 170
12.2.5 UploadRtos.exe (RTE <=4.x) or RtosUpload.exe (RTE >=5.x) ............................................ 170
12.2.6 RtosPnp.sys............................................................................................................................. 170
13 WINDOWS UPDATE CONSIDERATIONS ........................................................................................ 171
14 APPENDIX A – PLATFORMS AND PERFORMANCE .................................................................... 176
14.1 REAL TIME BEHAVIOR AND THE RTOS-VM ..................................................................................... 176
14.2 PLATFORM EVALUATION .................................................................................................................. 176
14.3 INTEL(R) RESOURCE DIRECTOR TECHNOLOGY (RDT) ..................................................................... 177
14.3.1 Cache Allocation Technology (CAT) ...................................................................................... 177
14.3.2 Memory Bandwidth Allocation (MBA) ................................................................................... 180
14.4 REDUCING DMA LATENCY PROBLEMS ............................................................................................. 181
Real-time
IR Q ISR
Re altime
Q
IR
Windows Real-time
Tasks
Note: When running the RTOS-VM in shared mode on multiprocessor/multicore systems this state
diagram is only applicable for one CPU core in the system (by default on the first core). All other CPU
cores will run Windows only.
The following diagram, illustrates the flow of control on a dual core system:
W Windows
in Re Real-time
ISRs, a
w s do m e lti ISRs
IR DPCs IR
Q Q
Windows Real-time
Processes Tasks
Core 1: Core 2:
Windows Real-time
Software
Operating states of the RTOS-VM in exclusive mode
Exception-handling or a higher priority interrupt becomes outstanding.
Interrupt Service Routine optionally starts a new task and then finishes.
Note: When running the RTOS-VM in exclusive mode Windows will never be interrupted. Application
and interrupt processing run concurrently and independently on both CPU cores. There is no need in
the real-time software to enter the idle state.
When using a product from the RTOSWin product family calling VMF functions is normally not
necessary. Calling framework functions is done in the RTOS adaptation for the RTOS Virtual Machine
(usually the Board Support Package).
Embedded Application
TCP/IP Stack
Board Support Package
RTOS-Library-
Interface
RTOS Processor Virtual Network Driver
Dependent Part for x86 Basic VMF API (HAL)
MP technology
OS switching
Shared Memory, Events
Sockets
Uploader DLL
RTOS
User Application Bootloader
Windows RTOS
RTOS
Image
Leave RTOS:
(Shared Core only)
Idle, Force Idle
When adapting a RTOS to run with the ACONTIS RTOS-VM there is no need to directly access PC
hardware like timers or interrupt controllers.
The VMF as well provides a generic method for booting the RTOS and for setting up the RTOS
memory context (virtual memory).
When running on multi-core systems the VMF also provides methods for executing a RTOS which
supports Symmetric Multiprocessing (SMP).
Summarized, using the VMF one gets the following advantages:
Fully virtualized hardware access (via Hardware Abstraction Layer functions). No need to
understand the complex PC hardware.
Either run the RTOS and Windows together on one single core or use dedicated cores
exclusively for each operating system.
The same RTOS image can be run either on a shared or a non-shared CPU core.
Sophisticated Multi Core Support
o Run the RTOS on one single or on multiple cores (SMP)
o A RTOS can run in SMP mode even on dual core CPUs
Pointer to Function n
Function 1
Function 2
Function 3
Summarized, using the VMF binary module leads to the following advantages:
No porting necessary, just include a C header file.
No change necessary in the system software when new VMF versions are released (just
exchange the binary module by the new one).
The same binary VMF module will be used together with different RTOSes; this ensures a
higher quality than if the VMF code would have been ported individually for any RTOS.
RTOS 2
(QNX)
[Rtos2]
RtosMemorySize
EntryPoint RtosEntryPointOffset
G_oVmfFmwkAnchor RteFmwkAnchorOffset
RtosMemoryStartAddress
RTOS 1
(Windows CE)
[Rtos1]
RtosMemorySize
EntryPoint RtosEntryPointOffset
G_oVmfFmwkAnchor RteFmwkAnchorOffset
RtosMemoryStartAddress
RTOS 0
(VxWorks)
[Rtos]
RtosMemorySize
EntryPoint RtosEntryPointOffset
G_oVmfFmwkAnchor RteFmwkAnchorOffset
RtosMemoryStartAddress
[Upload]
RteMemorySize
RteMemoryStartAddress
Uploader/RtosDrv
3.1 Overview
To achieve real-time behaviour the RTOS will have to directly access its hardware devices. In fact,
hardware devices are never emulated, neither in Windows nor in the RTOS. Every specific device,
e.g. a PCI network adapter card will, then either be used by Windows or by the RTOS exclusively.
In Windows all hardware devices which shall be used by the RTOS have to be managed by the
generic Windows RtosPnp driver shipped with the ACONTIS RTOS-VM. It will forward all required
information to RTOS.
In RTOS a device specific driver will be required.
Within the Windows Device Manager all RTOS devices will then appear in the “Realtime OS Devices”
tree:
For the RTOS the Virtual Machine Framework (VMF) provides several methods to detect whether a
device is assigned and usable or not:
- vmfIdGetByName( szDeviceName, VMF_ID_DEVICE, … ) : search by Name
- vmfDevicePciIsForRtos( nBus, nDevice, nFunction, …) : search by PCI address
- vmfDeviceIoIsForRtos( dwIoPort, … ) : search by IO-Port
Older methods:
- vmfDeviceIsForRtos( szDeviceName, … ) : search by Name
- vmfDeviceInterruptIdFromName(szDeviceName, … ) : search by Name
More information about these functions can be found in the VMF documentation.
Usually the RTOS adaptation (e.g. the Board Support Package) for the RTOS-VM uses these
functions internally. A RTOS user application normally doesn’t need to call these functions. More
information can be found in the corresponding documentation (e.g. in the VxWin, CeWin, QWin or
Rtos32Win/RtVmf documentation).
2) “MSI Enabled”
This option can be used for PCIe cards supporting Message Signalled Interrupts.
Advantage:
- No interrupt conflicts
Disadvantage:
- Enabling or disabling the interrupt requires PCI bus access.
3) “Interrupt Disabled”
This option can only be used in combination with a specialized driver supporting polling mode.
The acontis EC-Master Link Layers for example are such.
Any regular network driver instead will always require an interrupt to work.
Advantage:
- No interrupt conflicts and no PCI bus access
Disadvantage:
- Special driver required
Such a message can be prevented by providing a signed driver package, as described in chapter “3.5
Driver Signing”.
15.02.2021 Page 14/208
In case a reboot is required please reboot the system to continue.
After the device was assigned successfully it can be found below RTOS.
In case of starting the RTOS now brings up an interrupt conflict error please check chapter “3.3
Interrupt sharing conflicts” for possible solutions.
3.3.1 Principle
When a physical device shall be controlled by the RTOS it will be under direct control of the RTOS.
There is no virtualization of any physical device and no interference by the RTOS Virtual Machine.
Thus, the regular device driver provided by the RTOS can be used (e.g. a network driver, USB driver,
IEEE1394 driver, …).
Usually the device driver will:
a) read and/or write to device memory areas
b) read and/or write to device I/O areas
c) handle device interrupts
In case the device generates an interrupt, the driver’s interrupt handler is responsible to acknowledge
and handle the interrupt.
Important:
The same interrupt may never be used by both operating systems, Windows and the RTOS.
But even when two PCI devices use different physical interrupt lines, they may be hard-wired together
by the PC’s interrupt router. The interrupt router maps various physical interrupt lines to the inputs of
the Programmable Interrupt Controller.
Assume that Device A (installed under Windows) physically shares an interrupt with device B (installed
under the RTOS). If Device A generates an interrupt while the RTOS is running, how could interrupt-
handling software process the interrupt without impairing the ability of the real-time system to fulfil its
tasks within prescribed times?
One might be tempted to solve this problem in either of the following ways:
Disable the interrupt in the interrupt controller and re-enable it only when the RTOS returns to
its idle state and returns control to Windows. Using this approach, however, interrupts
generated from device B would also be blocked for some time, a circumstance that would not
be acceptable for real-time operations.
By implementing an appropriate RTOS interrupt handler, one could prevent Device A from
generating an interrupt until after the RTOS returned to Windows. Thereafter, the interrupt
intended for Windows could be handled. While this theoretically could solve the dilemma,
there could be no way to handle this in a general fashion. Requiring an intelligent real-time
interrupt handler to be written for each device that shares an interrupt with a Windows device
would very likely mean that the Windows device driver (depending on the device) would have
to be modified, too. For this reason, this approach does not provide an adequate solution for
handling shared interrupts either.
The foregoing scenarios can lead to but a single conclusion: In a dual system, such as the RTOSWin
solution, Interrupt-sharing between Windows and the RTOS must be prohibited.
And that implies that PCI cards that are controlled by the RTOS may not be plugged into a PCI slot
that uses the same hard-wired interrupt line (normally INTA) as does either an external or internal
Windows device.
Conclusion: Windows devices can share Windows interrupts and RTOS devices can share RTOS
interrupts, but never can interrupts be shared across the two operating systems.
Fortunately, most of the time, system designers can eliminate interrupt conflicts.
If it were possible to identify an otherwise unused interrupt pin route to real-time devices, the RTOS
could manage multiple interrupts along that route via interrupt sharing.
Custom boards that provide a means for specifying on which of the interrupt pins – INTA#, INTB#,
INTC#, or INTD# – the board’s interrupts should be asserted, very well suit the scheme of having
multiple-function or single-function PCI devices sharing an interrupt. Such boards allow great flexibility
in combining devices that require real-time servicing with those that do not.
If this fails, there are several ways how to resolve interrupt conflicts then.
a) Try to find another slot where to insert the PCI/PCIe card.
b) If capable then configure the device to use message signalled interrupt (MSI) instead (see
section 3.4.3.3)
c) Disable all unused devices in the BIOS
d) Disable the conflicting Windows device either by disabling it in the BIOS or by disabling it in
the Windows Device Manager.
In case your RTOS device driver does not use interrupts (i.e. if used polling) you may configure the
device using polling mode. This can be either done by the System Manager, RtosUpload.exe, RtosLib
RtosDevice() or by modifying the standard Windows INF file that is used to assign the device to the
RTOS. See section 3.4.3.3 for more information.
Sometimes a Windows device is assigned an interrupt but the device never generates an interrupt.
For example, in many cases the SMBus device doesn’t generate interrupts even if it is assigned one.
In that case you may also ignore interrupt conflicts. But it is also necessary to modify the standard
Windows INF file that is used to assign the device to the RTOS. See section 3.4.3.5 for more
information.
OS Id OsId
Device Id PciDevice
Function Id PciFunction
PIN PciPin
Type InterruptType
Polarity InterruptPolarity
When a device should be assigned to RTOS a Windows INF file is required to install the generic
RtosPnp driver for Windows so the device information can be forwarded to RTOS.
There are several RtosPnp INF files shipped with the product, but under some circumstances it is
required to create a new file:
- Support a new device and prevent the “Windows Security Warning” during driver installation
- An option should be changed to another default (for example always using polling mode) so
no re-configuration is required after assigning the device
After creating or modifying an INF file it must be signed to prevent the “Windows Security Warning”
during driver installation – see chapter “3.5 Driver Signing” for details.
Example adjustments (two devices with vendor id ABCD and device ids 1234 and 5678):
[DeviceList]
%DEVICEDISPLAYNAME% = DriverInstall, PCI\VEN_ABCD&DEV_1234 ; (r)
%DEVICEDISPLAYNAME% = DriverInstall, PCI\VEN_ABCD&DEV_5678 ; (r)
The reason why sometimes the driver is not loaded is an entry in the INF file that forces the Windows
Resource Manager to assign a unique interrupt to the device. If Windows cannot find a unique
interrupt then it may not load the driver.
To avoid this behavior the entry in the INF file has to be changed in a way that the Windows Resource
Manager is allowed to assign an interrupt that is already used by another device.
Template INF file (by default the entry is not existing which means device exclusive):
[DriverInstall_HwAddRegUsrDef]
;HKR,"ConfigInterrupt0", "InterruptRequestMode", %REG_DWORD%, 0x00
; (o) 00=exclusive, 01=shared
In case a device is configured to use MSI but it does not support MSI an error message will be shown
as soon as the driver wants to enable the interrupt.
A device can be configured for using MSIs either by modifying the inf file before the device driver
installation or by changing the device configuration using the Windows device manager after the
installation.
[DriverInstall_HwAddRegUsrDef]
;HKR,"ConfigInterrupt0", "InterruptType", %REG_DWORD%, 0xFFFFFFFE
Required adjustment:
[DriverInstall_HwAddRegUsrDef]
HKR,"ConfigInterrupt0", "InterruptType", %REG_DWORD%, 0x04
Select the RTOS device driver, open device properties, select the tab “Rte Device
Configuration”, select and click “Interrupt Configuration” and change “Type (Default)” from
“Autodetect” to “MSI”. At last click “OK” and reboot to update the settings.
Required adjustment:
[DriverInstall_HwAddRegUsrDef]
HKR,"ConfigInterrupt0", "InterruptDoesntInterrupt", %REG_DWORD%, 0x01
After adjusting the INF file a driver update with the new INF file has to be executed (see
section 16.2.1 Realtime OS Driver).
o InterruptTargetAddressType
FFFFFFFE=auto detect, normally you should not change this value
00=Processor bit mask,
01=Local Apic Id,
02=Logical Id (Flat),
03=Logical Id (Cluster)
Currently only the Local APIC is supported (value 01)!
o InterruptTargetAddress
Interrupt target address, meaning depends on InterruptTargetAddressType
(01 = local APIC ID, this value will be determined automatically)
o InterruptProcessorVector
Interrupt vector to be used.
FFFFFFFE=auto detect
00 .. FF: manually determined interrupt vector
The following restrictions for the interrupt vector exist:
a) If Windows is using one single CPU core and the RTOS is running in exclusive
15.02.2021 Page 26/208
mode, values from 0x00 up to 0xFF are allowed. Note: automatic configuration will
only use values between 0xE0 and 0xFF.
b) If Windows is using more than one CPU core, values have to be 0xF0 or higher.
c) If the RTOS is running in shared mode and Windows is using only one single CPU
core, values have to be 0xE0 or higher.
If the RTOS is started by the Windows Uploader it will first check for interrupt conflicts. If such conflicts
are detected an error message will be shown and the RTOS will not be started.
The error message identifies the conflicting devices.
Example:
Interrupt conflict between a PRO/100 card that shall be controlled by the RTOS and a USB host
controller that shall be controlled by Windows. The following error message will be displayed.
ERROR: Device Configuration - conflicting devices for interrupt (16)
- Intel(R) 6300ESB USB universal host controller - 25A9
(PCI\VEN_8086&DEV_25A9&SUBSYS_25A18086&REV_02\3&267A616A&0&E8)
- RTOS PRO/100 compatible PCI card
(PCI\VEN_8086&DEV_1229&SUBSYS_000C8086&REV_08\4&3ABFD0AC&0&00F0)
The USB host controller is identified by the following device string:
PCI\VEN_8086&DEV_25A9&SUBSYS_25A18086&REV_02\3&267A616A&0&E8
In case you know that this USB host controller will never generate interrupts you may insert the
following configuration setting into the RTOS configuration file:
[WindowsDevices]
"MaxInterruptShareDeviceIndex"=dword:01
"InterruptShareDevice0"="PCI\VEN_8086&DEV_25A9&SUBSYS_25A18086&REV_02\3&267A616A&0&E8"
The value of InterruptShareDevice0 must be identical to the device name shown in the Uploader error
message. Wildcards ‘*’ for multiple and ‘!’ for a single character are supported.
Digital signatures are used to prevent viruses from installing or manipulating drivers by ensuring their
integrity. To be able to install a driver without a signing warning or error the signatures must be
correct.
Since Windows Vista it is possible for a software publisher to sign a driver using a KernelMode
CodeSigning certificate, which can be bought from a Certificate Authority (CA).
The catalog file contains the filename and hash information about all other files which are part of the
driver package. To protect against any changes the file is signed.
After modifying an Inf-File it is required to rebuild and sign the catalog file.
The catalog filename is defined by the Inf-File entry “CatalogFile”.
Prerequisites:
- Windows Driver Kit fro the code signing tools
- A “Kernel Mode Code Signing” certificate issued for example from DigiCert,
GlobalSign, Thawte, VeriSign or any other authority listet in Microsoft “Cross-
Certificates for Kernel Mode Code Signing”
- A Microsoft Cross-Certificate corresponding to the “Kernel Mode Code
Signing” certificate.
A list can be found in the MSDN “Cross-Certificates for Kernel Mode Code
Signing”
http://msdn.microsoft.com/en-
us/library/windows/hardware/dn170454(v=vs.85).aspx
- The driver package to be signed
Signing:
1) Open a WDK Build Environment - for example Windows 7 “x86 Free Build Environment”.
2) Change into the directory containing all your driver package files.
3) Ensure the Inf-File contains all required modifications.
Tip: The Inf-File name and “CatalogFile” entry should be different from their original.
4) Delete any existing catalog file in the driver package directory.
5) Creating a new catalog file by calling:
C:\MyDriverPackage>inf2cat.exe /driver:"."
/os:2000,XP_X86,XP_X64,Server2003_X86,Server2003_X64,Vista_X86,Vista_X64,Server20
08_X86,Server2008_X64,7_X86,7_X64,Server2008R2_X64 /verbose
You may add or remove supported OS as required. A list of possible options will be shown
calling: “inf2cat.exe /?”
After signing the catalog file it should be shown as valid and contain a signature.
Please remember that this has to be done separately for 32 and 64 bit driver package.
This is done automatically after you once select “Always trust software from …”.
As an alternative you can pre-install the certificate in the store and so prevent the question.
1) Install the driver on a system and select “Always trust software from….”
2) Call “certmgr” from an administrator command line. The tool is part of Windows 7 or
alternatively the WDK. The certificate should be listed below “Trusted Publishers”:
The pre-installation can be done by right-click the file and select “install”. The correct store is
important:
Alternatively the certmgr.exe tool can be used to automatically install the certificate:
C:\MyCerts>certmgr.exe -add MyPublisherCert.cer -s -r localMachine trustedpublisher
Windows Vista / 7 / 8 / 10
The boot configuration has to be edited using “BCDEdit” from the command line.
- Open a command line (cmd) with administrator rights (right click, start as administrator)
- enter “bcdedit /set numproc n” to configure Windows to use ‘n’ processor(s).
The setting can be removed with “bcdedit /deletevalue numproc”
To be able to start RTOS on an exclusive core on Windows Vista or newer the Uploader
automatically sets the following entry: “bcdedit /set firstmegabytepolicy useall”
This will not be removed when the product gets uninstalled.
The entry can be removed manually by calling “bcdedit /deletevalue firstmegabytepolicy”
b) The cpu cores that shall be used by the RTOS are determined by the configuration parameter
ProcessorMask in section [Rtos]. Bit 0 represents the first cpu core, bit 1 the second etc..
Examples:
ProcessorMask = 1: RTOS will run on core 0 (first core)
ProcessorMask = 2: RTOS will run on core 1 (second core)
ProcessorMask = 3: RTOS will run on core 0 and 1 (first two cores)
ProcessorMask = C: RTOS will run on core 2 and 3
RTOS
RQ
R ea ltime I ISR
Q
IR
Windows RTOS
Tasks
Configuration
Boot configuration: no adjustment is necessary
ProcessorMask: 1
Q
IR
Windows
Q
e IR
ltim
Q
Priority of Execution
IR
R ea
RTOS
Tasks Windows
eIR Q
ltim
2 1
R ea
RTOS
ISRs
W Windows
in Re RTOS
ISRs, a
w s do m e lti ISRs
IR DPCs IR
Q Q
Windows RTOS
Processes Tasks
Core 1: Core 2:
Windows VxWorks
Configuration example 1 (dual core system, see picture)
Windows uses the first cpu core, the RTOS uses the second cpu core.
Boot configuration: set NUMPROC to 1
ProcessorMask: 2
W W
in Windows in Windows
IR dow I R do w
Q s ISRs, Q s ISRs,
DPCs DPCs
Windows Windows
Processes Processes
ea R Q
ea R Q
RTOS RTOS
lt i
lti
I
I
m
ISRs ISRs
e
RTOS RTOS
Tasks Tasks
Q
IR
Windows
Q
e IR
ltim
Priority of Execution
R ea
RTOS
RTOS
Tasks
Tasks
IR Q
Q
e IR
e
ltim
2 1 ltim
2 1
R ea
R ea
RTOS
RTOS
ISRs
ISRs
Another config file can be included (nested includes are possible) using:
#include “AnotherConfigFile.config”
A config file should end with a new line to prevent compatibility problems with some versions.
This manual only covers generic settings valid for all RTOSWin solutions.
The configuration file is divided into the following main sections:
[Upload] = Upload settings
[Vmf] = Virtual Machine Framework settings
[Windows] = Windows configuration settings
[Rtos] = RTOS 1 configuration settings for OsId 0
[Rtos1] = RTOS 2 configuration settings for OsId 1
[Rtos2] = RTOS 3 configuration settings for OsId 2
…
When document refers to [Rtos] this is also applicable for [Rtos1], [Rtos2], … .
Section [Rtos]
Entry Name Type Description
Each bit represents a CPU to be used by a RTOS.
0x1 means 1st CPU,
0x2 means 2nd CPU,
0x5 means 1st and 3rd CPU
ProcessorMask Dword
Limitations:
- Different Rtos can’t share CPU(s).
- An OS using multiple CPUs can’t share CPU(s) with
another OS also using multiple CPUs.
At the default configuration the RTOS interrupt processor vector range is always above the Windows
interrupt processor vector range – for compatibility even on exclusive core configuration.
Example 1 (QuadCore):
Windows Boot configuration: set NUMPROC to 1
Rtos Config file: [Rtos] “ProcessorMask”=dword:0F
Windows vector range: 0x20-0xDF
RTOS vector range: 0xE0-0xFF
Example 2 (QuadCore):
Windows Boot configuration: set NUMPROC to 2
Rtos Config file: [Rtos] “ProcessorMask”=dword:0C
Windows vector range: 0x20-0xEF
RTOS vector range: 0xE0-0xFF
At example 2 Windows uses the first two cores and RTOS the other two cores.
Because the vector ranges overlap it must be ensured that the RTOS can handle incoming broadcast
interrupts. This feature (Multi-SMP with Windows 7) is supported since version 5.0.00.31.
When Windows uses only one processor which is not shared with RTOS it might be possible to
allow RTOS to use all available vectors from lowest 0x20 to highest 0xFF.
This can be done at the [Rtos] section in the config file. Because of compatibility with old versions this
is not the default configuration.
Section [Rtos]
Entry Name Type Description
Optional; Set lowest vector allowed for range
determination
ProcessorVectorLowest Dword
Warning: Do not change this value without request. An
invalid value causes system instability.
Optional; Set highest vector allowed for range
determination
ProcessorVectorHighest Dword
Warning: Do not change this value without request. An
invalid value causes system instability.
Each RTOS has to be configured to use an individual, specific physical memory range.
The individual memory range of each RTOS must be defined in the RTOS specific section.
Section [Rtos] for first, section [Rtos1] for second RTOS and so on.
Entry Name Type Description
RTOS memory physical base address (in bytes).
MemoryStartAddress Dword omitted = use allocated memory
x = use this base address
MemorySize Dword RTOS memory size
Optional value usefull with MemoryType 4. Will return
MemorySizeMin Dword
error 0x00153B6D if allocated size is below.
Physical memory adress alignment (in bytes).
Only relevant when “MemoryStartAddress” = 0.
Alignment Dword 0 = no alignment used
Omitted equals 0
Highest physical address usable (in bytes).
AddressMax Dword Only relevant when “MemoryStartAddress” = 0.
Omitted equals 0xFFFFFFFF
0 = Autodetermination
1 = (reserved)
2 = RA; not usable on EFI systems
MemoryType Dword 3 = BCD; Maximum for x86=~512MB and x64=~3MB
4 = MEM; Allocated memory (contiguous)
Omitted equals 0
The following RTOS specific settings are deprecated and have been superseded by
VMF_OSIMAGE_INFO
(Exception: RTOS-32 still requires them for the debugger)
Entry Name Type Description
Offset where the RTOS image has to be copied by the
ImageOffset Dword
uploader
EntryPointOffset Dword Boot entrypoint offset of the RTOS
VMF management anchor offset. After loading the RTOS
VmfAnchorOffset Dword image the uploader will copy the VMF management
information data at this location.
VMF version offset. After loading the RTOS image the
VmfVersionOffset Dword
uploader will check the VMF version used by the RTOS.
The config file settings regarding the time/date and timezone synchronization are OS specific and
have to be made in an OS section like [Windows\TimeSync] or [Rtos\TimeSync].
Shortly said every OS has to know where to take its info from – from itself ( master) or another OS
( slave). When no configuration is found an OS takes its infos from itself.
[Rtos\TimeSync]
"TimeSyncMaster"="Rtos"
"TimezoneSyncMaster"="Rtos"
5.4.2 RTOS
By default the RTOS is being synchronized with the Windows clock.
The following entries have to be activated:
[Windows\TimeSync]
"TimeSyncMaster"="Windows"
"TimezoneSyncMaster"="Windows"
[Rtos\TimeSync]
"TimeSyncMaster"="Windows"
"TimezoneSyncMaster"="Windows"
[Rtos\TimeSync]
"TimeSyncMaster"="Rtos"
"TimezoneSyncMaster"="Rtos"
[Vmf]
Entry Name Type Description
This parameter defines the maximum physical address
allowed for VMF memory.
When omitted “FF,FF,FF,1F,00,00,00,00” ( =
0x000000001FFFFFFF = below 512MB) will be used.
The default value is “FF,FF,FF,FF,00,00,00,00” ( =
AddressMax hex 0x00000000FFFFFFFF = below 4GB).
Sometimes using SharedCore requires a value of
“FF,FF,FF,8F,00,00,00,00” ( = 0x000000008FFFFFFF =
below 2GB). Uploader will inform about this requirement.
Before changing the value please affirm this will be
supported by RTOS.
Maximum number of events supported.
100 (fixed) for versions < 6.1.00.06
EventCount dword 500 (default) for versions >= 6.1.00.06
Starting with 6.1.00.06 the number can be modified using
config entry “EventCount”.
This parameter can be used to override the determined
TimerHwInputFreq dword VMF hardware timer input frequency with a specific value
(unit Herz).
This parameter specifies the maximum delay in TSC ticks
for reading all required timer and counter values for a
single point in time during timer and TSC frequency
determination.
TimerMeasureDelayLimit dword Exceeding the default limit may indicate inaccuracy in the
determined frequencies.
=0 Use best value – recommended for running VmWare
>0 Limit in TSC ticks
If omitted “0x1388” (5000) is the default.
This parameter specifies the message level to be
displayed by a message box:
0 – only fatal errors
VerbosityLevel dword
1 – also other errors
2 – also warnings
If omitted “0” is the default.
This parameter contains flags for Hardware Virtualization
support:
Bit 0: Allow VT support for VT-x and VT-d.
Bit 1: Do not move host into a guest (Debug Flag)
Bit 2: Do not use VT-d (Debug Flag)
VtAllowed dword
[Vmf\MessageBox]
Entry Name Type Description
This parameter specifies the buffer size to be used for
vmfMessageBox API.
The minimum value is 522 = (
TextBufferLength dword
VMF_MESSAGEBOX_MAX_TEXT_SIZE +
VMF_MESSAGEBOX_MAX_TITLE_SIZE + 2 ).
When omitted the minimum will be used as default.
Attention:
When multiple large shared memories are configured it is possible the system has not enough
memory remaining to boot. Such a situation can be solved this way:
- Start the system in Safe Mode
- Change the SharedMemory configuration
- Start the RTOS to update with the new configuration
- Reboot the system
[SharedMemory\UserDefinedShmName]
Entry Name Type Description
This parameter specifies the name of the shared memory.
This name can be used to query the ID using
Name string
vmfIdGetByName() respectively RtosGetIdByName()
function.
Description string A string describing the shared memory.
Base address of shared memory.
0 = automatic allocation (recommended)
x = use this static address as base
omitted = equals 0
Limitations for static addresses:
Base dword
- The address must be within the range of
“RteMemoryStartAddress” and “RteMemoryStartAddress”
+ “RteMemorySize”
- The memory can not be accessed directly from
Windows.
Physical memory adress alignment (in bytes).
Alignment dword Only relevant when “Base” = 0.
0 = default = no alignment used
Highest physical address usable (in bytes).
AddressMax dword Only relevant when “Base” = 0.
0xFFFFFFFF = default
Size dword Size of shared memory (in bytes)
Path and Filename to load the shared memory content
File string
from a file or save it to.
0 = don’t initialize memory. The memory will nevertheless
be zeroed once after allocation, but not each time VMF
gets loaded.
1 = zero memory
2 = initialize memory with file
Initialize dword 3 = as (2) but initialize with '0' if file not found instead of
error
7 = as (3) but on load renames "File" to "File.loaded".
Existing file will be replaced. In combination with "Save"
this prevents re-use of old data e.g. after power-failure.
F = as (7) but rename also read only files
[SharedMemory\UserDefinedShmName\AccessModes]
Entry Name Type Description
Define an explicit access mode for OS X (0 … n)
“0” … “n” dword This overwrites the default access mode set by
“AccessDefault” for a specific OS.
5.8 OS Communication
5.8.1 Settings
The config file settings regarding the communication are OS specific and have to be made in an OS
section like [Windows\Comm] or [Rtos\Comm].
After changing the config file setting “CommInterruptMode” RTE should be stopped for at least 10
seconds before restarted with the new configuration setting. Without waiting between stop and start
the configuration change of “CommInterruptMode“ might not be completed.
1) Right-Click the “Realtime OS Driver”, which can be found under the “System devices”
in the Windows device Manager, and select “”Update Driver Software…”
To solve this problem either the “CommInterruptMode” can be set to 0 or the “Realtime OS Driver”
resources can be configured for an interrupt as described above.
1) Open the Device Manager and change the view to “Resources by type” to check for a
free interrupt number not conflicting with other device.
3) To select an individual IRQ double-click “IRQ” and then use spin-buttons to select
another interrupt or enter the value using the keyboard.
HINT: Using the keyboard allows setting values not possible using the buttons!
4) After a reboot the interrupt conflict should be solved.
Section [Vmf\RDT]
Entry Name Type Description
0 CacheAllocationTechnology (CAT) is not allowed
CatAllowed Dword 1 CAT can be used when available
omitted = 1 = CAT will be used when available
Configures the bitmask to be used for cache-level ‘%u1’ in
CAT-COS register index ‘%u2’ on CPU ‘%u3’.
CatMaskL%u1Cos%u2Cpu%u3 Dword
‘%u1’ has to be replaced with cache-level (typical 2 or 3).
‘%u2’ has to be replaced with COS config register index.
‘%u3’ has to be replaced with CPU index
0 CAT-CodeDataPrioritization (CDP) is not allowed
1 CAT-CDP can be used when available
omitted = 0 = CAT-CDP will not be used
CatCdpAllowed Dword
When active the COS registers are remapped from for
example 8x1 to 4x2 to individually configure data and
code.
CatMaskDataL%u1Cos%u2Cp Used with CDP only. Configures data priority. Equal to
Dword
u%u3 “CatMaskL%u1Cos%u2Cpu%u3”.
CatMaskCodeL%u1Cos%u2Cp Used with CDP only. Configures code priority. Equal to
Dword
u%u3 “CatMaskL%u1Cos%u2Cpu%u3”.
0 MBA is not allowed
MbaAllowed Dword 1 MBA can be used when available
omitted = 0 = MBA will not be used
Configures the value to be used in MBA-COS register
index ‘%u1’ on CPU ‘%u2’.
MbaThrottleCos%u1Cpu%u2 Dword
‘%u1’ has to be replaced with COS config register index.
‘%u2’ has to be replaced with CPU index
Section [Rtos\RTD]
Entry Name Type Description
Configures the COS-selector to be used by this OS on a
specific CPU.
CosIdxCpu%u Dword
‘%u’ has to be replaced with CPU index.
[Vmf]
Entry Name Type Description
This parameter contains flags for Hardware Virtualization
support:
Bit 0: Allow VT support for VT-x and VT-d.
Bit 1: Do not move host into a guest (Debug Flag)
Bit 2: Do not use VT-d (Debug Flag)
VtAllowed dword
[…\Vmf]
These settings are OS specific and made in an OS sub-section like [Rtos\Vmf].
Entry Name Type Description
Some devices (mainly USB) are configured by BIOS to
access BIOS owned memory. When a BIOS does not
proper declare this memory a “DMA Fault” will occur. In
such a case this setting might be a workaround by
granting RTOS devices access to all system reserved
MapReservedMemory Dword memory:
0: no access
1: read+write access
3: read only access
omitted = 0 = no access
This setting allows RTOS to access ACPI tables and
memory maped PCI config space. On default such access
would cause an Extended-Page-Table (EPT) fault. Our
latest config files already contain this entry when it is
MapSystemTables Dword required by RTOS.
0: access denied
1: access granted
omitted = 0 = no access
6.1 Introduction
After the RTOSWin solution has been installed, you can use the Uploader Utility program to
start the real-time system. By taking advantage of command-line parameters, you can cause it
to perform a variety of functions.
Caution: starting with RtE version 7.1.1 the RtosUpload.exe will be started with AsInvoke rights. For
most operations no admin rights are required. If the desired operation fails then the call must be rerun
with admin rights.
When the Uploader Utility is called to start the RTOS, it reads and processes its own command
line options. It also reads and processes configuration parameters from the system
configuration file. After the RTOS image has been loaded, it is given control.
Here is a summary of the services that the Uploader Utility together with other RTOSWin
components performs:
● Collects device configuration information (queries all RTOS devices),
● Loads configuration data (content of the *.config files) into memory,
● Performs system and device configuration consistency checks
(e.g. detects interrupt sharing conflicts),
● Reserves memory for the RTOS,
● Loads a RTOS image into memory,
● Defines physical memory areas for use by the RTOS,
● Initiates execution of the RTOS image,
● Terminates a running RTOS session and releases system resources.
/config "'f1' <options>" Load VMF using config file 'f1'. This will stop all running OS and
unload already loaded VMF.
'f1' use this file as config file
possible options are:
-vmf 'f2' use f2 as VMF binary (default is vmf.bin)
/shmsave "Name" "f1" Dump shared memory 'Name' into file 'f1'
When the Uploader is called using “/config” mode first all running OS will be stopped and a loaded
VMF will be unloaded. Then the following steps are performed:
RTOS device configuration data is collected and stored in memory.
15.02.2021 Page 57/208
RTOS Device consistency checks are performed (e.g. interrupt sharing conflicts).
RTOSWin configuration data (content of the *.config files) is loaded into memory.
The RTOSWin configuration is verified (e.g. detect overlapped memory areas).
The VMF binary image is loaded into memory.
If an OS image was specified (“f1” mode), it will now be loaded into memory and then booted.
Load VMF and start first OS (any running OS will be stopped and VMF unloaded first):
RtosUpload.exe /config “vxwin.config” “C:\Tornado\target\config\VxWin\vxWorks.bin”
Start or Restart OS 0 (VMF must already be loaded) without loading VMF again:
RtosUpload.exe /osid 0 “C:\MyOsImages\\vxWorks.bin”
VMF will be loaded first (any running OS will be stopped and VMF unloaded first), followed by two OS:
RtosUpload.exe /config vxwin.config
RtosUpload.exe /osid 0 “C:\MyOsImages\\vxWorks.bin”
RtosUpload.exe /osid 1 “C:\MyOsImages\vxWorks2.bin”
Using the “/x” mode in combination with “/osid” will stop the specified OS while “/x” without “/osid” will
stop all OS and unload VMF.
All OS will be stopped and VMF be unloaded:
RtosUpload.exe /x
Only OS 1 will be stopped. Other OS and VMF will not be affected:
RtosUpload.exe /x /osid 1
Before version 5.1.0.30 / 6.0.0.11 ClockCorretion could only be disabled by the following Windows
registry setting:
Starting with 5.1.0.30 / 6.0.0.11 ClockCorretion can also be disabled by a config file entry:
9.1 Configuration
It is OS dependent which features of the “Realtime OS Virtual Network Adapter” can be configured.
9.1.1 Windows
- Open the device manager, right -click “Realtime OS Virtual Network Adapter” and select
“Update Driver Software…”
- Browse the computer for the driver software
- Pick a device driver from your computer by selecting “Let me pick…” and “Have Disk”
- After finishing install you can open the “Realtime OS Virtual Network Adapter (IRQ)” properties
using either a double-click or a right-click and select “Properties”.
When you get a conflict with ACPI PC, like on the right picture, a reboot is required.
1) Open the Device Manager and change the view to “Resources by type” to check for a
free interrupt number not conflicting with other device.
2) Double-click the “Realtime OS Virtual Network Adapter (IRQ)”, which can be found
under the “Network adapters” in the Windows device Manager, and select the
“Resources” tab.
There you can disable “Use automatic settings” and select another setting from
“Setting based on:”
Each setting contains a differen interrupt number. If no configuration contains the
3) To select an individual IRQ double-click “IRQ” and then use spin-buttons to select
another interrupt or enter the value using the keyboard.
HINT: Using the keyboard allows setting values not possible using the buttons!
4) After a reboot the interrupt conflict should be solved.
10.1.3.1 RtosLibInit
Initialize the RTOS Library.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Each process must call this function at least once before using RtosLib.
An internal call counter is incremented each call. The initialization will be done when the value goes
from 0 to 1 and the de-initialization when it goes from 1 to 0.
There are some RtosLib functions not requiring RtosLibInit to be called:
- RtosSetOutputPrintf
- RtosResultGetModule
- RtosResultGetText
- RtosDevice
- RtosSetMemoryConfiguration
10.1.3.2 RtosLibDeinit
De-Initialize the RTOS Library.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A process must first close all RtosLib handles and call all Stop functions where it called Start before.
An internal call counter is decremented each call. The initialization will be done when the value goes
from 0 to 1 and the de-initialization when it goes from 1 to 0.
After De-Init was done no other RtosLib function except RtosLibInit should be called.
10.1.3.3 RtosCommStart
Start the inter OS communication subsystem (e.g. required for events).
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The following OS will do this automatically:
Windows: Handled by RtosDrv
VxWorks: Done by BSP
Windows CE: Done by RtosService
10.1.3.5 RtosCommWaitForSubsystems
Wait until all required subsystems are up and running. The application has to wait until all
communication subsystems are ready prior to calling the inter OS communication functions of the
RTOS Library (e.g. events, interlocked data access, …).
UINT32 RtosCommWaitForSubsystems (
UINT32 dwOsId,
UINT32 dwTimeout,
BOOL* pbSubsystemsInitialized)
Parameter
dwOsId
[in] Operating System ID.
dwTimeout
[in] Timeout in seconds.
pbSubsystemsInitialized
[out] TRUE if the subsystems are initialized, FALSE if not.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The application wants to communicate with at least one OS (usually Windows). The value given in
dwOsId has to be set to the appropriate value corresponding with this OS, it can be determined by
RtosGetIdByName(). If communication with more than one OS is requested then this function has to
be called for each of the corresponding operating systems.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If the caller’s operating system will show the message box it has to be assured that the process calling
RtosMsgBoxStart() is able to do this job (e.g. on the Windows side this function may not be called by a
Windows Service as services are not able to get a Window handle).
This function is called by default on
- Windows (by RtosControl)
10.1.3.7 RtosMsgBoxStop
Stop the inter RTOS message box communication mechanism.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is called by default on
- Windows (by RtosControl)
UINT32 RtosGetIdByNameA(
Const CHAR* szName,
UINT32 dwIdType,
UINT32* pdwId)
Parameter
szName
[in] Name of the desired element
dwIdType
[in] Element type to get an ID of. See comment for supported types (RTOS_ID_xxx).
pdwOsId
[out] requested ID.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
RTOS_ID_OS:
Every operating system which is part of the RTOS VM (at least Windows and one RTOS) is required
to have a unique name by which it can be identified. This name will be determined by setting the
appropriate entry “Name” in the OS config section in the RTOS VM configuration files. The RTOS VM
then assigns a unique OS ID to internally identify the OS.
RTOS_ID_DEVICE:
Each device has an OS unique name (devices with same name may be assigned to another OS). The
RTOS VM assigns a unique device ID to internally identify the device.
RTOS_ID_SHM:
Each shared memory requires an unique name. The RTOS VM assigns a unique shared memory ID
to internally identify the shared memory.
The macro RtosGetIdByName can be used to call RtosGetIdByNameW if UNICODE is defined and
RtosGetIdByNameA if not.
10.1.3.9 RtosGetIdByNameW
Get a VMF ID by a given name.
UINT32 RtosGetIdByNameW (
Const WCHAR* wszName,
UINT32 dwIdType,
UINT32* pdwId)
Parameter
szName
[in] Unicode name of the desired element
dwIdType
[in] Element type to get an ID of. See comment for supported types (RTOS_ID_xxx).
pdwOsId
[out] requested ID.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
See RtosGetIdByNameA().
The macro RtosGetIdByName can be used to call RtosGetIdByNameW if UNICODE is defined and
RtosGetIdByNameA if not.
[Vmf]
"EventCount"=dword:X
10.1.4.1 RtosCreateEventA
Create a named event.
UINT32 RtosCreateEventA (
BOOL bManualReset,
BOOL bInitialState,
const CHAR* szName,
RTOSLIB_HANDLE* phEvent)
Parameter
bManualReset
[in] Currently only auto-reset events are supported (bManualReset = FALSE).
bInitialState
[in] Currently the initial-state has always set to FALSE (non-signalled).
szName
[in] Event name
phEvent
[out] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If the event already exists a handle to the existing event object will be returned.
The handle returned by RtosCreateEvent may be used for all subsequent accesses to the new event
object.
Any thread in the operating system that expects notification of an event can use the event’s object-
handle in a call to RtosWaitForEvent. Correspondingly, any thread in the other operating system that
wishes to send notification may use RtosSetEvent to send the signal. The setting and waiting
functions work in either direction. When the state of the specified object is triggered, the
RtosWaitForEvent function returns, and the waiting thread will continue executing.
Even though the initial state of the event object is formally specified by the bInitialState parameter, the
only valid initial state is the non-signalled state.
All Shared Event objects are auto-reset objects. If the initial state of a event is not set to non-signalled,
an error will be returned. After the event has been signalled (RtosSetEvent), it remains signalled only
until the waiting thread is released. Thereupon, the system will reset the state to non-signalled. If no
threads are waiting, the event object remains signalled.
Use RtosCloseEvent to close the handle. The application is responsible for resource reclamation.
Shared events only work between the RTOS and Windows. Setting an event under Windows, can only
wake a thread in the RTOS and vice versa. It is impossible to use shared Events to wake up a thread
in the operating system under which the RtosSetEvent has been issued.
The macro RtosCreateEvent can be used to call RtosCreateEventW if UNICODE is defined and
RtosCreateEventA if not.
UINT32 RtosCreateEventW (
BOOL bManualReset,
BOOL bInitialState,
const WCHAR* wszName,
RTOSLIB_HANDLE* phEvent)
Parameter
bManualReset
[in] Currently only auto-reset events are supported (bManualReset = FALSE).
bInitialState
[in] Currently the initial-state has always set to FALSE (non-signalled).
szName
[in] Unicode event name
phEvent
[out] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
See RtosCreateEventA().
The macro RtosCreateEvent can be used to call RtosCreateEventW if UNICODE is defined and
RtosCreateEventA if not.
10.1.4.3 RtosOpenEventA
Open an already existing event object.
UINT32 RtosOpenEventA (
const CHAR* szName,
RTOSLIB_HANDLE* phEvent)
Parameter
szName
[in] Event name
phEvent
[out] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If the event already exists a handle to the existing event object will be returned.
The macro RtosOpenEvent can be used to call RtosOpenEventW if UNICODE is defined and
RtosOpenEventA if not.
UINT32 RtosOpenEventW (
const WCHAR* wszName,
RTOSLIB_HANDLE* phEvent)
Parameter
szName
[in] Unicode event name
phEvent
[out] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
See RtosOpenEventA().
The macro RtosOpenEvent can be used to call RtosOpenEventW if UNICODE is defined and
RtosOpenEventA if not.
10.1.4.5 RtosCloseEvent
Close access to a already existing event object.
UINT32 RtosCloseEvent (
RTOSLIB_HANDLE hEvent)
Parameter
hEvent
[in] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A call to this function closes a handle to the event object.
RtosCloseEvent invalidates the specified object handle, decrements the object's handle count. Once
the last handle to an object is closed, the object is removed from the operating system.
UINT32 RtosSetEvent (
RTOSLIB_HANDLE hEvent)
Parameter
hEvent
[in] Event handle
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The state of an auto-reset event object remains signalled until a single waiting thread is released, at
which time the system automatically sets the state to non-signalled. If no threads are waiting, the
event object's state remains signalled.
Note 1: Only auto-reset events are supported.
Note 2: If you call RtosSetEvent in the RTOS, you can only call RtosWaitForEvent in Windows. That
is, you cannot wait for the same event in the RTOS. If you do, the result is unpredictable.
Note 3: A call to RtosSetEvent will not immediately set the event int the counter-part OS due to
interactions between the two operating systems.
Note 4: Multiple calls to the RtosSetEvent function may be made, however, if the counterpart does not
consume one of them, a subsequent RtosSetEvent function call will replace the former unconsumed
event.
10.1.4.7 RtosWaitForEvent
Signal a new event.
UINT32 RtosWaitForEvent (
RTOSLIB_HANDLE hEvent,
DWORD dwTimeout)
Parameter
hEvent
[in] Event handle
dwTimeout
[in] Timeout in milliseconds. The function returns if the interval elapses, even if the
object's state is non-signalled. If dwTimeout is set to zero, the function tests the
object's state and returns immediately. If dwTimeout is set to RTOS_WAIT_INFINITE,
the function's time-out interval will never elapse.
Return
RTE_SUCCESS on success (event was signalled) and an error-code on failure
(RTE_ERROR_TIMEOUT on timeout).
Comment
RtosWaitForEvent checks the current state of the specified event object. If the object's state is non-
signalled, the calling thread will block.
Since only auto-reset event objects are used, the wait function that successfully receives the signal
resets the object's state to non-signalled before returning.
10.1.5.1 RtosInterlockedCompareExchange
The function performs an atomic comparison of the specified values and exchanges the values, based
on the outcome of the comparison. The function prevents more than one thread inside the callers OS
as well as multiple operating systems from simultaneously accessing the same variable.
UINT32 RtosInterlockedCompareExchange (
UINT32* volatile pdwDestination,
UINT32 dwExchange,
UINT32 dwComparand,
UINT32* pdwInitial)
Parameter
pdwDestination
[in] Pointer to the destination value.
dwExchange
[in] Exchange value.
dwComparand
[in] Value to compare to destination.
pdwInitial
[out] Destination value found at start of compare.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function performs an atomic comparison of the Destination value with the comparand value. If the
destination value is equal to the comparand value, the exchange value is stored in the address
specified by pnDestination. Otherwise, no operation is performed.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is
shared by multiple threads or operating systems. The threads of different processes or different
operating systems can use this mechanism if the variable is in shared memory.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will
behave unpredictably.
if( 0 == dwInitVal )
{
/* success: value exchanged */
bAccess = TRUE;
break;
}
Sleep(1);
10.1.5.2 RtosInterlockedExchangeAdd
The function performs an atomic addition. The function prevents more than one thread inside the
callers OS as well as multiple operating systems from simultaneously accessing the same variable.
UINT32 RtosInterlockedExchangeAdd (
INT32* volatile pnDestination,
INT32 nValue,
INT32* pnInitial)
Parameter
pnDestination
[in] Pointer to the destination value.
nValue
[in] The value to be added (might be negative).
pnInitial
[out] Destination value found before addition.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function performs an atomic addition.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is
shared by multiple threads or operating systems. The threads of different processes or different
operating systems can use this mechanism if the variable is in shared memory.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will
behave unpredictably.
UINT32 RtosInterlockedAnd (
UINT32* volatile pdwDestination,
UINT32 dwValue,
UINT32* pdwInitial)
Parameter
pdwDestination
[in] Pointer to the destination value.
dwValue
[in] The value used for the logical operation with the destination value.
pdwInitial
[out] Destination value found before logical operation.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function performs an atomic AND operation.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is
shared by multiple threads or operating systems. The threads of different processes or different
operating systems can use this mechanism if the variable is in shared memory.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will
behave unpredictably.
10.1.5.4 RtosInterlockedOr
The function performs an atomic OR operation. The function prevents more than one thread inside the
callers OS as well as multiple operating systems from simultaneously accessing the same variable.
UINT32 RtosInterlockedOr (
UINT32* volatile pdwDestination,
UINT32 dwValue,
UINT32* pdwInitial)
Parameter
pdwDestination
[in] Pointer to the destination value.
dwValue
[in] The value used for the logical operation with the destination value.
pdwInitial
[out] Destination value found before logical operation.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function performs an atomic OR operation.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is
shared by multiple threads or operating systems. The threads of different processes or different
operating systems can use this mechanism if the variable is in shared memory.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will
behave unpredictably.
UINT32 RtosInterlockedXor (
UINT32* volatile pdwDestination,
UINT32 dwValue,
UINT32* pdwInitial)
Parameter
pdwDestination
[in] Pointer to the destination value.
dwValue
[in] The value used for the logical operation with the destination value.
pdwInitial
[out] Destination value found before logical operation.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function performs an atomic XOR operation.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is
shared by multiple threads or operating systems. The threads of different processes or different
operating systems can use this mechanism if the variable is in shared memory.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will
behave unpredictably.
max GrantedSize if
RequestedSize
Accessable range !=
GrantedSize
RtosShmAddrGetAt()
RtosShmAddrGet()
● Use the RtosShmTotalSizeGet function to acquire the size of the shared memory range.
● After setting the input parameter dwRequestedSize to the value returned by
RtosShmTotalSizeGet, call the RtosShmAddrGet function.
● If the returned parameter pdwGrantedSize is not equal to dwRequestedSize, then
pdwGrantedSize represents the largest shared memory window you can access at that time.
● Through successive calls to RtosShmAddrGetAt, however, you can acquire the entire shared
memory.
Note 1: Once an RtosShmAddrGet or RtosShmAddrGetAt function has been used,
subsequent use of the same function will invalidate a previously returned address.
Note 2: Most RTOS and Windows applications address virtual memory space. While multiple
calls to these functions might return numerically identical virtual addresses, such addresses,
acquired at different times, will very likely point to different data areas.
UINT32 RtosShmAddrGet (
UINT32 dwRequestedSize,
UINT32* pdwGrantedSize,
VOID** ppvShmAddr)
Parameter
dwRequestedSize
[in] Requested size of shared memory to be accessed by the application.
pdwGrantedSize
[out] Actually granted size that is mapped into the caller’s memory context.
ppvShmAddr
[out] Base address of the mapped shared memory area.
UINT32 RtosShmAddrGet (
UINT32 dwShmId,
UINT32 dwRequestedSize,
UINT32* pdwGrantedSize,
VOID** ppvShmAddr)
Parameter
dwShmId
[in] Shared memory ID – can be requested by RtosGetIdByName(…)
dwRequestedSize
[in] Requested size of shared memory to be accessed by the application.
pdwGrantedSize
[out] Actually granted size that is mapped into the caller’s memory context.
ppvShmAddr
[out] Base address of the mapped shared memory area.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Any pointer previously initialized with a call to RtosShmAddrGet or RtosShmAddrGetAt must be
considered as invalid after a renewed call to those functions.
UINT32 RtosShmAddrGetAt (
UINT32 dwOffset,
UINT32 dwRequestedSize,
UINT32* pdwGrantedSize,
VOID** ppvShmAddr)
Parameter
dwOffset
[in] Offset from the shared memory base where to map the memory into the caller’s
memory context.
dwRequestedSize
[in] Requested size of shared memory to be accessed by the application.
pdwGrantedSize
[out] Actually granted size that is mapped into the caller’s memory context.
ppvShmAddr
[out] Base address of the mapped shared memory area.
UINT32 RtosShmAddrGetAt (
UINT32 dwShmId,
UINT32 dwOffset,
UINT32 dwRequestedSize,
UINT32* pdwGrantedSize,
VOID** ppvShmAddr)
Parameter
dwShmId
[in] Shared memory ID – can be requested by RtosGetIdByName(…)
dwOffset
[in] Offset from the shared memory base where to map the memory into the caller’s
memory context.
dwRequestedSize
[in] Requested size of shared memory to be accessed by the application.
pdwGrantedSize
[out] Actually granted size that is mapped into the caller’s memory context.
ppvShmAddr
[out] Base address of the mapped shared memory area.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Any pointer previously initialized with a call to RtosShmAddrGet or RtosShmAddrGetAt must be
considered as invalid after a renewed call to those functions.
UINT32 RtosShmTotalSizeGet(
UINT32* pdwSize)
Parameter
pdwSize
[out] Total shared memory size.
UINT32 RtosShmTotalSizeGet(
UINT32 dwShmId,
UINT32* pdwSize)
Parameter
dwShmId
[in] Shared memory ID – can be requested by RtosGetIdByName(…)
pdwSize
[out] Total shared memory size.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
–
UINT32 RtosShmSaveFileA (
UINT32 dwShmId,
const CHAR* szFilename)
Parameter
dwShmId
[in] Shared memory ID
szFilename
[out] File to write shared memory data to.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A shared memory ID can be queried using “RtosGetIdByName”.
The macro RtosShmSaveFile can be used to call RtosShmSaveFileW if UNICODE is defined and
RtosShmSaveFileA if not.
10.1.6.5 RtosShmSaveFileW
Save a shared memory to a file.
UINT32 RtosShmSaveFileA (
UINT32 dwShmId,
const WCHAR* wszFilename)
Parameter
dwShmId
[in] Shared memory ID
wszFilename
[out] File to write shared memory data to.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A shared memory ID can be queried using “RtosGetIdByName”.
The macro RtosShmSaveFile can be used to call RtosShmSaveFileW if UNICODE is defined and
RtosShmSaveFileA if not.
10.1.7.1 RtosTimeSyncStart
Start the date and time synchronization.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is called by default on
- Windows (by RtosService)
- Windows CE (by RtosService)
- VxWorks (by VxWin BSP)
On other OS the time and date synchronization is not running by default and the initial RTOS date and
time value will have to be set to a reasonable initial value by the RTOS Board Support Package.
In the default configuration Windows is the master. Configuration is described in chapter “5.4
Time/Date and Timezone synchronization”.
10.1.7.2 RtosTimeSyncStop
Stop the date and time synchronization.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
–
10.1.8.1 RtosIdle
Regardless of the priority of the currently executing RTOS thread that calls RtosIdle(), this function
forces the execution context to switch immediately to Windows. Should you have a task that
monopolizes the CPU time, you can use this function to make certain that Windows receives
additional CPU time. Upon the occurrence of the next real-time interrupt (e.g. from the real-time
system timer), control will be returned to the real-time system.
Parameter
–
Return
–
Comment
Before RTE version 5.0.00.02 / 4.5.00.20 / 4.1.01.13:
- If this function is called in exclusive mode it will return immediately.
Important:
RtosNotification : Only one single thread is allowed to wait for a specific event.
RtosNotificationEx : Multiple thread are allowed but the API is currently implemented for
Windows only.
10.1.9.1 RtosNotificationWait
Wait for specific notification event.
UINT32 RtosNotificationWait (
UINT32 dwNotificationId
UINT32 dwTimeout)
Parameter
dwNotificationId
[in] Notification identifier. The following notification identifiers may be generated:
RTOS_NOTIFICATION_ID_BSOD Windows BSOD
RTOS_NOTIFICATION_ID_SUSPEND Windows Suspend
RTOS_NOTIFICATION_ID_RESUME Windows Resume
RTOS_NOTIFICATION_ID_STOP Uploader requests RTOS Stop
dwTimeout
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure. If another thread called
RtosNotificationBreakWait with the corresponding id then RTE_ERROR_BREAK_WAIT will be
returned.
Comment
If this function is called the RTOS VM will notify the application about the corresponding event. The
normal event handling in the RTOS VM will be blocked until the application calls the appropriate
RtosNotificationDone() routine. For example if the application waits for the BSOD event then Windows
will not enter its normal BSOD handling until RtosNotificationDone(RTOS_NOTIFICATION_ID_BSOD)
is called.
UINT32 RtosNotificationDone (
UINT32 dwNotificationId)
Parameter
dwNotificationId
[in] Notification identifier. The following notification identifiers exist:
RTOS_NOTIFICATION_ID_BSOD Windows BSOD
RTOS_NOTIFICATION_ID_SUSPEND Windows Suspend
RTOS_NOTIFICATION_ID_RESUME Windows Resume
RTOS_NOTIFICATION_ID_STOP Uploader requests RTOS Stop
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Tell the RTOS VM that the corresponding event was processed by the application and the RTOS VM
can continue its normal event handling.
10.1.9.3 RtosNotificationBreakWait
Continue the thread which is waiting for the specified event.
UINT32 RtosNotificationBreakWait (
UINT32 dwNotificationId)
Parameter
dwNotificationId
[in] Notification identifier. The following notification identifiers exist:
RTOS_NOTIFICATION_ID_BSOD Windows BSOD
RTOS_NOTIFICATION_ID_SUSPEND Windows Suspend
RTOS_NOTIFICATION_ID_RESUME Windows Resume
RTOS_NOTIFICATION_ID_STOP Uploader requests RTOS Stop
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
In case a thread is waiting for the given notification id it will immediately return to the application. The
caller then will get a return value of RTE_ERROR_BREAK_WAIT.
DWORD dwRes;
UINT32 RtosNotificationExCreate (
UINT32 dwMaskWait,
RTOSLIB_HANDLE* phObject )
Parameter
dwMaskWait
[in] Mask of notifications to be notified. The following values exist (can be combined):
RTOSNOTIFICATION_MASK_VMFLOADED VMF was loaded
RTOSNOTIFICATION_MASK_VMFUNLOAD VMF will be unloaded
RTOSNOTIFICATION_MASK_VMFSUSPEND VMF will be suspended
RTOSNOTIFICATION_MASK_VMFRESUMED VMF was resumed
RTOSNOTIFICATION_MASK_OSSTARTED OS was started
RTOSNOTIFICATION_MASK_OSSTOP OS will be stopped
RTOSNOTIFICATION_MASK_OSSUSPEND OS will be suspended
RTOSNOTIFICATION_MASK_OSRESUMED OS was resumed
RTOSNOTIFICATION_MASK_OSBSOD Windows BSOD
phObject
[out] Pointer to receive a RTOSLIB_HANDLE object (notification-ex).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The returned handle can be used with the generic object functions.
From the moment the handle all notifications will be received and must be confirmed by calling
RtosNotificationExWait() again or closing the handle.
Ther Uploader for example will be blocked if an application registered for VMF load notification but did
not confirm the notification after it was notified.
UINT32 RtosNotificationExWait (
RTOSLIB_HANDLE hObject,
PRTOS_NOTIFICATION_INFO pInfo,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Notification handle
pInfo
[out] Pointer to a RTOS_NOTIFICATION_INFO structure. Its dwSize must be initialized to
sizeof(RTOS_NOTIFICATION_INFO)
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function will return on timeout or when a notification occurred.
After a notification occurred it must be confirmed by calling RtosNotificationExWait again or closing the
handle so the process can continue.
For any OS specific notification ( RTOSNOTIFICATION_MASK_OS… )
RTOS_NOTIFICATION_INFO.dwOsId contains the ID of the related OS.
Additionally should be pointet out that when VMF is being unloaded it is possible that
RTOSNOTIFICATION_MASK_VMFUNLOAD is received before
RTOSNOTIFICATION_MASK_OSSTOP!
10.1.9.1 RtosNotificationExBreakWait
This is a synonym for RtosObjectBreakWait. See RtosObjectBreakWait for details.
UINT32 RtosNotificationExBreakWait (
RTOSLIB_HANDLE hObject )
10.1.9.1 RtosNotificationExClose
This is a synonym for RtosObjectClose. See RtosObjectClose for details.
UINT32 RtosNotificationExClose (
RTOSLIB_HANDLE hObject )
10.1.10.1 SetOutputBuffer
The Uploader tool will internally generate null-terminated ANSI-string messages. If the user application
wants to get these messages it has to tell the Uploader where to store these messages.
If the message buffer is full no further messages will be stored (no wrap).
UINT32 SetOutputBuffer (
VOID* pvOutputBuffer,
UINT32 dwSize)
Parameter
pvOutputBuffer
[in] Pointer to the buffer where ANSI string messages shall be stored.
dwSize
[in] Size of the buffer.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function has been superseded by RtosSetOutputPrintf() to ensure synchronized output and solve
buffer limitation problems.
10.1.10.2 RtosSetOutputPrintfA
The Uploader tool will internally generate messages. If the user application wants to get these
messages it can register a printf - callback function.
UINT32 RtosSetOutputPrintfA(
RTOSLIB_PFN_PRINTF_A pfnPrintfA )
Parameter
pfnPrintfA
[in] Pointer to a ANSI printf callback function of type
INT32 (RTOSLIB_CALLCONV *RTOSLIB_PFN_PRINTF_A)(const CHAR *szFormat,
...);
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosSetOutputPrintf can be used to call RtosSetOutputPrintfW if UNICODE is defined and
RtosSetOutputPrintfA if not.
The function does not require RtosLibInit to be called.
UINT32 RtosSetOutputPrintfW(
RTOSLIB_PFN_PRINTF_W pfnPrintfW )
Parameter
pfnPrintfW
[in] Pointer to a UNICODE printf callback function of type
INT32 (RTOSLIB_CALLCONV *RTOSLIB_PFN_PRINTF_W)(const WCHAR
*wszFormat, ...);
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosSetOutputPrintf can be used to call RtosSetOutputPrintfW if UNICODE is defined and
RtosSetOutputPrintfA if not.
The function does not require RtosLibInit to be called.
10.1.10.2 RtosStartA
Upload and start the RTOS image.
UINT32 RtosStartA (
const CHAR* szImageName,
const CHAR* szConfigFile)
Parameter
szImageName
[in] Path and filename of the RTOS image file.
szConfigFile
[in] Path and filename of the RTOS configuration file. The RTOS started is described in
section [Rtos].
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosStart can be used to call RtosStartW if UNICODE is defined and RtosStartA if not.
RtosStartA internally calls RtosStartExA( szImageName, szConfigFile, 0 )
See RtosStartExA.
UINT32 RtosStartW (
const WCHAR* wszImageName,
const WCHAR* wszConfigFile)
Parameter
wszImageName
[in] Unicode path and filename of the RTOS image file.
wszConfigFile
[in] Unicode path and filename of the RTOS configuration file. The RTOS started is
described in section [Rtos].
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosStart can be used to call RtosStartW if UNICODE is defined and RtosStartA if not.
RtosStartW internally calls RtosStartExW( wszImageName, wszConfigFile, 0 )
See RtosStartExA.
UINT32 RtosStartExA (
const CHAR* szImageName,
const CHAR* szConfigFile,
UINT32 dwOsId)
Parameter
szImageName
[in] Path and filename of the RTOS image file.
szConfigFile
[in] Path and filename of the RTOS configuration file.
dwOsId
[in] OS ID of the RTOS to be started. Depending on the ID the RTOS started is described
in section:
0: [Rtos]
1: [Rtos1]
2: [Rtos2]
…
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The Uploader tool acts as the RTOS bootloader. It can handle different situations:
Start RTOS means this function will copy the RTOS image file into a memory area not used by
Windows and then call the boot entry point of the RTOS.
The macro RtosStartEx can be used to call RtosStartExW if UNICODE is defined and RtosStartExA if
not.
Remarks:
- Pay attention to the single and double quotation marks!
- On a 64bit system using Windows 8 or newer only a 64bit application can call this function!
15.02.2021 Page 97/208
10.1.10.5 RtosStartExW
Upload and start the RTOS image.
UINT32 RtosStartExW (
const WCHAR* wszImageName,
const WCHAR* wszConfigFile,
UINT32 dwOsId)
Parameter
wszImageName
[in] Unicode path and filename of the RTOS image file.
wszConfigFile
[in] Unicode path and filename of the RTOS configuration file.
dwOsId
[in] OS ID of the RTOS to be started. Depending on the ID the RTOS started is described
in section:
0: [Rtos]
1: [Rtos1]
2: [Rtos2]
…
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
See RtosStartExA()
The macro RtosStartEx can be used to call RtosStartExW if UNICODE is defined and RtosStartExA if
not.
10.1.10.6 RtosStop
Stop all RTOS operation and unload the VMF.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
All RTOS will be stopped and VMF will be unloaded.
UINT32 RtosStopEx (
UINT32 dwOsId)
Parameter
dwOsId
[in] OS ID of the RTOS to be stopped.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The RTOS will be stopped but VMF will not be unloaded.
10.1.10.8 RtosRunning
Determine if the RTOS is running.
Parameter
–
Return
TRUE if the RTOS is running, FALSE if not.
Comment
This function will return the state of RTOS with OsId 0 only.
10.1.10.9 RtosRunningEx
Determine if the RTOS is running.
UINT32 RtosRunningEx (
UINT32 dwOsId
BOOL *pbIsRunning)
Parameter
dwOsId
[in] OS ID of the RTOS to be queried.
pbIsRunning
[out] contains TRUE if the RTOS is running, FALSE if not.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
–
10.1.11.1 RtosResultGetTextA
Get a message text for a result value.
UINT32 RtosResultGetTextA (
UINT32 dwResult,
CHAR* szText,
UINT32* pdwSizeInBytes)
Parameter
dwRteResult
[in] Result value to query text for
szText
[out] String buffer to receive the result message text
pdwSizeInBytes
[in] Length of string buffer in bytes
[out] Number of bytes used for message text
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A text for a result value can be queried using “RtosResultGetText”.
The macro RtosResultGetText can be used to call RtosResultGetTextW if UNICODE is defined and
RtosResultGetTextA if not.
The function does not require RtosLibInit to be called.
10.1.11.2 RtosResultGetTextW
Get a message text for a result value.
UINT32 RtosResultGetTextW (
UINT32 dwResult,
WCHAR* wszText,
UINT32* pdwSizeInBytes)
Parameter
dwRteResult
[in] Result value to query text for
wszText
[out] String buffer to receive the result message text
pdwSizeInBytes
[in] Length of string buffer in bytes
[out] Number of bytes used for message text
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A text for a result value can be queried using “RtosResultGetText”.
The macro RtosResultGetText can be used to call RtosResultGetTextW if UNICODE is defined and
RtosResultGetTextA if not.
The function does not require RtosLibInit to be called.
UINT32 RtosResultGetModuleA (
UINT32 dwResult,
CHAR* szText,
UINT32* pdwSizeInBytes)
Parameter
dwRteResult
[in] Result value to query module name for
szText
[out] String buffer to receive the result module name
pdwSizeInBytes
[in] Length of string buffer in bytes
[out] Number of bytes used for module name
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A module name for a result value can be queried using “RtosResultGetModule”.
The macro RtosResultGetModule can be used to call RtosResultGetModuleW if UNICODE is defined
and RtosResultGetModuleA if not.
The function does not require RtosLibInit to be called.
10.1.11.4 RtosResultGetModuleW
Get a module name for a result value.
UINT32 RtosResultGetModuleW (
UINT32 dwResult,
WCHAR* wszText,
UINT32* pdwSizeInBytes)
Parameter
dwRteResult
[in] Result value to query text for
wszText
[out] String buffer to receive the result module name
pdwSizeInBytes
[in] Length of string buffer in bytes
[out] Number of bytes used for module name
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A module name for a result value can be queried using “RtosResultGetModule”.
The macro RtosResultGetModule can be used to call RtosResultGetModuleW if UNICODE is defined
and RtosResultGetModuleA if not.
The function does not require RtosLibInit to be called.
10.1.12.1 RtosLicense
Setting, getting and removing of a license will be handled through this routine.
UINT32 RtosLicense (
UINT32 dwAction
VOID* pvData
UINT32* pdwSizeInBytes)
Parameter
dwAction
[in] License action identifier. See comment for details.
pvData
[in] Supplied data (LicenseID) for a specific “set” action
[out] Requested data by specific “get” action
NULL if action = remove license
pdwSizeInBytes
[in] Size of supplied data for a specific “set” action
[out] Size of requested data for a specific “get” action
NULL if action = remove license
Return
RTE_SUCCESS on success and an error-code on failure. Calling this routine on the real-time part of
the RTOS Library, a RTE_ERROR_NOT_IMPL will be returned.
Comment
This function performs actions for setting, getting and removing of a license.
Notes:
1) If parameter 2 is NULL parameter 3 must also be NULL - otherwise an error will be returned!
2) If not enough memory is supplied for the “get” action only a part of the license ID might be
returned!
3) When using the “parse” action for “/get” the input buffer will also be used for the output. This
requires the buffer size to be the maximum of input and output.
4) The RtosLicense parse action can be addressed using the Uploader parameter “/lic”.
Examples:
- RtosUpload.exe /lic "/requestfile 'C:\MyFile.HwIdReq'"
- RtosUpload.exe /lic "/setfile 'C:\MyFile.HwIdLic'"
Please check chapter 10.1.14 “RTOS Library – files” for configuration and further details.
10.1.13.1 RtosFileServerStart
Start the file server for remote file handling.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is called by default on
- Windows (by RtosService)
RtosFileServer is currently only supported by Windows.
10.1.13.2 RtosFileServerStop
Stop the file server for remote file handling.
Parameter
–
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is called by default on
- Windows (by RtosService)
RtosFileServer is currently only supported by Windows.
HINT: On CE or RTOS-32 platforms using the new native file system drivers should fits on the most
cases and direct access to the RtosFile-API should not be needed.
In the other case the files are supplied via shared memory and acts mainly like memory-mapped files.
This so-called SHM-mode has some restrictions which are discussed below.
SHM File Mode: To access a file through a shared memory, the file name path must contain the prefix
//SHM/<FILENAME>.
The file name must correspond to the shared memory name (case-sensitive!)
Example:
SHM-Name: TestFileXyZ.txt
SHM-FileName: //SHM/TestFileXyZ.txt
A corresponding shared memory must be defined in the config file. The memory can be initialized with
zeros, without anything or with an existing file from the file system on Windows. For further details
about shared memories prepared for file handling please look at chapter 5.7 Multi Purpose Shared
Memory.
Example:
[SharedMemory\TestFileXyZ.txt]
"Name"="TestFileXyZ.txt"
"Description"="TestFile for SHM file access"
"Size"=dword:0
"File"="C:\Temp\TestFileForShmAccess.txt"
"Initialize"=dword:2
"Save"=dword:1
"AccessDefault"=dword:1
[SharedMemory\TestFileXyZ.txt\AccessModes]
Limitations: The SHM file depends on a shared memory; therefore it's not possible to increase the
size of a SHM file.
The initial size of the shared memory is the maximum possible file size!
Due to technical reasons it’s not possible to rename or remove a SHM file with the RtosFile API!
Remote File Mode: Accessing a file remote is realized by the file server module of RtosService. The
default operation directory of the file server is %RTE_ROOT%\RtFiles. If not yet available, it will be
created at startup. All file operations are restricted to this directory and its subdirs by default.
The config file settings regarding the file server are OS specific and have to be made in an OS section
like [Windows\FileServer] or [Rtos\FileServer]. Only a file server under Windows is supported at
moment!
Limitations: Currently 10 simultaneously open remote files are supported. This value could be
adjusted with corresponding entry MaxOpenFiles in config file. See above table.
Scan functionality is currently not available for remote files.
Caution: The file handles of RtosFile 6.0 API and RtosFile 6.1 API could not be mixed generally, if not
stated otherwise.
Generic functions like RtosFileClose, RtosFileRead, RtosFileWrite, etc can operate on various kinds of
handles.
For easier access to the RtosFile API, 3 different ways are supported. For some RTOS’s (CE- or
RTOS-32-based) we provide native file system driver, which will call the appropriate RtosFile functions
and second calling the RtosFile API directly or as (partly deprecated) third method through supplied
rtosstdio.h.
On CE- or RTOS-32-based products the default case is using the supplied native file system drivers,
which will hide the complete RtosFile-API and native fopen() or CreateFile() calls can be used.
The following rtosstdio.h example should be considered deprecated (on CE- and RTOS-32-based
projects) and should be only used for legacy reasons on these platforms.
Porting to native stdio.h on these platforms should be possible without much hassle.
The rtosstdio.h remaps default stdio calls like fopen() to the native RtosFile API. To use the remapping
functionality of rtosstdio.h the include file must be added into the source file as the last include.
Minimal example:
// other includes...
// #include ...
// last include:
#include <rtosstdio.h>
RtosLibInit();
...
RtosLibDeinit();
return 0;
}
For Debugging and/or Logging purposes the rtosstdio.h exposes the underlying returned error
code through a global error variable:
UINT32 RtosFileCreateA (
const CHAR* szName,
const CHAR* szOptions,
RTOSLIB_HANDLE* phFileCreate )
Parameter
szName
[in] Name of the file
szOptions
[in] File create options. See comment.
phFileCreate
[out] Pointer to receive a RTOSLIB_HANDLE object (file).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
“r” read: Open file for read operations. The file must exist.
“w” write: Create an empty file for write operations. If the file yet exists, its
contents will be discarded and the file is used like a fresh new file.
“a” append: Open the file for write operations at the end of file, expanding it.
Reposition operations (RtosFileSeek, RtosFileRewind, etc) are ignored. If the
file doesn’t exist, it will be created.
“r+” read/update: Open file for read/write operations. The file must exist.
“w+” write/update: Create an empty file for read/write operations. If the file yet
exists, its contents will be discarded and the file is used like a fresh new file.
“a+” append/update: Open the file for read/write operations with write
operations at the end of the file, expanding it. Reposition operations
(RtosFileSeek, RtosFileRewind, etc) affects only the following read
operations, but write operations move the position back to the end of file. If
the file doesn’t exist, it will be created.
“b” binary: File should be open as binary file.
“t” text: File should be open as text file.
The first character of the option string must be either “r”, “w” or “a”. The next and further character
could be one of the optional “b” or “t” or sign “+” with resulting compound modes: “rb”, “rt”, “wb”, “wt”,
“ab”, “at” and “r+b”, “r+t”, “w+b”, ”w+t”, “a+b”, “a+t” or “rb+”, “rt+”, “wb+”, ”wt+”, “ab+”, “at”.
With errors in format string the function will fail with RTE_ERROR_FILE_INVALID_CREATE_OPTS
(0x4461).
The macro RtosFileCreate can be used to call RtosFileCreateW if UNICODE is defined and
RtosFileCreateA if not.
10.1.14.2 RtosFileCreateW
See RtosFileCreateA
UINT32 RtosFileCreateW (
const WCHAR* wszName,
const WCHAR* wszOptions,
RTOSLIB_HANDLE* phFileCreate )
UINT32 RtosFileClose (
RTOSLIB_HANDLE hObject )
10.1.14.4 RtosFileRead
This is a synonym for RtosObjectRead. See RtosObjectRead for details.
UINT32 RtosFileRead(
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
10.1.14.5 RtosFileWrite
This is a synonym for RtosObjectWrite. See RtosObjectWrite for details.
UINT32 RtosFileWrite(
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
10.1.14.6 RtosFileReadStrA
This function read “string” data into an ANSI string.
UINT32 RtosFileReadStrA(
RTOSLIB_HANDLE hFileCreate,
CHAR *szStr,
UINT32 dwNum,
UINT32 *pdwNumOfCharRead )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
szStr
[out] String buffer to receive the data read
dwNum
[in] Length of string buffer in characters
pdwNumOfCharRead
[out] Number of characters read into the string buffer
Return
RTE_SUCCESS on success and an error-code on failure.
If the return value is RTE_SUCCESS but *pdwNumOfCharRead returned zero, then the stream should
be checked for eof. In that case the szStr remains unchainged.
Comment
If there is no data to be read the function will return and the *pdwNumOfCharRead will contain zero.
A newline character is considered as a valid character and is included into the returned string.
10.1.14.7 RtosFileReadStrW
See RtosFileReadStrA.
UINT32 RtosFileReadStrW(
RTOSLIB_HANDLE hFileCreate,
WCHAR *wszStr,
UINT32 dwNum,
UINT32 *pdwNumOfCharRead )
10.1.14.8 RtosFileFlush
This function performs a flush on the remote file.
UINT32 RtosFileFlush (
RTOSLIB_HANDLE hFile )
Parameter
hFile
[in] Object handle returned from RtosFileCreate() or RtosFileCreateEx()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is only supported on the remote file mode. It performs a flush on the real file at the file
server.
UINT32 RtosFileEof (
RTOSLIB_HANDLE hFileCreate,
INT32* pnEof )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
pnEof
[out] Pointer to receive the RTOSFILE_EOF indicator.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Check returned *pnEof value with define RTOSFILE_EOF to indicate, if EoF is reached.
10.1.14.10 RtosFileRewind
This function performs a rewind at the file. It sets the position indicator of the file to the beginning.
UINT32 RtosFileRewind (
RTOSLIB_HANDLE hFileCreate )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosFileSeek (
RTOSLIB_HANDLE hFileCreate,
INT64 qnOffset,
INT32 nOrigin )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
qnOffset
[in] Sets the position indicator relative to this offset from origin parameter.
nOrigin
[in] Defines the origin for the offset. Valid values see comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Origin ID Description
RTOSFILE_SEEK_SET Sets the position indicator to the beginning of
the file. If qnOffset has a positive value, the
position indicator will be set to this offset from
the beginning.
RTOSFILE_SEEK_CUR Uses the qnOffset parameter to move
position indicator from current position of the
offset value.
RTOSFILE_SEEK_END Sets the position indicator to the end of the
file. The end of file means after the last char.
In SHM file mode, this means, that the
position indicator is beyond the valid memory
range!
If qnOffset has a negative value, the position
indicator will be set to this offset from the end
of file towards to the beginning.
10.1.14.12 RtosFileGetPos
This function returns the current position in file.
UINT32 RtosFileGetPos (
RTOSLIB_HANDLE hFileCreate,
INT64* pqnPos )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
pqnPos
[out] Pointer to receive the current position indicator.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosFileSetPos (
RTOSLIB_HANDLE hFileCreate,
INT64 qnPos )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
qnPos
[in] Desired value of position indicator.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.14.14 RtosFileSize
This function returns the current size of file.
UINT32 RtosFileSize (
RTOSLIB_HANDLE hFile,
UINT64* pqwSize )
Parameter
hFile
[in] Object handle returned from RtosFileCreate() or RtosFileCreateEx()
pqwSize
[out] Pointer to receive the current file size.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosFileError (
RTOSLIB_HANDLE hFileCreate,
INT64* pqnError )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
pqnError
[out] Pointer to receive the current error indicator.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.14.16 RtosFileClearError
This function performs resets to both the error and the eof indicator of the file.
UINT32 RtosFileClearError (
RTOSLIB_HANDLE hFileCreate )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.14.17 RtosFileCreateTmpfile
Creates a temporary binary file with a filename guaranteed to be different from any other existing file.
UINT32 RtosFileCreateTmpfile (
RTOSLIB_HANDLE* phFileCreate )
Parameter
phFileCreate
[out] Pointer for receive a RTOSLIB_HANDLE object (file) of a temporary file.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
UINT32 RtosFileRemoveA (
const CHAR* szName )
Parameter
szName
[in] Name of the file to be removed
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileRemove can be used to call RtosFileRemoveW if UNICODE is defined and
RtosFileRemoveA if not.
This function is not supported on SHM file mode!
10.1.14.19 RtosFileRemoveW
See RtosFileRemoveA
UINT32 RtosFileRemoveW (
const WCHAR* wszName )
10.1.14.20 RtosFileRenameA
Rename a file with the specified name.
UINT32 RtosFileRenameA (
const CHAR* szOldName,
const CHAR* szNewName )
Parameter
szOldName
[in] Name of the file to be renamed
szNewName
[in] New name of the file
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileRename can be used to call RtosFileRenameW if UNICODE is defined and
RtosFileRenameA if not.
This function is not supported on SHM file mode!
10.1.14.21 RtosFileRenameW
See RtosFileRenameA
UINT32 RtosFileRenameW (
const WCHAR* wszOldName,
const WCHAR* wszNewName )
UINT32 RtosFileSetBuffer (
RTOSLIB_HANDLE hFileCreate,
const UINT8* pBuffer,
UINT64 qwBufferSize
INT32 nMode )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
pBuffer
[in] Pointer to buffer to be set.
qwBufferSize
[in] Size of the supplied buffer.
nOrigin
[in] Operation mode. Currently don’t care.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is currently not supported. It will remember the buffer, but no further action will be taken.
10.1.14.23 RtosFilePrintfA
Works sililar to the classic fprinf() function.
UINT32 RtosFilePrintfA (
RTOSLIB_HANDLE hFile,
CHAR* szFormat,
UINT64* pqwCharsWitten,
... )
Parameter
hFile
[in] Object handle returned from RtosFileCreate() or RtosFileCreateEx()
szFormat
[in] Format string. All Visual C fprintf() format sequences are supported.
pqwCharsWritten
[out] Pointer to receive how many chars was written.
...
[in] 0..n additional parameter for the format entries.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is comparable with the ANSI fprintf() function.
The macro RtosFilePrintf can be used to call RtosFilePrintfW if UNICODE is defined and
RtosFilePrintfA if not.
UINT32 RtosFilePrintfW (
RTOSLIB_HANDLE hFile,
WCHAR* wszFormat,
UINT64* pqwCharsWritten,
... )
10.1.14.25 RtosFileVPrintfA
This function is similar to RtosFilePrintfA . The main difference is the last parameter. This function
expects the parameters for the format string as a va_list. . For futher details see RtosFilePrintfA.
UINT32 RtosFileVPrintfA (
RTOSLIB_HANDLE hFile,
CHAR* szFormat,
UINT64* pqwCharsWritten,
va_list vaList )
10.1.14.26 RtosFileVPrintfW
See RtosFileVPrintfA.
UINT32 RtosFileVPrintfW (
RTOSLIB_HANDLE hFile,
WCHAR* wszFormat,
UINT64* pqwCharsWritten,
va_list vaList )
UINT32 RtosFileScanfA (
RTOSLIB_HANDLE hFileCreate,
CHAR* szFormat,
UINT64* pqwItemsRead,
... )
Parameter
hFileCreate
[in] Object handle returned from RtosFileCreate()
szFormat
[in] Format string. All Visual C fscanf() format sequences are supported.
pqwItemsRead
[out] Pointer to receive how many items could be read.
...
[in/out] 0..n additional parameter for the format entries.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
This function is comparable with the ANSI fscanf() function.
The macro RtosFileScanf can be used to call RtosFileScanfW if UNICODE is defined and
RtosFileScanfA if not.
Important: This function is currently not supported on remote files!
In SHM file mode are up to 20 items supported.
10.1.14.28 RtosFileScanfW
See RtosFileScanfA
UINT32 RtosFileScanfW (
RTOSLIB_HANDLE hFileCreate,
WCHAR* wszFormat,
UINT64* pqwItemsRead,
... )
10.1.14.29 RtosFileVScanfA
This function is similar to RtosFileScanfA . The main difference is the last parameter. This function
expects the parameters for the format string as a va_list. . For futher details see RtosFileScanfA.
UINT32 RtosFileVScanfA (
RTOSLIB_HANDLE hFileCreate,
CHAR* szFormat,
UINT64* pqwItemsRead,
va_list vaList )
UINT32 RtosFileVScanfW (
RTOSLIB_HANDLE hFileCreate,
WCHAR* wszFormat,
UINT64* pqwItemsRead,
va_list vaList )
10.1.14.31 RtosFileOptionSet
This is a synonym for RtosObjectOptionSet. See RtosObjectOptionSet for details.
UINT32 RtosFileOptionSet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
10.1.14.32 RtosFileOptionGet
This is a synonym for RtosObjectOptionGet. See RtosObjectOptionGet for details.
UINT32 RtosFileOptionGet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
The new file functions from RtE 6.1 on uses the Windows CreateFile()-API on the file server side.
Therefore the returned handles are generally not compatible with RtE 6.0 file handles (fopen()-based)
and could not be mixed, if not stated otherwise.
Generic functions like Close, Read, Write, etc applies to all kind of handles.
General rule: the name of the handle suggests, which handle are allowed.
See following table:
Parameter Name Allowed Handles
hObject All handle types allowed
hFile hFileCreate or hFileCreateEx handles allowed
hFileCreate Only hFileCreate handles allowed
hFileCreateEx Only hFileCreateEx handles allowed
hFind Only hFind handles allowed
Hint: As most of the following functions have equivalent Windows function calls on the file server side,
the main limitation of these native Windows calls applies also to these functions. Please see the
functional equivalent function descriptions at the MSDN.
10.1.15.1 RtosFileCreateExA
This is the main function to open an existing file or create a new file. SHM files are NOT supported.
UINT32 RtosFileCreateExA (
const CHAR* szFileName,
UINT32 dwDesiredAccess,
UINT32 dwShareMode,
PRTOS_SECURITY_ATTRIBUTES lpSecurityAttributes,
UINT32 dwCreationDisposition,
UINT32 dwFlagsAndAttributes,
RTOSLIB_HANDLE hTemplateFile,
RTOSLIB_HANDLE* phFileCreateEx )
Parameter
szFileName
[in] Name of the file
dwDesiredAccess
[in] Desired access mode. See comment.
dwShareMode
[in] Shared mode. See comment.
lpSecurityAttributes
[in] Currently only NULL is supported/accepted.
dwCreationDisposition
[in] Creation Disposition. See comment.
dwFlagsAndAttributes
[in] File create flags and attributes. See comment.
hTemplateFile
[in] Currently only NULL is supported/accepted.
phFileCreateEx
[out] Pointer to receive a RTOSLIB_HANDLE object (file).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
File attributes:
Value Meaning
RTOSFILE_ATTRIBUTE_READONLY The file is read only. Applications can read the
(0x00000001) file, but cannot write to or delete it.
RTOSFILE_ATTRIBUTE_HIDDEN The file is hidden. Do not include it in an
(0x00000002) ordinary directory listing.
RTOSFILE_ATTRIBUTE_SYSTEM The file is part of or used exclusively by an
(0x00000004) operating system.
RTOSFILE_ATTRIBUTE_DIRECTORY The handle that identifies a directory.
(0x00000010)
RTOSFILE_ATTRIBUTE_ARCHIVE The file should be archived. Applications use
(0x00000020) this attribute to mark files for backup or
removal.
RTOSFILE_ATTRIBUTE_DEVICE This value is reserved for system use.
(0x00000040)
RTOSFILE_ATTRIBUTE_NORMAL The file does not have other attributes set.
(0x00000080) This attribute is valid only if used alone.
RTOSFILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage.
(0x00000100)
RTOSFILE_ATTRIBUTE_SPARSE_FILE A file that is a sparse file.
(0x00000200)
RTOSFILE_ATTRIBUTE_REPARSE_POINT A file or directory that has an associated
(0x00000400) reparse point, or a file that is a symbolic link.
RTOSFILE_ATTRIBUTE_COMPRESSED A file or directory that is compressed.
(0x00000800)
RTOSFILE_ATTRIBUTE_OFFLINE The data of a file is not immediately available.
(0x00001000)
RTOSFILE_ATTRIBUTE_NOT_CONTENT_INDEXED The file or directory is not to be indexed by the
(0x00002000) content indexing service.
RTOSFILE_ATTRIBUTE_ENCRYPTED The file or directory is encrypted.
(0x00004000)
RTOSFILE_ATTRIBUTE_VIRTUAL This value is reserved for system use.
(0x00010000)
File flags:
Value Meaning
Write operations will not go through any
RTOSFILE_FLAG_WRITE_THROUGH
(0x80000000) intermediate cache; they will go directly to
disk.
RTOSFILE_FLAG_NO_BUFFERING The file or device is being opened with no
(0x20000000) system caching for data reads and writes.
Hint:
If the FILE_FLAG_NO_BUFFERING flag is active, then file access buffer addresses for read and write
operations should be physical sector-aligned, which means aligned on addresses in memory that are
integer multiples of the volume's physical sector size.
10.1.15.2 RtosFileCreateExW
See RtosFileCreateExA
UINT32 RtosFileCreateExA (
const WCHAR* wszFileName,
UINT32 dwDesiredAccess,
UINT32 dwShareMode,
PRTOS_SECURITY_ATTRIBUTES lpSecurityAttributes,
UINT32 dwCreationDisposition,
UINT32 dwFlagsAndAttributes,
RTOSLIB_HANDLE hTemplateFile,
RTOSLIB_HANDLE* phFileCreateEx )
10.1.15.3 RtosFileReadSeek
This is mainly the same as RtosObjectRead. It contains an additional offset parameter for the desired
seek position. See RtosObjectRead for further details.
UINT32 RtosFileRead(
RTOSLIB_HANDLE hFileCreateEx,
15.02.2021 Page 121/208
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs,
UINT64 qwOffset )
Additional Parameter
qwOffset
[in] Desired seek position from which the data should be read. The offset starts from file
begin.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.15.4 RtosFileWriteSeek
This is mainly the same as RtosObjectWrite. It contains an additional offset parameter for the desired
seek position. See RtosObjectWrite for further details.
UINT32 RtosFileWrite(
RTOSLIB_HANDLE hFileCreateEx,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs,
UINT64 qwOffset )
Additional Parameter
qwOffset
[in] Desired seek position from were the data should be write. The offset starts from file
begin.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.15.5 RtosFileSetEndOfFile
This function set the current file pointer to the end of file.
UINT32 RtosFileEof (
RTOSLIB_HANDLE hFileCreateEx )
Parameter
hFileCreateEx
[in] Object handle returned from RtosFileCreateEx()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosFileSetFilePointer (
RTOSLIB_HANDLE hFileCreateEx,
INT64* pqnDistanceToMove,
UINT32 dwMoveMethod )
Parameter
hFileCreateEx
[in] Object handle returned from RtosFileCreateEx()
pqnDistanceToMove
[in/out] Value that specifies the number of bytes to move the file pointer.
dwMoveMethod
[in] The starting point for the file pointer move. See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The following starting points are defined:
Value Meaning
The starting point is zero or the beginning of the
RTOSFILE_BEGIN (0)
file.
The starting point is the current value of the file
RTOSFILE_CURRENT (1)
pointer.
The starting point is the current end-of-file
RTOSFILE_END (2)
position.
10.1.15.7 RtosFileGetInformationByHandle
This function gets information about the file described by its handle.
UINT32 RtosFileGetInformationByHandle (
RTOSLIB_HANDLE hFileCreateEx,
PRTOSFILE_BY_HANDLE_INFORMATION pFileInfo)
Parameter
hFileCreateEx
[in] Object handle returned from RtosFileCreateEx()
pFileInfo
[out] Collected file information. See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
10.1.15.8 RtosFileGetTime
This function gets the file time.
UINT32 RtosFileGetTime (
RTOSLIB_HANDLE hFileCreateEx,
UINT64* pqwCreationTime,
UINT64* pqwLastAccessTime,
UINT64* pqwLastWriteTime)
Parameter
hFileCreateEx
[in] Object handle returned from RtosFileCreateEx()
pqwCreationTime
[out] Get the file creation time.
pqwLastAccessTime
[out] Get the file last access time.
pqwLastWriteTime
[out] Get the file last write time.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If a value is not desired, a NULL could be supplied.
10.1.15.9 RtosFileSetTime
This function sets the file time.
UINT32 RtosFileSetTime (
RTOSLIB_HANDLE hFileCreateEx,
UINT64* pqwCreationTime,
UINT64* pqwLastAccessTime,
UINT64* pqwLastWriteTime)
Parameter
hFileCreateEx
[in] Object handle returned from RtosFileCreateEx()
pqwCreationTime
15.02.2021 Page 124/208
[in] Set the file creation time, if not NULL.
pqwLastAccessTime
[in] Set the file last access time, if not NULL.
pqwLastWriteTime
[in] Set the file last write time, if not NULL.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.15.10 RtosFileGetTempNameA
Get temp file name based on the values of the parameter.
UINT32 RtosFileGetTempNameA (
const CHAR* szPathName,
const CHAR* szPrefixString,
UINT32* pdwUnique,
CHAR* szTempFileName )
Parameter
szPathName
[in] The directory path for the file name. Applications typically specify a period (.) for the
current directory. The string cannot be longer than RTOSFILE_MAX_PATH–14
characters and not NULL.
szPrefixString
[in] The function uses up to the first three characters of this string as the prefix of the file
name.
pdwUnique
[in/out] An unsigned integer to be used in creating the temporary file name.
szTempFileName
[out] Generated temporary file name.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileGetTempName can be used to call RtosFileGetTempNameW if UNICODE is
defined and RtosFileGetTempNameA if not.
If *pdwUnique is zero, the function attempts to form a unique file name using the current system time.
If the function succeeds, the returned value in *pdwUnique specifies the unique numeric value used in
the temporary file name. If the *pdwUnique parameter is nonzero, the return value specifies that same
number.
If the function fails, the returned value in *pdwUnique is zero.
10.1.15.11 RtosFileGetTempNameW
See RtosFileGetTempNameA.
UINT32 RtosFileGetTempNameW (
const WCHAR* wszPathName,
const WCHAR* wszPrefixString,
UINT32* pdwUnique,
WCHAR* wszTempFileName )
UINT32 RtosFileMoveA (
const CHAR* szExistingFilename,
const CHAR* szNewFilename)
Parameter
szExistingFilename
[in] Name of the file to be moved
szNewFilename
[in] New name and/or location of the file
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileMove can be used to call RtosFileMoveW if UNICODE is defined and
RtosFileMoveA if not.
This function is not supported on SHM file mode!
10.1.15.13 RtosFileMoveW
See RtosFileMoveA
UINT32 RtosFileMoveW (
const WCHAR* wszExistingFilename,
const WCHAR* wszNewFilename )
10.1.15.14 RtosFileGetAttributesA
Get the file attributes.
UINT32 RtosFileGetAttributesA (
const CHAR* szFileName,
UINT32* pdwFileAttributes)
Parameter
szFileName
[in] Name of the file which attributes are desired
pdwFileAttributes
[out] File attributes. See RtosFileCreateEx() comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileGetAttributes can be used to call RtosFileGetAttributesW if UNICODE is defined
and RtosFileGetAttributesA if not.
This function is not supported on SHM file mode!
10.1.15.15 RtosFileGetAttributesW
See RtosFileGetAttributesA
10.1.15.16 RtosFileSetAttributesA
Set the file attributes.
UINT32 RtosFileSetAttributesA (
const CHAR* szFileName,
UINT32 dwFileAttributes)
Parameter
szFileName
[in] Name of the file which attributes should be set.
dwFileAttributes
[in] New file attributes. See RtosFileCreateEx() comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileSetAttributes can be used to call RtosFileSetAttributesW if UNICODE is defined
and RtosFileSetAttributesA if not.
This function is not supported on SHM file mode!
10.1.15.17 RtosFileSetAttributesW
See RtosFileSetAttributesA
UINT32 RtosFileSetAttributesW (
const WCHAR* wszFileName,
UINT32 dwFileAttributes)
10.1.15.18 RtosFileGetDiskFreeSpaceA
Get the available free disk space.
UINT32 RtosFileGetDiskFreeSpaceA (
const CHAR* szRootPathName,
UINT32* pdwSectorsPerCluster,
UINT32* pdwBytesPerSector,
UINT32* pdwNumberOfFreeClusters,
UINT32* pdwTotalNumberOfClusters )
Parameter
szFileName
[in] The root directory of the disk for which information is to be returned.
pdwSectorsPerCluster
[out] A pointer to a variable that receives the number of sectors per cluster.
pdwBytesPerSector
[out] A pointer to a variable that receives the number of bytes per sector.
pdwNumberOfFreeClusters
[out] A pointer to a variable that receives the total number of free clusters on the disk.
pdwTotalNumberOfClusters
[out] A pointer to a variable that receives the total number of clusters on the disk.
Return
15.02.2021 Page 127/208
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileGetDiskFreeSpace can be used to call RtosFileGetDiskFreeSpaceW if UNICODE
is defined and RtosFileGetDiskFreeSpaceA if not.
This function is not supported on SHM file mode!
10.1.15.19 RtosFileGetDiskFreeSpaceW
See RtosFileGetDiskFreeSpaceA
UINT32 RtosFileGetDiskFreeSpaceW (
const WCHAR* wszRootPathName,
UINT32* pdwSectorsPerCluster,
UINT32* pdwBytesPerSector,
UINT32* pdwNumberOfFreeClusters,
UINT32* pdwTotalNumberOfClusters )
10.1.15.20 RtosFileFindFirstA
Find first file and get find file handle for subsequent find next calls.
UINT32 RtosFileFindFirstA (
const CHAR* szName,
PRTOSFILEFIND_DATA_A pFindData,
RTOSLIB_HANDLE* phFind )
Parameter
szName
[in] The directory or path, and the file name, which can include wildcard characters, for
example, an asterisk (*) or a question mark (?).
This parameter should not be NULL, an invalid string (for example, an empty string or
a string that is missing the terminating null character), or end in a trailing backslash (\).
pFindData
[out] A pointer to the RTOSFILEFIND_DATA structure that receives information about a
found file or directory. See comment.
phFind
[out] Handle for subsequent calls of RtosFileFindNext(). See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
If the function fails because no matching files can be found, the function returns
RTE_ERROR_FILE_NOT_FOUND.
Comment
The macro RtosFileFindFirst can be used to call RtosFileFindFirstW if UNICODE is defined and
RtosFileFindFirstA if not.
This function is not supported on SHM file mode!
10.1.15.21 RtosFileFindFirstW
See RtosFileFindFirstA
UINT32 RtosFileFindFirstW (
const WCHAR* wszName,
PRTOSFILEFIND_DATA_W pFindData,
RTOSLIB_HANDLE* phFind )
10.1.15.22 RtosFileFindNextA
Subsequent calls to get all files in specified directory.
UINT32 RtosFileFindNextA (
RTOSLIB_HANDLE hFind,
PRTOSFILEFIND_DATA_A pFindData)
Parameter
hFind
[in] Handle (returned by a previous RtosFileFindFirst call) for subsequent calls of
RtosFileFindNext(). See comment.
pFindData
[out] A pointer to the RTOSFILEFIND_DATA structure that receives information about a
found file or directory. See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
If the function fails because no more matching files can be found, the function returns
RTE_ERROR_FILE_NO_MORE_FILES.
Comment
The macro RtosFileFindNext can be used to call RtosFileFindNextW if UNICODE is defined and
RtosFileFindNextA if not.
This function is not supported on SHM file mode!
10.1.15.23 RtosFileFindNextW
See RtosFileFindNextA
15.02.2021 Page 129/208
UINT32 RtosFileFindNextW (
RTOSLIB_HANDLE hFind,
PRTOSFILEFIND_DATA_W pFindData)
10.1.15.24 RtosFileSetCurrentDirectoryA
Set the current directory.
UINT32 RtosFileSetCurrentDirectoryA (
const CHAR* szPathName)
Parameter
szPathName
[in] The path to the new current directory. This parameter may specify a relative path or a
full path. In either case, the full path of the specified directory is calculated and stored
as the current directory. See comment
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The string must not exceed RTOSFILE_MAX_PATH characters, including the terminating null
character. The final character before the null character must be a backslash ('\'). If you do not specify
the backslash, it will be added for you; therefore, specify RTOSFILE_MAX_PATH-2 characters for the
path unless you include the trailing backslash, in which case, specify RTOSFILE_MAX_PATH-1
characters for the path.
10.1.15.25 RtosFileSetCurrentDirectoryW
See RtosFileSetCurrentDirectoryA
UINT32 RtosFileSetCurrentDirectoryW (
const WCHAR* wszPathName)
10.1.15.26 RtosFileGetCurrentDirectoryA
Get the current directory.
UINT32 RtosFileGetCurrentDirectoryA (
UINT32* pdwBufferLength,
const CHAR* szPathName)
Parameter
pdwBufferLength
[in/out] Size of supplied buffer. The buffer length must include room for a terminating null
character.
szPathName
[out] A pointer to the string buffer that receives the current directory string. See comment
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
15.02.2021 Page 130/208
Setting parameter szPathName to NULL and supply *pdwBufferLength = 0, than the needed buffer
size will be determined and returned by pdwBufferLength, in characters, including the null-terminating
character.
10.1.15.27 RtosFileGetCurrentDirectoryW
See RtosFileGetCurrentDirectoryA
UINT32 RtosFileGetCurrentDirectoryW (
UINT32* pdwBufferLength,
const WCHAR* wszPathName)
10.1.15.28 RtosFileCreateDirectoryA
Create a new directory.
UINT32 RtosFileCreateDirectoryA (
const CHAR* szPathName,
const PRTOS_SECURITY_ATTRIBUTES pSecurityAttributes )
Parameter
szPathName
[in] The path of the directory to be created.
pSecurityAttributes
[in] Currently only NULL is supported.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileCreateDirectory can be used to call RtosFileCreateDirectoryW if UNICODE is
defined and RtosFileCreateDirectoryA if not.
This function is not supported on SHM file mode!
10.1.15.29 RtosFileCreateDirectoryW
See RtosFileCreateDirectoryA
UINT32 RtosFileCreateDirectoryW (
const WCHAR* wszPathName,
const PRTOS_SECURITY_ATTRIBUTES pSecurityAttributes )
10.1.15.30 RtosFileRemoveDirectoryA
Remove the specified directory.
UINT32 RtosFileRemoveDirectoryA (
Parameter
szPathName
[in] The path of the directory to be removed. This path must specify an empty directory.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The macro RtosFileRemoveDirectory can be used to call RtosFileRemoveDirectoryW if UNICODE is
defined and RtosFileRemoveDirectoryA if not.
This function is not supported on SHM file mode!
10.1.15.31 RtosFileRemoveDirectoryW
See RtosFileRemoveDirectoryA
UINT32 RtosFileRemoveDirectoryW (
const WCHAR* wszPathName)
10.1.16.1 RtosObjectRead
This is the generic function to read data into a buffer.
UINT32 RtosObjectRead(
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosMsgQueueCreate(), RtosPipeCreate(), RtosSocketCreate(), RtosFileCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesRead
[out] Number of bytes read into the buffer
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If there is no data to be read the function will return after timeout elapsed.
If data was read the function will return as soon as the read buffer is full or there is no more data to be
read.
UINT32 RtosObjectWrite(
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosMsgQueueCreate(), RtosPipeCreate(), RtosSocketCreate(), RtosFileCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesWritten
[out] Number of bytes written
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function will return after all data was written or the timeout elapsed.
If the timeout elapsed the number of bytes written will be returned in pdwBytesWritten.
10.1.16.2 RtosObjectWait
This is the generic function to wait for an event. The event is object specific. For details check the
comment.
UINT32 RtosObjectWait (
RTOSLIB_HANDLE hObject,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosCreateEvent(), RtosNotificationExCreate(), RtosMsgQueueCreate(),
RtosPipeCreate(),RtosSocketCreate(),RtosFileCreate()
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function will return when the object was signalled or after timeout elapsed.
The signal is object specific:
- Event : The event was set
- NotificationEx : A notification occurred - use RtosNotificationWait instead for details.
- MsgQueue : Reader: Read data available / Writer: Data can be send
- Pipe : Read data available
- Socket : Read data available
UINT32 RtosObjectBreakWait (
RTOSLIB_HANDLE hObject )
Parameter
hObject
[in] Object handle returned from
RtosCreateEvent(), RtosNotificationExCreate(), RtosMsgQueueCreate(),
RtosPipeCreate(),RtosSocketCreate(),RtosFileCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A thread could be waiting infinite for an event. If this thread should be shut down the
RtosObjectBreakWait function can be used to break the wait. In this case the wait function will return
the error RTE_ERROR_BREAK_WAIT.
10.1.16.4 RtosObjectClose
This is the generic function to close any RTOSLIB_HANDLE object.
UINT32 RtosObjectClose (
RTOSLIB_HANDLE hObject )
Parameter
hObject
[in] Object handle returned from
RtosCreateEvent(), RtosNotificationExCreate(), RtosMsgQueueCreate(),
RtosPipeCreate(),RtosSocketCreate(),RtosFileCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The handle becomes invalid and can’t be used any more – regardless of an returned error code like
timout.
UINT32 RtosObjectOptionSet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate(), RtosFileCreate()
dwOptionId
[in] Object specific ID
pBuffer
[in] Buffer containing the data to be set
dwBufferSize
[in] Length of buffer in bytes
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Possible options are object specific:
10.1.16.1 RtosObjectOptionGet
This is the generic function to query a handle option. The option is object specific. See
“RtosObjectOptionSet” for details.
UINT32 RtosObjectOptionGet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate(), RtosFileCreate()
dwOptionId
[in] Object specific ID
pBuffer
[out] Buffer for receiving the option data
dwBufferSize
[in] Length of buffer in bytes
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
See “RtosObjectOptionSet” for details.
10.1.17.1 RtosMsgQueueCreateA
This function creates a message queue
UINT32 RtosMsgQueueCreateA (
const CHAR* szName,
PRTOSMSGQUEUE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
Parameter
szName
[in] Name of the message queue
pOptions
[in] Message queue options. See comment.
phObject
[out] Pointer to receive a RTOSLIB_HANDLE object (message queue).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The message queue shared memory (named “RtosLibMsgQueue”) will be divided into n equal sized
parts. The shared memory size per queue can be configured via config file:
[MessageQueue\\RtosLibMsgQueue]
“MaxShmUsagePerQueue”=dword:100000
Note that not the entire data can be used by user data since there is also queue administrative data.
Hint:
Because the queue has a fixed maximum size the dwNumMessages member could be set to 0 to gain
the maximum number of packets.
UINT32 RtosMsgQueueCreateW (
const WCHAR* wszName,
PRTOSMSGQUEUE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
10.1.17.1 RtosMsgQueueInfoGet
This function queries information about message queue
UINT32 RtosMsgQueueInfoGet (
RTOSLIB_HANDLE hObject
PRTOSMSGQUEUE_INFO pInfo )
Parameter
hObject
[in] Object handle returned from
RtosMsgQueueCreate()
pInfo
[in] Information structure. See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
10.1.17.1 RtosMsgQueueRead
This is a synonym for RtosObjectRead. See RtosObjectRead for details.
UINT32 RtosMsgQueueRead (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
UINT32 RtosMsgQueueWrite (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
10.1.17.1 RtosMsgQueueWait
This is a synonym for RtosObjectWait. See RtosObjectWait for details.
UINT32 RtosMsgQueueWait (
RTOSLIB_HANDLE hObject,
UINT32 dwTimeoutMs )
10.1.17.1 RtosMsgQueueBreakWait
This is a synonym for RtosObjectBreakWait. See RtosObjectBreakWait for details.
UINT32 RtosMsgQueueBreakWait (
RTOSLIB_HANDLE hObject )
10.1.17.2 RtosMsgQueueClose
This is a synonym for RtosObjectClose. See RtosObjectClose for details.
UINT32 RtosMsgQueueClose (
RTOSLIB_HANDLE hObject )
10.1.18.1 RtosPipeCreateA
This function creates a message queue
UINT32 RtosPipeCreateA (
const CHAR* szName,
PRTOSPIPE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
Parameter
szName
[in] Name of the pipe
pOptions
[in] Pipe options. See comment.
phObject
[out] Pointer to receive a RTOSLIB_HANDLE object (pipe).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
A pipe contains two queues – one for reading and one for writing.
Only the queue(s) requested (read / write / read+write) will be created.
To establish a communication using a pipe one side must call RtosPipeCreate while the other side has
to call RtosPipeOpen. This is required to open the correct message queues.
The first caller – regardless of using RtosPipeCreate or RtosPipeOpen – will initialize the pipe with its
average data size. The second caller’s average data size parameter will be ignored.
The macro RtosPipeCreate can be used to call RtosPipeCreateW if UNICODE is defined and
RtosPipeCreateA if not.
10.1.18.2 RtosPipeCreateW
See RtosPipeCreateA
UINT32 RtosPipeCreateW(
const WCHAR* wszName,
PRTOSPIPE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
UINT32 RtosPipeOpenA (
const CHAR* szName,
PRTOSPIPE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
10.1.18.1 RtosPipeOpenW
This function opens a message queue. The counterpart has to use RtosPipeCreate. See
RtosPipeCreateA for details.
UINT32 RtosPipeOpenW (
const WCHAR* wszName,
PRTOSPIPE_OPTIONS pOptions,
RTOSLIB_HANDLE* phObject )
10.1.18.2 RtosPipeInfoGet
This function queries information about a pipe
UINT32 RtosPipeInfoGet (
RTOSLIB_HANDLE hObject
PRTOSPIPE_INFO pInfo )
Parameter
hObject
[in] Object handle returned from
RtosPipeCreate()
pInfo
[in] Pointer to information structure. See comment.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
UINT32 RtosPipeRead (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
10.1.18.4 RtosPipeWrite
This is a synonym for RtosObjectWrite. See RtosObjectWrite for details.
UINT32 RtosPipeWrite (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
10.1.18.5 RtosPipeWait
This is a synonym for RtosObjectWait. See RtosObjectWait for details.
UINT32 RtosPipeWait (
RTOSLIB_HANDLE hObject,
UINT32 dwTimeoutMs )
10.1.18.6 RtosPipeBreakWait
This is a synonym for RtosObjectBreakWait. See RtosObjectBreakWait for details.
UINT32 RtosPipeBreakWait (
RTOSLIB_HANDLE hObject )
10.1.18.7 RtosPipeClose
This is a synonym for RtosObjectClose. See RtosObjectClose for details.
UINT32 RtosPipeClose (
RTOSLIB_HANDLE hObject )
10.1.19.1 RtosSocketCreate
This function creates a socket
UINT32 RtosSocketCreate(
UINT32 dwFamily,
UINT32 dwType,
UINT32 dwProtocol,
RTOSLIB_HANDLE* phObject )
Parameter
dwFamily
[in] Socket family – must be RTOSSOCKET_FAMILY_RTE
dwType
[in] Socket type – currently only RTOSSOCKET_TYPE_STREAM is supported.
dwProtocol
[in] Protocol – can be RTOSSOCKET_PROTOCOL_TCP or
RTOSSOCKET_PROTOCOL_UDP
phObject
[out] Pointer to receive a RTOSLIB_HANDLE object (socket).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.19.1 RtosSocketBind
This function binds a socket
UINT32 RtosSocketBind(
RTOSLIB_HANDLE hObject,
UINT16 wPort )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
wPort
[in] Port number to bind the socket to.
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosSocketListen(
RTOSLIB_HANDLE hObject )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
10.1.19.1 RtosSocketAccept
This function (TCP) accepts a new connection
UINT32 RtosSocketAccept(
RTOSLIB_HANDLE hObject,
RTOSLIB_HANDLE* phObject,
PRTOSSOCKET_ADDR pAddrNew,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
phObject
[out] Pointer to receive a RTOSLIB_HANDLE object (socket).
pAddrNew
[out] Pointer to a RTOSSOCKET_ADDR structure containing the address of the new
socket. Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Before calling RtosSocketAccept pAddrNewbySize must be initialized with
sizeof(RTOSSOCKET_ADDR ).
10.1.19.1 RtosSocketConnect
This function (TCP) connects to a server
UINT32 RtosSocketConnect (
RTOSLIB_HANDLE hObject,
const PRTOSSOCKET_ADDR pAddr )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pAddr
[in] Pointer to a RTOSSOCKET_ADDR structure containing the address to connect to.
Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Before calling RtosSocketConnect pAddrbySize must be initialized with
sizeof(RTOSSOCKET_ADDR ).
See RtosSocketAccept for details of RTOSSOCKET_ADDR.
10.1.19.1 RtosSocketShutdown
This function does shutdown a connection.
UINT32 RtosSocketShutdown (
RTOSLIB_HANDLE hObject )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
-
UINT32 RtosSocketRecv (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesRead
[out] Number of bytes read into the buffer
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
If there is no data to be read the function will return after timeout elapsed.
If data was read the function will return as soon as the read buffer is full or there is no more data to be
read.
The timeout can be configured - see RtosObjectOptionSet for details.
10.1.19.1 RtosSocketSend
This is the (TCP) function to send data from a buffer.
UINT32 RtosSocketSend (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesWritten
[out] Number of bytes written
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function will return after all data was written or the timeout elapsed.
If the timeout elapsed the number of bytes written will be returned in pdwBytesWritten.
The timeout can be configured - see RtosObjectOptionSet for details.
UINT32 RtosSocketRecvFrom (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
PRTOSSOCKET_ADDR pAddr )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesRead
[out] Number of bytes read into the buffer
pAddr
[out] Pointer to a RTOSSOCKET_ADDR structure to return the source address.
Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Before calling RtosSocketRecvFrom pAddrbySize must be initialized with
sizeof(RTOSSOCKET_ADDR).
If there is no data to be read the function will return after timeout elapsed.
If data was read the function will return as soon as the read buffer is full or there is no more data to be
read.
The timeout can be configured - see RtosObjectOptionSet for details.
10.1.19.3 RtosSocketSendTo
This is the (UDP) function to send data from a buffer to a specific address.
UINT32 RtosSocketSendTo (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
const PRTOSSOCKET_ADDR pAddr )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesWritten
[out] Number of bytes written
pAddr
[in] Pointer to a RTOSSOCKET_ADDR structure containing the destination address.
Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
Comment
The function will return after all data was written or the timeout elapsed.
If the timeout elapsed the number of bytes written will be returned in pdwBytesWritten.
The timeout can be configured - see RtosObjectOptionSet for details.
10.1.19.4 RtosSocketReadFrom
This is the (UDP) function to receive data into a buffer and optionally get the source address.
UINT32 RtosSocketReadFrom (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
PRTOSSOCKET_ADDR pAddr,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesRead
[out] Number of bytes read into the buffer
pAddr
[out] Pointer to a RTOSSOCKET_ADDR structure to return the source address.
Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
Before calling RtosSocketReadFrom pAddrbySize must be initialized with
sizeof(RTOSSOCKET_ADDR).
If there is no data to be read the function will return after timeout elapsed.
If data was read the function will return as soon as the read buffer is full or there is no more data to be
read.
UINT32 RtosSocketWriteTo (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
const PRTOSSOCKET_ADDR pAddr,
UINT32 dwTimeoutMs )
Parameter
hObject
[in] Object handle returned from
RtosSocketCreate()
pBuffer
[out] Buffer to receive the data read
dwBufferSize
[in] Length of string buffer in bytes
pdwBytesWritten
[out] Number of bytes written
pAddr
[in] Pointer to a RTOSSOCKET_ADDR structure containing the destination address.
Its member ‘bySize’ must be initialized with sizeof(RTOSSOCKET_ADDR).
dwTimeoutMs
[in] Timeout in milliseconds
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function will return after all data was written or the timeout elapsed.
If the timeout elapsed the number of bytes written will be returned in pdwBytesWritten.
10.1.19.6 RtosSocketRead
(TCP) This is a synonym for RtosObjectRead. See RtosObjectRead for details.
UINT32 RtosSocketRead (
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
10.1.19.7 RtosSocketWrite
(TCP) This is a synonym for RtosObjectWrite. See RtosObjectWrite for details.
UINT32 RtosSocketWrite (
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
UINT32 RtosSocketWait (
RTOSLIB_HANDLE hObject,
UINT32 dwTimeoutMs )
10.1.19.9 RtosSocketBreakWait
This is a synonym for RtosObjectBreakWait. See RtosObjectBreakWait for details.
UINT32 RtosSocketBreakWait (
RTOSLIB_HANDLE hObject )
10.1.19.10 RtosSocketClose
This is a synonym for RtosObjectClose. See RtosObjectClose for details.
UINT32 RtosSocketClose (
RTOSLIB_HANDLE hObject )
10.1.19.11 RtosSocketOptionSet
This is a synonym for RtosObjectOptionSet. See RtosObjectOptionSet for details.
UINT32 RtosSocketOptionSet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
10.1.19.12 RtosSocketOptionGet
This is a synonym for RtosObjectOptionGet. See RtosObjectOptionGet for details.
UINT32 RtosSocketOptionGet (
RTOSLIB_HANDLE hObject,
UINT32 dwOptionId,
const UINT8 *pBuffer,
UINT32 dwBufferSize )
10.1.20.1 RtosDeviceA
This function allows device configuration.
UINT32 RtosDeviceA (
const CHAR* szParams )
Parameter
szParams
[in] Configuration parameters – see Comment for details
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function does not require RtosLibInit to be called. In fact it must be called without RtosLibInit when
installing RtosDrv.
Options:
-force Force operation
-noui Do not display user interface
-all Also include non-present devices (default is only present devices)
Commands:
rte_install -inf:<inf>
Install RtE device support. This will update and register the Class(Co)Installers.
-inf:<inf> Can specify a single inf file or an directory containing inf files
rte_uninstall [-deldp]
Remove RtE device support including all assigned devices (present and non-present),
registry entries, services, inf's, class(co)installer, ...
-deldp Deletes installed driver packages for all RtE devices
dp_add <inf>
Install driver package
-inf:<inf> Specifies an INF file.
dp_delete <inf>
Remove driver package
-inf:<inf> Specifies an Oem*.inf file.
ID Examples:
<pciid> $5:2:0 PCI device with address bus 5 device 2 function 0
<hwid> ISAPNP\PNP0501 Hardware ID
'*PNP0501 Hardware ID with apostrophe (' prefixes literal match -
matches exactly as typed, including the asterisk.)
<id> * All devices
ISAPNP\PNP0501 Hardware ID
*PNP* Hardware ID with wildcards (* matches anything)
@ISAPNP\*\* Instance ID with wildcards (@ prefixes instance ID)
'*PNP0501 Hardware ID with apostrophe (' prefixes literal match -
matches exactly as typed, including the asterisk.)
=SYSTEM All devices of class 'system'
$5:2:0 PCI device with address bus 5 device 2 function 0
<:n> <id> :2 '*PNP0501 2nd occurrence of Hardware ID with apostrophe
RtE Setup:
- During installation Setup will call
>>RtosUpload.exe /nosleep /nowait /device "-noui rte_install -
inf:\"$PATH_TO_RTE_RUNTIME$\Drivers\RTOS_Installer.inf\""<<
to prepare for RtE device assignment.
- During uninstall Setup will call
>>RtosUpload.exe /nosleep /nowait /device “-noui rte_uninstall -deldp"<<
to assign all RtE devices back to Windows, Remove registrations and optionally delete all
installed RtE driver packages, if “-deldp” was specified.
Finding Pro1000
- Find all present Pro1000 on a system using Hardware ID:
>>C:\>RtosUpload.exe /nosleep /nowait /device "-all find PCI\VEN_8086&DEV_10A7"<<
- Find all present Pro1000 on a system using Hardware ID and PCI addess B3-D0-F0:
>>C:\>RtosUpload.exe /nosleep /nowait /device "-all find $3:0:0"<<
10.1.20.1 RtosDeviceW
This function allows device configuration. See RtosDeviceA for details.
UINT32 RtosDeviceW (
const WCHAR* wszParams )
10.1.21.1 RtosSetMemoryConfigurationA
This function does install or remove memory reservation.
UINT32 RtosSetMemoryConfigurationA (
const CHAR* szParams
const CHAR* szConfigFileName )
Parameter
szParams
[in] Configuration parameter:
“-a” for install or update reservations (requires config file)
“-u” for uninstall reservations (will never ask for reboot)
“-ur” for uninstall reservations (will ask for reboot when required)
“-V” for validate reservations (requires config file)
szConfigFileName
[in] Config file – see comment for details
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function does not require RtosLibInit to be called.
10.1.21.2 RtosSetMemoryConfigurationW
This function does install or remove memory reservation. See RtosSetMemoryConfigurationA for
details.
UINT32 RtosSetMemoryConfigurationW (
const WCHAR* wszParams
const WCHAR* wszConfigFileName )
10.1.22.1 RtosVioCreate61
This function creates a handle to read or write to a VIO channel.
UINT32 RtosVioCreate61 (
UINT32 dwChannelIndex
BOOL bIsPrimary
RTOSLIB_HANDLE* phObject )
Parameter
dwChannelIndex
[in] Channel index (0, 1, …) – default OS channel equals the OS id.
bIsPrimary
[in] Virtual I/O data are transferred between the primary OS, which usually is Windows,
and the secondary OS (SOS), which usually is the RTOS.
phObject
[in] Pointer to receive a RTOSLIB_HANDLE object (VIO).
Return
RTE_SUCCESS on success and an error-code on failure.
Comment
The function does not require RtosLibInit to be called.
10.1.22.2 RtosVioClose
This is a synonym for RtosObjectClose. See RtosObjectClose for details.
UINT32 RtosVioClose (
RTOSLIB_HANDLE hObject )
10.1.22.3 RtosVioRead
This is a synonym for RtosObjectRead. See RtosObjectRead for details.
UINT32 RtosVioRead(
RTOSLIB_HANDLE hObject,
UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesRead,
UINT32 dwTimeoutMs )
10.1.22.4 RtosVioWrite
This is a synonym for RtosObjectWrite. See RtosObjectWrite for details.
UINT32 RtosVioWrite(
RTOSLIB_HANDLE hObject,
const UINT8 *pBuffer,
UINT32 dwBufferSize,
UINT32 *pdwBytesWritten,
UINT32 dwTimeoutMs )
The following examples are extracted from the ACONTIS CeWin product (Windows CE + Windows)
…\Examples\RtosLib\CeWin\WinCE
Windows CE example applications
…\Examples\RtosLib\CeWin\Windows
Windows example applications
The following examples are extracted from the ACONTIS VxWin product (VxWorks + Windows)
…\Examples\RtosLib\VxWin\VxWorks
VxWorks example applications
…\Examples\RtosLib\VxWin\Windows
Windows example applications
10.3.2 Initialization
Prior to using the RTOS Library it has to be initialized. See section 10.1.3 for more information.
Existing applications have to be adjusted appropriately.
11.1.1 General
This product requires a valid license to be run. If your project also requires a MAC-ID licensed EC-
Master it’s possible to use the MAC-ID based license of EC-Master to get this product licensed.
Finally one MAC-ID based licence is required to get both products (RTOS VM and EC-Master)
licensed.
Hint: It’s recommended that the call of ecatSetLicenseKey is done somewhere at start-up of the
application.
CodeMeter requires the “CodeMeter Runtime-Kit” to recognize the licenses. This Kit will be
automatically installed by our product setup.
It can alternatively be downloaded from “http://wibu.com/download_user.php”.
- Press „Next“
- Select „Create license request“ and press „Next“
- Select a path you want to save the request to and press „Commit“
Please send the created file to your support contact requesting a new license.
- Select a path you want to save the request to and press „Commit“
Please send the created file to your support contact requesting a new license.
- Open „CodeMeter Control Center“ and select the dongle you want to receive a license
update for.
- Select „License Update“
- Press „Next“
- Select „Create license request“ and press „Next“
- Select a path you want to save the request to and press „Commit“
Please send the created file to your support contact requesting a new license.
11.2.6.1 Single PC
The “CodeMeter Runtime-Kit” was installed by the product setup. You can just plug the dongle into the
PC and as soon as it is recognized the „CodeMeter Control Center” will change its icon from grey to
green.
On your host PC you must configure the “CodeMeter Control Center” to act as license server:
- Open “CodeMeter Control Center”
- Click “WebAdmin”
- Select “Configuration” – “Network”
- Enable “Run Network Server”
- Press “Apply”
11.2.7 Troubleshooting
If a license error occurs in spite of a valid license possibly the Dongle has an incorrect time.
In this case the time has to be updated:
- Open „CodeMeter Control Center“
- Select „WebAdmin“
- Select „Content“ and „CmStick“
- Press “Update” to update the time. A connection to the internet will be required.
12.1 General
By default the ACONTIS RTOS-VM runtime modules show up with ACONTIS product branding.
The RTOSWin solution provider or RTOSWin OEM customer may want to use his own brand labels
instead of the ACONTIS branding.
The ACONTIS RTOS-VM runtime modules provide mechanisms to customize manufacturer specific
product information. This can be achieved by some RTOS-VM specific functions and also by common
Microsoft Windows configuration possibilities.
12.2.1 RtosDrv.sys
The driver RtosDrv.sys hosts several product information like company name, registry base path,
product support internet address and product name. These informations are configured in the file
“RtosDrv.inf” which is used to install the driver. After the installation these values are part of the driver
registry values and provided by the RtosDrv to several RTOS-VM applications.
These values can either be modified in the “RtosDrv.inf” file or later in the registry.
Within RtosDrv.inf the product specific information can be found in the last block at the end of the file.
Additional information about the driver containing the company name (the second last block) might
also be adapted.
Changing a file will invalidate the given driver signature and Windows will warn about an unsigned
driver at installation time. This can be solved with a new signature. How to sign a driver and the
limitations is not part of this document. Please contact ACONTIS support in case a new signature shall
be generated.
12.2.3 RtosService.exe
Name and descriptions can be changed using the Windows Service Controller API to manually
register / un-register the service instead of calling “RtosService.exe INSTALL” and “RtosService.exe
UNINSTALL”. Additionally most Setup programs, like for example InstallShield, are providing
functionalities to register and un-register services using custom name and description.
The application embedded icon (displayed in the Explorer) can be replaced using a binary resource
editor tool.
12.2.6 RtosPnp.sys
The Windows Device Manager shows an ACONTIS specific icon for the Rtos device class, which can
be changed. This icon is part of the RtosPnpInstaller.dll which can be found in windows\system32
directory and the Rtos-Infs directory. There are several possibilities to change the icon:
1. Use an resource editor to edit the dll and change the icon
2. Use an resource editor to edit the dll and change add an additional icon + change the value of
“Icon” which can be found twice in each RTOS_xxx.inf.
A value of “0” represents the first icon of the dll, the value “1” is reserved.
3. Change the value of “Icon” which can be found twice in each RTOS_xxx.inf to a negative
value.
Negative values represent the system predefined icons. “-18” for example represents the
“Unknown” icon (18).
Changing a file will invalidate the given driver signature and Windows will warn about an unsigned
driver at installation time. This can be solved with a new signature. How to sign a driver and the
limitations is not part of this document.
To update a system where RtosPnpInstaller.dll is already installed with a new icon number you must
change the value of “Icon” in at least one of the RTOS_xxx.inf files, then right-click on the modified file
and choose “install”. After that the RTOS device class should use the new icon (perhaps a reboot
might additionally be required).
Nevertheless it is required to ensure the correct system configuration after updates are applied. Since
this is often done during a (re)boot the check should be after booting, but before starting RTOS.
We provide the following example script for such a task. There are some configurations which must be
adapted like for example
- Configuration path
- Image path
- Devices to be assigned
The “Device instance path”, as used by the script for RTOS device assignment and configuration, can
be found in Windows device manager device properties.
REM ---------------------------------------------------------------------------
REM Function:
REM To ensure a concrete system- / device- / memory- configuration
REM
REM Requirements:
REM This function must be called with administrator priviledges to work properly.
REM
REM Recommendations:
REM - Use a Windows LTS version to prevent unexpected behaviour caused by feature updates.
REM - Config file entry:
REM [Upload]
REM "BootCodeReservationForce"=dword:1 ; prevent additional reboot
REM
REM History:
REM 20201120,GTt New: Created
REM
REM ---------------------------------------------------------------------------
REM ---------------------------------------------------------------------------
REM Environment checks
REM ---------------------------------------------------------------------------
REM Check for admin rights: "net.exe session" will fail without them
>NUL 2>&1 net.exe session
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: Administrator rights are required
GOTO ExitError
)
REM ---------------------------------------------------------------------------
REM Restore Device Configuration
REM ---------------------------------------------------------------------------
REM TODO: Comment out or change to meet your requirements!
ECHO INFO: Devices - Stop any running RTOS before device configuration
>NUL %RTEUPLOAD% -x
ECHO INFO: Devices - ensuring polling mode for the network card.
%RTEUPLOAD% -device "-noui rte_configure -int_mode:1
@PCI\VEN_8086&DEV_10D3&SUBSYS_07D015AD&REV_00\000C29FFFF2C515C00"
CALL :CheckRteRetVal "%ERRORLEVEL%"
IF ERRORLEVEL 1 GOTO ExitError
REM ---------------------------------------------------------------------------
REM Restore System Configuration
REM ---------------------------------------------------------------------------
REM TODO: Comment out or change to meet your requirements!
REM Ensure Windows uses the correct number of processors {always required}.
CALL :CheckBcdVal "Current" "NumProc" "%CPUCOUNTWIN%"
IF ERRORLEVEL 1 GOTO ExitError
REM Ensure APIC is not used by host {required when 1st core is a shared core}
CALL :CheckBcdVal "Current" "UsePlatformTick" "Yes"
IF ERRORLEVEL 1 GOTO ExitError
REM Disable Virtualization based security {required when using RA reservation: Firmware!=UEFI
and OS requires "MemoryStartAddress" }.
CALL :CheckRegVal "HKLM\System\CurrentControlSet\Control\Session Manager\Power"
"HiberbootEnabled" "0x0"
IF ERRORLEVEL 1 GOTO ExitError
REM ---------------------------------------------------------------------------
REM Restore Memory Configuration
REM ---------------------------------------------------------------------------
REM ---------------------------------------------------------------------------
REM Sub programs
REM ---------------------------------------------------------------------------
REM ---------------------------------------------------------------------------
:CheckBcdVal
SETLOCAL
SET "TMP_Store=%~1"
SET "TMP_Property=%~2"
SET "TMP_Value=%~3"
REM ---------------------------------------------------------------------------
:CheckRegVal
SETLOCAL
SET "TMP_Key=%~1"
SET "TMP_ValName=%~2"
SET "TMP_ValData=%~3"
REM ---------------------------------------------------------------------------
:CheckRteRetVal
SETLOCAL
SET /A "TMP_Error=%~1 & 0xFFFF"
IF %TMP_Error% EQU 0 (
GOTO ExitOk
) ELSE IF %TMP_Error% EQU 260 (
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : HiberbootEnabled set but not detected/corrected.
GOTO ExitError
)
) ELSE IF %TMP_Error% EQU 261 (
15.02.2021 Page 174/208
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : BadMemoryAccess allowed but not detected/corrected.
GOTO ExitError
)
) ELSE IF %TMP_Error% EQU 262 (
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : HypervisorLaunchTypeAuto set but not detected/corrected.
GOTO ExitError
)
) ELSE IF %TMP_Error% EQU 263 (
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : EnableVirtualizationBasedSecurity set but not detected/corrected.
GOTO ExitError
)
) ELSE IF %TMP_Error% EQU 4226 (
ECHO REBOOT : Required to update memory and/or device configuration"
SET /A "REBOOTREQUIRED=1"
) ELSE IF %TMP_Error% EQU 14932 (
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : LocalApic is in use by host but not detected/corrected.
GOTO ExitError
)
) ELSE IF %TMP_Error% EQU 14933 (
IF %REBOOTREQUIRED% NEQ 1 (
ECHO ERROR : LocalApic is running in unsupported x2APIC mode but not detected/corrected.
GOTO ExitError
)
) ELSE (
EXIT /B %~1
)
REM Use round brackets to get var value beyond 'endlocal'
(
ENDLOCAL
SET /A "REBOOTREQUIRED=%REBOOTREQUIRED%"
)
GOTO ExitOk
REM ---------------------------------------------------------------------------
REM Exits
REM ---------------------------------------------------------------------------
:ExitReboot
ECHO INFO: Reboot required
EXIT /B 2
:ExitError
EXIT /B 1
:ExitOk
EXIT /B 0
REM ---------------------------------------------------------------------------
REM End Of File
REM ---------------------------------------------------------------------------
Exit codes::
- 0 = RTOS was successfully started
- 1 = an unknown error occurred and RTOS could not be stated.
- 2 = a reboot is required before RTOS can be started.
Even on slow Intel Atom or Celeron systems that run with a nominal of a 500 MHz CPU, the interrupt
latency should never exceed approximately 30 to 40 microseconds. Using such a test application
together with a tool like “BurnIn Test”, you can evaluate your platform, disclosing any devices which
may be detracting from your system’s real-time capabilities.
The number of CAT-COS registers and the length of the settable bits are CPU specific and can be
queried using CPUID.
Using the uploader utility, details about RDT availability and configuration can be determined:
"RtosUpload.exe /nosleep /nowait /idshow 6,0,8"
For more information, please contact your support.
[Vmf\RDT]
"CatAllowed"=dword:1 ; 1=Enable (Default if value is omitted), 0=Disable
; Upper half of L2 cache; cache bit mask (Example for E3940 supporting 8 bits, each bit
corresponds to 1/8 of the whole cache)
"CatMaskL2Cos0Cpu0"=dword:F0
"CatMaskL2Cos0Cpu1"=dword:F0
"CatMaskL2Cos0Cpu2"=dword:F0
"CatMaskL2Cos0Cpu3"=dword:F0
; Lower half of L2 cache; cache bit mask (Example for E3940 supporting 8 bits, each bit
corresponds to 1/8 of the whole cache)
"CatMaskL2Cos1Cpu0"=dword:0F
"CatMaskL2Cos1Cpu1"=dword:0F
"CatMaskL2Cos1Cpu2"=dword:0F
"CatMaskL2Cos1Cpu3"=dword:0F
[Windows\RDT]
"CosIdxCpu0"=dword:0 ; CPU0: COS0 - Upper half of Cache
"CosIdxCpu1"=dword:0 ; CPU1: COS0 - Upper half of Cache
"CosIdxCpu2"=dword:0 ; CPU2: COS0 - Upper half of Cache
[Rtos\RDT]
"CosIdxCpu3"=dword:1 ; CPU3: COS1 - Lower half of Cache
[Vmf\RDT]
"CatAllowed"=dword:1 ; 1=Enable (Default if value is omitted), 0=Disable
"CatCdpAllowed"=dword:1 ; 1=Enable, 0=Disable (Default if value is omitted)
; Upper half of L3 cache; cache bit mask (Example for supporting 8 bits, each bit
corresponds to 1/8 of the whole cache)
;Settings to use without CPD:
"CatMaskL3Cos0Cpu0"=dword:F0
"CatMaskL3Cos0Cpu1"=dword:F0
"CatMaskL3Cos0Cpu2"=dword:F0
;Settings to use with CPD:
"CatMaskCodeL3Cos0Cpu0"=dword:30
"CatMaskDataL3Cos0Cpu0"=dword:C0
"CatMaskCodeL3Cos0Cpu1"=dword:30
"CatMaskDataL3Cos0Cpu1"=dword:C0
"CatMaskCodeL3Cos0Cpu2"=dword:30
"CatMaskDataL3Cos0Cpu2"=dword:C0
; Lower half of L3 cache; cache bit mask (Example for supporting 8 bits, each bit
corresponds to 1/8 of the whole cache)
;Settings to use without CPD:
"CatMaskL3Cos1Cpu3"=dword:0F
;Settings to use with CPD:
"CatMaskCodeL3Cos1Cpu3"=dword:03
"CatMaskDataL3Cos1Cpu3"=dword:0C
;... the maximum number of CAT-COS depends on CPU – currently up to 16. Enabling CDP cuts
them by half because each seting uses two masks.
[Windows\RDT]
"CosIdxCpu0"=dword:0 ; CPU0: COS0 - Upper half of Cache
"CosIdxCpu1"=dword:0 ; CPU1: COS0 - Upper half of Cache
"CosIdxCpu2"=dword:0 ; CPU2: COS0 - Upper half of Cache
[Rtos\RDT]
"CosIdxCpu3"=dword:1 ; CPU3: COS1 - Lower half of Cache
The number of MBA-COS registers and its possible value are CPU specific and can be queried using
CPUID.
Using the uploader utility, details about RDT availability and configuration can be determined:
"RtosUpload.exe /nosleep /nowait /idshow 6,0,8"
; 50%: max/2 on linear and 1 on non-linear throttling; bandwith throttling value (the
value depends on the CPU type used)
"MbaThrottleCos0Cpu0"=dword:1
"MbaThrottleCos0Cpu1"=dword:1
"MbaThrottleCos0Cpu2"=dword:1
"MbaThrottleCos0Cpu3"=dword:1
; Unlimited
"MbaThrottleCos1Cpu0"=dword:0
"MbaThrottleCos1Cpu1"=dword:0
"MbaThrottleCos1Cpu2"=dword:0
"MbaThrottleCos1Cpu3"=dword:0
;... the maximum number of MBA-COS depends on CPU. (E3940 CPUs do not support MBA)
[Windows\RDT]
"CosIdxCpu0"=dword:0 ; CPU0: COS0 - Limited Bandwidth
"CosIdxCpu1"=dword:0 ; CPU1: COS0 - Limited Bandwidth
"CosIdxCpu2"=dword:0 ; CPU2: COS0 - Limited Bandwidth
[Rtos\RDT]
"CosIdxCpu3"=dword:1 ; CPU3: COS1 - Unlimited Bandwidth
W7:
Change other settings of your graphics card, i.e., reduce the resolution and/or the number of
displayed colors. In some cases, you may want to try a different graphics card or a different
graphics card driver. You might try using a resolution of 640x480 and 8 bit colors, the least -
demanding settings, to determine if a latency problem is truly related to the graphics card
adapter.
Try adjusting the advanced BIOS settings for the graphics card. Experiment with limiting the
size or duration of DMA accesses.
Try changing the settings of your network card adapter. If it uses DMA, try another network
adapter that does not.
Eliminate USB or IEEE 1394 devices that use extensive DMA transfers (e.g. USB hard disks
or CDROM drives), or try changing their device driver settings.
W7:
14.5.1 Detection
If throtteling becomes active on a PC depends on its CPU, BIOS, OS and RTOS configuration.
CPU throttling can for example be detected using Windows “Resource Monitor”:
Throttling settings may be processor specific so the check should be done on the realtime assigned
processors. Therefor “RealtimeDemo” can be used which is part of RtE:
- RTOS-32: Start image “RealtimeDemo.bin”
- CE: Call “RealtimeDemo” from shell
- VxWorks: Call “demoStart” from shell
Please run RealtimeDemo again after changes to ensure throttling was successfully disabled.
14.5.2.1 PC BIOS
The BIOS may contain CPU configuration options called
- “C1E Support”
- “Intel® SpeedStep™” or “EIST” (“Enhanced Intel SpeedStep Technology”)
- Something containing “throttling”
These options should be disabled.
[Optimizations]
"ValueC1"=dword:1 ; omitted = 0 = disable, 1 = enable,
; Other value = enable + force model (Exmpl: 0x617=CPU Family 6 Model 23)
; Do no force a model without being prompted to do!
14.6.1 VMF
In combination with Hardware Virtualization support (see “VtAllowed” in chapter 5.5) there is another
option to suppress software SMIs:
[Optimizations]
"ValueD1"=dword:1 ; omitted = 0 = disable, 1 = enable
- Check– especially on a new platform – if you’re using the latest RtE version.
- If installing from network or inside VMWare, first copy all files locally and run setup locally.
- On InstallScript engine errors sometimes it needs to be updated. RtE Setup requires version
10:
http://support.installshield.com/kb/files/Q108158/IsScript101.zip
http://consumerdocs.installshield.com/selfservice/viewContent.do?externalId=Q108158&sliceI
d=1
can appear when running Setup on an OS not supported or when application compatibility
mode is activated for setup or a component.
2) If Safe Mode also can’t boot the Windows “repair console” should be used to rename the
driver RtosDrv to prevent it from being loaded:
“ren c:\Windows\System32\drivers\RtosDrv.sys RtosDrv_org.sys”
The repair console can started from the repair boot menu or when booting from the installation
disk. After renaming the driver the console can be left by calling “exit” to reboot the system.
Please contact support in case this solved the problem.
3) If renaming the driver did not help call “bcdedit /enum {default}” from the repair console:
When it shows a huge “badmemorylist” over multiple pages then please call
“bcdedit /deletevalue {default} badmemorylist”.
When it contains “firstmegabytepolicy = UseAll” then please call
“bcdedit /deletevalue {default} firstmegabytepolicy”.
After the call(s) succeeded the console can be left by calling “exit” to reboot the system.
Causes:
The IRQ of the Rtos-Device is shared with a Windows-Device. Rtos-Devices need an exlusive IRQ.
Causes:
The path or filename is not correct. The include filename is invalid or it is not located in the selected
path.
Before manually (means not using Setup) updating from one version to another the memory
reservation should be removed first.
Causes:
The frequency can be set for each processor using a config file entry:
[Processors]
“LocalApicTimerInputFrequency0”=hex:…
“LocalApicTimerInputFrequency1”=hex:…
The values are 64 Bit values and have to be provided in “Little Endian” format.
e.g.: hex:00,CA,9A,3B,00,00,00,00 for 1 GHz
e.g.: hex:B4,BE,F9,0B,00,00,00,00 for 200916660 Hz
This error indicates that the measured frequency will probably not be very accurate and reliable.
This might be acceptable in case no Realtime is required.
The limit can be configured using config-file entry
[Vmf]
"TimerMeasureDelayLimit"=dword:X
Please check chapter “14 Appendix A – Platforms and performance” for possible reasons and
solutions.
Reason Setting
Memory reservation has changed (size, RtosUpload:
limit, alignment, type) RtosUpload.exe /nosleep /nowait /memcfg "/a" /config "CfgFile"
Windows is already using LocalAPIC BCD-store:
st
(Sharing 1 core only) Bcdedit.exe /set "{current}" useplatformtick yes
Exclusive-Core configuration BCD-store:
Bcdedit.exe /set "{current}" numproc $ReplaceWithNumOfProcs$
Bootcode reservation failed (using Config:
ExclusiveCore only) [Upload] "BootCodeReservationForce"=dword:1
BCD Memory reservation failed BCD-store:
because functionality was disabled Bcdedit.exe /deletevalue "{current}" badmemoryaccess
OR
Bcdedit.exe /set "{current}" badmemoryaccess no
Windows is running in x2APIC mode BCD-store:
Bcdedit.exe /set "{current}" x2apicpolicy disable
Windows Hypervisor is enabled BCD-store:
Bcdedit.exe /set "{current}" hypervisorlaunchtype off
Windows Kernel DMA protection is Turn off at Windows Security:
enabled Device Security Core isolation details Memory integrity
Windows Device based security is Registry:
enabled Set values to ‘0’ at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceGuard
OR
Policy Editor:
Disable “Turn On Virtualization Based Security”
Hiberboot is enabled Registry:
Set ‘HiberbootEnabled‘ to ‘0’ at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Power
Command line parameters and options for installing .msi files can be found at multiple online
ressources. Some of them will be presented down at RtE Runtime descpription.
Install:
msiexec.exe /i "RteRuntime_x64.msi"
Uninstall:
msiexec.exe /x "RteRuntime_x64.msi"
Because the msiexec.exe call will return immediately and not wait until install/uninstall finished, an
alternative is using PowerShell. Special attention is required creating the correct parameter list.
PowerShell Silent install using non-default IP without installing RtosUpload with LogFile:
PowerShell; Start-Process -Wait -FilePath msiexec -ArgumentList /i, "RteRuntime_x64.msi",
VNETIP="192.168.10.1", ADDLOCAL=ALL, REMOVE=Feature.RtosUpload, /qn, /l*v,
"%USERPROFILE%\RteRuntimeInstall.log"
- “Realtime OS Driver”
Required driver for loading and accessing VMF and OS
- “Realtime OS Uploader”
Required application to communicate with “Realtime OS Driver”
- “Configuration Files”
Configuration files ae required to control the behaviour of the Uploader and VMF.
- “Realtime OS Service”
Optional Service for handling RtosLib functionality.
It is required if at least of this features should be usable by Windows:
SharedMemory, Events, TimeSync, TimeZoneSync
If not installed the config file entry "WaitForRtosCommSubsystems" must be set to “0”
- “Realtime OS Control”
Optional task bar application for showing message boxes in case of errors.
If not installed the config file entry “LaunchRtosControl” must be set to “0”
- “Debug Console”
Optional application to show information, debug messages and – depending on the product –
gain access to a console for accessing an OS.
The following steps are described for Windows 7 but the procedure is similar for previous versions.
Depending on your Windows version and driver signing policies you may see different dialogs.
The main difference is that you have to select the “Realtime OS Virtual Network Driver”. All other steps
are equal.
Create a new folder where the product should be installed to and copy all files from your installation
directory into that folder.(without “Setup.exe”, “ProductIcon.ico” and “autorun.inf”)
The number of files will depend on your product.
The service can be removed using the commands “STOP” and “UNINSTALL”.
The environment variable “RTE_ROOT” has to be set in the Windows system properties.
“Realtime OS Uploader” requires the variable “RTE_ROOT” to have the value of the product
installation directory – for example “C:\Program Files\acontis_technologies\VmfWin”.
Additionally the memory reservation is checked each time VMF is started and reconfigured
automatically if the settings in the config file had changed.
The debug console has only to be copied. There is no other installation required.
16.2.5 Os Image
To start an OS the config file and OS image must be passed as parameters to the Uploder.
In this case the complete parameter is:
After first time installation the Memory-Configuration might require a second reboot.
The name of the config file and OS image file are product depending. This example uses VfmWin so
please adapt this step to the product you’re using.