160 likes | 461 Views
Power PMAC as a Linux Computer January 2012. Power PMAC Linux OS. Linux is an open-source, public-domain operating system Standard Linux has a non-preemptive multi-tasking kernel The kernel provides an execution environment for different applications
E N D
Power PMAC Linux OS • Linux is an open-source, public-domain operating system • Standard Linux has a non-preemptive multi-tasking kernel • The kernel provides an execution environment for different applications • The kernel implements services and interfaces for the applications • Without pre-emption, cannot do hard real-time control tasks (e.g. servos) • Power PMAC uses pre-emptive real-time kernel replacement • Xenomai open-source real-time kernel • Handles all hardware interrupts itself, blocks them from regular Linux • Runs single real-time application to handle Power PMAC “foreground” tasks (phase, servo, real-time interrupt – built-in and user-written) • Releases to regular Linux as “general-purpose OS” (GPOS) when interrupt tasks are done • Linux GPOS can run multiple applications • Dedicated Power PMAC “background tasks” • User C subroutines and application programs
Basic Linux Commands • ls List directory • cd Change directory • mkdir Make directory • rmdir Remove directory • rm Delete file • mv Move or rename file • more List contents of text file • ps -e List active process • pkill Kill process • whereis Show full path to file • top –d 1 Display task manager window
Power PMAC Linux File System Types • ext2 (standard Linux file system) • Write-protected with hardware jumper • Protects against flash wear, user corruption of OS files • tmpfs (temporary file system) • Used for active memory of files in RAM, lost on power cycle • vfat (Microsoft fat32 file system) • For generic USB stick access • smbfs (Samba file system) • So can access Microsoft-type network directly • nfs (Linux network file system) • So can access Linux-type network directly
Key Power PMAC Linux File Folders • /opt – for Power PMAC software package, add-on packages • /var – for variable data stored by utilities and servers • /media – mount point for externally attached storage media • /media/usbdisk – mount point for USB memory stick • /media/sdcard – mount point for Secure Digital memory card • /media/shared – mount point for PC’s shared file folder • /root – administrator home folder • /bin – for essential Linux user commands • /dev – for device drivers • /lib – for essential libraries
The opt/ppmac File Folder • /opt/ppmac is folder for Power PMAC software package • Power PMAC Linux applications in this folder include: • gpascii – Basic ASCII communications terminal to controller • gather_csv – Data gathering reporting program • projpp – Application and project loader program • gppmac – Background Power PMAC task execution program • stepmove, parabolicmove – Tuning-move programs • getsends – Handles sent strings from Power PMAC script programs • geterrors – Monitors for alerts of specified error conditions • Power PMAC real-time drivers also in this folder • /opt/ppmac/usrflash has saved (non-volatile) storage of user’s application – write-protected except during save operation
The var/ftp/usrflash File Folder • /var/ftp/usrflash is top-level folder for active user configuration • Volatile folder in RAM (not in flash – despite folder name) • IDE loads project files into this directory on build/download • Copied from opt/ppmac/usrflash on power-on/reset • Commands in files then executed – including loading of programs into controller buffer • Copied to opt/ppmac/usrflash on save command • Sub-directory /Project contains user programs and project files • Sub-directory /PMAC Script Language contains Script motion and PLC programs • Sub-directory /C Language contains C routines and application programs • Sub-directory /Configuration contains project-management files • Sub-directory /Database contains system data for project • Note that programs can be loaded directly into controller program buffer, bypassing file system (but these cannot be saved)
Files and Folders for Power PMAC Projects • Project downloading copies files from PC into /var/ftp/usrflash/ folders in RAM • Script commands are then executed from these files, loading program commands into active buffers • save command copies files into /opt/ppmac/usrflash/ folders in flash memory (previous versions retained) • Power-up/reset copies files from flash into RAM, then executes Script commands from these files • Direct loading of program commands permitted, but no save possible
Power PMAC Modules gppmac C Application libplcc.so CPLC thread libppmac.so librti.so RTI thread Bkg thread High Latency User Space (100us max) RTI semaphore Shared Memory pshm Low Latency Kernel Space (20us max) rtpmac.ko usralgo.ko usralgo.ko libppmac.ko libppmac.ko .ko files are kernel objects (device drivers) .so files are shared libraries (dll)
Power PMAC Modules • rtpmac.ko – Interrupt handler, a few driver calls – PMAC phase, servo, RTI • libppmac.ko • Useful kernel driver function library (i.e. Custom Math Library) • Functions in libppmac.ko can be called from user custom algorithms • usralgo.ko • Custom servo and phase routines written by customer in C • gppmac – executes functions in library to create PMAC background • libppmac.so • RTI thread - librti.so – custom routine created by IDE loaded by libppmac.so if UserAlgo.RtiCplc = 1 • Custom routine triggered by semaphore (special OS flag posted every RTI) • Cplc thread - libplcc.so – custom routine created by IDE loaded by libppmac.so if UserAlgo.BgCplc = 1 • Custom routine triggered between each background Script PLC scan • Background Thread • Executes background Script PLC programs • Triggers CPLC thread