ch13 - Central Processing Unit Operating System

You might also like

Download as pdf
Download as pdf
You are on page 1of 22
Drives and Standard Products SIEMENS Siemens Railway Automation system ® Kople Semiect ent dem Central Comput gi’ ‘Operating System vebgien V1.0 Soe os V 4,26 General Responsible : Biburger, AST 1D PE B T12C74 LP, - eisiy SI 6M Countersigned by: Pfaff, ASI.1 D PE B Tl © 1990-1994 Siemens AG SIEMENS Drives and Standard Products Contents 1, SIBAS 32 software structure 2. Powering up the system 3. Hardware interrupt management 4. Time slice monitoring 5. Background operation + Monitor commande + Background programs (B00 to B99) + Communication with DSP operating systens 6. Interfaces for user software 6.1 "Virtual interface" + Access to central computer hardware + system services 6.2 C interface 6.3 80387 software emulator 64 8. Protection mechanisms) 8.1 Division exception 8.2 "General ‘protection* 8.3 Ready monitoring ANNEX ‘A) Pin assignment for central comuter B) Bus assignment for SIBAS 32 - "large bu €) Bus assignment for SIBAS 32 - ‘small bu Operating System © 1990-1994 Siemens AG SIEMENS Drives and Standard Products 1 SIBAS 32 software structure The STBAS 32 software consists of three individual parts + STBAS 32 operating system + User software created with the SIBAS G tool + STBAS 32 monitor (PC program) ‘The operating system is stored in the "system FLASH" EPROM of the central computer. It is responsible for “powering up" the system, handling “exceptions” and hardware interrupts and managing time slices. Via an RS 232C interface it is able to conmunicate with the monitor program (PC)and to execute its commands. The ‘virtual interface" of the operating system permits access to the central computer hardware and makes system services available to the user software. ‘The code generated with the SIBAS G tool is written in the programming language C, and a monitor command is used to store it in the “user FLASH" EPROM. SIBAS G supports some of the C functions from the ANSI standard library. The code of this function is part of the operating aystem and can be called via the "C interface" SIBAS G basically generates five program parts, which are called by the operating system as subroutines a) Programs for initializing software and hardware b) Programs called because of a hardware interzupt (I1 - 16) c) Programs called by the tine slice management of the operating system (ma ~ 78) @) “Background” programs which run in the background and are called by SIBAS 32 monitor @) THandier"" routines Sy ~ overflow handles (m= 98) - Protection handler (G10) & = Handler for result overtiow és In addition to these program parts, sro generates the interface between User software and the operating system, (Ye user interface (transfer table) Operating System © 1990-1994 Siemens AG SIEMENS SANJONAS SAeMYOS Ss SIEMENS Drives and Standard Products Integration of the operating system in the overall system Generator of block Compiler, SG checker, SG librarian Block libraries Configuring engineer SIBAS G Sy User progi gt (*00c. PGES) “virtual interface" (Operating system interface) SIBAS 32 operating system Monitor STBAS 32 central, computer. . Subordinate computer SIBAS 32 ‘Operating System va ‘© 1990-1994 Siemens AG SIEMENS Drives and Standard Products 2 Powering up the system Powering up of the system is organized by the operating system; three operating modes are possible: 2.1 "Normal operation" In ‘normal operation", first all steps required to enable system itself to work’ properly are performed, for example: = Switch over to the protected mode of the 80386 = Load segment register = Load descriptor tables to RAM ~- Initialize hardware (e.g. service interface) ~ Initialize floating-point emulator - Initialize “virtual interface" - load "C interface" After the user RAM has been assigned with zeros, the user initialized depending on the user interface generated by S sequence is as follows 1. Load system constants 2. Call INT segments for each function package the operating software is SIBAS G. The Input and output connectors are initialized in the INI segment, STBAS ¢ sends the required initialization code = 2. Process entries in the start-up nanory OY & When setting up the user software, @heconfiguring engineer can use the monitor to initialize connect@sQFor this purpose, the connector and the required initialization @l@ are entered in the "start-up memory". This "overwrites" any ‘tor initialization configured before. This menory is located inghe buffered RAM and its contents consequently remains unchanged after power off. The operating system does, however, not process the "start-up menory" unless the following conditions are fulfilled: “Start-up memory" enabled via. "Applic. Buffer /Rele: Positive result of checksum test of the start-up met Setting of the BCD switch of the central -computer = a ory system service of the “virtual interface" enables the user to verify whether the “start-up memory" has been processed correctly. when new software is loaded, the “start-up memory* is automatically cleared. 4. Pi-class calls for each function package Blocks in the Pi class are called only during system start-up. The configuring engineer can consequently configure the initialization code. ‘The code of the POF segments, however, is already defined by the Person writing the block and is not tranferred to the graphics level. Operating System © 1990-1994 Siemens AG SIEMENS Drives and Standard Products S. calls of POF segments (Preset offline) for each function package ‘he POF segment contains code which is processed only once during System start-up. It contains calculations programmed by the person writing the block which are required for initializing the block. The PON segment is part of the segment. Due to the call sequence of Pi-class and POF segnent, a block running in the Fi class mist not have a POF section. 6. "Powering up* existing DSPs pefore calling the converter program, the operating system powers up eRe eEsSting signal processor modules, ‘The User Nas to take into EBSouue chat he BSP 'dees not access che dual-port RAM during BSSeURLsheion: daca required by the DSP for initializing mist, aa eee be entered within TINE, "Pi" or "FOF" in ene dual-port See SES the’ Gual-pore HAN must be brought into a defined state. During PA SOT SosGhe eke user has to call the apgropriate systen services tb provide valid software identifiers for SP program. The Spetating system of the DSP then checks Y che progran exists and opeeet Ans Syage to the operating systen.e ave central computer. The See entnges to “Monitor only” nede if pOeGuteware identifier is unknown es £$ Having checked the dual-port RAMs of t@ existing DSPs, the ct computer waits until all DSPs have completed their initialization and triggered their watchdogs A system service can be used to scan error messages from the oper: system (°VS_HLMELD") . ng 7. calling the "hardware initialization program" (69) ‘he hardware initialization program is called inmediately before the hardware interrupt is enabled. This enables the configuring engineer to piace initializing code at a defined location as is required, for example, when the watchdog responds the first time. 8. Enable hardware interrupt 9. Run-up message 10-Receive loop for monitor comands ‘Operating System © 1990-1994 Siemens AG SIEMENS Drives and Standard Products 2.2 "Monitor only" operation with ace: to user interface Press the "Monitor only" key when running up the system to change over to this operating mode. Monitor commands requiring access to the user interface such as display of connectors are possible in this operating mode. The user initialization Programs are, however, not run and the hardware interrupts are not enabled. ‘The central computer makes the existing DPSs go into "Monitor only’ operation too provided DsP reset is linked to the RESOUT signal of the central computer 2.3 "Monitor only" operation without acces to user interface If the BCD awitch of the central controller is set % or i user interface exists, pressing the "Monitor only system results in a changeover to this operatins = no valid jen running up the This operating mode could be required if the opgtyy & syeten erica co scrape wrong user invortace and, consauencig? g@voped the systen fron running up. This situation would, however, a systen err: which the user has no control ‘Operating System 7 © 1990-1994 Siemens AG 2 SIEMENS Drives and Standard Products Running up (te) Load segment register Load descriptor tables Load 'viualnteface” Inia hardware Lu Monitorkey pressed and seting of BCD swich comet? Yes Vaid ‘wanstor table? | User initialization: “topo Neat Power up DSPs (normal operation) Trae Rater eran (6) _ Monitor receive loo 7 i — — Execute ‘Operating System “8 © 1990-1994 Siemens AG % SIEMENS Drives and Standard Products Powering up the DSPs - [eames] fm an sore atce = mn ae . Operating System “- ©1990-1994 Siemens AG SIEMENS Drives and Standard Products 3 Hardware interrupt management. Six hardware interrupt inputs are available for the configuring engineer (connector x2: pin INTO to pin INTS). One of these interrupt inputs is connected to the timer output intended for tine slice monitoring (TIM1-O1); the rest can be assigned by the configuring engineer. He can freely decide which interrupt input to use for tine slice monitoring. The higher the number, the lower the priority of the interrupt input, that is INTO has the highest priority. Bach higher-priority interrupt interrupts an interrupt, with a lower priority. ‘The operating system manages the hardware interrupts and calls the corresponding user programs (NOR segmente of the I class) function-package by function-package The seventh interrupt input of the interrupt controller is reserved for a cyclic operating system interrupt in which the central computer communicates with the DSPs. ‘The NMI1 and NUI2 signals and Ready monitoring function of the central computer trigger an NWI which is also managed by the operating system. The operating system detects the cause of the SMT and syshequently calls the appropriate NMI handler (NMIi -> 19, NM=2 -> 110) Ti handler is called by the operating system if a user causes ee via the Monitor program (see “Hardw. RESET- command) . Consequeng je L_2U_NMr signal of the power-up management module (BSH) must be, led with the NMI] signal of the central computer (x2 pin £6). S 4 Time slice monitoring ‘The operating system provides eight time slices. Subroutine calls start the appropriate NOR segments of the T class for each function package in every time slice. The user configures the basic cycle (Tl) and defines the other time slices (72 to Té) as integral multiples of Tl. The individual tine slices are processed in sequential order and time slices with higher priority can interrupt time slices with lower priority (Tl has the highest priority). Hardware interrupts cannot interrupt tine slice processing unless their priority is higher than the priority of the time slice interrupt. Operating System T10- ©1990-1994 Siemens AG SIEMENS Drives and Standard Products Example: - 12 (pin INTL): Time slice management Tl, 12 = 2°71, T4 = 4*Ti Hardware interrupt (higher priority) Hardware interrupt (lower priority) ai UU UUW 2 Lf Lf Ey E 8 J. - IL (pin into): - 13 (pin INT2) 74 interrupt qt Monitor | : S& s Bach tine slice is monitored for overtiow and ehasSi@Sleing systen calis an cvercion nandiae (cb) if monitoring vespongat cont lgurine engineer Site envure thet Sanaters ace ores iene So ede ghee tae hice eee fanaier for Tie called whenever the tine AGES incense noes eaakeh Processing of has not Yor Seen complereds OOo alDierent acest era Sontigured for onitoring'ct tise siltes aa ve'38, Li munber of permitted overtious in sequence 2) asian Lebgth of overtior ab incepfal’ saltipte of the basic eyele If one of the two conditions is violated, the corresponding overflow handler is called. Processing the entire time slice management takes the operating system 64 his (based on: 80386 20 iz) ‘This time includes: = The time the processor needs for the time slice interrupt Processing all eight time slices including the call of an empty function package in TL = Saving the register Return jump froin thé time slice interrupt ‘Operating System. ~TT © 1990-1994 Siemens AG ® SIEMENS Drives and Standard Products Calling an additional function package takes the operating eysten approximately 4.4 us. At connector x12 of the central computer it is possible to determine which of the time slices Ti to 75 is currently activated (HIGH signal) Connector x12 pin 2: HIGH --> time elice management active pin 3: HIGH —-> TL active pin 7: HIGH —-> 12 active pin 6: HIGH --> 73 active pin 7: HIGH —-> T4 active pin 4; HIGH --> 75 active Interrupting time slice management by moans of lower-priority hardware interrupte For exceptional cases, the operating system permits time slice management to be interrupted by lower-priority hardware interrupts. The user informs the operating system via a system service which hardware interrupt is te ints ‘upt from which time level (12 to T8) (see also “Virtual interface") cannot be interrupted by a lower-level interrupt. ‘Two cases are possible 1.) Interrupt waile time slice management is actived At the earliest, time slices managenent is interrupted after the selected time slice and the hardware interrupt is processed. The interrupt program itself can be interrupted by higher-priority interrupts and time levels. Subsequently a return is made to time slice management which is then processed completely 2.) interrupt while tine slice managenent is not actived oo ¥ XE the interrupt progran is interrupted by the tighGiWe managenent Foutine, this Toutine is processed until: the Eine slice te reached fais nen peomatarely aborted, the lover ig che silcea ere, catia only after the incerrupt program has been tages and ime alice eo management has beer. reactivated 5 Background operation ‘The operating system operates the service interface for receiving and subsequently executing commands. from the PC monitor in the background. Monitor commands are, consequently, not executed if any interrupt program is active. The computer workload is therefore a decisive factor for the execution speed of monitor conmands. In extreme cases when interrupt programs require all of the computing capacity, ‘no monitoring operation is possible. ‘Operating System va © 1990-1994 Siemens AG SIEMENS Drives and Standard Products ‘The monitor and its commands are described in a separate manual: SIBAS 32 Central Computer Operating system Monitor’ Operating Instructions A conmand is used to make the operating systen load a B-class program and it then transfers background control to that user program. The background Programs can be started from the monitor menu via their configured menu titles and entries. Programs titled '_syS_' are not displayed in the monitor menu ‘The following procedure is applied for starting background programs of the user (B00 to 899) via the service interface: Send 0x00 to bring the operating system to a defined state. ‘Send 0x03 to interrupt any background program possibly started. ‘send 0x00 Send ‘0° and wait for the central computer to reflect the character This takes approximately one second if a background program was, still active. 5. Send menu title (8 characters; fill up with blanks if requized) Each character must be reflected by the central computer before the next character is sent. 6. Send menu entry (12 characters; fi11 up with blanks if required) Each character must be reflected by the central computer before the next character is sent 7. Send ‘0". This character is not reflected by the central computer 8. Wait for the central computer to report the start of the program by sending the character sequence 0x01, 0x08. If it sends 0x04, the menu title or menu entry was not found The central computer sends the character 0x2 when the background program has been terminated, It has to be taken into account that each character sent by the central computer must be reflected, which means that the receive routine of the PC program mirrors cach character received irrespective ©f the above procedure x, Co > A separate, relic hardware interne is avaliable gp gb operating tystem ite priority ie. however, lover than thet otber, haravare Eterrupte, the operating aysven’ consequently hy Eicitrouns level, which is used, for exanple, for commnicWigeuith the operating systems of subcomputers (signal processors) . Cc * Operating System 7B © 1990-1994 Siemens AG % SIEMENS Drives and Standard Products 6 Interfaces for user software 6.1 "Virtual interface" ‘The "virtual interface" is a data structure in the data area of the user Tt contains pointers to service routines of the operating system and their input and output parameters. The individual elements of this interface can be accessed via fixed system names. Using the ‘virtual interface’ makes it possible to program independently of the central computer and system interfaces For detailed information on this interface, please refer to the separate manual: SIBAS 32 Contral Computer operating Systen "virtual Interface" 6.2 C interface ‘The nunber of C function calls possible in STBAS 32 is limited. some ¢ functions use static variables and reentry is, consequently, not possible if only one user data segment is available as’ in STBAS 32. Such function calls are not possible in an interrupt-driven system. In addition, all function calls requiring PC hardware or a PC operating system have not been used. All possible function calls are listed below: abs, atoi, febs, Sselnun, iealpha, iscntrl, isdigit, isgraph, islower, isprine, ispunct. isepace, isupper, Lexdigit labs. Ss menchr, mencnp, mencpy, mennove, menset, ss sprintf, streat, stechr, stremp, strepy, strcoll,, sin, strlen, Strpbrk, strneat, stznemp, strncpy, strrchr, stgoaeecracr, tolower, toupper c veprineé 6.3 80387 software emulator ‘The operating system emulates the 80387 coprocessor. The emulator is, however, mot capable of reentry. The user must, consequently, ensure that coprocessor comands are used only during the initialization phase or in B- class programs Operating System Ta © 1990-1994 Siemens AG SIEMENS Drives and Standard Products 6.4 User interface (transfer table) ALL information the user program provides fcr the operating system are stored in the user interface. All program addresses, connector characteristics, identifiers and information on the required time slice management are stored in these vectored data structures. This interface is automatically generated by SIBAS G and is loaded together with the code into the FLASH-EPROM. ‘The user can access the contents of this interface via the ‘virtual interface". Direct access is not possible. 7 Memory structure and addressing ‘The 80386 processor assigns addresses relative to its segment start addresses. There are data segments, code segments and stack segments which are addressed via their segment registers (e.g. segnent cache register): Data segments via DS, ES, FS and GS segment register, Code segments via the Cs’ segment register and Stack segments via SS segment register Basically, these segments can be located anywhere in the address range and can have a maximum length of 4 Gbytes SUBAS 32 addresses data, 1/0 devices and code via the DS or CS segment register. These two segnents overlap and are defined by the operating system; the segment start (logical 0) is not at the phygical address 0. The protection mechanisms of the 80386 prevent addressing itwide this range Sr User programs and the C compiler can freely use for segment registers (ES. FS and Gs) but must first load then with gh @Sitents of DS and Cs All the other registers are also available to’ efter and need not be saved, except for the EBX register, which the oGfrating system expects to be unchanged. Data, 1/0 devices and code are stored for the user in a linear address area whereas the stack constitutes a segment of its om and can therefore be addressed only via the S$ segnent register. This prevents access to the stack.area via other segment registers. The stack cannot "overflow" since this would result in a "General Protection* of the 20386 Accessing an area which is not hardware-decoded causes ready monitoring of the central computer to respond. In this way, SIBAS 32-also prevents access to "gaps" in the data or code segment. The configuring engineer need not spend any time on segmenting and addressing since this task is performed by the SIBAS G tool and the operating system. ‘The figure below showing the "Menory:structuré and addressing" indicates the locations of main memory RAM, battery RAM, FLASH-BPROM and 1/0 devices It also illustrates where the operating system stores its segments. Addresses used for monitor commands are based on this segmentation. ‘Operating System TST © 1990-1994 Siemens AG SIEMENS Memory structure and addressing Central computer (80386 Dx) Drives and Standard Products . yss Operating system RAM ae; CA 16 Kbytes. Hi o201co00H i 020000008, i Operating system FLASH i 0.25 Moytes i o1rcooo0H ! oy OLELFFFFH| Internal I/0 device: o1E00000H| 0.125 Mbytes | o1co00008| | 16128 Kbytes o1aco00 Ext. 167128 Kbytes orao9900x| Ext. I/O devices with RDY X/os without RDY i - vo ge eae oxtareere oe Ss user Fiasi cf i 1.75 woyces i i | 5 ¢s,0s.e8 cxoov000H ‘User BRAT : tae moytes i Operating system BRA conooooon| st roves logical © < : | \ physical 0 _ Operating System “16 @ 1990-1994 Siemens AG SIEMENS Drives and Standard Products ‘The addresses for the external 1/0 devices must be entered in the hardware list for SIBAS G as related to I/O atart (1800000R) If the external 1/0 devices are to be accessed via the monitor, ‘this offset must be taken into account. csPoe csPit csp2h csP3# cspat css csP6# csP7h cspat Cspot csPio# csplié cspizé cspi3# spies csPise ‘The central computer can output up to 16 disk chipsell Cspi5#). The central computer distinguishes two 2/0 Range A: Range B: Entry in hardware list | Without RDY | With RDY | | | 00000000H | 002000008 | O1A200008 | | | { i | | | | | | | eieoso00n | o1a00000% 000200001 | o0220000% | | oxezooo0H sa0soooox | o0240000H | | oseaooc | oracoooo oo06o000x | oz60000% | | oreeooooH | orasooooit aaasoaoox | ovzsc0con | | oree00c0% | orasooooH sooaoooox | oozad0cox | | oreaooco# | o1axoooo sooceodox | oo2csos0x | | orecoosor | oracooooH 9aoE0090% | 002E000H | | o1eE0000H | OLAE0OOOH soxeoo00x | o0300000% | | o1s000008 | orpoooooH 90:20000% | oo3z0000% | | o1s20000H | oiB2.000% 90140000% | oosaoooH | | oxscoo00R | O1paooooH gorsoo00% | ooscaocox | | oiseoo00n | oipecoooN | oo1sc000% | oossco0H | | oxssoo0oH | oxpeo00on | coiaco0oH | cosaodcoH | | oxsaoa0on | otpacoooH | ooicooooH | ooscoooox | | oxscocoon | o1scooooH | ooiecoocx | oosz000o# | | osse0000n | o1seoooon | Josor to ee The central computer does not expos egKexternal Ready signal via pin b20 but generates the nal itself after a nunber of wait cycles have elapsegOrt assunes that it can then access the 1/0 devices. ‘The central computer expects a Ready signal (b20) when the I/O devices are accessed. If it has not received this signal within a waiting time, ready monitoring of the central computer responds. The operating system then calls the "protection handler* (G10) and enters an endless loop within this protection. As a result, all hardware interrupts remain disabled, the central computer watchdog elapses and a total disable is triggered. ‘Operating System “IT © 1990-1994 Siemens AG 7 SIEMENS Drives and Standard Products 8 Protection mechanisms 8.1 Division exception If a division causes a result overflow, the 80386 triggers a division exception. The operating system then positions the IP onto the conmand following the division conmand and uses a pointer (*SV_DPTR") to call the corresponding exception handler, which has to be created by the person writing the block. It must be ensured that this pointer has been loaded with a valid value before a division conmand is executed. Bach time this exception occurs, the operating system increments a counter which can be read by using the monitor. It also stores the address of the last division command causing an overflow; the monitor can be used to read this address too 8.2 "General protection" If a user program tries to access an address outside the assigned segment, fan exception is triggered ("general protection"). In this case, the operating system calls the “protection handler” (G10) in order to enable the user to react to this program error. The operating system renains in an endless loop within this exception after the “protection handler* has been processed. As a result, no more hardware interrupt programs are executed, the central computer watchdog elapses and a total disable is triggered. ch time this exception occurs, the operating system increments a counter which can be read by using the monitor. It also stores the address of the command causing the last "general protection"; the monitor can be used to read this address too. 8.3 Ready monitoring < Accessing an address which is not hardvare-decg§ejuithin a permitted segment ("gap") activates ready monitoring of@egwentral computer. the cperating Gysten then reacts in the sane waxGACe che case of @ "oenerel = protection". £ S Operating System “18 © 1990-1994 Siemens AG x SIEMENS Drives and Standard Products ANNEX A Pin assignment for central computer a { rl b 2 Aas i 337) 4 ABI ~ [aaa HBT BE 6 B3_——| ag | hs 8 BIO RBIT i —-aBi3 10 BIG ‘RBIS TSP 12 RESOUT RESOUTE t 34 PZ PIs To esPray 16 CEPSF SPIO] {OSPITF 18 | -~csrey——]—tsp7e | Perk —}—tspsy—} x1 20 | -—cEp3¥ SPU PF 22 CsP28 CsP1e i esPoe 38 ‘DEN# DI/RE ‘BIS DBLL ‘DBI2 DELa 28 DeiO DES p37 30 DBS DE DBd 32 ‘DES ‘DBO DBI { 4 2 WRICHD 4 6 mari WIDE 8 INTOF INTLE 10 INTSE INTS¥ 12 SINT RINT 14 16 - 18 [PORTING —|—PoRTINT —} [rome

You might also like