User`s manual

Dynamic C Users Manual digi.com 113
7. THE VIRTUAL DRIVER
Virtual Driver is the name given to some initialization services and a group of services performed by a
periodic interrupt. These services are:
Initialization Services
Call _GLOBAL_INIT()
Initialize the global timer variables
Start the Virtual Driver periodic interrupt
Periodic Interrupt Services
Decrement software (virtual) watchdog timers
Hitting the hardware watchdog timer
Increment the global timer variables
Drive uC/OS-II preemptive multitasking
Drive slice statement preemptive multitasking
7.1 Default Operation
The user should be aware that by default the Virtual Driver starts and runs in a Dynamic C program with-
out the user doing anything. This happens because before main() is called, a function called
premain() is called by the Rabbit kernel (BIOS) that actually calls main(). Before premain() calls
main(), it calls a function named VdInit() that performs the initialization services, including start-
ing the periodic interrupt. If the user were to disable the Virtual Driver by commenting out the call to
VdInit() in premain(), then none of the services performed by the periodic interrupt would be
available. Unless the Virtual Driver is incompatible with some very tight timing requirements of a program
and none of the services performed by the Virtual Driver are needed, it is recommended that the user not
disable it.
7.2 Calling _GLOBAL_INIT()
VdInit() calls the function chain _GLOBAL_INIT() which runs all #GLOBAL_INIT sections in a
program. _GLOBAL_INIT() also initializes all of the CoData structures needed by costatements and
cofunctions. If VdInit() is not called, users could still use costatements and cofunctions if the call to
VdInit() was replaced by a call to _GLOBAL_INIT(), but the DelaySec() and DelayMs()
functions often used with costatements and cofunctions in waitfor statements would not work because
those functions depend on timer variables which are maintained by the periodic interrupt.