160 likes | 183 Views
Spring 2013 – Diamond Light Source. OSI and Architecture Independent Device Driver. Jim Chen. (jim.chen@hytec-electronics.co.uk). HYTEC ELECTRONICS LIMITED. Spring 2013 – Diamond Light Source. Contents. The problem Things in common The solution Exceptions and caveats Conclusions.
E N D
Spring 2013 – Diamond Light Source OSI and Architecture Independent Device Driver Jim Chen (jim.chen@hytec-electronics.co.uk) HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Contents • The problem • Things in common • The solution • Exceptions and caveats • Conclusions HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source EPICS Device Support to “Device Driver” • Since introducing of asyn, EPICS device support actually becomes device driver • Asyn takes over the interfaces with records – the device support layer • Asyn standardize the interfaces to generic data type • Device driver only focuses on hardware access and controls ---- Much easier! HYTEC ELECTRONICS LIMITED
Con D C o Spring 2013 – Diamond Light Source What’s the Problem The operating systems: …… VxWorks Solaris Windows Linux Darwin RTEMS FreeBSD The architectures: Standalone via TCP/IP BUS PCI/PCIe/cPCI/PXI PMC VME ATCA/uTCA FPGA PCIe6335 EtherCat Raspberry PI Cubie board cPCI uTCA7003 IOC8800 VME8004 IOC9010 The processors (with different BSP or device driver): PPC (MVMExxxx) Intel (Concurrent/Tews/Acromag) ARM …… HYTEC ELECTRONICS LIMITED
Con D C o Spring 2013 – Diamond Light Source For a single ADC for example Linux VME uTCA cPCI Standalone IOC9010 IOC8800 … Raspberry PI /Cubie Board PC104 Concurrent Kontron … Eurotech Advantech … PPC Intel … • The BSP or processor device driver could be totally different • Some have kernel-user space like Linux, Windows. Some just have one space – VxWorks, RTEMS • VME architecture has AM code plus addr/data bit and even CR/CSR etc whereas PCI doesn’t HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Multiply by Different OS (An exaggerated figure) …… VxWorks Solaris Windows Linux Darwin RTEMS FreeBSD PPC PPC Intel Intel PPC PPC PPC PPC PPC Intel Intel Intel Intel Intel PPC PPC Intel Intel PPC PPC PPC PPC PPC Intel Intel Intel Intel Intel PPC PPC Intel Intel PPC PPC Intel Intel PPC PPC Intel Intel PPC Intel PPC PPC PPC PPC Intel Intel Intel Intel PPC Intel PPC PPC PPC PPC Intel Intel Intel Intel PPC PPC PPC PPC PPC Intel Intel Intel Intel Intel PPC PPC Intel Intel PPC PPC PPC PPC PPC Intel Intel Intel Intel Intel How about DAC, Scaler, Digital, SIO, Step motor, Timing modules, frame grabber….. HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Hold on – we’ve got OSI model OSI model – Operating System Independent. It takes over the operating dependant calls (interrupt, mutex, event, message queue, signals, thread, math etc etc) Yet down to the device driver level, we still face architecture differences and processor specific BSP/kernel driver differences HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Things in Common For all I/O moduels such as ADC, DAC, Scaler, Digital, SIO, Step motor, Timing modules, frame grabber etc devices…. • Register access • Memory access • Interrupt management • Most processors use PCI/PCIe to bridge the other side, implemented by Universe II/Tsi148/Plx chips • DMA or BLT or MBLT HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source The (my) solution – ipac + arch specific • Utilise Andrew Johnson’s ipac module + arch specific interface to BSP/kernel device driver • What ipac provides: • Generic base addresses mapping • ipmBaseAddr • Generic interrupt management • ipmIrqCmd • ipmIntConnect EPICS device driver Standard ipac/asyn interfaces Arch specific Interface • BSP or kernel device driver • mmap/sysBustoLocal • connectInterrupt/waitInterrupt • dmaInit/dmaRequest BSP/kernel driver • This applies to both carrier card case and normal modules as well (see examples) • The only thing ipac doesn’t have is DMA support at the moment HYTEC ELECTRONICS LIMITED
Con D C o Spring 2013 – Diamond Light Source Example 1 -- Carrier Card + IP IPs BUS Standalone VME 8004 IOC9010 PC104 PCIe 6335 ADC DAC uTCA 7003 uTCA 7002 IOC8800 Cubie board /Raspberry PI SCALER HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Example 1 -- Carrier Card + IP EPICS Device Driver Ipac-2.11 Linux VME Intel Concurrent Linux PCI/PCIe Intel RTEMS VxWorks/RTEMS VME PPC Intel PCI/PCIe drvHy8002.c drvTip810.c drvXy9660.c …… drvHy8002Concurrent.c drvHyLinuxCarrier.c drvHyRTEMSCarrier.c Hytec Kernel Driver + API cct Kernel Driver + API devLib2 devLib Device HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Example 2 – Micro Research Timing Module PXI PMC cRIO cPCI VME …… • They have the nearly identical (at least to now) register/memory configuration • They have similar interrupt scheme • MRF provides a generic API function set for Linux, based on memory pointer! • With the arch specific interface module in place, we can use this generic API for all HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Example 2 – Micro Research Timing Module EPICS Device Driver Ipac-2.11 VxWorks/RTEMS Linux cPCI Intel Linux VME Intel VME PPC drvMrfVMEPPC.c drvMrfcPCIcct.c drvMrfVMEcct.c …… Kernel Driver + API With CR/CSR support Kernel Driver + API devLib Device HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Exceptions and Caveats • mmap – not all OS support • Byte swap – endian problem. Not all processor boards support it. Then need be32_to_cpu etc. • Serial port, Ethernet. This needs device driver. Can be done by this model. • Standalone unit, like Raspberry PI/Cubieboard IOC8800, the interface cound be SPI or just I/O operations. We might be able to utilise the macro: be32_to_cpu – developing.. • DMA support – no common support in EPICS by far. Maybe a generic dmaInit, dmaRequest in ipac plus drvXXX.c? HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Conclusion • EPICS Device driver to hardware has common operations such as register, memory access, interrupt management and DMA operations • The ipac module happens to provide these services in standard interfaces. • We can utilise ipac plus OS/Arch specific module to mezzanine the OS/ARCH specific which hides the complex operations. • And it gives a common EPICS device driver for I/O peripherals – easy to maintain. • Discussion • Is this the right place? • A DMA interface? --- leave these to the core developers HYTEC ELECTRONICS LIMITED
Spring 2013 – Diamond Light Source Thank You! HYTEC ELECTRONICS LIMITED