# Presentation: 217404

## Linux EPICS IOC SupportIndustry Pack and Stepper MotorStatus ReportEPICS Meeting at IHEP

- August 2002
- Marty Kraimer

## Overview

- First presented at EPICS meeting at BESSY in May 2002
- Describes work in progress to support Linux PC IOCs
- First Target Applications:
- Synchrotron Beam line Applications
- Working with Tim Mooney's group at APS
- Some APS/ASD (Accelerator) Applications
- Example: Monitoring Conventional Facility data
- First Hardware Support
- OMS PCI Motor support (Joe Sullivan from Tim Mooney's group)
- PCI Industry Pack Carrier
- Serial, gpib, adc, dac, digital I/O.

## VISION

- LINUX REPLACES VXWORKS
- BUT: Linux isn’t a real time operating system
- Non-pre-emptive kernel => no context switch while kernel active.
- Interrupts can be disabled for long periods of time.
- Worst case can be 100s milliseconds. (2.4 Kernel)
- Future
- Development kernel is pre-emptive.
- Work in progress so that interrupts disabled for short times.
- Other possibilities
- RTLinux
- RTAI
- RTEMS

## Modified VISION

- Existing Linux good enough for some Applications.
- 2.6 Kernel will be good enough for more Applications.
- If small part of Application needs strict real time.
- Use RTLinux/RTAI.
- For demanding Apps use RTEMS or stay with vxWorks.
- RTEMS
- Open Source
- Tests show real time performance equivalent to vxWorks
- Not as complete an environment as vxWorks
- Well supported by R3.14
- Eric Norum and Till Straumann are very interested in it.
- See EPICS 3.14 home page and Till's talk at BESSY EPICS meeting.

## Initial Goals

- Industry Pack Support on Linux IOCs
- Standard PC platforms original goal
- In the future
- CompactPCI
- Other platforms, eg. VME
- Work with Tim Mooney’s group (synApps)
- Joe Sullivan working on PCI based motor support.
- IP + Motor => usable for some beam line applications.
- Expect there will be a lot of interest.
- Requires Message Passing Facility (MPF)
- When IP+Motor support ready some synApps can be done.

## Industry Pack Support

- Industry Pack: Small Low Cost I/O Modules
- PCI40A IP Carrier: SBS GreenSpring Modular I/O
- PCI bus card that holds four IP modules
- Fits in standard PCI slot.
- MPF and synApps supports following IP modules:
- SBS IP Octal Serial:  eight serial ports
- SBS IP488: GPIB interface
- SBS Ip-uniDig: family of Digital I/O modules
- Acromag IP330: ADC; 16 bit ; 16 channel DI or 32 channel SE
- Systran DAC128: DAC; 8 channel; 12 bit DAC
- Goal is to support all of this on Linux

## Progress

- Linux Kernel support now exists for
- Generic IP carrier support (Like ANJs IPAC support)
- PCI-40A: SBS Quad IP Carrier for PCI Bus
- IP-488 (Green Springs GPIB IP using the ti9914)
- IP-Serial (Green Springs IP-Octal)
- Simple driver for OMS PCI Motor driver (Proof of Concept only)
- Message Passing Facility (MPF) ported to 3.14
- Lots of cleanup.
- Ran several tests successfully
- Still at preAlpha stage
- Gpib and Serial still very buggy!!
- No Documentation

## Implementation Strategy

- Clear Separation between Linux and EPICS
- Linux drivers have NO knowledge of EPICS
- Separate development area. Separate releases.
- Usable by non-EPICS and non-MPF users
-  Linux char drivers (ioctl calls heavily used)
- Drivers written with real time performance goal
- Allow complete transaction with single user level call
- Read, write, writeRead typical request
- Allow easy addition of code called by interrupt handlers
- For now testing with ordinary user level process
- Later will test using real time scheduling
- Will try multi-priority iocCore (existing 3.14 does not do this)

## PCI40A Support

- Generic IP Carrier Support
- Similar to what Andrew Johnson did for drvIpac
- The PCI40A driver registers with the generic interface
- Additional carrier drivers can be added
- Individual IP module drivers interface via generic support
- cat /proc/industryPack
- Reports all industry pack modules
- PCI40A driver registers with the generic interface
- IP module drivers call the generic interface

## Some Details aboutGPIB support

- SBS (GreenSpring) IP-488 Industry Pack module.
- Linux kernel driver
- Interfaces to generic IP carrier
- gpibLinux.h describes user level interface (Linux ioctl calls)
- requestRead, requestWrite, requestWriteRead, requestCmd
- Each is single kernel call.
- EPICS code
- Implements Benjamin Franksen’s interface
- Usable by for any GPIB device support that uses Benjamin's code
- For Test the DG535 support code was ported to 3.14
- Easy port
- Works for awhile on Linux before crashing!!!

## Some Details aboutSerial Support

- Linux kernel driver
- serialLinux.h describes user interface.
- Uses Linux ioctl calls.
- requestRead, requestWrite, requestWriteRead
- requestConfig: baud rate, stop bits, etc.
- requestSniff: report all I/O for requested amount of time
- requestSetInputHandler:
- Defines Input Handler interface
- Interrupt code calls registered handler for each input character
- Standard input Handler provided
- Easy to add additional handlers.
- Some testing but not complete. Not yet interfaced to MPF.
- Will also support the Linux tty interface.

## Still to do

- IP330 (ADC): Nothing implemented now.
- Existing IP330 allows floating point in interrupt handler
- Not allowed in Linux Kernel
- DAC128V (DAC): Nothing implemented now
- ipUnidig (Digital I/O): Nothing implemented now
- OMS Motor support
- Have sent/received commands from OMS PCI Motor driver
- Joe Sullivan from Tim Mooney's group is working on support

## Immediate Plans

- Make the GPIB and serial drivers more reliable
- GPIB
- Find and fix bugs
- Serial
- Implement Linux tty interface
- Find and fix bugs
- Document IP carrier, gpib, and serial drivers
- Create alpha release under the EPICS open source license

## After Alpha Release

- Interface serial support to MPF
- Implement support for digital, and analog i/o
- Linux Drivers
- Interface to MPF, i.e. to EPICS
- Work with Tim’s group to support synApps on Linux
- Look for APS/ASD applications.
- Many many records use IP serial support.
- Many use IP330 support.
- Monitoring only and not time critical
- Work on real time performance
- IOC: Spawn a real time process and use multipriority posix threads
- When available use 2.6 Linux Kernel

## Possible Future Tasks

- Allow user level to access IP register space?
- Is this a good way to go?
- Is this better than kernel drivers?
- What about interrupts?
- Successor to IP?
- PMC?
- PC*MIP looks dead
- PCI based Transient Recorder?
- ???