# Presentation: 069616

## Writing Your Own Custom IP Driversfor the IOC Blade 9010

**By Darrell Nineham**
**(darrell@hytec-electronics.co.uk)**

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 OJT, UK

## Introduction...

- Background.
- Brief Hardware Overview.
- Write Your Own Driver Notes.

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## General 

- All (including Source Code) Supplied FREE.
- EPICS 3.14.8.2.
- Scientific Linux Version 4 and RTEMS.
- Kernel Linux Version 2.6.
- Alternatives Windows XP / OPC, V-system etc.

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## Typical Non-EPICS Users...  

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## Typical TANGO Users...  

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## PCI Devices 

- 2 x PCI Devices / Interfaces.
- The first is 1 x PMC.
- The Second is 6 x IP Cards + Carrier Board Specific Registers.
- The IP Cards Access is Memory Mapped.
- The Carrier Board is I/O Mapped.

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## Carrier Board Hardware 

- 6 x Fan Speed Monitoring in RPM.
- Fan Override - Halt, Half  or Full Speed.
- 5 Temperature 0-40°C in discreet 10°C Steps.
- Individual IP Cards Clocks 8 / 32 MHz.
- Front Panel and Jumper Switches.
- LCD Automatic / Override with own Messages.

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## Why Write Your Own Drivers... 

- You May Want Extended / Different Functions.
- Any Hytec IP Card we will support.
- Legacy IPs to support.
- You May Choose IPs from another source.
- WARNING TO FOLLOW !

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

## Slide 9

## Method of IP Cards Drivers 

- Directly with Driver Calls.
- Via API.
- Memory Mapped (Hopefully Soon).

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Producing Your Own Quick Driver ...

- Go to http://www.hytec-electronics.co.uk/
- Download the EPICS Example the ‘Idiots Guide’ and IOCBlade9010.tar.gzip
- This is an EPICS example application and also includes a copy of the Hytec IOC Blade Linux Kernel 2.6 Driver under the Directory...   ***/IOCBlade9010/pci***
- To install the driver simply type..*** /root/IOCBlade9010/pci/IOC9010-load***

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Simple C Example ...

- #include "9010LinuxDriver.h”
- /* Open the Stream */
- IOCHandle = open("/dev/IOC9010",0);
- if (IOCHandle = = -1) printf("9010: Error Opening Device !\n");

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Simple C Example ...

- /* Set up the Data Structure */
- ioctl_buf.lAddress = IP_A_ID_BASE_ADDR + 					ID_MODEL_NUMBER;
- ioctl_buf.lLength  = 1;
- ioctl_buf.sData  = (unsigned long)(&data);
- /* Read IP Card Type from ID PROM */
- ioctl(IOCHandle, OP_GENERAL_READ, &ioctl_buf);

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Simple C Example ...

- /* Do Something With It */
- printf("IP Slot %c = %4X\n", 'A', data);
- /* Close the Stream */
- close(IOCHandle);

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Quick Reference Drivers include...

- 9010 Fan / Temp ao, ai, mbbi, mbbo etc.
- 8401 8 x 16 Bit ADC.
- 8402 16 x 16 Bit DAC.
- 8505 16 Bit Digital Input/Output Card.
- 8506 48 Bit Digital Input/Output Card.
- 8601 4 Channel Stepper Motor Card.

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## Full Drivers Written...

- 8601 4 Channel Stepper Motor Card.
- Completed 13 June 2006.  Debug Testing Now.
- Using AsynDriver Full Motor Record Support.
- Many Thanks to Nick Rees and particularly Peter Denison of Diamond Light Source.
- Written in about 3 Hours (45 min MRE).

- www.hytec-electronics.co.uk
- 5 Cradock Road, Reading, Berkshire, RG2 0JT, UK

## IOC Blade 9010  

- www.hytec-electronics.co.uk
- 5 Craddock Road, Reading, Berkshire, RG2 0JT, UK

- Any Questions / Help darrell@hytec-electronics.co.uk